Thursday, April 29

Lucid is here

With tons of bugfixes and updates the new release of ubuntu is finally here.

While I play with it I'm upgrading my project's server to the latest LTS release.

$ nohup nice do-release-upgrade -d &

Executing shell scripts from NetBeans

One of the most interesting things in Komodo was the option to add some scripts and execute them in the project without leaving the IDE, usually this looks trivial but it's a great way of performing some batch processes and speed up your development.

Now we'll review how to do the same thing in NetBeans

1. At the project list, right click the project you want to add the script, select preferences
2. At the open preferences go to "Run Configuration"
3. Create a new configuration, give any name you want
4. At the combo-box select the last option "Script (run in command line)"
5. Uncheck the "Use default PHP Interpreter"
6. At "PHP Interpreter" box type the interpreter of your script, for example for a bash script /bin/bash
7. For the index file select the script you want to run
8. Optionally add the arguments needed for your script
9. Close the window
10. Now at the menubar open the Run submenu
11. Set the Project Configuration to run your newly created configuration

12. Just press F6 (default) or click the run button to run your script

Monday, April 5

Executing mysql instructions from the shell

I bet many already know this, but whatever ...

the -e option for the mysql command allows us to execute an instruction without entering into the mysql itself, for example.

$ mysql -uroot -ppassword -e "SELECT * FROM `Database`.`Table`"

this gives us an excellent way of printing results into a file, for example:

$ mysql -uroot -ppassword -e "USE Database; SELECT id, name FROM Table WHERE arbirtary_id IS NULL;" > nullRecords.txt

and with a simple parser we can use this data to get rid of inconsistent information or obsolete data.