Archive for August, 2009

Automating Screenshots with AutoHotKey

Posted by admin on August 27, 2009
examples / 3 Comments

This is a tiny little script that can be extremely useful.

1
2
3
4
5
6
7
8
9
10
loop
{
; /capture=0 takes a screenshot of the whole desktop
; /capture=1 takes a screenshot of the active window
; /capture=2 takes a screenshot of the client area of the active window
Run, "%A_ProgramFiles%\IrfanView\i_view32.exe" /capture=1 /convert=d:\screenshot\capture_$U(`%Y-`%m-`%d_`%H`%M`%S).png
sleep, 30000
leftclick, 100, 10
}
return

This script will
1. take a screenshot of your active window (capture=1),
2. save it on your D:\ drive,
3. wait for 30 secs (30,000 millis)
4. click at the (100,10) point of your screen
5. … it will start the loop again.

Tags:

Notes on PCB

Posted by admin on August 25, 2009
Arduino / Comments Off

This is more of a list of notes on custom PCB design rather than a proper post…

There is a pretty good tutorial on how to use Eagle on SparkFun.com. Eagle (the freeware version) can be downloaded for free here.

There is also a very useful library with most of the components available on Sparkfun.com here.

if you want to create a custom Arduino shield, a good starting point is this Proto Shield on ladyada.net.

There is a good list of companies that can produce pcbs on the cadsoft website.

SparkFun (through BatchPCB.com) and nuElectronics offer custom pcb manufacturing services; BatchPCB is basically sending everything to China and I’m assuming nuElectronics does the same.

Tags: , , , , ,

Arduino & LCD Smartie

Posted by admin on August 16, 2009
Arduino, examples / Comments Off

This weekend I played with the Arduino/LCD Smartie combination and I was impressed both by the results and by the simplicity of the whole project. If you have the right LCD shield and you don’t have to do any soldering, you can be up and running in 10-15 minutes.

For those who are not familiar with LCD Smartie (from the LCD Smartie website on sourceforge.net): LCD Smartie is software for Windows that you can use to show lots of different types of information on your LCD/VFD.

To use LCD Smartie with the arduino board, an LCD is required (duh…). I used a 16×2 LCD Shield, made by nuelectronics.

To get this up and running, I downloaded the modified 4 bit LCD library and LCD Smartie on Arduino sketch (both files are available here. This takes less than 5 minutes.

After that, it’s only a matter of setting up the LCD Smartie options. I spent most of my time trying to decide which messages I would like to see on the screen.

Here are a few examples:

Free space on D: Drive

The above example, shows the space available on my D: drive.

CPU & Memory usage

This one shows the the CPU and RAM usage.

Uptime and current IP address
This example shows the uptime and the current IP address.

Buttons

You can set LCD Smartie up to rotate the messages. I set mine to 3 secs per message. If you have many messages and you need to quickly get to get to a specific message, you can use the buttons on the shield for navigation.

Other available messages include title of incoming emails, RSS feeds, Winamp info (title, artist etc).

Now all I need is to build a nice little box for it… :)

Tags: , ,

simpleDateFormat in Processing

Posted by admin on August 12, 2009
Processing, examples / Comments Off

I spent about an hour, trying to figure out how to use the simpleDateFormat java library in Processing… It seemed so straight forward, yet I couldn’t get it to work…

Well, it seems that the only thing I had to add is a try/catch.

So, this example works:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import java.text.*;
Date myDate;
 
void setup(){
SimpleDateFormat myDateFormat = new SimpleDateFormat("yyyyMMdd");
 
try {
myDate = myDateFormat.parse("20001010");
} catch (Exception e) {
  println("Unable to parse date stamp");
} 
 
println(myDate);
}

but this one does not, even though there is no error to catch…

1
2
3
4
5
6
7
8
import java.text.*;
Date myDate;
 
void setup(){
SimpleDateFormat myDateFormat = new SimpleDateFormat("yyyyMMdd");
myDate = myDateFormat.parse("20001010");
println(myDate);
}

I’m not sure why this is the case. If anyone does, please let me know!

Tags: ,

Oomlout.co.uk – order received…

Posted by admin on August 12, 2009
Components & Materials / Comments Off

On Sunday night, I placed an order on the oomlout.co.uk site for a few bits I needed for a small project I’ve been working on.

I received the parcel on Tuesday morning and was very pleased with the fast delivery. When I opened it, I was really impressed with everything. First of all, all the components were in small resealable anti-static bags with a sticker with a description on them, which meant I could just put them in a box without worrying that I would forget where is what.

The second thing that really impressed me was that they actually included the description sheets for the multi-color LEDs and the force Sensitive Resistors I ordered. These sheets are also available on their website, but it was actually extremely handy to have them by my side, when I had the soldering iron on my other hand!

Last, but definitely not least, was the quality of the components!

I can fully recommend Oomlout.co.uk and I will be ordering again from them :) .

Tags: , ,

Parsing files with Processing…

Posted by admin on August 08, 2009
Processing, examples / Comments Off

In the following basic example, I’m using Processing to parse a 2GB textfile.

The textfile I’m using (content.rdf.u8) is from the DMOZ.org project. You can download the compressed file here.

As mentioned earlier, the size of the textfile, content.rdf.u8, is approx 2GB. For a sample of the contents and structure of the file, follow this link. For a file of this size, it’s important to use BufferedReader. Read here for more on BufferedReader.

The following piece of code, reads the textfile and converts it to another textfile of the format: URL|Title|Description|Category:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.util.regex.*;
 
String fileName = dataPath("C:\\Users\\Arkadian\\Downloads\\content.rdf.u8") ;
String outputFile = dataPath("D:\\dmoz\\data.txt") ;
 
String sep = "|";
String outputLine = "";
String L = "";
String t = "";
 
PrintWriter output;
output = createWriter(outputFile);
 
try
{
  BufferedReader file = new BufferedReader (new FileReader (fileName)) ;
 
  while (file.ready()){ 
 
    L = file.readLine(); 
    //println(L); //for debuging only...
 
    String[] m1 = match(L, "<ExternalPage about=");
    String[] m2 = match(L, "<d:Title>");
    String[] m3 = match(L, "<d:Description>");
    String[] m4 = match(L, "<topic>");
    String[] m5 = match(L, "</ExternalPage>");
 
    // Start of an external page & URL
    if(m1 != null){
      t = L.replaceAll("<ExternalPage about=\"","");
      t = t.replaceAll("\">","");
      outputLine = t;
    }
 
    // Title
    if(m2 != null){
      t = L.replaceAll("  <d:Title>","");
      t = t.replaceAll("</d:Title>","");
      outputLine = outputLine + sep + t;
    }   
 
    // Description
    if(m3 != null){
      t = L.replaceAll("  <d:Description>","");
      t = t.replaceAll("</d:Description>","");
      outputLine = outputLine + sep + t;
    }   
 
    // Topic
    if(m4 != null){
      t = L.replaceAll("  <topic>","");
      t = t.replaceAll("</topic>","");
      outputLine = outputLine + sep + t;
    }    
 
    // End of External page
    if(m5 != null){
      println(outputLine);
      output.println(outputLine);
      output.flush();
    }    
  }
}
 
catch (Exception e){
  println ("Error" + e) ;
}
 
output.close();
exit();

Pretty simple, yet effective…

Tags: , ,