A Custom Search Engine for Blogger

Custom Search EngineWhen I or other people used the searched function on this blog for some article they like they often couldn't find it, because the standard blogger search doesn't index all pages. This was annoying and either people left or they were forced to go through the article archive in order to find articles. There is an alternative to standard blog or google searches which allows people to always find what they are looking for. This is the google custom search, you probably heard of it, and if you don't have it on your blog yet, I suggest you consider putting it there.

The advantage of custom search engine (CSE) over the blogger search and normal google search is that you can determine how it indexes your site. If you submit your sitemap your pages will show up in the results. This makes search results from CSE more relevant than those from normal google search (even if you apply the site restriction to your site).

You can make money from adsense for search, in fact you can't opt out of ads if you don't want to pay for the professional account. I didn't want to have ads along with search results and I see this as a downside, however in the end the advantage of better results won me over.

If you want to see an example of a CSE, see the My Outsourced Brain custom search. You may also want to read an introductory article on how to set up a google custom search.

There are different choices on how to integrate the search results on your site in blogger. Some time ago I had the results embedded on my site in the sidebar, so they would always re-search for people coming from google or other search engines (similar to Chitika). During some efforts to make my site load faster I pulled the custom search result embedding because it required loading of several external files and because I got tired of all the customization efforts I put into making it look good.

Now I show the option which I currently use on this site, which is showing the results on a google site. Different to the code offered in the google custom search settings, the search form is standard HTML and does not show any google branding. The search bar is reset when you click on the search bar.

<form action='http://www.google.com/cse' id='cse-search-box'>
<input name='cx' type='hidden' value='014996012458446089762:dlibbmmbqik'/>
<input name='ie' type='hidden' value='UTF-8'/>
<input class='sitesearch' id='sitesearch' name='q' onblur='if(this.value==&quot;&quot;)this.value=this.defaultValue;' onfocus='if(this.value==this.defaultValue)this.value=&quot;&quot;;' type='text' value='search here...'/></form>

Try it out below:

You can put this anywhere on your site, in a widget or in the title bar, as you see on this blog. You will have to change 014996012458446089762:dlibbmmbqik to your own CSE ID. You find your CSE ID under get code in the dashboard of your CSE or when you go to your search site in the web address.

Enjoy. Please leave a comment below for questions and suggestions.
[ Read more... ]

Firefox in Parallel - A Pre-Release Version

firefox performance. Versions 2, 3, and 3.5. Continuous improvementIf you run Firefox and look at the system resources, you will see the use of one processor go up until 100 percent when you load several pages at once. Most personal computers today have at least two processors, if not more, and not using them is a waste of your time. Instead of loading multiple pages one after the other as it is doing now, it might as well load them at the same time using different processors. While Chrome and Internet Explorer 8 support multi-threading (running on different processors), Firefox still lacks it in the official version. Support for multiple processors in Firefox is in the works and I tested a pre-release version of Firefox that loads different tabs in parallel. In this post I show some of the results I found.

The image illustrates performance increases of firefox version 3.5 versus versions 3 and 1.5. The TraceMonkey JavaScript engine in 3.5 makes javascript execute twice as fast as in Firefox 3 and 10 times faster than in Firefox 2. Image credit: Firefox web browser - under the hood.

Chrome and Internet Explorer run different pages independently. Rumors are running, Microsoft wants to replace Internet Explorer with a new browser, Gazelle, that runs independently not only all pages, but also, components on pages. Now what about Firefox?

While the official version of Firefox still runs on a single processor currently people at Mozilla foundation, which is responsible for the development of Firefox, are working to implement multicore support for Firefox. The project, called Electrolysis, is very ambitious and will bring a lot of value to Firefox users including security and speed. The first stage of development, what they call the sprint, is finished and developers around Benjamin Smedberg are now busy ironing out bugs. You can already download and build (compile) an early version for Linux or Windows and this is what I did.

This post is structured into three parts. First I report what I found with this pre-release version. The other parts are more technical. In the second part I report a detailed speed test results comparing it to another version of Firefox and Google Chrome. In the third part I'll show how to compile this version if you want to run it on your computer. You might want to skip the last two parts if you are not interested in technical details and don't feel up to the task of compiling Firefox yourself.

A Short Test of Electrolysis

In the sunspider javascript performance test, I found that the new build runs nearly 3 times as fast (1849.2 ms) as firefox 3.5.6pre (4554.4 ms), however chromium runs about 50 percent faster (1211.6 ms). I posted about Chrome installation in Ubuntu earlier and this test confirms my impression that Chrome has the edge on speed over Firefox (at least in interpretation of JavaScript). The downside with Chrome is however that it doesn't yet have all the functionality of Firefox.

I found out that Firefox pre-releases are titled minefield not only to deter the feeble. When I tried to load different pages at once, minefield crashed on me and a second attempt also failed. After restarting Firefox Shiretoko (version 3.5.6pre), the version I had installed previously, I noticed that all my preferences, extensions, and bookmarks had disappeared. Fortunately I use the XMarks add-on to synchronize my bookmarks, so quickly recovered my bookmarks. It took me about 10 minutes to re-install by add-ons and I might have to write my passwords out for some time, that's all I lost.

Well... what did I learn? Firefox is going to improve a lot in speed in upcoming versions. Chrome is now about 3 times faster than Firefox in JavaScript performance. What else? Don't run bleeding-edge pre-release versions. They may not work properly, can crash on you, and might delete your browser preferences.

Performance Test

Here come the details of the performance tests all performed on the same machine, my laptop.

-Firefox 3.5.6preElectrolysis 3.7a1Chrome
Total 4554.4ms +/- 2.0 % 1849.2ms +/- 4.5 % 1211.6ms +/- 3.9
3d 509.2ms +/- 4.3 % 268.0ms +/- 6.9 % 187.6ms +/- 16.1
cube 173.6ms +/- 9.9 % 97.6ms +/- 12.4 % 66.6ms +/- 25.2
morph 171.4ms +/- 9.2 % 56.8ms +/- 16.4 % 63.2ms +/- 26.0
raytrace 164.2ms +/- 6.3 % 113.6ms +/- 13.9 % 57.8ms +/- 16.1
access 676.2ms +/- 6.1 % 226.0ms +/- 6.5 % 99.2ms +/- 2.6
binary-trees 79.2ms +/- 12.2 % 53.0ms +/- 19.2 % 6.2ms +/- 9.0
fannkuch 262.0ms +/- 4.4 % 102.2ms +/- 16.1 % 36.4ms +/- 1.9
nbody 244.2ms +/- 11.1 % 42.6ms +/- 7.9 % 46.2ms +/- 6.1
nsieve 90.8ms +/- 13.5 % 28.2ms +/- 10.5 % 10.4ms +/- 6.1
bitops 535.2ms +/- 4.1 % 76.0ms +/- 5.8 % 95.4ms +/- 1.5
3bit-bits-in-byte 77.4ms +/- 17.6 % 3.2ms +/- 17.4 % 8.0ms +/- 0.0
bits-in-byte 113.2ms +/- 19.2 % 20.4ms +/- 23.8 % 20.8ms +/- 2.7
bitwise-and 208.4ms +/- 8.3 % 5.2ms +/- 10.7 % 28.8.4ms +/- 4.7
nsieve-bits 136.2ms +/- 12.6 % 47.2ms +/- 5.1 % 37.8ms +/- 1.5
controlflow 67.4ms +/- 27.7 % 52.0ms +/- 106.3 % 7.8ms +/- 17.5
recursive 67.4ms +/- 27.7 % 52.0ms +/- 106.3 % 7.8ms +/- 17.5
crypto 264.0ms +/- 11.2 % 117.0ms +/- 8.7 % 77.8ms +/- 7.7
aes 96.6ms +/- 16.4 % 63.0ms +/- 13.5 % 27.6ms +/- 21.3
md5 91.4ms +/- 6.8 % 33.2ms +/- 10.4 % 26.0ms +/- 3.4
sha1 76.0ms +/- 18.4 % 20.8ms +/- 26.5 % 24.2ms +/- 2.3
date 357.6ms +/- 7.5 % 265.0ms +/- 6.3 % 189.2ms +/- 7.8
format-tofte 160.6ms +/- 13.4 % 155.4ms +/- 7.3 % 87.4ms +/- 6.5
format-xparb 197.0ms +/- 3.7 % 109.6ms +/- 14.8 % 101.8ms +/- 14.6
math 531.6ms +/- 4.8 % 90.0ms +/- 4.0 % 124.0ms +/- 9.2
cordic 205.0ms +/- 5.9 % 31.2ms +/- 10.7 % 51.8ms +/- 22.9
partial-sums 229.4ms +/- 7.0 % 42.6ms +/- 4.4 % 50.8ms +/- 6.1
spectral-norm 97.2ms +/- 16.5 % 16.2ms +/- 8.4 % 21.4ms +/- 12.7
regexp 483.0ms +/- 8.2 % 153.0ms +/- 6.0 % 29.6ms +/- 2.3
dna 483.0ms +/- 8.2 % 153.0ms +/- 6.0 % 29.6ms +/- 2.3
string 1130.2ms +/- 3.6 % 602.2ms +/- 2.5 % 401.0ms +/- 5.4
base64 90.8ms +/- 16.4 % 18.0ms +/- 21.8 % 40.6ms +/- 4.6
fasta 224.4ms +/- 6.7 % 117.4ms +/- 11.4 % 73.4ms +/- 3,9
tagcloud 257.0ms +/- 11.3 % 186.0ms +/- 8.2 % 85.6ms +/- 5.5
unpack-code 407.6ms +/- 2.6 % 212.0ms +/- 12.8 % 118.8ms +/- 7.5
validate-input 150.4ms +/- 11.3 % 68.8ms +/- 11.3 % 82.6ms +/- 20.3

Compilation of Electrolysis

For the rest of this post I'll walk through an installation of Electrolysis on ubuntu. If you use a different Linux distributions or Windows, you can follow a similar path.

Download archive in gzip, zip, or bz2 formats, I downloaded gzip. The file took a while to download. Then you unpack the files, depending on the format you chose for download. I did tar -xvvf tip.tar.gz

There are pre-requisites for building of firefox. On linux, you need to install some packages (you'll also find instructions for other linux distributions and windows).

> sudo apt-get build-dep firefox
> sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev

For building, you use GNU make and configure scripts (even on windows). Go to the top level directory of the code, cd electrolysis*.

Now configure your build options. It is recommended that you create a file, .mozconfig, where you put some options for building.

Create and edit a .mozconfig file. I inserted the following lines:

ac_add_options --enable-application=browser
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-optimize=-O2
ac_add_options --enable-optimize
ac_add_options --disable-tests
ac_add_options --disable-debug

Now we start compilation:

make -f client.mk build

Now you'll have a lot of time to think about the analogy between separating processes and the decomposition of water into oxygen and hydrogen.

Once finished, you find the build in dist/bin/. On Linux you execute the filefox binary, on windows you run firefox-bin. According to Mozilla, it is best to run it in a separate profile.

> cd dist/bin
> ./firefox -P JunkProfile

If you don't start with a new profile you might have to fix an error about xbl binding first.

My version of firefox shows 3.7a1. Go to firefox configuration typing about:config in location bar. With right click you insert a new boolean property dom.ipc.tabs.enabled and set it to true.

Hope you find the information in this article useful. Please feel free to leave feedback.
[ Read more... ]

Can the Second Law of Themodynamics Be Violated?

Can you imagine an egg which unscrambles? Or a jet engine that takes ambient heat and exhaust fumes to generate kerosene and oxygen? I suppose you can't. In physics, the Second Law of thermodynamics, establishes that it is not going to happen. In this post I explain the second law of thermodynamics and discuss whether it can be violated or not.

This post is part of the initiative "El Carnaval de la física" (the physics carnival), created by the blog Gravedad Cero and promoted by the Unione Astrofili italiani to commemorate the first observation of a heavenly object by Galileo.

Second Law

Entropy can be seen as a measure of the disorder of a system, the more entropy, the more disordered the system is. Technically, entropy is the measure of the number of microscopic states that give the same macroscopic properties.

The Second Law of thermodynamics states that the entropy of an isolated system which is not at equilibrium will tend to increase, reaching its maximum value in the equilibrium state, this means that its macroscopic properties such as temperature or pressure remain stationary. Another way to state this principle, equivalent to the first one, is that it is impossible to convert heat into work in a cycling process. You cannot take heat from a high-temperature source and completely convert it into work without transferring some heat to a low-temperature energy sink. Unlike the laws of mechanics, where time can go forward and backward, the second law of thermodynamics gives a privileged time direction. There are irreversible processes.

But some nanomachines, like mitochondria in cells which are far from equilibrium, spent some of their time working in reverse (like the jet engine which converts ambient heat into kerosene!). How can this happen? Do they break the second law? Does the second law fail when we go to the realm of "very small"? Is the second law only a statistical one? To find the beginning of the dicussions about the second law, we must travel backward in time, to the nineteenth century.

Maxwell Demons

Physicists have been dealing with the Second Law of thermodynamics since 1871 when James Clerk Maxwell, in his Theory of heat introduced a small creature to show that the second law is a statistical one. That creature has been known since then as the Maxwell Demon. The Maxwell Demon is a demon small enough to see the single molecules of a gas, such as the one in the image below. This Demon is situated in a container divided by a wall into two parts, A and B, filled with the same gas at the same temperature. When a molecule faster than the average in the A part of the container is close to the wall, the Demon opens a trap and the molecule will go to the B compartment. As the temperature is an average of the velocity of the individual molecules, if the demon repeats this process many times, the temperature will increase in B and decrease in A without any cost of energy.

This game, simple at a first look, has upset physicists, who tried to find a solution and to improve the Maxwell Demon to put to the test the Second Law. In this case, the contradiction vanishes if the Demon is taken into account as part of the system. The entropy produced for the Demon, when he tries to measure the information of the molecules, is higher than the entropy lost for the gas system.
Maxwell demon classifying molecules according to its velocity
(credits for image go to: Волобуев, Wikimedia Commons)

One of more important responses to the Maxwell Demon was the response given by the physicist Léo Szilard in 1929 in the published article, On the Decrease of Entropy in a Thermodynamic System by the intervention of Intelligent Beings. The Szilard engine is a variation of the Maxwell Demon which consists in a single particle gas in a cylinder at a thermal bath at temperature T. The cylinder has a piston that separates it in two halves. If the Demon knows in which part the particle is, he can let the gas expand reversibly and then remove the piston. With the expansion, the gas performs work, which is taken from the external bath. The engine extracts energy from a single thermal bath! Szilard's argument was that the amount of energy necessary to know in which part of the cylinder the particle is, would be greater than the amount of work produced by the Szilard engine. But Szilard was not precise in this part of the work, he didn't calculate the exact amount of energy the demon would need because his first premise was that the second law could not be broken. Later, some physicists tried to calculate this energy more precisely, like Léon Brillouin. He argued that, in order to see a molecule, it is necessary that this molecule scatters at least one photon whose energy dissipation would produce an increase of entropy at least equal to the decrease produced by the Szilard engine.

An interesting fact about the different kinds of Maxwell Demons is that they showed the relationship between information and thermodynamics entropies. In 1982, Charles H. Bennett demonstrated that, even if some measurement processes do not need energy, erasing information does and a Demon will eventually need information space. An easy-to-understand article about Maxwell Demons and information theory was published in 1987 in Scientific American by Charles H. Bennett and is called Demons, Engines and the Second Law. In 2004 J.M. Parrondo published the article Entropy, macroscopic randomness and symmetry breaking phase transitions, which can be interesting for those familiar with physics. In this article a macroscopic Szilard Engine was constructed, but it does not violate the second law.

Fluctuation Theorem

But I started the article talking about engines that actually work "in reverse", what has happened with them? How can Thermodynamics deal with that? To answer that I must explain the Fluctuation theorem. The fluctuation theorem, originated from statistical mechanics, shows that the second law is only a statistical one and quantifies the probability of an isolated system to decrease its entropy. It states that, with the increasing of time and the size of the system, the probability of seeing an entropy production contrary to the second law decreases exponentially. This is not against the second law because the second law is considered a time average of the entropy production.

A violation of the second law on the level of thousands of atoms and molecules and appreciable time scales was reported for the first time in 2002. The original article by G.M. Wang et al, from the Canberra and Brisbane Universities was published in the issue 89 of Physical Review letters, Experimental Demonstration of Violations of the Second Law of Thermodynamics for Small Systems and Short Time Scales. In the experiment, the trajectories of some latex beads captured in a optical trap and suspended in water are measured at short time-scales, consequently the change in entropy of the system can also be calculated. The researchers found that, in intervals of few tenths of seconds, the change in entropy can be negative, the bead was gaining energy from the surrounding water. But when time is over two seconds, a positive entropy change was measured. This experiment has been considered the first experimental evidence of the Fluctuation Theorem and was widely reported, for example in Nature News or in New Scientist.

Fèlix Ritort presented at the 2003 Poincaré Seminar an article about the state of the art and future perspectives of the second law transient violations entitled Work fluctuations, transient violations of the second law and free energy recovery methods: Perspectives in Theory and Experiments. This paper, after a technical explanation about second law and work fluctuations, gives some examples where transient violations are expected. According to Felix Ritort, many biomolecules are expected to show transient violations, like DNA or RNA polymerase during the replication and transcription processes, or like ribosomes. But two main problems arise in the experiments of single molecules: accuracy and reproducibility. Few single molecule experiments are reproducible, especially if the experiment involves some biomolecular process.
One interesting example is the fluctuations observed in unfolding small RNA molecules under the action of a mechanical force.

Imagine you have a friend convinced that the Second Law can be broken. What would you say to him? Would you encourage him? I'm skeptical about the violations of the second law, but I hope many interesting demons, engines and experiments will be proposed in the future.
[ Read more... ]

Blogger: Hide Deleted Comments

If you don't use pre-moderation of comments in your blog, inevitably some comment will sooner or later appear that you rather not wish on your site whether it contains obscenities, linkspam, or for other reasons. The problem is that if you delete the comment, there will be a message "this comment was deleted by a blog administrator." How not to show the comment at all? There is a simple solution and in this post I show it.

In my last post on commenting on blogger, I lamented that the blogger commenting system lacked many features. One of the lacking features is re-editing of posted comments.

If you delete the comments and put a new one, you'll see an ugly "this comment was deleted" message. Once you'll implement this little hack, you and other commenters can freely re-edit comments on your blog. This allows you to be more flexible in the comment posting. I even disabled the pre-moderation setting because now I can delete comments without a trace.

We need to edit the template in order to make this work. In the blogger dashboard go to layout->html. Backup your template before editing (choose download template). Expand widgets.

Now in your template search for this line:
<b:loop values='data:post.comments' var='comment'>

Insert the following lines below:

<b:if cond='data:comment.isDeleted'>

Now scroll down where you see </b:loop> several lines below. Above it, insert this line:

After these changes, deleted comments should not appear any more.

Now, for the comment count, which appears with the posts (usually in the post header or footer). The comment count includes deleted comments and therefore we have to subtract deleted comments. This is easy if we search and replace some text in the template.

Substitute all <data:post.numComments/> for <font id='numComments'><data:post.numComments/></font>. Usually there should be two occurrences.

Replace <b:includable id='comments' var='post'> with

<b:includable id='comments' var='post'>
<script type='text/javascript'>var numComments=<data:post.numComments/>;</script>

Now replace <b:if cond='data:comment.isDeleted'> with <b:if cond='data:comment.isDeleted'>
<script type='text/javascript'>numComments--;</script>

At last we need to replace <b:if cond='data:post.commentPagingRequired'> with <script type='text/javascript'>
var numC=document.getElementById(&#39;numComments&#39;);
if(numC) numC.innerHTML=numComments;</script>
<b:if cond='data:post.commentPagingRequired'>

Once you save, deleted comments should not appear any more and the comment count should be corrected for deleted comments.

Enjoy. Tell me how this works for you.
[ Read more... ]

Attracting More Comments On Your Blog

I think one of the principal motivations for people to maintain a blog is to exchange opinions and improve your thinking. By leaving comments, visitors can improve your article and give you pointers that you can follow. I think most bloggers are happy to receive comments, in fact it's unusual to find a blog that has comments deactivated. This post discusses how to get more comments.

Comments are an important part of a blog. They are a way to get feedback and they increase the value of a page to visitors. Furthermore, if you can engage your visitors they are more likely to come back and link to you.

How to attract (more) comments to a blog?

On this blog, there are post that were seen by several thousand visitors and are yet without comments. Therefore, I want to start with a disclaimer: I don't really know, how to attract more comments, but I am trying and I would be happy if you could give any useful advice.

First, let's get the obvious out of the way.

The Blogger Commenting System

There many nice commenting systems, like disqus or echo, but let's be honest, Blogger's comment system lacks many features, including comment threading, social networks aggregation, and comment voting. Out-of-the-box the visuals of Blogger's system are unsightly and it takes some extra work to make comments look good.

Why is it then that only few people on blogger use these superior comment systems? Because people are rightly afraid to loose on SEO when outsourcing their comments. The problem with blogger is that only javascript widgets are allowed, so all content that is delivered to your page by widgets is invisible to search machines (apart from slowing down the page in the browser). This means in particular that all comments made on your blogger blog with a comment system other than blogger's do not contribute to your search engine traffic.

However, there are a few things you can do on blogger to make commenting more bearable. Most of these have been discussed ad nausea on many blogs already, so I only shortly mention the most important points. It is easier for people to comment if you embed the comment form on the post page (done in settings->comments). People don't want to be carried to a different page for commenting. You can allow anonymous comments for people who don't have open-id accounts or for various reasons don't want to take the hassle to log in. I am currently allowing anonymous comments, but I use pre-moderation of comments, so that no obscenities or link spam comes through.

I think there are many ways that blogs can improve the commenting system in blogger starting from styling the comment section to several technical things. You may want to see my post on how to hide deleted comments in blogger on one of the technical things.

Normally links in comments are given special tag, no-follow which means that search engine spiders do not take them into account when they spider your site. Using do-follow gives incentives for people to comment, however my worry is that it will maybe not attract the right kind of comments.

Motivating People to Comment

How else to motivate people to comment on your site? Let's ask more in general, why do people comment?

I think, there are several reasons. Most importantly, I think is that they like the blog and the posts. I think there is a minimal requirement that the blog should look acceptable. As for myself, I usually only comment on posts that are reasonably well-written and I think it's often very well-written or high-impact posts that have a high number of comments.

If I find a post very superficial, I think, I better improve on that post by writing a new one than explaining in comments everything that was left out.

Another reason why people leave comments is personal involvement. There are many things that bloggers can do to increase the involvement of visitors. Some time ago I posted on social networking features in blogger and wrote about some of these aspects.

Often comments are reciprocative between people. Finally people often ask questions regarding issues they want resolved.

It probably helps to end your posts with a question. On the bottom of every post, I have a message animating people to discuss. It looks like the one with which I am going to end this post.

How do you animate people to comment on your posts? What motivates you to comment?

This post was inspired in part by the post Optimise your comments page in blogspot blog.
[ Read more... ]

How Digg Works - or - When to Submit Your Articles

Social bookmark sites can be great to find articles to read when you are at leisure or bored. They are also a great way to promote your website and attract traffic. This article is about how to promote an article at a social bookmark site.

Digg is one of the most popular social news sites and it has been scientifically studied often over the last years. I looked through some articles and found many studies that talk about social information processing and social recommendation with special attention dedicated to digg. From the articles many useful and interesting details about the dynamics of digg can be learned. This includes how article promotion works and when to submit an article at digg.

On Digg, anyone with a free account can submit links and stories, vote, and comment on submitted links and stories. Voting stories up and down is called digging and burying. Many stories get submitted every day, but only few appear on the front page. A newly submitted story first goes to the upcoming stories section, displayed in reverse chronological order of submission time. If the story accumulates enough votes shortly and meets promotion requirements, it will be moderated as a popular story and promoted to the front page, becoming more visible, otherwise the story gets pushed down in upcoming stories.

In order to find out how to get most visibility for your submitted story, lets start with the demographics of digg. This can give us clues about what people at digg might be interested in. According to Alexa, the typical digg user is a US-American college-educated male between 25 and 34 without children who visits from home.

What are US American guys between 25 and 34 most interested in? My guess is, probably girls, entertainment, and games. By the way, did I mention the nude geek chick on the bottom of this page?

Now to some of the studies I found.

What Digg does is called by some social information filtering. Somebody recommends a story, the story gets promoted over networks of related people, so that if one person likes an article a friend picks it up[1]. In initial voting patterns the more unrelated voters are the more likely it is that there will be more diggs[2]. Makes immediate sense to me.

I found many clear conclusions and graphs in the article Measurement and Analysis of an Online Content Voting Network: A Case Study of Digg by Yingwu Zhu. In the following two paragraphs I present a short summary of this paper.

The mechanisms of article promotion to the front page are essential to the success of digg and they do not make them public. This secrecy helps them protect against spam. Yingwu Zhu investigated promotion and found there is a cutoff by diggs. In his study, all popular stories received 15 diggs or more before promotion. However, cutoff is not the only factor. He found one upcoming story which received about 1900 diggs without getting promoted. He concluded there was a content censorship on advertisement, phishing articles and articles perceived offensive to Digg.

For both upcoming and promoted stories, digging frequency diminishes over time, however promoted stories get digged much more. Upcoming stories get nearly forgotten after 1 day, while promoted stories can come up again after one, two, or three days. After 1 day stories have very low probability of getting promoted. Highest chances are within the first hours (7 or 8 hours it seems). Zhu found that 88 percent of articles get promotion at age 1 day or younger.

Also a great study on digg can be found in the article Predicting the popularity of online content by Gabor Szabo and Bernardo A. Huberman. The graph below is taken from this article. It shows daily and weekly cycles in the rates of digging activity. The three curves show diggs, submissions, and promotions, which have been brought to similar scales by multiplication with powers of ten. The data come from one week, days are Monday to Sunday.
daily cycles of activity at digg.com

You can see when there is most activity at digg over the week and over the day (before and after lunch?). I think it becomes clear from the graph that article submission does not have equal changes on all days. In fact it seems that submission on Tuesday has highest chances of success, because of the better relation of promotions with respect to submissions. It has to repeated however that data in the study are based on only one week and that there may be differences depending on which week you look at. This answers partly the question of what's the best time to submit an article.

Now to the best hour. The hour of when best to submit an article does not really become clear from above graph. I took the graph below from Szabo and Huberman's article. I simplified it to show average diggs of submitted article by promotion time (measured 24 hours after promotion).
diggs by promotion time

Notice the difference between submission time and promotion to the front page. I didn't find a graph showing diggs by submission time. But I still think that you can get a basic idea on when to submit an article if you bear in mind that most articles get promoted within the first few hours of submission.

There are two peaks during the day, one around 6 am, the other one at about 8 pm. This means that if your articles get promoted at these times you can get many diggs and consequently you can hope for many visitors. For submission this means that you should try to submit a few hours earlier. (Please note that the times mentioned throughout this post are in Pacific Standard Time, PST.)

That's all. I'd be happy to read your comments. And please digg me at the right time ;).
[ Read more... ]

Speed of Fingernail Growth

nail bitingHow fast do fingernails grow and from what does the speed of their growth depend? Certainly good to know, if only for curiosity or so you can adjust the speed with which you bite off your nails. After reading this post you'll know better how fast nails grow and which factors relate with the growth.

The Image shows short-trimmed finger nails with some bite marks. Credit goes to Sue Bailey on Flickr.

Do nails grow faster during stress? Do nails on the feet grow slower? Do nails grow faster if you use nail polish?

I was somehow intrigued by these and other questions and I set out to search and found a great article from the year 1979 in the Journal of Investigative Dermatology. The article is called The Effect of Aging on the Rate of Linear Nail Growth and was written by Norman Orentreich, Jules Markofsky, and Joseph H Vogelman.

The authors propose that nail growth can be used for measurement of aging. Fingernail growth rate can be used to determine age! Turns out it depends mostly on age, but also on biorhythm, season, and circadian rythm.

So how fast do fingernails grow for different ages? The authors measured the nail growth of Caucasian males and females. In the graph below you find several curves:
A - 72 Caucasian males,
B - 185 Caucasian females,
C - One Caucasian male (from a different study),
X - (from yet another study) roughly 1000 people, Japanese and Caucasians by half, of both sexes.

Nails grow with a speed of between a quarter of a centimeter per month to about half a centimeter per month. Growth until around 20 years of age and after then becomes less with age.

Nail growth is greater in males than in females.

It might seem that for Japanese nail growth is less than for Caucasians, however without seeing the data from the other study it is risky to draw this conclusion.

What are the factors that determine or that are related with growth of nails?

See an excerpt from a table the authors compiled:
FasterSlowerNo Effect
Third DigitFirst and fifth digitsDietary supplement
MalesFemalesModerate emotional stress
PregnancyLactationMinor chronic illness
Piano PlayingAgingHeight and weight
HandednessMalnutritionModerate weight change
TypingDecreased CirculationSkin color
Elevated TemperatureLowered TemperatureUse of nail polish and remover

Finger nails grow faster on the toes that you use more, they probably grow faster in summer than in winter.
Moderate stress doesn't seem to have any influence. Painting nails doesn't make them grow faster.

Enjoy. What is your nail growth? Please leave a comment below for questions and suggestions. If you liked this article you might also want to read about handwashing behavior (or: should I take the peanuts?).
[ Read more... ]

Embed Google Wave in Blogger

Google wave. From YouTube - Google Wave Developer Preview at Google I/O 2009Yesterday I received an invite for google wave, google's new communication tool that had the potential to unify all of their services. I wanted to try how to embed a google wave in blogger. After some tinkering and trying I had it. Here it goes.

Image taken from Google Wave Developer Preview at Google I/O 2009. Credit: Rambling Librarian at Flickr.

You can find a very nice introduction to google wave at mashable.

How to embed a google wave in blogger? Take these steps:

1. Create a wave in your wave client and make it public by sharing with public@a.gwave.com or (if the former doesn't work) easypublic@appspot.com.

2. Share your wave with embeddy, it's wave address is embeddy@appspot.com.

3. Embeddy gives you all the necessary code.

4. Put the code into your post or into an HTML/javascript widget in the sidebox.

Below you'll see a wave that I embedded. You might not see the wave if you don't have an account with google wave (btw, I have some invites left).

Please participate in the wave below!

If you want to embed the wave below yourself, take this code:

<div id="wave" style="width: 100%; height: auto">

<script type="text/javascript">
  var wave =
    new WavePanel('https://wave.google.com/wave/');
  wave.setUIConfig('white', 'black', 'Arial', '13px');

Enjoy. Please leave a comment below for questions and suggestions or ask for invites.
[ Read more... ]

How to Keep Your Passwords Safe?

When I am browsing internet sites and using different services I am required to enter a lot of passwords. Memorizing all passwords grants best security, however this is inconvenient and usually annoying. It's much easier to let firefox fill in the passwords for me, however the problem is that if my laptop gets stolen or somebody gets physical access to the computer all private information will be visible. This post looks at solutions to this problem.

Remembering a new password for every site is difficult if not impossible, however using the same password for different sites is insecure, moreover sites have different password requirements regarding length and allowed characters. Letting firefox remember and enter the passwords for me is faster and easier than memorizing passwords and entering them manually. It is also a protection against phishing, where look-alike imitations of websites try to get access to your data.

The firefox feature to remember and automatically enter passwords is called a password manager. Password managers exist for the desktop, portable devices, or as web applications. A solution to the computer-stolen or physical access problem is to use a master password. This means that all your on-line passwords are secured behind one master password. Without the master password, there's no access to your other passwords. The master password has to be entered once per session.

Configure the master password for firefox as you can see in the image below.
master password for firefox

Password managers for the desktop encrypt passwords for all applications (including your web-browser). Examples are KWallet for KDE, GNOME Keyring for Gnome, or the Keychain for MacOS. For Microsoft Windows several proprietary programs exist.

If you want to secure all the data on your disk, disk encryption software like TrueCrypt provide you with the ability to create encrypted partitions whose existence is deniable, which means that you can plausibly deny in court having encrypted your data.

This post was inspired by a slashdot discussion about the best tool for remembering passwords.

Enjoy. Please leave a comment below for questions and suggestions.
[ Read more... ]

Greeting Widget (Entrecard, Twitter, etc.)

You might have noticed a greeting message on this blog. You would see different welcome messages depending on whether you come from a search engine, twitter, or entrecard. This post describes how to install such a welcome widget in your blog or website. Installation is as simple as copy-pasting a code.

Credits for a welcome message to Visitors from Entrecard and Twitter goes to Laura from Reviewing Whatever. In fact I even copied parts of her welcome message. Her message is great and I didn't know how to improve on it. If there is any part of it you don't like, it's probably an addition of me.

This widget is an extension of my earlier Welcome Widget. Basically you just take the code below and put it in your template where you want the message to displayed. In blogger you can create a new HTML/javascript widget and paste the code in the box.

There are parts of the code you might want to change, especially the text of the welcome messages, where it says search_again.innerHTML=.

You should also change this line:
if (document.referrer.length > 0 && document.referrer.indexOf("myoutsourcedbrain.com") > -1) return false

This filters the URL of your own site from the referral URLs. In my case that is myoutsourcedbrain.com. Just write the main part of your address there. This is important. If you don't change it, the widget does not work as expected.

For easy installation in blogger click the widget button:

Here goes the code of the greeting widget:

<div id="welcome_message"></div>

<script type="text/javascript">
function getReferrer() {
  var Refer = document.referrer
  if ( ! Refer ) return false
  if (document.referrer.length > 0 && document.referrer.indexOf("myoutsourcedbrain.com") > -1) return false
  if (document.referrer.indexOf("entrecard.com") > -1) return 2 // 2 for entrecard
  if (document.referrer.indexOf("twitter.com") > -1) return 3 // 3 for twitter
  return 1;  // by default probably search.

function getQuery(){
  var Refer = document.referrer
  q = Refer.match(/(q(([^=]*)|kw)?|p)=([^"&;]+)/)
  if ( ! q ) return false
  query = unescape( q[ ( q.length - 1 ) ] )
  query = query.replace("/</g,>/g", '&gt;')
  query = query.replace("/\+/g", ' ')
  if ( ! query.match(/\w/) ) return false
  return query

function yousearchedfor(result){
  if(result.responseData.cursor.estimatedResultCount>1) {
      var search_again=document.getElementById("welcome_message");
      search_again.innerHTML='<h2>Welcome Searcher.</h2><br/>According to google, for your query "' + query + '" there are <a href="http://www.myoutsourcedbrain.com/search?q=' + query + '">' + result.responseData.cursor.estimatedResultCount + ' results</a> on <i>My Outsourced Brain</i>. Please feel free to leave comments. If you like the site, you might want to subscribe to our feed to stay updated. ';

function welcome_entrecard(){
  var search_again=document.getElementById("welcome_message");
  search_again.innerHTML='<h2>Welcome Entrecard Dropper!</h2><br/>I hope you enjoy what you see enough to explore for more than the few seconds it takes to drop your card. My Outsourced Brain features articles about topics ranging from technology and software to scientific research. Recent articles have been more focused on <a href="/search/label/blogger">blogging</a> help, including several useful <a href="/search/label/widget">widgets</a>, which I wrote myself. You can find many articles on <a href="/search/label/linux">linux</a>, phd research, and <a href="/search/label/software">software</a> or of general interest such as lifestyle, and <a href="/search/label/nutrition">nutrition</a>. I write occasional <a href="/search/label/book review">book reviews</a>. <br/>A good place for exploration are most visited articles, labels, the search, or the article archive. <br/>I try to post several articles a week, but life being what it is, sometimes I make it, sometimes not. If you like what you see, it might be worthwhile subscribing to the <a href="/atom.xml?redirect=false&start-index=1&max-results=500">feed</a> in order to stay updated.';

function welcome_twitter(){
  var search_again=document.getElementById("welcome_message");
  search_again.innerHTML='<h2>Welcome Tweeter!</h2><br/>I hope you enjoy this site. My Outsourced Brain features articles about topics ranging from technology and software to scientific research. Recent articles have been more focused on <a href="/search/label/blogger">blogging</a> help, including several useful <a href="/search/label/widget">widgets</a>, which I wrote myself. You can also find many articles on <a href="/search/label/linux">linux</a>, phd research, and <a href="/search/label/software">software</a>. You can also find topics of general interest such as lifestyle, and <a href="/search/label/nutrition">nutrition</a>. I write occasional <a href="/search/label/book review">book review</a>s.<br/>A good place for exploration are most visited articles, labels, the search, or the article archive. <br/>I try to post several articles a week, but life being what it is, sometimes I make it, sometimes not. If you like what you see, it might be worthwhile subscribing to the <a href="/atom.xml?redirect=false&start-index=1&max-results=500">feed</a> in order to stay updated.';

var refer=getReferrer()
if(refer){  // refer > 0 query true, means the visitor was referred from another web site
  switch (refer)
{ // refer is a number that indicates the referral web site
    case 1: // search engine
          var query=getQuery();
          if (query){
          var script = document.createElement('script');
          script.src = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q='+query+'+site%3Awww.myoutsourcedbrain.com&callback=yousearchedfor';
          script.type = 'text/javascript';
    case 2: welcome_entrecard();
    case 3:
    default: // standard welcome message

Download here.

Enjoy. Please leave a comment below for questions and suggestions.
[ Read more... ]

Best Blog Tools

I compiled a list of useful internet resources for blogging. Categories for blog tools include page design and cross-browser testing, testing page loading performance, seo tools, social media tools, and post editing. If you think any page should be added, please comment.

Page Design

Combining Color Palettes and Fonts

  • Typetester provides a comparison tool for different fonts.
  • Color Scheme Designer provides a tool for creating color schemes.
  • A bit more simple is Color Blender, which generates 5 matching colors from one color you provide.

Cross-Browser Testing

browsershots.org is a free on-line service that lets you see your websites rendered in different browsers such as Firefox, Opera, IE, Safari, Dillo, Epiphany, Flock, Galeon, Konqueror, Seamonkey, and many more. You can adjust monitor resolution, color depth, javascript, Java and Flash support.

IE Netrenderer allows you to check how a website is rendered by Internet Explorer 7, 6 and 5.5 for free.

Page Loading Performance

Page Loading Analysis

Nothing beats firefox with Firebug and YSlow.

To clear the cache there is the clear cache button.

Web Page Test is one of the best on-line page loading analysis services.

Sprite Generators

CSS Sprite Generator

Image Optimization

Smushit reduces image sizes by optimization

CSS Minification

CSS Compressor

Javascript Compression

Compressor Rater

Content Delivery Networks

Google App Engine

Post Editing

greasemonkey and platypus for customization of web pages (blogger edit boxes)

Multimedia Embedding

  • Many different types of multimedia can be included with apture
    Apture helps during and after page editing. There are plugins for firefox and other browsers.
  • google viewer allows embedding of Powerpoint (ppt), MS Word (.doc) and open document formats (.odf, .odp)
  • Embedit.in
  • provides embedding of documents (doc, docx, xls, xlsx, ppt, pptx, pdf, wpd, odt, ods, odp, txt, rtf, csv, html), images (png, jpg, gif, tiff, bmp, eps, ai)
  • Wufoo Form Builder allows to build forms for on-line surveys

Source Code Embedding

SEO Tools

  • alexa sparky firefox add-on (improve alexa rankings)
  • swoosty seo tools provides alexa ranking and page rank of the pages you view
  • Google Webmasters allows you to control how google spiders your site.
  • Google Analytics provides a broad spectrum of statistics about visitors, and content.
  • deeper cloud helps you to find relevant tags to write more keyword-relevant articles (see also google lab suggest term)
  • Google Sets creates sets of items from a few examples, which can also help you find more relevant keywords.

Social Media Tools

Major social networking websites include digg, technorati, Facebook, Twitter, del.icio.us, stumbleUpon, slashdot, and reddit

Entrecard does social marketing.

For a list of advertisers, please see the footer of this page.

Enjoy. Please leave a comment below for questions and suggestions.
[ Read more... ]

Blogger Archive Pages with only Post Titles

Blogger category (label) pages can be very annoying to visitors if they have to wait very long while page with many articles loads. One remedy is to add &max-results=5 to your category links, however then many articles probably won't be read, because you can't realistically expect visitors to thumb through many pages. Probably this solution is also bad for search engine optimization (SEO), because it increases the distance between blog pages. In this post I present another solution which only displays the titles of the posts.

Here's a simple hack to change the show only titles In blog archive pages. Credits go to Divya Sai from bloggerstop.net.

From the blogger dashboard go to Layout -> Edit HTML. Make a backup, then check the expand widget templates box.

Search for this line:
<b:include data='post' name='post'/>

Replace that line with this coding.
<b:if cond='data:blog.homepageUrl != data:blog.url'>
<b:if cond='data:blog.pageType != &quot;item&quot;'>
<a expr:href='data:post.url'>
<b:include data='post' name='post'/>
<b:include data='post' name='post'/>

Enjoy. Please vote this post up if you like it and leave a comment below for questions and suggestions.
[ Read more... ]

Blogger: Most Popular Posts Widget (Google Analytics)

google analyticsThere are several widgets for wordpress to show most popular posts, however, as far as I know, there is no good widget yet for blogger. In my last article, I explained how to set up a blogger widget that shows most popular posts based on feedburner statistics. In this post I explain how to create a widget for your blogger blog that shows most viewed posts based on google analytics statistics. The set up is very similar to the previous widget. A prerequisite is rudimentary knowledge of python. Again the warning: the installation is a little bit more intricate than other widgets on this site. I think anyone, with some patience should be able to do it, however if your computer skills are very limited, don't try it.

Image credit: wikimedia commons.

I found actually widgets for blogger that show most popular pages. One is from feedjit shows most visited articles during a day. There are several implementations of popular post widgets that show popular posts by number of comments, such as this one, which works with google pipes. Now, in my opinion, one day of traffic doesn't really give too much statistics to give useful information about which of your pages are most popular. As for the other widget, I don't want popular posts by comments, I want just the most visited ones. There is postrank, which shows popular posts measures of post submission to social bookmark sites such as slashdot or digg, however it would be nice to have a widget that shows most visited pages.

The widget I present here uses google analytics statistics to list most viewed posts. You'll need a google analytics account and the tracking code active on your site for it to work.

Installation of this widget is similar to the previous popular post widget with feedburner.

You can host the code on any site, however in this walkthrough I assume you use google app engine. If you don't have one already, you need to create a free account on google app engine. Hosting your files and web applications on google app engine brings you the advantages of a low latency content delivery network (CDN) which can make your site load faster and for this implementation of the most popular posts widget you need an account. You'll have to choose a domain such as yoursubdomain.appspot.com.

If you don't have it already install python. Download the app engine python SDK for python.

Download the source code of the widget. You need subversion for this. The command for checkout is this:
svn checkout http://popular-posts-for-blogger.googlecode.com/svn/trunk/ popular-posts-for-blogger-read-only

Go to the popular-posts-for-blogger/popular-posts-for-blogger subdirectory and edit the getfeedstats.py file (use an editor or IDE that knows python, such as eclipse, vim, or kate). Search and replace myoutsourcedbrain for your feedburner uri.

Upload your code with the google app engine SDK. Still in the same directory type:
appcfg update .

If you did everything correctly you should now be able to see the javascript at http://yoursubdomain.appspot.com/reports/analytics.

In your website or blog, where you want the widget to show, paste this code:
<h2>Most Viewed</h2>
<ul><script src='http://yoursubdomain.appspot.com/reports/analytics' type='text/javascript'/><noscript>most popular articles by feed views</noscript></ul>

Enjoy. Please leave a comment below for questions and suggestions. If you have ideas for any improvements please tell me.
[ Read more... ]