Google

Wednesday, April 28, 2010

FreeBSD w/ XFCE continued

This is a continuation of my previous post. A few updates; flash plug-in cannot be installed from packages, it has to be done from the ports collection. In order to do that I had to download the ports zipped archive and extract it on the drive.

To get flash installed, I had to:

cd /usr/ports/www/linux-f10-flashplugin10 && make install

Just in case I also installed the opera-linuxplugins and nspluginwrapper packages; not sure if it was necessary.

To make Opera see the flash plug-in, I created a symbolic link in the opera folder.

ls -l /usr/local/share/opera/bin/libflashplayer.so
lrwxr-xr-x 1 root wheel 60 Apr 24 00:04 /usr/local/share/opera/bin/libflashplayer.so -> /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so




Wednesday, April 21, 2010

FreeBSD 8.0 w/ XFCE on an old laptop

Recently I got hold of an old Dell laptop (Pentium III / 1Ghz / 256 MB / 20G) and decided to put it to use. The obvious choices for an operating system were FreeBSD and Linux. For a while I wanted to brush up on my Linux skills and was thinking of either Debian (or Sidux) or one of the Redhat related distributions (Fedora or CentOS). But due to sheer laziness (I had the FreeBSD CD lying around + I am more familiar with it) I decided to go with FreeBSD.

The installer crashed on me when I accidentally selected the option of loading drivers from a floppy, but most of the install was done by then. The only things I didn't configure was networking (more on that below) and date.

The laptop came with a Linksys USB wireless card which was detected by the operating system without issues. Configuring the network was very easy, because I had PCBSD installed on another laptop. All I had to do was to copy
/etc/wpa_supplicant.conf

network={
ssid="freebsdap"
psk="freebsdmall"
}

some settings from /boot/loader.conf

and a few lines from the

/etc/rc.conf
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"

Installing packages was next on the task list. I decided to go with stable packages and changed the PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/. Since the resources were scarce (only 256 MB of RAM) I wanted a lightweight system. Nevertheless I needed some functionality like flash, a movie player, and printing support. Below is a short script that installed the desired packages.


#! /bin/csh

pkg_add -r compat5x-i386 compat6x-i386 compat7x-i386 cups-base cups-client cups-image cups-pstoraster cups-smb-backend dbus fusefs-ntfs linux_base-f10-10_2 linux-f10-xorg-libs opera

opera-linuxplugins linux-f10-tiff linux-f10-sqlite3 linux-f10-png linux-f10-openssl linux-f10-openldap linux-f10-nss linux-f10-nspr linux-f10-libssh2 linux-f10-jpeg linux-f10-gtk2

linux-f10-fontconfig linux-f10-flashplugin linux-f10-expat linux-f10-cyrus-sasl2 linux-f10-curl linux-f10-cairo linux-f10-atk polkit portupgrade xorg xorg-apps xorg-fonts-75dpi xorg-fonts-cyrillic

xorg-fonts-miscbitmaps xorg-fonts-truetype xorg-fonts-type1 xfce4 xfce4-battery-plugin xfce4-conf xfce4-datetime-plugin xfce4-mailwatch-plugin xfce4-mixer xfce4-notification-daemon

xfce4-time-out-plugin xfce4-xkb-plugin xfce4-wm-themes vlc foomatic-db foomatic-db-engine foomatic-db-hpijs foomatic-filters >& pkg_log.txt


echo 'dbus_enable="YES"' >> /etc/rc.conf
echo 'polkitd_enable="YES"' >> /etc/rc.conf
echo 'hald_enable="YES"' >> /etc/rc.conf

echo 'linux_enable="YES"' >> /etc/rc.conf

When pkg_add was done, I checked the number of installed components and it was > 370. Provided that I will need some more in the future.

In order to bring up the XFCE desktop, I created the .xinitrc file in my home directory and typed startxfce4. The XFCE desktop took a while to come up on that machine, I have to investigate the reason for that. Something that I realized was that 256MB of RAM won't cut it, since XFCE was using up most of it and if I were to start a browser with Flash for example, the system would start swapping like crazy.

Next to do (in order of importance):
  1. Get an extra 256 MB of RAM.
  2. System configuration (pf.conf, rc.conf -> fsck, linux, powerd).
  3. Configure sound (should be easy, just follow the handbook).
  4. C Shell configuration (nice prompt).
  5. Setup printing.

Wednesday, April 30, 2008

Back in the wxWidgets



I decided to go back to programming with wxWidgets and I don't regret it even one bit. In fact I enjoy it a lot.
Before I went back to programming wx, I tried to do as much coding as I could in Java. However despite some niceties, I saw quite a few things that I wasn't fond of.

  • Swing doesn't have a calendar/date picker control, which I needed on two occasions.
  • I witnessed NetBeans do some weird stuff - it complained about some code, even after I had deleted it. Probably a bug in Java compiler?
  • My company is still using JVM 1.4.2, and that version is slower and lacks support for certain features that are present in 1.6.
I do not particularly like database programming with wxODBC classes, it definitely is not as easy as doing it with JDBC, but so far I got everything working just fine. Also, wxWidgets doesn't use exceptions, which is quite disappointing for a modern C++ library; I however read through the exception handling overview in wx documentation and found out that I could throw my own exceptions and handle them quite nicely.

My experience in coding GUI programs in C++ did not start with wxWidgets. When in college I took an MFC course. At the time it looked amazing, because up until then we had been able to do only console programs in C or C++. MFC is probably more stable, because it has been used by many more people than wx. On the other hand, wx programs can be ported to other platforms with little or no effort. I also like the API much better than the one of MFC.
Compare:

Creating a push button -
in MFC:
m_wndButton1.Create (_T("CLICK"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rect, this, IDC_BUTTON);

in WX:
searchBtn = new wxButton(WxNoteBookPage3, ID_SEARCHBTN, wxT("Search"), wxPoint(154,272), wxSize(75,25), 0, wxDefaultValidator, wxT("searchBtn"));

Adding a root item to a tree control -


in WX:
wxTreeItemId id = m_treeCtrl->AddRoot (wxT("Root"));

in MFC:

HTREEITEM item = m_treeCtrl->InsertItem (_T("Root"));

Wx is much cleaner and much more C++ like if you ask me.

Anyway, I am glad to be back programming in C++ and wxWidgets.

Monday, April 14, 2008

PCBSD in VMWare

Wednesday, October 3, 2007

Matrix




Friday, September 14, 2007

Mplayer plugin

680 news is one of my favorite radio stations. They have traffic updates every 10 minutes, weather forecasts and tons of useful information. I was wondering if I could hear it on my FreeBSD machine. Appears that I could. The mplayerplug-in took care of that. All I had to do, was to install the port and it took care of installing the plug-in, such that Firefox could find it upon startup.

Here's the screenshot.

Saturday, September 8, 2007

FreeBSD 3D desktop

I happened to have a few spare minutes and an older MSI video adapter (which was based on ATI Radeon), so I decided to try to follow Dru Lavigne's article, called "Fun with Xorg", one of many in the excellent FreeBSD Basics column.

The driver for the card (radeon.ko) was already loaded, the dri package installed; all I had to do is edit xorg.conf and install the 3ddesk package. Looks pretty cool I must say.