Friday, April 27, 2012

Timezone offset in seconds php vs ruby

echo date('Z');

10800

and timizone seems to be set right


date_default_timezone_set('Europe/Bucharest');echo date('Z');
10800



and in ruby it gives


Time.zone.now.utc_offset()
 => -25200


seems that rails and php lives in different timzones

so try to use localtimezone and is correct now


l = t.getlocal
 => 2011-06-27 10:10:00 +0300
1.9.2p318 :025 > l.gmt_offset
 => 10800




Monday, April 23, 2012

One way to avoid the Adobe tax

One coleague of mine extracted the layers from psd files with image magick 

I wish gimp could preserve all these layers when you import the psd , or maybe we can do a python plugin that will extract the layers and import them in the the gimp layers

Sunday, April 22, 2012

I love pip install

Here is how easy it is to install fdb firebird driver

pip install fdb
Downloading/unpacking fdb
  Downloading fdb-0.x.x.tar.gz (xxxKb): xxxKb downloaded
  Running setup.py egg_info for package fdb
    
Installing collected packages: fdb
  Running setup.py install for fdb
    error: could not create '/usr/local/lib/python2.7/dist-packages/fdb': Permission denied
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/mariuz/build/fdb/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8bcPXK-record/install-record.txt:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/fdb

copying fdb/services.py -> build/lib.linux-x86_64-2.7/fdb

copying fdb/fbcore.py -> build/lib.linux-x86_64-2.7/fdb

copying fdb/ibase.py -> build/lib.linux-x86_64-2.7/fdb

copying fdb/__init__.py -> build/lib.linux-x86_64-2.7/fdb

running install_lib

creating /usr/local/lib/python2.7/dist-packages/fdb

error: could not create '/usr/local/lib/python2.7/dist-packages/fdb': Permission denied

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/mariuz/build/fdb/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8bcPXK-record/install-record.txt failed with error code 1
Storing complete log in /home/mariuz/.pip/pip.log

#Let's use the sudo super cow powers 

mariuz@borki7:~$ sudo su 

root@borki7:/home/mariuz# pip install fdb
Downloading/unpacking fdb
  Running setup.py egg_info for package fdb
    
Installing collected packages: fdb
  Running setup.py install for fdb
    
Successfully installed fdb
Cleaning up...

Monday, April 16, 2012

Firebird remote interface vs direct file access for firebird databases


The scenario it can happen when using firebird classic (see the end of the article) You skip the remote interface (tcp/ip) and access the database directly by typing
isql-fb database path
here is my setup when i try to use the database directly or without password the server is not using the remote interface (There is no remote server/interface in the show version command)

sudo isql-fb /var/lib/firebird/2.5/data/rubyonfire.fdb
Database:  /var/lib/firebird/2.5/data/rubyonfire.fdb

SQL> show version;
ISQL Version: LI-V2.5.2.26466 Firebird 2.5
Server version:
Firebird/linux AMD64 (access method), version "LI-V2.5.2.26466 Firebird 2.5"
on disk structure version 11.2
quit;
check if the server is up with telnet localhost 3050 and then force the tcp ip method to connect using the remote interface use locahost:path 
SQL>connect "localhost:/var/lib/firebird/2.5/data/rubyonfire.fdb" user 'SYSDBA' password '********';

SQL> show version;
ISQL Version: LI-V2.5.2.26466 Firebird 2.5
Server version:
Firebird/linux AMD64 (access method), version "LI-V2.5.2.26466 Firebird 2.5"
Firebird/linux AMD64 (remote server), version "LI-V2.5.2.26466 Firebird 2.5/tcp /P12"
Firebird/linux AMD64 (remote interface), version "LI-V2.5.2.26466 Firebird 2.5/tcp )/P12"
on disk structure version 11.2

Tuesday, April 10, 2012

What you can learn from instagram deal and become a billionare

If you look at the tech behind it:
- use Ubuntu server or debian on amazon ec2 (I guess you can choose your own cloud solution)
- use Django with a shraded relational database (I would chose firebird)
- use nginx with gunicorn or uwsgi
- you use memcache right ?
- for notifications on apple use pyapns , billions of messages are send with it
- create and write a android app
- use gearman
- redis
- scare the hell out of facebook

- profit

Tuesday, April 03, 2012

Rails project bash aliases

To type less in the bash console on my Lubuntu
I use these bash aliases added in ~/.bashrc