Tag Archives: linux

Creating random files.

Here is a bash script to create 100 random files with random sizes smaller than 400KB. I needed this to quickly generate 100 files to use it on a stress test.

for ((i=1;i<101;i++)); do
size=`expr $RANDOM % 400`
dd if=/dev/urandom of=/tmp/testfile.$i bs=1024 count=$size
done

Explanation:

The for loop is pretty straightforward, it counts from 1 to 100.

size=`expr $RANDOM % 400`

This line generates a random number between 0 – 399

dd if=/dev/urandom of=/tmp/testfile.$i bs=1024 count=$size

This line generates a file with blocksize (bs / not bullsh!t) 1024 times the random number that we generated. The input for that file is the special urandom device in linux. (It’s the random number generator for the linux kernel)
The name of the file is also straightforward.

Lotus Notes 8.5 on Ubuntu 10.04

If you need to run native Linux client for Lotus Notes 8.5 on Ubuntu 10.04:

1) After installing your ibm_lotus_notes*.deb files, drop the following files under /opt/ibm/lotus/notes

libgdk-x11-2.0.so.0
libgtk-x11-2.0.so.0
libgdk_pixbuf_xlib-2.0.so.0
libgdk_pixbuf-2.0.so.0

You can get the files here.

2) Install msttcorefonts package: sudo apt-get install msttcorefonts

3) Go to File -> Preferences and choose Windows and Themes on the left pane. For Theme, choose Operating System Theme. This way most of the fonts in the UI look much better.

Gnome and the glslideshow screensaver setup.

First of all, setting up screensaver configurations in gnome is a total mess. I don’t know why they decided to release and use gnome-screensaver instead of using xscreensaver. And I don’t want to know either.

My ubuntu setup is an archaic one. It’s an upgrade over an upgrade over an upgrade. I probably upgraded 4 or 5 times. So my config files might be overwritten, wrongly upgraded, etc… But I was having this horrible issue of not being able to setup my glslideshow settings.

You can search this online. Mainly people are complaining about how to setup the directory from where glslideshow reads the images, also how to set it up so that it doesn’t idiotically show the same images 5 times over and over again. Well I’ll repeat these in this blog post and some more which are not covered.

Initial Setup:

First of all to setup the directory to read the images go to your home directory and create/edit file .xscreensaver like the one below:

imageDirectory: /home/username/Pictures/Slideshow/or/wherever

This sets up your screensavers that are using images, to use this directory instead ofΒ  /usr/share/backgrounds (the default directory). Some people on the internet tells you to symlink it to your directory, but I think this is a far better way of doing it.

If you read the glslideshow manual (RTFM), it tells you that by default glslideshow pans an image for 6 seconds (Ken Burns/Pan Scale effect) and displays it for 30 seconds. This means that the glslideshow will idiotically display the same image 5 times. (30/6=5)

In order to fix this issue, you will need to tell it to pan it n seconds and display it also n seconds. So the command should be:

/usr/lib/xscreensaver/glslideshow -root -pan 6 -duration 6

(-root means display on the root window which is the way screensavers work)

The configuration for this resides at: /usr/share/applications/screensavers/glslideshow.desktop

Go ahead and edit that file as root and change the line that reads:

Exec=/usr/lib/xscreensaver/glslideshow -root

to

Exec=/usr/lib/xscreensaver/glslideshow -root -pan 6 -duration 6

Now you are ready to have a slideshow that displays with pan/scale each image for 6 seconds.

And it all doesn’t work…

This is where the shit hit the fan for me. No matter what I did, my glslideshow was still running as /usr/lib/xscreensaver/glslideshow -root (ps aux | grep glslideshow)

After a stubborn and painful few hours I discovered that these settings were being cached in a file called: /usr/share/applications/desktop.en_US.utf8.cache (This is WTF number one)

If you look at this file, it’s a 56 KB cache file of all the settings gnome is reading for all of it’s applications!! I guess it should have been setup to delete it on restart but for some reason it never got deleted…

After renaming this file (never delete them, always rename them πŸ™‚ ) the slideshow started to run as I wanted it to be.

WTF number two was that when I tried to add new images to my slideshow directory, glslideshow never picked them up. At the end of another painful search I found that the list of images are actually cached in a file called .xscreensaver-getimage.cache under /home/username/tmp/ (username is your username). I got rid of that file…

So now, it looks like I have a slideshow screensaver which kind of works. And hopefully you too…

Nokia n900 new firmware is out.

Nokia released a 16 MB minor release for the n900. The firmware version is: 3.2010.02-8

I had some issues with the update. I basically ran out of rootfs disk space. The update application complains as: Not enough space in location. For me disabling all the extra repositories and running apt-get clean; apt-get autoremove did the trick.

This looks like a bugfix update, and might be paving the road for the PR1.2 release. Still official changelog is a mystery. For more info check this thread on talk.maemo.org.

Also the update takes another ~3 MB on your rootfs. πŸ˜‰

More about battery life on my n900

This battery life situation is kinda pissing me off. πŸ™

I wrote a script to get charge, battery %, and cpu load. Made it run every 10 mins to collect the data. I unplugged the phone at 9:40 am. No 3g, no wireless, very few interaction. About 10-20 mins phone conversation. And at 15:30 the battery was completely drained. It gives me 6 hours of battery life under normal conditions.

The handset runs very warm. I found a temp sensor in the /sys folder but I don’t know if it’s telling me the truth since it’s constantly at 38ο»ΏΒ° C. I contacted the Nokia support, I hope they can provide me something. Maybe I have a defect battery.

Here are the charts since I love them… πŸ™‚

Discharge graphic

Battery %

System Load

Nokia n900 review

Background information:
All and all I’m definitely a Linux person. That means my expectations from n900 was primarily to be hackable πŸ™‚ I’m also coming from the world of blackberry. My previous hand-held was 8320. Other than being an extremely well designed smart-phone for business and email, it was pretty much useless for me. In this review i will also try to compare them.

I actually wanted buy the new google nexus one, it turned out that being a T-mobile customer for almost ten years would actually not allow you to qualify for the discount price of $180 with a two year plan renewal. So I said phukitol, and went and spent my $500+ to a Nokia n900 instead of a Nexus One.

N900:
N900 is the flagship product of Nokia for 2009-2010. It’s running maemo as the OS. It’s the “other” linux based handheld OS currently developed only by Nokia (well apart being open source for most parts of it). It’s debian based. So ubuntu/debian users will find theirselves pretty much at home. (System wise of course. UI is completely unrelated)

It has a full qwerty (for US) keyboard. The screen slides up to reveal it. If you don’t want to use the physical keyboard, it also offers a virtual one. It’s kinda weird though because the virtual keyboard is a full screen keyboard πŸ™‚

It also has a great camera. Very good widescreen 800×480 resolution. It works with t-mobile 3g, which is first for me. I had a chance to test the 3g around Washington, DC and Providence, RI. I’m not very impressed. But when it really is on 3g things get super fast.

Goods:

  • Awesome environment if you are a linux person.
  • Great user interface. Very smooth and shiny. Almost never slow and never frustrating.
  • Basic applications are already bundled out of the box. Nokia default software repositories are setup. (Apt-get with a good UI) if you want community supported apps you have to enable the Extras(-devel|-testing) repositories. (Which is setup but disabled for Extras) More infor here and here.
  • Killer web browser. It has the new fennec in it. Fennec is basically mobile version of Mozilla Firefox. So far i had no issues opening any web page! It supports flash player, javascript… If you need one reason to switch from blackberry, this would be it. Zooming, Copy/Paste, Hovering are very well implemented.
  • The maemo SDK and emulator was very easy to install on my ubuntu. I will soon start hacking πŸ˜‰
  • It has all the beauties of a linux box. I mean ssh, sshd, terminal, vi, grep, more, busybox, etc… you get what i mean πŸ™‚ It’s a great feeling to port forward your home machine’s web server to localhost and open the web browser to browse your home machine through the ssh tunnel for example πŸ™‚
  • The media player is very very good. One really great thing is that it has an FM transmitter built-in! You can transmit your songs to any usable FM frequency and listen on a car radio for example. Including the network streaming radios! (Bridge between conventional and internet radio!) It also comes with a good in ear headset with microphone.
  • Great contacts management. With some tricks you can import your google and gtalk contacts and manually merge them. The contacts become a unified messaging system. You can call, gtalk IM, gtalk voice, skype, SIP call from the very same contacts manager. Merging contacts are also very intuitive and easy.

Not So Goods:

  • Battery: It is better than a laptop, but worse than a smartphone. OK, I’m heavily using the phone, meaning browsing, SIP, IM… And I was expecting a not so good battery life, but I wasn’t expecting this bad πŸ™ This is the only thing that is on the frustrating level. With daily usage (whatever that means) I get around 6-10 hours of battery life at max.
  • Email Client (Modest): It’s an OK client. It displays your emails, it let’s you write an email, if you are offline, it let’s you queue them and it knows how to send then when you get online. But it ends there πŸ™‚ There is no search! You cannot search your emails. If you are a blackberry convert, you would be dissatisfied. It needs improvements.
  • Applications: As you could imagine, there are not many applications Γ  la iPhone or Android. But there are a lot of good, stable open applications. For example, there is no google maps. (But there is a nokia maps app which is not that bad) I think with the popularity of this phone, there will be more apps out. Ovi Store is a good start.
  • Keyboard: It’s a good slim keyboard. But the top line of keys are sometimes hard to press because they are very close to the sliding “lid”. There is very little space to fit your fingers.

Overall, I think this phone has a lot of potential. It sleek, very sexy and user friendly. Absolutely a great potential for linux hackers and developers. If I would have an option to return it, I probably wouldn’t. And I’m happy that I didn’t buy a Nexus One. πŸ™‚

Note: Wow it looks like me and engadget did a review at the same time πŸ™‚

Digital Frame or bust…

I’m writing this entry to push me to finish my neverending story about the digital frame project I started. I’m hoping that the entry will give me some sort of ignition after more than a year.

I had an old Dell Latitude c600 sitting at home and collecting dust. Like many other old hardware I have at home… So I decided to convert it to a digital frame that I can hang it somewhere.

Here are my goals:

  1. Have a low power, low cost digital frame.
  2. Ability to manage it wirelessly.
  3. Make it easy to use
  4. Have fun.
  5. Make an old hardware happy.

The very first step was to dissect the laptop and remove the guts. It turned out to be somewhat challenging, but with the right tools and time, things moved pretty good. I’m not going to go into details on how to dissect a c600, but here is a picture in the late stages of the dissection.

Guts and glory

Next step was to remove all the unnecessary parts like battery, CD-ROM, and some mini pci cards like ethernet/modem combo. I kept the pcmcia slot for the wireless card, and while there, added some leftover RAM to it. After neatly placing them all together, here is how it looks with BIOS setup on. The image is tilted to get rid of the flash glare.

bios view

Now the software step. Of course my OS of choice is Debian/Linux. I installed bare minimum Debian with fluxbox as desktop manager. Al I needed to do was to find a low cpu/memory usage image viewer. At first I thought about not having a Graphic User interface, and use zgv from the console, but then I gave up since it was too much trouble. (Still I think it would be cool to have a console only picture frame, maybe on the next version)

Instead, I decided to use feh. I must say i’m extremely satisfied with feh and recommend to everybody πŸ˜‰ The only issue I had was that the mouse pointer was showing in the middle of the frame which was not a good sight. I used unclutter to get rid of that. (I had to hack the program a bit to my taste)

I wrote some scripts and changed some config files for all this to start automatically. I will share the scripts later when the whole project is completed.

Now that the computer part is done, I need to take the measurements and head home depot or similar place to create some base for the frame and also buy a nice looking frame to place everything inside. So I guess there will be a second part of the blog entry.

Here is how it looks like as of now:

Haris and me