Authentication with Jersey 2

When creating various web services such as a REST service authentication tends to become relevant sooner or later. In some cases you want to integrate into existing services such as Google+ using OAuth in other cases – like here – you would rather have your own security schemes.

In searching for ways to do this I ran into a lot of older articles, which although being useful, often provided slightly outdated information or only half examples. This aims to provide a fully working basic example, with a complete source code for assistance. Basic example here means just enough to prove and show the concepts and enough to be used as a start for more advanced code.

Continue reading

Raspbery Pi B+ IDE cable connection

GPIO extension board

GPIO extension board

Wanting to play with electronic circuits an Raspberry PI seemed like a good choice to by. And of course you get the most powerful version (B+), an breadboard and a GPIO connector plug for it. Awesome you’re good to go… or are you? The setup bought was almost the one on the picture to the right. With one tiny exception, the newest version of Raspberry Pi has 40 pins whereas the older versions has only 26, and of course  the plug does not fit. Good new is the first 26 pins are the same on the B+ as it’s predecessor, so home made solutions is an option :)

Continue reading

PhoneGap plugins for Android

Finally I pulled myself together and got the PhoneGap plugin example from PhoneGap Day ported to Android. I discovered that there’s been some updates, so if I get access to a Mac somehow I might update the iOS code too.

PGPlugins-android on GitHub

Original post: Doing PhoneGap plugins

Pysmell revived

Logo for pysmell

Logo by Teresa Breinholdt

I finally started to do some work on the Python code tool pysmell. The current status is that almost all tests pass with the compliant ast module over the deprecated compiler.[ref] Only part that still needs work is the parts that ask for details at a line-number to get the current context.

Hopefully this tool will come to a lot of use for people writing plugins for code completion and other tools making use of the current context. Also the new parser will hopefully be easy to port for Python 3 (haven’t checked yet), which would give a clear and precise tool to use for future Python development too.

Currently the project  is getting closer to what is intended of improvements, and hopefully I’ll call it ready for an release of some kind. Next steps is to pass the missing tests and then a major cleanup of the new “coderfinder” (which still contains legacy code).

JavaScript testing – Requests

Dog is testing the the crackers for poison.

When testing JavaScript you might have run into the problem of testing requests, such as XmlHttpRequests (XHR). You might also have run into an awesome way of testing it such as the one provided by Buster.js (which in turn uses Sinon.js). These tools are really powerful and awesome, if you haven’t tried them yet go do it.

One problem though. A unit test is supposed to be as implementation independent as possible, and testing XHR is rather tightly bound to the implementation. If I suddenly start requesting resources by adding script tags to the dom my tests will fail even though the solution is solid. We don’t want that.

Continue reading

New computer

The time had to come, Mobile Ambitions Aps wants their computer back :) Although it will be missed there’s a great thanks to lending it to me even though I didn’t work there any more.

Due to this a new computer has joined the family here, optimized for effective building and use of virtual machines, this will hopefully assist me in my development in the years. While waiting for this baby to be entirely ready I’ll be improving my testing, so I can get RfTouch continued, so stay tuned :)

RfTouch sees light

Fatal error: Uncaught Error: Call to undefined function split() in /usr/home/rohdef/www/wp3/wp-content/pg4wp/driver_pgsql.php:526 Stack trace: #0 /usr/home/rohdef/www/wp3/wp-content/pg4wp/driver_pgsql.php(134): pg4wp_rewrite('DELETE FROM wp3...') #1 /usr/home/rohdef/www/wp3/wp-content/pg4wp/core.php(34) : eval()'d code(1741): wpsql_query('INSERT INTO `wp...', 1) #2 /usr/home/rohdef/www/wp3/wp-content/pg4wp/core.php(34) : eval()'d code(1645): wpdb2->_do_query('INSERT INTO `wp...') #3 /usr/home/rohdef/www/wp3/wp-includes/option.php(410): wpdb2->query('INSERT INTO `wp...') #4 /usr/home/rohdef/www/wp3/wp-includes/option.php(676): add_option('_transient_time...', 1718453586, '', 'no') #5 /usr/home/rohdef/www/wp3/wp-content/plugins/embed-github-gist/embed-github-gist.php(137): set_transient('_transient_embe...', '<script src="ht...', 86400) #6 /usr/home/rohdef/www/wp3/wp-content/plugins/embed-github-gist/embed-github-gist.php(164): embed_github_gist('4297951', 86400, '1', 'app.js') #7 /usr/home/rohdef/www/wp3/wp-includes/shortc in /usr/home/rohdef/www/wp3/wp-content/pg4wp/driver_pgsql.php on line 526