Friday roundup for March 28, 2008

ASP.Net, Browsers, JavaScript/Ajax, News 1 Comment »

Here is what I found interesting this week.

Key events and Safari 3.1
There has been a change in Safari 3.1 for how keypress events are handled. John Resig interviewed Yehuda Katz to get the skinny and understand why this was done.

eBay Discriminates Against Ebook Sellers, Squashes All Digital Downloads
In what will go down in Internet history as probably one of the lamest decisions ever in e-commerce, running second only to the firing of AOL CEO Jon Miller in 2006, eBay announced yesterday it will no longer allow any digitally downloadable product to be sold via an auction.

Where’s my .NET 3.5 (on IIS), Dude?
The not so obvious ‘problem’ is that if you fire up a machine that has .NET 3.5 installed, you might be surprised to find that the IIS service panel’s ASP.NET does not show an option to select the .NET Runtime of 3.5.

Opera and WebKit pass Acid3 test
The latest builds from Opera and WebKit are scoring a perfect 100/100 on the Acid3 test. Wow!

Where is Firefox on Acid 3? Here.
Some people have been surprised to not hear much from Mozilla around Acid 3. WebKit and Opera are duking it out, but what about Firefox?

Mike Shaver of Mozilla has posted on his views that Acid 3 is a missed opportunity and is pretty damning of the whole thing.

Using the YouTube API via Ext
With the YouTube API recently released, there’s bound to be lots of cool controls coming out soon. Thorsten Suckow-Homberg spent a weekend hacking up a Ext-based user extension that leverages YouTube’s chromeless API to build The Ext.ux.YoutubePlayer.

20 Types of Pages that Every Blogger Should Consider
When you use WordPress you’re given the choice when publishing between doing it as a ‘post’ or as a ‘page‘. Posts go up on your blog while ‘pages’ are static pages that you can publish without it having to go up on your blog.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Base2: A Standards Based JavaScript Library

JavaScript/Ajax No Comments »

I’ve posted about Dean Edwards‘ Base2 library in the past but I wanted to write a post that brings all the growth Base2 has under gone over the last couple of years into a brief overview of the project so it is easy to see the progress Dean has made and where the project is headed.

In early 2006 Dean Edwards began a little project called Base. This was he first attempt to ease the pain of developing Object Oriented JavaScript.

I want a nice base class for JavaScript OO:

  • I want to easily create classes without the MyClass.prototype cruft
  • I want method overriding with intuitive access to the overridden method (like Java’s super)
  • I want to avoid calling a class’ constructor function during the prototyping phase
  • I want to easily add static (class) properties and methods
  • I want to achieve the above without resorting to global functions to build prototype chains
  • I want to achieve the above without affecting Object.prototype

About one year later Dean released the next iteration, Base2. Although Base was a fairly simple library to use there was no documentation. Other than Dean’s, very helpful, posts on his website there was nothing you could refer to in the traditional reference sense.

In August of 2007 there appeared a nice post on Dean’s site that annouced the arrival of some documentation for Base. Although it is stamped as currently incomplete (at the time of this article anyways) it is a huge boost for the library and the community that has grown around it.

In early 2008 Dean released some improvements for Base2 and some nice code examples further demonstrating what the library can do to make developer’s lives easier.

One thing that, I believe, makes Base stand out, and Dean as an excellent programmer, is his commitment to standards. Base adherse to some fundamental OOP rules, which Dean has outlined in a nice reference guide for library developers.

Base has enjoyed great admiration in the JavaScript community with other libraries using it as a starting point for their library cores.

Thanks Dean for the great leadership you bring to the web development community and keep up the great work.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

C# DateTime.MinValue is not the same as SqlDateTime.MinValue

ASP.Net, SQL 12 Comments »

kick it on DotNetKicks.com

Working with non-nullable types in C# can be a bit of a pain. For instance when I have a date as a string and need to parse it into a DateTime what should the value be if the parse fails? I can’t use null because DateTime is not a nullable type.

This is exactly the dilema I encountered today. No worries, I’ll use DateTime.MinValue that way it is constant and I don’t have to worry about being consistent if I had chosen an arbitrary value of my own.

Well as it turns out I did have some worries. Sql Server 2000’s minimum DateTime value is not the same, in fact it is quite different. This kept causing errors.

For your reference here are some values you should take note of.

DateTime myDate = DateTime.MinValue; //=> 1/1/0001
SqlDateTime mySqlDate = SqlDateTime.MinValue; //=> 1/1/1753
//also note that SQL Server's smalldatetime min value is 1/1/1900

So my problem was easily averted, after a quick Google search. I just had to use SqlDateTime.MinValue instead of DateTime.MinValue.

Cheers

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

So long GoDaddy, I won’t miss you

News, Personal 4 Comments »

After nearly a year, with GoDaddy’s shared Linux hosting, I am moving on. I couldn’t be more relieved.

I have blogged about some issues I have had with GoDaddy in the past and some I have kept to myself. Now, it is payback time. I am doing this review in hopes that you won’t have to endure the ill treatment that I have experienced.

I haven’t posted at all yet this week. That is because I have been busy moving all my sites over to my new host, HostGator. HostGator be warned in about a year you also will be getting a review. Don’t worry, if the last week is any indication you will be getting a glowing review. It has been great thus far.

I’ve been holding off writing this review because I didn’t want any trouble from GoDaddy until after I was completely off their servers. Call me paranoid but I have heard horror stories.

Other than the fact that their shared servers are absolute crap, it started, and ended, with GoDaddy trying to block search bots with hidden robots.txt files. Note that I did not create this file and it was there from day one. This was the first issue and it never got resolved. I tried many things to get Google to index my site but even replacing the hidden file with a file giving wide-open access wasn’t even enough. All the while, GoDaddy denied that the hidden file existed even though you could browse to it but it didn’t show up in any FTP client.

I have avoided contacting GoDaddy customer support, there’s an oximoron for the ages, because frankly they don’t seem to know what they are talking about. The one time I contacted them was about problems with trailing slashes on rewritten URLs. I ended up getting far more help from other slighted GoDaddy users in various forums around the web. Their support people blamed me and said my code must be wrong. Again this was never resolved.

These two cases are mild compared to what some have endured. Needless to say, I am not going to wait around to find out if it’ll get worse. I have moved to a new host and am very happy. I can sleep at night again without worrying if my site will get suspended for having an opinion or if my visitors are being thwarted by poor performance.

So long GoDaddy. I won’t be back!

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Method overloading in JavaScript

JavaScript/Ajax No Comments »

If you have been programming for any length of time you probably know what method overloading is or have at least heard of it.

What is method overloading?

Method overloading is a feature found in various object oriented programming languages such as C#, C++ and Java that allows the creation of several functions with the same name which differ from each other in terms of the type of the input and the type of the output of the function.

[Wikipedia]

With the formalities out of the way, there are times when method overloading can be very helpful. JavaScript is no exception. The problem is it is not as apparent how to achieve method overloading in JavaScript because it doesn’t work the same as more traditional languages do.

What won’t work

Let’s look at implementing an overloaded function how you would think it should work.

function myFunction() {
  //function with no arguments
}

function myFunction(arg) {
	//overloaded function with one argument
}

Now JavaScript will accept this and you may think you are done. Think again. You do not have an overloaded function. In the above example your second function definition just overwrote the first so you only have a function that excepts one argument. I told you it doesn’t work the same.

What will work

Now that we have looked at what won’t work let’s take a look at the proper way to implement an overloaded function.

Let’s look at a simple example using bunnies. Awww, how cute.

function getBunnyColor() {
	var name = arguments[0] == null ? 'peter' : arguments[0];
	switch(name) {
		case 'peter':
			return 'brown';
			break;
		case 'flopsy':
			return 'white';
			break;
		default:
			return 'unknown bunny';
			break;
	}
}

getBunnyColor(); //-> 'brown'
getBunnyColor('flopsy'); //-> 'white'

What is that?

Now I’ll explain what I did. Every function has an array called arguments. This array contains the arguments that are passed into the function even if specific arguments are declared in the function definition.

So knowing that I didn’t bother to declare any arguments when I defined the function. I instead used the arguments array to detect what had been passed in. If arugments[0] was null (no argument had been passed) then I assigned a default name of ‘peter’.

Conclusion

So JavaScript implements method overloading a bit differently than most languages meaning your function definitions will look different but you use the overloaded functions the same way. Hope this helps you out!

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Friday roundup for March 21, 2008

JavaScript/Ajax No Comments »

Well it is Thrusday but I won’t be around to post this on Friday being a holiday and all. I only have one link for you this week. Either it has been a boring week for dev blogs or I have been way to busy with other things to find them. Enjoy.

A collection is not an array
James Edwards summeriezes this point. Although at first glance a collection of DOM elements may look like an array (you can iterate like an array) but ultimately it is not an array and lacks many of the array methods like push().

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Home automation - just in the movies?

Personal 4 Comments »

Home automation is a topic that occasionally peaks my interest. It kind of seems like an idea from a Sci Fi movie but it is available to day for those willing and able to pay for it.

Wikipedia defines it as:

Home automation (also called domotics) is a field within building automation, specializing in the specific automation requirements of private homes and in the application of automation techniques for the comfort and security of its residents. Although many techniques used in building automation (such as light and climate control, control of doors and window shutters, security and surveillance systems, etc.) are also used in home automation, additional functions in home automation can include the control of multi-media home entertainment systems, automatic plant watering and pet feeding, automatic scenes for dinners and parties, and a more user-friendly control interface.

That reminds me of an article I saw a little while ago about your plants sending you messages on Twitter when they need to be watered.

Home automation systems are still a ways off, at least in the mainstream, but I like thinking about it.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Some lessons are painful to learn

Hardware, Operating Systems, Personal 2 Comments »

Ever get the feeling that the universe is against you, or at least your computer hates you? Do you know where I am coming from? We have all had those days. I know I sure have but today I want to focus on the misfortune of a fellow blogger, not to kick him while he is down, but to offer some advice and encouragment for the future.

I enjoy reading the posts by Jim over at Blogging Startup. He posts about the ups and downs of blogging and new startups.

Today I saw his post and immediately felt his pain. He has had a rough week finished off with a hard drive crash with only a two week old backup. Talk about a final kick to the teeth. What’s worse his latest work project, that was due today, was completely wiped out in the crash.

Now I hear some of muttering to yourself, “why didn’t he have a more current backup?” Well that is easier said than done and Jim even vows now to do daily backups. I left a comment for Jim pointing out the flaw in his noble intentions. That flaw being himself. We, as human beings, eventually get lazy or we just forget and the universe sees these slip ups and sees fit to punish us at that exact moment.

I too have been in this same boat. I used to run my own web server that hosted my blog, an old one, not this one, as well as my current projects on the go. I enjoyed running my server and learn a lot from setting it up but failed in one area, backups.

I tried to tell myself I would make daily backups but the truth of the matter is I didn’t and wouldn’t you know my hard drive crashed and took my backup drive along with it. So unlike Jim I had nothing, not even a two week old backup, nothing!

I scrambled for the next couple weeks re-doing a project for a client that was nearly done and ended up a week late which didn’t impress them much. Oddly, they have never called me to do another project <sarcasm/>. You see, they identified the flaw in the situation, me! I had failed to take proper care in handling my data, and theirs. I should have had more fail safes in place.

Today I do not do my own hosting altough I am perfectly capable. I just don’t have any interest in spending the money and time in implementing proper backup that hosting requires.

Now back to Jim. I suggested he buy himself an extra hard drive and get some mirroring software to protect himself from repeating this same mistake in the future. Upon writing this post I pin pointed a flaw in my advice. What if the backup drive fails like it did for me?

I want to add to that advice and say go one more step further. Buy a third drive and an external enclosure (USB external hard drive) and have the backup routine included semi regular backups to the external drive as well. The chances of three drives frying on you at the same time are slim.

So Jim, you have my sympathy, but now you are on the hook to protect yourself for next time. Really there is no excuse from us not to learn from the mistake the first time around. Unless you enjoy these type of things ;).

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Friday roundup for March 14, 2008

News, Operating Systems, SEO/Marketing No Comments »

Here are some stories I found interesting this week. Enjoy!

Graham Langdon, Have You Been Naughty?
There is some bad blood boiling as someone is out to smear John Cow. I also blogged about it here.

Killer Writing Strategies
Alex Shalman shares his secrets on how to write killer articles, and make money doing it.

Microsoft Submits Windows 7 for Antitrust Review
Is the Windows 7 beta just around the corner and can Microsoft recover from their embarrassing Vista debocal?

Tough Times for GoDaddy
Are hard times a head for GoDaddy after these disturbing accusations?

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

There’s no where to hide on the Internet

News 3 Comments »

It is surprising that a lot of people don’t realize just how easy it can be to track their Internet trail. I hear, from time to time, about people getting fired over personal opinions on blogs or people that can’t get hired because they posted pictures of themsleves riding the porcelin pony on Facebook.

These people really have no means of appeal. You should know by now that if you post anything on the Internet it is there for life, for the whole world to see.

There is an interesting story unfolding over at John Cow. It appears that some nasty comments have been making rounds on popular blogs representing John Cow. Needless to say they are not authentic. John Cow has tracked the IP of the comments back to none other than Graham Langdon, founder of Entrecard. They have even posted the Google maps shot of the building the posts were made from.

Now either this is an insanely bonehead move by Graham, who you would think should know better, or it is an elaborate smear campaign against Graham. Graham has not responded to the post yet so it remains to be seen how this will play out. Either way, though, this is a textbook example of how easy you can be tracked on the Internet.

Think twice next time you go to post some compromising content about yourself.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.
WP Theme & Icons by N.Design Studio
Entries RSS Login