Why I don’t use Microsoft technology

Posted by Luke | General, Programming | Saturday 28 March 2009 4:36 pm

Everyone who knows me knows that I’m big on Linux, well Ubuntu to be more specific. I also have strong tendencies towards Java and open source when it comes to programming. But, it wasn’t always like that… Long ago, when I was still a lad, I was BIG on Microsoft. I guess because that’s all I knew. I’ve been programming since my early teens and simply never been introduced to anything else than DOS and, a bit later on, Windows.

Naturally I started using Visual Studio to program in C and C++ during the late 90’s after swinging a bit with Watcom and Borland for a while. But Watcom ceased to exist and Visual C++ was the next best thing because of the C++ optimizing compiler it used. Intel’s C++ compiler was to expensive other than the fact that none of my friends had a “free” copy of it (if you know what I mean).

When I became a professional, full time, programmer I started to learn things. Slowly that is. The first couple of years of my career I was pretty mindless. I didn’t know what to do, so, I just did what I did best, I programmed. I programmed in C, in C++, in ToolBook, in GRASP, in Lingo (Director), Java, and some more C++. Then the web became very popular so I did some HTML and Javascript. I hated HTML and Javascript in those early days of the web, to chaotic and messy. So, I did more Java and C++. Then Flash became really hot in 2001/2002. So I did ActionScript and started to specialize in the Flash Platform.

I did all of this in a Microsoft world using Windows as a platform.

Then, in the early 2000’s I started to notice something. At the time I was working for a large consulting/outsourcing company in Europe. I was also swinging between Java and C++ at the time. All C++ work was done with Visual Studio for the Windows platform. Actually, to be more specific, it was all MFC. I loved MFC. Because I did Java and C++ projects I switched between two different departments. And what I started to notice was that whenever I was with the ‘Java guys’ I just learned so much more. Even though I was working on a Windows box when developing Java, these ‘Java guys’ where all running Linux desktops and Linux servers. I saw them type in magical commands into consoles that vaguely reminded me of the commands I used to type in when I used DOS when I was a kid. But somehow, these commands where much more complex with weird characters and what’s not. I learned about regular expressions, design patterns, databases, client server models, reverse proxies, tunneling, security, the list goes on and on. I thought my head exploded.

Then, when doing C++ with the ‘Microsoft guys’ I noticed that I didn’t learn anything significant. I mostly worked with guys that I now like to call “drag & drop programmers”. They hooked up ActiveX controls and dragged and dropped some UI controls onto a gray canvas and called it an application. These guys where clearly in it for the money and the title on their business cards. They didn’t give a crap about programming or, beautiful code. Of course, there where a couple guys who’d know their stuff but most of them where the product of Microsoft’s latest Visual Studio features. Just drag and drop, click and point. In my opinion Microsoft had singlehandedly created an whole generation of programmers who didn’t care. Microsoft had made programming accessible to just about anyone with a university degree and an interested in a big paycheck every month.

At the time, programming in Java was something that you could only do if you really really wanted it. To work with Java you had to get over quite a threshold. There where no fancy editors (Eclipse was just emerging) and there was a lot of command-line stuff with build scripts involved. I guess this culled of a large amount of the drag & drop programmers and only the motivated programmers where left. The sad thing is that this has nothing to do with the quality of Microsoft’s products. I’ve used them for years and know it to be very good. It was just the people I was working with that weren’t that interesting and made me switch.

I guess this is also the reason why I never picked up any of Microsoft’s .NET stuff. .NET became popular just around the time I was losing interest in Microsoft. I know C# to be an excellent programming language. It might even be better than Java on some points. But the lack of choice is just not appealing to me. If I choose Microsoft I would feel locked in. There is no alternative if you find yourself unhappy with it for some sort of reason. This is why I love e.g. Java. If I choose to use Java technology to power my business and applications I can actually choose. Not only can I choose my runtime but I can choose my platform like JBoss, Geronimo, JRun or even just a servlet engine like Tomcat or Jetty and there a numerous frameworks for Java available. The list is endless.

What it basically comes down to is, instead of not choosing Microsoft I chose freedom. The freedom of choice. The good thing is is that I’m still free to choose Microsoft if I wanted to.

Stackoverflow

Posted by Luke | Dribble, General, Programming | Thursday 25 December 2008 12:09 am

When Stackoverflow went in beta I was really excited. Joel & Jeff had been discussing it for a couple of months already in their pod-cast and I was kind of curious to finally see it in action. I already had an OpenId which I had never actually used so Stackoverflow gave me a chance to finally test it out. I signed in…

It’s a couple of months later now and I’m currently not sure what to think of Stackoverflow. I liked the idea of a community of programmers coming together to discuss programming and anything related in a forum/wiki style environment. But what can I say, programmers will always be programmers.

By participating on Stackoverflow you gain reputation points and badges. The old style forum set ups had a similar thing where you basically gained status by the number of posts you had contributed to the forum. Often forums would also give you a title, or rank, based on this number or contributions. E.g. if Bill Gates would sign up at some Windows discussion forum he would gain the status of “rookie” because he had made zero contributions. These forums would always assume that if you hadn’t posted anything yet you knew nothing about the subject, so “rookie” in this context would mean that Bill was a “beginner” or a complete “noob” when it comes to Windows.

Stackoverflow’s reputation scheme works a bit different. Your reputation is based on what others think of you. Your questions and answers can be up or down voted by the other participants of Stackoverflow. Badges are assigned according to what type of actions you perform. E.g., if you write a lot of comments (which are like annotations to questions and answers) you might receive at some point the Commentator badge.

However, besides all the fun, Stackoverflow is starting to bug me.

As I said earlier, programmers will always be programmers. I’m not sure if the reputation scheme aggravates the typical programmer behavior (you know, that of the anal attitude and the obsession with the specific definition of things) but it seems to happen within Stackoverflow with an irritating presence.

To give you an example. I gained reputation points (or votes) for an answer that basically told the person asking the question to use Google. Now, even though its a valid answer because people should use Google before asking questions like that. To “up vote” an answer like that is kinda, well…, sad. It’s like kicking someone who is already down.

As I understand it, Stackoverflow was created as a community for programmers to share all things programming and related. However, there seems to be a certain self righteousness on Stackoverflow where certain individuals seem to think that its up to them to decide whether a question is a valid question or not. I really don’t understand why people need to go around and close other peoples questions just because it doesn’t fit with their opinion of what type of questions can and can’t be asked. If my question was totally unrelated to anything programming, e.g. about shepherding or something, I could understand, but just because someone doesn’t share a certain interest (in my case O’Reilly programming books) doesn’t mean they should be closing questions. E.g. asking a question about Programmer Jokes seems to be just fine. I guess, it doesn’t really matter if your question is pointless as long as it has a gimmick or an element of fun to it.

The typical programmer behavior comes to surface in the type of contributors who go around “editing” other peoples questions and answers for, guess what…, typos! It’s “Apache”, not “apache”! Oh dear…

Well. I’m not sure what Stackoverflow will do for me in the new year. I’ll probalby phase myself out at some point as happend in the past when I used be very active on a certain forum where I haven’t been activally contributing for over a year now.

I guess time will tell…

In the meantime, have a good one and the best wishes for 2009!

CodeIgniter and Controllers structure

Posted by Luke | CodeIgniter, PHP, Programming, Web development | Monday 20 October 2008 4:58 pm

Over the weekend I was playing around with CodeIgniter. I was up and running pretty quickly and it all seemed to go pretty smoothly. Having built web applications and web sites for a number of years now and before that desktop applications etc, I’m usually pretty quick with establishing a technical structure for my site. I do this because I tend to work in iterations rather than focusing on one specific thing before moving on the next. Anyway, I became a bit frustrated when I noticed that I couldn’t subdivide my controllers folder. It seemed that I could only have one big pool of controllers. This was no good. I checked the documentation and at first I didn’t notice the section that describes how to divide your controllers folder into sub folders. When I finally had figured it out I ran into the next problem.

My site has a top level menu option called ‘Settings’. When you click ‘Settings’ I want to execute the ’settings’ controller located in the controllers/ folder. The Settings page however has more sub-options like Users, Groups, Roles etc. and I want all these controllers to live inside a settings/ folder that’s located in the controllers/ folder:

+ controllers/
   +settings/
      -users.php
      -groups.php
      -roles.php
   -settings.php

This was going to clash. Going to the localhost/myapp/settings URL would execute the ’settings’ controller and going to localhost/myapp/settings/users would bring up a 404 error page. I assume this is because the framework tries to execute a method called ‘users’ inside the ’settings’ controller.

Going back and forth with this issue I finally figured out a way to overcome this problem. In the routes.php configuration file you can set a default controller to execute. I’ve set mine to ‘index’. So, this could mean that if I would bring my settings.php file holder the Settings controller into the settings/ folder and rename it to index.php, it might execute that controller when browsing to localhost/mysite/settings. And behold, it does. the structure I ended up with was:

+ controllers/
   +settings/
      -index.php  <- default controller
      -users.php
      -groups.php
      -roles.php

I haven’t tried this yet with deeper structures but I assume that the same idea applies to that as well.

Eclipse Local History

Posted by Luke | Eclipse, Programming | Wednesday 10 September 2008 12:16 am

I’ve been a big fan of Eclipse for quite while now and every now and again I find a new feature that gets me more excited about Eclipse just a bit more.

The other day when I was working on this project I noticed in the Team folder of the right-click (context) menu of a file, the Local History option. I’d actually seen this option many times before but I never took any notice of it. The other day however I decided to click on it. When I did a tab opened that showed me some sort of history of the file I had selected when I selected the option. It was, not to my surprise, a local history of the file. Every time I had saved my file, Eclipse has kept a previous copy of it. Local History turns out to be a super undo. Awesome!

Now, Local History is not like version control. Local History is much more low level than that. Basically, Local History is your version control between commits. Sort of.

After discovering Local History I decided to have another quick peek at the other menu options. After a bit of clicking around I noticed that when I right clicked a folder, the option Restore From Local History… appeared. And just like the title implied, you can actually bring back deleted files. Not only that, you can actually select which version from the Local History of that file you’d like to bring back.

All in all, again I’m pretty impressed with Eclipse. If you happen to know any cool Eclipse features, please let me know!

Flash Remoting

Posted by Luke | Actionscript, Actionscript 2.0, Flash, PHP, Programming, Remoting | Monday 21 July 2008 9:57 pm

I never really had the chance to use Flash Remoting on a commercial project and it has been years since I played around with it. It must have been 2003/2004 or so that I first tried using it. At the time I tried it with ColdFusion, which worked pretty OK, and with Java (JRun to be precise). I was pretty impressed with the level of abstraction that Flash Remoting provided. Not just from the ActionScript point of view but also from the server point of view. No more manual parsing of data structures. Great! Thinking about it, I can’t really understand why it isn’t more widely used. It seems that it is only used on the more corporate websites, or very specialized stuff to say the least, and you don’t see it much used with the ‘typical’ Flash stuff or hear much about it in the general Flash community. Maybe that’s because Flash Remoting is quite a techy thing to get your head around and that it’s out of the league of your typical Flashers. Maybe BlazeDS is going to make a change to this, but somehow I doubt that.

Anyways, I was playing with AMFPHP over the weekend. It was a fair bit of work to get it all up and running. The documentation on the site isn’t what you would call ‘good’ but after a bit of puzzling I was able to figure it out and was able to make a request through Remoting and get a result value back. Awesome. The next thing I wanted to do was to use a bare bone NetConnection instance to connect to AMFPHP. After all, in Flash it’s the only intrinsic object available to connect to an AMF server and somehow the Remoting classes provided by Adobe seem to be so incredibly complicated and not intuitive to use at all. Luckily they changed this for ActionScript 3, but I wanted to figure this out for ActionScript 2.

The first mistake I made was to focus on the connect method of the NetConnection object. I figured out that the NetConnection has an undocumented onStatus event handler. I figured also out that when I made a connection the onStatus wasn’t triggered when I used http, only when I used rtmp. Hmmm, that was kinda odd. I played around with it for a while and decided to move on to the next thing, which was calling a remote method. I created a simple HelloWorld method on the AMFPHP server and called it using the Remoting classes provided by Adobe. That worked fine. So I set up the following code using a bare bone NetConnection:

var responder : Object;
responder = new Object();
responder.onResult = function( result : String ) : Void
   {
      trace("responder:onResult " + result);
   };
responder.onStatus = function( info : Object ) : Void
   {
      trace("responder:onStatus " + info.code + ", " + info.level);
   };

var nc : NetConnection;
nc = new NetConnection();
nc.onStatus = function( info : Object ) : Void
   {
      trace("nc:onStatus " + info.code + ", " + info.level);
   };
nc.connect("http://localhost/remoting/gateway.php");
nc.call("HelloWorld.say", responder);

Now, this is where I went on my next wild goose chase. I spent the next couple of hours trying to figure out why this didn’t work. Going back and forth between the test case I did with the Adobe classes and this example. I just couldn’t figure out why the NetConnection example wasn’t working. I made dozens of small changes, trying to isolate the problem. But alas. Nothing. Until, at one point, I decided to change this line:

nc.call("HelloWorld.say", responder);

To this:

nc.call("HelloWorld.say", responder, "hello");

Bang! It worked. Apparently, just because the signature didn’t match previously with any remote function on the server, the function simply wasn’t called… Maybe it’s my naivety, but I was expecting the parameter to be just passed as an empty string, or null, if not specified. I’m currently not sure where the problem lies with that, but I guess it’s with AMFPHP. I think AMFPHP is to strict on signature testing and should be a bit more relaxed when it comes to that. I played around with it a bit more and decided to call it a day.

Today, while doing the dishes, or better, cleaning out the dishwasher the http/rtmp problem just solved itself. Of course the behavior was different! When connecting to an AMF server through http, the connection is stateless and can’t be maintained. In fact, calling the connect method on the NetConnection object doesn’t actually do that much and behaves completely different than with rtmp. It does call the server, but it seems to only check if the location, or gateway you want to call, exists. Only over an rtmp connection the Flash Player can maintain an open connection with the server. Duh!

I will definitely be using more Flash Remoting in the future and will most likely try to push it for more commercial projects from now on. It’s a great technology, saves heaps of bandwidth and no more XML/JSON parsing!

PHP

Posted by Luke | PHP, Programming, Web development | Tuesday 24 June 2008 8:44 am

I used to hate PHP. I still do actually, even if it’s only just a bit. But, over the past year or so I’ve developed an appreciation for the language. OK, as a programming language it is pretty odd. I mean that syntax, c’mon. Some weird demon child offspring between C and Perl. It’s a pretty hideous creature. Furthermore, PHP cannot be considered a platform like .NET or J2EE. It’s a programming language, nothing more and nothing less. Anything you can code with PHP can be done in as many different ways as there are PHP programmers. In a way it reminds me of the good old C days. C came with a massive library of incoherent functions. E.g. with C there where multiple of different ways of working with files. You use the set of functions that would make to most sense to you. In a sense, the biggest difference between PHP and C is the lack of pointers…

I believe that the power of PHP doesn’t lay in the programming language itself, because any serious programmer can confirm that the language is pretty frustrating to work with on a day to day basis. No, the power of PHP lies in its availability. A programming environment like ColdFusion, Java or even .NET is much more powerful and structured. Not that you can do more with these languages than with PHP, but it provides a common ground for programmers to start off with. The problem with ColdFusion and Java is that you can’t get it hosted, unless you’re willing to shell out the big bucks. Most providers offer Windows hosting so hosting ASP isn’t outside the reach of small time web developers and whipping up some old school ASP isn’t that much different than doing PHP. With .NET that’s a different story. Unfortunately, to effectively develop for .NET you need the Visual Studio development environment which you can buy for lots of money from Microsoft, making the platform unavailable for a large group of developers. I’m sure Micorsoft provides a stripped command-line SDK, but that doesn’t make the environment more approachable for people who don’t have the budget to buy Visual Studio.

The typical web developer likes PHP because every cheap hosting enviroment has at least PHP 4. And even though PHP 4 lacks some OO functionality, you can create pretty good applications with it. Other than that, there is so much information available for PHP available that’s being able to be grasped by not only the hard-core coders but also the the guy who just wants to store some stuff in a database and doesn’t want to get to much involved in the details of the language. Because of this, there are a lot of web developers using PHP. Which in turn means that a lot of companies use it because it has a large resource pool. So, even though PHP isn’t the most elegant programming language, it is popular because of these reasons.

(more) ActionScript 3 weirdness

Posted by Luke | Actionscript, Actionscript 3.0, Dribble, Programming | Wednesday 7 May 2008 11:08 am

The other day I was attending the Colin Moock lecture “AS3 from the ground up” here in Sydney. Even though the lecture was very (and I mean very) basic, as it was intended, it was still quite interesting to see the man in action. I sat through the whole thing even though around 4 o’clock I was ready to walk out (of boredom). I’m glad I made it till the end.

Even though the lecture was quite basic there was one thing he pointed out that caught my attention. The implicit calling of the super class constructor. He’s stated that even if you do not specify a call to super in your sub class constructor, the super class constructor is still called. this sounded all to weird for me. I didn’t wanted to shout this out in case I was wrong and I didn’t bring a laptop to test out if this weird behavior was true. And thinking again, AS3 has a number of weird things going on that are not consistent with what you would expect. So, this might be another one of those things.

Never the less, the next day I decided to test this behavior just to make sure this was the case, and behold. It is. Besides the fact that you can’t make constructors private in AS3 (which is a different discussion all together) the super class constructor IS ALWAYS CALLED!!!

As a programmer, for me to override the constructor has actual meaning. It means that I DO NOT WANT THE SUPER CLASS CONSTRUCTOR TO EXECUTE, unless I call the super class constructor explicitly with the super keyword. To me this is another typical one of those; “we complier designers need to protect those poor little programmers from them selfs, the poor souls don’t know what they’re doing” type of thing. Sigh…

For some reason, the more I do with AS3 the the more frustrating it is becoming. Every time I run into small but irritating issues like this the more I tend to step away from the language. Don’t get me wrong, I like the executing speed increase and the improvement from AS2 its just these little annoying things that get to me.

CoreTween v1.0.0 beta 2 available

Posted by Luke | CoreTween, PHP, Programming, XSLT | Monday 17 December 2007 6:02 pm

For the past week I’ve been working hard on the CoreTween website and the CoreTween library. Small changes where made to the CoreTween library and a new reference section has been added to the website.

One of the problems I was facing with the CoreTween reference documentation was the fact that CoreTween supports four different languages. Because 90% of the documentation is the same for all four languages I need some sort of scheme that wouldn’t involve duplicating any data. My first choice was of course to store the reference documentation in a good ‘ol database. But to do that effectively I also needed some sort of CMS through which I easily could fill this database. No of the shelf solution fitted this so I reverted to another solution.

For a long time I’ve been wanting to do more (and learn more about) XSLT. This fascinating XML technology has been on my mind a lot lately and so I decided that this would be a good time to start using it. The reference documentation for CoreTween is therefore stored in a simple plain XML document which is easy to edit with a normal text editor. The XML Stylesheet then converts this XML document to the appropriate HTML document containing the correct implementation language (ActionScript 1, 2, 3 or haXe). Within the XML document there are tags that look like this:

<if>
   <as3>
      void
   </as3>
   <otherwise>
      Void
   </otherwise>
</if>

This way its easy to specify only the differences between the supported programming languages and keep all the other stuff the same. The XML Stylesheet takes care of filtering the <if> tags to the correct value. These vales are passed from the URL to the PHP script that executes the XSLT processor. Try a sample of the TweenManager class for a demonstration. To change to implementation language, simply change the ‘language’ parameter on the URL to as1, as2, as3 or haxe. Follow this link to have a look inside the TweenManager XML document that defines the reference documentation.

Of course, on the final website you can easily change between implementation languages. But that’s still in the works.

New flex2ant release (v0.0.5)

Posted by Luke | Eclipse, Flex, Programming, flex2ant | Friday 30 November 2007 8:30 am

Once in a while I get requests or bug reports for flex2ant. Like the other day, I received a request for a fix of this one bug from two different people. Apparently a blog had popped up that discuses flex2ant (amonst other things). I knew that the problem in question was caused due to operating system differences but I didn’t really have the time to look into the problem.

When I received the second email explaining the issue I decided to have a look at it because the problem was starting annoy me. It didn’t annoy me that people report bugs, but the fact that there was a problem with flex2ant. And since I always try to fix bugs to code ASAP instead of pushing it forward, I loaded up up Eclipse, synchronized the project with the Subversion repository to be sure I had the latest copy and fixed the issue in about 2 min. Updating the website however, took me about 10 min.

So, there you go. If you’re a flex2ant user then get your new copy from the download area of the website. Happy Flexing!

Papervision3D, Quake Models & Color Palettes

Posted by Luke | Actionscript, Actionscript 3.0, Papervision3D, Programming | Tuesday 20 November 2007 3:23 pm

Last week I was working on a port of a Quake model viewer I did in OpenGL to ActionScript 3.0 and Papervision3D. The actual AS3 code is reading the Quake model information from the original binary Quake .mdl file and contains, besides the polygon data, the bitmap that represents the texture for the model. The problem is that Quake uses a global color palette because the game was programmed for 256 colors (remember, this game is from 1996!). None of the models or textures actually stores a palette because they are assumed to all use the same palette and why store it many times… The actual color palette is stored in a separate binary file of 768 bytes in size (256 * 3 = 768, the 3 is for the three r, g, b color channels and every component ranges from the standard 0 - 255).

When building the AS3 version of the Quake model viewer I could have chosen to read the color palette from the binary file by loading it in at runtime. Instead I chose another approach. I created a class that represented the color palette and I embedded the raw palette information as a resource in the swf itself:

package
{
   import flash.utils.ByteArray;

   public class QuakePalette
   {
      [Embed(source="quake.pal", mimeType="application/octet-stream")]
      private static const Palette : Class;

      public var r : Array = null;
      public var g : Array = null;
      public var b : Array = null;

      public function QuakePalette()
      {
         var i : int;
         var a : ByteArray;

         a = new Palette() as ByteArray;

         r = new Array();
         g = new Array();
         b = new Array();

         for( i = 0; i < 256; i++)
         {
            r[i] = a.readUnsignedByte();
            g[i] = a.readUnsignedByte();
            b[i] = a.readUnsignedByte();
         }
      }
   }
}

Above is the code for the actual QuakePalette class that is used by the AS3 Quake model viewer. As you can see, the color palette is embedded inside the class as a resource. By setting the mimeType property to “application/octet-stream” the data is actually embedded as raw binary data. In the constructor the Palette class (the alias by which the raw binary data is known inside the class) is then casted as a ByteArray to be able to access the data. In the end the QuakePalette class has three public properties, r, g & b, that represent the three RGB color channels for easy access.

Next Page »