Filtered by Web development

Page 21

Reset

GMapEZ - Google Maps API too complicated for you?

July 12, 2006
1 comment Web development

gmapezlogo.png If you've used Google Maps API to put a map on your site the javascript work you need to do can get quite hairy. GMapEZ puts an end to that. With GMapEZ, controlling google map on your site is as easy as writing HTML. I'm really impressed.

However, the usage in the grand scheme of things has to be taken with a pinch of salt. If you do want a Google Map on your site and do stuff with it, perhaps GMapEZ is not for you unless you want quick results. Simplifying APIs or other convenient libs are really only useful if it's not important. If it is important to you, in most cases you'll have to get ready to roll up your sleeves and get in there and do it yourself. GMapEZ does add more HTTP download for the user and additional javascript rendering time as well. So, if you have 1,000 users a day to view your Google Map app the time you save with being lazy with GMapEZ is paid by your users having to wait a long time extra for the overhead if you sum it all up.

But, like I said, if you think the Google Map API is too complicated sometimes then GMapEZ is definitely worth considering.

UPDATE

This tool looks really hot too. Worth remembering.

Desired Firefox extension

July 9, 2006
1 comment Web development

I want an extension for Firefox that measures the speed it takes to download a webpage. I'd like a total time and the time for the individual constituents.

For example, it could look like this:


screen.css took 0.5 seconds
core.js too 1.0 seconds
index.html took 2.0 seconds
foo.png took 0.5 seconds

total page took 4.0 seconds

Does anybody know of a solution to my problem? Can it be done?

UPDATE I just discovered lori which does a decent job. It could be more detailed but so far it's looking quite promising.

RememberYourFriends.com beta version

June 19, 2006
4 comments Web development

RememberYourFriends.com beta version Two years ago I had an idea of a web application that reminds you to keep up the contact with friends on a periodic basis. Now I've put together a new web application that does exactly that called RememberYourFriends.com and is fully working but might get a few more features added later.

RememberYourFriends allows you to tell which friends you want to be reminded about and how often. If it's a really close friend (eg. your own parent and you just moved away from home a week ago) you might set the reminders to be sent every week. If it's a old class mate who you just want to make sure you don't loose contact with completely you set it to remind you every 6 months instead.

The reminders are sent to you via email which makes it very easy for you to go from reading the reminder email to composing a new email to this friend. If you at the current time don't have time to send an email to this old friend, just click one of the "snooze links" and the reminder will be sent again in a day or a week depending on your choice.

Truncated! Read the rest by clicking the link below.

isInt() JavaScript function

May 22, 2006
23 comments Web development

Here's my take on a function that determines if a variable is an integer or not before or after it's been recast to an int. The functionality is very similar to Python's 'isdigit()' function which works like this:


>>> assert "1".isdigit()
>>> assert not "1.0".isdigit()

However, my Javascript function should return true when the input is an integer or a string of an integer. Here it goes:


function isInt(x) {
   var y = parseInt(x, 10);
   return !isNaN(y) && x == y && x.toString() == y.toString();
}
assert(isInt("1"));
assert(isInt(1));
assert(!isInt("1a"));
assert(!isInt("1.0"));

You can see it in action here.
To be honest, I'm writing about this here just to not forget it the next time I need a similar function. Sorry to cause any interweb-noise.

UPDATE

Corrected whitespacing and made a jsFiddle link.

Private functions in Javascript?

April 29, 2006
3 comments Web development, Python

In Python you indicate whether a function/method is private by naming it so that it starts with an _ underscore like this:


def _thisIsPrivate():
    return 'a'

def thisIsPublic():
    return 'b'

It means that if you have these two functions in a file called dummy.py and you do something like this:


>>> from dummy import *
>>> thisIsPublic()
'a'
>>> _thisIsPrivate()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name '_thisIsPrivate' is not defined

Seems fair doesn't it. Now is there such similar naming convention and functionality in Javascript?

Truncated! Read the rest by clicking the link below.

Careful when dealing with options in IE

April 14, 2006
2 comments Web development

If you have a drop down that looks like this:


<select name="name"
 onchange="alert(this.options[this.selectedIndex].value)">
  <option>Bill</option>
  <option>Gates</option>
</select>

you'll get a different alert message in Firefox and IE6. Try it here

Firefox will understand that if you don't have a value attribute on a option tag, it takes the content of the option tag as the value. IE doesn't. On the above code it returns blank (aka. empty string) in the alert.

Truncated! Read the rest by clicking the link below.

Merrill Lynch's f**ked up website

March 28, 2006
3 comments Web development

Don't ask me why but I today clicked a Google ad about IT jobs at Merrill Lynch. Not that I'm interested but I guess I was just curious to find out what this super-rich company has to offer in terms of IT technology. I guess what they need is a team of web developers. Here's why...

First of all, look at this screenshot. Apparently my browser is too crap for their website, but I know they're wrong. Firefox 1.5 is one of the fastest growing and most advanced browsers available. According to Google Analytics, about 30% of visitors of peterbe.com use Firefox. Granted that that site is geek oriented but more than 90% of my visitors are new ones who drop in through random Google searches. Out of curiousity I started the Windows machine we have at work to try the site there and when I reached the site I was horrified to know that there it does work in Firefox. Are Merrill Lynch Linux-haters? If so, let's continue complaining.

Truncated! Read the rest by clicking the link below.

To br / or not to br/

March 23, 2006
1 comment Web development

Back in the very beginning of this centuary I remember that there was a web browser called "netscape". Apprently it had a bug in it that you had to write all linebreaks like <br /> and not <br/> if you decide to use XML compliant HTML.

Ever since then I've almost always respected that rule putting in that extra space between the r and the /. Unless anybody can think of a reason not to, I'm going to ignore and forget about netscape and the mandatory extra whitespace. Bye bye netscape+XML+Peter!

parentElementsByTagName(doc, tagname, classname)

March 6, 2006
3 comments Web development

I've just written a little javascript function that I have myself found extremely valuable when doing DOM scripting. It's called parentElementsByTagName() and even if it's name isn't great it really does work and has proven very useful for my app.

At any starting point in a DOM tree (first parameter) it goes "up the tree" by looping over "currentelement.parentNode". The second parameter is the tag name (eg. "div") and the third parameter is optional and it's a class name that that tag name needs to have.

I wrote this because I found myself writing this.parentNode.parentNode.parentNode... in my Javscript code and thought I'd stop that sillyness.

Truncated! Read the rest by clicking the link below.

Dynamic image replacement technique

February 24, 2006
6 comments Web development, Python

I've been playing with PIL's ImageDraw to create images from text. This isn't anything new but I thought I'd combine it with some Web 2.0 technology. The page is marked up like before in valid and accessible XHTML, then a javascript kicks in to automatically replace the plain text headers with image generated ones.

The benefit of this is that the image replacement stuff happens AFTER the page has been loaded for snappier response times. The page looks better with image headlines because you're not font-limited there (see apple.com for example). And most importantly: you want images for headlines but you also want to be found on Google.

Go to the demo page to see it in action.

Truncated! Read the rest by clicking the link below.