daily desasters: blackberry

Posted by crux on June 29, 2007

I bought a D-Link DWL-2100AP access point yesterday. Only to find out, after setup!, that it is was broken. It could be configured but returned to factory defaults all by himself after every two minutes. Not useful.

Blackberry ExceptionToday my beloved modile mail device came up with a new suprise. “…message queue overflow”, pardon? What is it this thing was designed for? god gracious, it’s Java, how hard can it be to simply check for such things?

Basically approx. 15 times per week i got kicked off the connected world by the blackberry messing up and reporting a SIM card error. Of course silently. It goes like, you are slowly calming down for just not beeing phoned or mail-molested for the last 2 hours only to find out later that actually hell broke loose and it was only that just nobody could reach you because of your blackberry got goobled up by SIM card errors.

All this troubles are strictly mine. These gadgets are functioning perferctly once they are out of my reach, nothing can be blamed on them or their makers.

p.s.: switch-off, switch-on brings blackberry back to normal. 37 seconds only, and helps you train your pin code memory.



Technorati Tags: , , , ,

“It’s all changing so fast today!?” Bullshit!

Posted by crux on June 27, 2007

a1.jpgoh boy, i can hardly tell how much am i annoyed by this unknowing, uninspired, boring minds which walk around me sometimes and are thrillingly giving me their first hand reports of the insights they think they gather at the fast and vivid edge of the dazzling world of the internet and its hyperspeeded and -connected  communities. no links here! you know, twitter and friends.

and now, to the left(or above), you see, “The Answer Machine”, published in 1964(my birthyear by the while), on paper i guess. What is it? It is describing Google(link! try it!)

pause…

it took a fu….g 40+ years to build it. that was fast man, yep, see me gasping. and now? what’s next? The original star trek aired in 1966, which means there are a couple of things to come yet.

please read “Google as predicted in 1964″ for the full story where Web Owls combined the sources to match google with its vision.

and then, please, go back keep going to build the stuff which is already there according to some.

oh, and one more thing. What a relief to work with whom im working with and that i could put an end to consulting with the clients which where so…, hmm, to harsh a word to say here, but you know.

Technorati Tags: , ,

interpolate hex color vectors in one line of ruby

Posted by crux on June 27, 2007

which color lies halfway inbetween #ff00ff and #00ff00 you ask?

One line of ruby code can interolate two color vectors like they are usually found inside css files, like: body{background: #ff00ff; color: #00ff00}.

%w{ff00ff 00ff00}.map{|a|a.scan(/../).map{|b|b.hex}}.inject{|c,d|(0...c.size).each{|i|c[i]+=d[i]};c}.map{|e|"%02x"%(e>>1)}.join

@UPDATE:
#121 character solution by schmidt(http://www.nach-vorne.de)
%w{ff00ff 00ff00}.map{|a|a.scan(/../).map{|b|b.hex}}.inject{|c,d|c.size.times{|i|c[i]+=d[i]};c}.map{|e|"%0x"%(e>>1)}.join


Answer -> 0×7f7f7f. sure, there must be a shorter version. Can you show it to me?

next step: color animations and gradients and HSR colorspace conversions mayby.

have fun



Technorati Tags: , , , , , ,

assert_raises_kind_of with Module error tagging

Posted by crux on June 24, 2007

this sunny sunday afternoon i was putting together some utility code(stupid me!) to do some remote blogging from the shell or the cosy inside of my vim editing session. This for some later time, but while i was going on with my test-driven/test first development i hit the problem of missing a test to check for the base class of my errors. I wanted to:

assert_raise(StandardError) { @blog.find_post(:postid => 123456789) }

to generally check for any kind of trouble bubbling up but it was not working as expected. Instead i got nasty Failure reports:

1) Failure:
test_find_post(XMLRPCTest) [mylib.rb:83]:
<StandardError> exception expected but was
Class: <XMLRPC::FaultException>
Message: <"Sorry, no such post.">

I suspected XMLRPCTest::FaultException to maybe not beeing derived from StandardError, but that was not the case. A look in the ruby documentation and the ruby-talk thread confirmed:

assert_raise(*args) {|| ...} is checking for the EXCACT exception type only!

How was it for you?

On the ruby-talk mailing list there was a little discussion about this topic and i pretty much agree with all the +1 sayers on the list. Edwin Fine propsed adding his own assert_raise_s method the Assertions class. You easily get into muddy waters with opening standard ruby classes for some duck-typing but reverting to:

assert_raise(XMLRPC::FaultException) { @blog.find_post(:postid => 123456789) }

was not an option. This would expose way to much implementation detail to this very high level coding of the very first tests so early in the project. So I was using the source, as yoda said and found another solution for me.

Modules as base class arguments to assert_raises

After i read Edwin’s post i checked the source for def assert_raise and learned that this method is actually checking for some kind of exception base class. The argument to assert_raise is an array of exception types. assert_raise does partition this types into Class and Module.

The assertion_raise checks for Class types is exact, but the Module is not(can’t be). They are checked with an is_a? condition - there can’t be no object instance of module type or course.

My original test therefor simply fails because StandardError is not a Module but a class. The XMLRPC::FaultException implementation is not mine but it is bubbling through my lib which i’m testing and this is precisly the condition i want to write tests for.

“Module tagged” exceptions and assert_raises_kind_of

First i wrote an empty tagging module for lib to tag all Errors and exceptions coming from my lib:

module MyLib
    module Error; end
end

Now i can tag all exception from some deeper laying code with my Error module:

begin
    ...
rescue => e # errors bubbling from the underworld
        # tag it
    class << e; include MyLib::Error; end 
        # throw it
    raise e
end

Voila, and now i can write:

assert_raise(BlogMist::Error) { @blog.find_post(:postid => 123456789) }

and finally got what i wanted but you’re milage may vary. Basically this gives me a way to create some kind of folksonomy of errors coming from my library. Don’t know yet where this might lead me, but hey, ruby is the best for protoyping and playing around!

Don’t be lazy!

Testing for error base classes instead of pricise error handling is not to make you lazy! As discussed on the forum thread it is to start with tests early on and being able to refine error condition testing over time.

Technorati tag: , , , ,

Erlang makes it easy to parallelize our programs.

Posted by crux on June 22, 2007

In Erlang, there is no mutable state, -> there is no shared memory, -> and there are no locks. This makes it easy to parallelize our programs.

Page 32, Pragmatic Erlang, Software for a concurrent World

starting to love it.

Technorati Tags: , , ,

bookmarking deluxe with AddThis!

Posted by crux on June 14, 2007

What techcrunch is doing can’t be wrong, not totally wrong at least i hope. So lets see, AddThis! seems to finally solve the bookmarking issue once and for all by just taking it out of your hands completly and leaving the freedom of choice in the hand of the readers. It took me less than 2 minutes to click through their “Get your free widget” site and i had my personal bookmark button(test page).

And than, you get statistics pages for free, (techcrunchs, not mine though, sigh):
…and as you can see from the charts, AddThis does RSS Feeds too.

Is this all? Nope, there is more, of course a AddThis! Wordpress Plugin is available as well. But you go figure that out for yourself, i guess.

have(a lot of) fun
cheers

ps.: and(thx to wp plugin) try the bookmark button under this article ;-)


Technorati Tags: , , ,

sharper images for foto-foo

Posted by crux on June 14, 2007



form the “competition drives innovation” department i would like to tell you about the foto-foo (of my company) update for sharper images, but see for yourself!

nobody blogged about us(sigh), but with cameroid and phozi two other sites similar to us got mentioned on techcrunch and elsewhere. And as competition drives…, you know, we are glad to have them around. To keep us motivated. So we got sharper images for today, lets see whats next? Ideas?

Technorati Tags: , , , , , , ,