Rest Scaffold with Flex

Posted by Krzysztof Rączkiewicz Sat, 07 Apr 2007 12:30:00 GMT

Hi, if we are to touch upon the issue of scaffolding then I found Flexible Rails. As the author say it’s

“Flexible Rails approach is to scaffold REST controllers and generate Flex (swf) views from models including validations. Use generators to create the .mxml and .as code. Use Rake to compile .swf and publish assets.”

I’ve also found news about it on Eribium site (check out the comments).

Looks interesting.

Tags , , , , ,  | no comments

Scaffold and Administation stuff

Posted by Krzysztof Rączkiewicz Wed, 04 Apr 2007 14:43:00 GMT

Few days ago I’ve showed you how to quickly prototype your Rails application. Yesterday guys from Polish Ruby on Rails forum point me to some other projects. They not only help you build interface for your models but some of them support authorization/authentication stuff. Those are:

  • auto-admin, which can be used for generating administration interface and is inspired by Django project;
  • goldberg can provide your application security, site navigation and content management;
  • hobo deliver tools for building Ajax interfaces, switchable themes and more. You can also watch very interesting screencasts ;
  • and finally ajuby.

Tags , , , , , , ,  | no comments

Ruby implementation + GUIs

Posted by Krzysztof Rączkiewicz Tue, 03 Apr 2007 21:46:00 GMT

I’ve just found post with news – Microsoft is “very interested” in the Ruby. Till now we’ve got abandoned project (last update – 2004) Ruby-.NET from http://www.saltypickle.com/rubydotnet and Ruby.NET from http://www.plas.fit.qut.edu.au/Ruby.NET/

We’ve got severals implementations of Ruby in different languages. For me most important is JRuby. Especially that two weeks ago the 1.0 release of rails-integration jar shows up. More information about it you’ll find of course here.

I would like also point you to nice comparision/list of Ruby GUI Toolkit projects.

Tags , , , , , ,  | no comments

Prototype your Rails application

Posted by Krzysztof Rączkiewicz Tue, 20 Mar 2007 12:26:00 GMT

Today I want to show you some piece of software that will help you quickly prototype your Rails application. We all know the scaffold mechanism. Without it there wouldn’t be famous Weblog in 15 minutes screencast. It’s really nice for beginning or if you what to quickly show someone (or to yourself) the idea of your application. But scaffold generate not very beautiful code. E.g.:
<% for column in User.content_columns %>
    <th><%= column.human_name %></th>
<% end %>
I’ll present you four tools that may look interesting for you: But first I’ll give you an idea how my sample app look. I will use one model (with one table associated of course). This is how migration file looks like:
create_table :users do |t|
  t.column :first_name, :string
  t.column :last_name, :string
  t.column :address, :text
end

Custom scaffold

You can obtain it from here and you install it just by unpacking it to YOUR_APP/vendor/plugins/ . After that you could check that you’ve got your new generator:
YOUR_APP$ ./script/generate
..
Installed Generators
  Plugins: custom_scaffold
..
Now all you need to do is to generate custom scaffold for your model (you don’t need to specify controller name, but it’s possible)
YOUR_APP$ ./script/generate custom_scaffold User admin
It’s generating much more prettier code,
<% for user in @users %>
  <tr>
    <td><%= user.first_name %></td>
    <td><%= user.last_name %></td>
    <td><%= user.address %></td>
    <td><%= link_to 'Show', :action => 'show', :id => user %></td>
    <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
    <td><%= link_to 'Delete', :action => 'destroy', :id => user %></td>
  </tr>
<% end %>
but it also have some problems. It generate code in YOUR_APP/app/views/admin/_form.rhtml with non existing method
<%= error_for 'user', 'first_name' %>
So you need to delete it or add this method definition to application helper, something like1 this

You can customize templates in YOUR_APP/vendor/plugins/custom_scaffold/generators/custom_scaffold/templates

MasterView

Authors call it template engine and you could get it from here. It is distributed as gem or plugin and installation is described on the main page. You can also watch screencast presenting MasterView power, so I will not focus on it.

Streamlined

This one is really nice and quite powerful. With help of this plugin you can generate nice, powerful including JavaScript interface for you ActiveRecord models. At the beginning, it was used mainly for administrative purpose, but there’s no contraindication to use it for general stuff.

You can watch nice screencast available at the framework homepage

Although it’s looks great, it also have few problems. First of all – lack of documentation and some times those doc’s are out of date. Also as you see it’s in early development so sometimes you could find a bug.

Ok. First create rails app, install plugin (version 0.0.7.1) configure your database then create model and controller:
dev$ rails streaml
dev$ cd streaml
dev$ ./script/plugin install http://svn.streamlinedframework.org/edge/streamlined
[CONFIGURE_DB]
streaml$ ./script/generate model User
streaml$ ./script/generate controller users
It would be available2 to specify model used by streamline, nevertheless pay attention to plural noun users right now. First of all add some code to application helper
module ApplicationHelper
  include StreamlinedHelper
end
Add code to your controller
class UsersController < ApplicationController
  layout 'streamlined'
  acts_as_streamlined
end
Now you could test your app. If you would like to use Ajax (editing, view etc.) you can meet problem in prototype library. You could find solution here There’s also generator available. You need to install older gem (e.g. streamlined_generator-0.0.6.gem from Download Streamlined section). After that you could generate “scaffold”
streaml$ ./script/generate streamlined user
and you’re able to make modifications of header, menu and layout generally in the stream/app/views/streamlined At the end I will show you quick UI configuration from the first example (version 0.0.7.1). Create file app/streamlined/user_ui.rb (if you need, create directory app/streamlined). Fill that file with:
module UserAdditions
end
class UserUI < Streamlined::UI
  user_columns :exclude => [:address]
end 
Refresh your view, and look at the difference. More examples here: Declarative View Options

Streamlined Edit in JavaScript window - Streamlined

AjaxScaffold

Last but not least Ajax Scaffold Generator. It is available as generator or dynamic plugin. I think all of you knows that soft and if you’ve never heard about it, there’s a bunch of good tutorial for newbies.

AjaxScaffold Edit - AjaxScaffold

1 Not exactly like this. You could see only an idea.

2 It would be available in 0.1.0 version

Tags , , , , , ,  | no comments

Solitudinem faciunt, pacem appellant

Posted by Krzysztof Rączkiewicz Sat, 03 Mar 2007 15:25:00 GMT

Speech attributed to Calgacus, the leader of the Caledonian Confederacy, by the historian Tacitus in the Agricola

Robbers of the world, having by their universal plunder exhausted the land, they rifle the deep. If the enemy be rich, they are rapacious; if he be poor, they lust for dominion; neither the east nor the west has been able to satisfy them. Alone among men they covet with equal eagerness poverty and riches. To robbery, slaughter, plunder, they give the lying name of empire; they make a solitude and call it peace.

Tags ,  | no comments

Fring

Posted by Krzysztof Rączkiewicz Tue, 27 Feb 2007 11:34:00 GMT

Check this out Fring. You get little mobile app and then you can use Google Talk, Skype or MSN. You can also make a call using VoIP. Of course you will pay for data transfer if you connect to Internet using GPRS/3G, but imagine that there is available free WiFi, and your mobile can connect to it.

I had a problem with logging to Skype network, but Gmail talk works perfect.

Tags , , , ,  | no comments

Poznań miastem nowych technologii

Posted by Krzysztof Rączkiewicz Mon, 26 Feb 2007 19:45:00 GMT

Przeczytałem dziś wypowiedź Prezydenta Poznania, Pana Ryszarda Grobelnego Poznań nie ma zadyszki

Pozwoliłem sobie go skomentować. Pan Prezydent, uważa że ma wizję dla naszego miasta. Na pytanie jaka to wizja, pisze: “Po raz kolejny odpowiem: miastem akademickim, miastem nowych technologii, miastem sportu.”

Ja odpowiadam.

Nie rozumiem, co ma Pan na myśli mówiąc “miastem akademickim”. Takim miastem jesteśmy już od dawna, bez nowej wizji. Właściwie “miasto akademickie” oznacza tylko tyle, że mamy dużą liczbę studentów przez 10 miesięcy w roku. No i jeszcze campus Morasko można dodać. Miasto sportu – ok, całkiem niezła akcja promowania Kolejorza, nieudana ale jednak akcja z uniwersjadą. Jednak jak zobaczyłem “miastem nowych technologii”. Chyba tylko jako slogan reklamowy, bo teraz każdy “Pcim Dolny” (oraz Włoszczowa), chcą być “miastem nowych technologii”, czy też “polską Dolina Krzemową”. Proszę mi powiedzieć co miasto robi aby Poznań stał się “miastem nowych technologii”? Bo chyba nie mówimy o współpracy z Microsoftu i PP gdzie zatrudnionych zostanie kilku pracowników? Trzeba powiedzieć, że potencjał mamy niezły, wspomniany campus Morasko i UAM z kierunkami/specjalnościami: informatyka, nanotechnologia, biotechnologia, czy też PP z bardzo dobrą informatyką. Tylko, że potrzeba jeszcze jakiejś pomocy od miasta, aby zachęcić duże firmy do współpracy z tymi uczelniami (oczywiście one same też muszą walczyć). W Niemczech w Böblingen studenci mogą robić MBA, czy licencjat w IBM czy też w DaimlerChrysler. Firmy same kreują kierunki, na których studenci uczą się. Tylko te firmy muszą być. Jeśli tak dalej pójdzie to ludzie uciekną do Wrocławia, Krakowa lub na zachód. Ja także.

Bardzo podoba mi się akcja Wyborczej Przystanek Poznań. Wiele osób w końcu dostrzega problem. Cieszy jedynie fakt (smuci, że taka akcja jest potrzebna), że wreszcie podjęto dyskusje. Oby nie zakończyła się jak ostatnia akcja “Poznań na zakręcie”

Tags ,  | 2 comments

Textmate for Linux

Posted by Krzysztof Rączkiewicz Thu, 08 Feb 2007 00:32:00 GMT

Finally I did it. I’ve changed my blog engine to typo, and I’ve changed my language to English. Because of that please give me some feedback, when I make some (or lots of) grammar mistakes.

For the first, inauguration post I’ll describe my search for nice “editor” for rails development. Everybody knows that most popular, and beautiful is Textmate ;p. Editor that became standard, and prototype that everyone want to duplicate. I know that “de gustibus non disputatum est” so first I present some other products and then my final choice (for now :) )

At the begging I’ve used RadRails. It was quite nice, but first I had some problems running it on amd64 (you need to pay attention to java version – 32 bit). Now I have ubuntu 32bit, so then some new problems showed up. First of all I needed some other plugins, like for html, css and so on. So I started to use EasyEclipse LAMP which has everything that I need. But finally I thought it’s to big for me. I’ve used snippets from here and theme form there

I’ve also tried to use jEdit, prepared by colleagues from Polish Ruby on Rails forum. I’ve got some errors during usage, and I can say that it isn’t most beautiful editor I saw. Yes, yes.. I know that it’s only tool, and you should write software not admire themes.. but like DHH said (and not only him) motivation is really important during development process. Motivation comes from happiness, and I feel really happy writing my code in beautiful environment :)

I should come to the crux of the matter, so I want to present you how to make gedit to be your mate, to look and work like Textmate.

Step 1

Install gedit and gedit-plugins.

Step 2

Go to Edit->Preferences->Plugins Make “Snippets” plugin available. Get ruby and erb snippets from here and copy them to ~/.gnome2/gedit/snippets

You can check them in Edit->Preferences->Plugins->Snippets & Configurate plugin

Step 3

Get more plugins..
  1. Eddt for nice directory browsing plugin
  2. Class browser for class browser
  3. Snap Open for opening files based on regexp. At the same site there is set of files with textmate colors and font settings, but I set them manually.

Optionally you can install others

You will get something like:

gedit like textmate

gedit like textmate

that’s all for now

Tags , , , , , , , ,  | 4 comments