Tuesday, November 11, 2008

Epoch date/time convert - Python and Bash

With python you can convert epoch time to the format you want. Hint below!
>>> import os,time
>>> time.time()
1226392970.4683549
>>> time.gmtime(time.time()).tm_mday
11
>>> time.gmtime(time.time()).tm_mon
11
>>> time.gmtime(time.time()).tm_year
2008
>>>

WIth bash the same is accomplished as below.
veveo@shreyas:work$ date  +%s"  <-->  "%c
1226393170  <-->  Tuesday 11 November 2008 02:16:10 PM IST
veveo@shreyas:work$ date -d "-1 month" +%s"  <-->  "%c
1223714775  <-->  Saturday 11 October 2008 02:16:15 PM IST

veveo@shreyas:work$ aMonthBefore=`date -d "-1 month" +%s`
veveo@shreyas:work$ echo $aMonthBefore
1223714816
veveo@shreyas:work$ date --date=@$aMonthBefore +%c
Saturday 11 October 2008 02:16:56 PM IST
veveo@shreyas:work$ date --date=@1223714816 +%c
Saturday 11 October 2008 02:16:56 PM IST

Tuesday, August 26, 2008

Thursday, August 21, 2008

My first DSLR - Nikon D60

Two places to read from, when you own your first DSLR. Immensely helped me in understanding the tech bits!

Software's to assist the photographer in you!!

 

--more to come soon!

Thursday, May 1, 2008

Install ipw3945 (or iwlwifi) - Intel PRO/Wireless 3945ABG - on debian.

I always had these thoughts

  1. Why ubuntu install all the necessary drivers for the intel wireless cards to work automagically after the installation
  2. Why debian (etch) cant do the same ? why doesn't debian (etch) have the necessary packages in their official repositories.

I was always shying away from installing the firmware, building from the source. But when I found no other way, I ventured to get things done with sourceforge.net and here is how.

Step 1:

  • download the ipw3945-1.2.2.tgz from sourceforge.net (http://ipw3945.sourceforge.net/)

Step 2:

  • Do the following : 'tar -xzf ipw3945-1.2.2.tgz',  'cd ipw3945-1.2.2'  and 'less INSTALL'

Remember, most important step is the "less INSTALL' and reading through the instructions.

Finishing it off:

Thank your lucky stars, thank the developers who got these packages for you and last but not least thank sourceforge.net for hosting the ipw3945 page.

PS: If you have followed the 'INSTALL' file precisely you should see the wireless networks in your 'nm-applet' list, when you click on it.

I had to use sudo every here and there, especially when i do the './load' within the 'ipw3945-1.2.2' directory. So use it at abundance, shouldn't hurt you much !

This will only get you started with perfecting the wireless interface configuration. Once the mentioned procedure is completed, you might want the wpasupplicant and other accompanying packages like wpa_gui also for completing the setup.

Update:

After updating my Debian etch DVD's to lenny using jigdo, I installed lenny on the laptop. Once done, I modified the sources.list as below and did a "sudo apt-get dist-upgrade"

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free
deb http://http.us.debian.org/debian/ lenny main contrib non-free
deb-src http://http.us.debian.org/debian/ lenny main contrib non-free

This updated my kernel to 2.6.24 and it got me the correct wireless drivers (iwlwifi, this is the next life of deprecated ipw3945 driver). Wireless was working fine after the update and the networks were showing up in the nm-applet.

Thursday, April 10, 2008

Configuring syslog server on debian

Like me, if you also wanted to set up a log server for gathering all the logs from your firewall, router, servers etcetera to a single log server, follow me..

I am running a Debian (lenny; In etch also this should work fine) and I got syslog-ng installed replacing the older, sysklogd package. syslog-ng is the next generation log daemon which has added features, noticeably in the log filtering area. But all I wanted was to get start with collecting and logging logs from my Netscreen firewall. So this is what I did.

Installed necessary packages using apt
apt-get install syslog-ng syslog-summary

(I am yet to try out syslog-summary )

Added the following to the configuration file of syslog-ng (/etc/syslog-ng/syslog-ng.conf)
In the source s_all{}, uncommented "udp();"

under the default destinations, added "destination df_netscreen { file("/var/log/netscreen.log"); };"

Under the default filters, added "filter f_netscreen { facility(LOCAL0); };"

Added to the end of the configuration file, the meat of the new log entry,

log { source(s_all); filter(f_netscreen); destination(df_netscreen); };

And then restarted the syslog-ng service.
sudo /etc/init.d/syslog-ng restart

That much did the main work of setting up the log server.  





"f_netscreen" & "df_netscreen"

These are mere identifiers and since I am setting this up to get my Juniper Netscreen25 logs to be accumulated here, I gave the name "*netscreen*".

"LOCAL0"

This is the log facility I used on the Juniper Netscreen25 for setting it up to send the logs to the newly set up log server. Hence the string "LOCAL0" appeared in the facility description in the filter syntax.

Since my firewall log size grows madly, I had to set up the logrotate to save my computer from running out of space. Adding a file called "netscreen" in the "/etc/logrotate.d" folder with contents as below did the magic for me.
/var/log/netscreen.log {
  rotate 6
  weekly
  compress
  missingok
  notifempty
}

This will rotate my firewall logs weekly and each will be kept until 6 weekly rotations before getting deleted. Read through "man logrotate" for more detailed information on setting up logrotate for your logfile and its always good to restart the crond "sudo /etc/init.d/cron restart" since logrotate uses cron.daily to get itself running every day.

update (2008-04-11): Adding the remote log facility "LOCAL0" to the "not" list of "f_messages" filter will avoid accumulating the remote logs in "/var/log/messages". (Addition is in 'bold letters', below)
filter f_messages {
        level(info,notice,warn)
            and not facility(LOCAL0,auth,authpriv,cron,daemon,mail,news);
};

Most importantly, by default syslog-ng does not seem to enable the cron log. I found it only when I wanted to check why the logrotate did not worked. I had to un-comment the below in "/etc/syslog-ng/syslog-ng.conf".
#log { source(s_all); filter(f_cron); destination(df_cron); };

Wednesday, April 2, 2008

Installing windows vista ultimate on dell laptop (Vostro 1400)

I have an office laptop,a Dell Vostro 1400 and it came with windows vista home basic. After a while, now I wanted to install the MSDN copy of windows vista ultimate in the laptop along with my Ubuntu Gutsy. I got the DVD and get started with the installation. It was all looking fine and the vista installer restarted my machine and went about completing the installation and once it finished and started to come to the login screen after one of the reboot sequel, I was stunned to see that after all the time spend on installing, Vista was giving me a BSOD. Its so fast that I cannot even read the error message or come to know which device driver is giving the trouble. As always I do, I started to suspect the driver for the nvidia card in the laptop. Before I try to disable the graphics card in the BIOS to make the onboard display as default, I was going through all the settings in the BIOS. When I came across AHCI settings for the SATA disk, I wanted to know more about it and went to wikipedia and searched for AHCI. I was reading through and I found everything under "Common problems switching to AHCI under Windows" in that page interesting. I was getting the similar error and I wanted to give a try by disabling the AHCI.

After disabling AHCI I was able to boot up the fresh Vista installation, and I knew what exactly is the trouble. Further search in the Google took me to this thread @ forum.notebookreview.com. I tried to repair the installation with the Vista repair option during the installer run, trying to add the drivers (which came with my dell driver cd) from a floppy/USB memory stick. It was taking a very long time and was not going forward. I didn't had much time to experiment and had to go for a re-install and this time when I did load the drivers (from the dell driver cd) everything was going on fine.
Initially when the windows vista ultimate installation was not going further, I tried to install windows server 2003 R2, which also succumbed to BSOD. From the wiki page about AHCI, its obvious that this is a common problem with most of the windows installations. Loading the appropriate drivers from the vendor while installing should be the solution if you have faced similar trouble.

Update (2008-04-11): After the successful installation of the Vista Ultimate, I never had used Bluetooth, until yesterday when I wanted to connect the laptop to the internet using vodafone mobile connect. I was trying to findout the old "Bluetooth Devices" application/link in my computer where I can enable/search for devices. Unfortunately later I found that the laptop doesn't have the BT (BT=Bluetooth from now on) LED on. This means, the device is not on for the OS even though it is in the BIOS. I checked the BIOS to make sure that BT is on and that the Wifi switch will handle BT as well as the Cellular device (Cellular device is my another mystery to be found out). Desperate to get it working, I called the Dell engineer. After trying all that he asked me to (most of which I had already done, but did for the sake of following a protocol in troubleshooting), we  (me and the dell support engineer) came to a conclusion that there is either connection problem (BT module to the motherboard) or the BT module is not working. Only after scheduling the engineer visit, it occured to me that visiting the dell forum is a good idea, and right there I headed straight. In "Forum Home > Support > Network/Internet/Wireless", the welcome (must read) thread named "Network/Internet/Wireless FAQ **READ FIRST** (Updated 4-11-2008)" I found the answer to my problem in the form of a "patch" (In the forum thread, under 'Bluetooth updates', a link named " Utility to enable Bluetooth radio after downgrade from Vista to XP or Vista to Vista if the radio is software disabled on Vista"). After installing the patch, my BT device LED indication was on, I can see the "BT devices" in the system tray, and It was on, it came back alive.

My advice to all those in distress due to your computer malfunction, head to Dell forums, read and search and read and .... chances are you can get things working by yourself. Dell forum is a great help and its very active. The way they categorized the forum is very neat and easy on the new users.

Saturday, March 29, 2008

Installing KDE4 on Ubuntu (Hardy Heron)

I had an urge to try kde4 on my Ubuntu installation yesterday. I was using gnome in the laptop and I was a loyal KDE 3.5.x user on my office desktop (with Debian etch upgraded to Lenny a couple of days before) for a long time. With all the new applications details going around about kde4, I wanted to give it a try. After upgrading the Debian etch at my office desk to Lenny, I was a bit over confident that upgradinng my Ubuntu Gutsy to Hardy wouldn't break my heart (applications). I changed the sources.list to do a dist-upgrade. But since my home connection is not that great considering the speed, I decided to update to kde4 to start with, because something was telling me that things wont go so fine with kde4. I ended up with a shiny new kde4 interface in about 40 minutes. I logged into the kde4 and the first impression was not so great. I was welcomed with a windows vista look-alike interface. The new application launcher (K menu) was there with a new design to complete the vista's clone. I didn't like the way KDE4 gave me the desktop. The icons were oversized, menu was difficult than the old style (The classic menu is still there, which you might want to add to the panel). I like it when things have changed for good, but when it makes things difficult for users to adjust, its not improvement. Its disastrous design for the sake of improved flashy interface. The fact that I most dislike is the way kde4 resembles my windows vista. I was with the desktop for about 45 minutes and still have not figured out how to move a application launcher in the panel. Call me ignorant or noob, but I think simple things like these should not be so hidden (It was not in kde3.x). The fact that default gnome optimized window manager gives me more screen real estate made me switch back to gnome in less than 1 hour. Oh yeah and I did tried out the new improved konsole and the file manager. File manager was good (I can always install a similar polished file manager in my old, and the best, KDE - like krusader). Konsole doesn't "look" good and the new settings tab which is said to be improved and easier to use than previous, looked not a bit more easy than the former version. Overall, I did not like KDE4, and I am not going to use it again, not in the near future. What a great desktop kde3.x was, and how the new kde4 put me off from even trying it out. Maybe its just the fact that kde4 looks more like windows vista desktop, that had made me feel uneasy with kde4. I do not understand why there are people who believe, things will be more user friendly when it looks like windows desktop. Well, fine with all the thoughts, all I wanted was to let you know this is what you can expect as a welcome with the new KDE desktop. Try it and ditch it

Friday, March 28, 2008

What do you mean by free software

I like the way debian.org explains what "free software" is.
When we speak of Free Software, we mean freedom, not price.

Have a read here

Saturday, March 22, 2008

Friday, January 11, 2008

ffmpeg and mencoder GUI for Windows

There in the web, I found a GUI wrapper for ffmpeg and mencoder for windows called Media coder. This is an open source software distributed under GPL license. Download it and try it (I have done some basic conversion _single files | not in batch_ and it worked okay) and do not forget to convey your gratitude to the author/developer of the application if it helped you in any way.

ffmpeg with AMR (nb & wb), lame, FAAC and FAAd codec.

Below is how I have installed and used ffmpeg to convert avi and wmv files to 3gp format so that I can store and play them in my mobile phone. I have a very rough guide, but hope that will help you in understanding more about the procedure by doing your own research. Consider the below scribble as a pointer to get things started. Now that being said, lets get started..

Download the source for amr_nb (nb stands for narrow band; amr is for the 3gp support). If you can find the sources for both you can use both of them. I was not able to find the source for amr_wb and at last I had to beg in irc://irc.freenode.net (#ffmpeg) to get the source from a fellow who had it uploaded in some file sharing site for me.

For mp3 support, get the lame codec from sourceforge

Download faac, faad2 from sourceforge.net and get them installed.

get the amr and lame codecs compiled and installed.

Get the source for ffmpeg from the svn or search for the tarball.

svn://svn.mplayerhq.hu/ffmpeg/trunk

Get things going with the configure, make & make install.

./configure --enable-libmp3lame  --enable-libvorbis --enable-libamr-nb --enable-libamr-wb --enable-gpl --enable-libfaac --enable-libfaad --enable-shared

voila.. you are ready to convert video files for your mobile ~smile~

Below is the way I use ffmpeg to convert. Figuring out the options for ffmpeg is your job (hint: man ffmpeg)

./ffmpeg -i /home/old_desktops/sabarish.old/laptop_backup/Azureus\ Downloads/Kylie\ Minogue\ -\ Spinning\ Around\ \(xvid\ K-rip\).avi -f 3gp -vcodec mpeg4 -acodec faac -ar 8000 -ac 1 -ab 12.2k -y Kylie.3gp

I have used options, -acodec libamr_wb also but had some issues with the sound in the video, so rolled back using faac audio codecs. You can experiment around and use the best to get things done.

vtap.com or regionalized India.vtap.com !

What would you do when you want to see the new Rs. 1 Lakh car  which was presented to us, Indians by TATA Motors ? What if you want to see the video of the car to find the look and feel of it ?

vTapMy choice would be to search in vtap.com. This ultimate video search engine gives me the power to find out informational videos, entertainment videos, news videos, sports, user videos (which are hugely crappy or pathetic, but a few gems), music videos etcetera. The most powerful feature of vtap engine is its search capability, where it does an incremental search and you can see results of the typed in query without you clicking on the "Go" button. The search is so good that, I don't have to type in the whole characters of my (current) favourite singer "alizee" to find her videos. All it takes is type up to "aliz" and I can see the results already showing the pretty singer smiling at me.

vtap.com also provides your mobile (iphone, windows mobiles (source available here), large number of web enabled phones and itouch) with this search facility where you can use either a downloadable client or by going to vtap for mobile (http://m.vtap.com). Alas, one feature missing in vtap for mobile is the incremental search, so you have to go "clicky clicky" each time you want to see the results. Over the gprs in India this will really test your patience, talking about rigorous testing. Though at office or home, with those wifi enabled mobile, its a virtue.

Latest news is that vTap is bundled with Motorola mobile phones starting from their latest model MOTO Z10 onwards. I bought a Motorokr E6 recently and now I feel I should have waited a little while more so that I can buy MOTO Z10 with vTap bundled.

If you have a mobile which is supported by vtap and have a data plan activated, do try out vTap. Even with a PC you can use vTap to do more precise search than any other video search feature provides.

Let CamStudio make videos of your computer screen!

Below are two quotes from their home page which caught my eyes.

uno:

CamStudio is able to record all screen and audio activity on your computer and create industry-standard AVI video files and using its built-in SWF Producer can turn those AVIs into lean, mean, bandwidth-friendly Streaming Flash videos (SWFs)

Due:

You can download and use it completely free - yep - completely 100% free for your personal and commercial projects as CamStudio and the Codec are released under the GPL (for more details on this license, click here.)

This was all I wanted to know about CamStudio and there ended my search for a screen capture utility. After installing and trying, CamStudio left me with no reason to hit Google.com for more software of similar nature. I wanted this for giving a video demo configuring route based VPN on our Juniper Netscreen NS25. This proved to be a very handy tool for creating demos and short video tutorials for people who need support beyond voice. I have not tried any feature in CamStudio other than creating a screen shot video. But that was all I wanted and CamStudio did it extremely well in with very simple steps.

I suggest you download and install it. You will never know when you want to tell a video story to someone who has no receptive ability enable by default on his/her ears when it comes to technical trouble shooting.

                                                  ~

In honour of "nickthegeek" and "windycity" (Project Admins)

CamStudio - Free Streaming Video Desktop Recording Software

Thursday, January 10, 2008

Clean way to get one's network IP address? - comp.lang.python | Google Groups

The best way of finding the IP address using python, that I have seen so far. Look for "Jean Paul Calderone's" post in the below link.

Clean way to get one's network IP address? - comp.lang.python | Google Groups

Here is what he posted.

    >>> from socket import socket, SOCK_DGRAM, AF_INET
    >>> s = socket(AF_INET, SOCK_DGRAM)
    >>> s.connect(('google.com', 0))
    >>> s.getsockname()
    ('192.168.1.113', 43711)