Posted by Jim Morris
on Sun Dec 17 02:57:15 -0800 2006
My current development system is Ubuntu 6.06 using an Athlon 2500+ Barton
processor and an Asus A7V8X-X motherboard and 1GB of DRAM. It has been
pretty stable, and relatively fast, but it is about 3 years old, and I
like to upgrade when I can at least double my perceived performance. (ie I
have to notice the difference, not just going on specs).
So I decided the latest hot system seems to be based on the Intel Core
2 Duo 6600, and I like a quiet system so I decided to build one spec'd
out by Silent PC Review. The one in
particular was SPCR Model One: Modern General Purpose
PC.
This is a build based on an Asus P5B-E board, in an Antec Solo case,
with the silencer foam etc. I wanted 2 GB memory this time around as I
like to use VMware workstation to run winxp.
So I ordered the CPU, Mobo and Memory from NewEgg, and I ordered the
Antec Solo case with pre-installed silencer foam from EndPCNoise.com, they
have a pre-built
version
but by buying the components myself I could save about $500, and I enjoy
building systems.
The specs are:
- Intel Core Duo E6600
- Corsair TWIN2X2048-6400C4 memory
- Asus P5B-E Motherboard
- Antec Solo case
- Scythe Ninja Plus Rev. B CPU Cooler
I already have Seagate Barracuda drives (but had to get a SATA drive see
later).
I had an Antec 380 Watt PSU, which is not really quiet but I will
switch that with a 430 Watt Seasonic S12 later.
I had to get a new Video card, as the newer Motherboards no longer
have AGP slots, so I wanted to get as close to what I already have and
setup for dual monitor, which meant sticking with ATI Radeon, not the
fastest but I don't play games so don't need the fastest out there,
but it does need to support dual monitor, Fry's had a special on
Diamond Stealth x300e ATI based PCI express cards, so I got one of
those. (And as it turns out I may as well have gotten anything, as
even though it is a Radeon like my current card, it couldn't use the
same driver).
I had already read the horror stories of people trying to get Ubuntu
to work on these new C2D Mobos, but it seemed most of the problems
related to trying to run off of ATA/IDE disks, and the newer mobos all
have SATA. So I got an SIIG UltraATA 133 PCI card, just in case. This
was because the on-board JMicron based IDE controller does not work
with the version of the Kernel Ubuntu 6.06 comes with and the plan was
to try to continue using Dapper Drake and not have to upgrade to Edgy
Edge or worse Fiesty. I thought I could just stick my existing drive in
the new system and be off and running. (Boy was I wrong!)
I built the system pretty quickly, everything fitted in nicely
although the Ninja heatsink is huge, and made it hard to plug in some
connectors after I installed it, probably should have plugged them in
first. Also replacing the power supply later on is going to be tough
without removing the heatsink first.
The first thing I tried was to boot off of my existing IDE drive using
the SIIG IDE PCI board, and I was surprised that it booted OK. The
first thing I always do is run memtest over night, and as that comes
with Ubuntu it was easy to do. I needed to tweak the memory settings
in the BIOS first though. I don't overclock as I want stability, but
the defaults the BIOS picked up were wrong, so I just changed the
latencies to the Corsair specified ones (4,4,4,12). Memtest ran all
night with no problems, and the CPU temp was around 50 deg C, which
isn't too bad. I really like Corsair RAM it always seems to work for
me. So the first step seemed to go ok.
I then discovered I was not able to get the system to boot from an
IDE CDROM drive connected to the SIIG controller, whatever I tried.
I also noticed that the HD performance of the ata100 IDE disk drive
was not what it should be on the SIIG controller, I'm not sure why,
but it was about half the speed I expected, so I popped down to Fry's
again (I practically live there ;) as they had a Seagate 300GB SATA
drive for just under $100, and hooked that up, and it was nice and
fast, at least 3 times as fast as the IDE drive, I suspect the SIIG
PCI/IDE adapter was using a slower mode than necessary, but there was
no way of fixing it, and given I can't boot from CDROMs either I
returned the card (luckily Fry's has a great return policy).
I found I could boot off of a USB CDROM drive though, which I had
lying around so I ran Spinrite 6 on the SATA drive,
as I like to test all my drives as I've had a few bad ones in the past,
this comes on a bootable CD and I left that running for about 14
hours! The disk checked out OK.
Given all these problems, plus the fact that the sound card wasn't
recognized and the Ethernet card wasn't either I figured I'd see what
happened if I tried to boot off of the Edgy (Ubuntu 6.10) Live CD
using the built-in JMicron based IDE, I thought after all the bug
reports I read they have fixed it by now.
I stuck it into the IDE CDROM drive plugged into the JMicron slot, and
watched it boot, it came up and saw all the drives on the IDE, and the
sound worked too. Only the Ethernet was still invisible. So it seems
Edgy has fixed most of the compatibility problems, so this was enough
incentive for me to upgrade from Dapper to Edgy, which turned out to
not be too much of a hassle, and most of the problems I ran into other
people have already run into and can be easily fixed with some
Googling. (For instance the acpid didn't want to update, it was just a
matter of killing off hald).
I plugged my existing Dapper IDE drive into the JMicron slot, booted
into the Edgy Live CD, and copied the Dapper system onto the new SATA
drive, basically just cp -ax /mnt/old /mnt/new. This meant I could
keep that Dapper disk as a backup in case something went terribly
wrong down the road. I did some Grub incantations to get the SATA
drive to boot, this is best done in the grub boot prompt rather than
using grub on a running system...
grub> root (hd0, 0)
grub> setup (hd0)
Figuring out it's hd0 or hd1 takes some effort, but if its the only
drive it will be hd0, if you do this from a running system (ie the
Live cd)...
> grub
grub> device (hd0) /dev/sda
grub> root (hd0, 0)
grub> setup (hd0)
I then booted off the SATA drive into single user mode of Dapper.
(Dapper boots fine from a SATA drive on this MoBo).
I followed the KUbuntu instructions to upgrade from Dapper to Edgy,
basically edit the /etc/apt/sources.list and replace all occurrences
of dapper to edgy, then...
> apt-get update
> apt-get dist-upgrade
> apt-get install kubuntu-desktop python-qt3 python-kde3 ubuntu-minimal
Then keep doing it until everything downloads ok, that's when I found
the hald problem mentioned above which was blocking the upgrade
finishing.
I had to do a few apt-get upgrades afterwards, and manually upgrade
the list of things that got held back for some reason.
At the end of that I had my existing workstation image upgraded to
Edgy on the SATA drive, able to see the IDE drives on the JMicron
controller, and the sound worked fine. I had to plug in an old PCI
Ethernet card I had lying around as the Gig Ethernet controller is not
recognized even in Edgy.
In the process of all this I discovered that even though the JMicron
IDE works under Edgy, it thinks all the HDs are UDMA33, ie SLOW, I
haven't played around much with that, but I'm not sure why as it says
it handles UDMA133. This is ok for my CDROM, but I want my second IDE
drive to be a bit faster, even though my primary will now be a genuine
SATA. Fry's didn't have anymore SATA to IDE dongles to try (the one
from Syba I tried didn't work at all), so I ordered the newer SYBA one
from NewEgg, along with the 430 Seasonic S12 PSU. Hopefully this will
work and make my second IDE drive fast again. In the meantime I'll
live with the slow second drive.
Now I needed to find all the things that broke from my upgrade from
Dapper to Edgy (Something I was hoping I would have to avoid).
The first thing was to get dual monitors working again, and as fglrx
didn't seem to work anymore (not sure if it was Edgy or the different
video card), I had to do some research again and found that the Radeon
Xorg driver should work the same way withthe same setup I had before.
I took my existing xorg.conf that I had finally got to work with dual
screen a while back using fglrx and changed the driver to radeon, and
everything worked OK, except for some problem with the second screen
having a huge rectangle instead of a cursor, again Googling discovered
others had solved that problem, and I think adding "composite" "false"
to my xorg.conf fixed it. (Or rebooting, who knows).
Most everything else seemed to work except...
Had to uninstall and reinstall Mysql to get the server to run
I had to remove Beagle as it was using 2GB of memory! and no
backport in sight of the latest version, which apparently fixes that.
lm-sensors no longer worked, and it appears the device drivers
needed for my motherboard have not been ported over yet, and probably
won't make it into Edgys kernel anyway, so no more CPU temp sitting in
GKrellM.
Minor mods needed to smarttools (smartd) setup (add -d ata for the SATA drive)
Oh yea, it is really fast, well worth the effort and expense of the
upgrade, a very noticeable speed improvement over the Athlon XP 2500+
Barton system. I won't have to upgrade again for years, until there
are native quad core chips at 5GHz, at least ;)
This version is quieter than my old system, but not silent yet, I'm
hoping replacing the case fan with my Nexus fan, and the PSU with the
Seasonic S12, and removing the fan from the heat sink, will make it
almost silent.
update I got the new PSU it is a lot quieter. It is still not 100%
silent as I can just hear the nexus case fan, but the pc is right next
to my right ear, so you could say it is a good as it gets.
The syba silicon image based sata to ide dongle works well, the ide
drive now runs about 2-3 times faster, make sure you get the silicon image
based one and not the jmicron one. The one I have is in a clear
plastic case, available from egghead for about $12.
Posted in
Linux
|
Tags
ubuntu,coreduo,dapper,edgy
|
no comments
Show
Posted by Jim Morris
on Wed Dec 06 21:42:05 -0800 2006
UPDATE 2007-06-09 This method has been deprecated in Cap 2.0.
UPDATE 2007-02-21 I have updated the files to correctly update revisions.log
UPDATE I added rsync as suggested see end of article for more info.
I previously published a custom deploy recipe that allowed subversion
to checkout from a local repository and send to the remote server.
This was a suboptimal solution, as it wouldn't work with things like
deprec.
So here is the way I should have done it in the first place. It is a
modified version of the standard subversion scm module, it should be
backward compatible with the built in version, but adds a couple of
features.
- Handles the subversion repository only being accessible from the local
machine
- If the subversion repository is accessible from the remote server
allows for different URLs for access from the local and remote
machines.
If you use a standard deploy.rb and your subversion is accessible
from the server, then it should work exactly as the built-in version
(no need to use it then, but it should work)
However if you have your subversion server behind your local firewall,
you just add these three lines to your deploy.rb
require 'lib/tasks/local_subversion_rsync.rb'
set :scm, Capistrano::SCM::LocalSubversionRsync
set :repository_is_not_reachable_from_remote, true
And everything will work as before, even though the server has no idea
what subversion is.
Of course for this to work you need to download
this de-tar
it and put it in your lib/tasks directory. (That's where the require
line gets this extension from). There is also a unit test for the
new_subversion module which is extended from the one shipped with
Capistrano, which passes.
Everything else in deploy.rb should be the same as before, except
that you set the repository to the URL your local machine uses to
access your locally accessible subversion server or repository.
(Should even work with the URL file://...), for instance...
set :repository, "svn://your.svnserver.host/#{application}/trunk"
The assumption is that both the local and remote machines can create
files and directories in /tmp, if this is not true then one or both
of these should be set...
set :tmpdir_local, "/usr/tmp"
set :tmpdir_remote, "/home/user/tmp"
The way this module works is to export the relevant version of the
project from Subversion into a temporary directory on the local
machine (default is /tmp/unique_name). Then I create a gzip'd tar
archive into the temp directory. The tar file is then transferred to
the target servers, using the Capistrano put command into a
temporary directory (/tmp by default) on the server. I then create the
target directory on the server and un-tar the file into that
directory. Then clean up the various temporary files. From the
perspective of the server the end result should be identical to doing
an svn export into the target directory on the server.
The other facility this SCM Module provides is when your subversion
server is accessible from the server as is the "normal" use case (per
the Capistrano developers, but bad practice IMHO), but you need a
different URL to access the SVN repository from the local machine vs
the remote server, eg
server accesses with this URL svn://localhost/myapp/trunk
local machine accesses with this URL svn+ssh://myserver.com/myapp/trunk
in this case you add these lines...
require 'lib/tasks/local_subversion_rsync.rb'
set :scm, Capistrano::SCM::LocalSubversionRsync
set :local_repository_path, "svn+ssh://myserver.com/myapp/trunk"
set :repository, "svn://localhost/myapp/trunk"
In addition if the actual SVN binary is different on server and local
you can add these for instance...
set :remote_svn, "/usr/local/bin/svn"
set :local_svn, "/usr/bin/svn"
If the relevant configuration variable is not set then the standard
svn configuration variable is used, and then just "svn" if that is not set.
Please beware I have not fully tested the use cases other than the
first one, where I use my local subversion server to deploy to my
remote servers that know nothing about subversion, however the unit
tests do pass for the other use cases.
UPDATE 2007-02-15 check this article for using the rsync option.
Posted in
Rails,Ruby
|
Tags
capistrano,subversion
|
26 comments
Show
Posted by Jim Morris
on Fri Dec 01 18:09:47 -0800 2006
I've just started a new RoR project and thought I'd try out
HAML for the views instead of rhtml.
Seeing as I just switched to JEdit, I looked for a HAML language mode,
and to my surprise no one had done one yet.
So here is my first attempt at a language mode for JEdit and version
1.0 of the HAML language mode. It needs more work, and I hope someone
with a better understanding of JEdit language modes will help out.
This will set the indent to 2 spaces and auto-indent after a %tag that
has nothing else on the line...
%p
stuff
It will not auto indent if there is more stuff on the line like in the
following example the line after %p gets indented but the line
after %label does not.
%p
%label{ :for => "login" }Login
%br/
= f.text_field :login
I have setup a basic syntax coloring scheme that should color %tags
and .classes and #ids differently. It will color anything
following an = or ~ and defer the syntax highlighting to the ruby
mode for anything following them, ditto for anything inside { }.
Feedback and better ideas are welcome.
Download from here
To install copy the file to ~/.jedit/modes, and edit the catalog file
in that directory and add this line:
<MODE NAME="haml" FILE="haml.xml" FILE_NAME_GLOB="*.haml" />
Then restart jedit, and your haml files will be syntax highlighted.
I like HAML but there simply is not enough example code out there
yet, so here are two simple conversions from well know rhtml files
into HAML...
First the standard login form from acts_as_authenticated
- form_tag sessions_path do
%p
%label{ :for => "login"} Login
%br/
= text_field_tag 'login'
%p
%label{ :for => "password" }Password
%br/
= password_field_tag 'password'
%p
%label{ :for => "remember_me" }Remember me:
= check_box_tag 'remember_me'
%p
= submit_tag 'Log in'
Next the new user form from the same place...
= error_messages_for :user
- form_for :user, :url => users_path do |f|
%p
%label{ :for => "login" }Login
%br/
= f.text_field :login
%p
%label{ :for => "email" }Email
%br/
= f.text_field :email
%p
%label{ :for => "password" }Password
%br/
= f.password_field :password
%p
%label{ :for => "password_confirmation" } Confirm Password
%br/
= f.password_field :password_confirmation
%p
= submit_tag 'Sign up'
If this is dumb HAML coding please let me know how to improve it :)
Posted in
HAML,JEdit,Rails
|
Tags
rails,jedit,haml
|
8 comments
Show
Posted by Jim Morris
on Fri Nov 24 19:05:52 -0800 2006
I imported the rest of the Textmate ruby and rails snippets I had to combine them
into the one ruby file though.
I have added about 80 new ones to the existing ones by Scott Becker
that I found here
The list of snippets I now have is at the end of this post, note I did change the
abbreviation for some of the assertions they all now start with as so
I can search for them faster with my select_superabbrevs macro
described in the previous post.
download the new snippets from here
unzip and replace the ruby file in the .jedit/SuperAbbrevs directory with the one in
this zip archive.
You need the Beta version of SuperAbbrevs to use this from here
Super Abbreviations for the ruby mode
--------------------------------------- : --------------------------------------
:${1:key} => ${2:"value"}$end
-------------------------------------- all -------------------------------------
all? { |${1:e}| $end }
-------------------------------------- am --------------------------------------
alias_method :${1:new_name}, :${2:old_name}
-------------------------------------- any -------------------------------------
any? { |${1:e}| $end }
-------------------------------------- app -------------------------------------
if __FILE__ == \$PROGRAM_NAME
$end
end
-------------------------------------- ase -------------------------------------
assert_equal ${1:value}, @${2:thing}.${3:attr}$end
------------------------------------- asid -------------------------------------
assert_in_delta(${1:expected_float}, ${2:actual_float}, ${3:2 ** -20})
------------------------------------- asio -------------------------------------
assert_instance_of(${1:ExpectedClass}, ${2:actual_instance})$end
------------------------------------- asko -------------------------------------
assert_kind_of ${1:Class}, @${2:thing}$end
-------------------------------------- asm -------------------------------------
assert_match(/${1:expected_pattern}/, ${2:actual_string})
-------------------------------------- asn -------------------------------------
assert_nil(${1:instance})$end
------------------------------------- asne -------------------------------------
assert_not_equal(${1:unexpected}, ${2:actual})
------------------------------------- asnm -------------------------------------
assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string})
------------------------------------- asnn -------------------------------------
assert_not_nil ${1:true}$end
------------------------------------- asnr -------------------------------------
assert_nothing_raised(${1:Exception}) { $end }
------------------------------------- asns -------------------------------------
assert_not_same(${1:unexpected}, ${2:actual})$end
------------------------------------- asnt -------------------------------------
assert_nothing_thrown { $end }
-------------------------------------- aso -------------------------------------
assert_operator(${1:left}, :${2:operator}, ${3:right})
-------------------------------------- asr -------------------------------------
assert_raise(${1:ActiveRecord::RecordNotFound}) { ${2:Class}.find(@${3:thing}.${4:id}) }$end
------------------------------------- asrar ------------------------------------
assert_raise(${1:ActiveRecord::RecordNotFound}) { ${2:Class}.find(@${3:thing}.${4:id}) }
------------------------------------- asre -------------------------------------
assert_response :${1:success}$end
------------------------------------- asrt -------------------------------------
assert_redirected_to :action => "${1:index}"$end
-------------------------------------- ass -------------------------------------
assert(${1:test}, "${2:Failure message.}")
------------------------------------- assm -------------------------------------
assert_same(${1:expected}, ${2:actual})$end
-------------------------------------- ast -------------------------------------
assert_throws(:${1:expected}) { $end }
-------------------------------------- bt --------------------------------------
belongs_to :${1:object}, :class_name => "${2:ClassName}", :foreign_key => "${3:foreign_key}_id"$end
------------------------------------- case -------------------------------------
case ${1:object}
when ${2:condition}
$end
end
-------------------------------------- cl --------------------------------------
classify { |${1:e}| $end }
------------------------------------- clafn ------------------------------------
split("::").inject(Object) { |par, const| par.const_get(const) }
------------------------------------- class ------------------------------------
class ${1:ClassName}
$end
end
-------------------------------------- col -------------------------------------
collect { |${1:e}| $end }
------------------------------------ collect -----------------------------------
collect { |${1:element}| ${1:element}.$2 }$end
------------------------------------- Comp -------------------------------------
include Comparable
def <=>(other)
$end
end
-------------------------------------- dee -------------------------------------
Marshal.load(Marshal.dump(${1:obj_to_copy}))
-------------------------------------- def -------------------------------------
def ${1:method_name}
$end
end
------------------------------------- defd -------------------------------------
def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}
------------------------------------- defds ------------------------------------
def_delegators :${1:@del_obj}, :${2:del_methods}
------------------------------------- defs -------------------------------------
def self.${1:class_method_name}
$end
end
------------------------------------- deft -------------------------------------
def test_${1:case_name}
$end
end
-------------------------------------- det -------------------------------------
detect { |${1:e}| $end }
-------------------------------------- do --------------------------------------
do
$end
end
-------------------------------------- doo -------------------------------------
do |${1:object}|
$end
end
-------------------------------------- ea --------------------------------------
each { |${1:e}| $end }
-------------------------------------- eab -------------------------------------
each_byte { |${1:byte}| $end }
-------------------------------------- eac -------------------------------------
each_char { |${1:chr}| $end }
------------------------------------- each -------------------------------------
each { |${1:element}| ${1:element}.$end }
-------------------------------- each_with_index -------------------------------
each_with_index { |${1:element}, ${2:idx}| ${1:element}.$end }
-------------------------------------- eai -------------------------------------
each_index { |${1:i}| $end }
-------------------------------------- eak -------------------------------------
each_key { |${1:key}| $end }
-------------------------------------- eal -------------------------------------
each_line$1 { |${2:line}| $end }
-------------------------------------- eap -------------------------------------
each_pair { |${1:name}, ${2:val}| $end }
------------------------------------- easl -------------------------------------
each_slice(${1:2}) { |${2:group}| $end }
-------------------------------------- eav -------------------------------------
each_value { |${1:val}| $end }
------------------------------------- eawi -------------------------------------
each_with_index { |${1:e}, ${2:i}| $end }
------------------------------------- Enum -------------------------------------
include Enumerable
def each(&block)
$end
end
-------------------------------------- fin -------------------------------------
find { |${1:e}| $end }
------------------------------------- fina -------------------------------------
find_all { |${1:e}| $end }
-------------------------------------- fl --------------------------------------
flunk("${1:Failure message.}")
------------------------------------- flao -------------------------------------
inject(Array.new) { |${1:arr}, ${2:a}| ${1:arr}.push(*${2:a}) }
------------------------------------- flash ------------------------------------
flash[:${1:notice}] = "${2:Successfully created...}"$end
------------------------------------- forin ------------------------------------
for ${1:element} in ${2:collection}
${1:element}.$3
end$end
------------------------------------- Forw -------------------------------------
extend Forwardable
-------------------------------------- gre -------------------------------------
grep(${1:/${2:pattern}/}) { |${3:match}| $end }
------------------------------------- Hash -------------------------------------
Hash.new { |${1:hash}, ${2:key}| ${1:hash}[${2:key}] = $end }
-------------------------------------- hm --------------------------------------
has_many :${1:objects}, :class_name => "${2:ClassName}", :foreign_key => "${3:foreign_key}_id"$end
-------------------------------------- ho --------------------------------------
has_one :${1:object}, :class_name => "${2:ClassName}", :foreign_key => "${3:foreign_key}_id"$end
-------------------------------------- if --------------------------------------
if ${1:condition}
$end
end
-------------------------------------- ife -------------------------------------
if ${1:condition}
$2
else
$3
end
-------------------------------------- inj -------------------------------------
inject(${1:init}) { |${2:mem}, ${3:var}| $end }
------------------------------------ inject ------------------------------------
inject(${1:object}) { |${2:injection}, ${3:element}| $4 }$end
------------------------------------- logi -------------------------------------
logger.info "${1:Current value is...}"$end
-------------------------------------- mac -------------------------------------
add_column :${1:table_name}, :${2:column_name}, :${3:string}$end
-------------------------------------- mai -------------------------------------
add_index :${1:table_name},[:${2:column_name}], :name => "${2:column_name}_index"$end
-------------------------------------- map -------------------------------------
map { |${1:e}| $end }
------------------------------------- mapwi ------------------------------------
enum_with_index.map { |${1:e}, ${2:i}| $end }
-------------------------------------- max -------------------------------------
max { |a, b| $end }
-------------------------------------- mcc -------------------------------------
change_column :${1:table_name}, :${2:column_name}, :${3:string}, ${4:default => 1}$end
-------------------------------------- mct -------------------------------------
create_table :${1:table_name} do |t|
$2
end
-------------------------------------- Md --------------------------------------
File.open(${1:"${2:path/to/file}.dump"}, "w") { |${3:file}| Marshal.dump(${4:obj}, ${3:file}) }
-------------------------------------- mdt -------------------------------------
drop_table :${1:table_name}$end
-------------------------------------- mex -------------------------------------
execute "$1"$end
-------------------------------------- min -------------------------------------
min { |a, b| $end }
-------------------------------------- mm --------------------------------------
def method_missing(meth, *args, &block)
$end
end
-------------------------------------- mnc -------------------------------------
rename_column :${1:table_name}, :${2:column_name}, :${3:new_column}$end
-------------------------------------- mod -------------------------------------
module ${1:ModuleName}
module_function
$end
end
-------------------------------------- mrc -------------------------------------
remove_column :${1:table_name}, :${2:column_name}$end
-------------------------------------- mri -------------------------------------
remove_index :${1:table_name}, :${2:column_name}$end
-------------------------------------- mtc -------------------------------------
t.column :${1:column_name}, :${2:string}$end
--------------------------------------- p --------------------------------------
params[:${1:id}]$end
-------------------------------------- par -------------------------------------
partition { |${1:e}| $end }
--------------------------------------- r --------------------------------------
attr_reader :${1:attr_names}
-------------------------------------- ra --------------------------------------
render :action => "${1:action}"$end
-------------------------------------- ral -------------------------------------
render :action => "${1:action}", :layout => "${2:layoutname}"$end
-------------------------------------- ran -------------------------------------
sort_by { rand }
-------------------------------------- rb --------------------------------------
#!/usr/bin/env ruby -w
------------------------------------- rcea -------------------------------------
render_component :action => "${1:index}"$end
------------------------------------- rcec -------------------------------------
render_component :controller => "${1:items}"$end
------------------------------------- rceca ------------------------------------
render_component :controller => "${1:items}", :action => "${2:index}"$end
-------------------------------------- rea -------------------------------------
redirect_to :action => "${1:index}"$end
------------------------------------- reai -------------------------------------
redirect_to :action => "${1:show}", :id => ${2:@item}$end
-------------------------------------- rec -------------------------------------
redirect_to :controller => "${1:items}"$end
------------------------------------- reca -------------------------------------
redirect_to :controller => "${1:items}", :action => "${2:list}"$end
------------------------------------- recai ------------------------------------
redirect_to :controller => "${1:items}", :action => "${2:show}", :id => ${3:@item}$end
-------------------------------------- rej -------------------------------------
reject { |${1:e}| $end }
------------------------------------ reject ------------------------------------
reject { |${1:element}| ${1:element}.$end }
-------------------------------------- req -------------------------------------
require "$end"
------------------------------------- reve -------------------------------------
reverse_each { |${1:e}| $end }
-------------------------------------- rf --------------------------------------
render :file => "${1:filepath}"$end
-------------------------------------- rfu -------------------------------------
render :file => "${1:filepath}", :use_full_path => ${2:false}$end
-------------------------------------- ri --------------------------------------
render :inline => "${1:<%= 'hello' %>}"$end
-------------------------------------- ril -------------------------------------
render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"$4 }$end
-------------------------------------- rit -------------------------------------
render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml}$end
-------------------------------------- rl --------------------------------------
render :layout => "${1:layoutname}"$end
-------------------------------------- rn --------------------------------------
render :nothing => ${1:true}$end
-------------------------------------- rns -------------------------------------
render :nothing => ${1:true}, :status => ${2:401}$end
-------------------------------------- rp --------------------------------------
render :partial => "${1:item}"$end
-------------------------------------- rpc -------------------------------------
render :partial => "${1:item}", :collection => ${2:items}$end
-------------------------------------- rpl -------------------------------------
render :partial => "${1:item}", :locals => { :${2:name} => "${3:value}"$4 }$end
-------------------------------------- rpo -------------------------------------
render :partial => "${1:item}", :object => ${2:object}$end
-------------------------------------- rps -------------------------------------
render :partial => "${1:item}", :status => ${2:500}$end
-------------------------------------- rt --------------------------------------
render :text => "${1:text to render...}"$end
-------------------------------------- rtl -------------------------------------
render :text => "${1:text to render...}", :layout => "${2:layoutname}"$end
------------------------------------- rtlt -------------------------------------
render :text => "${1:text to render...}", :layout => ${2:true}$end
-------------------------------------- rts -------------------------------------
render :text => "${1:text to render...}", :status => ${2:401}$end
-------------------------------------- rw --------------------------------------
attr_accessor :${1:attr_names}
--------------------------------------- s --------------------------------------
session[:${1:user}]$end
-------------------------------------- sca -------------------------------------
scan(/${1:pattern}/) { |${2:match}| $end }
-------------------------------------- sel -------------------------------------
select { |${1:e}| $end }
------------------------------------ select ------------------------------------
select { |${1:element}| ${1:element}.$2 }$end
-------------------------------------- sor -------------------------------------
sort { |a, b| $end }
------------------------------------- sorb -------------------------------------
sort_by { |${1:e}| $end }
-------------------------------------- tc --------------------------------------
require "test/unit"
require "${1:library_file_name}"
deli delete_if { |${1:e}| $end }
-------------------------------------- ts --------------------------------------
require "test/unit"
require "tc_${1:test_case_file}"
require "tc_${2:test_case_file}"
-------------------------------------- uni -------------------------------------
ARGF.each_line$1 do |${2:line}|
$end
end
------------------------------------ unless ------------------------------------
unless ${1:condition}
$end
end
------------------------------------- usai -------------------------------------
if ARGV.$1
puts "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"
exit
end
------------------------------------- usau -------------------------------------
unless ARGV.$1
puts "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"
exit
end
-------------------------------------- va --------------------------------------
validates_associated :${1:attribute}, :on => "${2:create}"$end
------------------------------------- vaif -------------------------------------
validates_associated :${1:attribute}, :on => "${2:create}", :if => proc { |obj| ${3:obj.condition?} }$end
-------------------------------------- vc --------------------------------------
validates_confirmation_of :${1:attribute}, :on => "${2:create}", :message => "${3:should match confirmation}"$end
------------------------------------- vcif -------------------------------------
validates_confirmation_of :${1:attribute}, :on => "${2:create}", :message => "${3:should match confirmation}", :if => proc { |obj| ${4:obj.condition?} }$end
-------------------------------------- ve --------------------------------------
validates_exclusion_of :${1:attribute}, :in => ${2:enumerable}, :on => "${3:create}", :message => "${4:is not allowed}"$end
------------------------------------- veif -------------------------------------
validates_exclusion_of :${1:attribute}, :in => ${2:enumerable}, :on => "${3:create}", :message => "${4:is not allowed}", :if => proc { |obj| ${5:obj.condition?} }$end
------------------------------------ verify ------------------------------------
verify :only => [:$1], :method => :post, :render => {:status => 500, :text => "use HTTP-POST"}$end
------------------------------------ verifyr -----------------------------------
verify :only => [:$1], :session => :user, :params => :id, :redirect_to => {:action => '${2:index}'}$end
------------------------------------- vlen -------------------------------------
validates_length_of ${1::name}, :maximum=>${2:10}, :message=>"${3:less than %d if you don't mind}"
-------------------------------------- vp --------------------------------------
validates_presence_of :${1:attribute}, :on => "${2:create}", :message => "${3:must be present}"$end
------------------------------------- vpif -------------------------------------
validates_presence_of :${1:attribute}, :on => "${2:create}", :message => "${3:must be present}", :if => proc { |obj| ${4:obj.condition?} }$end
-------------------------------------- vu --------------------------------------
validates_uniqueness_of :${1:attribute}, :on => "${2:create}", :message => "${3:must be unique}"$end
------------------------------------- vuif -------------------------------------
validates_uniqueness_of :${1:attribute}, :on => "${2:create}", :message => "${3:must be unique}", :if => proc { |obj| ${4:obj.condition?} }$end
--------------------------------------- w --------------------------------------
attr_writer :${1:attr_names}
------------------------------------- when -------------------------------------
when ${1:condition}
$end
------------------------------------- ydump ------------------------------------
File.open(${1:"${2:path/to/file}.yaml"}, "w") { |${3:file}| YAML.dump(${4:obj}, ${3:file}) }
------------------------------------- yload ------------------------------------
File.open(${1:"${2:path/to/file}.yaml"}) { |${3:file}| YAML.load(${3:file}) }
-------------------------------------- zip -------------------------------------
zip(${1:enums}) { |${2:row}| $end }
Posted in
JEdit,Rails,Ruby
|
Tags
ruby,rails,jedit,snippets,superabbrevs
|
8 comments
Show