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.