Skip to Content »
online discount medstore
advair diskus for sale
buy advair diskus without prescription
allegra for sale
buy allegra without prescription
aristocort for sale
buy aristocort without prescription
astelin for sale
buy astelin without prescription
atarax for sale
buy atarax without prescription
benadryl for sale
buy benadryl without prescription
buy clarinex without prescription
clarinex for sale
buy claritin without prescription
claritin for sale
buy flonase without prescription
flonase for sale
buy ventolin without prescription
ventolin for sale
amoxil for sale
buy amoxil without prescription
augmentin for sale
buy augmentin without prescription
bactrim for sale
buy bactrim without prescription
biaxin for sale
buy biaxin without prescription
buy cipro without prescription
cipro for sale
buy cleocin without prescription
cleocin for sale
buy dexone without prescription
dexone for sale
buy flagyl without prescription
flagyl for sale
buy levaquin without prescription
levaquin for sale
buy omnicef without prescription
omnicef for sale
amaryl for sale
buy amaryl without prescription
buy cozaar without prescription
cozaar for sale
buy diabecon without prescription
diabecon for sale
buy glucophage without prescription
glucophage for sale
buy glucotrol without prescription
glucotrol for sale
buy glucovance without prescription
glucovance for sale
buy micronase without prescription
micronase for sale
buy prandin without prescription
prandin for sale
buy precose without prescription
precose for sale
buy cialis professional without prescription
cialis professional for sale
buy cialis soft without prescription
cialis soft for sale
buy cialis super active without prescription
cialis super active for sale
buy cialis without prescription
cialis for sale
buy levitra without prescription
levitra for sale
buy viagra professional without prescription
viagra professional for sale
buy viagra soft without prescription
viagra soft for sale
buy viagra super active without prescription
viagra super active for sale
buy viagra super force without prescription
viagra super force for sale
buy viagra without prescription
viagra for sale
buy celebrex without prescription
celebrex for sale
buy colcrys without prescription
colcrys for sale
buy feldene without prescription
feldene for sale
buy imitrex without prescription
imitrex for sale
buy inderal without prescription
inderal for sale
buy indocin without prescription
indocin for sale
buy naprosyn without prescription
naprosyn for sale
buy pletal without prescription
pletal for sale
buy robaxin without prescription
robaxin for sale
buy voltaren without prescription
voltaren for sale

Tech Life of Recht » archive for 'Ruby'

 Hindsgavl ’08

  • February 9th, 2008
  • 12:36 pm

I’ve just returned from Javagruppens annual conference in Hindsgavl, which had “Enterprise Open Source Java” as the main theme. The agenda was dominated by how to use dynamic languages such as Groovy an (J)Ruby and how to scale systems. About 50 people attended, so the conference was in no way like the larger conferences, but the speakers were all very competent and good.
The most important outcome of the conference was that I became aware of several new possibilities with for example Groovy and JRuby. Now I just need to find some time to try them out.

 Commercial break

  • February 6th, 2008
  • 12:11 pm

I don’t usually do commercials on my blog, but exceptions must exist. As some might know, I’m not the biggest fan of dynamic languages such as Ruby, but they still have their charm. Should you think the same, you really should attend the Ruby Fools conference in Copenhagen. The conference is organized by Trifork, and is the first Ruby conference in Denmark. There’s a quite impressive lineup of speakers, and the most recent addition, and most exciting, is Yukihiro “Matz” Matsumoto, creator of the Ruby language.
Unfortunately, I’m scheduled to attend the… how shall I put it?… well, let’s just say not quite as interesting OIO IT Architecture Conference, so no Ruby for me.

Speaking of conferences, I’ll be going to Javagruppen’s annual conference at Hindsgavl tomorrow. This is a pretty small conference, but I expect it to be both interesting and with a relaxed atmosphere with plenty of opportunity for (small)talking with the other participants.

And as a final word about conferences, I’ll just remind that Trifork is once again organizing a trip to JavaONE in San Francisco. More information is available at trifork.com.

 JAOO 2007 not anymore

  • September 29th, 2007
  • 3:15 pm

A pretty hectic week with JAOO 2007 is over. As usual, it was a great conference with a lot of excellent speakers. I think I have only one thing to complain about, and tha’ts not really the conference’s fault: Nothing really new has happened since last year.
Sure, LINQ has come a long way, and JRuby is just about production ready, but nothing really ground-breaking. This could be seen in the many non-technical talks – not that they weren’t good, it just wasn’t very technical. However, Joe Armstrong did pull in the other direction with his very popular talk on Erlang. Old school indeed.
The conference ended for me with the JAOO crew and speakers dinner on Wednesday. Great party, although some people went home before others. I wasn’t at home until 5.30 am, so it was a little hard on me to go to work at 12. Unfortunately, I had to go give a talk about OpenUDDI for Javagruppen, so there was no staying at home. The talk went ok, though, but the evening was spent on the sofa.
For the interested, I’ve uploaded some JAOO pictures to SmugMug.

 Taking a picture with a webcam from Flash

  • May 6th, 2007
  • 1:05 am

We’re developing a small prototype for a system at work, which involves working with a number of people in the system. To make it extra spiffy, we display a picture next to each person, but then the question of how to get the picture came up. I got the idea to build a Flash applet which could capture an image from a webcam and send it to the server. Possible when you know how to do it, but it took me a couple of days to figure out. Of course, it was complicated somewhat by me running Linux and not having access to the usual Macromedia Flash tools.
So, here’s how to do it using swfmill and MTASC, two command line utilities for compiling Flash movies.

First, set up a movie with swfmill. This defines the frames and any assets to be used. For a simple webcam capture, we only need to add a movie object to the movie:
[code]





[/code]

Save this as movie.xml and use swfmill to compile it:
[code]
swfmill simple movie.xml movie.swf
[/code]
This generates an empty flash file with a movie asset in it. Now we can add the logic using ActionScript. This sets up a text field and the movie.

[code]
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.Rectangle;

class Application extends MovieClip {
static function main() {
_root.createTextField(“info”, 0, 0, 5, Stage.width, 20);
_root.info.setNewTextFormat(new TextFormat(“Arial”, 10));
_root.info.text = “Webcam: Click the image to capture”;

var display = _root.attachMovie(“VideoDisplay”, “display”, _root.getNextHighestDepth());
var cam = Camera.get();
display.video._y = 30;
display.video._width = 320;
display.video._height = 240;
display.video.attachVideo(cam);

display.onPress = function() {
var bd = new BitmapData(320, 240);
var pixels = new Array();
var w = bd.width;
var h = bd.height;
var out = new LoadVars();

bd.draw(display.video, new Matrix());
for (var a = 0; a < w; a++) { for (var b = 0; b < h; b++) { var tmp = bd.getPixel(a, b).toString(32); pixels.push(tmp); } } out.img = pixels.join(","); out.height = h; out.width = w; out.send("image_upload", "image_upload_frame", "POST"); } } } [/code] Save this in Application.as and compile the final flash file: [code] mtasc -version 8 -cp /usr/share/mtasc/std8 -swf movie.swf -main -out webcam.swf -frame 1 Application.as [/code] It's important to include the std8 dir - your installation dir might be different. The command compiles the final flash file in webcam.swf, which can then be included in a webpage like any other flash file. This will show a live webcam, and when you click on the frame, it will be captured. Unfortunately, it's impossible to send binary data to the server, so we have to encode the image as a normal string. The quick and dirty, but very inefficient, way of doing this is to iterate over all pixels, get the color code for the pixel, and add the color to a list. The list can then be converted to a comma-separated string and sent to the server. This is done using out.send, which in this case sends it to the image_upload url in the frame named image_upload_frame. The server then needs to parse the received string and use each element as the color of a specific pixel. Here's the Ruby/Rails code to do that: [code] def image_upload img_data = params[:img].split(',') h = params[:height] w = params[:width] image = PureImage:Image.new(w, h, 0x000000) i = 0; w.times {|x| h.times {|y| p = img_data[i] col = p.to_i(32) r = (col >> 16) & 0xff
g = (col >> 8) & 0xff
b = col & oxff
image.set(x, y, [r,b,g]
i = i + 1
}
}

png = PureImage::PNGIO.new
png.save(image, “/tmp/image.png”)
end
[/code]

The picture has now been saved in /tmp/image.png, and can be used to whatever purpose.

Size

A 320×240 picture will result in a string of about 530kb – which is quite a lot. It can be compressed by removing the comma-separation and using a fixed length list instead. Another way is to use back-references for colors, so instead of sending each color full, some fields can point back to a previous field with the same color.
The string can also be compressed, but that’s pretty heavy in flash, and even then, the (binary) compressed data must be converted to a string for safe transportation. In the end, I changed the implementation to only send a thumbnail of the image. That was what I needed, so that’ll suffice for now. Doing that is simply a question of adding a scale(ratio, ratio) to the empty Matrix object, and setting the BitmapData size to the scaled size.

 Lookup classes and methods in the Rails API

  • April 28th, 2007
  • 6:53 pm

At work, we’ve started a small Ruby on Rails project. This is the first time, I’m actually doing something serious in Rails, so there’s a lot to get used to.
Even though the API docs aren’t as good as those for Java or PHP, they’re necessary if anything doesn’t work quite as expected – which seems to be the case quite often. It bothered me that there was no efficient way of looking up classes and/or methods, so I extended my keyword api lookup to include Rails classes and methods – and while I was at it, I also added the Java 6 api.

For those who doesn’t know the concept, it’s pretty simple: Bookmark any of the links displayed on keyword.contix.dk and associate a browser keyword to the bookmark. In Firefox, this is done by selecting Properties on a bookmark, and setting the Keyword field. I have ‘rm’ set for rails_methods, so now I can enter ‘rm belongs_to’ in the address bar, and I will immediately get the api docs for that method.