Saturday, January 28, 2006

Awful days

Some days you feel it would had been better to not quit the bed.
And some days you just can't quit your bed.

Yesterday I passed all the day with a strong pain in the back, and I couldn't even go to work. I passed the morning just checking that all the doctors near me where full, and the rest of the day trying to do something useful with my laptop... until yesterday evening, when the screen of the laptop decided enough was enough, and stopped working since then.

Today I'm feeling somewhat better, but it still hurts. I'm using the Mac now. I passed the latest hours installing emacs, getting a decent developer environment and doing some work on the javascript engine.

It turns out I was not just lacking concat and reverse on Arrays. It seems that I can't even read my own TODO items. I just had toString, join, pop and push, and thus I was lacking concat, reverse, shift, slice, sort, splice and unshift.

I have implemented now all of them, and they have all of them worked at the first try, except for splice (I got wrong some indexes on some for loops on splice). O'Caml is truly an outstanding language.

On the Panoramio front, yesterday I coded a first cut at a home page somewhat usable for people without Javascript activated. I still have a lot of work to do on this front.

Wednesday, January 25, 2006

Filtering photos

I have pushed a new feature in Panoramio.

Now you can say us if your photo is "about" the place you took it, or if the place is somewhat irrelevant.

For instance, if the picture is about a party, or about you in a closed room, then it's probably not about the place, but about you / your friends. If you mark these photos as not being "about the place" when you post them, then other Panoramio users can choose to see them or not.

That's to help those users that were looking for landscapes / buildings / etc. and want to filter out other kind of pictures.

We have not yet layed down a full set of objective rules, and we have been putting photos in the "not about the place" category using my instinct. But definitively we have to follow some rules. If you think that some of your photos were "about the place" and we marked it as not about the place wrongly just let me know. Btw, we are taking ideas about what kind of images would you like to see filtered out in Panoramio.

For those that only want to see "about the place" photos, click on the link "See only photos of places" in the main page.

Update: Since many users didn't uncheck the option when they were not photos about places, we decided to supress this filter. We will develop another solution for filtering photos in the future.

On other news, we also added a kml feed on each user's page, so now you can brag showing only your photos on Google Earth to your friends :)

I finally added a javascript layer around the server side "mark as favourite", and I even managed to get some minutes to implement some missing functions in Array on my ecmascript engine (reverse is still buggy).

And for those greasemonkey's users out there, Johan Sundström has written a script that will add a link to Panoramio in Google Local, so you can quickly see photos of the region of the world you're seeing in Google Local.

Friday, January 20, 2006

Photo acceptance policy

Until now we have been very laxists with the moderation of photos in Panoramio, only deleting sexual explicit photos. However many users have complained about the photos that have no relationship whatsoever with the place they were taken (close ups of people, for example).

We understand some people want to share their photos with their friends using Panoramio, and we have absolutely no problem with this. It's even one of our goals. But there are pictures that definitively cross the line. Hint: posting your head on a white background is not ok, posting you having great time with friends in a beach is ok.

We are implementing the concept of "private" photos, ie. photos that don't show up in the main page. But until then, we have to ask you to be reasonable with the pictures you post, or they will be deleted (we will keep you a copy for a while, so if you had no copies of a deleted photo you can ask us for it.)

Another kind of problematic photos are logos, copyrighted photos, or mini images copied from some web page. Those are also not allowed because of legal issues. We are proud to host your photos, but it doesn't mean we can host any image you send us.

So far, the vast majority of photos we have received are stunning photos of places. Please keep it that way. Keep rocking!

Tuesday, January 17, 2006

Latest developments

Being featured in Google Earth gave me the energy to code some long overdue changes to Panoramio.

First, I put a common header in the user and photo pages, so that users can jump directly to their pictures, to the home page, and sign out / sign in easily. I remember Johan said sharing the header will improve the feeling of "being part of Panoramio" (the words are mine). I still have to find someway to integrate this header in the home page... I hope you like it, because I tried several ideas and I passed several hours in The Gimp to do it.

Now you also have RSS feeds in the user's page, so you can follow the photos of your favourite users from bloglines or your favourite aggregator. And speaking about favourite users, you can now add users to your favourites clicking on their star or add them using the input box in the right column if you are logged (Actually, I put the RSS feeds and favourite's users a while ago, but I have not blogged about it).

I also improved a bit the algorithm to choose the photos to display in Google Earth, and raised the number of photos downloaded when you stop over an area.

And something Eduardo was begging for a while, a way for people to spread the word about Panoramio. Now (only when logged) you will have in your right column a "show these photos to a friend" link. That will let you spa^H^H^H tell your friends how great is Panoramio.

On the bad news, you can see that when you use sign in / sign out / stars it works reloading the page, so the results are not as smooth as they can be. At first I had a full javascript solution working, but there were too many bugs. There are just too many things to coordinate to keep these 3 things fully in javascript, so by now I will let the server-side fallback do its job. Later I will javascriptize the stars (I don't think sign in / out are really worth the effort).

Well, I hope you like these things, because they sucked away my week-end and latest evenings (again!)

This evening I decided to code a bit on the javascript engine. I have fully finished variable instantiation now. It was not yet done, that why I was using that weird "var a = function fact(x) { ... }" instead of just "function fact(x) { ... }".

Now the TODO is starting to look reasonable...

  • Unicode support

  • Track correctly line numbers for errors

  • Human readable error messages

  • Fix string to number conversions

  • Handle efficiently big sparse arrays (firefox also has this bug)

  • toLocaleString is not just toString...

  • Build a pretty-printer and use it instead of the compressor for js_function_to_string

  • Fix arithmetic that uses uint32

  • Implement real objects for standard Errors (right now I'm throwing string objects)

  • Joined objects

  • Implement Array.prototype.concat and Array.prototype.reverse

  • Implement all the native objects, right now I only have Object, Function and Array (and their prototypes, constructors, instances, etc.). This TODO item is big.

  • Label sets support

  • New expressions (this is the last expression not yet implemented, probably just a few minutes to make it work)

  • Run the SpiderMonkey regression tests, cry and fix bugs

Well... it looked reasonable in my head.

New expressions are now fully implemented:

function test_constructor(a) { this.hello = a; }

var o = new test_constructor("world");

var st = "";

for (var i in o)

    st += i + " " + o[i];



"hello world"

Btw, do you know of any plugin to colorize javascript code in WordPress?

Tuesday, January 10, 2006

We have been Googled!

The Google Earth pals just linked to us in their list of feeds.

The server is slowly heating. I hope it will support the load, but anyway, that's the problem any webmaster wants to have :-)

Update: Further proof that our server is heating...

Trafic of 10 January

Saturday, January 7, 2006


I implemented functions, at last!

So now I can execute:

var a = function fact(i) {
if (i == 1)
return 1;
return fact(i - 1);

if (a(3) == 6)

And it actually says "pass"! When I showed it to my wife, she looked at me as "did it really took you so long to do just that?". Pfff, Girls.

The big thing is still missing is all the native javascript objects. I have just done the objects Object, Function and half of Array (and their respective instances).

I'm still lacking objects literals (it should take 1 or 2 minutes), and a list of little TODO items that is getting longer and longer as time passes.

Little incompatibilities between browsers

On the series of incompatibilites between browsers, I have two new items to show.

First, don't use location.hash = "#foo" to jump to "foo" link, because Safari will jump to %23foo. Safari's behaviour seems very logic, but I don't really know who is right, Safari or the IE / Firefox crowd.

Second, don't use
<a h ref="javascript:void(foo())" >foo</a>

You should really do
<a h ref="something.html" onclick="foo(); return false">foo</a>

For the purist out there, yeah, that's not exactly equivalent, onclick="try { foo() } finally { return false } gets you closer, but the value of this will still be different in the two foo's.
Putting javascript:void(foo()) in the href turns out to produce buggy results, because once a user clicks in a link, and Internet Explorer engine passes onclick's or any other guard and reaches href, then it enters in a different state, that only quits when the new page loads (a href to an anchor is of course an exception).

In this new state, animated gif images stop their animation and Bad Things Happen™. Among others, expect your javascript code to fail in subtle ways. Explorer is not expecting to execute javascript code after you click on a link. It's already hard enough to make it behave correctly on its natural state, so trying to do something useful after a successful click on a link is roulette.

P.S.: WordPress 2.0 is nice and all, but it's html editor is a pain. I had to put the above html code in a pre tag, using entities, and breaking h ref (like here) because otherwise it changes it!

Wednesday, January 4, 2006

A plan for blog's spam

(Please, excuse my lame rip-off of Paul Graham's title)

I shall say it up-front. I don't like captchas.

For those in the dark, captchas are images of words, usually distorted. Sites that accept public comments ask their users to write the word in the captcha. If the user is able to read the word, then the system concludes the user is a human being. If it fails, it concludes that it was a bot (a computer program). The reason is that is very easy for a user to read a word, even if deformed, and it's extremelly hard for a computer to visually "read" a word.

Given than bots usually post spam, and human beings usually post legit comments, the "captcha" test is a simple way to differenciate between spam and human's comments.

They have however several problems:

  1. Human's with disabilities (for instance, blind people) are not able to pass the test.

  2. New programs have been developed that are able to read the captcha, and thus pass the test.

Newest captchas, harder to read, have been developed to make programs fail. They are, however, so hard to read, than even humans fail regularly the test. For instance, I needed to try three times before I could pass the test in the captcha I had on this blog. That's embarrasingly the same success rate of latest programs (33%).

I thus started looking for another solution. In the same "make it hard for computers, easy for humans" spirit, I come to the conclusion that the easiest way to solve the problem was to just ask some stupid (for a human) question to the user.

My question to let you publish on my blog is: What's the color of white pages?

And my question to let you register an user on my blog is: What's the name of your planet?

The replies to these questions are, of course, "white" and "earth". See, I'm not even afraid of putting here the replies. A computer has to understand english to extract the replies.

If this method ever becomes popular, spammers will surely attack it. It seems to be safe of automatic attacks except for spammers building a database of questions - replies, or using a load of possible replies (for instance, all the english words in the dictionnary).

My suggestion to prevent the first kind of attack is to use your imagination for new questions. Make them relative to recent actuality, for instance, so that previous collected questions - answers become useless.

As for the second attack, you can artifially wait several seconds before giving your answer, so that people trying a lot of different answers will need a lot of time to check the reply of all them.

This method is obviously not useful for high profile sites, as Yahoo! Mail, as you only need a couple of seconds of human's brain to fully crack it. But I hope it to be useful for random blogs, because spammers don't want to crack a random blog, they want to crack a million random blogs. I hope that the expectative of having to reply a million different questions will change their mind. Or most probably, make them spam other, unprotected blogs.

I have removed moderation on the comments on this blog. Let's see how this thing works...