Dreams of Thought

Are dreams thoughts… or are thoughts dreams..

RSS Feed

Archives for technology

The Internet must die so the Internet can live

0 Comments

We are used to the idea of the Internet being free – free as in Freedom, though not always in price. It is difficult to accept government control over something we have so carefully guarded. But it is coming whether we like it or not. You may be in a democracy (the United States, India) or you may be in a dictatorship (China). Governments everywhere are trying to take control. Along with the government, powerful organisations (MPAA and RIAA, for eg.) will also get control. We do our best to prevent our loss of control, but over time those with power will win. We have to accept this fact.

Having accepted the fact what can we do about it? Rewrite. It is time we moved towards the new Internet. The new Internet will have many challenges to solve. Censorship is only one of the many challenges. Connectivity is another. While average Internet speeds have increased over the years, we still haven’t seen the huge jumps promised by the next big improvement (TM). Connections are unreliable – be it in the skyscrapers of New York or the villages of Africa. The are many technical challenges to solve.

While those with power have many weapons at hand – court orders to new laws – we have one weapon they don’t have. We are smart. We know science. Before it’s too late, before they take away the Internet from us, we must fight back. The new Internet needs to grapple with all these issues. It must be deliberately decentralised so that any attempt at censorship would be technically infeasible. We are taking baby steps, but we have light years to go before we sleep.

Filed under technology
May 19, 2012

Illegible captcha

0 Comments

How in heaven’s name am I supposed to fill this one! :)

 

( click on image to see a bigger one )

illegible captcha

Filed under technology
Aug 1, 2011

How to log requests to specific paths on Apache

0 Comments

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.

Filed under technology
Jun 23, 2011

WordPress – Unable to create directory error when uploading images

0 Comments

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.

Filed under technology
Nov 16, 2010

How to generate a QR code to a link online

0 Comments

QR code

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).

Filed under technology
Oct 28, 2010

How I recovered my Thunderbird mail from backup

0 Comments

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 :P ) 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 Aardvarkhttp://vark.com/t/eee11d. I got replies from Shel and Moez. I would like to thank both of them for helping me out.

Filed under technology
Feb 2, 2010

Comparison of Google Public DNS and Open DNS response

0 Comments

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.

Filed under technology
Dec 5, 2009

User agent GTB or GTB5 is the Google Toolbar

0 Comments

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.

Filed under technology
Oct 5, 2009

Gingerjoos.com visitor stats on a map

0 Comments

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.

visitors to gingerjoos.com blog

visitors to gingerjoos.com 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.

Sep 10, 2009

Copying files from one unix box to another with scp

7 Comments

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 :)

Filed under Linux, technology
Jul 31, 2009