Wednesday, February 15, 2012

For people who belive in ORM: Please learn SQL

Here is one example of what happens when django ORM can be optimized
Profiling Django Applications: A Journey From 1300 to 2 Queries

Sunday, February 12, 2012

EC2 is about 10-20 times more expensive than dedicated hosting.

Quote of the day via ycombinator:

Even if reserved instances save us 22% over 3 years, it still doesn't even come close. Reserved instances also force me to commit to using a certain type of EC2 instance for 3 years with lots of money upfront. Moreover, IO is ridiculously bad on EC2 and there's nothing that can be done about it. Even RAIDing a gazillion EBS volumes together doesn't do much. I'm glad the truth about how expensive EC2 really is is starting to come out. Hopefully it will force them to revise their pricing, or at least offer more processing power for the same price.

I ran some benchmarks a few weeks ago that show how expensive EC2 really is

Agreed. Here's a good relevant blog post by mark maunder challenging the "cloud hype"  http://markmaunder.com/2011/10/31/clouded-vision/

Another thing that is overpriced is the memory , here is a quote from the basecamp's next memory cache article (see the comments section)


They have brought 864GB of RAM that looks like below




Total price was $12,000
Compare that with Amazon :Just checked AWS Elastic Cache’s pricing.
It would cost around 20k / month for ~ 800 GB of Memory. (12 * Quadruple Extra Large nodes / 68 GB)

Saturday, February 11, 2012

Ati fglrx gpu blacklisted in latest chrome beta on Lubuntu/Ubuntu 11.10 with the fglrx driver




Although it works just fine if i use to ignore the blacklisting
Tested on two systems with the current drivers and quite new gpus

See bellow

Here are the details
:

Wednesday, February 08, 2012

php shell script that will run runs at specific hour with crontab and send emails with the html form extracted content


Here is how to create a daily crontab script that runs at specific hour 
gets the web content and then saves the output in a file folder (the form must use a sumbit button with post) and then 
it send email with the html file 

you need to install php5-cli , php-pear 
sudo apt-get install php5-cli php-pear

and then from pear Mail , Mail_Mime http://pear.php.net/package/Mail_Mime/redirected

sudo pear install Mail_Mime
sudo pear install Mail

crontab -l

# m h  dom mon dow   command
0 1 * * * /home/ubuntu/curl_cron.php


cat /home/ubuntu/curl_cron.php


Thursday, February 02, 2012

Suhosin is disbled by default in Debian, and soon Ubuntu - i hope

I think is the right aproach 
I don't believe in security by obscurity (this random patch it will secure your php ... riiight)

suhosin shouldn't be a patch it should be inside of php core or as module (think like the selinux situation) , So debian guys are right use the upstream unpatched version , let the core php devels decide if suhosin is right or wrong for them :less bugs , less patches , life is better = more security and fast updates in debian

Did i told you that upstream doesn't test suhosin patch when they run the tests ?
And with that patch php core is not the same , there are some bugs that i found related to it  (in debian/ubuntu) and it happens only when that invasive patch is applied

Wednesday, February 01, 2012

updating passenger in rails and ubuntu 10.3 lts

I had one issue with an old instalation of passenger and nginx (kernel 2.6.32 doesn't quite deliver signals to the nginx 0.8.x)

I download the current dark passenger

wget http://rubyforge.org/frs/download.php/75548/passenger-3.0.11.tar.gz
tar -zxvf passenger-3.0.11.tar.gz
cd passenger-3.0.11/
rake package
sudo su # and make me a sandwitch
cd pkg gem install passenger-3.0.11.gem

start the nginx wizzard
/var/lib/gems/1.8/gems/passenger-3.0.11/bin/passenger-install-nginx-module
choose (1),(1)
enter enter enter
and all is installed

Read what is needed to add to nginx config if you do an upgrade

mainly the new passenger path

Please edit your Nginx configuration file (probably /opt/nginx/conf/nginx.conf),
and set the passenger_root and passenger_ruby configuration options in the
'http' block, like this:

  http {
      ...
      passenger_root /var/lib/gems/1.8/gems/passenger-3.0.11;
      passenger_ruby /usr/bin/ruby1.8;
      ...
  }

After you (re)start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.

Press ENTER to continue.

The END

encoding decoding strings in python3.x


I like to think of  encoding of strings in python3 to the analogy of encrypting your plain text into a random stream of bytes

string (plain text) -> encode (encrypt) -> bytes (stream)
bytes (stream) -> decode (decrypt) -> string (plain text)

and the codec you choose is your key (utf-8 ...)