How in heaven’s name am I supposed to fill this one!
( click on image to see a bigger one )
Are dreams thoughts… or are thoughts dreams..
It is possible to log requests to specific paths of your website in your Apache log. Imagine you need to log all access requests to www.example.com/widgets/ path and whatever is under it in a separate file. You can use a combination of the CustomLog directive and SetEnvIf directive to achieve this. The SetEnvIf directive needs the mod_setenvif module enabled.
On a Linux machine you can do this by using the a2enmod command. On my Ubuntu I ran
$sudo a2enmod setenvif
On a Windows machine you probably need to edit the httpd.conf file in the conf directory of your Apache installation directory.
Once this module is enabled you can issue such directives from your VirtualHost configuration.
The CustomLog directive allows you to specify how and where logging should be done. The last parameter that this directive takes is an environment variable. This environment variable can be set the with SetEnvIf directive conditionally. What you would do inside the VirtualHost definition of the domain is something like this
SetEnvIf Request_URI '^/widgets/' widget_page=yes
CustomLog ${APACHE_LOG_DIR}/widgets.example.log combined env=widget_page
The SetEnvIf module above sets the widget_page variable as yes if the Request URI matches the regular expression '^/widgets/'. The CustomLog directive below it directs Apache to log a request in the combined format if the widget_page variable is set.
Unable to create directory<DIRECTORY NAME> . Is its parent directory writable by the server?
This error seem familiar to you? I got this error when trying to upload an image on wordpress. I checked the directory mentioned in the error and it did not exist. It so happened that Dreamhost had moved the my blog to another server. WordPress was trying to save the image to a location that existed in the old server. I went to Settings -> Media Settings -> Uploading Files and then changed the "Store Uploads in this folder" setting to "wp-content/uploads". Before the changed it pointed to the directory in my old server. This change fixed the problems with uploading files.

A QR code is a 2-dimensional bar code. Barcodes are commonly found in the packages of products you buy and often hold a unique number. This unique number is often used to refer to a product. There are many online databases which allow you to then lookup this number and match it with the product.
You can use the QR code generator at http://qrcode.kaywa.com/ to generate QR code to your link, phone number or some text. To verify, you can use the Barcode scanner app or Google goggles on your Android phone
(Hint : those are available when you search for them in the Android Market).
So the best way to backup your mails from Thunderbird is to copy your complete profile directory. Follow these steps for restoring your mail.
The fool that I am, instead of copying the full profile directory I ended up backing up just the Mail subdirectory in the profile directory. It took me a while to figure out how to restore the backup, so I thought I would share it with you.
The first thing you do is install Thunderbird (if you haven’t already). Now Run( Windows : Start->Run or press Win key+r ; Mac/Linux – you’re smart enough to know
) this command “thunderbird.exe -profilemanager”. Create a dummy profile – just have some dummy email address in there. Now exit Thunderbird.
Next step is to find your newly created profile directory. Locate the Mail directory in there. Now you have to copy 2 files from your backup – both have the same name. One has a .msf extension and the other has no extension. I had created a separate thunderbird mail folder with a filter and I needed to backup just that one alone. So I just copied those 2 files (from the Inbox.sbd directory) and put them in the Local Folders subdirectory in the Mail directory (which already had empty files like Trash and Trash.msf).
The file without extension – this is the actual mail file. It’s in the mbox format. The other is an index file.
Acknowledgements :
I posted a question on Aardvark – http://vark.com/t/eee11d. I got replies from Shel and Moez. I would like to thank both of them for helping me out.
Google announced that it’s making 2 DNS servers available publicly. The servers are 8.8.8.8 and 8.8.4.4 . They’ve also given configuration instructions on their DNS page. I configured my /etc/resolv.conf to refer to Google’s DNS. Before this I ran some quick tests using dig to compare it with OpenDNS.
$ dig @208.67.222.222 gingerjoos.com ; <<>> DiG 9.4.2 <<>> @208.67.222.222 gingerjoos.com ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1273 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;gingerjoos.com. IN A ;; ANSWER SECTION: gingerjoos.com. 14400 IN A 208.113.199.196 ;; Query time: 751 msec ;; SERVER: 208.67.222.222#53(208.67.222.222) ;; WHEN: Fri Dec 4 09:13:58 2009 ;; MSG SIZE rcvd: 48 $ dig @8.8.8.8 gingerjoos.com ; <<>> DiG 9.4.2 <<>> @8.8.8.8 gingerjoos.com ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2594 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;gingerjoos.com. IN A ;; ANSWER SECTION: gingerjoos.com. 14400 IN A 208.113.199.196 ;; Query time: 616 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Fri Dec 4 09:14:09 2009 ;; MSG SIZE rcvd: 48 $ dig @8.8.4.4 gingerjoos.com ; <<>> DiG 9.4.2 <<>> @8.8.4.4 gingerjoos.com ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34741 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;gingerjoos.com. IN A ;; ANSWER SECTION: gingerjoos.com. 14321 IN A 208.113.199.196 ;; Query time: 123 msec ;; SERVER: 8.8.4.4#53(8.8.4.4) ;; WHEN: Fri Dec 4 09:15:28 2009 ;; MSG SIZE rcvd: 48
Dig allows you to directly query a DNS server and get its reply. It shows stats from that query – response. The stat we’re interested in is this one
;; Query time: 123 msec
The IP 208.67.222.222 is the address of the OpenDNS server. Let’s try one more query
$ dig @208.67.222.222 mec.ac.in ; <<>> DiG 9.4.2 <<>> @208.67.222.222 mec.ac.in ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44308 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;mec.ac.in. IN A ;; ANSWER SECTION: mec.ac.in. 604800 IN A 210.212.232.132 ;; Query time: 389 msec ;; SERVER: 208.67.222.222#53(208.67.222.222) ;; WHEN: Sat Dec 5 12:38:57 2009 ;; MSG SIZE rcvd: 43 $ dig @8.8.8.8 mec.ac.in ; <<>> DiG 9.4.2 <<>> @8.8.8.8 mec.ac.in ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56600 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;mec.ac.in. IN A ;; ANSWER SECTION: mec.ac.in. 160448 IN A 210.212.232.131 ;; Query time: 121 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Sat Dec 5 12:39:06 2009 ;; MSG SIZE rcvd: 43
You can try more queries and see for yourself. At least as of now Google DNS seems to be faster.
Was checking out this blog’s visitor stats recently when I came across this User Agent "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5". I was wondering what GTB5 was. Some googling and testing later I found out that GTB is in fact the Google Toolbar. To compare, here’s the UA of a Firefox browser with Google Toolbar installed :
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5"
And here’s another Firefox without it :
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"
Also, if you plan to capture the UA string in the Apache logs, make sure that feature is turned on. Your LogFormat directive must have something like \"%{User-Agent}i\" in it. For eg,
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
You can check the Apache documentation on custom log formats for more info. If you’re using XAMPP/LAMPP, you might want to comment out
CustomLog logs/access_log common
line in your httpd.conf and uncomment
CustomLog logs/access_log combined
line.
My friend Arun Prabhakar recently started playing around with some visitor stats reporting for his site. He has been gracious enough to extend the service to his friends and now the public as well(by invitation only)
The service is still in beta, so occassional hiccups might occur. He’s been adding more and more tools to complement the visitor count. You can check out the stats on the right sidebar of this blog. So if you want to put in a nice stat counter for your blog or website, head over to http://stats.kitiyo.com/.
He’s just completed a see-your-visitors-on-a-map feature. Here’s what it looks like for this blog.
He has very kindly provided a limited-time special invitation code for Gingerjoos.com visitors
Use the invitation code iwantitbadly to sign up for the service at Kitiyo stats.
ssh is a very powerful and widely used protocol in all the Unices. If you’ve used the ssh client in your Unix/Linux box, you must have realised how indispensable it is. There is another indispensable tool that uses the ssh protocol – scp (secure copy). scp was meant to be an alternative to unsecure tools like rcp. It has since replaced most such programs. Since scp uses the ssh protocol, the encryption it uses ensures security of your data.
Using scp is simple. It works almost like the regular cp command. The basic syntax is
scp SOURCE DESTINATION
In order to specify the SOURCE or DESTINATION we have a special syntax.
USERNAME@HOST:PATH
Let me give you an example :
$scp anirudh@box:/var/www/html/test.html gingerjoos@linux:~/test_dir/
Copy /var/www/html/test.html in the machine called “box” as user “anirudh” to the box called “linux” as user “gingerjoos” to the path HOMEDIR/test_dir/
That’s it
Simple, right?
To copy the file to our localmachine, we could do this
$scp anirudh@box:/var/www/html/test.html ~/workarea/
This would copy the file test.html in the machine called “box” (as user anirudh) to the localmachine at path HOMEDIR/work_area/
Interchange the source-destination to copy file in your localmachine to the remote machine.
If you want to copy whole directories, use the ‘-r’ flag(recursive copy)
$scp -r ~/workarea/ anirudh@box:~/workdir/
Since scp is tied to the ssh program, the keys you use to set up passwordless login with ssh works for scp as well.
Got questions? Got something to add to this? Post your comments below
My friend Arun created an Intel 8085 microprocessor simulator as a hobby project sometime in his college. It’s written with php and javascript.
If you’re into 8085 programming, do try it out and let me/Arun know.
http://labs.kitiyo.com/8085/free-online-assember-simulator-8085.html