Monday 28 January 2008

Greasemonkey Script - Integrate Gmail and Google Calendar

Visit the following link

Internet Cookies

Netscape developed cookies. They did so as a means to store "state-related" (a programming term) and other information in a persistent manner. The information in a cookie survives after you disconnect from the remote server. When you connect again, that server can look up the cookie. Cookies work with CGI (Common Gate Interface) programs that reside on the remote server.

When a browser requests a URL (Uniform Resource Locator) from a remote server, the browser first searches a cookies file to see if any of that file's cookies match the URL it's requesting. The browser then sends, as part of the URL request, the remote server information contained in the matching cookie(s). Cookies allow CGI programs to store information on your computer instead of the remote one.

A cookie is a HyperText Transfer Protocol (HTTP) header that consists of a text-only string. Your browser stores this text string in its memory when called upon. This string contains the domain, path, lifetime, and value of a variable. That variable is something a CGI script is looking for--your e-mail address, what site you came from to get to the remote server, what browser you are using, or what operating system you run. A server can get all of this information without cookies, but doing so slows the server down. This is the only information a cookie can contain, unless you fill out a form that explicitly adds other information or the remote server sends you a cookie with information it added--such as a shopping cart ID number. A cookie cannot and does not scan your hard drive.

How To Protect Yourself Against Computer Crashes

To prevent crashes, you need to look at your whole system. Here are key areas to look at.

Operating system. If you have a wintel (Windows/Intel) machine, you have a choice of two operating systems. Those are DOS (which is the underlying OS of WinCRASH--oops, I mean Windows 95, Windows 98, and Windows Me) and Windows NT (NT, 2k, XP).

There is no reason to run Windows 9x on any computer that is less than 2 years old, unless you are running the older game CDs or a laptop that is low on RAM. The false argument that NT costs more conveniently ignores many things, such as the fact you must buy quite a few third party programs to put the missing pieces into Windows 9x, while with NT these pieces are built-in.

RAM. Anything less than 64 MB of RAM, and you'll be dipping into your "virtual RAM," which runs about one 1,000 as fast as your RAM. This means longer execution cycles, timing problems, logjams on your bus, and more crashes.

Bad RAM. Hey, it's always possible. Pay attention to that RAM test when you boot up.

Hard drives. It's best to have your program files on one physical drive, your temporary files and pagefile on a second, and your data files on a third. However, dual-drive machines are far more common than triple-drive machines, and single-drive (ugh!) machines are even more common, still. If you have a single-drive machine, buy an extra hard drive, and partition it so you can devote 1 GB to temp files and another GB to your page file. This will dramatically speed up your machine, and it will reduce crash frequency, too. Keep your hard drives defragmented. How often should you defragment? Run defragmentation at least once a week. If you recently deleted many files, run it again.

Run Scandisk or some other similar hard drive utility to check for bad sectors on your drive(s). These cause crashes, too. Scandisk will also check for lost clusters. Choose the delete option.

Drive organization. Tons of temp files, too many files in your root directory, and the default "keep my frequently-changing files in the same folder as my operating system files" all cause crashes. Relocate your user Profiles, Favorites, Temp, Temporary Internet, and other such files to their own partition or at least their own folder. Go into regedit and change from C:\WINNT or C:\Windows as the default to something like C:\Mystuff or C:\0me.

Long filenames for folders or directories. Microsoft won't tell you this, but they don't support long filenames, even in NT, as seamlessly as they would have you believe. Go beyond 8 characters, and you increase the likelihood of a crash because the resources required to read even one extra character are more than what it takes to read the first 8!. Change Program Files to Programs, and you are on your way to better computing. This can be a hassle, though, because not all of your shortcuts, macros, etc., will respond to Explorer's name change utility. So, this is a "choose your poison" strategy that you should employ only when you want the ultimate in speed an reliability from your machine.

Cheap parts. Buy parts that carry NT certification. Period.

Screen savers. These don't save your screen, but they do induce crashes by hogging resources. You can choose between cute and functional--it's your computer. However, screen savers and crashes go hand in hand. If you are just dead set on a screen saver, at least avoid the kind that allow you to run text banners. These use highly complex algorithms that place a huge drain on your system.

Power glitches. What? You don't have a UPS? I'm not talking about one of those $12 surge strips. Get a battery backup unit, like the kind made by APC, Best Power, or other major names. I use a 1 kVA APC unit for my PC, but a unit a fourth of that size is sufficient. The cost is not much. Make sure you provide surge protection for data lines (such as phone lines going to your modem).

What to do about frequent crashes. Keep notes on what you did just before a crash. If a single program makes you crash, manually uninstall it (run regedit), and then see if your crashes go away. If they do not, then it may be because this program loaded in DLLs that aren't quite right for your system. To cure that, you may have to do a repair reinstall of your operating system and the latest service pack. Good luck.

If your computer makes a clunking sound and then crashes, you have hard drive control or physical hard drive problems. The cure is to reload your operating system, minus any service packs, and disable all TSRs (terminate and stay resident programs, such as screen savers and various utilities). Then, over a period of several user sessions, add in service packs and utilities. Forget the screen saver.

Taking a look at Vista

Traditionally Microsoft software has ignored the fact other operating systems exist. Installing Windows will usually attempt to destroy any other non-Windows partitions, in a Darwineque way, and Windows certainly doesn’t come with anything like a boot manager that lets you select alternative operating systems (although it does offer a boot manager that lets you switch between versions of Windows installed on the disk).

Out in the real world Microsoft is making moves towards opening up and allowing competition. Is there evidence of that in Vista? While it might be a pipe dream to expect Vista to interoperate with other operating systems, is there evidence of toleration of other operating systems?

Of course not.

The installation partitioning tool identifies Linux partitions on the disk but isn’t quite sure what to do with them. It doesn’t identify them by name or file system but simply assigns them a number. But, for that matter, the partitioning tool doesn’t even identify existing NTFS partitions by name or file system. It’s not a particularly helpful piece of software.

Any changes you make to the partition system at this stage are carried out instantly. If you expect to make changes and then be asked to confirm them later, as with practically all Linux installation routines, then you’re in for a shock. There’s no room to experiment with different partition setups.

I installed Vista on a notebook computer that had Ubuntu Dapper installed as its main OS, alongside Windows XP Home. Did Vista install a boot loader that let me boot into my choice of operating systems? Of course not. The boot menu identified Windows XP on the same machine as an “Earlier version of Windows”, indicating a weird kind of snobbishness toward all other non-Vista OSes. Ubuntu definitely wasn’t on the list. To restore my ability to boot into it I’m going to have to reinstall GRUB from a rescue disc.

How about within Computer (aka “My Computer” in earlier versions of Windows). Once Vista was up and running, did it identify the ext3 partition? Did it, gulp, install file system drivers so I could access the contents of my ext3 file systems?

You know the answer.

It looks like the same-old Disk Management snap-in is available from the Computer Management console. As with Windows XP, this merely identified the ext3 and Linux swap partitions as “Healthy”, and reported then to be 100% free.

I’m not sure what excuse Microsoft offers for this lack of functionality. The main open source file systems are extremely established and popular, especially on servers. It wouldn’t be a huge task for Microsoft to provide rudimentary access, even if it’s simply read-only.

In some ways I’m not surprised. I know the nature of Microsoft. But if I ignore this, and pretend for a moment that I’ve no idea of how Microsoft operates, then it’s actually quite shocking that Vista doesn’t interoperate at all with other operating systems. Why not? Doesn’t Microsoft want its product to appeal to a sizable section of users, on the desktop and server, who use Linux?

Over the next few days and weeks I’ll examine more of how Vista interoperates with Linux (and vice versa), so check back. I’m also going to take a look at some of Vista’s features compared to Linux alternatives.

Windows keyboard shortcut: New folder

Because Windows’ console interface is pathetic, users having Linux experience often find having to use the GUI makes even the most menial tasks a cumbersome process. Case-in-point: creating a directory. Having had enough of guiding the mouse pointer through the maze of context menus, I did some research and figured out a very easy keyboard sequence:

Shift + F10, w, f

“Shift + F10” opens the context menu, “w” takes you to the New directory, and “F” creates the directory!

Tuesday 22 January 2008

GNU C __attribute__ format

This __attribute__ allows assigning printf-like or scanf-like characteristics to the declared function, and this enables the compiler to check the format string against the parameters provided throughout the code. This is exceptionally helpful in tracking down hard-to-find bugs.

There are two flavors:

* __attribute__((format(printf,m,n)))
* __attribute__((format(scanf,m,n)))

but in practice we use the first one much more often.

The (m) is the number of the "format string" parameter, and (n) is the number of the first variadic parameter. To see some examples:

/* like printf() but to standard error only */
extern void eprintf(const char *format, ...)
__attribute__((format(printf, 1, 2)));
/* 1=format 2=params */

/* printf only if debugging is at the desired level */
extern void dprintf(int dlevel, const char *format, ...)
__attribute__((format(printf, 2, 3)));
/* 2=format 3=params */

With the functions so declared, the compiler will examine the argument lists

$ cat test.c
1 extern void eprintf(const char *format, ...)
2 __attribute__((format(printf, 1, 2)));
4 void foo()
5 {
6 eprintf("s=%s\n", 5); /* error on this line */
8 eprintf("n=%d,%d,%d\n", 1, 2); /* error on this line */
9 }

$ cc -Wall -c test.c
test.c: In function `foo':
test.c:6: warning: format argument is not a pointer (arg 2)
test.c:8: warning: too few arguments for format

Note that the "standard" library functions - printf and the like - are already understood by the compiler by default.

RPython can be faster than C

Check out the following link

Monday 21 January 2008

Connect T-Mobile Wireless Internet Through Your Cell Phone

You can find a hardcopy of this walk through on my blog at this location.

I recently took on the challenge of getting an old PC up and running with Xubuntu 7.10. My father recently purchased the T-Mobile Internet package, which allows him to connect his computer to unlimited mobile Internet for $20 a month. Setting this up proved to be easier than I anticipated.

1. The first thing you need to do is change the USB configuration in your phone. On my phone (a Motorola K1) and many other T-Mobile phones, you have to change your USB configuration: make your default USB connection a data connection. By default, most phones are configured to be in “Memory Card” mode.
2. Next, you need to install a piece of software in Ubuntu called “wvdial”. To do this, click on Applications>Accessories>Terminal. Once your terminal window is open, type in the following:

sudo apt-get install wvdial

3. Edit your wvdial.conf file. Type

sudo gedit /etc/wvdial.conf

in a terminal window to do this.

Once you have your wvdial.conf file open, paste in the following text over all the contents of the file:


[Dialer Defaults]
Init1 = AT+CGDCONT=1,”IP”,””
Modem Type = USB Modem
Phone = *99#
Password = pass
Username = user
Modem = /dev/ttyACM0
Baud = 460800

Take note of the “ttyACM0″ part. This may not be the same on your PC. To find out what yours is, attach your phone to your PC, and then type the following into the terminal:


dmesg | fgrep acm

You should see something like this returned in the output:

[ 9168.949496] cdc_acm 2-3:1.0: ttyACM0: USB ACM device

This ACM device is your phone, and it is now an accessible piece of hardware. For wvdial to use it, you must make sure the above configuration file points wvdial to the right device name. If the above dmesg output produces a different ttyACM#, change it accordingly to match your PC. (Note, if you don’t get any dmesg results at all, try typing this in first: sudo modprobe cdc_acm).

After your wvdial.conf file is created and your sure your Modem = /dev/tty line is correct, save the file and close gedit. Then simply run wvdial from the terminal:

$ wvdial

Wvdial will then access your phone as it is directed to do so by the wvdial.conf file, and essentially dial T-mobiles Internet Service Provider. No real username or password is required for this, so leave the user/pass in the above config file as it is written. You’ll see some output on the screen that looks like this:

user@user-desktop:~$ wvdial
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: AT+CGDCONT=1,”IP”,””
WvDial Modem<*1>: AT+CGDCONT=1,”IP”,””
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99#
WvDial Modem<*1>: CONNECT
WvDial<*1>: Carrier detected. Waiting for prompt.

At this point, the program will pause as it handshakes and establishes a connection using PPP. After about 10 or 20 seconds, the output will continue on and look similar to this:

WvDial: Don’t know what to do! Starting pppd and hoping for the best.
WvDial: Starting pppd at Thu Jan 17 17:50:28 2008
WvDial: Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
WvDial: –> PAP (Password Authentication Protocol) may be flaky.
WvDial: Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
WvDial: –> CHAP (Challenge Handshake) may be flaky.
WvDial: Pid of pppd: 13530
WvDial<*1>: Using interface ppp0
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: local IP address
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: remote IP address
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: primary DNS address
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]
WvDial<*1>: secondary DNS address
WvDial<*1>: pppd: ?06][08]?06][08]??[06][08]

Congrats! You are now connected to the Internet using your cellphone. And all you have to do to establish a connection is open a terminal window and type wvdial.

To end your connection, you can simply close the terminal window containing the above mess, or hit CTRL-C while the terminal window is open. So be careful and don’t close the window by accident, or your connection will be dropped and you’ll have to run wvdial all over again. Oh, the agony of typing that one command over again!!

Anyway, enjoy your T-Mobile Wireless Internet connection! You should see a steady downstream of about 20 to 30 KB per second, which is about 5 times faster than dial up. And it’s unlimited! It’s not DSL or Cable, but that’s still not a bad deal for 20 bucks a month.

Sopcast in Ubuntu

1) Download this, untar it and place sp-sc into /usr/local/bin/ :

2) Download the gtk-sopcast.deb and use gdebi to install it.

That should work out of the box. MPlayer wouldnt work for me, it may for others, but Kaffeine worked perfectly.


With AllTray you can dock any application with no native tray icon (like Evolution, Thunderbird, Terminals) into the system tray. A high-light feature is that a click on the "close" button will minimize back to system tray. It works well with Gnome, KDE, XFCE 4*, Fluxbox* and WindowMaker*

But, there is no drag 'n drop support .

Are You Ready For Blu-Ray?

A Beta version of CyberLink’s BD/HD DVD Advisor has been made available for free download from their website. The diagnostic software analyses system resources to check if they will be able to support playback of the next-generation discs, and recommends upgrades or troubleshooting support if the PC isn’t up to scratch.
Among the components it checks the capabilities of are the processor, graphics card, Blu-ray/HD DVD drive, system memory, operating system and playback software. To find out more, or to download the software, head over to

Running Windows, Linux And Mac Operating Systems

Avanquest UK has launched a virtual desktop product (created by Parallels Inc) that’ll allow you to run different operating systems and applications alongside Mac OS. Intel processor-based Apple Macs will therefore be able to run Windows, Linux and most other applications in Mac OS X without needing to reboot. Files will be shareable between Windows XP/2000 and Mac OS X by just copying and pasting them, which is useful.

Desktop for Mac will also come with Parallels’ Compressor, which allows Windows 2000, 2003 and XP virtual machines’ hard drive space to be reduced by 50% of more, so that Desktop for Mac isn’t constrained by memory and space requirements.

Sunday 20 January 2008

PowerTOP - Power Saver for GNU/Linux

Computer programs can make your computer use more power. PowerTOP is a Linux tool that helps you find those programs that are misbehaving while your computer is idle. The application that misbehaved the most was the Linux kernel. However, as of version 2.6.21, the Linux kernel went tickless, and no longer has a fixed 1000Hz timer tick. The result (in theory) is huge power savings because the CPU stays in low power mode for longer periods during system idle.

However... there are many things that can ruin the party, both inside the kernel and in userspace. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing at saving power, and which components are the biggest problems.

PowerTOP has these four basic goals:

* Show how well your system is using the various hardware power-saving features
* Show you the culprit software components that are preventing optimal usage of your - hardware power savings
* Help Linux developers test their application and achieve optimal behavior
* Provide you with tuning suggestions to achieve low power consumption

Switch between RDP and Desktop in Ubuntu

In most of the time, we use RDP in full screen mode, But,sometimes we have problem with minimizing the remote screen.
But, CTRL-ALT-ENTER key combination will help us to make the RDP terminal full screen to windowed mode. So that we can work with the desktop machine also.