Peter's howto

Development in Java and Ruby, my projects and occasionally other stuff

2009-12-11

I'm moving

After a long blogging pause I decided to move to a new url: acts_as_developer

2009-06-18

New month, new assignment

I started a new assignement this month, doing SOA integrations at a CA-TV operator. Basically doing BPEL and Java WS on Oracle SOA Suite (oc4j version).

Two things are really nice, first I use Ubuntu as a client O/S. Sure I've used a lot of unixen in the past, but this will be the first time I use it as a client for a longer period. I guess the visits to MS-land will be fewer in the future. Second, they have setup a really good Maven structure for the project. Done right, it _does_ make things easier.

My latest sidetrack is Sinatra, really good stuff, could it be more simple? As for now I've only run it on MRI, next step will be JRuby and warbler to deploy on aforementioned oc4j :-)

2009-05-19

Undefined method `fixtures'

... when running generated acts_as_authenticated unit tests. Test classes inherits from
Test::Unit::TestCase
instead of
ActiveRecord::TestCase
Found solution here

2009-05-18

Pain on Rails

I remember reading something like this:
"Rails is opinionated software, if you follow the rails way, everything will be easy, if not then....".

Here's what I want to do: I have some models and controllers that I want to separate from the rest of the application (in an admin interface) using another namespace (Module) say:
apps/controller/admin/nails_controller
apps/controller/admin/screws_controller
apps/models/admin/nail
apps/models/admin/screw
And I want to create them all using scaffolding, since I'm going to use all the CRUD operations. Then I'm going to create some customer pages for my imaginary hardware store, that are only able to view stuff.

So what happens, the db tables in the migrations get named admin_nails and admin_screws. But the application still only uses them by their simple class names Nail and Screw so ActiveRecord totally messes up and I have to edit and redo my migrations.

Then there's the routes. Scaffolding adds
map.resources :nails
map.resources :screws
which means that rails can't find the controllers since they are available under /admin/nails and /admin/screws so I have to change routes.rb to:
map.namespace :admin do |admin|
admin.resources :screws
admin.resources :nails
end

And last but not least, all the links in the generated views still points to /screws and /nails so I have to edit them as well.

Is it supposed to be this hard? Is using modules for namespaces against the rails way? Is it me as a longtime Java developer who is wrong, never wanting to put anything in the default package?

Bootstrapping resources

Setting up a company that does anything involving the web and code requires certain resources such as source control and hosting. Wanting to keep the costs at a minimum, free services are preferred of course.

For source control I use these two:
Projectlocker
Unfuddle

I haven't yet decided which one I like the most, so for the time being I use them simultaneously for different projects. They both provide free subversion (svn) or git repositories. There's some (small) difference in how much disk space you get for free and how many project you can setup. The main disadvantage with Unfuddle is that they don't provide https access for free.

If you're not intereseted in closed source there are a lot of other alternatives available as well, such as github, Google Code and Sourceforge.

When it comes to hosting I decided to pay for my Rails hosting, since I want the server to be located in Sweden for this project. I can't really evaluate the service at this point since we're not live yet, but the package comes with shell access, db, and Rails for a low monthly fee. As a free alternative I looked at Morph. The free package seems nice, and is deployed on Amazon EC2 som there's no doubt about the uptime and availability. However for my main projected targeted at the Swedish market, I still prefer to pay. I might use Morph for some other project though.

On the Java side I decided to use Google App Engine. The free service is a great way to get going, and there are unlimited resources if you need to scale up. Of course there are some downsides (which I'm sure I'll blog more about some other time) such as no databases, no threads and limited access to JRE classes. One nice thing about the scaling is that that you can set a daily budget for your resource usage in the same way that you do with AdWords.

And on the non-technical side, this book/manifesto by Seth Godin seems like a good read.

2009-05-14

Netbeans

So I've been doing som Ruby and Rails coding lately. I'm a longtime Eclipse user, but for various reasons I decided to check out the Ruby support in Netbeans (and yeah, I know _real_ Ruby development is done in textmate, but I'm on PC so...).

So it all starts very well, I think the gui support for generators, rails shell etc are quite good, perhaps even better than in Eclipse (Aptana RadRails plugin). At first the only real issue is that the explorer won't show me the rails projects as it is on the file system. It insist on showing me "fake" folders for view, controller etc at the root of the project. Surely you can switch over to the other view the see the project exactly as it is on the file system, but then you don't have access to the special rails gui stuff, like right-click to do db:migrate. But this is something I can live with.

Then it happens. I run a plugin that generates .rhtml views. But since I want to use .erb I edit the file, and then try to change the file ending. And there's absolutely no way that you can change the file ending in Netbeans! At first I'm just amazed, and suspect that I'm doing it wrong, but after googling a bit, I come to the conclusion that this is the way it is supposed to be! So goodbye Netbeans, hi again Eclipse. I guess I wont be sorry if Oracle decides to kill the project.

Bootstrapping

I'm starting a company together with my girlfriend. More info to follow later. These are the cost's so far:
Registering the company with the authorities 800 SEK
Domains (.se .com .nu) 250 SEK
Hosting 400 SEK (+monthly fee)