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
Posted by antonio lorusso on the June 28th, 2008
I just want to share how excited I am studying Ruby and RubyOnRails.
Soon I’ll start the development of a Facebook application with Rails.
stay tuned!
No Comments • June 28th, 2008
Posted by antonio lorusso on the June 11th, 2008
If this error afflict your quiet development day, I’m sorry
I had this problem today and I solved in few steps:
- make a backup of the working copy in a different directory
- delete only the corrupted directory from your working copy
- make an svn update
- copy back only the modified files you need from the backup copy to the current working copy
- commit your changes
Now breath deeply and take a cold shower: I suppose you must be sweat! 
No Comments • June 11th, 2008
Posted by antonio lorusso on the June 7th, 2008
You can find many post outside the web disguising on how much and why a programming language sucks. In particular, I’ve found a lot with this argument about PHP.
Personally, I don’t understand why programmers waste their time on writing this useless things. The more, I don’t understand is why they attack PHP the most of the time… or maybe I know … it’s because it’s the most used in the web, isn’t it?
If it sucks, why the hell people and big enterprises persist in using it? Why the bloody hell BBC is going to migrate his websites on PHP platform? Why Facebook use PHP? Why Yahoo?
I’d like to link an article because it reflects my thoughts No, PHP does not suck; YOU suck
Cheers.
No Comments • June 7th, 2008
Posted by antonio lorusso on the May 30th, 2008
Study it! if you are beginning with perl, that chapter is the one you will never jump over!
http://perldoc.perl.org/perlreftut.html
No Comments • May 30th, 2008
Posted by antonio lorusso on the May 30th, 2008
Do you have a really long log file and you need to extract a portion from it?
Well, there are different approaches to this and it depends from what you really need from that file.
I’ll show you the case where I need to extract a portion of y lines from an x line number :
- get the line number
to get the line number, if you don’t know it already, use grep and a pattern
grep -n pattern /var/log/examplelogfile
- extract the portion
use head to output the first 200 lines and use tail to take 100 lines starting from the bottom
head -n 200 /var/log/examplelogfile | tail -n 100
In this case, I extracted the portion from line 100 to line 200. In other words, I’ve taken 100 lines starting from line 100.
I hope I’ve been clear enough!
ps. thanks to my colleague Mauro for the second part of this trick.
No Comments • May 30th, 2008
Posted by antonio lorusso on the May 12th, 2008
Grep is a fantastic search command that let you filter results and give you what you need. It is used to search in the content of files and is very useful for programmers like us
Typically, when you search in a directory recursively and you whant to exclude hidden directory such as the .svn, you so this:
grep -ri "your password is" * | grep -v .
this waste time cause search in all directories including the ones you want to exclude and then remove the unwanted results.
This other method, is the correct and quickest one:
grep -r 'content_graphic' assets/js --exclude-dir=\*.svn\*
COOOL!
If you want to make this permanent when you use grep, just put it in your profile file: on a Mac open ~/.profile with a text editor. If you’re using Linux, edit ~/.bashrc or ~/.bash_profile or ~/.profile.
Add the following line to the top of the file:
GREP_OPTIONS="--exclude-dir=\*.svn\*"
export GREP_OPTIONS
save and close!
Happy grepping to everybody 
No Comments • May 12th, 2008
Posted by antonio lorusso on the May 12th, 2008
I’ve found this command useful to filter the svn log by username:
svn log | sed -n '/username/,/-----$/ p'
I hope is useful to anyone like it was for me
ps. It’s really useful to read the sed manual as well!
No Comments • May 12th, 2008