Dump Javascript at the end of your page

You’ve seen it plenty of times before. A website loads but only the sidebar appears. The loading graphic in your browser is still spinning and there’s that “contacting …” or “loading …” message at the bottom of your window. Why?

The most common cause of this is because the site uses a chunk of Javascript loaded from a remote site. Think of those fancy chat widgets, Snap.com popups and even hit counters. If those sites are slow to load, they could make your site slow too. The best place to put that code is right at the bottom of the page, after all the content, if you can and it’s appropriate.

I just noticed this happening on Pro Blogger a few minutes ago. Darren’s c2.gostats.com stats are loaded just below the sidebar and because that site was responding slowly the main content part of his blog didn’t display immediately. This may be a storm in a teacup because the next time I refreshed it loaded fine but remember, first impressions count. You don’t want to keep a new visitor to your site waiting.

The ever pervasive Snap.com seems to suffer this sort of problem on a regular basis so be extra careful when you use their Javascript applet. If it takes a while to load, so will your blog.

To further confuse matters, there’s also a bug in Firefox that makes the “Transferring data from …” message appear longer than it should. The guys at Sphere noticed this after complaints their Javascript was loading slowly. It’s all a bit of a mess really!

What to do this weekend?

This weekend will be a busy one in Cork but I think we’re going to try to take it easy and not stress ourselves too much trying to enjoy it too much!

This weekend a Capoeira festival will be held in the city. On Saturday morning there will be a demonstration at 10:30 in front of Brown Thomas on St. Patrick Street, followed by workshops in Blackrock GAA club. Looks like a latin party on Saturday night and a BBQ will follow the workshop on Sunday! Not sure if I can make it but I’ll try to be there. I must dig up some more of my Capoeira photos next week.

In Blackpool The Festival of the Bulls will be held from 12pm to 6pm, Saturday and Sunday. There’s more info on the Whazon website but I’ll copy it here because they don’t have any archives unfortunately.

THE FESTIVAL OF the BULLS – Community Carnival

Saturday and Sunday 12pm – 6pm

STREET PERFORMANCES
Be Your Own Banana Company, That Man, Amani Acrobats, The Svetlana show, Bui Bolg, Mr.Cro, The Incredible Bull Circus and Cork Circus

MUSICIANS
The spectacular Burundi Drummers, Filipino dancers and drummers chorus, The 40 piece Youghal Ceile House band with dancers, Southern Brigade Army Brass band, The Mayfield Brass band, The Cork City String Quartet The Clubmen Swing band , The award winning Polyphonic Barbershop Chorus, The Christ Restoration Life Ministries Gospel Choir, Traditional musicians doing walkabouts, Blackpool Youth Club song and dance show, Isis Youth band

COMMUNITY EVENTS
Duck races , Blackpool Treasure hunt, Pub Quiz
Food Market, Arts & Crafts Stalls, Massage area, Balloon modellers, Face painters, Penalty Shoot outs Community Art exhibition, Programme of local film documentaries, Programme of Award winning Irish films , Exhibition of original drawings by Seamus Murphy, Amateur Photography exhibition, Re-dedication of the Grotto, Dublin Hill, Planet gym health club demonstration and Children’s games

The Bulls Mart
The market will feature over 40 local producers and slow food promoting traders along with local craft and jewelry stalls.

Sunday 3rd June at 4.30pm
BULL RUN
The climax of the festival will be the inaugural Blackpoll Bull Run. Although the bulls have long since left the streets of Blackpool the Carnival bulls will be out in force, creating havoc, making noise, inciting madness and generating excitement. It will be a riot of Brazilian carnival, freaky metallic bull bikes and puppet bulls, along with dancers, drummers, butchers, witchdoctors and warriors. All of them painted head to toe, shouting, singing and dancing crazy.

The public will be invited to participate in the event which promises to be an incredible sight and a fitting remembrance of what once was, of what built this city, this area, this people and this culture.

Sunday 3rd June
Bull puppet workshops
Dowtcha puppets will be holding puppet making workshops

TICKETS:
BOOKING/INFO:
VENUE: Blackpool Retail Park

I have a feeling you’ll find us at the beach if the weather is nice or even mildly ok. It’s been a while, before Adam was born even, and the pull of the ocean is strong!

Star trekkin' across the universe

Star Trekkin’ by The Firm

I can’t believe this song is 20 years old! My parents bought the original album on tape and we listened to it over and over. The other songs on the tape were more boring to my 11 year old ears but I remember they grew on me as time passed. I have no idea where the tape is now unfortunately.

What would we do without Youtube? Write original content? Gasp!

Star Trekkin’ is a song released in 1987 by a band called The Firm (not to be confused with the British rock group or the hip-hop supergroup of the same name). It is a parody of the original TV series of Star Trek.

Just in case that wasn’t enough, and on the subject of songs that get stuck in your head. The “Hold a chicken in the air” part of the Chicken Song by Spitting Image was stuck in my head for several years. Don’t press play. You’ve been warned!

The real way to improve server performance

If you want to improve server performance, the best way is to move as much of the processing off it and onto the client machine. All those visitors of yours are running souped up AMD and Intel CPUs with their big screens and fat harddrives. No wonder your small little hosting plan can’t keep up. Here are some very good ideas from a Slashdot comment I read this morning.

  • Databases can get pretty slow with complicated queries, so upload your database to the client when they load the page and then your database queries are distributed.
  • PHP isn’t very fast, and neither are Perl or Python, so you don’t want to be running them on the server either. Write an interpreter for the language of your choice in Javascript and move your business logic to the client. This will also interface better with the client side database copy.
  • SSL is a performance killer, don’t use it. If you need to send something securely just prefix it with a predetermined number of random letters and numbers, no one will think to look beyond them.
  • Writing to databases can be pretty bad too. Try discarding all your changes, your users might not notice the difference, but they will appreciate the performance gain.

Check out the original post for a few more invaluable nuggets. If you follow all these tips you’ll be well on your way to becoming a respected and l33t hacker.

And now the big news. I’m really excited about this. The next version of WordPressMU will have a special Javascript client-side db (JCSDB) library built in. JCSDB will enable distributed and parallel access to your WPMU db without the danger of harming your servers. The best thing about it? If your site is dugg or slashdotted then your visitor’s machines will handle the load transparently. Instead of using slow and ungainly TCP/IP the library will use super-quick UDP to communicate. It really is the best way of sending data over the Internet.

I expect Matt will roll out JCSDB on WordPress.com just as soon as a few of the final bugs are ironed out. It might be a bit of headache for Barry and Demitrious to administer, but at least we can get rid of at least half our servers and use them to power a massive game of Counter Strike at the next WordCamp.

Update on May 31st! You all thought this was a joke didn’t you? Well, Google Gears has just been released and “is an open source browser extension that enables web applications to provide offline functionality”.

  • Store and serve application resources locally.
  • Store data locally in a fully-searchable relational database
  • Run asynchronous Javascript to improve application responsiveness.

It’s still in beta but Google Reader already supports it by allowing you to download up to 2000 items to read offline. This could be useful when I’m flying to SF next July!

Ubuntu's useful apt-get hints

Ubuntu 7.04, or Feisty Fawn as it’s known to it’s friends, has added a neat upgrade to the apt-get tool. For those who don’t know, apt-get is the tool Ubuntu uses to install and remove software. A small problem in the past has been trying to figure out what the name of the package required was.

In Feisty Fawn, if you try to run a command that isn’t installed a small message will be displayed telling you how to install it! The software has to be in your repository, so typing notepad and expecting it to tell you to apt-get install windows isn’t going to happen!

This morning I needed to update my local WPMU work area so …

$ svn update
The program 'svn' is currently not installed. You can install it by typing:
sudo apt-get install subversion

apt-get moo still works too! 🙂

If the mountain won't come to Google

While posting yesterday’s photo I used Google Maps to find the name of the quay where it was taken. Unfortunately, the map wasn’t exactly correct.

google-cork.jpg

Google Maps put Patrick’s Hill down by the River Lee where Camden Place should be. Also, since when did Merchants Quay go across Christy Ring Bridge? Yahoo Maps have it right however so it’s best to double check before you plan your journeys!

yahoo-cork.jpg

The Weekend section of the Irish Examiner has a lengthy piece on blogging. Unfortunately it starts out interviewing Perez Hilton but the second part concerns itself with Irish bloggers. The usual suspects are represented there plus a few you may not have heard of. Good read!

I voted today in the Irish election

Thanks Celine for taking care of Adam while we went and voted! I can’t remember who I gave all my votes to but the first two went to:

  • John McCarthy, an independent standing on health issues, including mental health. (yes, that is a pony tail!)
  • Noel O’Flynn, a Fianna Fail politician. He helped us a few weeks ago, although in hindsight there was little he could do. I’ll be blogging about that once an appeal is done.

I didn’t vote for the Worker’s Party, Socialist Party (same thing?), Sinn Fein or the Greens.

Around the Irish blogosphere:

  • Mel listed who he voted for.
  • Claire voted for the first time.
  • The Swearing Lady ponders the paradox that the Irish government wanted Sinn Fein to be part of the administration in the North, but nobody will touch them with a barge pole down south.
  • Adam thinks Rock the Vote was a complete failure. As I only became aware of that movement through blogs talking about it and taking the piss out of it I’d have to agree.
  • More coverage from Politics.ie, Irish Election, and of course Damien has plenty to say on the election. I rather enjoyed the grey tigers video he posted!

Can you vote on the 24th?

My dad texted me to ask if I was registered to vote in Blarney because he checked the electoral register and neither Jacinta or I were found there. I know we’re registered because we filled in and sent off the forms months ago and we’re receiving junk mail from politicians to prove it! Nevertheless I went to checktheregister.ie to check the electoral lists and sure enough we’re there. You have to scroll down quite a bit because the list of place names similar to our address is quite long. It’s still got an awful interface btw.

Like Michele, both of us can vote in two places. So much for the famous cleanup of the lists last year. They obviously weren’t that careful checking. Would I be commiting a crime if I voted twice? I wonder what the penalty for doing so is? What about a spoiled vote? Does that count?

Welcome Dublin!

It’s now easier than ever to use Google Analytics thanks to the interface revamp it’s gone through. Michele had the scoop yesterday and I’m very impressed. From your dashboard you can drill down to various aspects of your website’s traffic.

One of those is a clickable map of the world that eventually led me to the following map of Ireland. That’s a lot of traffic from Dublin, but it’s probably something to do with the way Internet traffic in the country is routed. That, or the fact that a quarter of the population live there. Welcome Dublin people to Holy Shmoly!

eire.gif

keywordhits.gif

A few days ago I listed the keywords people use to visit my site but now it’s easier to find that information and dig deeper into archived traffic stats. Inside the new Analytics interface, go to “Traffic Sources” where you’ll find “Top Traffic Sources”. Click on the keywords for pretty graphs!

Update! Some people aren’t happy with the new upgrade. Chris Silver Smith thinks it’s a downgrade from the old interface.