First of all you need images to show as wallpaper. You can easily get them from various wallpaper sites on the web. Make sure you store the files in a single directory - you can organize them into sub-directories if there are too many.
Install feh which is an application for viewing images. This is in /usr/ports/graphics .
There are other wallpaper setting applications which can be used:
Once installed, run fbsetbg (fluxbox set background) . Run it first with fbsetbg -i which makes sure that there is a suitable application to set the wallpaper. You can now set the background wallpaper by using the command
fbsetbg -f /path/to/graphic/file
Eg. fbsetbg -f /var/data/wallpaper.jpg
You can even specify wildcards and fbsetbg will set the first matching file as the wallpaper.
Given below is a sample full-blown fluxbox installation.

Most people keep bash as their preferred shell program in FreeBSD. The problem with bash is that it does not come as part of the default FreeBSD package - it has to be installed as a third party application either using pkg_add or by compiling it from ports.
chsh -s /usr/local/bin/bash
If for some reason your ports tree has corruption or the bash port or a supporting port has not been updated properly, you might get locked out from the system the next time you try to log in. The problem would be that root uses bash for login and bash is not working in the ports so you can’t get in.
The way around such a case is to log in to single user mode and set the root shell back to something like sh or tcsh.
To prevent such a thing from happening in the first case, always keep the root shell as something which is not dependent on third party libraries. If you must keep bash then link it statically from ports by specifying WITH_STATIC_BASH during building.
My own preference is install bash but keep csh as the root shell. Once I have logged in to root, I manually run bash and then continue using bash.
A crucial part in installing FreeBSD again over a corrupt or existing FreeBSD installation is knowing how to recreate the disk partitions. By default, even if you change the disk geometry and slicing configuration, the actual changes will be written to the disk, only when installation of files is about to start.
In such a case, if your existing partitions have data, you may very well end up with a situation where FreeBSD says that there is not enough space to install the new files.
To make FreeBSD ignore existing data on the disk, once you have completed configuration press W either in the FDisk screen or in the Disk Labelling screen.

FDisk Screen
W is not a key that is listed in the help commands but it works. It ‘W’rites the new disk configuration to the disk and thereby invalidates all existing partition configuration and data.

FreeBSD will warn you once before committing the Write. For obvious reasons, this step should not be taken if you are installing FreeBSD for the first time in your disk.
Overview
I get a lot of requests from people who want to put up a google map in their blog (which most of the time is Wordpress) but they have no idea how to do it. Unlike embedding a google map in a standard web page , a simple pasting of the map script will not work in Wordpress.
The best way to show a google map as part of a Wordpress blog post is to make it a Wordpress Plugin. For most non developers, creating a Wordpress plugin is simply not worth the trouble as it takes too much knowledge of PHP and the Wordpress API . For PHP developers who are proficient in PHP but have never worked with Wordpress code before, the task of making a WP plugin can be a little daunting at first. It takes some time and some trial and error to understand how a WP plugin works.
For both the above kinds of people I thought it would be a good idea to create a simple Google map plugin for WP which can be used by anyone who just wants to show a map in WP. This basic plugin can also form a base for creating a more complex map plugin if required.
It is assumed the reader already knows how to paste a google map in a standard web page. I am just going to deal with the basics of writing a WP plugin and how to plug the google map into it.

The Plugin Deployment
The plugin has the following files :
The plugin is available as downloadable zip file here. To install the plugin in your WP blog
How It Works
The main plugin file is index.php. The entire plugin is created as a class which gets instantiated only once. This class can have any methods or atrributes that is required. WP does not place any restrictions on the internal functioning of the class.
In our class we have defined a method called loadData which gets called in the constructor. For now this method does nothing but can be used to run any initialization tasks required for the class to function.
The main method which handles the displaying of the map is showMap(). This method acts as the main point of contact between the WP blog and the Google map. There are a few WP functions which are used in this function. They are explained below:
The showMap() checks whether the current page is the homepage or a post or a content and then shows the map in all three cases.
function showMap($content) {
global $post;
$url = get_bloginfo('wpurl');// this is to get the current WP base url
// check if this is a post
if ($post->post_type == "post" && !is_home()) {
$more_content = file_get_contents($url . "/wp-content/plugins/gmapplugin/showmap.php");
return $more_content. $content ;
}
// other pages and not homepage
if ($post->post_type == "page" && !is_home()) {
$more_content = file_get_contents($url . "/wp-content/plugins/gmapplugin/showmap.php");
return $more_content . $content;
}
else {
// show map in homepage
if (is_home()) {
$more_content = file_get_contents($url . "/wp-content/plugins/gmapplugin/showmap.php");
return $more_content. $content ;
}
}
return $content;
}
There is a function at the bottom of index.php called add_filter(’the_content’, array(&$GMS, ’showMap’));
This is an inbuilt WP function which adds third party code to its event queue or processing pipeline. This line tells it to add this class into the list of classes which will filter “the content”
Enhancements and Changes
It is unlikely that anyone would want to show a map in every post or page. To fix that, you can filter on the $post->ID for showing maps only if particular posts are shown.
You can also filter on custom fields added to the post while editing it. This can be done using get_post_meta($pageId, ‘custom_field_tag’, true) . If the current post has this particular custom field value then it will return true and the map can be shown.
append() and prepend() methods: similar to appendChild, except jQuery accepts a string, a DOM element, or a jQuery object as valid arguments. jQuery converts the argument into a text node or element depending on what is passed.
$("#leftNav ul").append("<li>after the last <li></li>"); // adds <li> at the end of <ul>$("#leftNav ul").prepend("<li>before the first <li></li>"); // adds <li> at the start of <ul>$("#leftNav ul").append($("#mainContent h2")); // moves headers from the mainContent to the leftNav
$("#leftNav ul").append($("#mainContent h2").html()); //copies text of the first h2, adds it to leftNavThere are two similar methods — appendTo() and prependTo() — which are basically inververted verstions of append() and prepend(). A.append(B) is about equal to B.appendTo(A)
Note: As shown in example 3, if you try to append an element that already exists in the DOM, that element will first be removed from DOM before being reinserted, or appended, in the new location.
before() and after() methods: similar to insertBefore() method (and the non-existant, but found in many javascript libraries, includeing this one, insertAfter()). The after() method inserts a node after a selected one. The before() method inserts a node before a selected one, like the javascript standard method of insertBefore().
$("#leftNav ul").before("<h2>Left Navigation</h2>"); // adds header before the <ul>$("#leftNav ul").after("<h4>New Header</h4>"); // adds header after the <ul>$("#leftNav h4").before($("#mainContent h2").html()); //copies text of the first h2, adds it to leftNav before our new <h4>There are two similar methods — insertBefore() and insertAfter() — which are basically inververted versions of before() and after(). A.before(B) is about equal to B.insertBefore(A)
Well I have been using Windows XP for a very long time now and I am quite happy with it. Even after when Vista was launched ,I kind of stuck with XP because I found Vista to be a real pain. Most of the things in Vista were quite complicated and for doing a very small thing we had to go through a lot of confirmations and pop-ups and screens which was quite annoying for a user sometimes.
Well then came windows 7 which I recently loaded onto my desktop just to try it out because I got good reviews from my friends and connections , I thought maybe I should give it a shot once . So after installing Windows 7 , I am quite satisfied with it till now . It works fine on my machine , it still has some complications for users like me who are very used to working on XP , but still a lot better than Vista by far .
Initially I found myself stuck with a small thing like changing the hibernate option settings on Windows 7 . I couldn’t find the way to enable the hibernate option as I easily did on XP but after going through few options and settings I finally found the way ,so just thought that I would put it up over the internet.
Steps to enable the hibernate option on Windows 7 :
1)

personalize
first just right click on the desktop and then click personalize in the menu list
2)

screensaver
then click on the screen saver icon on the right-bottom corner of the window
3)

power option
a window will open after you click on screen saver and on that there will be a text written as ” change power settings ” , click on it which will open another window
4)

select power plan
now when you see a window like above , find the link given as ” change plan settings ” on the right side of the window , corresponding to the power plan currently being used for the computer (indicated on the left-middle side of the window with a highlighted radio-button)
5)

edit plan settings
after that you will again see another window having a link given as ” change advanced power settings ” , click on that to manage the advanced power settings
6)

change advanced power settings
a small window will open with several options displayed as a list , from that list look for an option called ” sleep “, click on that option to expand it further for listing more options
7)

sleep
now you will see another extended option called “ allow hybrid sleep ” , click on it to display the options in it which will show setting as ” ON ” (default value) , now you just have to change it to ” OFF ” in the drop down box to enable the Hibernate option for your Windows.
8 )

hibernate after
now there are several other power options which can be changed , like for example there is an option called ” Hibernate After ” which is used to set the time duration after which the computer will go into hibernation automatically if no user is using the machine or no work is being done by the operating system (in this case Window 7)
You can set it in form of minutes like 60 mins or 120 mins or even 111 mins to be precise or you can disable automatic hibernation by choosing 0 (zero).
9) When you are done with your settings , just click on the ” Apply ” button of the window to save your settings and then click “ Ok “ to confirm - Or - you can directly click on ” Ok ” button to save and confirm at the same time .
10)

hibernate enable
now after changing the settings , when you go to the start menu , you will get see another option called hibernate in the shutdown button .
Well i started of from right clicking on the desktop and then navigated to the power options , to reach the power options window there is a another way to go through the control panel in the start menu .

control panel
here you will get to see a lot more options for you windows which are very useful , but right now we are going to look at the part of windows hibernation settings , so there is an option called “ Hardware and Sound “, click on it to go to the next window .

hardware and sound
now on this window you will see the link ” Power Options “, clicking on which will go to the window which you see in the above stated step number (4) .
Well after that, all the steps from step (5) are the same .
Dec 09
23
To change default settings for Xterm, a file called .Xdefaults needs to be in the home directory for the logged in user (root for admin) . Generally the default font size in xterm is always too small to be used, specially in high resolution screens. This can be changed in .Xdefaults.
A sample .Xdefaults is given below:
Dec 09
23
A tutorial on installing PHP from the FreeBSD ports for Apache and MySQL.
What you need to add to the httpd.conf file and which of the PHP5 ports to choose.
Choosing which port to use
In the past there were several ports for PHP such as /www/mod-php5, /lang/php5-cli, and /lang/php5. Since the release of PHP 5.1.14 there is now only /lang/php5 This port now allows you to choose if you want to install the CLI, CGI, and Apache module.
CLI stands for command line interpreter. It is used for running PHP scripts from the command line and makes creating shell scripts very simple if you already know PHP. The Apache PHP Module is disabled by default, so make SURE that if you plan to use this for web work that you enable it.
Installing the port
Since all PHP ports are now combined you will need to configure it to be sure the parts you need are built.
# cd /usr/ports/lang/php5
# make config
# make install
When you run make config you will be shown a list of options. To use PHP with Apache make sure the Apache Module box is selected.
Once php has installed you will need to install the extra modules for things such as MySQL. These modules are all located in the ports. Some of the most common modules are
/usr/ports/databases/php5-mysql - MySQL Database
/usr/ports/www/php5-session - Sessions
/usr/ports/graphics/php5-gd - Graphics Library
Adding the PHP 5 module to Apache
Apache needs the following lines in the httpd.conf file to use php. These lines should already be added by the port but if you have problems you should double check your httpd.conf file. Note that Apache 2.x does not need the AddModule line.
# Apache 1.3.x
LoadModule php5_module libexec/apache/libphp5.so
AddModule mod_php5.c
# Apache 2.x
LoadModule php5_module libexec/apache/libphp5.so
If you installed using the port and had apache installed already it should do this automatically for you.
Next find your DirectoryIndex section in your httpd.conf file. Apache is set up for PHP 4, but not PHP 5 currently so you will need to modify it and change the 4s to 5s like this.
<IfModule mod_dir.c>
<IfModule mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.php3 index.html
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.php3 index.html
</IfModule>
</IfModule>
<IfModule !mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.html index.htm
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.html
</IfModule>
</IfModule>
</IfModule>
This code is telling Apache to open index.php first you have the PHP 5 module loaded. You can change the order as you wish. Or if you just wanted to skip it you could simply add the following line to the httpd.conf file since you know you are going to have php 5.
DirectoryIndex index.php index.html index.htm
Now apache just needs to know what it should parse the PHP files with. These two lines should be added to the httpd.conf file, and can be put at the bottom if needed.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
If want to use PHP code inside of .htm files you can just add on those extensions.
AddType application/x-httpd-php .php .htm .html
Configuring PHP
Settings for PHP are stored in /usr/local/etc/php.ini You will need to create this file by copying it from /usr/local/etc/php.ini-dist
# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
In this file you can set the memory limit for programs. Turn on global variables if you must, set the max file upload size, and everything else you need.
Testing PHP
Once you have restarted Apache so the changes take effect you are ready to test it. To test it run the following command to create a php file that you can attempt to run
# echo “<? phpinfo(); ?>” >> /usr/local/www/data/test.php
Then point your web browser to http://yourdomain.com/test.php and if it works you will see several pages of information on your PHP settings. If it did not work you will see only the text you typed in.
Dec 09
23
Installing Apache2.2
Make sure you update ports and then run the following commands:
# cd /usr/ports/www/apache22
# make install clean
That will install apache2.2
Configuring apache2
Lets edit the httpd.conf file:
# vi /usr/local/etc/apache22/httpd.conf
Scroll down and change the following settings. The optional settings I will put OPTIONAL before the setting:
OPTIONAL: Listen 80 - You can change this default option if you have more than one apache server running on your network
User www - Changes what user apache runs as
Group www - Changes what group apache runs as
ServerAdmin you@example.com- change you@example.comto your email address.
DocumentRoot “/usr/local/www/apache22/data” - I don’t usually use the default path. I put my www documents on a seperate drive.
Directory “/usr/local/www/apache22/data” - Change this to the same path as DocumentRoot (See above)
<Directory /usr/local/www/apache22/> Change this to the root of your vhosts folder
DirectoryIndex index.html index.html.var - add any pages you would use. For instance, add index.php if you use php pages
OPTIONAL: #CustomLog /var/log/httpd-access.log combined - I usually leave this commented unless you want to use this to track users looking at your site
ScriptAlias /cgi-bin/ “/usr/local/www/cgi-bin/” - change this to your cgi-bin path
Directory “/usr/local/www/cgi-bin”> - change this to the same path as ScriptAlias /cgi-bin above
Now lets tell apache to start:
# apachectl start
and hit Enter on your keyboard
We now need to tell Apache to run on startup. Please run the following command:
# echo ‘apache22_enable=”YES”‘ >> /etc/rc.conf
If you get no errors, apache should be running. Look at the page by opening a browser to http://localhost or replace localhost with the IP or the actual hostname of the box. If you went with the DocumentRoot defaults, You will see an apache test page until you get your site up and going. If you are behind a router or firewall, make sure you forward the apache port (Port 80) to the FreeBSD box otherwise you won’t be able to get there from here.
Configuring SSL
Let’s get SSL Configured and Installed:
(FROM http://www.bsdguides.org/guides/freebsd/webserver/apache_ssl_php_mysql.php)
# mkdir /usr/local/etc/apache22/ssl.key
# mkdir /usr/local/etc/apache22/ssl.crt
# chmod 0700 /usr/local/etc/apache22/ssl.key
# chmod 0700 /usr/local/etc/apache22/ssl.crt
Create Certificate
Now, you need to understand that one server can hold multiple certificates, but only one per listening IP address. So, if your server is listening on one IP address, you can only have one certificate for the server. Follow me so far? All of your virtual domains can share the same certificate, but clients will get warning prompts when they connect to a secure site where the certificate does not match the domain name. If your server is listening on multiple IP addresses, your virtual hosts have to be IP-based — not name-based. This is something to consider when creating your certificate.
Change to your root dir by typing in the following command. We want to save this configuration there as a backup.
# cd /root
# openssl genrsa -des3 -out server.key 1024
You will now be prompted to enter in a password. Write this down as you will need it later. We need to make a Certificate Signing Request (CSR):
# openssl req -new -key server.key -out server.csr
Enter your password when it asks for it. Make sure you enter your FQDN for the “Common Name” portion.
Self-signing your Certificate
You could always pay money to Verisign or Thawte for this but it costs $$$. Here is the way to do it:
# openssl x509 -req -days 365 -in /root/server.csr -signkey /root/server.key -out /root/server.crt
Now your cert is good for 365 days. If you want to make it longer, go right ahead and do so ![]()
If you would like more information about SSL Certs, go to http://httpd.apache.org/docs-2.0/ssl/ssl_faq.html#aboutcerts
Now we need to copy the certs to the right place:
# cp /root/server.key /usr/local/etc/apache22/ssl.key/
# cp /root/server.crt /usr/local/etc/apache22/ssl.crt/
Now to give them the right permissions as well:
# chmod 0400 /usr/local/etc/apache22/ssl.key/server.key
# chmod 0400 /usr/local/etc/apache22/ssl.crt/server.crt
We will now want to copy the default httpd-ssl.conf from the extras folder to the Includes folder:
# cd /usr/local/etc/apache22/extra
# vi httpd-ssl.conf
Now modify the following:
DocumentRoot “/usr/local/www/data” - Change the path to your httpd.conf document root.
ServerName www.example.com:443 - Change www.example.com to your domain name.
ServerAdmin you@example.com Change this to your email address
ErrorLog /var/log/httpd-error.log - You can leave this or comment it out.
TransferLog /var/log/httpd-access.log - You can leave this or comment it out.
SSLCertificateFile “/usr/local/etc/apache22/ssl.crt/server.crt”
SSLCertificateKeyFile “/usr/local/etc/apache22/ssl.key/server.key”
One additional thing you will need to do is open up /usr/local/etc/apache22/httpd.conf and comment out the following line:
Include etc/apache22/extra/httpd-ssl.conf
Now run the following:
# apachectl stop
# apachectl start
The start means it will start in ssl mode to serve both http:// and https:// addresses. This used to be apachectl sslstart but that command has been depreciated.
The URL below includes instructions on how to remove the pass phrase prompt when apache starts
http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#removepassphrase
Mar 09
18
This is an exercise in using the object oriented concepts in Javascript to implement a doubly linked list.
There is a class called Node which encapsulates the actual node in the list. The linked list is implemented as a global object with class variables and methods to:
The Node object simply stores a string. There is scope for further improvement, as always. The source is easily available by viewing the page source. Any comments and recommendations for changes or improvements are welcome.
You can see the implementation here