Posted by antonio lorusso on the March 13th, 2009
Finally I started a little RoR project with my friend Antonello but we did it in the wrong way
We started from the database design (not exactly the rails way) and we are trying to solve problems that a Rails developer usually doesn’t have like create the scaffold without migration scripts!
Here are 3 simple steps to do it:
- rake db:schema:dump (create the schema dump from the existing database)
- mv db/schema.rb db/migrate/001_initial.rb (create the initial migration script manually)
- script/generate scaffold firstmodule field1:text field2:varchar field3:date –skip-migration
The most important thing you should never forget is that your tables on the database must have a PLURAL name but use the SINGULAR name when you create the scaffold for that table.
( ex: the table name is “tools” but the command to create the scaffold is script/generate scaffold tool )
Happy RoRing !!!
No Comments • March 13th, 2009
Posted by antonio lorusso on the March 9th, 2009
With a couple of little commands, you’ll be able to ignore the .DS_Store files forever from your git repositories on mac!
The following command will add the .gitignore file to the git configuration
git config --global core.excludesfile ~/.gitignore
then, the following, will add the .DS_Store to the list
echo .DS_Store >> ~/.gitignore
and voilà!
4 Comments • March 9th, 2009
Posted by antonio lorusso on the November 13th, 2008
if are trying to use mod_evhost in lighttpd in a more advanced way like using deep subdomains or with particulars tld like “co.uk” aka 2tls, you should know that
$HTTP["host"] =~ "^([^.]+)\.([^.]+)\.babelclient\.photobox\.([^.]+)\.([^.]+)$"{
evhost.path-pattern = "/web/%5/%6/assets"
}
will NEVER WORK but
$HTTP["host"] =~ "^([^.]+)\.([^.]+)\.babelclient\.photobox\.([^.]+)\.([^.]+)"{
evhost.path-pattern = "/web/%5/%6/assets/"
}
WILL WORK.
compare the two pieces of code and start screaming like a mad!
No Comments • November 13th, 2008
Posted by antonio lorusso on the October 20th, 2008
Me and my friend Antonello, are going to start an experimental testing server to improve our skills in Ruby, PHP and start with Python as well.
After the installation, Antonello provided me an access created with webmin but, after the login I noticed that bashrc, actually bash, was not executed!
Editing /etc/passwd file, I was able to re-enable bash at login instead of sh:
your user line should look like
loginname:x:1001:1001::/home/antonio:/bin/bash
and not
loginname:x:1001:1001::/home/antonio:/bin/sh
No Comments • October 20th, 2008
Posted by antonio lorusso on the October 9th, 2008
This morning I had a lot of problems with my Eclipse Ganymede installation: svn plugin (subversive) refused to work properly… well, actually, it didn’t worked at all!!
After some time trying to understand the source of the problem, I came out with a GREAT IDEA : “I can remove some file from my workspace folder!!!” So I went there, I displayed the hidden folders, I entered in the .metadata folder and deleted all folders related to svn and team plugins and … you know what?? It f#*king worked…
I love how Eclipse doesn’t help in solving this… F%£k IT!
But, at the end, is a good IDE…
bye
No Comments • October 9th, 2008
Posted by antonio lorusso on the September 30th, 2008
what is that? you have done digited free in you linux shell and you see that all the memory is fulfilled by the cache?
sudo -s
sync; echo 3 > /proc/sys/vm/drop_caches
No Comments • September 30th, 2008
Posted by antonio lorusso on the September 29th, 2008
If you have this error after tryin a commit, for sure you have replaced a standard file with a symlink or viceversa, haven’t you?
In that case, what you have to do is just svn add <the resource changed> and svn will replace the file with the new one!
Were you already scared
?
Anyway, the correct procedure to replace a real file with a symlink in svn is the following:
- svn remove of the file you want to link
- ln -s <link>
- svn add of the new link
11 Comments • September 29th, 2008
Posted by antonio lorusso on the July 9th, 2008
Hi
if you try to umount an NFS mountpoint this way
root:~> umount /mountpoint
and your shell answer this way
umount: /mountpoint: device is busy
umount: /mountpoint: device is busy
then try killing all processes using the mountpoint and update the nfs export fs
root:~> fuser -k -m /mountpoint
root:~> exportfs -au
at this point, you can safely umount
root:~> umount /mountpoint
peace!
No Comments • July 9th, 2008
Posted by antonio lorusso on the July 9th, 2008
I was looking for this useful function I always use in php and found this simple article.
Basically, the function that permit you to do that is grep used in this way:
my $string = ‘fin_helm’;
my @array = qw/full_plate manteau boots two_handed_sword fin_helm/;
if(grep $_ eq $string, @array)
{
print “$string is in the array”;
}
easy?
No Comments • July 9th, 2008
Posted by antonio lorusso on the July 8th, 2008
I said not to jump the chapter 4 of the Camel book (the Dromedary one) otherwise you’ll not know what @{…} (literally: at plus curly brackets) do!!
As explained in page 252, that expression, dereferenciate an array reference returning the array itself.
Remember that arghh..
ps. why Perl should be so complicated?
No Comments • July 8th, 2008