My New Venture (reblaze.com)

I have been quite busy lately, ever since I have started working on Reblaze in the winter last year (2011).

We all wish to make the world (wide web) a better place. I think we have found a way to improve the web, to make it a better, safer and cleaner.

I guess we can be categorized under the SaaS tag, in fact, we are SaaS x2, we provide Software as a Service, as well as Security as a Service.

Visit us at reblaze.com and read all about, as well as add your site, it is free now, and so it will remain for all those who join during public beta.


Installing oursql on ubuntu

sudo aptitude install python-pip libmysqlclient-dev
sudo pip install oursql

The Dark Magic of MongoDB

There is no other explanation for this but magic, ha? Look at this sequence of commands I just typed in my terminal. I simply cannot decide whether this is great or scary, mean, who saved that data for me in between restarts? And do not get me wrong, I am all excited about MongoDB, yet, these ghost driven technology which works for you behind the scenes is a bit scary, ain’t it?

tzury@x200:/$ sudo service mongodb stop
[sudo] password for tzury:
mongodb stop/waiting
tzury@x200:/$ status mongodb
mongodb stop/waiting
tzury@x200:/$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo import Connection
>>> Connection().test_db.books.count()
0
>>> Connection().test_db.books.insert({"autor": "Charles Dickens"})
ObjectId('4c1e592b6b13eb0ee3000000')
>>> Connection().test_db.books.count()
1
>>>
tzury@x200:/$ sudo service mongodb start
mongodb start/running, process 3830
tzury@x200:/$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo import Connection
>>> Connection().test_db.books.count()
1
>>> Connection().test_db.books.find()[0]
{u'autor': u'Charles Dickens', u'_id': ObjectId('4c1e592b6b13eb0ee3000000')}
>>>
>>>
tzury@x200:/$

running wireshark as root on Mac OSX

After installing the .dmg packge you should run

$ sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark

In order to capture traffic on the interfaces


Default Parameters Values and Mutable/Callable Objects

Quoting from the python Language Reference[link]:

Default parameter values are evaluated when the function definition is executed.
This means that the expression is evaluated once, when the function is defined, and that that same “pre-computed” value is used for each call. This is especially important to understand when a default parameter is a mutable object, such as a list or a dictionary: if the function modifies the object (e.g. by appending an item to a list), the default value is in effect modified. This is generally not what was intended. A way around this is to use None as the default, and explicitly test for it in the body of the function, e.g. …

I was not aware of this. I have an excuse though, in previous versions of Python, language reference was described as “for language lawyers” [link]. Since I never liked lawyers, I never bothered reading it. I am happy though it was changed in current release and now it is described as “describes syntax and language elements”. I guess I have to read it now.

Below is an example for a bug I had caused by this feature and which made me aware of this issue.

>>> import time
>>> def now(t=time.time()):
...     print t
...
>>> now()
1228988224.36
>>> now()
1228988224.36

Installing Python 3.0 on Ubuntu 8.10 Intrepid Ibex

UPDATE (Dec, 7): apt-get install python3 works now. this might be the prefered way for most of us.

Based on sofen’s blog’s post about python 2.6

This was the easiest thing I did recently. It went so smooth that this post is totally redundant.

Seven commands and you are all unicode.

Step 1: Make sure you got all the prerequisites

$ sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libbz2-dev libc6-dev libsqlite3-dev tk-dev g++ gcc

Step 2: Grab the bits, extract them and build them

$ wget http://www.python.org/ftp/python/3.0/Python-3.0.tgz
$ tar xvzf Python-3.0.tgz
$ cd Python-3.0/
$ ./configure
$ make
$ sudo make install

That’s it my friend. You now have the best software development platform in the entire universe!

$ python3.0
Python 3.0 (r30:67503, Dec  4 2008, 21:27:40)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Good luck and enjoy the sweetness of open source software!


error_help() for python hackers

Just came across this what might be a usefull utility which provides help within the python interperter using collaborative data gathered at http://bug.gd

Example:

tzury@regulus:~$ sudo easy_install bug.gd
tzury@regulus:~$ sudo /usr/bin/python error_help_config.py
tzury@regulus:~$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 0/0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
>>> error_help()
========== 1 of 7 ==========
Error: Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

Solution: I divided by zero as a test. Maybe you did the same thing? The trick is not to divide by zero!
...
...

		

Pydoc’s built-in HTTP server

Just came across this in python mailing list (link)

import pydoc
pydoc.gui()

(then click the ‘open browser’ button)


HotKeys jQuery Plug-In version 0.7 is out

Last night I released a new comprehenced version of jshotkeys. This plugin lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination.
For example, to bind Ctrl+C to a function fn simply type:

$(document).bind('keydown', 'Ctrl+c', fn);

See the live demo.


A Couple of Nice and Handy Python Modules

python-wifi 0.3.1

Python-Wifi is a Python library that provides access to information about a W-Lan card’s capabilities, like the wireless extensions written in C.

>>> from pythonwifi.iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> wifi.getEssid()
'romanofski'
>>> wifi.getMode()
'Managed'

A simple unix/linux daemon in Python

by Sander Marechal

sub-process usr/bin/dpkg returned an error code (2)

I came across this annoying message and couldn’t get around it (running dpkg --configure -a  yields EOF related error message)  until I ran dpkg --clear-avail


jQuery vs. Prototype

just put both libraries on wordle to visualize on which each library have focused.

Here are the results:

jQuery

jquery-1.2.6

Prototype

prototype visualized


Choosing the right (open-source) tools

From the announcement of the open source reddit:

There are only five of us who work on reddit; we couldn’t have made this site if it weren’t for a great community of developers. In no particular order, here’s a quick list of the open source products that reddit is built and runs upon: Debian, lighttpd, HAProxy, PostgreSQL, Slony-I, various python libraries, Psychopg, pylons, Solr, Tomcat, Ganglia, Mercurial, Git, gettext (translation), daemontools, and memcached.

Five people. 1,000,000’s of pages every day.


Do we need more facebok applications?

My friend has 73 friends and 152 Facebook applications.
IMHO, the layout is lack of usability and functionality.
Let alone the fact each application require other users to install them in to their accounts in order to view standard web content (images, flash, videos, etc.)

I am sure Facebook’s dudes need to rethink the whole concept and come up with something more sensible.

152 facebook applications


def grab_contacts(ask_for_password = 0)

stefan fountain -> coding horror -> hacker news

Jeff – here are the links for you:

Google Contacts API: http://code.google.com/apis/contacts/
Yahoo! Contact API: http://developer.yahoo.com/addressbook/
Windows Live Contact API: http://msdn.microsoft.com/en-us/library/bb463989.aspx

I’m glad these malpractices are getting more attention, they deserve to get the bad wrap on their wrist for these kind of infringements of respecting users’ data.

Stefan Fountain on June 5, 2008 05:37 AM

Too Bad To Be True (or Dear Ray Ozzie: IE8 can’t handle Windows Live)

Yesterday, while walking from launch, my freind Amnon David (the creator of jNext) told me that IE8 doesn’t work on hotmail.com.

Since IE8 release gained lots of credit by JavaScript Hackers (John Resig and many more), therefore, I couldn’t believe it until I saw it in my own eyes.

Plain and simple, the site is broken. Icons, texts, menus are overlapping each other.

Everyone can see now that every piece of DHTML code must be written twice, once for all the browsers, and then specifically for IE.

The unbearable lightness of releasing buggy software at MS is shocking.

The results are deployed here in front of your eyes.

IE8 default mode Ie8

IE 8 emulating IE7

Emulated IE7

Firefox 3 Beta 3

firefox3-beta


My Next Laptop Will NOT Be a Mac (But Dell’s)

Comparing to Microsoft aggressiveness,  I was wondering whether Apple is just passive aggressive?

Both  companies are making money selling proprietary, closed-source software (and hardware) . Perhaps Apple just dose it more gently with a wider smile on the face. That is all.

Even getting a legal copy of OS x runs on a virtual machine is almost impossible.

For now, I will stick with Dell which runs Linux smoothly.


The Winner Takes It All doesn’t work anymore, even for Microsoft

Microsoft interoperability announcement is a significant switch and a remarkable milestone onto the way to make the world of software an open, standardized  and perhaps free as well. Especially regarding the IE8 default behavior.

Read more at:

I have said in the past that IE would eventually become an open source browser and so it would. I believe  that by the year of 2013 .NET, IE and perhaps more products from Microsoft would be become open source projects.

There is no other way to keep your top rank in any business  than being the best, by all means. Ever since the world of software have realized the the best way to write a software if the open-source way, Microsoft would have to join this principles in order to survive. The fact that more and more developers are switching to free and open-source tools, languages and platforms and barely the vice versa is the only fact that counts in the long run.


Huge Elements in Firefox 3 beta 3 on Ubuntu

If you just installed firefox 3 beta 3 on ubuntu (sudo apt-get install firefox-3.0), you may came across this issue where all elements are huge (toolbars, text, icons, etc.)

In order to fix it at address line go to about:config (and promise to be careful ;-)) and set layout.css.dpi to 96.


How to install Infogami (+ PostgreSQL 8.2) on Ubuntu Gutsy Gibbon (7.10)

Step 1: PostgreSQL (8.2)

Installing postgresql (8.2)

sudo apt-get install postgresql-8.2

Setting up the password for postgres’ postgres user

sudo -u postgres psql template1
ALTER USER postgres WITH PASSWORD 'your-password';
\q

Configure postgres’ authentication method :

sudo cp /etc/postgresql/8.2/main/pg_hba.conf /etc/postgresql/8.2/main/pg_hba.conf_bak
sudo nano /etc/postgresql/8.2/main/pg_hba.conf

Add the following at the bottom of the file

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD
host    all         all         127.0.0.1       255.255.255.0    password

Restart postgres:

sudo /etc/init.d/postgresql-8.2 restart

Step 2: Infogami

Get the code with:

sudo apt-get install mercurial
hg clone http://infogami.org/hg/ infogami

Create your run.py

cd infogami
nano run.py

Paste the following into the run.py file:

import infogami
infogami.config.db_parameters = dict(dbn='postgres', db="infogami", user='postgres', pw='your-password')
infogami.config.site = 'sitename.local'
if __name__ == "__main__":
    infogami.run()

Save and exit.

Grant permission to infogami (and it child nodes)

cd ..
chmod -R 777 infogami/

Install Python Driver for PostgreSQL (python-psycopg2)

 sudo apt-get install python-psycopg2

Create the database and install infogami objects into it

cd infogami
sudo -u postgres createdb infogami
sudo -u postgres psql infogami < infogami/tdb/schema.sql
sudo -u postgres python run.py install

That’s it. You now have infogami installed on your machine.
to run it type:

sudo -u postgres python run.py

and nav your firefox to: http://loclahost:8080


How to Install PostgreSQL on Ubuntu Gutsy Gibbon (7.10)

Useful and simple guide, step by step.
http://www.supriyadisw.net/2007/02/postgresql-on-ubuntu-linux

Installing postgresql (8.2)

sudo apt-get install postgresql-8.2

Setting up the password for postgres’ postgres user

sudo -u postgres psql template1
ALTER USER postgres WITH PASSWORD 'your-password';
\q

Configure postgres’ authentication method :

sudo cp /etc/postgresql/8.2/main/pg_hba.conf /etc/postgresql/8.2/main/pg_hba.conf_bak
sudo nano /etc/postgresql/8.2/main/pg_hba.conf

Add the following at the bottom of the file

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD
host    all         all         127.0.0.1       255.255.255.0    password

Restart postgres:

sudo /etc/init.d/postgresql-8.2 restart

The Truth About Python

from: Python Is Not Java (dirtSimple)

So, if you don’t feel like you’re at least ten times more productive with Python than Java, chances are good that you’ve been forgetting to use the time machine! (And if you miss your Java IDE, consider the possibility that it’s because your Python program is much more complex than it needs to be.)

One might replace the word Java with .Net, it would remain the same, wouldn’t it?


Getting rid of Insert Ubuntu Disc Message

This “Insert Disc” message was annoying and frustrating almost at any time I was trying to install a new software on my Ubuntu (7.10 gutsy-gibbon).

Media change: please insert the disc labeled 'Ubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016.1)' in the drive '/cdrom/' and press enter

If you want to get rid of it you should comment out the line that point to the “CD-ROM” Source.

Type the following in the terminal:

gksudo gedit /etc/apt/sources.list

Locate the line that reads:

deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted

and comment it out

#deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted

Save the file, close the editor, back in the terminal window type:

sudo apt-get update

Good luck and thank you for choosing Ubuntu.


The Zen of Steve Jobs

Ever wondered about Apples designers sources of inspiration?
I thinks I just found one, its name is Steve Jobs.

I was worth about over a million dollars when I was twenty-three
and over ten million dollars when I was twenty-four,
and over a hundred million dollars when I was twenty-five and it wasn’t that important because I never did it for the money.

The following is a photo was taken by Diana Walker and it shows Steve Jobs in his house in 1982

STEVE JOBS AT HOME IN 1982

Jobs said about it:

This was a very typical time. I was single.
All you needed was a cup of tea, a light, and your stereo,
you know, and that’s what I had.

•Bare in mind• the fact that in 1982 Jobs was already 27 years old, 2 years after he was already worth more than hundred million dollars, and yet, he kept that elegant minimalism principle.


Is Facebook the next Microsoft?

I just came across this post by Robert Scoble

If you are trying to contact me on Facebook, please don’t. My account has been “disabled” for breaking Facebook’s Terms of Use. I was running a script that got them to keep me from accessing my account. I’m appealing. I’ll tell you what I was doing as soon as I talk with the developers who built what I was using and as soon as I talk with Facebook’s support (I sent an email in reply to the one below, but haven’t heard back yet).

I am working with a company to move my social graph to other places and that isn’t allowable under Facebook’s terms of service.

While they wrote their own screen scrappers Your addressbook and facebookso they can read all your contacts and friends that stored in the addresses books at gmail or hotmail or live.com, and many others. They blocked Robert Scoble’s account for running a script that (as far as I can read between the lines) exports his own friends list.

It is pretty clear now why Facebook preferred to go along with Microsoft instead of Google.
It is even more clear why they don’t join open social.
I can see what they thought at the first place when they released that cursed Beacon, and I don’t buy the apologizes that came after the rush.

Here is a short description of [Windows|Facebook] (you choose) platform.

  • It is a closed source system that comes with a set of APIs, which let third parties develop new applications.
  • If a user wants to use a third party application he must install that application.
  • If a user decided to uninstall a third party software.
  • When a user run the uninstall process, most of the data might remain in the system.
  • You never know who has access to your private data.