“Der Computer wird zum Teil der Persönlichkeit.”, coole jungs
spiegel|online: “Vorbeugendes Schnüffeln ist tabu - es muss Gefahr für Leib und Leben bestehen, bevor der Staat Festplatten ausspähen darf….: Der Computer wird zum Teil der Persönlichkeit.”

genau! coole jungs, so geht das. damit waere das dann mal geklaert. nur schade das schaeuble jetzt nicht mehre meine backups macht.
Technorati Tags: security, terror, orwell
disable DIGEST-MP5 to xmpp4r connect with your openfire jabber server
in my typical love and hate relationship with opensource (aka open sore) i stumbled over SASL induced configuration pains again today. To cut a long story short, just disable DIGEST-MD5 sasl out on the openfire jabber server and immediatly xmpp4r works like a charm for me.
How to disable digest md5 on Openfire? Not so easy to find out and in a beautiful amateuristic way lots of the advice you find is actually plain wrong.
Put this into your openfire.xml:
<sasl><mechs>PLAIN</mechs></sasl>
<!-- but put it inside the <jive>...</jive> tags somewhere -->
, because when you know the name of the right openfire property, and are able to read(in openfire.xml): This file stores bootstrap properties needed by Openfire.
Property names must be in the format: "prop.name.is.blah=value"
That will be stored as:
<prop>
<name>
<is>
<blah>value</blah>
</is>
</name>
</prop>,then you easily know that <sasl><mechanisms>….</mechanisms></sasl> is bogus.you usually find your openfire.xml at
${OPENFIRE_HOME}/conf/openfire.xml. and you must restart the the server afterwards, like /etc/init.d/openfire restart.there is another option, like making the xmpp4r implementation don’t even try to use the digest-md5 mechanism which the openfire server offers. Just disabling DIGEST-Md5 acceptance at
/opt/local/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/lib/xmpp4r/client.rb:108 in Jabber::Client.auth does work, but i will try to get it implemented a littel more selective before posting a xmpp4r fix here. Who knows, there even might be two SASL DIGEST-MD5 implementations on this planet which actually do match? i doubt it, an even then, i don’t care. vote for alt.source.sasl-must-die-die-die andhave fun
Technorati Tags: xmpp, xmpp4r, openfire, jabber, sasl, digest-md5
Web-Scale Computing is changing the economics of doing business online.
the title was actually quoted from the the Amazon Web Services Blog. That post reports on a new option of running a version of the Wowza Flash Streaming Video server as a virtualized AMI instance from insides the Amazon EC2 cloud.
What this all means? You get a real cheap way to build you’re own streaming network. For private videos YouTube will to the trick of serving your private holiday videos to the fans and you don’t have to bother for neither price nor capacities. But with such a thing as a Wowza server on EC2 you can now build your very own YouTube on demand. And it’s running on small pockets too. For only 5$ a month you get the right to do so and beyond that you pay per-hour and bandwith.
But even besides the economics, Wowza brings more to the party. It is a real good piece of software it seems. I worked with it just end of last years and all operations where smooth. Before Wowza choosing a streaming server sometimes to me felt more like “die Wahl zwischen Pest und Cholera”(or Hobson’s choice as i learned). I worked with Wowza last year and it was breeze of fresh air. I think i read somewhere it was written by some old SGI dudes. Ah, good old times, but that is another story(Personal Iris anyone?)
Adobe, the original? Expensive, old-school. heavy. not sexy. Red5 Open Source? Good luck i wish. I never had. Quicktime? Don’t know about QTSS but the DSS variant of it failed on me badly whenever i needed it and on top of that it uses PERL! to serve its admin HTML pages, uha, shudder.
Some fellows became even so desperate as to start recoding things from scratch and try writting an RTMP* server in Erlang. As i said elsewhere, Erlang, power- and beautiful concepts, but such an ugly language. Again, good luck i wish. If someone might want to spent a couple of month on trying to combine Erlang concepts and ruby language on writing a scalable stand-in replacement for the proprietary FLash streaming video server solutions than please give me call. Would be a nice project.
Technorati Tags: wowza, ec2, aws, flash, streaming
googlecharts 1.0.0 gem (includes URI bugfix) released
Matt Aimonetti released a 1.0.0 version of his googlecharts gem which includes my URI bugfix i blogged about earlier. Me haven’t had so many opensource contributions yet, feels good though.
Technorati Tags: googlecharts
googlecharts gem URI::InvalidURIError fixed
Yesterday i was wondering who is right about the URI and as it turns out the culprit is the googlecharts gem. The RFC defines ‘UNWISE’ characters, the ruby URI implementation seem to correctly fail on them and the Google API defines the just the URI, not how it has to be encoded/escaped.
I posted the scary URI regex from the ruby open-uri package which fails to grasp the Google Charts URIs. Debugging such thing is no fun so i went for a quick fix instead and actually could find it in the googlecharts gem. Just replace:
jstize(@@url + query_params.join('&')) from ...ruby/gems/1.8/gems/googlecharts-0.2.0/lib/gchart.rb with:
unwise = []#%w({ } | \ ^ [ ] `)
query_params.each do |p|
unwise.each { |c| p.gsub!(c, "%#{c[0].to_s(16).upcase}") }
end
jstize(@@url + query_params.join('&'))this escapes the ‘|’ (pipe) characters which were causing the exception, like this one:
/opt/local/lib/ruby/1.8/uri/common.rb:436:in `split': bad URI(is not URI?): http://chart.apis.google.com/chart?chdl=requests(cached)|requests&chd=s:Fb9JJfgZ,Fb9KJfgq&cht=lc&chs=300x200 (URI::InvalidURIError)
Technorati Tags: ruby, googlecharts, google, gem, fix
ruby google charts api wrapper, RFC2396 and ruby open-uri woes
UPDATE:found a simple fix/hack for the googlecharts gem
Uhh!, this for sure is one of the more scary regular expressions you normally encounter. Its URI::REGEXP::PATTERN::ABS_URI from uri/common.rb:137. Looks complete, doesn’t it? And still it fails to grasp my seemingly valid Google Charts URL which is: http://chart.apis.google.com/chart?chdl=requests(cached)|requests&chd=s:Fb9JJfgZ,Fb9KJfgq&cht=lc&chs=300×200
It’s the googlecharts gem which creates this URL here(not me!), but than bails out when trying to download an image from it.
/opt/local/lib/ruby/1.8/uri/common.rb:436:in `split': bad URI(is not URI?):...Now, who is right? Google? The URI RFC2396? The googlecharts gem? Debugging such things are the less thrilling moments in life. Besides that, even when bailing out on this one, the googlecharts gem feels good. It offers efortless chart creation and basic cases are already covered, the advanced stuff will follow i think. Go check it out when in search for an easy charting solution. Googlecharts gem felt better to me than the gchartrb which is another wrapper for the same service, but your milage may vary.
have fun
Technorati Tags: ruby, googlecharts, api
‘||’ unequal ‘or’
some simple ruby code:
a = nil || 23
b = nil or 23
puts "#{a==b}"
prints: false. Please explain! I mean explain in the sense of why not how it happens. Is it meaningful to put ‘||’ and ‘or’ on a different level in the precedence hierarchy?
UPDATE: i checked a couple of times before i posted but still can’t reproduce it a day later. don’t know what was different yesterday, Jruby? confused, … i seem that puts "#{a == b}" prints true. today.
Get yourself organized with GTD, from the shell
Get yourself organized with GTD, from the shell
promoting GTD might be surprising from me because it’s kind of contradicting myself. I have great doubts in any tool claiming to solve the problem for you, but this time it might be different. Peter Copper drove my attention to EarGTD of Gregory Brown.
EarGTD is a console application for David Allen’s GTD method. It is a good example for a Ruby outside of Rails application which still uses the ORM powers of ActiveRecord.
The commandline is where i spend lots my productive time and having a framework for database driven applications could be boost. Actually i already made myself a google console app(g-module alpha gem), example:
$ google :count earGTD
158 results for ["eargtd"]
$ google :lucky earGTD
gives you google result on the commandline.
Adding ActiveResource/database access to my console apps is a big help for me. “In the Beginning was the Command Line” and i start seeing a pattern here that i like.
Extending GTD
I will now go using EarGTD to find out how it works for me but there are 3 things would like to add i find time to do so:
1. keeping removed tasks in the database and add a done flag to them. This could make gtd a good tools for automated reports.
2. make a distributed group version where a bunch of people works on the same dataset. This coule make it a good sync tool for a group of coders.
3. to project and context add a person attribute, but that is actually only a sub-feature of the previous point.
4. must have: twitter connection!
install notes
Me beeing to lazy to gem’ify it just added:
require "fileutils"
FileUtils.cd(File.dirname(FILE))
$:.unshift "."
to the earGTP script itself and made an
alias gtd=~/EarGTD/earGTD
so i now can call it form anywhere. e nu?
gtd + "write better posts [blog] <writing>"
cheers
interpolate hex color vectors in one line of ruby
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: ruby, coding, puzzle, css, hex, color, interpolation
assert_raises_kind_of with Module error tagging
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: ruby, ducktyping, assert_raise, test-first,