admin's blog

Javascript verification using SHA1

One of the most modern ways of performing a malicious attack is using client side attack with javascript. What happens is, you visit a site, and that site got javascript that your browser executes. You continue to surf, while the javascript still continue to run in your browser. From there, only the imagination of the attacker stops him/her from what that malicious js should be doing. I wont elaborate the consequences, but this is a somewhat of a new trend on the internet. Specially now that firefox3 and opera both executes javascript within the blink of an eye.

Ternary in Python 2.5

Python 2.5 features a new ternary expression. Here is an example to clarify how it works:

In[1]: boolean=False

In[2]: answer = "yesss" if boolean==False else "noo"

In[3]: answer
Out[3]: 'yesss'

In[4]: answer = "yesss" if boolean==True else "noo"

In[5]: answer
Out[5]: 'noo'

Summary:
variabel = [expression-1] if [boolean-condition] else [expression-2]

Reference: http://www.python.org/dev/peps/pep-0308/

Make ipython behave even more like your bash

Ok, a little tip for all you ipython users out there.

If you are really used to the way your traditional bash shell works, there is one thing I found that ipython by default lacks. And that is the clear screen command. In ipython by default, you have the !clear command to clear your screen space. But it's not as efficient as the Ctrl+l keyboard shortcut. So I wanted this behavior in ipython too. Here is how you do it:

In your ~/.ipython/ipythonrc you should locate the line:

readline_parse_and_bind "\C-l": possible-completions

Datatype musings

Have you ever thought about the fact that the world most quoted theatrical phrase 'to be, or not to be' - by Hamlet - is really a boolean?

Have you ever gotten an error, and you are sure you've seen it before - but you can not recall what causes it?
Then you have just experienced a Déjà Foo(tm).

gvim refuses to load background color

I'm a avid user of gvim. And I've noticed that my color schemes don't load the correct background color (they do however in vim). In your .vimrc you have to add a little code snippet to solve this:

if has("gui_running")
gui
colorscheme golden
endif

Where golden is the name of the color scheme you want to use.
Thanks to mgedmin for the solution! :)

Cheers!

What is under the hood on digg.com?

This slide lists the technology and solutions that powers the all so popular news site digg.com.
I thought this might be interesting reading for those of you who care about high performance.


Syndicate content