Invert Your Mind

NEWS:
01 Jul

Hidden folders in OS X file dialogs

Found a good shortcut for getting access to hidden folders in OS X file dialogs and the Finder. It requires some typing and it doesn’t auto-complete like Linux does, but it is better than nothing. Just hit Shift-Command-G to open the “Go To Folder” dialog and then type the path to the hidden file or folder. The path can be relative.

Now, just need to figure out how to access hidden files from the Finder and file dialogs.

19 Jun

How generics can pay dividends

One of the things I’ve noticed lately are some discussions regarding how cumbersome generics can be. They can take time to get right or figure out and some folks have gone as far as to stipulate that if you can’t do it without generics then something is borked.

While reading a lot of this, I’ve also being writing the MVC for JCatapult. I’m a big generic fan and I’m on the opposite side of the fence from a lot of the folks that have been generic bashing lately. I think that if you can’t get rid of all the unchecked warnings and use generics everywhere, you’re probably not doing something correctly. Of course this isn’t always possible, but I try to get there.

I’ve done some Rails work and some Grails work over the past few years. When it comes to dynamic languages, you are almost always getting the incoming HTTP request parameters into your actions as simple Strings. Therefore, if you want to do some math or pass them along, you might have to convert them a bit. This is how most first generation Java MVCs also worked. A few more modern MVCs did it a bit better. Struts2 for example uses OGNL and can populate JavaBeans with the values using a specific syntax like this:

user.address.city

These MVCs also go so far as to provide type conversion support. If you have an action like this:

public class MyAction {
  private int age;

  public int getAge() {...}
  public void setAge(int age) {...}
}

you can pass in the age parameter and the MVC will convert it to an integer. Most of these also handle type conversion failures decently well. Here is an example URL:

http://www.example.com/my-action?age=42

In many cases, these more modern MVCs will also instantiate classes for you and set them into JavaBean properties. The user.address.city example might map to this code (getters and setters have been left out):

public class MyAction {
  private User user;
}

public class User {
  private Address address;
}

public class Address {
  private String city;
}

Since the MyAction member variable named user is null, the MVC will instantiate the User class and set it into the MyAction class. Most of these MVCs hit a limitation when it comes to complex object modeling that uses collections. One of the main reasons is that from a legacy perspective (i.e.JDK 1.4) it was impossible to know what types of objects were being stored in a collection. Here’s an example:

public class MyAction {
  private User user;
}

public class User {
  private Map addresses;
}

public class Address {
  private String city;
}

There was no way for the MVC to understand that the Map contains addresses and that the keys are Strings like home and work. However, if you changed this code like this:

public class MyAction {
  private User user;
}

public class User {
  private Map<String, Address> addresses;
}

public class Address {
  private String city;
}

some modern MVCs can figure it out. The issue is that they don’t do a good job and many times fail horribly. So, I decided for JCatapult to fix this. JCatapult supports all flavors of generic programming when it is converting HTTP request parameters into objects. It supports arrays, Collections, Lists, Sets, SortedSets, Queues, and Maps. It also handles nested collections like:

Map > crazyAddresses;

It also supports handling multiple request parameters of the same name and converting them into generic collections. Let’s say you want to pass in a list of IDs using checkboxes like this:

<input type="checkbox" name="ids" value="1"/>Choice 1
<input type="checkbox" name="ids" value="2"/>Choice 2
<input type="checkbox" name="ids" value="3"/>Choice 3

These will come into the Servlet container as a single parameter that is an array of Strings. Your action can then look like this:

public class MyAction {
  private Set ids;
}

You could also nest these IDs inside another class. The nice thing about this is that using generics can reduce the amount of code you have to write to get access to a Set of Integers.

So, the moral of the blog post, generics are good things and can reduce overhead considerably.

27 May

Open source operating system quest

While waiting to see if my X300 sells on Craig’s list and before I eBay it, I figured I would go back to my roots and install a bunch of operating systems on the machine. It is very new hardware and I wanted to see what else is out there. For those who don’t know or haven’t ever read my white-paper, I wrote a fairly lengthy paper around 2000 that outlined how to build an open source operating system that was geared 100% towards desktop and laptop users. It covered mainly changes to Linux, but could be easily abstracted out to any operating system. It had things like:

  • Drop LHS (linux file system standard) in favor of a more friendly naming convention like /config, /system (or operating-system), /users, /applications, /libraries, etc.
  • Drop X-Windows in favor of OpenGL foundation with no networking and everything vector based where possible
  • Standard system APIs for everything, including graphics. No more Gnome vs. KDE vs. whatever
  • Better file permissions
  • Better login
  • Remove TTYs
  • Remove termcap and all that jazz
  • Assume latest modern hardware everywhere, even shell/terminals
  • Fix run-levels and services
  • Standard hardware abstraction
  • Better packaging (no more littering files everywhere)

It had a bunch of other stuff, but you get the drift. Some of this stuff has actually happened in the last decade or so. However, a lot of it hasn’t quite gotten there and Linux has suffered from more and more server syndrome that it probably will always be rough around the edges for desktops and laptops.

Anyways, back to the main point… I downloaded and installed a bunch of different operating systems and here’s what I found.

Linux (Ubuntu, Fedora, OpenSuse, etc)

Same old story. ACPI is rough, the CPU is a hog, the battery life is short, 3D desktop doesn’t quite work, missing drivers, bloated, etc, etc. Definitely a thumbs down on my scale, even though I am currently running Ubuntu on all my machines and love Linux to death, it still sucks for desktop and laptop compared to other OS’s.

OpenSolaris

Sorry to say that this is just like Linux with a different kernel and some minor tweaks here and there. It still runs X-Windows, Gnome and all the other Linux upper layers. Plus, it has worse driver support and very little modern desktop and laptop necessary support such as ACPI, CPU scaling, low voltage, etc. Definitely a thumbs down for now. We’ll see what Sun does. If they are smart, which they don’t appear to be yet, they would drop all the upper layers and build something better and new. They would also drop all the file system standard crap and just start fresh. They have the man power and the money to do it, just not the vision or the drive it seems.

Syllable

This is a very promising OS. They have a lot of the key components, but they have also been using Linux and Unix too long to deviate drastically enough to make it truly usable for the average Laptop and Desktop user. However, it still isn’t 1.0 and they might update some of these things. I never actually got it running, but from what I’ve seen on their website, they have the right idea. If I had some advice for all the developers and users of this OS it would be: hang a sign that says, “can my grandmother use this OS?” on your wall next to your computer and if that answer is ever “no”, fix things until it is “yes”. If I had a million bucks or so laying around, I’d definitely put my money on this project.

Hackitosh

Yeah, just wanted to see if I could get it running and the answer is no. Apple definitely has a great OS. Although some things are still lacking, it is probably the best out there right now. However, it runs best on Apple hardware and I’m not about to fight that. I’m planning on a 100% switch to Mac OSX here soon.

There are a few others that I didn’t get to like Haiku, but they seemed quite new as well and probably wouldn’t have worked all that well. Another thing that was lacking from most of the newest OS variants out there was 64bit support.

22 May

I can’t sell a laptop on Craig’s list????

So, some of you might have seen that my latest laptop purchase has been a complete disaster. I’ve decided to sell it and switch entirely to Apple hardware and software because at this point I just need an OS and machine that I can count on and is some form of Unix. The only ones out there that almost fit this bill are Apples. With Linux, there is always something.

I figured I would put it up on Craig’s list, save the fees and make it really affordable. Thus far my experience with Craig’s list has been absolutely horrific. Not a single person has responded to my posting that is actually in my area and NOT a scammer. I’ve received a number of emails asking me to ship the laptop to Nigeria after payment via PayPal, but those always sketch me out, even with PayPal for the money transfer. I’ve heard of folks using PayPal and then the credit card companies coming after them later for a refund.

It seems that people are still in the habit of using eBay for everything computer related. I find this sad because Craig’s list is much better on both sides because it is free.

As a last ditch effort, before I eBay this machine, I figured I would post my Craig’s list posting to my blog and see if anyone that reads my blog might be interested in the laptop. Here’s my Craig’s list posting for anyone that might be interested:

http://denver.craigslist.org/sys/688891861.html

14 May

X300 first impressions

Got my Lenovo Thinkpad X300 last week and I’ve been using it for development for only a few days. Here are my first impressions:

Pros

  • Very lightweight
  • Fast - the SSD drive seems to make some things pretty fast and the system is fast enough for the work I do
  • Nice screen
  • THE BEST KEYBOARD ON A LAPTOP (as all Thinkpads have)
  • The Trackpoint (never leave home row again)

Cons

  • The fan is the WORST PIECE OF CRAP EVER!!!!!

After much research and pain it appears that Thinkpads in general have a horrible issue with fan noise. Apparently, the Thinkpad BOIS pretty much refuses to turn the fan off and the fan goes directly from 1000 RPMs when cool to 6000 RPMs when hot. There is no intermediate fan speed. Well, needless to say that 6000 RPMs is extremely annoying.

I would definitely not recommend this machine to anyone looking for a solid work laptop because the fan noise is considerable enough that after an hour or two of working with that drone you are certain to have a monster headache and feel like throwing up. I’ll probably sell it and get an Apple instead. At least then I know I’ll have very little problems with the hardware.

© 2008 Invert Your Mind | Entries (RSS) and Comments (RSS)