Archive for the 'Work' Category

Wed
22
Aug '07
me goes google
by Frank Spychalski filed under Work

A few days ago I received a very nice birthday present from Google: a job offer for a position as software engineer in Munich. Well, today I handed in my resignation ;-)


Fri
5
Jan '07
Difficult start with cakephp
by Frank Spychalski filed under Cakephp, PHP, Work
a cake
by andy47

I’m slowly learning to work with cakephp, but it’s damn hard.
The manual is confusing. I nearly gave up, when I found the blog tutorial in the appendix. Dear authors, this should be chapter 1 or 2! The wiki was removed, but at least some of the content can still be found in the google cache. The Bakery is a mess of articles. some of them cluttered with broken links.[1]

So far I found only two pages with “Rails-quality” documentation: Learning from the CakePHP source code - Part I and Part II.

I someone knows other good documentation for cakephp, please leave a comment.

Update:
I forgot to mention that it isn’t even decided yet, that I will use cakephp for my upcoming project. I’d love to hear more about other Rails-like frameworks in PHP. Right now I’m investigating Symfony, which looks promising.

[1] these broken links should let you download code, but the code is provided in the box below, so it’s only an annoyance.


Sun
31
Dec '06
Tab-completion and syntax-highlighting for irb
by Frank Spychalski filed under Ruby
wirble shell example on dark background
wirble shell example on light background

Please forgive me if I state the obvious, but I just found out about this great gem called Wirble. Wirble adds tab-completion and syntax-highlighting to irb.

Installation is really simple, just install the gem (gem install wirble) and add this to your .irbrc:

require 'rubygems'
require 'wirble'

Wirble.init
Wirble.colorize

For a console with a dark background everything looks pretty good but I prefer a light background where yellow is not easy to read. Thanks to the really helpful README the solution was easy to find. I had to add a few more lines to my .irbrc to change some settings from yellow and white to something readable in my console.

require 'rubygems'
require 'wirble'

Wirble.init
Wirble.colorize

colors = Wirble::Colorize.colors.merge({
  :object_class => :purple,
  :symbol => :purple,
  :symbol_prefix => :purple
})
Wirble::Colorize.colors = colors


Sat
23
Dec '06
Changes…
by Frank Spychalski filed under Work

Yesterday was my last day at Schlund+Partner. I have a few days of vacation left and next year I will start working for Gameforge AG.

I’m glad that I was able to quit at S+P without burning any bridges. My former manager told me that “… if it is not working out, I will happily take you back…”.

I will continue to write software, but the tool set will change: from Java, EJB and way too much of XML to PHP (probably with cakephp) and I will try to sneak in some Ruby every once in a while :-) The thing I like most about my new job is that I will start working on a brand new project. I spent the last year working on two projects started by others, which droppen into my lap and I had to get them into production shape.

I hope I will be able to talk more about my new project next year. But I want to check with my new bosses first.


Tue
12
Dec '06
Magic Ruby Hacker mug
by Frank Spychalski filed under Fun, Ruby

ruby hacker logo in courier

There is a CafePress shop for RubyHacker stuff with a few nice thingies. But I wanted something else :-)

magic mug

A shop (fotokasten.de) sells all-black mugs which only reveal the image when something hot is inside. Therefore I needed my own RubyHacker image and couldn’t find one online. To save everybody else the work, here’s my result.

I will post images of the mug when I have it :-)

Update:
I made a mistake and put the wrong image online. Fotokasten does not accept gif (which is pretty lame but I cannot change it). Changed the image to a jpg.


Tue
24
Oct '06
Ruby search engine
by Frank Spychalski filed under Ruby

When I read that Google offers customizable search engines, I spent a few minutes to create one for my usual ruby searches. It can be found here. Right now, it doesn’t look very nice and I added only about a dozen sites, but I will add more and fine-tune the searches in the next few days. If anybody else wants to contribute, be my guest…

Update:
Google provides a bookmarklet called Google Marker, which helps adding new sites. This morning I added about 20 new sites and tweaked the searches.

Update:
This morning I added a few more pages and changed the default behavior from “Search the entire web but emphasize included sites.” to “Search only included sites.”.

Update:
3 contributors have signed up and I added a lot of new sites. Go visit Ruby & Rails Search and test it.


Mon
2
Oct '06
Profiling Rails Unittests
by Frank Spychalski filed under Rails, Ruby

Thanks to a hint by Chris Mear on the Ruby on Rails Mailinglist I had an idea how to add profiling my unittests. It’s a simple 3 step process and adds just 5 lines of code to your unittests:

Step 1:

require 'profiler'

Step 2:

 def setup
  # ...
  # your normal setup code
  # ...
  Profiler__::start_profile
 end

Step 2:

 def teardown
  Profiler__::stop_profile
  f=File::new("#{RAILS_ROOT}/log/profiler.#{name() + ' ' +
              Time.now.strftime('%Y-%m-%d %H:%M')}.log", 'w')
  Profiler__::print_profile(f)
  # ...
  # your normal teardown code
  # ...
 end

As you probably guessed from the code, this will log the profiling results into a file for each test. But beware: this is VERY SLOW! The tests I was profiling took 9s without profiling and 1267s with profiling… But slow profiling still beats no profiling :-)

If you are looking for memory profiling, there is a nice article by Scott Laird on Memory leak profiling with Rails.


Mon
7
Aug '06
Playing on the CodeGolf Range
by Frank Spychalski filed under Computer, Fun, Ruby, articles

picture by bigpru

I stumbled over this funny site called CodeGolf.com and tried my luck on the first problem (actually it’s the sixth, but it was the last and therefore appeared first on their page - confused?) Writing a Brainfuck Interpreter:

The brainfuck language uses a simple model of a computer consisting of an array of memory cells, a movable pointer into the array, an output stream, an input stream and the program itself. The program is formed from a sequence of the below commands :

  • > - Increment the pointer to point to the next cell to the right.
  • < - Decrement the pointer to point to the next cell to the left.
  • + - Increment the byte pointed to by the pointer.
  • - - Decrement the byte pointed to by the pointer.
  • [ - Jump forward to the command after the corresponding ] if the byte at the pointer is zero.
  • ] - Jump back to the command after the corresponding [ if the byte at the pointer is non-zero.
  • . - Output the value of the byte at the pointer.
  • , - Accept one byte of input, storing its value in the byte at the pointer.

It didn’t take me very long to write a running interpreter. My first version was more than a thousand characters. Even after renaming the variables and stripping all the whitespaces I still needed around 700 characters, which is huge compared to the best Ruby solution with only 142 characters. Read the rest of this entry »


Mon
31
Jul '06
Planning a Ruby course - request for comments
by Frank Spychalski filed under Ruby

Later this year I am going to hold a beginners course for Ruby at the VHS in Karlsruhe. Yesterday I started thinking about the topics I want to cover. The participants will have some programming experience which means I don’t have to explain the very basics. The course runs for two days with six hours each day, so I will have 12 hours to teach them Ruby. From the tutorials I read, I liked Mr. Neighborly’s tutorial best and I will use a similar structure. Read the rest of this entry »


Mon
24
Jul '06
Mocking context lookups
by Frank Spychalski filed under Java, Work

Sorry for another non-ruby post, but I’m currently very busy at work playing with JBoss 4, EJB 3, EasyMock, and a bunch of other pretty cool technologies.

I’m a big fan of EasyMock but frequently I ran into problems when code performed lookups to get resources like:


Context ctx = new InitialContext();
UserTransaction trans = (UserTransaction) ctx.lookup("UserTransaction");
trans.begin();

Read the rest of this entry »