You have reverted an svn merge and you have a lot of files not tracked (with exclamation mark, basically)? Clean it up: svn status | awk '$1 == "?" {print $2}' | xargs -t -i rm -r {} Again, knowing awk and xargs turn helpful!
I was searching for a bash command to move files and directories from a folder to another with modified in a specific date for ages on google until I gave up and decided to write it myself: ls -l | awk '$6 == "2009-06-04" { print $8 }' | xargs -t -i mv {} /destination/folder
To understand what this line does, you need to know a bit about awk and xargs (try “man xargs” in your shell)
Explaination:
ls -l : directory listing awk ‘$6 == “2009-06-04″ { print $8 } : take the files and dir with date 2009-06-04 and print the list xargs -t -i mv {} /destination/folder : execute the mv command. {} is the result from the previous command.
I would like to explain you more, but I’m quite lazy and I leave you with google to undestand better the commands I’ve used.
Wow, I just noticed that my last post was 50 days old… I must have been busy, haven’t I? So, what am I doing? The first part time website in Ruby on Rails is going to be published and I was working on that almost every evening and weekend with Antonello. I should have written something about Rails and Ruby in here but … there is already a lot of material around the web.
Maybe I’ll post something on GIT that is a bit more obscure
We tried to setup a rails application in a server subfolder in a way that could have been accessible through an URL like http://servername/rails, so we followed the configuration manual for mod_rails.We found that, to make rails works in a subfolder, should have used the Apache parameter RailsBaseURI.
With a great surprise, that didn’t worked so we started trying all possible apache configuration combinations to avoid that 404 error that was becoming a nightmare.
After few hours we started doubting about our Apache knowledge and even about our capacity of reading and following a couple of stupid instructions on a website!
We gave up and we started googling around when… the solution came out from dozens of blogs, forums and newsletters:
MOD_RAILS IS NOT COMPATIBLE WITH RAILS 2.2.2 AND ITS NEW ROUTING SYSTEM
“HOLY CRAP” was our esclamation and I will not mention here all the italian’s bad words that suddenly came out from our mounth!
So, here the solution: put this line here config.action_controller.relative_url_root = "/guestbook"
in your environment.rb
Now restart apache and enjoy!
ps. why hadn’t we changed mod_rails with mongrel or anything different? I don’t know!!!!
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)
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 )