Tag Archives: tips

Airlink Ultra Mini USB Adapter with Linux

We recently bought this Ultra mini usb wifi adapter for our laptop that had it’s internal wifi card fried. Since this laptop was acting really bad with Windows XP, we installed Ubuntu on it.

At first Ubuntu couldn’t recognize the adapter. Then I wanted to try ndiswrapper. All I had to do was to install ndisgtk (sudo apt-get install ndisgtk). It installs ndiswrapper-utils package as a dependency. Then point the ndisgtk to the .inf file of the driver.Β  (net8192cu.inf)

Here is a more detailed write-up for generic ndiswrapper configuration from ubuntu.

The ID for this adapter is: 0bda:8176
When you run lsusb it shows as: Bus 001 Device 002: ID 0bda:8176 Realtek Semiconductor Corp.
The manufacturer id is: AWLL5088

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…

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

Blackberry email reading tips

  1. This is my favorite: If you press J and K on the email list or while reading the email, it moves between previous and next emails in the context. (just like in the vi πŸ˜‰ )
  2. While reading and email, if you press N it goes to the next email, P to the previous email. And if you press same keys on the email list, it goes next day and previous day consecutively.
  3. Space key and Shift+Space key scrolls page by page the email list, or the email.
  4. T and B are shortcuts for Top and Bottom, no more scrolling like crazy to go to the end of an email πŸ™‚
  5. R is to Reply, L is to Reply All.
  6. U is to go to the oldest unread messages.

I hope this is useful πŸ˜‰

Call reports in FreePBX

I’ve been having hard time to understand the CDR reports from FreePBX. There were a lot of duplicates, lots of couple of second connection entries, etc… All I needed is to set a criteria and see the reports related to that criteria.

So here is how it goes:

  • I need only ANSWERED calls.
  • I need only calls longer than 30 seconds.
  • I need last 24 hours and also last month call reports.
  • I want the script to be able to run on cron whenever I want to, so the output should be purely “emailable”
  • At the end of the report I need the total talk time.

So I came up with this perl script. If you need similar stuff, please don’t hesitate to use it.

Here is a little howto:

First you need to edit the script to fit your database settings, it’s pretty self explanatory in the script itself.

  • cdrreports -d gives you the daily report (or the last 24 hours to be more precise)
  • cdrreports -m gives you the monthly report (or the last 30 days to be more precise)
  • if you run cdrreports without any arguments, it will give you all the calls you made so far.

Lastly, the way I use this script is by running from two cronjobs. One at night for the last 24 hours, and one every 1st day of the month for the monthly reports. It’s up to you how to use it πŸ˜‰