How to earn $50 on a bookmark

fun, ideas, story Comments Off on How to earn $50 on a bookmark

I gonna tell a story how I sold a browser bookmark for $50.

A client contacted me, he wanted a Firefox add-on that would do a simple, but important thing — the client needed to see contact details on a website, and in order to do this he had to click multiple “Show contact details” buttons. These buttons loaded the contact details by an AJAX call.

So he needed a solution to click these multiple buttons on the same page.

Plus the second requirement was to make this feature password protected. Once the password was entered, it’s “cached” for a long time. The client needed that so other people couldn’t reuse his code, and he knew that those users are not tech guys.

So, the budget was $50.

I told him that I can make a solution that would work not only in Firefox, but in any browser. He agreed.

So I created a bookmark and edited the URL.

Maybe you know, you can replace a usual HTTP-link by a javascript code.

So instead of “http://server.com/my/link” you can type “javascript:alert('this is a message');“. Like this:

$50 bookmark

So clicking this browser bookmark shows a JavaScript alert.

That’s what I used. The password was asked by a prompt() function and saved to a cookie. Then every button with a given title was pushed, as a queue.

Client is happy. $50 for a bookmark.

Major problems with geo in MySQL

boo, geo, mysql, postgres Comments Off on Major problems with geo in MySQL

Many development projects are started with MySQL on board — it’s free, stable and scalable.

At some point your project might need Geo features (a.k.a. “spatial calculations“): a great example would be to count a distance from where your user is to closest airport, Eiffel tower or hotel.

If you’re at this point, you are in a gray zone. Think twice if you want to stay with MySQL. You can save lots of hours and rude words if you make a right decision now.

Reason is simple: Geo calculations in MySQL are not implemented the way they should. OK, ok, count a distance between 2 points is an easy task and can be solved by a single function, but anything more complex just don’t work. For example, distinguishing if a point is inside a boundary, or calculation of two boundaries overlapping square.

That’s what MySQL website says:

MySQL originally implemented these functions such that they used object bounding rectangles and returned the same result as the corresponding MBR-based functions.

What does it mean? Look at this picture of an area in Egypt called Al Jizah.

Al Jizah

The shape is quite complex, but MySQL cannot process it, so instead of this a Minimal Bounding Rectangle is used — which is exactly the rectangle shape of the picture itself. I cannot find exact words to express how error-prone that is.

You can try to reinvent a wheel and write your own functions (like I did…), but they are very slow — iterating through 4 Kb of points of a polygon takes 1-2 seconds, so if you have hundreds of polygons to compare — say bye-bye to the product performance.

This is fixed only in versions after 5.6.1.

What to do? Use Postgres + special spatial extension called PostGis. It’s super-fast, works in multiple dimensions and does it RIGHT.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in