Archive for the ‘HTML’ Category

Why is my database slow?

Tuesday, May 11th, 2010

Not part of my Don’t Assume series, but when a client states “Why is my database slow”", you need to determine if indeed the database is slow.

Some simple tools come to the rescue here, one is Firebug. If a web page takes 5 seconds to load, but the .htm file takes 400ms, and the 100+ assets being downloaded from one base url, then is the database actually slow? Tuning the database will only improve the 400ms portion of 5,000ms download.

There some very simple tips here. MySQL is my domain expertise and I will not profess to improving the entire stack however perception is everything to a user and you can often do a lot. Some simple points include:

  • Know about blocking assets in your <head> element, e.g. .js files.
  • Streamline .js, .css and images to what’s needed. .e.g. download a 100k image only to resize to a thumbnail via style elements.
  • Sprites. Like many efficient but simple SQL statements, network overhead is your greatest expense.
  • Splitting images to a different domain.
  • Splitting images to multiple domains (e.g. 3 via CNAME only needed.) — Hint: Learn about the protocol
  • Cookieless domains for static assets
  • Lighter web container for static assets (e.g. nginx, lighttpd)
  • Know about caching, expires and etags
  • Stripping out http://ww.domain.com from all your internal links (that one alone saved 12% of HTML page size for a client). You may ask is that really a big deal, well in a high volume site the sooner you can release the socket on your webserver, the sooner you can start serving a different request.

Like tuning a database, some things work better then others, some require more testing then others, and consultants never tell you all the tricks.

References

As with everything in tuning, do your research and also determine what works in your environment and what doesn’t. Two excellent resources to start with are Steve Souders and Best Practices for Speeding Up Your Web Site by Yahoo.

Correctly handling redirects

Friday, February 22nd, 2008

I’m in the process of consolidating all my work scattered across the WWW to www.ronaldbradford.com

As part of the process I was originally redirecting this to my present blog but I was not doing it the correct way. You should Use standard redirects: don’t break the back button! from W3C.

For now, I’ve reverted to a splash page and physical links until I can complete the new site.

The iPhone Safari Browser

Sunday, July 15th, 2007

One of my photo websites www.ronaldbradford.com doesn’t work properly on the iPhone under Safari, but it works under Safari on Mac OS/X. Problem is, there is no debugging options and I see no way to workout why DOM compliant Javascript doesn’t work!

FireFox’s Live Bookmarks

Thursday, June 15th, 2006

I’m just about to launch a new project I’ve been working on in the past week. It has a RSS feed, and I wanted to ensure that within FireFox, this could be picked up as a live bookmark. This alone is a very cool feature. Using my Blog for reference, the following code is used.


	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://blog.arabx.com.au/?feed=rss2" />
	<link rel="alternate" type="text/xml" title="RSS .92" href="http://blog.arabx.com.au/?feed=rss" />
	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="http://blog.arabx.com.au/?feed=atom" />

So adding a RSS2 live bookmark link is as simple as a header tag.

References
Live Bookmarks – Mozilla Description
Good Introduction Tutorial

Sending email using PHP

Sunday, November 6th, 2005

I’ve had a number of recent inquiries about sending emails on a Web Form using PHP.

The following examples using the core PHP mail() function.

mail() syntax http://www.arabx.com.au/example/mail.phpView Source

HMTL form with mail() operation http://www.arabx.com.au/example/form.phpView Source

A tip for not using Click Here as a link on a web page

Tuesday, September 20th, 2005

http://www.w3.org/QA/Tips/noClickHere

HTML (ampersand) Character Codes

Wednesday, July 7th, 2004

· (&middot;) Middle Dot
• (&#149;) Bullet, black small circle
« (&laquo;) Left-pointing double angle quotation mark
» (&raquo;) Right-pointing double angle quotation mark