Gmail address alias

Feb 4, 2010
Gmail is probably the best free email service available. Along with huge storage (7419.900081 MB & counting at time of writing this post), it also provides free pop and imap serivces. Gmail also offers some very interesting features like undo send, offline gmail etc. Here is a partial list of features.

One of the most coolest feature is email alias. Gmail neglects anything in between + (plus) and @. So any email address can be appended by string of your choice. This is particularly useful when you want to sign in to some less reliable site and you suspicious that the site can start spaming you. In case, a filter can easily take care of these spams. Similarly, Gmail do not recognize . (periods) in any email address. Thus you can insert any number of periods in your email id.
So, if your email address is firstname.lastname@gmail.com, then any email sent to any of the following address will be delivered to your inbox:
  • firstnamelastname@gmail.com
  • first.name.last.name@gmail.com
  • firstname....lastname@gmail.com
  • f.i.r.s.t.n.a.m.e.l.a.s.t.n.a.m.e@gmail.com
  • first.name...last.name@gmail.com
  • firstname.lastname+blog@gmail.com
  • firstname.lastname+my.blog@gmail.com
  • first.name...last.name+bank@gmail.com
  • firstname.lastname+this.site.is.not.good@gmail.com
  • firstname.lastname+@gmail.com
  • firstname.lastname+...+@gmail.com
  • firstname.lastname...+@gmail.com

To matter more interesting Gmail also offers another bonus. Any email ending in @googlemail.com is same as @gmail.com. So, any email sent to firstname.lastname@googlemail.com will also be delivered to your inbox. And yeah, you can replace gmail by googlemail in all the examples above without ruining anything.

Check unofficial user guide and complete gmail tips, if you want to get more out of your gmail.

Enjoy Gmail!!

Read more ...

cron scripts being executed at wrong time

Feb 4, 2010
Checked on: Ubuntu Karmic Koala 9.10

Few days back I was shocked to see that one of my cron scripts was being executed at 3:24PM, which was actually scheduled to be executed at 4AM. Probing with the system logs further revealed that none of the cron scripts were following the specified schedule. After googling a little bit I found that it is a common problem and has been discussed in many forums. Here is a synopsis of the all the discussions.

Cron is a utility, which is supposed to automatically execute specific commands periodically (daily, monthly etc). The preferences of the schedule for root is stored in /etc/crontab file and can be edited directly to make changes. Check this link to understand structure of crontab. Non-root users can also have their own cron schedule but their crontab file are located at different location. So, non-root users are suggested to use following command for editing their crontab. crontab -e Default entry of /etc/crontab is given below: # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user    command 17 *    * * *    root    cd / && run-parts --report /etc/cron.hourly 25 4    * * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6    * * 7    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6    1 * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) # Let us examine following line from crontab. 25 4    * * *    root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) It means that cron will execute following command daily at 04:25 AM as root. test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) The problem lies in first part of the command i.e. test -x /usr/sbin/anacron. The test command checks that whether the file /usr/sbin/anacron exists (& is executable), and if it exists then do not execute the next part (where actually scripts are being called). So, crontab is actually instructing to skip the execution of scripts at the scheduled time, if anacron is installed !! Sounds funny :) Clearly, this anacron is the culprit of all the chaos in schedule.

Anacron performs periodic command scheduling but without assuming that the system is running continuously. Cron schedules are not executed if the system is not running at the scheduled time. Anacron makes sure that these commands are run at the specified intervals as closely as machine uptime permits. Anacron reads a configuration file (/etc/anacrontab) that specifies the jobs Anacron controls, and their periods in days. If a job wasn't executed in the last n days, where n is the period of that job, Anacron executes it. Anacron then records the date in a special timestamp file that it keeps for each job, so it can know when to run it again. So, when a schedule is missed, the job is execute after next boot and a timestamp (depending on period of the job) is fixed for next run. This process may ultimately lead to timestamps which are too much out of the cron schedule. And this creates all the chaos.

Anacron is cron-complement (it requires cron) for laptop and home PC which are not running 24x7. So, Ubuntu Desktop edition have anacron installed by default and the crontab is configured so that cron is over ridden by anacron, if installed. The test commands can be removed from crontab as given below, if this default behavior is not required.

Note:
1. There are some known issues with hardware-clock time, when timezone is different. Check last few sections of this page.
2. fcron is intended to provide better features for periodic command scheduling.
Read more ...

Setting up VNC for GDM Login

Nov 12, 2009
Tested on: Ubuntu 9.10 (Karmic Koala)

Ubuntu has a Remote Desktop server (Vino), which can be easily configured. But personally I found it to be too slow (even on 100Mbps connection) and there is no option to get it up & running before actual GDM login. One of the faster alternatives is x11vnc. It allows one to view remotely and interact with real X displays with any VNC viewer. Following are the steps to enable x11vnc immediately after GDM (or XDM, KDM etc) loads. We will be effectively using XDMCP over VNC.
  1. Enable XDMCP
    • Older Ubuntu version: System->Administration->Login Screen Setup-> Tab XDMCP->Enable XDMCP. You can disable "Honor Indirect Requests".
    • Karmic Koala: There is no XDMCP Tab in settings. So add "Enable=true" in [xdmcp] section of /etc/gdm/custom.conf (or gdm.conf for older version of GDM). Check here for detailed instructions.
    • For others, just look through the settings and find XDMCP, make sure it's enabled.
  2. Disable Desktop Sharing with Vino under System -> Preferences -> Remote Desktop. Install x11vnc from repository.
  3. Create password for VNCsudo x11vnc -storepasswd yourpasswordhere /etc/x11vnc.pass
  4. Configure GDM to run x11vnc when it loads:sudo nano /etc/gdm/Init/Default & add this line to the file just before exit 0:/usr/bin/x11vnc -nap -bg -many -repeat -clear_keys -rfbauth /etc/x11vnc.pass -rfbport 5900
  5. Edit gdm configuration to make sure that x11vnc is not killed after being started.sudo nano /etc/gdm/custom.conf Add / edit KillInitClients option in the [daemon] section to:KillInitClients=false Also check this FAQ for recent changes and other workarounds in x11vnc regarding KillInitClients.
  6. Restart gdm (you can just reboot), and you are good to go.
Few things to be noted:
  1. x11vnc does NOT have any options for locking the server machine's display on connection with client. If this is an important security issue then other vnc servers like vino, tightvnc etc should be used. Refer comments for more details.
  2. You may experience endless key repetition / key pressing when logged from a client. Use "-repeat" options with x11vnc to check this behavior. Check this discussion for other alternatives.
  3. I experience initial delay (about 6-7 secs) in response from x11vnc whenever I try to make a new connection. Though, it responds nicely after initial glitch.
Edits:
17 Jan, 2010: [debug] changed to [daemon], as it makes more sense according to GDM manuals.
18 Jan, 2010: Added FAQ link in step 5.


Read more ...

Code Block for Blogger / Blogspot

Nov 12, 2009
Added following to template (Layout->Edit html) in body section: code { font-family: Courier; margin:.75em 0; border:1px dashed #CCC; padding:5px 15px; display: block; background-color: #F4F5F7; overflow: auto; white-space: pre; } Above box itself is result of <code>...</code> tag.

An example:code block retains the whitespace & any other formatting in plain text.
Another Example:T h i s is a realllllllllllllllllyyyyyyyy looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnngggggggggggggggg cooooooooooooooooooooode block
This is output of<blockquote> ... </blockquote>
blockquotes does NOT retains the whitespace OR any other formatting in plain text.

Note: Any HTML code between <code></code> is also treated as HTML. Use this HTML encoder to encode to HTML code before posting. Or, paste the HTML code in Compose tab (not in "Edit HTML" tab) of the post editor (Make sure that you have selected "Show HTML literally" in Compose Settings under Post Options).
Read more ...