Friday, September 16, 2011

Twig syntax highlighting plugin for Netbeans 7

First, I been using Netbeans since Zend Studio merged with Ecplise and let me say i love it. Also, since i met Twig while studying Symfony2 like a year ago i been looking for a decent plugin to highlight my *.twig files without any luck till now.

PHP Twig (that you can download from here)  have some little bugs with the validator (like showing 'unexpected block endings', but still works really well.

Besides that this is the first time i had to install an extra plugin for netbeans and i should say it is not intuitive at all.  After downloading the *.nbm file i had to google to find out how to install it and the only way to do it is to open the Plugins window --> then Drag the file over it.

I know, there's probably be a better way... i just couldn't find it, so if you know how to do it let me know :)

Thursday, August 25, 2011

Install Ruby on Rails 3 on Debian 6 (Squeeze) using RVM

First at all I decided to install Ruby & RoR using RVM because (yup, imma RoR n00b) seems to be a really common thing to switch between ruby versions,gems and anything while developing any kind of ror apps.
Also, because Debian version is (of course) outdated and besides that i ran into a lot of problems while i was trying to install it using the packages... Yeah, gotta love Debian <stable>. Errors like:
  • File not found: lib.
  • Execjs: Could not find a JavaScript runtime
  • And so on...
First some packages that you probably already have if you are a developer:
apt-get install curl git-core
Now because RVM downloads and compiles a LOT of the stuff we are installing you'll need:
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
(Again, if you are a developer you might already have some of em installed)

And this one if you plan to use Mysql on your project:
apt-get install libmysqlclient-dev
Here, make sure you don't have any Ruby packages installed and begin installing RVM (and from now on don't run anything as root):
bash < <(curl -sk
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
Now if you are a Gnome user make sure to check this option on your Terminal profile perferences (don't ask me why, just do it™ ):

To continue restart your Terminal, then:
// Checks if rvm is installed correctly (it MUST return 'rvm is a function')
$> type rvm | head -1

// Install Ruby and make sure it works
$> rvm install 1.9.2
$> rvm use 1.9.2
$> ruby -v

// Create a new gemset and install Rails
$> rvm gemset create rails305
$> gem install rails -v 3.0.5

// SQlite database extension
$> gem install sqlite3

// MySQl database extension
$> gem install mysql2
At this point if everything went OK you are good to go, still I recommend ya to run a simple app to make sure:
rails new HelloWorld
cd HelloWorld
rails server

Friday, August 12, 2011

Install MongoDB PHP driver on Debian 6 Squeeze

Install the server

apt-get install mongodb-server

Before install the PHP driver a couple of packages you'll need:

apt-get install php5-dev build-essential php-pear

Now time to compile/install the driver:

pecl install mongo

Once it finishes it will display the location of the new extension. Something like:


Finally add this to your php.ini (/etc/php5/cgi/php.ini):


Now restart your web server and that's should be it!

Saturday, August 6, 2011

Symfony2's "Upgrade your APC extension (3.0.17+)" problem

Somehow Symfony2 Standard (2.0.0) have a bug on the installer that produces an error while it checks APC version. (even if you don't have it installed it, APC is NOT a requirement for SF2)

Here is the patch to fix it:

Btw, This patch has already been commited to SF git, (not yet released).

Tuesday, August 2, 2011

Run Zend Framework (1.11) on lighttpd

Make sure this two mods are enabled on yer lighttpd.conf:



And add this to your host config:

$HTTP["host"] == "localhost" {
  url.rewrite-if-not-file = (
    ".*\?(.*)$" => "/index.php?$1",
    "" => "/index.php"

  # Not necessary, but most of Zend applications use it
  setenv.add-environment = (
    "APPLICATION_ENV" => "development"

Wednesday, April 13, 2011

Limit APT download rates/speed


Second: Yeah, as i said in my previous post (doh!) im re-installing Debian on my notebook and one thing i found myself wanting to do was to lower the download rate to some number that i can keep using my connection on a different (or not) pc while downloading big collections of packages. 

Here is how i made it:

Create a file called: /etc/apt/apt.conf.d/75downloadspeed

  Queue-mode "access";
    Dl-Limit "25";

This also can be done on the fly:

sudo apt-get -o Acquire::http::Dl-Limit=25 upgrade

That's it!, enjoy my l33tness

Friday, February 25, 2011

Moving to lighttpd..

I always loved apache since the beginning of times.... still do, but let's say that lighttpd is my b1tch now.

Why i moved?

  1. Really easy to install and config
  2. Not many dependencies
  3. Ease PHP/CGI setup
  4. REALLY easy to setup a multi virtual Host  (great for your work environment)
  5. Runs smooth on my 64mb ram server... Yes, I'm not lying.!

Give it a try, your home server will love it too: