Testing Localhost Developments in Internet Explorer via Parallels on Mac OSX

Developing web applications can be a frustrating job solely because so many people still use various versions of Microsoft Internet Explorer — possibly some of the worst browsers compared to most of the other modern browsers in terms of adherence to web standards. But I can’t just not test my applications against them simply because I hate them… So the war continues…

One of the problems of testing web apps under Parallels with IE is, instead of testing development URLs such as

1
http://localhost/

, usually IP addresses have to be used, like such

1
http://192.168.0.100

, to reach OSX’s localhost server (because

1
localhost

on Windows would entail having an actual web server running under Windows). The problem with that is that some applications such as WordPress need to have a full absolute path in order for it to work properly (especially when dealing with themes). I’ve tried a couple of workarounds, but nothing is as simple as using Apple’s own Bonjour technology.

I found a post that explains how to set it all up. Even though his example deals with running Ruby on Rails, the idea is exactly the same for other development environments such as PHP and Java (enable port 80, 443… etc). Now I am a happy camper…

via [the naked brain]

Unobtrusive JavaScripting

Recently I’ve been looking into ways to make my code more maintainable after having to support an old site I did and some Actionscript code from someone else. One of the things I found and REALLY liked was the idea of using Javascripts in an “unobtrusive” manner. Basically all it means is to take out those Javascript event calls like

1
onClick

,

1
onMouseOver

and such from the presentation layer (CSS style sheets and HTML tags), and use other means to achieve the same effects.

What I’ve found useful and have been using ever since are these classes:

1. Prototype
2. script.aculo.us
3. Behaviour

There are tons of extensions and subclasses written for them, making them super useful when you want something done quickly and effectively. I especially like Behaviour for its simplicity and the ability it affords me to completely separate Javascripting from tangling with my HTML codes (hard coded, dynamically generated or otherwise).

There are other useful ones such as jQuery and moo.fx, but I’ve been pretty happy with those other three core packages so far.

Incidentally, Apple’s revamped site also has a lot of new Javascript-driven effects that are pretty interesting to look at and experiment with. Another really clean and simple site I like is Panic’s Coda product site. Really very effective use of Javascripts in presentation.

There’s always so much to learn with so little time… What to do!!

Two Weeks in Flash Actionscript

This is my second week coding full time in Flash Actionscript. Sooner or later I’d have bumped into things that would drive me crazy… And here’s a small list of what I’ve encountered:

1. XML feeds, masking, embedded fonts, css styles (for the XML feeds) and scrollable areas is a combination for hours of fun headaches. One can easily spend all night trying to figure out why something doesn’t work the way it’s supposed to… Certain things are very poorly documented by Adobe (formerly Macromedia).
2. Flash is most useful when used with Actionscripts… Some designer/coder wannabes try to do Actionscripts but instead have code littered all over the place… It’s just NOT cool!
3. Sometimes what seems easy can be more than a handful when you try to code for it… Simplicity can be deceiving in Flash/Actionscripting….
4. Components are your friends. Use them whenever you can. Customizable ones are totally worth every penny if you had to buy them. Just weigh the time you could have spent on it if you had to code that biatch yourself…

I also learned a couple of client-management tips from Jiann… Even though Brian tried to warn me about some of these things, I’ve had some pretty pleasant clients that I didn’t think running into one of “them” was in my Karma…

1. Clients are always right even when they give you some of the worst designs, features and requirements to work with.
2. Trying to beautify, improve upon or enhance anything this type of client gives you only will give you more grief later… because he’s just going to ask you go fix it back to exactly the way he had it… never mind how stupid, unusable, ugly or impractical the design elements or features are.
3. It’s all about ego, pride and control. Some clients want to feel they are in control and will ask you to do crappy stuff even though they knew your solution was better.
4. Stand up to unreasonable requests and demand overage. Or else feature creeps will never stop if the pay is on project basis. Some clients think they own you if they are paying you… Just say “NO” to abusive clients…
5. Being over-confident in your ability to pick up new programming skills can make you lose valuable sleep and family time… 🙁
6. Never mind that you have just achieved miracle doing something nobody thought was undoable given how short the deadline is. This type of client will always look for the smallest fault and overlook the fact that you just completed some of the most important features of the site.

Ok… now I feel better….

Back to coding…

One Week Developing Flash Actionscript

After having developed in Flash for almost a full week, I can honest say that….

1. Flash rocks.
2. Actionscript is not too shabby.
3. Flash can truly do some wonderful stuff.
4. I am looking forward to seeing what Apollo and Flex can do…
5. If inherited from the wrong hands, Flash/Actionscript is a bitch to maintain and extend… All you Actionscript code “litterers”… you know what I am talking about…. Please freaking code everything in ONE FRAME! Take advantage of Actionscript’s Object Oriented design. Damn it…

Again, I can’t thank Murdza and lynda.com enough for bringing me up to speed so quickly on this…

Developing with Flash, Finally

After having resisted learning Flash since the days of Flash 5.0, I finally had to budge and cave in to doing it again. But thanks to Lynda.com, the learning experience so far has been pretty positive, especially with the introduction of Adobe Flash CS3 and ActionScript 3.0. It seems like every other project referred to me these days wants something to do with Flash. So I guess having to learn it was only a matter of time. But really, Lynda.com makes it so much easier and effective.

The upside is, I am already pretty conversant with the back end and server side stuff. I am hoping by adding Flash to my arsenal of client side interactive design and scripting skills will make the overall combination of my skill set that much more demanding (since most people only know one thing or the other, client-side scripting or server-side, rarely BOTH). Unless, of course, you are Michael Murdza, who just knows too much about everything anyway…

Overlapping Audio Tracks in Safari

Apple’s Safari is definitely a work in progress with the kind of weird bugs I keep running into. One of the bugs I hadn’t documented about is overlapping audio tracks in Safari under a very special circumstance.

The issue is this: When using AJAX to load one quicktime clip over another, if the first movie hadn’t finished playing as the second movie is loaded in via AJAX, the user will hear the audio tracks of both movie clips playing at the same time. I have no idea why that is, and I am not even going try to guess. And apparently this has not been documented (or the little that I’ve found in Google) by any developer that I know of…

Fortunately there’s a quick fix to this problem (or my clients will drive me crazy). The upside is that this problem can be mitigated with a quick Javascript since the Quicktime object supports Javascript controls. And here’s how it’s done. We all know websites, especially college ones, are reliable and all, you know, their content never changes and they never disappear… But I decided to keep a snapshot of it anyway for future reference. Apple also has a couple of decent documentations on the subject.

Basically I used Javascript to stop playback of the first video before the second one is even loaded in by embedding the event as

1
onClick

. In some cases, it may help to dynamically embed it in the

1
< body>

tag as

1
onLoad

.

An interesting side note: Javascript documentation says that

1
onLoad

events can be triggered with

1
< body>, < iframe>, < frameset>, < img>

and

1
< object>

tags in HTML, but in reality, use of

1
< iframe>

and

1
< object>

are weird among browsers.

IE6, IE7, Firefox, Opera — support

1
onLoad

in the

1
< iframe>

tag, but they do not support it in the

1
< object>

tag.
Safari — the only loner browser that supports

1
onLoad

in the

1
< object>

tag, but NOT the

1
< iframe>

tag…

Sometimes it can really suck being a web developer.

Done with Java Programming Class

Today was the last day of the intensive Java programming class. I actually completed the final project ahead of my estimated scheduled time. I even had enough time to complete a make-up assignment I didn’t turn in. This class was especially tough because it was one of those “part one” and “part two” courses rolled into one. I kind of started falling behind during the second half of the class.

Knowing more about Java now made me realized something — PHP is a relatively easy language to pick up and for someone to be comfortable with. But precisely because of these “advantages”, PHP also makes someone without strong programming fundamentals a lazy programmer. Now that I know more about Objected Oriented programming with a “proper” language, I shall apply similar concepts to my future PHP projects. But I hope I get to work on Java programming more so some of that good stuff will actually stick!

Notes on Java: Garbage Collection

One of the advantages that proponents of Java love about the language is garbage collection — the process in which JVM cleans up after your program is done partying and messing with your computer’s memory — free of charge. Th-unk you. Com’ again. Buh-bye.

Simplistically speaking, in comparison, C and C programmers typically need to clean up after themselves. The problem with that is, sometimes these parties get so wild that it makes the clean up afterwards impossible. That’s when “memory leaks” occur (ahem, Safari). The “parties”, of course, are the programs that rampage through your computer’s memory when they are having the time of their lives (which is not all that long). I mean, WHO likes cleaning up after parties, right? Think about it: Even if you try, there are bound to be spots where you just can’t get to or miss out from all the other cleaning you have to do YOURSELF. Java frees programmers from that headache by being in the business of memory salvation. Bless Java.

So here’s how it works… Whenever your Java program disposes something that it no longer cares for in your system memory, it’s considered trash, garbage, litter, junk, scrap, rubbish, Microsoft’s customers, whatever name suits your fancy, and is eligible for Java’s free garbage collection service. Did I mention enrollment is automatic, and it’s free? With small parties, Java only cleans up after your mess once in a while. But with parties in the size of Coldplay’s concerts, Java will do it a bit more frequently.

Well, I lied when I said it’s free. Com’on, nothing is free. You know that. Luckily, it costs in terms of system performance with all that bookkeeping and cleaning Java has to do. But it’s not really that bad if you consider the work Java’s done for you and the time and brain cells it saves you. I may be going out on a limb here, but I’d say the small performance hit your program suffers is well worth the price. And besides, with today’s qua-gazillion-megahertz computing power and memory availability, these performance hits are barely noticeable. It’s like being thrown at with a penny — of course it hurts. But just a little, and the pain only lasts long enough for you to realize that the sucker who threw the penny is now a penny poorer, and you are now a penny richer…

On a different note, the new Mac OSX Leopard is supposed to ship with a new version of Xcode that comes with garbage collection feature… Buh-bye, major memory leaks…

Dreaming in Code

Ever since I started prepping for the GRE, I’ve been somewhat lagged behind on my Java programming homework. So when I was done with the GRE, I feverishly tried to catch up by reading all the assigned sections in the book plus trying to program for the assignments. Maybe I am just not very bright… but it just takes me a while to pick up a new programming language in the beginning trying to orient myself in the new syntax and constructs.

Maybe it’s because of all the codes I’ve been reading, programming and tinkering with. For the past couple of nights, my dreams have been nothing short of me trying to solve some obscure programming problems in Java! How weird is that? The messed up part is, every line of code in the dream made sense!

Damn I need some rest and time away from Java…

Java Kicking My Ass

My excitment over Java waned a bit after having my butt kicked by all the syntax differences. What comes natural to me in PHP takes a bit of fiddling in Java not knowing all the “right” ways to do things. Digging through Java documentation is slightly useless for me at this point since I am still trying to get used to how everything works and fits together.

Since this is as close to formal programming training as I’ll get, I found some of the brain teaser questions on some homework problems more challenging to figure out since I am really not a “left brain” kind of guy (which is why I have two art degrees in the first place). When it comes to slightly complicated if/else statements or for, sometimes my brain just locks up, and I get “writer’s block” for coders… The assignment on writing a “Bubble Sort” messed me up quite a bit before I could immerse myself in how it should be coded… I think Alex got annoyed a few times after the 100th time I asked him how something trivial works in Java… But really, my brain completely went on a strike…

I still got one last problem on writing a “Magic Square” class on the assignment… Hopefully I can complete that in time for class on Tuesday.

Rebel Forces Have Landed

At long last, the much anticipated Java class I’ve been wanting to take all year in 2006 finally started on Tuesday. After having played with PHP for 4 years, I’ve finally felt the need to pick up something else for a change. Partly, my cousin Alex is to “blame” for pushing me into Java for its enterprise-readiness.

A couple of interesting statistics about this class:

1. A typically uber-geek class has almost 1/2 of the students being women.
2. Everyone else in the class has either an IBM ThinkPad or some sort of loser Dell laptop. I am the lone Mac user in the class with the only Mac laptop (yoohoo!).
3. Everyone else planned on coding Java using Windows; I am the only person using Mac OSX (yoohoo!) while one other guy is using Solaris.

Hopefully this class will worth its weight in tofu. I had the same instructor in a previous database design class, and that class turned out to be very “profitable” for me. So hopefully I’ll be able to make what I learn here equally successful economically. 🙂

Get Rid of Dotted Outlines on Windows Browsers

For you web developers, I am sure your clients have often tried to make you do the impossible — correct mistakes and/or idiotic decisions made by Microsoft on how browsers should behave on the Windows operating system. Fortunately some of these mistakes can be corrected with hacks and work arounds. Here’s another one…

Some browsers (namely IE and Firefox) have this annoying behavior that’s a Windows-only trait — upon clicking an active link, it leaves a ghosting outline of dots around the link enclosed by the anchor tag. There are two work arounds that I know of to get rid of, or rather, prevent this from happening.

Method 1: Javascript — Yes, yes, I know client-side scripting is not reliable and all that jazz. All I am saying is, this is A work around. The idea is to make these links sans-anchor tags… That is to say, write a Javascript to respond to “onClick” events within, say,

1
< div>

or

1
< span>

tags.

EXAMPLE:

1
< div onClick="doSomething();">Click Me< /div>

Method 2: Div tags — If you are trying to avoid Javascript at all costs,

1
< div>

or

1
< span>

tags may be your best friend. Simply enclose your links with a

1
< div>

or

1
< span>

tag immediately following the

1
< a>

anchor tags, the ghost dots will disappear all by themselves. Sweet, huh?

EXAMPLE:

1
< a href="linkToSomething.html">< span>Click Me< /span>< /a>

Again, if Microsoft had bothered to adhere to industry standards, there wouldnt’ be a need to use work arounds like these. So I beg of you, use an alternative browser as much as possible. And only use IE sparingly when you must (for those idiots who develop sites that work ONLY with IE).