jump to navigation

Incorrect name resolution to 1.0.0.0 in Debian Lenny while using DSL 502-T ADSL router August 9, 2009

Posted by razasayed in Hacks.
Tags: , , , , ,
add a comment

I was facing a strange problem in Lenny, wherein any websites i tried to access  from the console were resolving to 1.0.0.0 .Because of this apt-get update was not working . Also, other applications requiring network functionality like the x-chat irc client were not working .

So, i did a lil bit of googling, and found that this had something to do with the handling of IPv6 packets by the DSL-502T adsl router which i use for my MTNL Triband service. Im not sure whether this was a problem with my adsl router,but what was happening was that the name resolution requests were going to my adsl router (192.168.1.1), as it was the nameserver specified in /etc/resolv.conf, and it was incorrectly returning 1.0.0.0 as the ip.

A temporary workaround i did was hardcoding the ip address of my repos listed in /etc/apt/sources.list and the irc servers, in /etc/hosts.

However, luckily enough i discovered a permanent solution , which would work for any website henceforth, and that was to use the free service OpenDNS .  Quoting Wikipedia , “OpenDNS offers DNS resolution for consumers and businesses as an alternative to using their Internet service provider’s DNS servers” .  What this means is , i could use the DNS severs provided by OpenDNS instead of passing the name resolution requests to my adsl router at 192.168.1.1.

OpenDNS provides two DNS servers 208.67.222.222 and 208.67.220.220 . To use them i did the following.

Step 1) In  /etc/dhcp3/dhclient.conf , i uncommented and replaced

# prepend domain-name-servers 127.0.0.1;

with

prepend domain-name-servers 208.67.222.222,208.67.220.220;

Step 2) Reboot
After reboot, i could see those nameservers added to my  /etc/resolv.conf as well . To confirm, i was using OpenDNS , i visited http://www.opendns.com/welcome .

Another thing,if you are facing issues with browsing websites in Firefox or Iceweasel, then from about:config just set network.dns.disableIPv6 to true and restart the browser.

If you still face any issues you can refer to http://www.debian-administration.org/articles/409

Hope this helps any Lenny users out there who might be facing the same problem .

Till the next post,
Adios 🙂

Advertisements

Convert Vi into a powerful Python IDE March 9, 2009

Posted by razasayed in Hacks, programming.
Tags:
9 comments

Below is a simple two step recipe for converting Vi into a full fledged IDE for python . Though there are numerous powerful features which can be added to Vi, to make it more powerful as an IDE, for simplicity’s sake and also to enable newcomers to easily get started with using some of these great features, im gonna share a couple of ways in which you can use Vi as a Python IDE.

These tips would enable you to get all those cool features like code completion , syntax highlighting , automatic indentation in Vi which would definitely make you more productive as a python hacker.

Step 1) For automatic code completion, download the pydiction plugin for Vi, from http://www.vim.org/scripts/script.php?script_id=850

Then, you need to extract this file into  your .vim directory. Assuming its in your home directory e.g.) /home/raza/.vim (If .vim directory does not exist create it), you run the following command from the location where you dowloaded the plugin

tar xvzf pydiction-0.5.tar.gz -C ~/.vim

To use auto-completion, simply press Ctrl-n or Ctrl-p , while in Insert mode.

Step 2) Now, add the following piece of code to your .vimrc file. This file is located either in your home directory or in /etc/vim.
If you dont want to risk messing up your existing .vimrc, you can create a backup of it, and create a new .vimrc file and then paste the following code in it:

[Note:] Dont forget to replace /home/raza/.vim in the code below with the location of your .vim directory

set nocompatible
syntax on
set showmatch
set ignorecase
set showmode
set ts=4
set sw=4
set autoindent
set smartindent
set number
autocmd FileType python runtime! autoload/pythoncomplete.vim
imap <c-space> <c-x><c-o>
:set backspace=2
if has("autocmd")
        autocmd FileType python set complete+=k/home/raza/.vim/pydiction-0.5/pydiction isk+=.,(
        endif " has("autocmd"

filetype plugin on
filetype indent on

" Mappings
nmap <C-N> :noh <CR>

Thats all there is to it ! . If you want to directly execute your program , without having to leave vi, then switch to command mode and execute the following command:

:!python <yourfilename>.py

There are more cool features like adding support for snippets, debugging etc that can be added to Vi, but maybe ill cover them in a later post.
If readers would like to share any more tips for customizing Vi for python development, then you are welcome to post them in your comments.
Hope this makes your python programming more productive and fun.

Happy Hacking ! 🙂

Online C compiler November 22, 2008

Posted by razasayed in Hacks, programming.
Tags:
25 comments

Sometime back i was at my friends place . He was preparing for some test and he showed me a complex looking C expression , and asked me what it would evaluate to . I told him what i thought would be the answer but anyways we needed to verify it .  He did not have a C compiler installed on his machine . But, luckily enough he did have an internet connection , and google came to the rescue .

There is an online C compiler available at http://www.delorie.com/djgpp/compile/ . It runs your program and gives the executable for download . Pretty cool and quite handy when we quickly need to check the output of some C program , but dont have access to a C compiler . Saves some time on downloading and installing one.

However, of course this wont work if you are using a GNU/Linux system, as the output is an exe . However, for those users gcc is just a synaptic away 😉

RSS Feeds for GMail ! August 4, 2008

Posted by razasayed in Hacks.
Tags:
add a comment

I recently discovered another thing which separates GMail from the rest of the webmail service providers out there . It provides an rss feed for your mails , which you can access using any rss aggregator/feed reader ! . All you need to do is visit https://mail.google.com/mail/feed/atom , and enter your credentials to subscribe.

However, a point to be noted is that not all aggregators support GMail . For an aggregator to access GMail rss, it must support Atom 0.3 and SSL/HTTPS . Google provides a list of aggregators supporting GMail on Windows , Mac and Linux platform.As for rss aggregators available as firefox extensions ive seen that “Brief” does not support GMail but “Sage” does .

The GMail help center article for this feature is located here . However,  make sure that you double check the privacy settings for your aggregator before using GMail with it, as you might accidentally end up making your contents public !.

If you want to be really safe , but at the same time also get alerts for your mail in gmail , including the ones you have labelled , check out “GMail Manager” , a super cool extension for firefox which allows you to display your account details including unread messages, saved drafts, spam messages, labels with new mail, space used, and new mail snippets 🙂 .

Brief-A cool feed reader extension for firefox with feed notifications August 3, 2008

Posted by razasayed in Hacks.
Tags:
add a comment

I was looking for a good feed reader extension for Firefox . There are some excellent “online” feed readers like Google Reader, but i needed something i can use from within firefox without the need to login to some online service. While searching for feed reader extensions i was initially overwhelmed with the number of choices out there . It was difficult making a pick, but finally i decided to go for an extension known as “Brief“, which most people have voted as one of the best feed reader extensions for firefox .

It is simple yet powerful at the same time . The interface resembles that of google reader with features like  single click bookmarking and tagging . It also has the feature of providing notifications of updates in your list of feeds. This notification feature is what i found missing in the other feed readers i looked at , including “Sage“, which is another good feed reader for firefox.

You can install Brief by visiting https://addons.mozilla.org/en-US/firefox/addon/4578

P.S. : For all Google Reader fans out there , if you want to get notified of any updates in your list of feeds without having to login to Google Reader check out a nice firefox extension called “Google Reader Notifier

Access the GPRS service of your cellphone on a Linux machine via bluetooth July 16, 2008

Posted by razasayed in Hacks, programming.
Tags: ,
add a comment

Sometimes when im on the move and also there is no wifi nearby I find it convenient to access the Internet using the GPRS service on my phone . And even more convenient is accessing the same on my laptop. So,here are four simple steps for using the GPRS service of your cellphone on your Linux box via bluetooth. Actually, as they say in Linux “theres more than one way to do it “, there could be other ways of going about this, but this one works for me (and also the only one i tried 😉 ). So here we go…

Step 1) Make sure you have the bluez-utils package installed . If your bluetooth dongle is recognized as soon as you plug it in then you already have this package installed. If not install it from synaptic or by using the following command.

sudo apt-get install bluez-utils

Step 2) Plugin the bluetooth dongle and activate the bluetooth on your mobile.

Step 3) Now, the first time you setup your Linux machine to access the GPRS service on your mobile phone via bluetooth, there are quite a few steps involved , so i wrote a simple shell script for automating the connection setup. Now all that needs to be done is run this script , and voila !, our connection is ready 🙂 .

You can access the script over here. Save it as connect_gprs.sh on your machine . After you run this script , minimize the terminal window where this script is running. To disconnect press Ctrl-C at the terminal.

Step 4) Now, in your browser, assuming you are using Firefox, go to Tools->Options->Advanced->Network. Click on Settings. Then from the menu select Manual proxy configuration . And enter the value for the Http Proxy and Port . Since you are following this tutorial, i assume you already have the GPRS service on your phone . And in that case you can get the values for the Http proxy and port by looking at the access point settings on your phone.

Thats it . Have fun 🙂

Access the Web offline with Google Gears July 10, 2008

Posted by razasayed in Hacks.
Tags:
1 comment so far

“Offline web access”- does this term sound paradoxical ?.  Well, it should not if you have heard of a technology called Google Gears . Google Gears is actually an open source browser extension/add-in , available for both Firefox and Internet Explorer, which makes web applications available offline.

Google Gears

The way it works is that a gear enabled website allows you to download some portion of the website that you commonly work with onto your local hard drive. A case in point is Google Docs . I can for example have a copy of my google docs on my local machine . Now, even when im not connected to the Internet, i can continue to work with my google docs offline , and the next time I go online , my changes are automatically synced with the online copy…pretty neat, huh ? 🙂

Not every website though on the web is currently gears enabled , however there many popular ones like Google Docs, Google Reader, Zoho etc…which support offline access via gears. And the list continues to grow. WordPress, recently joined the bandwagon of gears enabled websites.

To get started with using Google Gears, simply download the extension from http://gears.google.com/?hl=en

Google Docs

Then , to access your Google Docs offline just click on the Offline option available on the top right hand corner when you login to Google Docs. However, currently Google Docs supports viewing and editing documents offline , but spreadsheets can only be viewed offline . I would love to see support for offline spreadsheet editing too in the near future.

To use Google Gears with WordPress just click on the Turbo option at the top right hand corner when you are logged into wordpress. When this is done the images, javascript, and CSS used inside the WordPress dashboard would be copied to your local hard drive , so in case of a slow connection  this downloaded data would act as a local cache to speed up your dashboard . The posts are not copied , so offline viewing/editing of posts is currently not possible .

And just in case you are wondering where exactly on your local hard drive this data gets stored then below is a list of these locations.

  • Windows Vista – Internet Explorer
    C:\Users\%USERNAME%\AppData\LocalLow\Google\Google Gears for Internet Explorer
  • Windows Vista – Firefox. Database files are stored in the user profile directory.
    C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles\{PROFILE}.default\Google Gears for Firefox
  • Windows XP – Internet Explorer.
    C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Google\Google Gears for Internet Explorer
  • Windows XP – Firefox. Database files are stored in the user profile directory.
    C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Mozilla\Firefox\Profiles\{PROFILE}.default\Google Gears for Firefox
  • Mac OS/X – Firefox. Database files are stored in the user profile directory.
    Users/%USERNAME%/Library/Caches/Firefox/Profiles/{PROFILE}.default/Google Gears for Firefox
  • Linux – Firefox. Database files are stored in the user home directory.
    ~%USERNAME%/.mozilla/firefox/{PROFILE}.default/Google Gears for Firefox

So, the next time you are on that cool web 2.0 website, do look out for offline access by google gears..have fun 🙂

Making Compiz effects of Hardy work with Via Graphics Chip June 6, 2008

Posted by razasayed in Hacks.
Tags:
7 comments

I recently got my hands on Ubuntu v8.04 (Hardy Heron) and installed it on my laptop . However, i was disappointed to see that the compiz effects were not working . Also, there were other problems like doing a log off just gave me a black screen and i had to manually reboot my machine.

The reason was my Via Chrome9 HC IGP graphics chip which is not directly supported by Linux, and requires proprietary drivers provided by Via to be installed .  So , after some googling around for the solution and a lil bit of hacking on my part i finally got it to work . So, here im posting the steps i followed :

Step 1) Download the chrome9.83.40558 driver from Via Linux Portal.

Step 2) Install the driver.

But, after installing the driver, when i restarted X-server (Ctrl+Backspace), i just got an orange screen with yellow stripes and a bigger than normal mouse cursor. The desktop just wont come up.

So, the next steps were…

Step 3) In xorg.conf (located in /etc/X11) , under the “Screen” section , add a new subsection  “Display” as follows :

Section “Screen”

SubSection “Display”

Modes “1280×800″
Virtual 1280 800

Depth 24

EndSubSection

EndSubSection

Step 4) Now save the file and reboot your machine or restart X.

Thats it ! . The via drivers were successfully installed and all the display problems which i was facing earlier were gone and the compiz effects now worked like a charm.

I hope this works for you too 🙂 .

Use your Nokia mobile phone as a wireless webcam ! April 10, 2008

Posted by razasayed in Hacks.
Tags:
59 comments

Here is an interesting find that i would like to share with you . Is your webcam currently out of order and you dont have enough time to get it serviced or to buy a new one ?. Maybe you dont have a webcam at all, and you think you wont be using it frequently enough as to justify the expense you incur on buying one.

But there are times when we think having a webcam would have been really nice . Maybe you would like to chat with a distant friend or relative once in a while , or there is some great occasion in your house and you want to share it live with people located far away.

How about getting a wireless webcam completely free ? . “You must be kidding !”, i hear you say . Well , you are in luck 🙂 . Motvik WWIGO (Webcam Whereever I GO) is a completely freeware application that will turn your bluetooth enabled Nokia phone into a wireless webcam that can be used along with a PC/laptop equipped with bluetooth hardware.

The best part is instead of sitting in front of the webcam, you can walk around with the cameraphone, shoot in the next room and still stream video live onto your PC . Sounds too good to be true ?. Well, theres more good news coming . You can use this webcam along with your favourite instant messaging application be it Yahoo Messenger , Windows Live Messenger or Skype ! . You can also use it to share videos on websites like You Tube and Grouper . All this for just 0$ . Now just how cool is that ? 🙂

I myself used this app on my Nokia 6600 and found the video quality good . The product website claims that it is better or comparable to an off the shelf webcam . So head over to http://www.motvik.com to download this cool freeware application and turn your Nokia mobile phone into a wireless webcam ! 🙂

# and chm files…whats the relation ? March 21, 2008

Posted by razasayed in Hacks.
Tags:
add a comment

Some time back i was facing a problem opening windows help files a.k.a. chm files on my XP box . Actually, chm files make use of Internet Explorer for displaying their content, so i checked all the settings in IE but ultimately was at my wits end and was not able to figure out what was going wrong .

After googling on it for sometime i came across some info , which finally helped me solve the problem . It was a strange revelation that if the chm files are placed in a folder which contains the character # in its name , then the chm files wont display their content.

Actually, the chm files on my machine were some docs related to the c# programming language and were placed in a folder that contained the word c# in its name. I renamed the folder by replacing the character # with the word ‘sharp’, and voila, the chm file contents were now visible 🙂 .

For the coders amongst you, the reason is that the # character signifies an anchor in html so the chm file is getting a bit confused as to where to look for the content.  I dont know whether this is officially documented by Microsoft or not , however the moral of the story is never have a # character in the name of a folder that contains chm files. Hope this saves you a lot of trouble in case you run into the same problem.
Alright then, till the next post,

Adios and Happy Hacking ! 🙂