jquery – maphighlight – highlight already highlighted area

Monday, 25. July 2011

oke.. thisone is a very special usecase – but who knows – maybe it helps somebody who’s trying to accomplish the same shit 🙂

i am using jquery map highlight and jquery metadata to highlight html areas on a country map ..

first of all: every country in “countryresult list” gets permanently highlighted in a special color.  (the js code is mixed with djangos template language – it will work without it if you change the relevant parts) then a “hover” event is set to each highlighted area that will highligt it again on hover in a slightly different way.

thats all !

$(document).ready(function() {

   {% for c in countryresult_list %}
      $('area[title="{{c.ccode}}"]').addClass('{strokeWidth:1,strokeColor:"ffffff", fillColor:"{{c.map_color}}",fillOpacity:0.5,alwaysOn:true}');

     $('area[title="{{c.ccode}}"]').hover(
         function(){
         var d = $(this).data('maphilight') || {};
         d.fillOpacity=0.7;
         $(this).data('maphilight', d).trigger('alwaysOn.maphilight');
    },
   function () {
       var d = $(this).data('maphilight') || {};
       d.fillOpacity=0.5;
       $(this).data('maphilight', d).trigger('alwaysOn.maphilight');
   }
   );

  {% endfor %}

});

(KDE) Kate syntax highlighting sucks !!

Sunday, 24. July 2011

obviously there is no other way to speed up kate than avoiding looooong lines (gt than ~1000 characters)

kate sucks hard when it comes to long lines and there is nothing the developers can do about it, because it’s an issue of QT – so nokia (or digia ) will have to fix that…

so rather than writing one single line (opening a jquery minimized library will kill kate if you are lucky) you should write something like that:

countrylist =[
[“AS”,”AF”,”AFG”,”4″,”Afghanistan, Islamic Republic of”],
[“EU”,”AL”,”ALB”,”8″,”Albania, Republic of”],
[“AN”,”AQ”,”ATA”,”10″,”Antarctica (the territory South of 60 deg S)”],
[“AF”,”DZ”,”DZA”,”12″,”Algeria, People’s Democratic Republic of”],
[“OC”,”AS”,”ASM”,”16″,”American Samoa”],
[“EU”,”AD”,”AND”,”20″,”Andorra, Principality of”],
[“AF”,”AO”,”AGO”,”24″,”Angola, Republic of”]
]

 

let’s hope for a quick fix (there is no such problem in older kde 3 versions of kate)

Country List, Country Codes by Continent

Sunday, 24. July 2011

Ich habe für meine Applikation eine ordentliche Liste (list of lists) in python erstellt, die ich hier anderen zugänglich machen will. Als Quelle dafür diente mir Wikipedia.

 

The columns appear in this order…

  1. Continent Code
  2. Two-letter Country Code (ISO 3166-1 alpha-2)
  3. Three-letter Country Code (ISO 3166-1 alpha-3)
  4. Three-digit Country Number (ISO 3166-1 numeric)
  5. English Country Name

 

Ein kleiner Auszug:

countrylist = [ [“AS”,”AF”,”AFG”,”4″,”Afghanistan, Islamic Republic of”], [“EU”,”AL”,”ALB”,”8″,”Albania, Republic of”] [……]

 

Hier die Datei:

countrylist.py