Saturday, 17 May 2014

Eclipse: ClassNotFoundException indicates erroneous project setup





Seems like an awful way to start the day!

Do you keep your projects / modules warning free in your IDE? As i have found out not every developer does. It starts from the beginning though. In my experience it is crucial to start off from a clean working environment in regardless of your profession. If you are working with software why not keep them tidy as if you were working with carpenter? You don't want to step into nails would you?

The screenshot i take from an example project setup (created for this very post) indicates a common issue. A library reference is out of synch in the referenced project (stub) making the other project (implementation) unable to compile.

What happened is that i altered the referenced library name from log4j-1.2.17.jar to log4j-1.2.18.jar. Then the stub project tried to warn me that there is something fishy but just as developers do regularly i ignored the warning. Then when trying to execute the test ExampleServiceTest.java for the implementation project after some changes i cannot do so. ClassNotFoundException? This is happening because the bin folder of the implementation project vanished during a clean+build and since the referenced module cannot be built anymore my project is also not working anymore.

To my amusement developers with a couple of years of experience start to claim that the IDE is stupid because "my class is there you see? why does it say it's not there!".

Tools can be faulty i agree. But maybe we should use them well then start to make culprit of them.

Sunday, 23 February 2014

Comparing SSD with HDD

I decided to give away my 250 GB Samsung HDD to my friend as i have no real use to it anymore. We can say it has low 'milage' on it - in practice it was only used for 2 years and only during the weekends in my 'second' PC.

Before giving it to anyone of course it worth to clean it. I thought i use Ubuntu's built-in 'Disk Utility'.


When i was looking for the option to erase all content i realized this is a great opportunity to compare my 64 GB SSD (Samsung also) to this HDD. The 'Benchmark' feature offers two mode. Read-Only mode or Read/Write mode. I had to go with the first as the latter one requires an empty disk. The benchmark will give you:
  • Minimum read rate
  • Maximum read rate
  • Average read rate
  • Average access time
Of course i remembered some figures from magazines where they compared SSD to HDD respecting these attributes but i was excited to see this in action. First let's see the HDD graph:


What amazed me is the dispersion when it comes to the access time (marked as green). The average read rate was 121.2 Mb/s. Now let's see how the 'non-spinning-cousin' performed:


Note how balanced the access time graph is. Also it was measured to be around 0.2 ms. The average read rate was about 261.8 Mb/s.

I am using this small SSD in this PC for around a year and it turned out to be a great investment for me. I had issues running Java application servers for development and using the SSD i could get away with 2GB DDR2. As i only use this PC on the weekend i did not want to invest too much in DDR2 RAM which is outdated anyway. Startup time is next to nothing and i don't mind the 64 gigs of available space as this is a machine i use for work only.

What are your experiences?

Tuesday, 24 December 2013

Christmas lights (led) with Arduino

This is a very quick post just to say Merry Christmas(!) and also to give you a small kick towards LED control using Arduino. I advise you to visit Jeremy Blum's great tutorials then you can quickly put this together.

"ingridients"

  • Arduino panel (can't think of one which you could not use) + USB cable
  • Breadboard
  • Wires
  • 4 LED
  • 4 270 OHM resistor
Let me just share the code here without any schematics of the wiring (straightforward):


const int RED = 13;
const int YELLOW = 12;
const int GREEN = 11;
const int ORANGE = 10;
const int pause = 500;

int programStates[12][4]={
  {HIGH, HIGH, HIGH, HIGH},
  {HIGH, LOW, LOW, LOW},
  {LOW, HIGH, LOW, LOW},
  {LOW, LOW, HIGH, LOW},
  {LOW, LOW, LOW, HIGH},
  {HIGH, LOW, LOW, HIGH},
  {LOW, HIGH, HIGH, LOW},
  {HIGH, LOW, LOW, HIGH},
  {LOW, HIGH, HIGH, LOW},
  {LOW, HIGH, LOW, HIGH},
  {HIGH, LOW, HIGH, LOW},  
  {LOW, LOW, LOW, LOW}
};


void setup() {                

  pinMode(RED, OUTPUT);     
  pinMode(YELLOW, OUTPUT);     
  pinMode(GREEN, OUTPUT);     
  pinMode(ORANGE, OUTPUT);     
  
}

void setLed(int port, int state) {
  
  digitalWrite(port, state);
  
}

void loop() {

  for (int i = 0; i < 12; i++) {
    setLed(RED, programStates[i][0]);
    setLed(YELLOW, programStates[i][1]);
    setLed(GREEN, programStates[i][2]);
    setLed(ORANGE, programStates[i][3]);
    delay(pause);
  }  

}
And let's see it in action:


http://www.youtube.com/watch?v=eaK2H-Soen8
Youtube video