Sunday, September 7, 2008

once you go penguin, you don't go back

I was having a conversation with a colleague today who switched to Ubuntu a few months back and has not had to "boot into Windows since". Good deal, very much the kind of experience most people have once they start using Ubuntu. I have not yet switched to 8.10, but my experience with 8.04 has been exceptional. I still dual boot, but don't remember the last time I booted Windows.

And since I am Windows b*tching, I can't believe that Dell charges something close to $160 if you are purchasing and customizing your spanking new system and want XP instead of Vista. Because nothing says freedom of choice like having to pay extra for an older version of a software.

Not necessarily on topic, but had this link bookmarked about best free (not open source) software to try out.

Friday, August 8, 2008

manually mounting the windows partition

I had to manually mount my windows partition the other day because after a reboot, it did not get auto mounted.

sudo mount -t ntfs -o nls=utf8,umask=0222 /dev/hdb1 /media/c

Monday, July 7, 2008

inotify

I recently stumbled upon inotify. A set of calls to monitor file system events on an individual file or a directories.

Used in combination with read(), you can read an event from an inotify file descriptor that is "watching" files or directories. On a successful event, read() returns a buffer containing an inotify_event.

checkout man inotify for more information. IBM's DeveloperWorks has a good writeup on it here.

Tuesday, June 3, 2008

cool Firefox add-on


I am still struggling to make my peace with Firefox 3-beta recently...

But a new issue that has bothered me enough that I have had to switch to using IE on the Windows XP system at work, is that pages with lots of Flash or Java script content takes way too long to load and the browser completely freezes another 30 seconds - 1 minute after that.

I have tried the obvious things:
  • disable all add-ons
  • uninstall all add-ons
  • uninstall/reinstall Firefox
Switched back to using 2.0.0.14 which got me back all my Add-ons, but didn't still rid me of the problem.

Anyways, in the frustration, I stumbled onto a damn cool add-on call Tab Effect. Its a "Ubuntu desktop-effects-cube-inspired" transition between multiple tabs. And as expected, it is still not available for Firefox 3.

Oh well, I still need to find a solution to my Firefox woes.

header guard

When working on large software development projects, you often include header files from various parts of the source repository and a cool trick to avoid redefinitions is by use of "header guard".

The concept is fairly simple. Consider the following header files:
foo.h
-----
typedef struct {
int x;
} foo;


bar.h
-----
#include "foo.h"
typedef struct {
foo f;
} bar;


Now when you include these files as follows:
mainfile.c
----------
#include "foo.h"
#include "bar.h"
.....
.....


Obviously you will run into a "redefinition" error when compiled.

The solution:
Place
#ifndef /* unique symbol is generally some form of the file name */
#define
at the beginning of the header file, and
#endif
at the end of the header file.

What this does is that the first time the unique symbol is encountered, the symbol gets defined and none of the definitions in the header file are then redefined.

So foo.h would look like:
#ifndef _FOO_H_
#define _FOO_H_
typedef struct {
int x;
} foo;
#endif /* _FOO_H_ */


and bar.h is like:
#ifndef _BAR_H_
#define _BAR_H_
#include "foo.h"
typedef struct {
foo f;
} bar;
#endif /* _BAR_H_ */

Saturday, May 31, 2008

Splashtop: simple and useful technology......goes on my wishlist


I have been keeping up with the release news and information about ASUS Eee PC and am convinced enough that it is going to be my next laptop purchase. And if I needed more reasons to do so, Splashtop provides me with a really strong one.

The simple and useful idea is to be able to launch complete applications, browsers, Skype, instant messengers, etc without having to boot the entire operating system which typically takes up to 2-3 minutes.

It is bundled within the motherboard and is already available on ASUS laptops and is know as ASUS Express Gate.

I have very little knowledge about how such a technology would work. I would think the challenge of course is to run the entire application (hopefully in its full capacity and not a subset of features) with network access, which means a subset of the operating system features. I am guessing an application that access disk/local filesystem might present its own additional challenges.

Here is a good video demo about it:

new command a day / a few days / a week

Here is trying to start something that I probably will not be able to keep up with unless I keep a "floating" frequency option. The idea is to try and note a previously unused shell command.

Today's entry:
lsof -i : lsof will list open files, and the "-i" option is to list files/sockets for an interface.
Seems to be more useful as compared to "netstat" for listing open TCP/UDP connections.

example:
rutul@rutul-laptop:~$ sudo lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
avahi-dae 4865 avahi 14u IPv4 12827 UDP *:mdns
avahi-dae 4865 avahi 15u IPv4 12828 UDP *:50260
cupsd 4895 root 2u IPv4 12863 TCP localhost:ipp (LISTEN)
dhclient3 5601 dhcp 4u IPv4 12003 UDP *:bootpc
dhclient3 6112 dhcp 4u IPv4 11489 UDP *:bootpc
firefox 13310 rutul 19u IPv4 114592 TCP rutul-laptop.local:39018->ar-in-f191.google.com:www (ESTABLISHED)
rutul@rutul-laptop:~$

Tuesday, May 13, 2008

Linux file systems in a high-performance server

I was reading this article on analysing Linux ext(2/3/4)fs in a high-performance server environment as an appropriate file system.

The idea of the article certainly raised my curiousity and the start of it did pique my interest. I was looking for the answer to this particular question asked early on:
"Can Linux file systems, which I will define as ext-4, XFS and xxx, match the performance of file systems on other UNIX-based large SMP servers such as IBM and Sun?"

Unfortunately, the rest of the information did little to assert the claim that for now (ext3 fs) and in the near future (with ext4 fs), are not designed to support large file systems that are typical with high-performance server environments.

Fedora 9 released


Like a lot of open source and particularly Linux-as-a-desktop users, I spent a fair share of my time with early RedHat Linux and eventually Fedora releases until I was saved by Ubuntu.
In fact, I still use Fedora for various projects at work which are running either Fedora 6 or 7 depending on the confidence the rest of the development team has on the stability and the kernel. These are either server systems or even embedded platforms that do not have the traditional restrictions of processor speed, RAM or even disk space.
So, the news of interest today, has been the release of Fedora 9, which among some cutting edge features, includes KDE 4.0 that Ubuntu Hardy (8.04) stayed away from. I am not a KDE user, so my opinion on the impact is insignificant.

Monday, May 5, 2008

saving PDF forms

I have needed to save PDF forms after filling them with data instead of just having the option to print them. Obviously Adobe Acrobat Professional would do the trick, but in the world of free software, Linux and Ubuntu, it would be criminal to use that.

Found a very good software (free ware) called CABAReT Stage..."

... is a flexible software for your daily work with PDF-Documents. With it you may open and view PDF-Documents, complete and save PDF-Forms, as well as send them."

The Ubuntu install was just a download, untar and then running the ./cabaretstage.sh script.

the case of the disappearing audio - solved










An annoying little problem I ran into the other day:
  • After Firefox 3b5 and flash locked up the screen, I had to force power cycle.
  • On reboot, the master audio control showed it muted.
  • On un-muting, no luck. The audio was completely absent.
Solution:
sudo apt-get remove alsa-base
sudo apt-get install alsa-base (it prompted me to insert the 8.04 alternate DVD)

Sunday, May 4, 2008

more Ubuntu evangelism

People write blogs for various reasons. There are some really good Ubuntu users with well written blogs that describe Ubuntu features and tools and tricks when they have been brave and smart enough to try out the latest releases and new applications.

I like to think that I walk a couple of steps behind these users. Mainly because I always want to have a _working_ system as I don't have the luxury of a backup. Which is why I am still unhappy with an upgrade to 8.04 that installed Firefox 3b5 that disabled a lot of my add-ons because of incompatibility.

Anyways, without digressing too much, the point being that I write this blog mainly for evangelizing Ubuntu rather than it being a technical source of "all things Ubuntu". So, on that theme of doing my "job", I read recently a note from Eric S Raymond, a well known Open Source proponent and the author of some well known books (including the one I am currently reading). He switched from being a Fedora Core user onto Ubuntu. It is a common trend and the recent news about how Red Hat and Novell have decided to focus on Enterprise/Server markets rather than Desktops (thankfully!).

Monday, April 28, 2008

RTFM

Two skills that have deteriorated due to the excessive use of computers are:
  • writing with a pencil/pen.
  • reading, but not really reading.
Sure, the latter is, to some extent, a result of laziness. But having the option to search keywords in digital documents when reading them on a computer screen has contributed significantly.

The direct effect of this was felt very recently as I have been trying to manage a small personal website using Wordpress as a Content Management System (CMS). I am not web-development expert, though I do volunteer as a project manager/web developer for an organization that helps non-profits with their website needs.

Wordpress is great, pretty simple to use and with very little php or sql knowledge, you can have a pretty decent website (blatant link promotion) ready in minutes. Besides a few other things, I had a simple desire to have the first page/home page/front page be static and the dynamic content (blog, etc) be linked from there. Fairly simple as a feature, yet I managed make it way too hard on myself by not RTFming (this is a G-rated blog folks...) the manual.

As it turns out, it is fairly simple, and here are a few methods to do this:
a) Page-template + Configuration option
Create a page template for static home page and configure your wordpress settings to show static page and point your blog/posts to another static page. This is also a good way to have your static page also be dynamic, where say it shows your most recent 5 posts. You would do this by coding that part in the php template that you create.

b) php hacking
This seems more like a hack. And it worked well until I upgraded to Wordpress 2.5. Since then the link for pointing to the blog/posts always ended up taking me to the static homepage.

c) Adding a Wordpress plugin
A google search points me to more than one Wordpress plugin that is supposed to make setting (and managing) a static home page fairly easy to do. Never tried it.

Thursday, April 24, 2008

load of do-do

I believe one of the most brilliant examples of open source software projects is Firefox. Since I have been feeling a little bold these days (will write later about the experiences with Ubuntu 8.04 that was released today), so I upgraded to Firefox 3.0b5 on the Windows desktop that I _use_ at work.

The experience so far has been very disappointing.

1) This was expected, but it disabled a ton of Add-ons that were not compatible:
Answers
Firebug
Gmail Space
RealPlayer Broswer Record Plugin
Session Fix
View Source Chart (and I was just starting to use this...)
Zoho Notebook Helper
Zoho QuickRead

2) The integrated Flash Player is not reliable at all. Nuemorous times I have had to refresh the page because the Flash movie would not play on the frist attempt. Also, I have had Firefox crash due to the player.

3) More than a couple of times today Firefox has frozen when using multiple tabs and switching between them. I normally have about 5 to 8 tabs open which isn't a lot.

4) I have history disabled, but for a session, I was able to see all the urls that I have typed in. That has been replaced by what seems to be the bookmarks. Any way I can just see the history there?

5) Crashed today when playing a quicktime audio file (must have been mp3).

6) It forced me to write this post in IE!

Since I don't really care about the new features, to me it has just been a load of do-do. I quickly checked and Hardy has Firefox 3 beta 4 as its default browser. There has already been some noise about the issue with Flash player killing Firefox.

I am downgrading back to Firefox 2.

Wednesday, April 23, 2008

more of a good thing

Some news and information worth sharing.

* In a recent Open Source Census report, Ubuntu tops the list with 46% of installations. Its a global project to count the number of each open source distributions. Obviously it focuses on businesses, which gives Ubuntu an edge with it becoming the distribution of choice for desktop installations.

Want to sumbit a report for your organization?

* Also in relevant news earlier in the week, RedHat and Novell (Fedora for desktops) have decided to let Ubuntu be the distribution of choice for end-user desktop installations and concentrate their focus on desktops for commercial markets. In a way, Ubuntu is reaping the rewards of work done by the earlier by RedHat and later on by Fedora.

Monday, April 21, 2008

never go hungry ...feeds

I am slowly getting to a point where it just seems like there is more information that I am required to digest than I can keep up with. And having good tools to get you that information does make the task itself easier, but nothing makes the amount of information any lesser. Come to think of it, wouldn't it be great to have a hash function that maps segments of information into your brain with a key for easy retrieval later?

Anyways I digress. A few days ago I heard a smart person say that a good way to judge what the other person knows is just by looking at his/her OPML. In case you have your feeds on Yahoo!, if you are logged into your account, this is where you can get your OPML:
http://api2.my.yahoo.com/2.0/content/getsubs

I have been using Liferea Feed Reader recently which does a good job of bringing your feeds to the desktop. But I am looking for something prettier, something more apt for Ubuntu. Its adequate, but not attractive. Any suggestions?

cheesy name....yet useful


Terminator.....really? I guess sometimes you cannot have both; a useful tool and a good name (katapult anyone?)

Anybody who has needed to use the terminal, generally needs more than one all the time. So a tool that arranges multiple GNOME (I have never been a KDE convert) terminals on the screen and manages to add/remove/resize and jump between these multiple terminal windows is a useful addition to your applications.

On first impressions, Terminator seems to do the job nicely. When you launch it, you get one screen. You can split this horizontally or vertically and keep adding and use your screen space in an efficient manner. The moving between the terminals using the keyboard can take a little getting used to (ctrl + shit + n and ctrl + shit + p).

Seems like for Hardy (8.04) you can do a:
sudo apt-get install terminator

For 7.10 (yay! I finally upgraded) and below you need to download the source code and install.

Saturday, April 19, 2008

Ubuntu community strength

I am probably not the first to make this observation, but its worthy of a mention since the single biggest reason why I use Ubuntu is the strength of the community.

More often than not, you are going to find the information that is exactly relevant to what you are looking for in the Ubuntu forums or on another discussion through a simple Google search. That gives me enough confidence to try out anything that I am curious about and that remotely sounds of use to me. That makes the experience of using Ubuntu a very nice one and in turn the feedback the community developers receive of those new features improves them and in general the overall experience.

Since I have been having trouble enabling desktop effects (more on that in a later post), I have been trying out more than a few things including installing and removing packages (without completely understanding/reading the information). After one of such experiments, I ended up getting a "The X system keyboard settings differ from your current GNOME keyboard settings" message each time X server started. The fix, described with a brief explanation of the possible reason was found, where else, but on a Ubuntu forums thread.

upgrading to 7.10

The feature list for Gusty Gibbon (Ubuntu 7.10) never provided me reason(s) enough to upgrade from my fairly satisfactory 7.04. So, it was ironic that it was on the day when the 8.04 release candidate was announced, I decided to finally move up.

Some of the lessons learned in the upgrade process:

- You can upgrade only to the next release up. So 7.04 -> 7.10 -> 8.04 -> and so on.
- The Live CD is great for a new install. However, to upgrade from your current version, you need a alternate CD (make sure to check on the selection button that says "Check here if you need the alternate desktop CD".
- The best way to upgrade would have been to use the Network Upgrade method, but I have a slow wireless Internet connection and the (clever?) Update Manager never shows me that option.
- The entire upgrade process is fairly hands-off, prompts the users about 3 or 4 times, but does the bluk of the work without any inputs......the way it should be.

update - on Online Television and Ubuntu


A few days ago, I wrote about watching television online. Looks like my concern about having a common interface to be able to watch good quality shows from various networks on any platform (more specifically on my Ubuntu laptop) without having to install a different player is being address by a startup called Hulu.

All you need is a fairly recent version of Flash Player (probably Flash player 9 and higher). The quality seems great and they host content from a lot of networks including ABC and NBC. Of course television shows (new and old) isn't the only option available. There are full length movies and NBA network clips also available.

Friday, April 18, 2008

Linux marketing

I know I have been slacking (hey...it was tax season, and I also need to make a living), but have enough posts drafted out that I will publish over the next few days. Meanwhile, some Linux marketing that could cater to the consumer markets rather than enterprise vendors and customers:

Friday, April 4, 2008

top firefox extensions

One more along the line of "slacker" posts....

Some/all of my favorite Firefox extensions (not in any particular order)

ScrapBook - save web pages, notes.

Download Helper - Save YouTube and other Flash (.flv videos).

Yahoo and Gmail Notifier - Notifies you when new messages arrive. Though, it can be distracting if you are an email-addict.

CustomizeGoogle Options - I wonder how people who do not use this option ever have a clean Internet experience.

ScribeFire - Its a blog editor that pops up that makes it easy to post to your blog. Can be great if you think of something worth while and do not wish you spend a few clicks to log into your blog.

Google Notebook - It used to be useful for taking notes and putting links, etc that you can access from other machines. I use it most as a bookmarks tab that I can open in any place. Scrapbook is a better option.

There are a few extensions that are very useful, even for the minimal web-development work I do for non-profits:
Source Chart
Firebug
Web Developer
YSlow

Thursday, April 3, 2008

Online Television programming and Ubuntu

Have had this in the "drafts" section since a while.....

Even though I have a 46" LCD TV, I am not too keen on paying my cable distributor an exorbitant amount of money each month to receive HD, keep a DVR and then watch the few TV shows of interest on my own time which is generally between 12:30am and 2:30am in the night. So, the most convenient way for me is to watch them on my laptop which has a decent 15.4" screen and the Toshiba TruBrite (c) technology.

Obviously the convenience of not being tied to the television schedule helps, but even the commercials are fewer for the online versions and you can run some scripts while watching without having to look up from your screen!

As a simple desire, The Daily Show is available the next day in flash which plays in Firefox, so thats a start.

As for network stations, here is the breakup for the big three stations (non-cable)

ABC - This has probably the best quality HD programming which looks great on a large LCD if you try it. The catch is however, that even though it works great it Firefox, it needs Windows. I haven't checked recently, but I doubt there is a Ubuntu port for that flash player/codec?

NBC - They have some of their best shows (which is not many) available in flash and the player/interface is not bad. Plays in Firefox.

Fox - Their flash player also needs an installer for Windows, but probably runs in Firefox. Can't get it to play in Ubuntu...than again, I don't want to spend any effort figuring this out to be able to watch How I Met Your Mother!

I had read an article in Business Week a few months ago talking about this thing in particular; Online TV (as opposed to IPTV, which is a little different). Its an interesting read, and things are constantly changing it seems and moving in the right direction.....as far as the consumers are concerned.

trying out some apps

Over the last few weeks I have been lazy and distracted from doing actual work (as in something that pays) in the evenings. Thats why I have been doing searches like Top 10 Ubuntu applications.

Some of what I have installed and started using (not in any particular order):

Katapult (sudo apt-get install katapult)
Application launcher that matches the application name as soon as you start typing the first few letters. Launch it using Alt-Space.

Kopete (sudo apt-get install kopete)
Enhanced multi-protocol chat client, webcam and voice(?). Like the interface on first impressions, but it will take a lot more to move away from Pidgin.

GParted (sudo apt-get install gparted)
Gnome Partition Editor, utility for disk partitions that reformats hard drives into many formats including FAT16, FAT32 and NTFS. Will need to try it out soon since I am running out of disk space in my Ubuntu partition if I keep installing applications at this rate!

Some that I have installed and then un-installed (of course in that order):

Gayachi
Tried it as an enhanced chat client that does webcam and voice, but the interface is crappy at best.

Some that I would soon try (probably in that particular order)

Amarok
music player with last.fm plugin and some other features (I will find out).

Liferea
Desktop RSS feed reader (sudo apt-get install liferea)

Monday, March 31, 2008

MySQL and database design for Web 2.0

Disclaimer: I am not a Web 2.0 developer, just somebody who likes to read about technology and architecture design.

On O'Reilly Radar, which blogs about emerging technologies, back in 2006, there were a few interesting posts on how some Web 2.0 companies use databases that I stumbled upon recently.

p.s. I guess I need a new category for such posts not particularly related to Ubuntu or Linux or software.

Friday, March 28, 2008

metacity bug in 7.04

Yesterday evening when I booted my laptop and logged in, gnome started, but things were a bit strange. I could launch applications, actually a single application, e.g. Firefox, but it would start without any window handles (minimize, maximize and close) and missing the title bar. Moreover, I could not switch to another application if it was already launched.

So, after a quick search found out that it is a documented bug in Fiesty where "metacity" fails to launch. Since metacity is the default window manager, and it wasn't being launched after startup/login. All I had to do was to launch "metacity" from command line and things got back to normal. It also was able to run metacity the next time I logged in after logout and restart.

As always with anything Ubuntu related, I am not the first one to face this and the forums provide excellent information:
http://ubuntuforums.org/showthread.php?t=446881

Tuesday, March 25, 2008

Linux partitions (ext2 and ext3) from Windows

For reasons which don't hold much weight if I am willing to spend more time figuring it out myself (such as need to use Sopcast for watching soccer online), I have always had a dual-boot system, even in the ugly days when I was a RedHat/Fedora user. And my ext3 partition which hold Ubuntu 7.04, is just a small 10GB OS-only partition and my data is still on a NTFS partition that is accessible by both Windows XP and Ubuntu.

So, I have never needed to access anything from my Linux partition from XP. But, seems like there are enough free tools available to achieve this. The most useful being Linux Reader (freeware and closed source) and Ext2 FS (freeware and closed source). The options are nicely analyzed and explained here.
(p.s. Interestingly, I wasn't the first to think that I could prefix 'ubuntu' with my name/initial and it would be a clever blog title.)

Monday, March 24, 2008

hot sun


More news that shows how Ubuntu is gaining traction faster than any other Linux distribution recently. Its the perfect personal computer/laptop distribution, but has started to make significant headway in the Enterprise/Server/Data Center markets. Sun Systems has now started distributing its SMB servers with the option of Ubuntu:
http://www.sun.com/solutions/smb/products.jsp

RedHat does continue to dominate the server market, but having a strong vendor with not-so-cheap customer support/service can only be positive for Ubuntu. Also, the next release (8.04), contains several server-focused enhancements as discussed and mentioned here and there is talk about Dell and HP certifying their server-line products for Hardy Heron (8.04).

Friday, March 21, 2008

hardy heron

Today Ubuntu's next release, 8.04 beta aka Hardy Heron was released. I am yet to move from Feisty Fawn (7.04) to Gusty Gibbon (7.10), so thats that.

http://www.ubuntu.com/testing/hardy/beta

From the feature list, all the new stuff seems great. The most interesting feature is Wubi. Its an installer for Ubuntu under Windows. No partitions, or boot loader changes, just installs Ubuntu as a Windows Application. Right now, there is a beta for installing 7.04 on the Wubi site. Or if you are bold enough you can try the 8.04 installer here. That seems worth trying out on my work Windows desktop where I have been running Fedora and Ubuntu using VMware Server. The installer seems to download the image when you install, so judging by how my corporate network has been crawling, I would have to make that a weekend project one of these days.

Once again, Ubuntu takes a giant step in easing Windows users into Linux-world.

Tuesday, March 18, 2008

Vista toilet paper

I am not one of those extremist-Open Source supports with a tattoo of a penguin on my a** and a Linus shrine in my home office. In fact, I refuse to go Linux-only and still maintain a dual-boot with Windows XP (and refrain from labeling the Windows partition as "Windoze") because I still haven't figured out how to get Sopcast running in Ubuntu. But thats for another post.

However, this story about Vista toilet paper is still funny, even though uncalled for.

timeout

I have been sitting on the sidelines since the last couple of weeks as my laptop, which has had power problems before (it was just the connector then which I had fixed), suddenly decided to not cooperate anymore. It seems like not enough power is being propagated to drive the screen and the drives. Thats just my theory.

So, this is me taking a timeout for a few weeks.

On an unrelated note, I have been reading The Linux Journal these days with all this time that I have, and there are always so many useful notes in there for anybody with a faint interest in the Linux world.

Friday, February 29, 2008

wordpress upgrade - four simple steps

Recently I was forced to upgrade my wordpress and in the past having not had the patience to read the documentation, my attempts were not very successful.

So, it was good to have found a good source which described the process in four simple steps using the shell. It worked.

Step 1: Backup the existing database.
I would not want to lose my work, specially the blog, so against my natural tendency, I did backup.

[me@mywebserver]# mysqldump -u lazyinvestor -p > backup_`data +%m-%d-%y`

Step 2: Get the latest wordpress .zip and unzip

This would generally work, but you should be smart enough to know there are other ways.

[me@mywebserver]# wget http://wordpress.org/latest.zip
[me@mywebserver]# unzip latest.zip

Step 3: Overwrite all the new files onto your old ones

[me@mywebserver]# cd [to_whereever_your_wordpress_files_are]
[me@mywebserver]# cp -avr [from_the_unziped_latest.zip]


Step 4: Open http://yourblog_url/wp-admin/upgrade.php in your favorite browser.

Done!

brainstorm Ubuntu

There is probably is a clever marketing-theory terminology to refer to this, but some of the best feedback for any kind of product comes from people who use it.....a lot.

Check out http://brainstorm.ubuntu.com

The best part is you get to submit your ideas and also vote on what is of more importance to you.

Power management and suspend/hibernate enhancements obviously are high up on the list. That is all good for making Ubuntu better for laptops. Even though I am very a happy with how things run on my laptop, some things like efficient power-management enhancements and faster booting will be great additions.

Tuesday, February 26, 2008

TCP optimizations and sysctl

Time and again, I have needed to tweak a server running a variety of TCP/IP application(s) so that it shows some improvement with some simple steps. I am not a System Administrator, so the quickest trick for me is to tweak simple TCP characteristics:

a) Increase TCP window size
net.ipv4.tcp_window_scaling=1
b) Enable TCP SYN cookies. This prevents SYN floods on incoming connections
net.ipv4.tcp_syncookies=1
c) Increase TCP send and receive buffers
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

All these are edits to /etc/sysctl.conf which is a configuration file to configure/edit kernel parameters at runtime.

Do
#sysctl -p /etc/sysctl.conf
to enable your changes, and
#sysctl -a
to see what else has been configured.

Monday, February 25, 2008

hup hup and away

I have used other ways to do this, and never really thought about this until somebody recently asked me how to run a command so that it continues to run even after you exit the terminal/logout.

Since I have been working with systems software development, the first thing that comes to my mind would be to make your executable a service and use the 'service [program] start/stop/restart' commands to control it.
The other option is to use a tool called 'screen' which I did try it for a few months, but never got comfortable with the scrolling up/down.

The simpler (and probably more obvious) way is to execute the program such that it is immune to hangups i.e. the 'nohup' command.

example:
nohup ./keep_this_running

This will dump the output to a file called nohup.out.

To get more control over the output, try this:
nohup ./keep_this_running 1>output.log 2>error.log

be nice

In my previous post, I gave an example command to create an (uncompressed) ISO image from a CD/DVD. The actual command was preceded by 'nice -n +19'.

Briefly, a little bit about this 'nice' command since even though I don't use it very often, it can be a very useful tool, specially on laptops like mine where I am anyways struggling for processor resources.

So, 'nice' is a command for POSIX-complaint OS'es using which you can control the priority of a process with -20 being the highest value and +19 being the lowest priority. The default value is 0, which is inherited from its parent (shell being the most likely parent).

Obviously, a lot depends on how the scheduler is designed, where the 'nice' value is probably just a part of a complicated set of parameters used to determine which task should be run next. But, it does give you a user-level control, specially when doing non-priority tasks like creating ISO copies, etc.


Wednesday, February 20, 2008

and no DVDShrink

In the previous post, I talked about using DVDShrink to save .iso from DVDs onto your laptop so that you can play movies in your favorite DVD player just like you would with regular DVDs.

What I did not mention was that, IF unlike me you are not looking to _shrink_ the original DVD and are fine with your ISO using (almost for all feature DVDs) 8GB of your precious disk space, there is an easier way:
rutul@rutul-laptop: nice -n +19 mkisofs -dvd-video -V BILL_MAHER_IM_SWISS -o /media/sda1/BILL_MAHER_IM_SWISS.iso /media/cdrom > /dev/null 2> /var/log/mkisofserrors.log

But, if you ever (don't do it, it's probably illegal) want to make a DVD out of that .iso, you will need a dual-layer DVD burner and an appropriate disk.

dvdshrink

I wanted to write a little about Automatix before I got into details about how useful the packages installed using it have been. But life doesn't pan out as one plans.....I have been realizing that lately. Anyways, more about Automatix some other time. Just know that if you use Ubuntu as your primary OS, you will appreciate having that package manager along with the obviously awesome Synaptic Package Manager.

I sometimes don't get enough time to watch a movie that I have picked up from the library, and they don't allow renewals. So, I tend to keep a soft copy of the DVD onto my laptop in ISO format, so that I can play it later. This is great if you travel a lot and like to watch movies in flight.

Step 1: Get DVDShrink (trust me, just use Automatix)

Step 2: Configure it so that you "Create ISO file only" (very intuitive to select this).
Specify where you want to create the .iso (directory).
Specify you want to remove temporary files when done.
Start

Step 3: Once you have your .iso at the appropriate location, mount the .iso
sudo mkdir -p /media/movie
sudo mount -o loop BILL_MAHER_IM_SWISS.iso /media/movie/

Step 4: Play the .iso
totem /media/movie
or
xine /media/movie (trust me, get Automatix)

Easy enough and convenient enough.

Tuesday, February 19, 2008

more command line tips

I wrote a few days ago about a reference document that organizes the commands in well defined categories for quick look-ups. That is useful, but this list is probably better for users like me who know the basic command, but are too lazy and impatient with the man pages since the list gives the commands in form of examples, commonly used.

Oh well, as with the previous document, not sure if I will ever use it, but it never hurts to keep a bookmark.

Monday, February 18, 2008

software (un)development

My theory is that there are two kinds of software developers (broadly categorized); There are those that love the science, the art of programming and view each challenge as something to be designed and developed as a precious diamond. And the other kind who get things to work, get features completed and manage to write code that mostly works. I tend to believe that I belong to the latter category. Actually there is a third kind, but they should be fired anyways, so not relevant. But I digress.....

I recently read an interesting article by Joel Spolsky in Inc magazine about five reasons/ways a software project fails. Now, I might not be the best judge of what seem to be very obvious bad software development management practices, but I have observed these in my not very long development career, so they make sense to me.

It is really weird that managers, who have spent years in the field, and even those in successful companies and with successful products, are not immune to these bad practices. All of them should pick up a magazine or two, because asking them to read a book might be a bit too much.

Briefly, here are the reasons:
1. mediocre team of developers
Its the manager's responsibility to pick the right people.
2. set weekly milestones
Weekly? I have worked with someone who require a daily update!
3. negotiate the deadline
As in wishful thinking because the manager lacks the skills to do effective planning when starting off and as things progress.
4. divide tasks equitably
This gets even more interesting when the manager doesn't have a clue about the details of and tries to "balance" the project.
5. Work till midnight
If it takes X 1 hour to write a 5 line macro, can he write 10 macros in 10 hours?

I am sure I am not the only engineer who agrees with the list, specially due to having experienced this in their development-lifetime.

Thursday, February 14, 2008

coolbuntu

The desktop effects, with Feisty Fawn and then much more advanced in Gusty Gibbon are way too much fun to play around with. I have been meaning to write about my experiences, but thats for another post.

If you are every looking to get excited over funky desktop effects, make sure to check out the default effects and eventually, if your hardware supports it, beryl.

Wednesday, February 13, 2008

dosemu

Now this is one of those things where I wonder either I have to have way to much time to sit around and try this out, or I am just a nerd. But don't judge, if you grew up in the days of Windows 3.1 and Windows 95 playing shareware PC games (from those much coveted CDs included in PC Magazines), you will understand the joy of it.

DOSEMU is an emulation program for running a _lot_ of DOS executables in Linux. I believe WINE is great for Windows programs, but this is specifically for DOS, as in Dangerous Dave anyone?

And not surprisingly, for my Ubuntu laptop, all I had to do was:
sudo apt-get install dosemu

Next step, finding my most favorite games, Asteroids, Dangerous Dave, Need for Speed and Wolf. A Google search and some minutes on DOS Games Archives later, I was up and running Need for Speed!

Tuesday, February 12, 2008

et tu, Linux?

Well, how is that for a dramatic title? A little Shakespeare reference!

So, a few days ago, a _serious_ bug in the 2. 6 kernel (from 2.6.17 to 2.6.24.1) was discovered. Very well documented on what exactly it is and how to reproduce it locally (if you are one of those) in this Slashdot article. The issue is that a user can gain access as 'root' if the exploit is execute on your system, which means that now that user has complete access to your system.

On my personal laptop, it obviously doesn't matter. The issue is when you are running multiuser access servers, as in a University network. I am not a systems administrator, but if I was, I would be worried to say the list.

Well, it didn't take long to find a patch.

For us smart Ubuntu users, don't worry about things if you don't know what a patch means. Because we have the strength of Synaptic Update Manager with us. Just simply click on the update notification (which you should have received sometime today) and relax. If you are really curious, this is the issue that was patch'ed. It will update all the necessary headers, kernel image and source files.

If you are one of the unfortunate Fedora or RedHat users and running the affected 2.6 kernel, applying the patch to your kernel source and recompiling the kernel is do-able, but not without raising your heartbeat a few notches. This might work for you:

1. Get the patch from here. It also has a lot of information of how to apply it, etc.

2. cd to the kernel source (hopefully you have it installed). Generally should be /usr/src/linux-2.6.x.x. If not installed, try this:

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2

3. Apply the patch to the kernel source.
patch <

4. Compile and install. This can be little tricky if your kernel configuration (.config) is not created for your system. This would be the case if you just downloaded the source.

If you have the .config for your system, just follow these steps:
a)
$ make

b)
$ make modules

c) $
su -
# make modules_install

d) $
make install

This should have created the following in your /boot:
* System.map-2.6.x.x
* config-2.6.x.x
* vmlinuz-2.6.x.x

e) Create initrd image:
# cd /boot
# mkinitrd -o initrd.img-2.6.23 2.6.23

f) Update /etc/grub.conf (as in I am not a fan of LILO)

g) Say a prayer and reboot

Friday, February 8, 2008

conky

As I spend more time on my laptop these days, I tend to play around with the more _cooler_ tools that make the whole Linux-as-a-desktop-experience a little more interesting. Very recently Linux Trovalds expressed his thoughts on Linux desktop which is an interesting read.

The tool I enjoyed mucking around with recently is called conky - a light weight system monitor that embeds itself into the desktop and you can configure it to feel and look exactly how you want it to.

Of course, the Ubuntu experience is worth spending a few minutes configuring it exactly the way you want it to with all the information you can get from this forum. As you try and set it up to give the exact bits of information, this list of conky variables is very useful, however I am having trouble setting up the following two things:

- battery display only works when the laptop is charging.
- the wireless-link bar doesn't display anything.

My .conkyrc

Tuesday, February 5, 2008

glamorous != software development

As almost every software engineer, I wish our jobs can gain acceptance in society as being a glamorous profession one day! That way I can get rid of my fake visiting cards in which I am a model scout and live in LA but travel to Europe once a week, but which gets tiring since all that the models ever want to do is go out drinking........well I digress, but you get the point!

Anyways, if you like reading nerdy-stuff, Slashdot had a link to this vent written by a software engineer/developer with a pretty unique take on making it sound way more interesting than it really is. But hey, if that changes the opinion about "our kind' for the cute red head at the coffee shop next door, I am not complaining.

Monday, February 4, 2008

mobile penguins


Ever since Google's Android development platform was released, I keep noticing the Linux mobile development platforms getting a lot more news. Either that, or its like when you are decide to buy a car and then suddenly you start noticing only that model on the road everywhere.

LiMo, recently announced it will be coming out with a standard specification for creating shared and open mobile applications/platforms. There is another group, Linux Phone Standards, doing pretty much the same thing.

Lot more details in this news.com article.

The most interesting however was reading about how Ubuntu is making a strong impact on stacking claim as being the best distribution for being the best platform for mobile/handheld devices. Gusty Gibbion (which I have yet to try out) includes support for Ubuntu Mobile and Embedded (UME) project that "aims to derive an operating system for mobile internet devices using Ubuntu as a base".

There is this nice tutorial on quickly getting yourself acquainted with the embedded development framework and tools to get start.

I want to get myself involved with one of these projects, but I am still thinking of what application do I really want built into my phone? I am old fashioned I guess since besides wanting to make and receive phone calls reliably, I really don't expect much out of my phone.

Sunday, February 3, 2008

slashdot - data center

Going through Slashdot used to be part of a daily routine some time ago. Anyways, I had gone through this interesting article on Slashdot's data center setup back in October, 2007. It was certainly an interesting read, since it is good to know what it takes to setup and administer a pretty heavy website.

The interesting part was reading about what software they would be running on the Web Servers. As expected, all of their 16 servers run Linux, but RedHat 9 (really???...well, I guess this was setup back in 1999). I guess the distribution doesn't really matter as long as you can manage and upgrade whenever necessary.
In addition, they have 7 databases, running CentOS.

I am not an administrator, but the second part of the article did get into details about the Apache setup on the 16 servers which could be interesting to read.

Friday, February 1, 2008

pdsh - rsh to multiple remote systems

A useful tool, specially when you are working with multiple systems/servers is pdsh. A variant of rsh, where it runs the command on multiple remote systems. And it does this smart where it fans out sending the command (multiple threads) so that we are not waiting for timeouts on some connections if that happens.

The man page is fairly detailed, and the impressive feature is that the command accepts host lists in general format (Its not really regular expressions, but does the job effectively. ) I can do the following:

[rutul@rutul-laptop]#pdsh -w 10.35.74.[66-72] ls
10.35.74.72: anaconda-ks.cfg
10.35.74.72: bin
10.35.74.71: ssh: connect to host 10.35.74.71 port 22: Connection refused
10.35.74.69: ssh: connect to host 10.35.74.71 port 22: Connection refused
10.35.74.66: anaconda-ks.cfg
10.35.74.66: Desktop


Pressing ctrl-c once shows status of all the connections:

pdsh@rutul-laptop: interrupt (one more within 1 sec to abort)
pdsh@rutul-laptop: (^Z within 1 sec to cancel pending threads)
pdsh@rutul-laptop: 10.35.74.67: command in progress
pdsh@rutul-laptop: 10.35.74.68: command in progress
pdsh@rutul-laptop: 10.35.74.70: command in progress

and another ctrl-c within one second aborts:

sending SIGTERM to ssh 10.35.74.67 pid 8161
sending SIGTERM to ssh 10.35.74.68 pid 8162
sending SIGTERM to ssh 10.35.74.70 pid 8164
pdsh@rutul-laptop: interrupt, aborting.

Very useful if you spend some time working on clusters and are clever at scripting.

heavyreading....for later

I haven't yet setup the LAMP server that I mentioned in a previous post, but once I am up and running, I expect to do some tuning for performance improvements.

IBM's DeveloperWorks often has some very up-to-date articles on Linux and open source and came across this series of 3 articles that seem a good starting point for the experiments I could do to optimize my setup.

If I get around to it, will try and document my experiences.

Here are the individual links:
Part 1
Part 2
Part 3

in case of emergency

On one of the embedded devices that I write software for, I am running the 2.6.21 kernel patched with preempt-rt patch. I won't get into discussing what my opinion of real-time Linux is right now, so save that for a later post.

But, since the device is going to be deployed in a 24-7 environment, I figured it might help to reboot the system in case of a kernel panic rather than having it sit around since the privilege of console access is not affordable.

The solution, configure /etc/sysconfig.conf :

kernel.panic = N # to reboot immediately
kernel.panic = 5 # to reboot after a 5 second delay

You will notice the change in /proc/sys/kernel/panic, which means, you can change this at runtime by doing:

echo 5 > /proc/sys/kernel/panic

Wednesday, January 30, 2008

making things easy - single command for any archive

Since we are on the topic of commands (previous post), I have been using this simple utility (called "e") that makes it possible to extract almost _any_ type of archive. I have been able to use it successfully for .zip, .tar, .tar.gz, .tar.bz, .deb and (wait for it.....) .rpm.

It is written in Ruby and recognizes the type of source from its content and not by extension.

It's cool....now I will never need to remember the "-" options for any of the individual commands. But thats the least impressive benefit according to me. The fact that it allows me to extract an RPM package is the best. Check this post out about using rpm2cpio to extract an RPM (of course without installing it) since there is no option with the 'rpm' command itself.

example:
rutul@rutul-laptop:~/tmp$ e php-5.1.4-1.esp1.x86_64.rpm
./etc/httpd/conf.d/php.conf
./etc/php.d

.....
.....
./var/www/icons/php.gif
19188 blocks
rutul@rutul-laptop:~/tmp$ ls
etc php-5.1.4-1.esp1.x86_64.rpm usr var


However, not much success with this experiment. A few days ago, after I compiled a kernel RPM, installed it and created the initrd image, I had trouble booting because it was missing some modules. So, I had to dig into it to check if everything I had wanted did get compiled/build in.

So, this is what I had to do:
mv initrd-2.6.21-1.3194.fc7.img initrd-2.6.21-1.3194.fc7.gz
gunzip <>

Now I tried to do:
rutul@rutul-laptop:/boot/tmp$ sudo e initrd.img-2.6.20-16-generic
gzip: initrd.img-2.6.20-16-generic: unknown suffix -- ignored

ERROR extraction not successful with these files:
initrd.img-2.6.20-16-generic: gzip compressed data, from Unix, last modified: Tue Jan 29 02:03:36 2008, max compression

As you can see, no luck there.

aging = losing memory = need a command line list

Not that I like to think only age is the factor here, but recently more often than before I have had the realization of forgetting commands, specially since in my world a shell is the best place to get real work done...GUI tools are for "girlie men"...not that girls don't use shell...oh well, you get the point.

So, here is a pretty good reference guide, indexed/arranged by sections:
  • System information
  • Shutdown (Restart of a system and Logout )
  • Files and Directory
  • File search
  • Mounting a Filesystem
  • Disk Space
  • Users and Groups
  • Permits on Files
  • Special Attributes on files
  • Archives and compressed files
  • RPM Packages ( Fedora, Red Hat and like)
  • YUM packages updater (Fedora, RedHat and like)
  • DEB packages (Debian, Ubuntu and like)
  • APT packages updater (Debian, Ubuntu e like)
  • View file content
  • Text Manipulation
  • Character set and Format file conversion
  • Filesystem Analysis
  • Format a Filesystem
  • SWAP filesystem
  • Backup
  • CDROM
  • Networking (LAN and WiFi)
  • Microsoft Windows networks (SAMBA)
  • IPTABLES (firewall)
  • Monitoring and debugging
  • Others useful commands
You could download the zip file HERE.

search for a server distribution


I never have had to think about Linux distributions and comparing those in order to get a system (desktop or server) installed and running. I almost accidentally stumbled upon Ubuntu for my personal laptop and cannot be more glad that I did.

However, here is the challenge: I am currently researching in the background. The charitable bug in me helps out (volunteers) a non-profit with their website needs. They want to move to hosting their own Web server instead of paying a hosting company. So, I am tasked with finding the right hardware (still under research) and getting the server up.

Of course it has to be a LAMP installation (which I recently found out is the right term to use for a Linux running Apache, MySQL and PHP...clever). The question is, which Linux distribution do I go with?

I would have thought running a Google search with the words "comparing Linux distribution for web server" should have brought something up......apparently not. Or resources such as DistroWatch would have yielded an article or two on the topic. Found a few comparison charts, but nothing in particular for Web servers.

So, here is the thought process so far. I have always thought of RHEL as the "first instinct" server installation. Probably is the most popular one. Fedora should not be too far behind/very different than RHEL, and I have used each of those over the last 3 or 4 years, but I don't find either of those charming/clever. Not that I am going to need my web sever to have either of those qualities, but hey, I get to decide here! Also, I never have been able to spend too much time on Debian, Mandrake, Slackware or SUSE. So unless I find out _very_ convincing arguments in favor of either of those, I might not be willing to spend any time of my own installing and analyzing.

Now, that leaves me with Ubuntu Server Edition. I am already happy with my Desktop version. Have spend enough time with the distribution, playing with the system tools, etc in case I need to use those. Here is what I am expecting:
- simple and quick thin client server installation.
- reliable performance.
- simple security (SELinux-kind, only simpler) = no useless open ports. I don't want to be running and analyzing too many things with nmap.
- some level of smart power management. That could save a few $$

Will post my experiences when I get around to it.

Monday, January 28, 2008

anomaly - IE for Linux


It's like how the tail was/is a vestigial organ for homo sapians that eventually will get phased out due to lack of usage. But for now, having IE run under _might_ have some use, like if you do web development, testing for IE or once in a while when you run into those IE-only sites.
So, here is how you do it: IEs4Linux

Seems like a it installs IE and setups Wine accordingly. I was able to verify Flash works fine.

Here is the challenge apparently which I am going to have to spend some time on. I sometimes watch soccer online (living in USA does force you to be innovative if you are a football fan, and that just doesn't mean learning to call football soccer) and this requires me to use IE and Sopcast.

I believe qsopcast should get me to a point where I am able to run the streams in the stand-alone player. But integrating it into Firefox doesn't seem to be supported yet. Maybe I can get Sopcast to work with ie4Linx?

Sunday, January 27, 2008

Ubuntu documentation

Most of the time, I find information that I am looking for at various places (as in google searches), but there is an official Ubuntu Documentation project here. that is well maintained and very useful.

For example, something that I have been wanting to do, but never needed to until today (so had to look it up) was to mount the NTFS partition (that I use to boot into Windows XP) with both read and write support. Found a fairly good documentation on that: https://help.ubuntu.com/community/MountingWindowsPartitions/ThirdPartyNTFS3G

Really helpful.

bootstrapping the blog & first impressions


Back in July of 2007, I installed Feisty Fawn (7.04) on my personal (read: cheap) laptop (Toshiba Satellite M35X-S149, only upgrade was to 512MB RAM) after receiving the Live CDs and haven't stopped being impressed by this wonderful software ever since. They (who?) say that within the first three seconds of a new encounter, you are evaluated… even if it is just a glance. Ubuntu does score a ton of points there.

So, before I move on to Gusty Gibbon (7.10), I figured it was time to start writing about my experiences, tips, tricks, hurdles and notes instead of having that information all scattered around in my mind, in notebooks or in emails.

As a start, the first thing I remember that impressed me most (even when running just the Live CD was that my integrated wireless card was up and running without any intervention.

Another useful thing was that during the install, for user creation, it was able to recognize the Windows partition (XP Home) and was able to add the user already present for Windows (password, profile, etc). Cute.

After the install, I discovered command line package management with "apt-get" is great to use. The unique concept of not having a "root" user login is something that takes a little getting used to, but the more you use it, the more it seems to make sense.

My first few installs were:
- Macromedia Flash plugin for Mozilla/Firefox
sudo apt-get install flashplugin-nonfree
- sudo apt-get install build-essentials
- sudo apt-get install libncurses5-dev
- sudo apt-get install azureus

Thats a short list, but I was already up and running most of my commonly used applications with what was installed as default.

Lets gets started.