Tuesday, September 16, 2008

Curing TB - now with free cellphone minutes!

There's a fascinating, and slightly gross article here which talks about the difficulties in curing TB in developing nations. The short of it is that it is really hard to convince most people to continue to take their pills for a whole six months. I've been told this is quite the problem the world over. When I was in the Philippines last year, it was definitely present there, and presents huge problems because if you don't take the whole 6 months of pills, the viruses predictably come back more resistant to antibiotic treatment, hurting not only the person involved but everyone that they might spread the resistant TB too. This is a very cool solution to a very real problem, and worth the read.

Thursday, September 11, 2008

Let's make power with a string!

Alrighty, this isn't software related, but it is darn cool. Shawn Frayne, a 28 year old inventor has managed to create a device that harness the power of wind at 10-30 times the efficiency of a windmill. These devices are very small and can be produced very cheaply, and could be a great boon to remote, developing locations such as Haiti. Check out the video from popular mechanics.

Tuesday, September 09, 2008

Social Justice Programming

It's hard to be a programmer who cares about the world around you. There isn't the directness of other disciplines. You can't walk up to a starving child and give them a sheet of code, it just doesn't help. If you're a water engineer, you can help build a new well. A sanitation engineer can help with desperately needed, erm, sanitation. Agriculture, nutrition, etc, these are all very directly applicable and needed skills throughout the world, but Software Engineering is harder.

Still, I am a Software engineer, and I love it, so how do I help? I have been struggling with this idea for years, but now I've decided that I want to start bringing it to my blog, and the first, somewhat quirky thing I'd like to mention is mobile phone money. (Yes, I hear the skepticism, but hear me out!) :)

There are a couple new project, one called M-PESA and the other called "Hello Money" and both of them are being launched in more violent, less safe parts of the world, and for good reason. It turns out, according to David Birch and Bruce Sterling at the LIFT|ASIA conference, that cash is actually the hardest thing for poor people to use, and it is no wonder that in places like Kenya, people use their SIM cards as currency because they are more secure and less dangerous to carry than paper money.

Also, thanks to the fantastic people at Adaptive Path for turning me onto this.

Monday, June 09, 2008

Properly Naming Exceptions Is Important

I just got done spending over an hour debugging an OutOfMemoryException in a C# application I have. It was a really peculiar error because it began spontaneously in an application that primarily just iterates over about fifty thousand images in a repository and resizes them for the web. This was peculiar because the application had already run succesfully many times for the same data set with no memory exception.

Regardless, I dutifully set up lots of different memory freeing mechanism, going to the final state of forcing a Image.dispose() and forced garbage collection after every single image. Still OutOfMemory. DANG YOU!!!

Ok, so what it turns out is that if you are attempting to load a corrupted image file using C#'s Image.FromFile(), it crashes with the very unhelpful OutOfMemoryException instead of something more useful like ImageCorruptedException. Heck, I would have settled for IAmTooLazyToThinkOfAnActualException, at least that wouldn't have misled me so much :)

Thursday, May 15, 2008

Flex 3 - Get the text of your DataGrid Item

The task (which you would really think should be simple) is to get the text of the current DataGrid element in a custom drop-in itemRenderer. This can be useful for a lot of reason - for me specifically, I wanted to use the same renderer for an entire DataGrid and color things one color if they're less than 5 and another if they are more than 5. But to do that, you have to create an itemRenderer that knows which column it is in in order to retreive the correct data. Sadly, this took me several hours of searching and not only could I not find any proper solutions, but I ran across a number of dated examples that sent me in the wrong direction.



So, without further ado, getting the text of your DataGrid item in an ItemRenderer:


private function getItemText():Object
{
return data.elements(getColumn().headerText);
}

private function getColumn():DataGridColumn
{
var dg:DataGrid = (listData) ? DataGrid(listData.owner) : null;
var column:DataGridColumn = (dg) ? dg.columns[listData.columnIndex] as DataGridColumn : null;

return column;
}

Tuesday, May 06, 2008

Yet another reason to choose bittorrent...


I wish Hulu had been done right, but seriously, when it is *easier* to pirate than to "do the right thing" something is just wrong with your business model.

Tuesday, August 21, 2007

How to tell if you're a programmer

Apologies to Jeff Foxworth, but: If you search for "test" in your gmail account and google just says "hundreds" because it doesn't want to count them all, then, you just might be a programmer.

Friday, August 17, 2007

The Right Caption

"I'm in your rain. Owning your roads."

Thursday, July 26, 2007

Shoes of Humility + 2


Look at them, sitting there smugly. They think they've foiled me, but I know where they sleep...

Ok, some background needed - I've finally managed to get up to running half marathon distances, and I have constant, completely irrational dreams of winning races. Some people just run for the exercise. Some people run so they can eat more. I run to win races. Full disclosure dictates that I mention that I am excruciatingly slow and have never finished better than the top third of any distance race I've ran, but the dream lives on.

Having run my last pair of shoes into the ground, I bought this pair, above, and they have proceeded to attack my feet at every opportunity. Today, I wasn't able to run more than 20 minutes in them before crippling foot pain and blisters forced me to walk back to my truck. Everyone passed me and gave me that look that meant, "Wow, you sure have a lot of running gear on for somebody who's just walking slowly." Even the tag-along friends gave me that look (that's the friend whose super-athletic best friend somehow tricked them into coming running with them). I definitely learned some empathy for the trail walkers today. Well played, Adidas Supernovas, well played, but I've got something to say to you: Yo mama was a rubber tree. Yeah, I went there.

Wednesday, July 04, 2007

A What Server?

So as not to be too mean, I won't link to this, but I was browsing the Seattle craigslist web design jobs and I came across these qualifications:

Strong knowledge of Visual Studio / ASP .Net (C#)
Sequel Server 2007
Microsoft Exchange
QuickBooks Enterprise Edition v7

That must be like Server 2007 II, the Sequel.

Thursday, June 07, 2007

Vista and the ASUS A8N-SLI Deluxe

This is a post for all you folks out there pulling your hair out trying to get Vista to install on your ASUS A8N-SLI Delux MOBOs. If you're anything like me, you keep hitting the screen where it says choose a hard drive and you get blankityblank/zero hard drives. It askes for drivers, and you may keep feeding it the RAID drivers that ASUS has over and over again, but to no avail. Fear not: I have discovered the solution.

Move the SATA cable 2 inches to the right. :D

As it turns out, only the interior SATA plugs are controlled by those dreaded SATA RAID drivers that Vista can't figure out. The external SATA plugs are instead controlled by the nForce chipset, which Vista has drivers for built in. I googled this one to death and couldn't see a solution posted anywhere, so hopefully, this will help some poor soul. :)

Saturday, January 27, 2007

Of Fish and Kettles

I just wanted to give two big shout outs today.

The first is to my friend Jordan, who just launched a website for lending things to/from friends. I really wondered how useful this thing would be, but then at the launch party last night, I discovered three different things that my group of friends had and were willing to lend that I'd been wanting to borrow from somebody for months, and I had to just think to myself, "This is cool."

And the second is to my friend Tom who has been systematically gutting things around his house and turning them into aquariums. Normally, this could be considered suspect behaviour (he's from the UK, I gotta spell it that way), but I think the results are actually pretty darn cool. You can find him at adifferentkettleoffish.net

Monday, November 20, 2006

The Horrors of Objects

So, I discovered today, as is proved by a screenshot below from digg's RSS feed, that C++ is actually 21 times harder than C!

Tuesday, October 31, 2006

Ubuntu Edgy

Let me start off by saying that Ubuntu Edgy is awesome. Throw on a bit of Automatix after that, and it's a heaven-sent operating system - unless you upgrade. If you upgrade, everything just blows up. Your eclipse stops working, and that experimental fix that you pushed to the website? Well, it's going to stay there for a while as you fight your install and fight it and fight it, and then finally save *everything* off to another disk and re-install from scratch.

This is palantar signing out, saying, "Don't Upgrade Your Linux"

Wednesday, July 19, 2006

CSS Code Blocks

Ok, this is just silly, but I hate having to experiment and look things up, so I'm thinking you aren't so different. Here, I've layed out in CSS a basic little css block to create those nifty little blocks of code that you see everywhere with their fancy formatting. The following CSS block defines the look of the code. Add that to your CSS file, or template file, or wherever :)

.code {
font-style: bold;
margin: 0 0 1.5em 0;
padding: 0 0 1.5em 14px;
background-color: #EEEEEE;
font-family: monospace; font-size: 14px;
border: 1px solid black;
}

Now, in your post/document/etc just surround your post with the following: <div class="code"> and </div>

Wednesday, June 21, 2006

AGAD!! (Tutorial-ish sort of post)

Please note this blog has now moved Here.

Asynchronous Google (Web Toolkit) and Django

Personally, I think that the acronymn is way more fun to say than "Ajax". Picture this, you're sneaking up behind someone at a party... you wait until the perfect moment when the music has just paused slightly between songs and you yell one of two things, you yell "AJAX!" or "AGAD!" Also, it should be noted, that the person you chose to sneak up behind has been horribly disfigured by a childhood accident involving large quantities of a brand-name cleaner. NOW, which are you going to yell? At this point, the superiority of AGAD should be evident, but just in case not, I will proceed to actually talk about it.

The Google Web Toolkit (GWT) is designed to work primarily with a Java backend, but a lot of people, myself included, don't really want to mess with the monolithic terror that is a Java backend, and so Google provides a JSON interface as well. In my most recent application, I decided to use JSON to communicate between the GWT front end and Django backend. The results are midly thrilling, so it is not advised that you not follow the link unless you have a strong heart, a good back, and at least one friend named Bubbles for support.

www.lunchtimevoter.com

So, how do you integrate the Django and the GWT? The key part is found in the here. It's a Python-JSON package that will help Django to speak GWT's language. It does a pretty good job of converting standard Pythonisms into JSON. I actually use a modified version, which can be found here. It takes the Python-JSON package and adds the function of interpreting any Python object into JSON as well. Feel free to download and use to your hearts content...

Now, once you have got that, you need to create the object to send, say an object looking something like this, which is the code for a single choice in the lunchtime voter :

class DisplayChoice(object):
__name__ = "DisplayChoice"

def __init__(self,choice):
votes = LunchVote.objects.filter( choice__choiceName__exact = choice.choiceName )
blackballs = LunchBlackball.objects.filter( choice__choiceName__exact = choice.choiceName )

self.choiceName = choice.choiceName;

self.voteList = list()
self.blackballList = list()

for vote in votes:
self.voteList.append(vote.user.displayName)

for blackball in blackballs:
self.blackballList.append(blackball.user.displayName)

As you can see, this code is nothing more than a shell for containing a few essentials that need to be communicated to the frontend. It is then written using the JSON write function with a call such as:

response = HttpResponse(write(displayChoice))
response['Pragma'] = "no cache"
response['Cache-Control'] = "no-cache, must-revalidate"
return response;

Since you'll be updating the AJAX frequently (that's kinda the point of the AJAX stuff isn't it?) you will want to the cache control lines to make sure you get a new copy each time you ask for it. Additionally, you can add some random garbage GET variable to your request from GWT to force the browser to recognize the response as new. After that, you have to decode the thing in your GWT application. This is actually really easy, and for the most part, you can just follow along with the included JSON example. However, it can be a bit tricky to get the JSON decoder working in *your* application. After copying the JSON decoder into your own project structure, it is probably easiest to leave the decoder in its own package and import it using the XML files. Firstly, you want to remove the entry-point from the JSON xml file, just rip the whole line out of there. Secondly, you want to inherit the json classes. As an example, here is what the core xml file for the lunchtime voter looks like:

<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.sample.json.JSON'/>

<!-- Specify the app entry point class. -->
<entry-point class='com.lunchtimevoter.client.Display'/>
</module>

And that's about it. After that, it's all standard django and or gwt stuff, so experiment and have fun :)

Friday, May 19, 2006

What do they want this time???

This post/link is for everyone who has ever tried to figure out what their website users really wanted. I present to you the FeatureVoter. As you can see, it gives your own users the option to either submit new feature requests or vote up someone else's feature request. This way, you can tell what your users really want the most, so you can give it to them before your competitors do :)


See the Live Version

To download the app (it's in python), click here.

To install the app, simply unzip it in the directory that you want it and alter the settings file appropriately. It's all fairly intuitive, but I'll go over it quickly...

web_root = (the URL of the the installation location)
admin_user = (the admin password for the feature voter itself, default feature_admin
admin_pass = (the admin password for the feature voter itself)
db_host = (wherever your mysql db is, usually localhost)
db_name = (name of your mysql database)
db_user = (username for your mysql database)
db_password = (password for your mysql database)

the feature_header and the feature_footer are whatever you want to go before and after the feature voter table in HTML... and example is provided.

After setting that up, just go to your base url and then admin.py in order to set up the database tables that the app will need, then point your user at your base url + features.py/

Thursday, May 18, 2006

The Python Conspiracy

Python produces some really beautiful code sometimes. It's powerful, and even better in nerd currency, Google uses it. It is, however, driving me completely nuts. Pull my hair out nuts. Stryker's son in X-men 2 nuts, and it's all because of one thing: mod_python. In what universe is it ok, that you have to restart the web server to make one little fix? I suppose this wouldn't be so bad if I had my own server to host stuff off of, but since none of my readers seem to click on my ads...ever, I am currently stuck with a more cost-effective option: shared hosting.

Then again, perhaps mod_python was written by admins as a way of extorting nerd-treats (Mountain dew, Snickers bars, etc). This could explain the last e-mail I got from my admin:

"Dear Palantar,

We thank you for your patronage, but regret to inform you that we cannot at this time restart the Apache server AGAIN as we are feeling very tired due to lack of nerd-treats (Mountain dew, Snickers bars, etc). Please feel free to send us a lot of them. "

Or I could just be paranoid...

Sunday, April 30, 2006

Wiiiiii!

So as we all know, Nintendo is producing a "different" sort of console, supposedly emphasizing small size, ease of use, that sort of thing. AND Nintendo just renamed the thing "Wii". So, does this mean that when it comes out we can go to Best Buy and gawk and go, "Aww, look at Nintendo's little wii. It's so cute." ? Just wondering...

Wednesday, March 22, 2006

Kiko The Unselfish

So, I actually received an e-mail from Kiko (AJAX web calendar people) today. This shocked me because I'm fairly certain it has been the first useful reply I have gotten from an online company since the dawn of automated reply systems. Further more, it encouraged me greatly because it turns out that they're planning to add export and synchronization tools for iCal users. Good new for people with Mac laptops everywhere.