Are you a hacker or code monkey?

You have a chance to prove yourself in an amazing javascript based game: http://alexnisnevich.github.io/untrusted/. Your become Doctor Eval, who needs to find The Algorithm. Would you dare?

(do not look below until you completed the game yourself)
My solution to The Boss is here: https://gist.github.com/anonymous/73304632ce742351000d.

Share

Mapping sales in UK using google geochart

My Jewellery shop generates slow but steady flow of orders, which lets me play with data. Today I’ve try mapping the shipping addresses to a map.

I’ve decided to try Google’s geochart from charts API. There’s simply no way they could make it any easier. They have even created a playground where you can test the api from the browser.

There are some issues with this chart though – the map looks bland, it can’t be zoomed and there’s not real map overlay. Also it take ages to draw unless the markers are given in lat/lon format.

Here’s the result:
orders in uk map

Share

Missing markers when two Google maps divs are placed on same page

Google is making constant changes to their APIs and they seem to roll the alpha/beta versions for us to test. Which should be fine unless you expect your webpage to be stable and working all the time.

One of the issues in current version of Google APIs is problem of missing markers when you try to place two or more Google maps objects on a page. All maps are displayed in their div tags as expected, but only one of them gets the markers actually displayed. No error message is displayed, individual maps work with markers when they are separated, but together they don’t.

The only solution I have found so far is to tell Google that we want to use Stable Google Map API instead of latest. Do to it add v=3.0 version selector to URL of JavaScript librery, i.e. instead of

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true">
</script>

use

<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.0&sensor=true">
</script>

So far I haven’t noticed any drawbacks of this solution. New unstable versions probably add new features and/or improve performance, but I’m willing to wait until the changes are tested and moved to stable API. I bet you do also.

Share

Chrome can speak now!

Yesterday new version of “Translate and Speak!” (previously TranslateMe) Chrome Extension has been released and it’s now ready to download on Chrome Webstore.

New features in version 1.4 include:

  • “Speak!” function, which uses amazing Google’s TTS to read text
  • Translate (detect language) function, which tries to guess language of the phrase before translating it to your selected language
Share

Limitation of Chrome Extensions API

The Chrome Extension model is amazingly easy to use with just few basic concepts to understand. But there are rather severe limitations. The most important I found so far:

  • There is no easy and consistent way to create option page. Developer needs to create option page as any normal HTML page, this is just overkill! See Extension options page, Chrome issue cr25317.
  • Attaching action to context menu is limited in many ways:
    • You can’t add two items to context menu. Chrome automatically creates a group called after the extension and puts all your items into this submenu.
    • Callback method from event gets very limited amount of data about the click – e.g. you can’t easily read the contents of a link (A) tag right-clicked by user.
  • There is no way you can modify the title of the link in context menu when it’s being displayed (no OnShow or similar event).

Expect edits here.

Share

TranslateMe – my first Chrome extension

I spend long hours reading on-line (don’t we all?). Most of interesting material is available in English only (including en.wikipedia.org which is much superior to my native pl.wikipedia.org), so I tend to read all in that language. And as it is my second tongue, I need to use translator quite often. Google translator is doing pretty good job with helping me, but the manual process (copy->new tab->type address->paste) was just too slow to be comfortable. This is where the idea for extension for Chrome came from.

Basic needs for the plugin were defined as:

  • No need to open translate.google.com everytime I need a translation
  • No need to copy/paste to translate
  • Quick
  • No more than 3 hours to develop (including the ramp up – this was my first attempt to create a Chrome Extension)

The result is quite encouraging – the extension is working and can be downloaded from Chrome Web Store. More information about the extension can be found here (click!)

Share