I wanted to add a new device to my wireless network, but I had forgotten the wireless key. My network uses WEP encryption. So, I used aircrack to recover the key. Basically what I had to do was:

    • use airodump to save a large number of  transmissions between the wireless router and a device that is already connected to the network.
    •  use aircrack to analyse the file produced by airodump and find the password

In particular, I managed to recover the key in the following simple steps:

  1. Download BackTrack Linux Distribution and burn it on a DVD.
  2. Boot my laptop using the live DVD
  3. On command prompt type:
    ifconfig to see the available network interfaces in Linux. Doing this I was able to find my laptop’s wireless interface.
  4. Type: airodump-ng -write afile.cap wlan0 , where afile.txt is the file that airodump will save all communication and wlan0 is the wireless network interface of my laptop as discovered in step 3. Let it run and collect packets for quite some time. It may a few hours (in my case it took 6 hours) for this step to collect enough packets. The time it will require depends on the traffic of the network. The more traffic the better. Once enough packets have been collected press Ctr+c to kill the process.
  5. Type: ivstools -convert afile.cap afile.ivs to convert the captured packets to ivs format compatible with aircrack
  6. Use aircrack-ng afile.ivs. Aircrack will pop up a menu to ask you which network you want to crack. Select the SSID of your network and if enough packets have been collected in step 3, you will have the key of your wireless network in no time!

I recently wanted to get the usage of my CPU in C#. After searching the internet I found a way of doing it using the PerfomanceCounter class. I made a couple of changes and I created the following class, which seems to work.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;</code>

{
   public class SystemUtils
   {
      public static long getCpuUsage()
      {
        PerformanceCounter cpuCounter;
        cpuCounter = new PerformanceCounter();

        cpuCounter.CategoryName = "Processor";
        cpuCounter.CounterName = "% Processor Time";
        cpuCounter.InstanceName = "_Total";

        cpuCounter.NextValue();
        System.Threading.Thread.Sleep(1000);
        return (int) cpuCounter.NextValue();
      }
    }
}

Using the statement: SystemUtils.getCpuUsage() you should be able to get an integer number showing the CPU usage.

Update: The method described in the following proved to be useless in the summer, when the laptop became too slow (almost unresponsive). I guess setting the CPU Fan Control level to quiet does not work well when the environment temperature is relatively high. So, I removed the fan cover (all you need to do is remove 6 screws on my laptop) and injected some sewing machine oil on the fan! Now the laptop is TOTALLY silent again! Hurrah!

The noise level of the CPU Fan of my Sony Vaio VGN-SZ71E laptop was driving me crazy for the past few days. When the laptop was on, you could hear the fan operating even in the room next door. The fan was also producing vibrations, which I could feel when I had my arms on the keyboard palmrest! It’s needless to say you can’t work properly (i.e. concentrate on your work) under these circumstances.

I tried removing the chassis to see if I can replace the fan, but in order to have access to the CPU fan on this laptop model you need to disassemble pretty much everything! Luckily there is a workaround.

I had installed the Sony VAIO Power Management utilities, which allow me to manage the CPU Fan speed (Control Panel -> Power Options->VAIO Power Managent -> CPU Fan Control ). I set it to level  “1-quiet” and I have to say it is much better now.  Probably this has some impact on the performance, but this comes second to the peace of mind when working 🙂

I recently wanted to redirect the output of Log4j to a JTextPane, so as to output messages to the JTextPane using a different color depending on the severity.

I spent some time searching for information and I quickly put together a small example. The following screenshot shows the output.

[ad#half_banner_inline]

screenshot.jpg

The source code is available here.

Kaspersky antivirus and comondo firewall have rendered my windows 2000 laptop to be very slow. So I decided to give it a try with linux.

My set-up: A Toshiba 2450-S203 laptop (P4@2.8), an nvidia video card (don’t remember the details of the chip) and a wireless pcmcia linksys WPC11 version 4.

My experiences:

Mepis 6.5

First I tried Mepis 6.5. It worked very well out of the box and the wireless card connected to our router without a problem. However since Mepis 6.5 is based on an older version of ubuntu its repository has reaaaaly old versions of software. This was a problem and since Mepis 7.0 is coming out, I decided to try version 7.0 RC2.

Mepis 7.0RC2

Installed well, but I couldn’t make the wireless card work. I sent a post to the mepislovers forum and received a number of useful answers. It could be the version ndiswrapper that comes with Mepis 7, or the driver. So I had to either download the latest source code of ndiswrapper and compile it, or try different version… Too much work for a RC version.

Kubuntu 7.1

As I have been a windows user, I decide to go for another kde distribution, kubuntu. The installation went smoothly. However I couldn’t connect the wireless card to our router. Kubuntu would recognise it, but as soon as I tried to connect to the router… kernel panic! The caps lock light flashed and the system was unresponsive. I tried to blacklist the native drivers and use ndiswrapper with my windows drivers… but to install ndiswrapper it asked for the installation cd! (Even though I was already connected to the internet with my ethernet cable).

I managed to make it word with ndiswrapper and the system was quite stable. So, now let’s try ubuntu for a change…

Ubuntu 7.1

As expected I had the same problem with the wireless card and  resolved it using ndiswrapper again. I have to confess that I liked the interface better than KDE. It was quite fast and stable. The problem is that I need windows anyway (some .NET development, software which don’t have a linux version) . I can use virtualization (vmware) to run windows from within linux, but to do that I need more hard disk space and probably I will need again the firewall and antivirus installed.

The verdict?? I might try to switch to linux after I finish writing up, but right now I don’t have the time, resources (i.e. hard disk space) to do it properly. However there are some things I didn’t like. First of all in (k)ubuntu, when the native wireless card drivers crashed, NOTHING was logged in the log files, no warning, no nothing (at least a windows blue screen gives you a message with the address/module that caused the crash.).  The other annoying thing… why do you need the installation cd if you are already on the internet and the package manager can find the binaries on the internet?

I mean ok… you blaim windows for the blue screens of death, you blaim them for asking the installation cd all the time… so people say switch to linux (or get a mac).. you switch to linux and see things are not much better there.

Having said that I hope that some day I will have the time to be actively involved in a linux distro.