Welcome! I'm your host, Steven Mlodzianoski. I'm a web and software developer located in Boston. I plan on this site being a place for me to post some of my work, and occasionally write about interesting things.
Most Wanted
The most addicting game since Tetris. Ok, that's an exageration. But it really is fun.

My First Interesting Program

I've been reading Coders At Work, which is a collection of interviews with fifteen noteworthy programmers. One recurring question is "What was your first interesting program you ever wrote?". It's a good questions, so I thought I'd share my answer here.

My first exposure to programming was in high school; I took a class where we learned to program in BASIC. One assignment was to create a scrolling marque, where text would move from the left side of the screen to the right, and then reappear on the left in an infinite loop of textual motion. As a follow up assignment, we had to make the text "turn" downwards, and then "turn" to the right again.

But that's not the interesting part. This being my first involvement with programming, I didn't know what functions or methods were. Hell, we hadn't even gotten to subroutines yet.

Back to the program, I realized that the code for both of those turns were very similar, and decided to generalize it out. I knew that if I invested a little more work into this code, then I'd be able to turn in any direction (8 directions to be exact), and have that text snaking around the screen like nobody's business! So I wrote this generalized block of code which would make the text "turn" depending on how a few variables were set. I put this code way down in the file, like line 2,000 or something. And whenever I needed to use this code, I'd set a few appropriate variables, and then GOTO the generalized code. At the end of that code, I'd GOTO the code where I left off. I didn't realize this at the time, but I had essentially just created a function -- a block of code that takes parameters, meant for reuse.

Ironically, when I did learn about methods in C++ the following year, I had a bit of difficulty grasping the concept.

HTML vs. Flash

This is how you add an image to HTML.


<img src="http://www.google.com/images/weather/partly_cloudy.gif" />


And this is how you add an image in Actionscript 3 (Flash).

 var image_url:String = "http://www.google.com/images/weather/partly_cloudy.gif";
 var image_loader:Loader = new Loader();
 image_loader.contentLoaderInfo.addEventListener(Event.INIT, function(e:Event) { 
     addChild(image_loader); 
 });
 image_loader.load(new URLRequest(image_url));

HTML5 Placeholder

The HTML5 placeholder feature is such a good (and simple) idea, and hardly seems complicated to implement. I'm surprised that only webkit (Safaria, Chrome, Most Mobile Browsers) implements it so far.

http://simon.html5.org/sandbox/js/placeholder-demo.htm

Detect Quirks Mode

How can you tell if a page is in quirks mode or standards mode? Javascript's document.compatMode should tell you what mode you're in, and should work for any browser. You can type the following into the url of any web page:


javascript:alert(document.compatMode);


The most common result is CSS1Compat, which is quirks mode.
More at http://stackoverflow.com/questions/627097/how-to-tell-if-a-browser-is-in-quirks-mode.