“free” command to determine ram/memory usage in FreeBSD

People moving from Linux to FreeBSD get confused when they need to determine ram/memory usage. Although there is no equivalent command, there is a nice perl script located at http://people.freebsd.org/~rse/dist/freebsd-memory. Just download and run the perl script, and it gives a formatted output of your memory status. Something like:

# fetch http://people.freebsd.org/~rse/dist/freebsd-memory
# perl freebsd-memory

In case  you need to mimic the linux command, simply set the execution bit and move it to bin.

# fetch -o /usr/local/bin/free http://people.freebsd.org/~rse/dist/freebsd-memory
# chmod +x /usr/local/bin/free

You should now be able to use “free” command without any problems from anywhere within your system.

Amitabh Kant

Advertisement

Desigining interfaces for web application

I have generally been involved in creating one or the other web application all throughout for the last 8-9 years. The languages have been different, VB.net. C#, Perl, PHP, JS etc, but the basic idea has always been creating some sort of web app. Generally while the app has been “relatively” easy to create, the only point I always had problem was coming up with a consistent design interface for the apps that i would be building.

Recently I came across this wonderful site about interface design, http://www.designinginterfaces.com/ , which explains in pretty easy terms about the whole concept of interface design. I would recommend it to anyone who is involved in any sort of web applicaiton design.

Cheers
Amitabh

Installing & configuring Lighttpd with PHP on FreeBSD

Recently, I had to install Lighttpd on a FreeBSD server. Now generally I install Apache as a web server, but this time because of the gains that Lighttpd has over Apache, I decided to give it a go. The following instructions have been primarily taken from http://trac.lighttpd.net/trac/wiki/TutorialInstallation, some changes primarily being for the path to more suit FreeBSD defaults.

Install lighttpd from ports (Update the ports tree before this)

cd /usr/ports/www/lighttpd
make install clean

Make sure you have enabled FastCGI support in PHP.

Enable Lighttpd in rc.conf and edit it’s configuration:

echo lighttpd_enable="YES" >> /etc/rc.conf
cd /usr/local/etc/
cp lighttpd.conf.sample lighttpd.conf

Create some directories and files:

mkdir /usr/local/www/lighttpd
mkdir /usr/local/www/lighttpd/log
mkdir /usr/local/www/lighttpd/data

touch /usr/local/www/lighttpd/log/lighttpd.error.log
touch /usr/local/www/lighttpd/log/lighttpd.access.log

Make your new directories and files accessible by the user and group “www” that Lighttpd operates as:

chown -R www:www /usr/local/www/lighttpd

Edit lighttpd.conf

vi /usr/local/etc/lighttpd.conf

Change the values for directories and files as follows:

server.document-root = "/usr/local/www/lighttpd/data" 
server.errorlog = "/usr/local/www/lighttpd/log/lighttpd.error.log" 
accesslog.filename = "/usr/local/www/lighttpd/log/lighttpd.access.log"

Save and exit from the editor.

Test to make sure Lighttpd starts up properly:

/usr/local/etc/rc.d/lighttpd start

If you need to, you may shutdown lighttpd this way:

 /usr/local/etc/rc.d/lighttpd stop

And then restart it with this:

/usr/local/etc/rc.d/lighttpd restart

If you get an error that says “permission denied”, check to make sure that the files and directories mentioned exist AND that user www has permission to operate on them. Also be sure that lighttpd.conf has been corrected from the non-working default version. If you get no errors, put an HTML file in /usr/local/www/lighttpd/data and try to load it up in your browser. If everything works, now enable PHP.

Edit lighttpd.conf once again

# vi /usr/local/etc/lighttpd.conf
  • In section “server.modules” uncomment the line “mod_fastcgi”
  • Uncomment the entire section “fastcgi.server”
  • Add the following lines under “socket” in the “fastcgi.server” section:
		"bin-path" => "/usr/local/bin/php-cgi",
		"broken-scriptfilename" => "enable"

Now make some more files and directories:

mkdir /var/run/lighttpd
touch /var/run/lighttpd/php-fastcgi.socket

Make your new directories and files accessible by the user and group “www” that Lighttpd operates as:

chown -R www:www /var/run/lighttpd

Dubai trip

I have been on a small business trip to Dubai, UAE. Really amazed by the amount of construction activities going on in the entire place. All around you can see large buildings, malls and shops. One has to be inside one of these malls to see their expanse. Just went to Mall of the Emirates, and while I am no shopping addict, but the it’s one big mall. It has its own artificial ice skiing place.

Adding a few images of my trip, hopefully will have more time to click a few more pictures now that official business has been completed and I have two more days to roam around.
Now this was taken from the hotel I was staying in for the first two days:
front_building.jpg dubai_skyline3.jpg dubai_nightime3.jpg

Ten rules for startups

This is the one the best pages I have seen for anyone running a small IT/web company:
http://evhead.com/2005/11/ten-rules-for-web-startups.asp

And one of the best quotes:

#9: Be Agile
You know that old saw about a plane flying from California to Hawaii being off course 99% of the time—but constantly correcting? The same is true of successful startups—except they may start out heading toward Alaska. Many dot-com bubble companies that died could have eventually been successful had they been able to adjust and change their plans instead of running as fast as they could until they burned out, based on their initial assumptions. Pyra was started to build a project-management app, not Blogger. Flickr’s company was building a game. Ebay was going to sell auction software. Initial assumptions are almost always wrong. That’s why the waterfall approach to building software is obsolete in favor agile techniques. The same philosophy should be applied to building a company.