4 Jun 2015, 12:02pm
uncategorized

leave a comment




  • Anzeige
  • Excellent photos free to be reused

    Look­ing for great pho­tos for your next project or pre­sen­ta­tion? And you enjoy to be on the legal side of life? Check out this great web­sites with free stock photography!

    Excel­lent qual­ity: Pex­els, Life of Pix, Stocksnap.io, Unsplash,
    Grati­sog­ra­phy (by Ryan McGuire).

    Good qual­ity: Cup­cake.

    Good, but…
    A bit com­pli­cated to browse: Neg­a­tive Space, Great shots food, but the licens­ing is not exactly clear: Food­ies Feed.

    And it’s all free to use via the Cre­ative Com­mons Zero license (aka CC0). Even for com­mer­cial projects… and if you need even with­out attri­bu­tion. Great stuff — tru­ely free. :)

    Sources: Slideshare blog and others.

    16 Apr 2015, 8:15pm
    linux:

    leave a comment




  • Anzeige
  • Recover deleted photos

    Shit hap­pens… but for Linux users, there is a power tool straight from the US Air Force called “fore­most” to help you recover (aka undelete) your pho­tos eas­ily!
    Note: you’ll need sudo rights to install this soft­ware tool.

    But most impor­tantly: do not write any new data to your device (SD card, flash drive or what­ever)! Oth­er­wise, you’ll over­write what is still there and lose your pho­tos forever.

    The steps:
    Remove or unplug the media/drive/card from your comupter.
    Open a ter­mi­nal window.

    Install the recov­ery software.

    sudo apt-get install foremost

    Cre­ate a folder to put the recov­ered pho­tos in. Impor­tant: don’t put this for­ler on the drive where you want to recover pho­tos from! See above…

    mkdir recovered-photos && cd recovered-photos

    Find the device: copy the fol­low­ing com­mand to your ter­mi­nal and press the [Tab] key twice

    foremost -v -t jpg /dev/sd

    It will say some­thing like this

    sda   sda1  sda2  sda3  sda4  sda5  sda6  sdb

    Now, plug in your drive/card/medium and press [Tab] again, twice.
    It should change to some­thing like this

    sda   sda1  sda2  sda3  sda4  sda5  sda6  sdb  sdc  sdc1

    In my case sdc and scd1 showed up. Thus, sdc1 is the par­ti­tion on the device to recover from. Thus, I my case the full com­mand would be (You need to replace sdc1 with what­ever showed up pre­vi­ously on your own terminal!)

    foremost -v -t jpg /dev/sdc1

    … press return and see the magic hap­pen! Your pho­tos will show up in a sub­folder of recovered-photos. :)

    25 Sep 2014, 7:10pm
    linux:

    leave a comment




  • Anzeige
  • Setting up a linux server to forward all incoming mails

    Typ­i­cal thing when hav­ing a new site up: you want to get whatever@yourdomain.com to end up in you nor­mal inbox, say Gmail.

    Here are the steps!
    Note: If you are logged in as root, you do not need to use “sudo” in front of each command.

    Prepa­ra­tions

    It’s rec­om­mended to have a user account to receive the mail other than root.
    So either choose a user you have cre­ated already or cre­ate a new one:

    sudo adduser [username]

    Does your provider require you to use an SMTP relay? (check the doc­u­men­ta­tion, or ask). You need to know this to continue.

    Install post­fix

    Post­fix is a soft­ware pack­age, a MTA, it han­dles incom­ing mail and forwarding.

    sudo apt-get install postfix

    And answer all con­fig­u­ra­tion ques­tions as below:
    Server con­fig­u­ra­tion type: If you use an SMTP relay, choose “Inter­net with smarthost”, oth­er­wise “Inter­net“
    Sys­tem mail name: [yourdomain.com] (no sub­do­main)
    SMTP relay host: [smtp.yourprivider.com] (only show­ing if you chose “Inter­net with smarthost”)
    Root and post­mas­ter mail recip­i­ent: The created/chosen before (not root)
    Other des­ti­na­tions to accept mail for: keep the sug­gested defaults and add in front [yourdomain.com] and a space
    Force syn­chro­nous updates on mail queue: no
    Local net­works: keep sug­gested
    Use proc­mail for local deliv­ery?: yes
    Mail­box size limit: 0
    Local address exten­sion char­ac­ter: +
    Inter­net pro­to­cols to use: all

    Man­ual configuration

    All edits with sudo if you not logged in as root.
    Edit /etc/postfix/main.cf add fol­low­ing two lines to the end

    virtual_alias_domains = [yourdomain.com]
    virtual_alias_maps = hash:/etc/postfix/virtual

    Create/edit /etc/postfix/virtual and add

    @[yourdomain.com]    [your.email.address@somewhere.com]

    Finally, after edit­ing this file call

    sudo postmap /etc/postfix/virtual

    so that postmap actu­ally applies your changes.

    Notes

    If you for­ward to Gmail, do not use the same address to send test mails that the mails will be for­warded to — Gmail will silently ignore/delete mail where the sender and recip­i­ent are the same and you will think the for­ward­ing does not work.

    19 Jul 2014, 9:21pm
    uncategorized

    leave a comment




  • Anzeige
  • Copying MongoDB from meteor.com

    I started deploy­ing my lat­est Meteor app umeedoo.net to my own VPS and wanted to use the data from my beta sys­tem hosted at umeedoo.meteor.com.
    First of all, I was sur­prised how sim­ple and easy it was to deploy using Meteor Up (MUP). Some weeks before, I spend an entire day on installing the Meteor envi­ron­ment on a Debian machine — now it’s less than 15 min­utes! One caveat though, it did not work for me on Debian, I had to drop my pre­vi­ous Debian VM and replaced it with Ubuntu as MUP depends on Upstart and it seems rather tricky to replace Debian’s SysVinit with Upstart. Ok, dif­fer­ent story, but a biiig thanks to Arun­oda for the great work on MUP!!

    So, how to db.copyDatabase(); the data from the orig­i­nal DB to yours?

    The method sig­na­ture is db.copyDatabase("[app-name]_meteor_com", "[your-db-name]", "[meteor-mongo-domain]", "[username]", "[password]");
    I’ll assume “app” to be the app name for sim­plic­ity.
    Gen­eral approach: get the Mon­goDB URL, extract all the para­me­ters above, log into your own Mon­goDB instal­la­tion and use db.CopyDatabase(); to move the data over.

    All com­mands need to be exe­cuted on the same machine. (FYI, the user­name and pass­word get auto­mat­i­cally gen­er­ated and it did not work to get the URL on my machine and use the user­name and pass­word on the server… strange though)
    Thus, install Meteor on your server curl https://install.meteor.com/ | sh.
    Then, get the Mon­goDB URL meteor mongo --url app.meteor.com
    It will look like this mongodb://client-fd532e7d:683a9a4e-1604-5729-07fd-df1ba7dcbbf9@production-db-a2.meteor.io:27017/app_meteor_com
    The parts are

    • user­name: client-fd532e7d
    • pass­word: 683a9a4e-1604-5729-07fd-df1ba7dcbbf9
    • meteor-mongo-domain: production-db-a2.meteor.io:27017

    Start a Mon­goDB CLI by typ­ing mongo.
    In my case, the data­base cre­ated by the app and MUP was called “admin” (i.e. [your-db-name]=“admin”). How to find yours? Use “show dbs” in the Mon­goDB CLI to see which one is yours.
    Then write “use [your-db-name]” to switch to your DB.
    And finally, using the data from above: db.copyDatabase("app_meteor_com", "admin", "production-db-a2.meteor.io:27017", "client-2fbeb6ef", "1bd44ece-b3fa-7d1b-0046-83b917927f35");
    will copy the data over in a few sec­onds.
    When I tried first, I got an error about a dupli­cate key (the deployed app had cre­ated some data already), drop­ping the entire DB fixed it. Also, the user­name and pass­word are valid for a short time only, so maybe hav­ing to ter­mi­nals open is a good idea.

    Ref­er­ences: Cloning Mon­goDB, Meteor dump, Clone DB from meteor.com, Copy DB from one server to another

    11 Feb 2014, 7:19pm
    uncategorized

    leave a comment




  • Anzeige
  • Match.Optional for null

    Secur­ing my Meteor app, I came across a strange quirk of Match.Optional of the “check” pack­age.
    Exam­ple (in CoffeeScript)

    Meteor.methods
      test: (x) -> check x, Match.Optional String
    

    I expected the match to be suc­cess­ful when call­ing the method like this:

    Meteor.call 'test', undefined

    But instead, I got a “Match failed” excep­tion. After debug­ging for a bit, it turned out that the undefined becomes a null when it arrives on the server.
    Which is odd, of course—but also annoy­ing as the check x, Match.Optional String fails for null (only undefined or String are accept­able).
    To over­come this, here is a new Match.Optional that does the trick:

    Match.OptionalOrNull = (pattern) -> Match.OneOf undefined, null, pattern

    Also, I keep won­der­ing: what’s the pur­pose of mak­ing Match.Optional fail on null in the first place?

    28 Jan 2014, 6:25pm
    hci:

    leave a comment




  • Anzeige
  • Mac flaws — hardware and software

    I started this list about four years ago when I first got in touch with OSX and the hype around it. The usual claim: it’s great usabil­ity. But it’s not that dif­fi­cult to spot seri­ous usabil­ity issues. There are not that many — so it’s worth mak­ing a list (as opposed to other sys­tems ;) ), but it should show clearly: OSX has a great user expe­ri­ence (aka UX), which is the actual and under­stand­able rea­son for the hype — but that must not be mixed up with usability.

    Miss­ing features

    In gen­eral, OSX can not be con­trolled with the key­board only, thus you are forced to switch between key­board and mouse/touchpad regularly.

    Using key­board to con­trol OS X

    • No delete key on the Apple lap­top key­board (only back­space and Fn+backspace to sim­u­late the delete key)
    • No key to show the con­text menu on a cur­rently selected item; but some func­tion­al­i­ties are part of the con­text menu only. My new com­puter (Lenovo) does not have a con­text menu key either–following the exam­ple of Apple??
    • Alert boxes that are not part of a run­ning appli­ca­tion can not be focused using Cmd+Tab or Cmd+<>, thus, it’s not pos­si­ble to send them away with the key­board once they lost the focus.
    • When using finder in tree mode and insert­ing a copied file, it will always be put in the root folder instead of the folder the user has high­lighted; only the con­text menu’s entry “paste item” does that as expected but is not acces­si­ble via keyboard.
    • When delet­ing an item from a list using Cmd+Backspace the cur­sor gets reset to the top­most posi­tion in the list instead of mov­ing to the pre­vi­ous or next item, thus mak­ing it very frus­trat­ing to clean a large, dis­trib­uted set of items from a long list

    Thus, work­ing with key­board only (which is the most effi­cient way while cod­ing) is almost impos­si­ble. :(

    Point and Click Interface

    • No con­text menu (right click menu) in menus like “Down­loads” in the launcher bar, there­fore it is not pos­si­ble to open a docx file in OpenOf­fice instead of Microsoft Office)
    • Only since OSX Lion files can be dragged and dropped from the “spot light” quick start menu. Before, e.g. to use the spot light to search a doc­u­ment to be send via Skype it was nec­es­sary to click “Show all” first -> Finder win­dow pops up -> drag item from there + close win­dow afterwards.
    • When open­ing a folder in a finder win­dow, there is no but­ton to step up the folder hier­ar­chy since OSX Lion.
    • Mul­ti­ple selec­tions aren’t sup­ported in menus such as Down­loads. Imag­ine you down­loaded sev­eral files, now you want to move them to a par­tic­u­lar folder. So you either drag and drop each sep­a­rately or you open up an addi­tional finder win­dow, nav­i­gate to “Down­load” sort the results by date and then drag and drop the lat­est files.
    • When open­ing an image in the pre­view, it is not pos­si­ble to for­ward to the next image in the same folder. Instead, the user is required to select all images in the finder win­dow and then open them in the pre­view to be able to skim trough them. But mul­ti­ple selec­tion is not sup­ported every­where (see above).

    Hard­ware

    Despite that my Mac Book is called “Pro” it’s lack­ing basic pro features.

    • There is no dock­ing sta­tion available
    • There is no way to have a back-up bat­tery as the bat­tery is sol­dered in
    • I always need to carry the dis­play adapters because it does not have any stan­dard socket any more (the old ones had at least DVI), only dis­play port.
    • Just for the list: the power adapter is designed per­fectly, plus every adapter fits every Mac, thus for­get­ting your’s at home is not such a big thing! That’s great, no doubt about it.

    Usabil­ity Mistakes

    • Cmd+W closes a win­dow (e.g. a browser tab), Cmd+Q quits the entire appli­ca­tion… The keys for Q and W are just exactly next to each other on every key­board and there­fore it’s easy to hit Cmd+Q acci­den­tally. Saidly it’s the same for Linux and sim­i­lar for Microsoft Win­dows: Ctrl+F4 vs. Alt+F4.
    • The “cut-and-paste” par­a­digm is not sup­ported (FYI, in an Apple user forum I read a jus­ti­fi­ca­tion as fol­lows: “Imag­ine you cut a file, con­tinue work­ing and finally for­get you cut it. Then when you shut­down your com­puter… the file will be lost!” :D )
    • Mak­ing a win­dow fullscreen size can be very tedious because of two rea­sons: the “+” but­ton in the upper left does not max­i­mize the win­dow hor­i­zon­tally (it gets widen to a width OSX “con­sid­ers” rea­son­able) plus there is only a sin­gle resize grip on each win­dow in the lower right. Thus, it requires pre­cise mov­ing and scal­ing of the win­dow to get it fullscreen — instead of hav­ing just a but­ton to click — or dou­ble click­ing the title bar of the win­dow to max­i­mize it as usu­ally sup­ported in other OS.

    One ques­tion remains: With respect to finan­cial suc­cess, is UX more impor­tant than usabil­ity and util­ity?
    Accord­ing to this list and the suc­cess of Apple (though it seems the peak has been passed) the answer is yes.
    Also, this list is not meant to bad­mouth Apple in gen­eral, I still con­sider Apple’s “com­put­ing prod­ucts” (includ­ing Mac Books, iPhone, and iPad) to be some of the best hardware-software com­bi­na­tions avail­able today, though, I def­i­nitely pre­fer my Crunch­Bang for being super fast and slim, effi­cient, highly con­fig­urable, com­pletely con­trol­lable via the key­board, and open source! :)

    p.s. I stopped using OSX at ver­sion “Snow Leop­ard” at the end of 2012 so I might miss the lat­est features.

    26 Dec 2013, 12:25pm
    linux:

    leave a comment




  • Anzeige
  • Scale images for the web — quickly

    Start­ing Gimp just to scale down some pho­tos to send them by mail? Meh.
    How about mark them, right-click, “Send To” -> “Scale for web”?
    No prob­lemo:
    First, get a tool to scale images:

    sudo apt-get install imagemagick

    Now, cre­ate a script that takes a list of images as input, scales them down, and stores them with a pre­fixed file name. Go!

    #!/bin/bash
    pwd > ~/f0.txt
    echo "$@" > ~/f1.txt
    for file in $@
    do
    	convert "$file" -quality 50 -resize 1024x768 "${file%/*}/web-${file##*/}"
    done

    Make sure we chmod +x the script file we just cre­ated.
    Next, let’s inte­grate it into “Send To”. (This is an exam­ple for Thu­nar)
    Cre­ate a .desktop file in the sendto folder, e.g. /usr/share/Thunar/sendto/scale-for-web.desktop with fol­low­ing content:

    # Scale images for the web
    [Desktop Entry]
    Type=Application
    Version=1.0
    Encoding=UTF-8
    TryExec=scale-for-web
    Exec=scale-for-web %F
    Icon=
    Name=Scale for the web
    MimeType=image/jpeg;image/jpg;image/png
    

    Replace both scale-for-web with the name you gave to your script file. Is the script’s folder in $PATH? No idea? Then just put the entire path+filename.
    Now, open Thu­nar, select some images (Jpeg or Png), right-click, “Send To” -> “Scale for the web”, wait a few sec­onds and you’ll see web-....jpg files appear­ing in the same folder. :)

    Ref­er­ences: how to scale images with imageMag­ick, extract path seg­ments, more details on string manipulation

    14 Dec 2013, 11:03pm
    javascript:

    leave a comment




  • Anzeige
  • Hash in JS

    Gen­er­at­ing hashes from strings is a very handy thing to have. Sur­pris­ingly, in JavaScript, an arithmetic-operation-based algo­rithm is about *three times* faster than one using bit-wise oper­a­tors–see for your­self. I sug­gested to add the most per­for­mant method as hash method to underscore.string.js.

    So much about state­ments on stack­over­flow like

    The hash << 5 - hash is the same as hash * 31 + char but a LOT faster.

    (cf. here)

    In times of inter­preted lan­guages and vir­tual machines one should recon­sider before apply­ing the same old rules again.

    p.s. If you know about alter­na­tive algorithms/implementations, please add them to the test and leave a com­ment here, I’m curi­ous to see what else there is. Btw. I was very sur­prised that the neat reduce-based ver­sion failed so miserably.

    21 Nov 2013, 3:46pm
    meteor:

    leave a comment




  • Anzeige
  • Mongo fails when starting meteor

    If your are see­ing this one when start­ing meteor:
    Unexpected mongo exit code 100. Restarting.
    Can't start mongod
    MongoDB had an unspecified uncaught exception.

    Check if mon­goDB is run­ning already, oth­er­wise, if you can find a file called .meteor/local/db/mongod.lock means that mongo did not stop prop­erly last time. Just delet­ing this lock file should fix it. It’s a bit unfor­tu­nate that the error mes­sage doesn’t give any hint in this direction.

    29 Oct 2013, 4:19pm
    meteor:

    leave a comment




  • Anzeige
  • Serving Static Files with Meteor and Spiderable

    In short: To serve files which are not part of your project’s code (i.e. which are sup­posed to be served with­out being com­piled), put them in the public folder. This folder will be served from /.

    Some more back­ground and details:
    Tried to add a web-font to my project, thus, I put it in /client/webfonts/somefont.woff. But the font didn’t show up. I tested it with wget -O- http://localhost:3000/webfonts/somefont.woff … and *sur­prise* I got the HTML of the default page — not some binary gib­ber­ish that you would expect to find in a font file.

    All file types unknown to meteor get stripped out dur­ing com­pile time. Instead you need to put them in a sep­a­rate folder called public — in my case in /public/webfonts/somefont.woff. Rookie mis­take I guess. :)

    7 Oct 2013, 10:07am
    javascript:

    1 comment




  • Anzeige
  • Callback Method for Twitter’s Typeahead

    When you start using Twitter’s typea­head, e.g. because you switched from Boot­strap 2.3 to 3.0, you will notice that it is NOT a sim­ple drop-in replace­ment for Bootstrap’s orig­i­nal typea­head!
    Before, you gen­er­ated the sug­ges­tions shown to the user by imple­ment­ing a call­back method while cre­at­ing the typea­head like this:

    $(field).typeahead({
      source: function(query, process) { 
        ... return a list of suggestions (see doc for details) 
      }
    });

    Since ver­sion 3, Boot­strap does not pro­vide its own typea­head any more, instead it is using Twitter’s own imple­men­ta­tion which seems to be a good choice at least on the long run. But it does not pro­vide any mean for defin­ing a call­back method to pro­vide the sug­ges­tions — no clue why.
    Instead you can pro­vide a pre­de­fined array locally, a pre­de­fined array that will be loaded on start-up, or a remote ser­vice defined by a URL.
    You will find sev­eral good exam­ples of why you need a call­back method sometimes.

    • You want/have to use a Javascript library to access the service.
    • There is no data­base for the sug­ges­tions, they a gen­er­ated on the fly, e.g.if you want to sug­gest sen­tence com­ple­tion while the user types.
    • You are using Meteor’s col­lec­tions hold­ing your sug­ges­tions, thus, there is no URL you could point to.

    But tak­ing a look into the inter­nals revealed fol­low­ing solu­tion: com­pletely by-pass the inter­nal sug­ges­tion aggre­ga­tion of Twitter’s typea­head by replac­ing the getSuggestions(query, callback) method of the first dataset, which we defined by local: [];.

    (t = $("field")).typeahead({ local: [] });
    t.data("ttView").datasets[0].getSuggestions = function(query, callback) {
      var suggestions = ... gather your suggestions here ...
      var data = [];
      for (suggestion in suggestions) { data.push(this._transformDatum(suggestion)); }
      callback(data)
    }

    (Trans­lated from Cof­fee­script on-the-fly — con­sider as a draft than an out-of-the-box solution.)

    Happy hack­ing. :)

    p.s. for Meteor users: The call­back breaks each time the tem­plate gets re-rendered — despite that you use the pack­age preserve-inputs or <#constant> due to a bug. Some­how, con­stant areas and that par­tic­u­lar pack­age do not get along with each other. Solu­tion: removed the pack­age and use con­stant areas around typea­head input fields works. This should be fixed as soon as the new tem­plate engine gets rolled out.

    30 Nov 2012, 7:40pm
    recommendations:

    leave a comment




  • Anzeige
  • Dev Tools Collection

    Design Grid

    The famous 960 grid is a great basic for any kind of web design. Espe­cially the 12 col­umn grid is used often on eye-pleasing web­sites.
    Fea­tures: fully cus­tomiz­able and the CSS code will be gen­er­ated auto­mat­i­cally.
    Edi­tor: grids.heroku.com.
    More info about the grid itself: 960.gs.
    Alter­na­tively, use Bootstrap’s inte­grated lay­out grid: http://getbootstrap.com/css/#grid.

    Ani­mated Busy Indi­ca­tor Graphic

    Gen­er­ate busy indi­ca­tors aka ani­mated graph­ics to visu­al­ize when a sys­tem is load­ing data or is busy doing some­thing in gen­eral.
    Lots of dif­fer­ent ani­ma­tions are pro­vided to choose from, col­ors are com­pletely cus­tomiz­able, and the gen­er­ated graph­ics are free to use wher­ever you like!
    ajaxload.info

    Embed Graph­ics into CSS

    A tool to con­vert graphic files (e.g. a busy indi­ca­tor) into a Base64 that can be embed­ded into CSS as data. Though the size is slightly big­ger (which does not mat­ter a lot with such small files) but it saves another, poten­tially block­ing request to the server (as the amount of par­al­lel requests is lim­ited to two).
    You have to upload the file (Ref­er­ence by URL is not sup­ported unfor­tu­nately) to get the data for­mat in return.
    websemantics.co.uk/online_tools

    CSS Gra­di­ent Generator

    Gra­di­ents (used wisely) can help to cre­ate sub­tle 3D-effects with­out the need of extra pay­load in terms of DOM nodes or graphic files. Of cause you can also go wild and cre­ate crazy rain­bow gra­di­ents… This edi­tor gen­er­ates the CSS code for you with a very easy to use UI.
    colorzilla.com/gradient-editor/

    Live RegEx Tester

    Build­ing reg­u­lar expres­sions is always a bit tricky IMO. The tool below comes in handy because you can test your drafts instantly and there are explained exam­ples, too.
    gskinner.com/RegExr

    If you need some­thing sim­pler and smaller:
    regular-expressions.info

    Match­ing color combinations

    Most of the tools I saw online pro­duce the same sequences using well known pro­ce­dures (monocro­matic, com­ple­ment, triad, tetrad, ana­logic, and accented ana­logic). They are good and use­ful, but color blender does some­thing dif­fer­ent (I did not yet check out in detail what and how) so it’s a good way to find an alter­na­tive set of col­ors, also for com­par­i­son.
    colorblender.com/

    Nice tools using the before men­tioned “known pro­ce­dures”:
    colorschemedesigner.com/

    Beau­ti­ful color sets and pat­terns:
    colourlovers.com

    Fonts and Icons

    Adobe’s Edge Web Fonts.
    In my opin­ion the best icons font there is: Font Awe­some.

    JSON Val­ida­tor and formatter

    Quickly for­mat out­put of a web­ser­vice into some­thing much more human read­able and check valid­ity in the same time: http://jsonlint.com/

    (to be continued…)

    15 Nov 2012, 5:37pm
    gwt:

    1 comment




  • Anzeige
  • GWTBridge Not Found in GWT2.5

    Just updated the GWT SDK and ended up with a bro­ken app:

    java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:169)
    	at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
    	at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
    

    After some searching/experimenting and a cup of cof­fee it finally occurred to me: the pack­age name says client! So all the time I have been using a client-package class in my server-side code. Kinda sur­pris­ing that it did work nicely all the while.

    Solu­tion: replace all com.google.gwt.core.client.GWT with com.google.gwt.core.shared.GWT in shared and server-side code.

    20 Sep 2012, 1:32pm
    gwt java:

    13 comments




  • Anzeige
  • Using GWT’s DateTimeFormat in Server-Side Code

    I was work­ing on some util­ity class to for­mat dates. As the for­mat­ting is the same on server and client the same class should be used on both, server and client. Within the GWT frame­work there is the DateTimeFormat class which seems to be sup­posed to do exactly that.

    But despite being in the shared pack­age (com.google.gwt.i18n.shared.DateTimeFormat) using it in the server-side code causes

    java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code!  It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.

    Hav­ing a look into the code of the DateTimeFormat class (which is part of the shared pack­age of the GWT frame­work, thus can be used on server and client) reveals there is an import of com.google.gwt.i18n.client.LocaleInfo. But this class is part of the client pack­age — thus, it can not be used in the server-side code. It’s unclear to me why this was done like that because it sim­ply can not work by definition…

    Going down a bit fur­ther in the code of the DateTimeFormat class shows that the client pack­age class LocaleInfo is used only once like this:

    private static DateTimeFormatInfo getDefaultDateTimeFormatInfo() {
      // MUSTFIX(jat): implement
      return LocaleInfo.getCurrentLocale().getDateTimeFormatInfo();
    }

    The line is marked as “MUSTFIX” but for some rea­son it has not been fixed yet.
    There is a way to fix this issue that worked for me:

    • Copy the con­tent of DateTimeFormat to a new file in your own code
    • Remove the import of LocaleInfo
    • Chang­ing the fol­low­ing method (start­ing in line 656) like this:
    private static DateTimeFormatInfo getDefaultDateTimeFormatInfo() {
      return new DefaultDateTimeFormatInfo();
    }
    • And use this newly cre­ated class from now on in all your code.

    The fix does not seem to cause any major harm, but as John A. Tam­plin (cf. his com­ment below) clearly pointed out, apply­ing this fix will ren­der all dates using the default locale instead of using the user’s locale. Thus, this fix should be con­sid­ered a hack rather than a patch — but it does the trick until the bug has been fixed officially.

    The hack can be applied quickly — or sim­ply down­load the fixed class here.

    p.s. Unfor­tu­nately, it is not pos­si­ble to just over­write the method in a derived class because it’s a sta­tic method and pri­vate any­way.
    p.p.s. As sug­gested in the com­ments, you might also ini­tial­ize the DateTimeFormat with a new DefaultDateTimeFormatInfo() as the sec­ond para­menter. (Please note that I did not ver­ify this sug­ges­tion) In gen­eral, both ways of fix­ing this issue will cause that the date and time to be for­mated using the default locale rather than the user’s cur­rent locale, unfortunately.

    24 Aug 2012, 12:26am
    php:

    leave a comment




  • Anzeige
  • Papercite Crashes WordPress

    Just updated Word­Press as well as all the plu­g­ins and sud­denly my résumé page is blank. And just in case some­one else expe­ri­ences a sim­i­lar issue, I took notes of all the steps to fix the issue below.

    Turn­ing off likely plu­g­ins revealed that papercite (a plu­gin used to ren­der pub­li­ca­tions in the BIB for­mat as HTML) was the reason.

    To under­stand­ing the prob­lem I turned on error mes­sages to actu­ally see what was going on by
    edit­ing index.php in wp-content/themes/ / and added fol­low­ing line to the begin­ning of the file:

    <?php ini_set('display_errors',1); error_reporting(E_ALL); ?>

    From that I could under­stand that papercite was unable to load a PEAR mod­ule due to the strong restric­tions that my web space provider had set up (which is also why I can not edit the php.ini file directly to turn on error messages).

    Solu­tion: Go to Set­tings -> papercite plu­gin and change the parser to OSBiB parser (which does not depend on PEAR), et voilà my résumé with pub­li­ca­tions is back! :)

    Finally, let’s remove the PHP line I added in the begin­ning from the index.php file.

    2 Jun 2012, 7:32pm
    gwt:

    3 comments




  • Anzeige
  • How to Use JQuery in GWT

    After adding the JQuery script to your project HTML file’s header section

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

    You will be able to use JQuery in native (JSNI) meth­ods by prepend­ing $wnd., e.g.:

    private native void someMethod() /*-{
    	$wnd.$(function() {
    		$wnd.$('#somediv').doSomething();
    	});
    }-*/;

    With­out $wnd. you will end up with fol­low­ing error: com.google.gwt.core.client.JavaScriptException: (ReferenceError): $ is not defined

    15 May 2012, 12:08pm
    gwt java:

    3 comments




  • Anzeige
  • JUnit-Testing and GAE APIs

    Some issues I encoun­tered when test­ing a new Java library for load­ing mul­ti­ple URLs in par­al­lel on the Google Apps Engine (GAE) (more about that library in another post).

    Here are some of the typ­i­cal errors you might encounter:

    Miss­ing time­out class

    java.lang.NoSuchMethodError: org.mortbay.thread.Timeout

    Con­text menu on project: Prop­er­ties -> Build Path -> Order and Export: move GWT SDK *above* App Engine SDK (cf. here)

    Com­pi­la­tion unit was not seen

    com.google.gwt.junit.JUnitFatalLaunchException: The test class 'com.test.client.MyTest' was not found in module 'com.text.Module'; no compilation unit for that type was seen

    • The test class needs to be within a pack­age that is con­fig­ured in the mod­ule file (*.gwt.xml). You should cre­ate a new source folder (Con­text menu on project -> New -> Source Folder) and cre­ate the whole pack­age struc­ture you use within your project up to client, e.g. com.company.client, and put your GWT tests in it. This way you make sure that the tests are not going to be deployed to GAE later on.
    • If you are test­ing client-side code, your test class needs imple­ment GWTU­nit *and* be run as GWTU­nitTest *not* as JUnitTest ;)

    API pack­age not found

    java.util.concurrent.ExecutionException: com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' was not found.

    The GAE envi­ron­ment has not been initialized.

    • Set up the required libraries for testing:
      • Con­text menu on project -> Prop­er­ties -> Build Path -> Libraries -> Add Vari­able -> Con­fig­ure Vari­ables -> New…: Set “SDK_ROOT” as name and search you disk for “appengine-api-stubs.jar” and copy the part before “/lib/impl” into the text box named “Path”
      • Select “SDK_ROOT” from the pre­vi­ous dia­log, click “Extend…”, unfold lib and impl and select “…labs.jar”, “…stubs.jar”, and “…api.jar”; unfold “lib/testing” and select “…testing.jar” — done, whew.
    • Add fol­low­ing lines to your test class:
      private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig());
      @Before public void setUp() { helper.setUp(); }
      @After public void tearDown() { helper.tearDown(); }
    • Have a look in com.google.appengine.tools.development.testing to see all the services/APIs avail­able for test­ing and replace LocalURLFetchServiceTestConfig with the one you need.

    I tried to keep it as brief as pos­si­ble, for more details have a look at this page.

    14 May 2012, 8:27pm
    linux recommendations:

    4 comments




  • Anzeige
  • Missing Digikam Themes w/t KDE

    Digikam is a great tool to man­age and work on pho­tos — my per­sonal favorite for some years already. But it’s made for KDE and uses a lot of KDE-related libs and stuff, there­fore, installing it in Gnome, Xfce, Lxde and the like will cost about 1gb because of the depene­den­cies.
    Nev­er­the­less, worth it. But it comes with a bright default skin ren­der­ing it com­pletely unus­able for work­ing seri­ously on light and color set­tings of photos.

    To add themes, you will have to install an extra pack­age (as decribed here) like this:
    sudo apt-get install kde-workspace-data
    Yes, this will add more data to your disk, but only 10mb this time. ;)

    Happy photo-tweaking!

    26 Apr 2012, 11:04am
    gwt:

    leave a comment




  • Anzeige
  • Improving Canvas Performance

    1. Time­out instead of Scheduler

    Sur­pris­ingly, using com.google.gwt.user.client.Timer seems much faster then rely­ing on com.google.gwt.core.client.Scheduler. I did not yet eval­u­ate the dif­fer­ences in detail but the lower CPU work­load speaks for itself.

    2. Ani­ma­tion­Sched­uler

    I am not really sure if this helps a lot, but you will find a lot of online doc­u­men­ta­tion explain­ing that you should use this:
    com.google.gwt.animation.client.AnimationScheduler.get(). requestAnimationFrame(callback, element);. The ele­ment para­me­ter is optional but said to improve per­for­mance as the browser can decide when to ren­der opti­mally.
    So when­ever your timer kicks in, and you are ready to ren­der the results, use the Ani­ma­tion­Sched­uler instead of call­ing your ren­der­ing rou­tines right away. It will only take very few mil­lisec­onds (depend­ing on the users screen frame rate—which is 60 Hz or more usu­ally) for the call­back to return to your code.

    3. Caching

    This parts requires much more effort and depends on your soft­ware archi­tec­ture and require­ments. The basic idea is not to redraw things that did not change. To do so we can draw each item on a hid­den can­vas once and then reuse this ren­der­ing dur­ing every draw­ing cycle.
    As the process is a bit more com­pli­cated, I will ded­i­cate it a sep­a­rate post—comming soon!

    4. Save on effects

    Yes, effects is what the can­vas is all about, but some­thing like a shadow can cost quite some CPU power. So if you run into prob­lems check if some of the effects can be achieved cheaper or even be removed.

    26 Apr 2012, 9:58am
    gwt java:

    leave a comment




  • Anzeige
  • Multiple Projects and GWT

    When work­ing on sev­eral large scale projects (in Eclipse), it’s con­ve­nient and of course more effi­cient to share and reuse code via com­mon libraries. While those are in an early stage they need to be changed a lot and there­fore it’s handy to link projects in instead of cre­at­ing new jars each time the library has been updated.
    Unfor­tu­nately, this stan­dard approach for Java devel­op­ment in Eclipse does not work that straight for­ward as with plain old Java projects, it requires three steps in total:

    1. Link the library project to all rel­e­vant projects (“Project Pref­er­ences” -> “Java Build Path” -> “Projects” -> “Add…”)
    2. Then, add the client-side code of the library (by adding it as a mod­ule.) There­fore, edit the gwt.xml of your appli­ca­tion and add for exam­ple <inherits name="net.svenbuschbeck.gwt.lib.SuperLib "/> where Super­Lib is the file name of the gwt.xml file in you library project and before that is the pack­age it lies in.
    3. Add the code to the project by link­ing a source folder. Unfor­tu­nately, this is required if you do not want to write an Ant script to com­pile your appli­ca­tion. (If you pre­fer Ant check this out) I don’t like the idea of using such a script because if you for­get to run it each time you make changes, you will end up in confusion—let’s go for the con­ve­nient, auto­matic way then.
      1. Add a folder to your appli­ca­tion project; open the “advanced” sec­tion in the folder cre­ation dia­log, select “Link to alter­nate loca­tion” and pick the source folder (usu­ally “src”) of your library project. (Hint: if you work within a team using a ver­sion­ing sys­tem, you can cre­ate a vari­able for that folder and use this instead. This way, each of your col­leagues can put the library project in a dif­fer­ent folder and accom­mo­date for that by adjust­ing the vari­able :) )
      2. Right click the folder, “Build Path” -> “Use as Source Folder”. Done.

    Sur­pris­ingly, the GWT plu­gin for Eclipse does not honor the project link­ing, thus all the ref­er­ences need to be made explicit or you will end up with lots of the fol­low­ing: ClassNotFoundException.

    31 Jan 2012, 10:53am
    gwt java javascript:

    leave a comment




  • Anzeige
  • An invalid or illegal string was specified” Exception in GWT

    While work­ing with can­vas (draw­ing stuff on it) in GWT, sud­denly and in a seem­ingly unpre­dictable man­ner I got fol­low­ing error mes­sage now and then from within the GWT frame­work code:

    com.google.gwt.core.client.JavaScriptException: (NS_ERROR_DOM_SYNTAX_ERR): An invalid or illegal string was specified;

    Again, GWT tricked me into think­ing I am writ­ing Java code and made me for­get about that it is going to be com­piled into Javascript. And because of the lat­ter, a divi­sion by zero does not throw an Devi­sion­ByZe­roEx­cep­tion, no, it returns NaN even for native data types (there is no dif­fer­en­ti­a­tion between dou­ble and Dou­ble in Javascript — there is only the object-version of dou­ble, which can be of value Double.NaN).

    But also GWT was not pre­pared to han­dle Double.NaN. When call­ing canvas.getContext().drawImage(image,x,y) and one of x and y or both were Double.NaN I got the error mes­sage shown above. If you got the same… you know what to do now: check all devi­sions in your code for poten­tial devi­sions by zero!!

    18 Jan 2012, 10:50am
    gwt java:

    leave a comment




  • Anzeige
  • Sorting Lists in GWT

    Quick one:
    Lists.sort(list, comparator) is not imple­mented in the GAE JVM.
    But, as a replacement/alternative, Collections.sort(list, comparator) is.

    28 Feb 2011, 11:10pm
    gwt java:

    leave a comment




  • Anzeige
  • How to Execute Code When the GWT Application Is Going Down

    My goal was to store the UI state of my appli­ca­tion just before it gets ter­mi­nated to be able to restore it next time the way the user left it the other day.

    I tried to add an addAttachHandler to the RootPanel to get informed about the root panel get­ting detached from the DOM so that I can final­ize my appli­ca­tion. Sur­pris­ingly, that does not work in Chrome (tested Chrome and Fire­fox only).

    But besides that this sounds like a bug to me, I found the “proper” way of doing things before the appli­ca­tion ends:

    Window.addWindowClosingHandler(new Window.ClosingHandler() {
    	@Override public void onWindowClosing(ClosingEvent event) { ... } 
    });

    In the end, I think some­thing like Document.addUnloadHandler would be more sug­ges­tive… clos­ing the win­dow or reload­ing a page is both exit­ing the appli­ca­tion by unload­ing the DOM — not clos­ing the window.

    18 Feb 2011, 1:27pm
    gwt:

    1 comment




  • Anzeige
  • Disable an Anchor in GWT

    Unex­pect­edly, call­ing setEnabled(false) does not pre­vent a link/anchor from being clicked. That means, the click events still get trig­gered.
    The rea­son is more or less a bug in GWT as it updates the list of events that are going to be trig­gered only at the moment when it gets attached to the DOM (Btw, in GWT, this process is called to sink and to unsink events, where the for­mer enables a spe­cific event to be trig­gered and the lat­ter dis­ables it).
    I found a workaround by cre­at­ing my own Anchor class and forc­ing the under­ly­ing GWT Anchor to update the list of events to be sunk.

    ...
    import com.google.gwt.event.dom.client.ClickHandler;
    import com.google.gwt.user.client.Event;
    
    public class Anchor extends com.google.gwt.user.client.ui.Anchor {
    
    	@Override public void setEnabled(boolean enabled) {
    		super.setEnabled(enabled);
    		if (isAttached()) {
    			onDetach();
    			if (enabled) {
    				sinkEvents(Event.ONCLICK);
    			} else {
    				unsinkEvents(Event.ONCLICK);
    			}
    			onAttach();
    		}
    	}
    
    	@Override protected void onLoad() {
    		super.onLoad();
    		if (isEnabled()) {
    			sinkEvents(Event.ONCLICK);
    		} else {
    			unsinkEvents(Event.ONCLICK);
    		}
    	}
    }

    Note the onLoad method, it sets up the state when the wid­get gets attached to the DOM the first time. It is required because setEnabled() could have been called before the anchor got attached.

    If you encoun­tered the same issue, please vote for this bug report.

    14 Feb 2011, 9:48pm
    linux:

    leave a comment




  • Anzeige
  • Flickering Screen with ATI Radeon X1400 and Ubuntu

    EDIT: ATI Radeon X1400 seems to work fine again since Ubuntu 11.04.

    There is another fix to the “well known” issues with the ATI Radeon X1400 and Ubuntu 10.04 to 10.10 besides the one posted about one year ago (see here).
    The pre­vi­ous fix kept the graph­ics card work­ing nor­mally but harmed the over­all oper­at­ing system’s sta­bil­ity, so here is another fix based on dis­abling all 3D fea­tures of the device to get rid of the flick­er­ing screen.

    It’s up to you to choose what you are able to live with­out
    a) The desk­top set­tings panel and “Seg­men­ta­tion fault” errors now and then, or
    b) 3D accel­er­a­tion (does not harm video play­back or any other basic OS functionalities)

    For solu­tion a) see this.
    For b) cre­ate this file: /etc/modprobe.d/radeon-kms.conf — and add fol­low­ing content

    options radeon modeset=0

    Solu­tion found here (in German).

    14 Feb 2011, 9:26pm
    linux:

    leave a comment




  • Anzeige
  • Logitech Communicator STX Webcam vs. Ubuntu (64bit) & Skype 2.1

    There are many tuto­ri­als out there solv­ing the prob­lem by mak­ing Skype use Video for Linux ver­sion 1 dri­vers instead of ver­sion 2, as that par­tic­u­lar web­cam does not seem to get along with the newer ver­sion. It boils down to the fol­low­ing lines:

    Cre­ate a file in /usr/local/bin/skype and insert

    #!/bin/bash
    LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype

    Finally, make it exe­cutable by sudo chmod a+x /usr/local/bin/skype
    Use this file to start Skype from now on. Done.

    But not for me. Skype refused to eat it: ERROR: ld.so: object '/usr/lib/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.
    Until I finally found this one here.

    Just to cut a long story short, here is why: all the other solu­tions work for 32bit Linux only — but hey, I do not have any of my old laptop’s poten­tial to be wasted — I am run­ning 64bit Ubuntu (tested with ver­sion 9.10 and 10.10 64bit). And with a minor tweak, the fix will work for you, too. :)

    Install the video4linux libraries:

     sudo apt-get install lib32v4l-0

    And change /usr/local/bin/skype to

    LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so /usr/bin/skype

    Its just about the “32” — and one good exam­ple more of why you should put mean­ing­ful error mes­sages in what­ever software!

    Thanks Eoin Mur­phy.

    7 Feb 2011, 2:58pm
    java:

    leave a comment




  • Anzeige
  • Java Cookies from the Future Past

    While work­ing with cook­ies in Java/GWT and thus—to set the expire date—with Date, I found a doubt­ful Java behavior.

    My goal was to set a cookie to expire in about one month from today like this:

    Date expires = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30);
    Cookies.setCookie("myCookie", "myData", expires);

    And kept won­der­ing why the cookie never got stored.

    And finally cre­ated a sim­ple test case like this:

    Date today = new Date();
    Date tomorrow = new Date(today.getTime() + 1000 * 60 * 60 * 24);
    Date nextMonth = new Date(today.getTime() + 1000 * 60 * 60 * 24 * 30);

    And got fol­low­ing dates:

    today=Mon Feb 07 14:27:50 CET 2011
    tomorrow=Tue Feb 08 14:27:50 CET 2011
    nextMonth=Tue Jan 18 21:25:02 CET 2011

    Accord­ing to Java’s cal­cu­la­tion, the cookie was expired already before even being set.

    Took me a bit to under­stand why:
    1000 * 60 * 60 * 24 * 30 = 2,592,000,000 = 0x9A7EC800
    Thus, the first bit got set to one… a clas­si­cal over­flow caus­ing the inte­ger value to become neg­a­tive — just try:

    System.out.println(1000 * 60 * 60 * 24 * 30);

    It will print out -1702967296.

    Fix: Add a lit­tle L will solve the issue by forc­ing the com­piler to cal­cu­late using the scope of long:

    Date nextMonthLong = new Date(today.getTime() + 1000L * 60 * 60 * 24 * 30);

    I guess I will fall for that one again some­time as the error is not obvi­ous in my opin­ion — espe­cially because getTime() returns a long and still, the com­piler sticks with an int for the mul­ti­pli­ca­tion part.

    4 Feb 2011, 10:10pm
    gwt:

    1 comment




  • Anzeige
  • Disable Context Menu in GWT

    To make use of the right mouse but­ton, it is nec­es­sary to dis­able the native browser con­text menu (the popup menu appear­ing on right click). This can be achieved like this:

    RootLayoutPanel.get().addDomHandler(new ContextMenuHandler() {
    
    	@Override public void onContextMenu(ContextMenuEvent event) {
    		event.preventDefault();
    		event.stopPropagation();
    	}
    }, ContextMenuEvent.getType());

    Same should work for RootPanel.

    After that, it is pos­si­ble to make use of the right mouse but­ton for exam­ple like this:

    someWidget.addDomHandler(new MouseMoveHandler() {
    
    	@Override public void onMouseMove(MouseMoveEvent event) {
    		if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
    		...
    2 Feb 2011, 11:45pm
    gwt jobs:

    leave a comment




  • Anzeige
  • GWT Error Message “Asked for attribute parser of no type”

    Exam­ple:

    public boolean isCollapsed() {
    	return panel.isVisible();
    }
    
    public void setCollapsed() {
    	panel.setVisible(false);
    }

    Seen it? Despite the com­pli­cated and cryp­tic error mes­sage, the mis­take is rather sim­ple: the set­ter method is miss­ing a para­me­ter, i.e. “pub­lic void setCollapsed(boolean collapsed) {“.

    2 Feb 2011, 11:41pm
    java projects:

    leave a comment




  • Anzeige
  • Authentication with FlickrJ

    When you know about user­name and pass­word logins, the whole Flickr authen­ti­ca­tion process for web appli­ca­tions seems a lit­tle weird on first sight, nev­er­the­less it is log­i­cal and nec­es­sary after you have done some read­ing (for exam­ple the offi­cial Flickr WebApp Auth HowTo).
    To get started and into cod­ing quickly (using FlickrJ and Java) I rec­om­mend this page. Espe­cially the code exam­ple is excel­lent in my opin­ion! Thanks Andy Sacher!

    17 Jan 2011, 6:38pm
    gwt jobs:

    leave a comment




  • Anzeige
  • Testing GWT Application in Virtual Machine

    I am devel­op­ing on a Mac, but to test my GWT appli­ca­tions for cross-browser com­pat­i­bil­ity in Inter­net Explorer I need to use Win­dows, thus I got Win­dows 7 installed using Par­al­lels. Just by the way, to be able to test in dif­fer­ent Inter­net Explorer ver­sion, I am using a pretty handy appli­ca­tion called IETester.
    But try­ing to access local­host with IE in the vir­tual machine did not work. I got a “404 page not found” error instead of see­ing my app run­ning on the local App Engine instance. Obvi­ously, Par­al­lels does not auto­mat­i­cally for­ward local­host requests to OSX and maybe that is actu­ally a good idea security-wise.
    To fix the issue, you need to run Google App Engine on a pub­lic net­work inter­face, or in other words, bind the App Engine server to all avail­able IP addresses. The down side: every­body know­ing your IP address can see the GWT app now, but oth­er­wise you are not allowed to access it in the viru­tal machine as from your OSX’s point of view, that Win­dows machine is “some other guy access­ing from the out­side”, too. To make GAE acces­si­ble from the out­side, add the para­me­ter “-bindAd­dress 0.0.0.0″ when launch­ing you local GAE. Using Eclipse you can achieve that by right click­ing your project -> Run As -> Run Con­fig­u­ra­tions -> Choose “(x)= Argu­ments” tab; add the option to the top most box titled “Pro­gram argu­ments” in the options area (e.g. before “-port 8888″).

    The first part of the list of argu­ments should look some­thing like that:

    -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl GlocalUiPg2.html -logLevel INFO -codeServerPort 9997 -bindAddress 0.0.0.0 -port 8888 ...

    Now, you can access you app using the OSX’s pub­lic IP address. (You can get to know your IP by hav­ing a look at the net­work pref­er­ences panel.) Launch­ing GAE from Eclipse, you will see a dif­fer­ent link (URL) in the “Devel­op­ment Mode” tab now, con­tain­ing the pub­lic IP already. Using that one in, say, your Fire­fox on Mac, it will ask you now whether you want to allow the debug­ger access. That is also due to the fact, that you are now using a pub­lic address, so it is not clear to your local debug server, whether that request came from the same com­puter or some­one else in the network.

    14 Dec 2010, 11:49am
    java:

    leave a comment




  • Anzeige
  • Casting collections in Java

    Assum­ing two classes A and B as

    class A {}
    class B extends A {}

    It is just log­i­cal that cast­ing B to A works fine:

    A anObjectOfClassA = new B();

    But when it comes to col­lec­tions of As and Bs, a strange phe­nom­e­non appears in Java:

    Collection<B> collectionOfBs = new LinkedList<B>();
    Collection<A> collectionOfAs = (Collection<A>)collectionOfBs; // this line does not compile!

    That is, though the col­lec­tion wrap­per (the java.util.Collection class) is the same and B extends A, cast­ing a col­lec­tion of objects of class B to a col­lec­tion of objects of class A throws an compile-time error.

    But it works using gener­ics (the whole class for the sake of com­plete­ness and reusability):

    import java.util.Collection;
    import java.util.LinkedList;
    
    public class CollectionCastingExample {
    
      class A {}
      class B extends A {}
    	
      Collection<B> collectionOfBs = new LinkedList<B>();
    //  Collection<A> collectionOfAs = (Collection<A>)collectionOfBs;
    	
      Collection<A> collectionOfAs = downCastCollection(collectionOfBs, A.class);
    	
      /**
       * Casts a collection of objects of class B where B extends A to a collection of objects of class A.
       * 
       * @param <T> Base class
       * @param collection Collection of objects of a class extending T 
       * @param aClass Representation of T
       * @return Collection of objects of T casted from given collection of objects of a class extending T.
       */
      @SuppressWarnings("unchecked")
      public static <T> Collection<T> downCastCollection(Collection<? extends T> collection,
          Class<T> aClass) {
        return (Collection<T>) collection;
      }
    }

    Despite the fact that a @SuppressWarnings("unchecked") is required, it avoids iter­at­ing over the whole col­lec­tion of Bs and cast­ing each of them from B to A plus adding them to a new col­lec­tion of As.

    3 Dec 2010, 4:02pm
    gwt:

    2 comments




  • Anzeige
  • Adding a New Service (GWT)

    Adding a new servlet/service to you GWT appli­ca­tion is quite straight for­ward, e.g. by copy­ing the exam­ple “greet­ingSer­vice” or cre­at­ing a new servlet. But it’s easy to over­look a required change/adjustment of your project’s con­fig­u­ra­tion and you might end up with an error mes­sage like “Blocked attempt to access inter­face ‘some.package.SomeService’, which is not imple­mented by ‘some.other.package.SomeOtherServiceImpl’; this is either mis­con­fig­u­ra­tion or a hack attempt”.

    Check list (some should be replaced with what­ever you want to call your new service):

    • Copy or cre­ate files:
      SomeService.java and SomeServiceAsync.java in client pack­age
      SomeServiceImpl.java in server pack­age + change imple­men­ta­tion state­ment to SomeSer­vice
    • Adjust web.xml:
      <servlet>
      	<servlet-name>someServlet</servlet-name>
      	<servlet-class>some.package.SomeServiceImpl</servlet-class>
      </servlet>
      <servlet-mapping>
      	<servlet-name>someServlet</servlet-name>
      	<url-pattern>/[copy base directory name from other service declaration]/some</url-pattern>
      </servlet-mapping>
    • Anno­tate inter­face SomeService.java:
      @RemoteServiceRelativePath("some")
    • Con­nect to your new ser­vice in the client:
      private final SomeServiceAsync someService = GWT.create(SomeService.class);

    Def­i­nitely some pos­si­bil­i­ties to make a mis­takes or miss some­thing here.

    17 Sep 2010, 4:16pm
    jobs projects:

    1 comment




  • Anzeige
  • Using the XML Parser in GWT

    I tried using the XML pars­ing fea­tures of the GWT like that:

    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
    	@Override
    	public void onSubmitComplete(SubmitCompleteEvent event) {
    		// One time upload only, to upload again, user needs to start the upload process from scatch – keeping it simple for now
    		panel.clear();
    		Window.alert(event.getResults());
    		Document result = XMLParser.parse(event.getResults());
    		...
    });

    But GWT kept telling me “No source code is avail­able for type com.google.gwt.xml.client.Document; did you for­get to inherit a required mod­ule?”. It turns out, you are required to explic­itly add the XML func­tion­al­i­ties to your project by adding fol­low­ing line to your .…gwt.xml file:

    <inherits name='com.google.gwt.xml.XML'/>

    Raises a ques­tion: What’s the point of AJAX (Asyn­chro­nous JavaScript and XML) with­out XML? Or in other words there is no AJAX with­out XML! So it’s up to you to add the AX part to GWT man­u­ally. What’s next?

    17 Sep 2010, 3:49pm
    gwt java:

    leave a comment




  • Anzeige
  • Uploading File to Server: Access Denied

    Sim­ple task: upload a file to the server. Achieved so far: upload form works and the file gets trans­ferred to the server.
    But as soon as the file is writ­ten, I get one of that:
    “java.security.AccessControlException: access denied (java.io.FilePermission /some/folder/upload__71c20601_12b1b66bc39__7ffa_00000000.tmp write)“
    I am amazed how much search­ing is required to find some infor­ma­tion about how to mod­ify the file per­mis­sions for the local app engine! And in the end, it turns out that there is an issue with the GAE on Mac but with­out a way to con­fig­ure the local Jetty server to allow write access. :(
    As soon as I deploy the app to a Tom­cat on Linux, it works like a charm!

    16 Sep 2010, 6:02pm
    jobs projects:

    3 comments




  • Anzeige
  • GWT FileUpload: Adding Widgets to a FormPanel

    If you build your first GWT form, for exam­ple some­thing like that:

    <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
    <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <g:HTMLPanel>
    <g:FormPanel ui:field="form"> 
    <g:FileUpload ui:field="uploadField" name="file"/>
    <g:SubmitButton ui:field="submitButton">Upload</g:SubmitButton>
    </g:FormPanel>
    </g:HTMLPanel>
    </ui:UiBinder>

    And your con­sole keeps telling you dur­ing run­time some­thing like this: “java.lang.IllegalStateException: Sim­plePanel can only con­tain one child wid­get”. Instead of writ­ing a long page of expla­na­tions and com­plaints like I did before, it’s sim­ply like that:

    Just put all your wid­gets in a panel (like Hor­i­zon­tal­Panel) and add that panel to the Form­Panel.” (Jake − cf. com­ment below)

    Thanks Jake! :)

    9 Sep 2010, 4:48pm
    jobs projects:

    1 comment




  • Anzeige
  • GWT Does Not Load Module in Local AppEngine

    The issue arose after I renamed the mod­ule file (end­ing with .gwt.xml) to bet­ter rep­re­sent the mod­ule func­tion­al­ity. I also updated all rel­e­vant files in the project (search for files con­tain­ing the old name to find them) accordingly.

    Start­ing the appli­ca­tion after that mod­i­fi­ca­tions ended up in an error (“[ERROR] Unable to find ‘<old mod­ule name>.gwt.xml’ on your class­path; could be a typo, or maybe you for­got to include a class­path entry for source?”) as the AppEngine tried load­ing the mod­ule by its old name.

    Solu­tion: Delete the launch pro­file for the project (by choos­ing “Run As…” -> “Run Con­fig­u­ra­tions…” from the con­text menu).

    Obvi­ously the GWT does not check nor update the auto­mat­i­cally gen­er­ated launch pro­file thus you need to delete it to force the GWT to cre­ate a new pro­file from scratch tak­ing the project changes into account. You might also adjust the pro­file accord­ing to the changes made, but delet­ing it is the safe and easy way.

    25 Aug 2010, 10:41am
    jobs projects:

    leave a comment




  • Anzeige
  • First GWT Steps

    Just started to work with GWT – a pretty inter­est­ing approach for web devel­op­ment com­pared to PHP or JSF. The whole Appli­ca­tion engine is quite impres­sive espe­cially allow­ing you to quickly test your appli­ca­tions locally by sup­port­ing auto­matic hot deploy­ment after each code update.
    One thing that took me a while was one of that “[ERROR] Unable to find ‘[some-file].xml’ on your class­path; could be a typo, or maybe you for­got to include a class­path entry for source?” errors. If you are sure the file is in place, I real­ized restart­ing the App Engine or Eclipse mostly solves that problem.

    8 May 2010, 11:25am
    linux:

    leave a comment




  • Anzeige
  • Resizing System or Home Partion

    A very con­ve­nient tool for cre­at­ing, mov­ing, and resiz­ing par­ti­tions is GParted. I use it for all my partition-changing-needs — it is really pow­er­ful and yet easy to use! :)

    But it is not pos­si­ble to resize sys­tem rel­e­vant par­ti­tions while the sys­tem is run­ning — makes sense, right? ;)

    But you can down­load GParted as LiveCD ISO file and burn it on a CD. After that, restart your com­puter with the CD in your drive and a small linux will start up directly from CD includ­ing GParted, thus allow­ing you to mod­ify any drive and par­ti­tion there is. :) Do all required changes, click the exit but­ton and you are done. In my case, the com­puter did not reboot auto­mat­i­cally, instead I ended up with a com­mand line inter­face — use the com­mand “sudo reboot” to restart the sys­tem your­self if that happens.

    And just by the way, GParted does also han­dle Win­dows par­ti­tions eas­ily — so there is no need to buy or “get” Par­ti­tion Magic from some­where. But never for­get to backup your data first.

    Yet another hint: GParted works most reli­able if you do one step at a time. So for exam­ple, there are par­ti­tions A and B (A is in front of B) and you wish to give some of the free space in A to B. You need to do fol­low­ing steps: Shrink A, move B left and finally grow B. From my expe­ri­ence, GParted works best if you really do all those steps sep­a­rately, apply each of then, and go for the next one if the last one fin­ished successfully.

    30 Apr 2010, 11:04pm
    linux:

    leave a comment




  • Anzeige
  • Flickering Screen After Upgrade to Kubuntu 10.04

    First of all, I was amazed how smoothly the upgrade went. (K)Ubuntu and I guess other dis­tri­b­u­tions as well have gone quite a far way to become plat­forms for every­body — with a lot of soft­ware but even more tools, helpers and auto­matic back­ground ser­vices — like the nice upgrade service.

    There was only one prob­lem I ran into and I want to share the solution.

    I am run­ning Kubuntu 10.04 (just upgraded today) on a Lenovo IBM ThinkPad R60 (Yes, one of those with both brands on them ;) ) with an ATI Radeon X1400 graph­ics device. But since upgraded, my dis­play started flick­er­ing — not per­ma­nently but unbearable.

    The solu­tion that worked for me (at least par­tially — see below — and this is of cause depend­ing on the graph­ics device type) was to install the pro­pri­etary ATI dri­vers. I know, it is not a good solu­tion, I do not like to use them nei­ther and if any­one out there is read­ing this with a bet­ter solu­tion in mind, let me know it!! :)
    Edit 2011-02-14: Added a new post with an addi­tional, alter­na­tive solu­tion here.

    So what you need to do is  to get your favorite pack­age man­age­ment tool (e.g. Synap­tic or KPack­ageKit) — just hit Alt+F2 and type “pack­age” and pick KPack­ageKit from the list (it will ask you for the super user pass­word). Then, search for “fglrx”. In KPack­ageKit, you will find a result titled “Video dri­ver for the ATI graph­ics accel­er­a­tor”, and some­thing below the title like “fglrx — 2:8.723.1-0ubuntu3” but the ver­sion num­ber should not mat­ter. Click the arrow to the right, hit “Apply” and after reboot­ing, every­thing should per­fectly with­out any configuration.

    Good luck. ;)

    Prob­lems noticed so far: The dri­ver causes “Seg­men­ta­tion Fault” error mes­sages, e.g. when try­ing to open up the dis­play set­tings. That’s ugly, I know. But you can read in sev­eral forum and blog posts, that the sup­port for the for­mer nicely work­ing dri­ver for the ATI X1400 has been dis­con­tin­ued since 10.04, hence, it’s just good luck that the fglrx works some­how — good to know *after* upgrad­ing, right. But still, the flick­er­ing was unbear­able for me, thus, I accept the issues for now. I will keep my eyes peeled hop­ing for a proper solu­tion in the future.

    26 Apr 2010, 9:34pm
    linux:

    leave a comment




  • Anzeige
  • Change hotkey of Kubuntu’s Quick Launch Tool KRunner

    First of all: I love those quick launch tools aka key­stroke launch­ers, they are real time savers — every­one should have one!

    [For those with­out a glue what a key­stroke launcher is:] It is THE tool for launch­ing any kind of soft­ware or even open­ing doc­u­ments. Instead of mov­ing your mouse to you appli­ca­tions menu, click it, search the pro­gram, move the mouse there, maybe pick a sub-folder, move mouse again and finally click — unless you acci­den­tally moved a lit­tle but to far and the menu close again, com­pletely. :( But it is easy to put an end to this (as described below). Instead of doing all that click­ing, you hit a spe­cial key com­bi­na­tion, by default [Alt] and [Space], this will make a small input box show up, now, you only enter the first let­ters of the pro­gram — e.g. “f” will do after a few uses to start Fire­fox (the pro­gram learned that you use it a lot). It might save only a few sec­onds each time, but the sum up and, hey, it is very con­ve­nient, too!

    So here is what you need to do:
    Mac OS: It is already built-in — Just hit Alt+Space and type the name of the pro­gram you want to start (or files or what­ever).
    Win­dows: Get/install Launchy and use it as explained above.
    Kubuntu: built-in as well, BUUUT you have to hit Alt+F2 instead.

    And there it is, some­thing that kept annoy­ing me about Kubuntu for quite a bit. I was hop­ing to get used to it but for what rea­son? Alt+F2 is really not handy com­pared to Alt+Space.
    Finally, based on this old forum post and a few adjust­ments to fit nowa­days Kubuntu, all you need to do is this:

    1. Go to “Set­tings” -> “Key­board and mouse”
    2. Select “Global Key­board Shortcuts”
    3. Pick from the select box “KDE com­po­nent” at the top “Run Com­mand Interface”
    4. Now, you can access “Run Com­mand” — Change it to what­ever you like :)
    28 Feb 2010, 2:05pm
    linux:

    leave a comment




  • Anzeige
  • Moving home to it’s own partion (Ubuntu)

    We are going to move all accounts includ­ing their per­sonal data on a dis­tinct par­ti­tion. This rec­om­mended in case of sys­tem fail­ure to not loose any data.
    I have no idea, why the Ubuntu instal­la­tion wiz­ard does not do this by default — it should!

    This post is based on an arti­cle in Ger­man — I will mainly trans­late it, strip some plush and add some stuff to make life eas­ier and to reduce the risk of data loss. But be aware: to per­form any of those fol­low­ing things, you will need super user rights and you should feel some­what comfy with using the com­mand line. And of course, it might be pos­si­ble in cir­cum­stances unfore­seen, that you lose all your per­sonal data — but there are a lot of backup steps included below.

    Here we go: (con­sole input or state­ments are writ­ten in ital­ics)

    1. Prepa­ra­tion
      1. Cre­ate a backup: rsync –avx –progress /home <your backup destination>
      2. If you do not have a free par­ti­tion yet, I rec­om­mend GParted to cre­ate one (use sudo apt-get install gparted). I rec­om­mend ext3 for com­pat­i­bil­ity issues — but if you use Linux only, you can go for ext4 (please change ext3 to ext4 in step 1.6 in case) — make sure your new par­ti­tion is big enough for your home folder! Try to remem­ber the size (get size: du –sh /home) of /home, you can use it later on to ver­ify your new home location.
      3. Get par­tion name sudo fdisk –l /dev/sda — e.g. /dev/sda7 — I will refer to this name as (name)
      4. Copy your cur­rent file sys­tem con­fig­u­ra­tion: sudo cp /etc/fstab /etc/fstab.new
      5. Get par­tion UUID of new par­ti­tion: sudo blkid — you will find a line about (name) stat­ing a UUID (quite a long hex string), I will refer to it as (uuid) — copy it.
      6. Edit /etc/fstab.new, add a new line at the end as fol­lows (the lay­out should fol­low pre­vi­ous lines — sim­ply copy one and adjust it):
        UUID=(UUID)  /home                ext3         defaults                    0 2
    2. Copy
      1. Sign off / Log out
      2. Switch to con­sole mode by press­ing Ctrl+Alt+F1
      3. Cre­ate a mount point for the new par­ti­tion: sudo mkdir /mnt/tmp
      4. Add par­tion: sudo mount (name) /mnt/tmp
      5. Copy home from the old loca­tion to the new par­ti­tion: sudo rsync –avx –progress /home/ /mnt/tmp
      • Test
          1. Mount copy of home as new home: sudo mount (name) /home
          2. Check size of home folder — should be the same as in step 1.: du –sh /home
          3. Check mount­ing worked: sudo mount| grep /home should print out some­thing like
            (name) on /home
          • Switch
              1. yet another home backup: sudo mv /home /home.bak
              2. cre­ate new home mount point: sudo mkdir /home
              3. cre­ate a backup of fstab: sudo mv /etc/fstab /etc/fstab.bak
              4. put updated ver­sion in place: sudo mv /etc/fstab.new /etc/fstab
              5. reboot and you should be done: sudo reboot

              Ok, that’s that. If every­thing works fine, you can delete the backup home sudo rm –rf /home.bak and the fstab backup sudo rm /etc/fstab.bak. Hope you found it use­ful and I did not put in a mis­take or typo. Gimme feed­back! :)

              18 Feb 2010, 7:10pm
              jobs projects:

              leave a comment




            • Anzeige
            • Getting Drupal’s Access Control Module to Work Properly

              After set­ting up some con­tent types — some pub­lic, some inter­nal. I installed the Access Con­trol mod­ule, set up inter­nal con­tent not to be vis­i­ble to anony­mous users — but with­out any effect.

              After some research, but with­out suc­cess, I real­ized the *Advanced* sec­tion at the bot­tom of the Access Con­trol tab for each con­tent type. And now the magic trick: Increase the weight and you are done. So I guess the build in access man­age­ment was fight­ing the Access Con­trol mod­ule, so it is up to you to make your favorite mod­ule stronger by giv­ing it more weight. — I doubt this is intu­itive. Addi­tion­ally, it is for sure dif­fi­cult to sim­ply find the tiny lit­tle select box down there in a sec­tion, which is by default folded.

              7 Feb 2010, 10:52pm
              linux:

              leave a comment




            • Anzeige
            • KDE vs. Gnome

              Now, my deci­sion is final: KDE rules (though I actu­ally pre­fer the look of Gnome :( ).

              Sim­ple rea­son: Gnome does not sup­port drag-and-drop in com­bi­na­tion with alt+tab (see bug tracker), but there might be hope with the upcom­ing Gnome 3.

              [Edit 2011-06-14: Indeed, drag-and-drop + alt-tab works since since Ubuntu 11.04 (did not try with 10.10). One major dif­fer­ence remains: Do you need a lot of con­fig­u­ra­tion and cus­tomiza­tion options? And are you will to accept com­plex, maybe not that self-explaining menu struc­tures for that? If yes, KDE is your choice, oth­er­wise Gnome might make your life eas­ier. See also this page for more details and screenshots.]

              In more detail: using drag-and-drop together with alt+tab key com­bi­na­tion allows to work very effi­ciently. For exam­ple, while order­ing my pho­tos, I want to work on one of them — as I do this reg­u­larly, Gimp is opened already, but in the back­ground — so what I do using KDE or MS Win­dows is, I grab the pic­ture, switch to Gimp by using alt+tab and imme­di­ately drop the pic­ture with­out mov­ing the mouse at all — I am quite con­fi­dent that this is the fastest way of open­ing a pic­ture for edit­ing. Some peo­ple advice to set Gimp as default appli­ca­tion to open JPEGs, but I am not always edit­ing pic­tures, most of the times I just want to view them.

              Using “Open With” on a JPEG file for sure is the com­mon approach — but let’s com­pare it:

              • Drag-and-drop & alt+tab
                • Actions to be per­formed: mouse down + key down + key up + mouse up
                • In total: four fast steps
              • Open With” solu­tion (hold­ing mouse down as improvement)
                • Actions to be performed:mouse down + mov­ing to “Open With” + wait for sub-menu to open + move to sub-menu + mouse up
                • In total: two fast, three slow steps
              2 Feb 2010, 7:13pm
              jobs projects:

              leave a comment




            • Anzeige
            • How to Make Jquerymenu for Drupal Keep its State on Page Reload

              While set­ting up the web­site for my new project “Glo­cal” www.glocal-project.eu), I came across the prob­lem of find­ing a proper menu mod­ule. Some­thing easy to use, sta­ble and effi­cient in the same time for the com­plex intranet struc­ture (there­fore, sorry, but you will not be able to see my solu­tion there unless you are a project mem­ber). Some­thing with a high usabil­ity in the end. Active­menu is still quite buggy and DHTML Menue requires a dou­ble click to actu­ally open a page — unbear­able in a non-doulbe-click envi­ron­ment like the Inter­net — who is sup­posed to guess, that this menu requires a dou­ble click?? Leav­ing me with JQuery­menu.

              First impres­sion: per­fect! Open and close branches by click­ing (+) or (-) — view page by click­ing menu item label. Even the few styling issues could be fixed eas­ily by using CSS. But as soon, as some­one clicks a label, the menu col­lapses to its default sta­tus. It does not remem­ber its last sta­tus after load­ing a dif­fer­ent page with the same menu.

              Is this it? All mod­ule have crit­i­cal down­sides like this? I was quite dis­ap­pointed! :(

              But I taught JQuery­menu to remember!

              As it is quite some code, I will not post it here directly, but added it to the tracker page for this “fea­ture request” or you can down­load the two updated files (jquerymenu.js and jquerymenu.module) here and replace the once in your /sites/all/modules/jquerymenu folder.

              But please be care­ful, it should be con­sid­ered an alpha ver­sion, there are quite some weak­nesses (see tracker page). Any feed­back or sug­ges­tions are very wel­come!

              5 Aug 2009, 1:12pm
              php:

              leave a comment




            • Anzeige
            • Simple redirection using PHP and HTML meta tag

              Some­thing every­one needs once in a while… maybe you moved a file on your server or you did not install word­press in the root folder of your web­server — like I did nei­ther ;) — a redi­rec­tion or for­ward­ing can be an easy answer.

              The script is rather sim­ple — it redi­rects in three ways to pro­vide a rea­son­able fall back if any of the auto­matic redi­rect­ing fails. To use it on your server, just enter the URL/address/file name/folder you would like the user to be redi­rected to in the sec­ond line of the page/script.

              Put the whole code and markup in a file with file exten­sion “.php”.
              In my case, every user end­ing up at “www.svenbuschbeck.net” should to be for­warded to “www.svenbuschbeck.net/wordpress/home”. So I adjusted the script below like “$url = ‘wordpress/home’”, named the file “index.php” and put it in the root folder. Done :) .
              <?php
              $url = 'put your URL between the parenthesis';
              header("Location: $url");
              ?>
              <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
              <html>
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
              <meta http-equiv="refresh" content="0;url=<?php echo $url; ?>"/>
              <title>You will be redirected... </title>
              </head>
              <body>
              If you are not redirected automatically, please click <a href="<?php echo $url; ?>">here</a>.
              </body>
              </html>
              29 Jul 2009, 10:30pm
              hci:

              leave a comment




            • Anzeige
            • good & bad usablity
              the tap example

              Every­one inter­ested in HCI and Usabil­ity saw the cover pic­ture of The Design of Every­day Things by Don­ald Nor­man. But there are exam­ples about good and bad usabil­ity all around us, every day and I want to share one of mine.

              I real­ized how much more com­fort­able the shower tap at my par­ents place is, com­pared to the one in my shared flat.

              don't move! If you are lucky, the water gets only turned of... otherwise you get frozen or boiled...

              Don’t move! If you touch it and you are lucky, the water gets only turned off… oth­er­wise you get frozen or boiled.

              an good example of a water-tap for a shower

              A good exam­ple of a water-tap for a shower.

              .

              The exam­ple to the left  is a typ­i­cal one — most prob­a­bly fol­low­ing an assump­tion like “this tap is work­ing for the wash­bowl, so it will do for a shower as well”. As it is mounted waist-high, it is easy to reach, also by mis­take, which can be quite dan­ger­ous as it can eas­ily be turned towards hot water by a slight touch. The re-engineered exam­ple on the right shows a func­tional and easy-to-use solu­tion, in addi­tion, the water tem­per­a­ture can be set up very pre­cisely, but most impor­tant, there is no way to change the water tem­per­a­ture by acci­dent as it is selected with a knob. Addi­tion­ally, due to the knob, its almost impos­si­ble to reach the han­dle, which is used to set up the water amount, by accident.

              24 Jun 2009, 3:03pm
              jobs projects:

              4 comments




            • Anzeige
            • fixing flex VideoDisplay CuePointManager

              I was cre­at­ing a Flex appli­ca­tion to show slides and a pre­sen­ta­tion video of pre­vi­ously recorded pre­sen­ta­tions. Accord­ingly, each slide should appear at a cer­tain point of time in the video — calls for cue points!

              As all slides and there appear­ance are stored in a text file in my case, I started adding cue points with Action­Script. But as soon as the video can be con­trolled with a slider, allow­ing to shift for– and back­wards, the event han­dler “cue­Point” was not trig­gered any more. Thus, the slides where not changed cor­rectly as the user jumps ahead, as the cue points between the pre­vi­ous and the new posi­tion did not cause and cue point event.

              Finally I wrote AdvCue­Point­Man­ager, inher­it­ing from Cue­Point­Man­ager, but which can deal with jump­ing back– and forward.

              Copy it to “<your source folder>/net/svenbuschbeck/flex/video” and use it as follows:

              <mx:VideoDisplay cuePointManagerClass="net.svenbuschbeck.flex.video.AdvCuePointManager" />
              16 Apr 2009, 5:46pm
              jobs:

              3 comments




            • Anzeige
            • how to install memchached 1.2.2 from source

              I have installed an instance of mem­chached ver­sion 1.2.2 on one of our servers (Debian etch) today and to keep you from spend­ing a whole after­noon, see my everything-step-by-step instruc­tion below.

              Mem­chached is a dis­trib­uted hash map, which can be used for exam­ple to speed up any kind of web appli­ca­tion, see web­site for details. In our case, we want to use it as tem­po­rary data store. I will report about the expe­ri­ences in a lat­ter post.

              intro­duc­tion

              Always refer to this page for details, but I cre­ated a ver­sion with less text but includ­ing steps to really start from scratch.

              All lines start­ing with # are com­mand lines, i.e. you need to type into a linux shell.
              Out­put of any kind is always sur­rounded by ” even if it is mul­ti­line output.

              con­tent

              a. get libevent (needed to install mem­cached)
              b. get mem­cached and ver­ify instal­la­tion
              c. use and test mem­cached within Java with junit/ant

              a. installing libevent 1.3

              a.1. check for cur­rent ver­sion of libevent

              a.1a.

              Log in as root or get super user rights by call­ing su

              # updat­edb
              # locate libevent

              If there is out­put includ­ing “libevent1” and/or “libevent-1″ (ignore pack­age files like *.deb) -> a.1b, oth­er­wise a.2

              a.1b. remov­ing old libevent version

              # apt-get remove –purge libevent1
              # Y

              # updat­edb
              # locate libevent
              Should now return noth­ing or pack­age files only, i.e. you are ready for installation

              a.2. installing libevent 1.3

              a.2a down­load­ing and unpacking

              # cd /usr/local/src
              # wget http://monkey.org/~provos/libevent-1.3b.tar.gz
              # tar zxvf libevent-1.3b.tar.gz
              # cd libevent-1.3b

              a.2b. con­fig­ur­ing

              # ./configure
              check the out­put, if it con­tains some­thing like “con­fig­ure: error: no accept­able C com­piler found in $PATH” -> a.2c. oth­er­wise a.2d.

              a.2c. com­pil­ing

              # apt-get install gcc

              Redo a.2b.
              I got out­put like “C com­piler can­not cre­ate exe­cuta­bles”, read­ing file ‘config.log’ did not help me at all. Googling finally did, as I found a forum entry, point­ing out a miss­ing lib.
              So try this:

              # apt-get install libc-dev

              Redo a.2b.
              If that did  not solve it… sorry … google on, there is no sense in going on with­out solv­ing this issue. :-/

              a.2d. make it!

              # make && make install

              If you get some­thing like “-bash: make: com­mand not found” -> A.2e, oth­er­wise A.3.

              a.2e.

              # apt-get install make

              Redo a.2d.

              a.3. con­fig­u­ra­tion

              Press the Esc key as you read [esc] in the com­mands below.

              # vim /etc/ld.so.conf.d/libevent-i386.conf
              # i/usr/local/lib/[esc]:wq
              # ldconfig

              b. install mem­chached and ver­ify installation

              b.1. down­load, unpack and install memchached

              # cd /usr/local/src
              # wget http://danga.com/memcached/dist/memcached-1.2.2.tar.gz
              # tar zxvf memcached-1.2.2.tar.gz
              # cd memcached-1.2.2
              # ./configure
              # make && make install

              After installing gcc and libc-dev in sec­tion a, this one went eas­ily for me — if you skipped sec­tion a and run in prob­lems here, please install gcc and libc-dev (see a.2c).

              b.2. ver­ify instal­la­tion of memchached

              b.2a. start mem­chached server

              # mem­cached –u www-data –vv

              Out­put should end with line “<3 server lis­ten­ing”. Per­fect! :)

              b.2b test server

              I will refer to this shell in front of you as server shell below. Now, open another shell on the same machine, I will refer to it a client shell.

              # tel­net local­host 11211

              You should see some­thing like “<7 new client con­nec­tion” on the server shell, switch back to client shell.

              # set test1 1 10000 1
              # a

              You should see “STORED” on client shell and the two fol­low­ing lines on server shell
              ”<7 set test1 1 10000 1
              >7 STORED

              Per­fect!
              You did it, your mem­cached is up and run­ning :)

              c. mem­cached and Java

              I wrote a lit­tle test pack­age using a Java client library for mem­cached from here, together with junit and ant. You can down­load it to have a look how sim­ple using mem­cache is and to ver­ify your instal­la­tion with an included  junit test, auto­mated with an ant build file.

              29 Mar 2009, 10:18pm
              news

              leave a comment




            • Anzeige
            • break even…

              It is done so far. Port­fo­lio, résumé and this blog has been filled up with a lot of stuff I did within the last years con­cern­ing my fields of inter­est. After all, it was quite an inter­est­ing jour­ney, also because I almost for­got some nice projects of mine.

              I hope I could arouse inter­est in the things I like to do or even pro­vide inspi­ra­tions. If you have any thoughts or ideas to share, please drop me a line! I am look­ing for­ward to hear­ing from you!

              12 Mar 2009, 10:05pm
              projects:

              leave a comment




            • Anzeige
            • flickTrick

              The flickr Ser­vices API is quite amaz­ing. So I made a lit­tle appli­ca­tion called flick­Trick using phpFlickr.
              tI is capa­ble of pro­duc­ing either image mosaics on the basis of pub­lic pho­tos of a given flickr account, or it it can gen­er­ate a col­lage as the one you can see in the header part of this page, by sim­ply adding fol­low CSS to it.

              background-image: url(http://svenbuschbeck.net/flickTrick/collage.php?username=sven%20buschbeck&width=500&height=200&size=square&shuffle=true&maximum=24&alpha=40);

              — edit 2009/03/15 —
              As cre­at­ing a col­lage can take sev­eral sec­onds, I imple­mented a caching ver­sion. It firstly returns the last image stored for the given para­me­ters and then cre­ates a new image. This ver­sion can be accessed by using “fast-collage.php” instead of “collage.php”.

              » try it (alpha version) »

              1 Mar 2009, 3:25pm
              news:

              leave a comment




            • Anzeige
            • androids are taking over!

              See­ing those new touch enabled smart­phones with this new Android plat­form, it seems to be a com­plete oper­a­tion sys­tem based on a Linux ker­nel, with real multi-tasking capa­bil­i­ties, an OpenGL library, and an SDK allow­ing to code in Java (as you can see in the video below.) Makes me curi­ous! Google announced to release Android to the pub­lic this sum­mer. I’m really look­ing for­ward to what the peo­ple will do with it, but I will not wait that long to try the SDK which is pro­vided with doc already. :)

              You will find a lot of demon­stra­tion videos out there. I really enjoyed a small detail, done on Android only so far: hav­ing a con­text menu by per­form­ing a long click. That’s some­thing truly use­ful and a nice idea!

              – Edit 2013: Unfor­tu­nately, as we know now, Android does not sport a com­plete linux ker­nel, nor is it really open source and far from free soft­ware. Read this great arti­cle to get the big/real picture.

              3 Feb 2009, 10:46pm
              news

              leave a comment




            • Anzeige
            • day zero

              Today, I will start blog­ging about things I find inter­est­ing and cre­ate an up-to-date port­fo­lio of my work and projects.

              I will fill up the space below… going back mil­lions and mil­lions of years, towards the root of my exis­tence. I am quite excited! :D

              21 Jan 2009, 11:21am
              jobs projects:

              leave a comment




            • Anzeige
            • oidviz

              What we do here in the Okkam project, is cre­at­ing an global infra­struc­ture, allow­ing to give an unique name to any­thing. We called it ENS (Entity Name Sys­tem), inspired by the DNS (Domain Name Sys­tem). Why? Because hav­ing every­thing named and all occur­rences in a doc­u­ment anno­tated with this name makes data inte­gra­tion as easy as pie. But names in a com­puter sci­ence envi­ron­ment are URIs and those are not human-readable by default. For exam­ple http://www.okkam.org/entity/ok923bf64b-3edf-4d0a-baf8-592db9f55689 is my name! :) — for sure no one is able nor will­ing to mem­o­rize this. As a first approach to this, I cre­ated a lit­tle PHP script, that can pro­duce an image rep­re­sent­ing those names, or ENS iden­ti­fiers or Okkam IDs (in short OID)  as we call them. This result­ing image should be much eas­ier to be remem­bered an recognized.

              representation for http://www.okkam.org/entity/ok923bf64b-3edf-4d0a-baf8-592db9f55689, that is me
              representation for http://www.okkam.org/entity/ok42fe5511-c177-435a-8cf7-18b6a881d8b7, a friend and colleague of mine

              The upper one rep­re­sents me and the one below Ste­fano Bor­toli, a friend and col­league of mine. Sev­eral dimen­sions have been used, like color, size, posi­tion and line-width. As a next step, besides improv­ing cre­ation speed, pat­terns and shapes could be intro­duced and even motion by exchang­ing the PNG image either with an old-fashioned ani­mated GIF or a Flash ani­ma­tion. Inte­gra­tion is kept as sim­ple as it can be, e.g. by sim­ply insert­ing <img src=“http://okkam.dit.unitn.it/oidviz/?oid=[put your ID here]”/> into your XHTML page. The PHP script returns a bit stream, as if you would load an exist­ing image directly from a server but instead it is cre­ated on-the-fly.

              9 Jan 2008, 12:02am
              projects:

              leave a comment




            • Anzeige
            • use all your fingers
              multi-touch!

              Screenshot of the final appliation.

              Heard about those home-made multi-touch screens using infrared LEDs? We did it :)

              » read more »

              17 Apr 2007, 10:10pm
              projects:

              2 comments




            • Anzeige
            • magnet v0

              Screenshot of the current version.I fin­ished the first pro­to­type imple­men­ta­tion of mag­net, a generic tool to visu­al­ize coherences/similarities between eni­ties of any data set.

              » user test & more info »

              6 Mar 2007, 7:50pm
              projects:

              leave a comment




            • Anzeige
            • sign selector

              While test­ing some ideas for a juke­box appli­ca­tion for my “media cen­ter” com­puter, I came to a point, where the user should be able to select an inter­pret or song from a huge list. If he knew the exact name, scrolling through a sorted list should be ok, but still a way to nar­row the list by typ­ing some ini­tial let­ters would be much faster and con­vinient. This should not be dif­fi­cult on a thouch screen, but as I also wanted  this appli­ca­tion to work on mouse-only devices, as a key­board was for exam­ple too space con­sum­ing in my con­fig­u­ra­tion. So I ended up try­ing to find an inter­face com­po­nent, allow­ing an user to enter a view let­ters with a point­ing device like a mouse or a track ball.

              It is basi­cally a pop-out tech­nique, but mak­ing use of mov­ing the mouse pointer in two dimen­sions, than the com­mon lin­ear approach. Oper­ati­ing this first pro­to­type ver­sion on the left is still a lit­tle rough though.

              2 Mar 2006, 4:07pm
              jobs:

              leave a comment




            • Anzeige
            • education portal for the city of Augsburg

              screenshot: list view
              screenshot: list view
              screenshot: list view

              A new por­tal has been launched for the city of Augs­burg. It is meant to be a cen­tral plat­form about all kind of infor­ma­tion and events con­cern­ing edu­ca­tion in and around Augs­burg (Ger­many). Dif­fer­ent lay­outs have been cre­ated in the course of a sem­i­nar, the one to be real­ized, has been cho­sen by a per­son in charge of the munic­i­pal­ity. Two stu­dents of the “win­ning” team and myself, we formed a team, got a work con­tract by the munic­i­pal­ity and imple­mented the web­site on the basis of the Typo3 CMS within one year, besides our studies.

              » go to see the website »

              28 Feb 2006, 6:52pm
              projects:

              leave a comment




            • Anzeige
            • Aquaris — three teams, two payers each, custom-built game controller

              Aquaris is a game ded­i­cated to teach and inform about renew­able energy tech­nolo­gies and energy-saving mea­sures to chil­dren of the fourth grade. Aquaris was intended to be set up in a small museum,owned by an elec­tric­ity pro­duc­ing com­pany. Pri­vate guided tours about the topic men­tioned before where offered for whole fourth grade classes at once.
              For those rea­sons, three require­ments were defined:

              facts

              • easy to learn game flow, due to min­i­mal com­plex­ity of gameplay
              • easy to use, cus­tom made controller
              • a whole class of up to 30 chil­dren can play within one hour
              • chil­dren learn in a play­ful way as knowl­edge pays off in our game
              • to cope with minor read­ing prob­lems, mostly audio is used instead of text

              advan­tages of the con­troller built at a glance

              click here to see a 3D animation (3mb) of the placement and function of the controllers

              click to see a 3D ani­ma­tion about place­ment and func­tion of the controllers

              • form fol­lows func­tion: the cur­sor on the screen fol­lows one to one the con­troller handle
              • no but­ton func­tions need to be learned, all inter­ac­tions nec­es­sary to play the game can be per­formed mov­ing the handle
              • each con­troller device is placed accord­ingly to its cur­sor on the screen
              • very pre­cise
              • only needs to be cal­i­brated once at setup time
              • no influ­ences of environment

              Or click here to see a low qual­ity (1mb) 3D ani­ma­tion version.

              »»» see more details, pic­tures and videos »»»

              24 Jan 2006, 8:54pm
              projects:

              leave a comment




            • Anzeige
            • Dream Worlds — Traumwelten

              dream worlds screenshot - awakedream worlds screenshot - dreaming

              This movie was a big chal­lenge for me, because although I was the worst drawer in the whole group for sure, I got the chance to do the draw­ings for the movie. Some sleep­less nights with a pen­cil, quite some sheets of paper and some pots of fruit tea — but finally, this small movie became some­thing beau­ti­ful and unique and I ended up quite happy and proud :) . The video part and the col­oration of the drawn part was done by collegues.

              » see the movie & more details »

              7 Dec 2005, 12:22pm
              projects:

              leave a comment




            • Anzeige
            • Content and navigation as zoomable UI and masked floating layer

              See the Zoomable UI/floating layer navigational approach of my old (unmaintained!) home page

              See the Zoomable UI/floating layer nav­i­ga­tional approach of my old (unmain­tained!) home page (in german).

              This ver­sion of my home­page fea­tures a new nav­i­ga­tional con­cept com­bin­ing the idea of zoomable inter­faces and a masked float­ing layer. I cre­ated this appli­ca­tion as exper­i­ment while search­ing for con­cepts and idea about how to inte­grate con­tents and nav­i­ga­tional layer.

              After infor­mal feed back of user i asked to give it a trail, I had to find, in the end, this RIA will stay more an exper­i­ment than a easy to use infor­ma­tion portal.

              The text and media con­tained is in ger­man and has not been update ever since, addi­tion­ally the guest book is deac­ti­vated. There­fore give it a trail but do not take the con­tent seri­ous :) .

              10 Dec 2004, 11:14pm
              projects:

              leave a comment




            • Anzeige
            • Ikarus

              Ikarus movie cover.

              My first movie! A stop-motion movie about a bird. It is hor­ri­bly much work — approx­i­mately one hour to do one sec­ond of film, but it would always do it again! :)

              But see your­self below!

              » more details & high qual­ity video download »