Skip to content
Aug 20 10

Java must be stopped

by Jason

Java has pasted its expiry date. It is no longer the only cross platform, fast language available. There are few examples of widely used Java applications. The few popular ones there are are noticeably slower and more resource intensive than native apps. And as a developer, I waste far too much time worrying about types in Java and generally writing out a lot of boiler plate code. Here are some examples of Java compared to Python (a more modern language):

converting an integer to a string in Java:

String aString = Integer.toString(aInt);

converting an integer to a string in python:

aString = str(aInt)

consider using a dictionary, or hash map in Java:

Map<String, Object> env = new HashMap<String, Object>();

in python:

env = {}

Notice how much cleaner the python implementation is? I don’t even need to care about types, actually, I don’t even need to worry about using semi colons. Python enforces nice looking code by forcing the developer to indent properly. How cool is that?

As a C++ programmer, getting past the concept of a dynamic typing language as easy to work with as Python was tough. But the reward so sweet. Using duck typing, I can make a function that takes in any sort of argument and all I need to ensure is that the argument has a certain interface.

For example, if i want to write a simple function that outputs a string or integer in Python, I could write the following:

def outputVariable( arg ):
    print str(arg)

To do the same in java, I would need a class and two functions (one for a string, one for an integer):

class Outputter {
    public void output(String arg) {
        System.out.println( arg );
    }	

    public void output(int arg) {
        System.out.println( Integer.toString(arg) );
    }
}

It seems to me that since punch cards computer languages have been evolving to be more easily read and less verbose. With each new generation of languages allowing developers to write one line of code that would be the equivalent of 10 lines of code had he used an older language.

There are two main reasons why Java and C/C++ are still the defacto standard languages: there is an existing large Java and C/C++ code base to maintain, and to replace it all would be a very expensive undertaking. And also, there are many Java and C/C++ programmers. Many of whom aren’t even aware that there are easier ways to write software.

There is an argument for learning Java: it’s more likely you will find work with Java. But if you are interested in just writing solid software quickly, you should consider using a language that is more congruent with “quickly” and “easy” than Java.

Aug 11 10

The State of Mobile Application Development

by Jason


It is amazing to see the amount of enthusiasm people have for their smartphones. Many iphone users not only like their phone, but regularly put on a sales hat for Apple and convince others that the iphone stands alone in its awesomeness and to not have one is the same as losing a sense.

Android too isn’t without it’s feverish supporters, though I think most are just happy to have a decent device that isn’t an iphone.

It is fun to watch and participate in such meaningless fanfare, but it’s even more fun to participate by developing an app yourself and seeing people download and use it. And it’s definitely more fun if you can make some money too.

As a developer, there are a number of things to consider when deciding which platform you want to target. One of the main things to consider is which phone OS you want to target. Many people in North America would be surprised to know that North America isn’t the world and that Symbian is still, by a large margin, the number one smartphone OS in the world:

But as the apt reader will mention, the number of Symbian handset owners that actually buy apps is far lower than iphone or Android owners. I’m sure most Symbian owners don’t even know they have a Symbian phone. Nokia Marketing has done an amazing job masking and obfuscating its products and features to its end user for many years.

Another thing to consider as a potential mobile developer is costs associated with developing for a given platform. This is where Apple truly shows their bum by requiring iphone developers pay an annual fee of $99. No other platform has this entry fee. Apple also requires you to develop on Apple computers. And of course, Apple is now infamous for blocking all 3rd party attempts to by-pass purchasing the Apple SDK. It is a shame Adobe is not allowed to release tools that compile Flash apps to run on the iphone. Now (as before) a developer with even a simple app has to re-write the app several times to reach all the big mobile platforms, and pay 99$ to port it to the iphone. But I guess when a company believes it is the future of smartphones, it doesn’t make sense to think that developers would want to port apps to other devices.

The most important consideration in my mind when choosing a mobile platform to develop for is how easy it is to develop on a given platform. I have never developed software that targets any Apple computer or phone, but by all accounts there is a bit of a learning curve, but not much. Once you get it, it’s pretty easy to work with.

I have developed for both Symbian and Android and feel that both are not fun to work with. It’s as though Nokia’s marketing department also put together the Symbian API. The first jaw-dropping shock I got from Symbian was learning that it has 7 different types of strings. Seven. I don’t recall the reasoning for this other than these 7 string types make your applications leaner. I’d be curious to know how much leaner.

I have recently done some work on Android and found that it uses (as far as I can tell) only 2 types of strings. Android apps are built on top of a custom JVM (Dalvik) and use their own set of GUI tools. The first jaw-dropping shock I got from working with Android was the total lack of any GUI designer tools. There was no drag and drop interface anywhere. I had to use DroidDraw, an opensource GUI designer tool. DroidDraw is pretty limited, but compared to the alternatives, an essential tool for any Android developer.

Android had a few other throw backs to earlier times. Most of my grips are related to its use of Java which I find has a unique way of making what should be simple tasks cumbersome and hard to look at. For example, dynamically populating a combo box (which Android decided to rename to “spinner”) was a remarkable effort partly because of the lack of documentation, but also because the code needed is ugly. If you want to make a slick looking 3d game, good luck. 3d support for Android is not good as I have mentioned in a previous post.

I find it strange that developers like to bash Symbian for being old and clunky whereas Android tries to be a new and slick platform that will soon own the smartphone market. The truth is that Android feels old and clunky too. As a user it’s hard to tell, but as a developer Android code is verbose and clunky looking.

Looking at todays mobile options vs mobile options 5 years ago, the only real difference is that there is finally a way to make money with mobile. This is a great development, hopefully with the extra money, organizations can make better mobile tools. Maybe thats worth $99 a year.

Jun 8 10

Cold Calling for Hackers

by Jason

As a hacker, you live by what you think is a high code of ethics and standards. You pride yourself on your good work, you take your work very seriously and it’s not uncommon to work every waking hour to meet a deadline. Every year or two you invest lots of time and effort learning a new technology, be it a new programming language, server platform or design paradigm.

When you stroll into the office every morning, you can almost be forgiven for having what appears to be a chip on your shoulder (even though it’s really just a desire to be recognized for working so hard). You venture into the other side of the office where the salesmen do their “work” and wonder why these people get paid so much and command so much respect from business owners.

The reason is simple, the only way anyone gets anywhere making software, or indeed any business, is if people actually use your product or service and money changes hands.

It is hard making software, it requires a lot of work, but as anyone whose tried will tell you, getting sales is in many ways much harder. I feel hackers scoff at this notion because “getting customers” is such a simple concept, no where near as complex as the 1000’s of lines of code thats been written in their sophisticated software. But give a hacker a list of possible customers, a phone, a cubical and 8 hours, more often then not their minds will break and you will reduce them to sniveling, delicate flowers who will go home and talk to their moms about how rough life is for hours (not that I would blame them).

As a hacker trying to start a business, I am in the unfortunate position of having to get customers. As I have very few personal contacts that can help, I have been relying on cold calling. And it has been a tough slog.

I read on a blog post that if 1 out of 20 calls ultimately results in a sale, you are doing good. That means you are going to get rejected a lot. When you make cold calls you aren’t actually trying to sell anything, but merely set up a meeting where you can give a proper pitch as well as take the time to listen to the customers needs and make sure you can help.

As the main stake holder at Schedule Bin, getting constantly rejected has been gut wrenching. Let me be clear that the success or failure of my company rests squarely on my shoulders and that after getting constantly shot down or told I’m crazy for having such a lame product, I have been reduced to a delicate, whimpering flower.

But, they say cold calling is a numbers game eg. I just need to call 1000 people to get 50 customer. I don’t know about that, I don’t think I’d be able to physically or emotionally do that. But what I have found is that when you do get shot down, asking the person why is the key for figuring out what you are doing wrong and adjusting.

After 20 calls trying to sell Schedule Bin and ultimately getting rejected each time, I put a list together of why people were not interested. The top reasons were they didn’t want to change the current system, and/or they didn’t want to pay for software that does something they do for free right now. Without giving away more hard-fought marketing info, suffice to say that I was able to change my approach significantly based on this feedback and now when I do my cold calling, I am able to line up meetings every 2nd call I make.

When you are programming a fairly complicated component and are running into all kinds of constraints and limitations, chances are you aren’t on the right track and you need to rethink how to approach your problem. When selling your business, the same is true. Try as best you can to roll with the punches, but it’s critical to ask questions and track what kind of feedback you are getting.

May 14 10

The boogie-man that is internet cloud security vulnerabilities

by Jason

After participating in a recent online discussion about security vulnerabilities in internet clouds, I was a bit surprised at how many people still seem to think that using publicly-exposed internet clouds are less secure than clouds or networks sitting behind private firewalls.

It’s important not to be distracted by buzz words, a cloud is a large network of servers. The servers are set up to talk to each other to share the load. This has been something that’s been around for many years.

Lots of hackers use some program or virus to gain access to servers. It could be an attachment in an email or it could be delivered by a person with physical access to your computers. They could also be getting info by using a man-in-the-middle attack. Sometimes hackers come into possession of passwords and account info, sometimes weak security precautions are simply too tempting to crack for some hackers. All of these things can happen with or without a firewall.

Also, who knows how Amazon’s, Google’s or Salesforce’s clouds are structured? All their servers have custom operating and file systems. Trying to hack a system you have no information on is going to be more difficult than a system you are familiar with.

Something else I notice people forget is that clouds are usually backed up to at least 1 other physical location. If your network goes down because of a power outage, is all your data automatically available on the other side of the continent?

Clouds make efficient use of computer resources. The level of security, scalability and affordability is unmatched by anything a regular IT department can put together and maintain.

The myth that clouds are less secure is just that – when was the last time you heard of a cloud breaking or losing data? You hear about banks being hacked and credit card numbers being stolen from a variety of places. Maybe they should consider outsourcing their data and data management to a cloud.

There is no such thing as a 100% secure and safe system. There will always be some sort of hole in everything, but clouds have a better track record in terms of both security and uptime. The trend is definitely changing though, more and more offerings are being made from a cloud, Schedule Bin is one of them. Because Schedule Bin runs from a cloud, we are able to run our business with minimal cost and IT management overhead. In fact, there is so little overhead that we can give our service away for free!

Apr 19 10

Why Android Market Has No Games

by Jason

After a few days of Nexus One ownership I began looking for games, preparing to be hypnotized by games as amazing as the Nexus One itself. After my first search, the list of games I found was the following: Robo Defense Lite (an ok tower defense game), Labyrinth Lite, Poke A Mole, Pinball and BreakTheBlocks Lite. The list of games after the top five were similar and included many more brick breaker, whack-a-mole, snake and pong games.

Underwhelmed hardly describes how I felt.

Being a computer programmer with notable skillz, I thought “I will make an amazing 3d game on Android and show these other Android developers how its done!”. After a weekend of tinkering, researching and compiling code, I can with 100% certainty say the reason why there are so few good games for Android is because it is nearly impossible to program good games without losing your sanity. I felt like the Charles Bukowski of computer programming by the time I was done.

While Iphone, webOS and windows mobile all have openGL ES 2.0 available, Android is stuck with openGL ES 1.0. The recommended way to write a string onto a 3d object is to make the text you want to draw a texture. So “game over” could be one texture and “press start to continue” would be another. But to display something that changes, like your score, onto the side of a rotating cube you need to write your own text renderer (ugh).

Android exposes OpenGL ES 2.0 which makes drawing text easier, but you need the NDK (Native Development Kit) to do that. Working with the NDK reminded me of working with Symbian v3 five years ago; lots of config files and directory structuring, like it was designed by engineers who spend far too much time in a terminal and think GUI’s are “nice to have”. Because I was running Windows, I needed to install Cygwin to build the native libraries.

After an hour or so setting up the NDK and prepping and catching up on this Java JNI business, I was ready to run the openGL ES 2.0 demo that came with the NDK on the emulator. But for some reason, I kept getting an error that simply said “The application xyz has stopped unexpectedly. Please try again”. After the relatively tedious process of setting up the NDK and running the sample app and getting vague errors, I retraced my steps. I thought I screwed up my NDK during install or I somehow screwed up the sample’s build process. I spent hours trying to resolve this only to find on a forum that the emulator doesn’t do openGL ES 2.0. I had to test the app on my Nexus. No debugging and a longer than necessary process getting my .apk onto my phone (not to mention the number of times I would crash the phone testing my .apk).

That was bad enough, but the kicker was that after hours of hair pulling frustration, the sample app only showed a static 2d green triangle and a background that went from black to white. A 2d sample to demonstrate openGL ES 2.0, the defacto mobile 3d library. It would be nice to have a few Nehe demos included instead (though props to INsanityDesign for putting some together for openGL ES 1.0)

Am I going to be developing an amazing 3d game that is going to make people feel like they were punched in the face because it’s so amazing? Not on Android anytime soon.

Apr 14 10

Adobe’s Flash. Good, Bad or Just Ugly?

by Jason

I have a few beefs with Flash… its security sandbox seems more restrictive than helpful. Most Flash vulnerabilities have something to do with null pointer exceptions rather than what programmers write, which one could point at and say “ah HA! Flash is bad!”. But when you think about it, what software doesn’t have security vulnerabilities? I mean, Apple recently dealt with a vulnerability that lets would-be hackers send an SMS that allows them to eaves drop on conversations and make your iphone part of a botnet. Where was the outrage then?

There is also the argument that Flash is bloaty and slow. There are many examples of Flash applications that should of been built better. Be it design or programming, lots of people release terrible software. But there are also countless examples of well designed Flash apps that are able to deliver an interface that is otherwise out of reach with other technologies (such as javascript). There are many bad developers and designers out there, including the iphone variety, why only pick on the bad Flash designers and developers?

I fear I may have posted this a few hours too late and this is already yesteryears news. But it seems to me that people who are coming out of the wood work now to say they have had poor experiences with Flash and understand Apple’s decision are really going too far above and beyond the call of fanboy duty to the point where they are just being idiots. For example, The WSJ recently showed us their bum by informing the world that Flash is buggy. I understand that Rupert Murdoch (owner of the WSJ) really likes the ipad cause he can make more money with his media properties with a paid app than anything on the internet, but really, at least try to make it look like the cute blonde host of “digits” has at least a passive interest in technology!

For those who claim that Apple has right to do whatever they want with their platform. I say if I buy a phone, it is MY phone, not Apples. Perhaps that doesn’t mean much now, legally. But unless Apple starts renting or leasing phones, I am willing to bet that what courts say in 30 000 years, when society and voters catch up to where technology is today, will be different than what they say now.

Apr 9 10

The Many Faces of Pain – Daylight Savings Time

by Jason


I have never given much thought to DST, I simply adjust my clocks when the world tells me to. But daylight savings time turns out to be a hideous beast hidden from the teeming masses because it is so arbitrary and random, it’s useless.

Time zones are complicated and seemingly random due to political, social, and geographical factors. Imagine a tiny country like Luxembourg having a time zone split right down the center of its 100km wide borders, Luxembourgians would go crazy waking up in one time zone and having to commute to work in another time zone 20 minutes away. It is for reasons like this that time zones often share boundaries with political jurisdictions. Although many smaller jurisdictions such as Arizona and Newfoundland have multiple time zones, how some jurisdictions handle time zones is truly puzzling. China, the worlds 4th largest country by land mass has only one time zone while Nepal defines its time zone as 5 hours and 45 minutes ahead of GMT (as opposed to the usual 1 hour increments). This could be the mountain kingdom being irrational, or it could be because the elevation in Nepal (sitting atop the Himalayas) is so high up the Sun is somehow 45 minutes different rather than 60 minutes different.

Time zones are strange enough, but things get downright chaotic when you throw in daylight savings time. The original purpose of DST was to extend the number of daylight hours people had in the evenings during summer, thus using less energy for incandescent light bulbs. Clocks are typically adjusted ahead one hour in the beginning of spring and back in autumn. Not every country thinks DST is a good idea, this map shows that most of the world doesn’t actually care for DST. Looking at this map, you’ll notice that Canada mostly adheres to DST except Saskatchewan, the north eastern tip of BC and an island north of Hudson’s Bay that I’ve never noticed before.

Another issue with DST is how it’s decided when to change the time. Since 2007 the first Sunday of April and last Sunday of October are when DST changes happen in N. America. Whereas the EU tends to kick off DST with the last Sunday of March and last Sunday of October.

In the Southern Hemisphere though, DST changes happen in reverse, Chile observes DST from the second Saturday in October to the second Saturday in March. The time difference between the United Kingdom and mainland Chile may therefore be three, four, or five hours, depending on the time of year.

If you were programming a time sensitive client server applicaion such as Schedule Bin, you will quickly find that dealing with time zone offsets is a frustrating and unrewarding experience. The Google App Engine stores all datetime’s in UTC, you must store any time zone info separately, and as time zone offsets vary all the time for arbitrary reasons, it’s important to make sure you aren’t scheduling someone to work one hour before they are supposed to start working.

After spending more time than I care to admit looking for solutions, I ended up using pytz. It has the Olson database hooked right in to it that takes much of the tediousness out of worrying about whether or not to add an hour to an employee’s shift start time in Halifax on April 4th, 2013.

Apr 4 10

Why Bother Starting Your Own Business

by Jason

I’ve always thought working for someone else is a means to an end, an opportunity to save enough cash so that one day I can strike out on my own when the timing is right and launch a successful business. I have always had some personal side project going on, something I worked on during evenings and weekends. Kind of like how guys used to work on their hot rods in their garages, I would work on a video game or a productivity app or something I enjoyed or thought had market potential. This also serves as a great way to learn new technologies and keep my skills sharp and up to date. As a computer programmer with 10 years experience, I generally feel a job I would need to be formally trained on is a job that would carry a junior level wage. You get paid more when you hit the ground running and to stick with only one technology is a great way to become a dinosaur when trends change (which they always do).

To me, working as an employee is good, the steady income and structured environment and process’s for everything truly do make your job easier. But at the same time, structures and process’s take a lot of the thinking out of work, unless I am stimulated and have real goals and new challenges to work towards, my interest wanes and that is usually when I spend most of my free time working on my own projects.

Working for the Man is exhausting and there are lots of really good TV shows and video games that easily consume your attention. It’s hard to find the time and energy to work on something that statistically will go nowhere. I usually get my motivation to work on side projects from taking a measurement of where I was X months/years ago, where I am now and extrapolating where I will be in 30-40 years. Using a sophisticated algorithm (most in tune when at a bar with other programmers), it’s easy for me to see that I will likely be doing the same sort things. If I’m lucky (or not), perhaps promoted into a managerial role or some sort of higher paying sales-type role.

But I generally conclude that the big difference between now and 40 years down the road is that I will probably have a mortgage and extra mouths I’m responsible for feeding, it will be more difficult to change my life then (ie. do something risky).

Me being the type of person to take popular clichés such as “you only have one life” or “Only when we are no longer afraid do we begin to live” or “I will rest when I die” or “You’re not getting any younger” or “How we spend our days is how we spend our lives” or a number of other clichés to heart, I find these side projects suddenly give me something to work towards. I have something to keep my mind occupied and even a means by which the next 40 years can be a crazy roller-coaster ride where anything can happen.

Mar 30 10

DHL Having a Problem with Google Nexus One Thievery

by Jason

I recently ordered a Google Nexus One phone, it has been years since I have turned my back on the world of mobile gadgets but thought it’s time for me to give it another try.

My excitement and mirth shot up when my phone came in a box that seemed too light to be believable. Upon opening the box, to my astonishment, I saw the Nexus One box ripped open, the phone and its accessories missing and immediately felt the palpable weight of a $600 vapor phone on my visa bill pulling me down, and my surly disdain and lack of trust in modern trends resurfacing.

As Google, HTC and DHL (and Visa) were all involved in this, getting in touch with the right people was difficult. Two days after being told someone will be in touch with me by Google and DHL, I get a call from DHL informing me that they have had lots of complaints about stolen Google phones. I don’t know how many, but it seems that I am not the only one trying to piece together the ripped box of a Google Nexus One wondering what it would of looked like.

Nov 9 09

Changing the background color of a label in Flex

by Jason

funny how i’ve always laughed at posts that tell you “how to make a scroll bar pink” because those problems seem silly or insignificant.

But after spending an entire afternoon and draining my brain of any trace of reason, I feel I need to let the world know that you can change the background color of a label. I’ve read on forums that say otherwise, but thats not quite true.

The catch is that you need to inherit from the flex label class so you can make the protected property “textField” publicly available somehow. Me, I created the following class:

package {
 import mx.controls.Label;

  public class BGLabel extends Label {
    public function BGLabel() {
      super()
    }

    public function getTextField():* {
      return textField
    }
  }
}

With this, you use the BGLabel instead of the Label class in your mxml. To change the background, in actionscript you would write something like this:

myLabel.getTextField().background = true
myLabel.getTextField().backgroundColor = 0x4499CC

The reason why we need to inherit from Label is because we need access to its TextField class that the Label class is based on. TextField’s are able to change the background color’s, but labels for some reason are not. As the TextField property is protected, the only way we can get at it is to inherit.

Strangely though, if you set up a MOUSE_DOWN event listener for a label, the event passes in the TextField of the Label to the handler, not the label itself.

Other methods I tried to change the label background include using setStyle(), which doesn’t allow you to change the background color of a label. I also tried the opaqueBackground property , but I couldn’t get the background colors switching off and on the way I wanted. I would suggest you play with opaqueBackground first before you access the TextField property. But if you notice it not redrawing properly or other signs of flakiness, don’t waste an afternoon, use the TextField.