Dual Monitors with NVidia

aptitude install nvidia-glx-new
aptitude install nvidia-settings

Some options that you can put in the Screen section

/etc/X11/xorg.conf
Option “NoLogo” “True”
Option “RenderAccel” “True”
# This turns on NVidias TwinView
Option “TwinView”
# Option “MetaModes” “1280×1024” “1152×864” “1024×768”
# LeftOf, RightOf, Below, Above, or Clone.
# Option “TwinViewOrientation” “LeftOf”

will_paginate with ajax

It is very easy to handle ajax pagination as described on this post here.

I want to give one full example.

Here is how my form looks:

Here is how my will_paginate helper looks:

I have used the improved version of the will_paginate:

Update for will_paginate 2.3.x

Fun links

flip text: http://www.revfad.com/flip.html

cats: http://i011.radikal.ru/0805/da/61ea5e6e5c0c.gif

drawing graffity – http://graffiti.playdo.com/

Тест за география http://www.travelpod.com/traveler-iq

Rails 2.0 scaffolding

The most valuable usage for scaffolding is when you use it in the administration part of the site. The administration is usually separated in separate module/folder.

The new rails scaffolding is not good because:

  • It is time taking to setup nested scaffold
  • I have tons of uselss source code in the scaffolding like respond_to ... that is usable very rare or never.
  • The HTML that is generated is ugly and not usable for CSS skin
  • Not using the nice ruby style iterations .each instead of for's
  • Code repetition, the “new” and the “edit” views has the same form elements
  • Not easy to find documentation

I find Akita article for scaffolding. It is is great that he has covered some real cases. It is a lot of reading and I must read/copy/paste every time I need to make a scaffold. Here is step by step on making scaffold for administration.

  • ruby script/generate scaffold admin::BadArticle NOT PLURAL!
    • user:references
    • description:text,string
    • fixed:boolean
    • timestamps are automaticaly added
  • Add in routes.rb

  • Model
    • Rename admin::BadArticles -> BadArticle,
    • move it to the model directory
    • rename the file
  • Fix the migration file:
    • remove the prefix from the migration class,
    • remove the prefix from table name
    • rename the file
  • URL references
    • admin_bad_articles_url
    • redirect_to([:admin, bad_article])
  • Controller
    • rename all Admin::BadArticles -> BadArticle except in the controller name
    • Probably you will want to make your scaffold inhired your base admin controller



  • Index.rhtml.erb


  • edit.rhtm

  • show.html.erb

  • new.rhtml


Traps:

The order of the routes in routes.rb does matter! In order to make the REST work you must have this block at the bottom of your routes.rb like this:


Remove simply_helpful plugin if you get the error:

Debuging tools:

rake routes

Tips:

How to add custom actions to the REST

Then in the controller:

And in the view:

More reading here

Resources:

Game

Once in the dark DOS ages I have one game with which you can make wonderfull animations. In the “Windows” era I miss this game a lot….until I found this nice replacement.

http://phun.cs.umu.se/wiki/Download

Firefox extensions

Here is the list of the firefox plugins that I use.

Javascripts

Good prototype controls

http://livepipe.net/#hoverbox

Directly print pdf files from a browser

function Printobject(){
document.all.PDF.print();
setTimeout(“self.close();”,4000); }

Rails code-snipplets

auto_scope

source: http://blog.teksol.info/archives/2007/3

class Contact < ActiveRecord::Base
auto_scope \
:old => {:find => {:conditions => [born_on < ?, 30.years.ago]}},
:young => {:find => {:conditions => [born_on > ?, 1.year.ago]}}
end

class Testimonial < ActiveRecord::Base
auto_scope \
:approved => {
:find => {:conditions => [approved_at < ?, proc {Time.now}]},
:create => {:approved_at => proc {Time.now}}},
:unapproved => {
:find => {:conditions => approved_at IS NULL},
:create => {:approved_at => nil}}
end

Rails internals!?

http://localhost:3000/rails/info/properties

Threads

Programs for Linux

Ubunto repositories

http://getdeb.net/

winetricks

wget www.kegel.com/wine/winetricks
example: ./winetricks winver=winxp
example: ./winetricks vcrun2005

http://www.virtualbox.org/

Disk managment
KDirStat and Baobab

Security

http://pakiti.sourceforge.net/ – monitor and install patches on multiple servers, supports ubunto, and rh

games

LiveCD