Back to the Tables...

Published at September 30, 2010 | Tagged with: , , ,

... or how table based layout still lives

When I first started to write HTML (about ten years ago) the web has nothing common to the current one. Modem connections, IE4/IE5 were the major browsers and Netscape was far far away in the competition. These were dark ages for the web. CSS was a new conception that every one mentions but few dared to use. These was the ages of the table based layouts - hard to do and impossible to maintain. Multiple colspans and rowspans, nested table, absolute HTML horror until you(or your boss) decide that "this page need some minor improvement" this was when the real hell started. One less or extra column usually destroys the whole layout. These may seem like a bad coding practice or joke to most of you but I`m sure that everyone that walked this way will agree with me about this.table based layout

Years later when I realized the power of CSS and started to build CSS based layouts with floated divisions I was like a new born. It was amazing - simple, clean, easy to build and even easier to maintain. Yes there was some other holes where to fall like box models and other browsers differences but it was a great improvement. Then I learned that table were for table-data only, everything else should be done with CSS and I was happy.

In the last years I was mainly focused on back-end development and the JavaScript part from the front-end so I have to confess that I was little away from all this HTML&CSS stuff. I only write simple things or take deeper when some of the front-end developer faces a problem. But how you all know a man always goes back to its roots so it was my turn now. I have a simple template to code from PSD to HTML/CSS. Header, two fixed width columns, some rounded corners nothing to worry about so I sit down and started. I was pretty happy with the result until I decided to check is there something special that I must have in mind for these e-mail newsletters.

What? Didn`t I tell you? Yes it was a template for a newsletter that is going to be send to users via e-mail. From the time when I started to use CSS layout I have never thought that there will be a time when I will go back and do table based layouts again but it looks like contrasting to the browsers the e-mail clients haven`t evolved in much in the last 6-7 years(at least when we talk about CSS support). So the tables are back in the game and these are some simple rules I found over the net that you must have in mind when you do html e-mails.

  • Use table to build your layout
  • Do not declare your CSS in the head tag, use inline styles insted of this
  • Avoid using background images
  • Avoid using images at all(just joking but have in mind that you have to check how your mail will look without them cause most of the mail clients did not load images until you confirm that you really want them )
  • If you are going to use images my personal advice is to use absolute URLs instead of adding the images to the mail. This will save bandwidth of your customers(especially for the ones that use mobile devices), you will be able to change and image every time when you need(if you noticed a problem with am image after the mail is send)

There are several companies that offer e-mail testing services one if them is Campaign Monitor. I have to confess that their price seems a little high to me but it depends from project requirements. The good thing is that the provide absolutely free e-mail clients CSS support table. I found it very useful and that you will do too.

Another solutions is Litmus they have lower prices but their test support less clients.

A free but just for basic tests is Email on Acid

If you know any other(especially free) simiral services please share the with me.
I hope that this will help to someone else, and if you have any questions fee free to ask.

Google Analytics referring sites and https

Published at September 16, 2010 | Tagged with: , , ,

The problem: recently a client reported the he does not see another site he owns in the list of referring sites in his Google Analytics account(for his main website) but was absolutely sure that he recieves trafic from this website.

The research and the reason: at first I thought that the problem is cause by the 301 redirects the site use to send you to the propper language version of the website(cookies based). But after some reasearch I found that these 301 redirects keep the original referrer so the problem was somewhere else. So I open a page from the second site, click a link to the main one and run "document.referrer" in the console, strange but the answer was empty. I tried it clicking link from other site and everything was ok, the result was the referring site so the problem really was with this one. After some more wondering what is really going on I finally noticed that the problem website was working under secured(https) connection.
According to RFC2616 section 15.1.3

Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol.

OK, so the reason for the problem was found but how to solve it?

The solution: Google Analytics allows you to override the referral URL so the only thing you need is to add get parameter to the link url with the url of the pointing page, for example: http://main.com/news/?referral_site=second-website.com
Then place some logic that will check for "referral_site" parameter and use the_setReferrerOverride() gladly provided by the GA team to override the referral address.

If you have another solutions or questions please let me know.

Python comparisons speed depends from the result

Published at August 18, 2010 | Tagged with: , , ,

Recently I decided to check whether "less than or equal"(<=) is slower than "bigger"(>) and I was surprised from the result. In my case "bigger" was slower. I was amazed, according to the simple logic in the case of less then or equal we need one or two operation(for example we first check for equality and the for then for "is lower"), so I asked at stackoverflow what causes this and here is the answer.

The speed of the operation does not depends from the operation itself but from the result. When the result is false it is calculated faster the if it is true. You can see the disassembler trace here.

Have you found other operations when python acts "strange"?

Google stops Google Wave development

Published at August 5, 2010 | Tagged with: , , , , ,

As stated in the official Google blog Google will discontinue Wave development(at least as an independent product). I looks like low user interest is the main reason for this decision.

We have to admin that Wave creates a new point of view on the web technologies and it is little sad that this "new wave" meet its end so quickly but I doubt that Google will completely forgot Wave. I am pretty sure that we will see many of the Wave features in the upcomming Google social network(Google Me).

Also the main parts of the code are availabe as open source so I think that there will be a lot of developers who will continue to use and improve Wave features.

Google and social networks - wins and failures

Published at July 27, 2010 | Tagged with: , , ,

...will google finaly place itself on the top of social networks?

Have you ever heard of Orkut?

Most of the people will say "No". This was the first try of Google to take place in the world of the social networks. Ok, maybe not the first. I have to admit the the first was in the late 2003rd when Google offered to purchase Friendster, but their offer was declined. So they decided to start own project and in 2004th Orkut was launched with the hope that it will dethrone Facebook from the leading position. Although the big interest in the start it didn`t succeed to take the first place(by registered users) and is now on number 7 with 100 milion users. Some people blame Brazilians for overwhelming it and repulsing other members by using not English but Portuguese in social discussions. Since then Orkut is widely used in Brazil and India but not popular in the other countries.
So this was big failure number one(if you can call failure 100 milion users.)

Google Buzz

This was the second attempt, this time the "attack" was pointed in the area of short messages. Again it couldn`t reach the size of its main competitor Twitter.

Google Me

Digg founder Kevin Rose, posted on Twitter the rumour that Google are going to intriduce a Facebook competitor. SF weekly posted an article that this is true and Google have already allocated many engineers to this project.

The only thing left to us is to wait and see will Google finaly succeed to take the throne of social networks king.