I use a virtualbox virtual machine to run Ubuntu from within Windows (yes, I know I am a masochist). Anyway, every time I resume the virtual machine Ubuntu loses connection with the internet and I have to reset the interface. In windows from the command prompt you have to do an ipconfig /release and an ipconfig /renew. Similarly in Ubuntu all I had to do was the following:

1. sudo ifconfig to get a list of all the network interfaces. There you can see the name of the networking interface that you need to reset. In my case I wanted to reset interface “eth3”. So I did:
2.sudo dhclient -r eth3 to ipconfig /release
3.sudo dhclient eht3 to ipconfig /renew

That’s it! Got a new IP and I can access the internet!

This morning I came out of the shower and found my iPhone on the floor. I had forgotten the alarm on and since it’s on vibration, the alarm was ringing for quite some time until the phone fell on the floor. I picked it up and the home button wasn’t functioning, the speakers were dead and it wouldn’t charge. The phone has been like that for the whole day.

I just came back from work and I decided to use a novel approach based on strict scientific/engineering reasoning. I let it fall down again. I picked it up and it didn’t recognise the Sim card. Ooops… I switched it off, removed and re-inserted the Sim card and turned it on. It’s back to normal! The home button works, the speakers are loud and clear and it charging at this very moment!

I have received an Email with the top 50 programming quotes. Here are my favourites:

  • “Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning.” – Rick Cook
  • “Walking on water and developing software from a specification are easy if both are frozen.” – Edward V. Berard
  • “They don’t make bugs like Bunny anymore.” – Olav Mjelde
  • “A C program is like a fast dance on a newly waxed dance floor by people carrying razors.” – Waldi Ravens
  • I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.” – Bjarne Stroustrup
  • “In the one and only true way, the object-oriented version of ‘Spaghetti code’ is, of course, ‘Lasagna code’ (too many layers).” – Roberto Waltman
  • “For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match.” – Bill Bryson
  • “Good design adds value faster than it adds cost.” – Thomas C. Gale
  • “Perfection [in design] is achieved, not when there is nothing more to add, but when there is nothing left to take away.” – Antoine de Saint-Exupry
  • “The best programmers are not marginally better than merely good ones. They are an order-of-magnitude better, measured by whatever standard: conceptual creativity, speed, ingenuity of design, or problem-solving ability.” – Randall E. Stross
  • “To iterate is human, to recurse divine.” – L. Peter Deutsch
  • “The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.” – Seymour Cray
  • “Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” -Linus Torvalds

And my favourites:

  • “You can’t have great software without a great team, and most software teams behave like dysfunctional families.” – Jim McCarthy
  • “Beware of bugs in the above code; I have only proved it correct, not tried it.” – Donald E. Knuth
  • “Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday’s code.” – Christopher Thompson
  • “First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.” – George Carrette
  • “Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves.” – Alan Kay
  • “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” – Martin Golding
  • “There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare
"Programming today is a race between software engineers striving to
> build bigger and better idiot-proof programs, and the universe trying to
> build bigger and better idiots.
> So far, the universe is winning." - Rick Cook

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.