Setting up Cygwin and PuttyCyg
Getting Cygwin










Introducing Cygwin to your Windows

- ~/.bashrc
- ~/.bash_profile
- ~/.inputrc



Getting PuttyCyg
Configuring PuttyCyg to access local cygwin






A humble blog about life and software development




















While looking up some information about REST and RESTful services I've encountered a pretty amusing forum post that defines REST fan type hierarchy. Let me share the smile:
API Makers: I find them everywhere. They have a system, usually not built thinking on REST, and they want an API created. They usually think REST is an API making technique or recipe, for the web.
- URI Jugglers. This are the ones that think REST is all about creating URIs, and nothing more. So their discussions are solely focused on URIs, and their presentations are about URIs definitions.
- RPCers. Bad group that think REST is a way to map RPC in disguise using URIs in a web API. The most of them don't know they speak RPC at all.
- Exposers: This type is repeated below. Those are the guys that think you need to expose things in REST using resources. So REST is an API for exposing things on the web.
- CRUDers: Another repeated group. They think REST is a web api for CRUD. Simple.
Mappers: This other category may use the API idea, but they actually thing REST is a representation type and the work to be done is to map all that is know used to that new type. Interesting?
- CRUDers. Again, the idea is that CRUD can be mapped naturally to HTTP operations, and that makes it RESTful.
- HTTPers. They believe REST is HTTP. Deep enough.
- Exposers. Again too. They usually try to map all classes, data entities, elements into resources, and then call their systems RESTful.
<?xml version="1.0" encoding="UTF-8"?>
<data>
<entry id="1">entry number one</entry>
<entry id="2">entry number two</entry>
</data>
public class Entry {
private int id;
private String content;
//the usual setters and getters here
}
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File("data.xml"));
NodeList nl = doc.getElementsByTagName("entry");
for (int i = 0; i < nl.getLength(); i++) {
Entry entry = new Entry();
entry.setId(Integer.parseInt(nl.item(i).getAttributes()
.getNamedItem("id").getNodeValue()));
entry.setContent(nl.item(i).getTextContent());
System.out.println(entry);
//do real stuff
}
}
catch (final Exception e) {
System.out.println("Failed parsing: " + e);
//do real handling
}
Entry:{id: 1; content: entry number one}
Entry:{id: 2; content: entry number two}
DocumentBuilderFactory.newInstance() will usually return an instance of this implementation: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl for (Node n : doc.getElementsByTagName("entry") { ... }).
for (XmlSlicer piece : XmlSlicer.cut(data).getTags("entry")) {
//each piece is: <entry id="...">...</entry>
Entry entry = new Entry();
entry.setId(Integer.parseInt(piece.getTagAttribute("entry", "id")));
entry.setContent(piece.get("entry").toString());
System.out.println(entry);
//do real stuff
}
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
</repository>
<!-- other repositories -->
</repositories>
<dependency>
<groupId>com.googlecode.xmlzen<groupId>
<artifactId>xmlzen</artifactId>
<version>0.1.1</version>
</dependency>
A few months ago my MacBook finally died.
I will never buy a Mac again. Although I loved OS X, the hardware is terrible and heavily overpriced. My MacBook had bluetooth adapter and motherboard replacements in the first year of use, and it didn't really help. Then the warranty period was over and I used the all-broken-no-bluetooth-randomly-freezing-hard-drive-randomly-unavailable MacBook for another painful year untill one day the screen went black and never went back...
Here is a slideshow with my little MacBook disassembly project.
A month later I've bought myself a Dell Studio 1537 (with 3GB of RAM, 1440x900 screen and 3 years of warranty).
After installing Ubuntu 9.04 all I missed from MacBook was two finger scroll, which can be easily enabled anyway.
Too bad I'll have to discontinue Hawkscope for Macs, unless someone is willing to join the development and perform the builds. Anyone?
I've always wondered why torrents are packed into multiple archives, sometimes even archives inside other archives. Anyway, I've got fed up with all the unpacking routines, especially after downloading several seasons of something that has each episode in an individual folder containing 20 rar or zip files. So, after one evening of coding this nightmare is now over.
Here is the screenshot of the stupidly named tool (click to visit project page): 
It was also a good reason to try out new version of NetBeans. I still hate GUI builders, however for small "write and forget" kind of projects like Multi Unpacker it's a fairly good choice. However NetBeans is still slow and unresponsive in comparison with Eclipse.
So far Multi Unpacker is for Windows only, however it's a spare evening away from becoming cross-platform (and you are welcome to join the project). Too bad my MacBook broke down completely, so Macs will most probably not get any special treatment... This is also bad news for Hawkscope, unless someone is willing to donate me an old Mac? :)