Yavor Atanasov web portfolio

Weblog

2012
04.05

Although already introduced features of ECMAScript5 fix this, the global property undefined in older versions of JavaScript is writable just like any other property. This means someone can override it which can cause trouble in a shared environment where everyone assumes its value.

undefined = "not undefined anymore";
(function(arg1, arg2, undefined){

    // undefined is undefined in here

})(value1, value2);

This creates a locally scoped variable undefined that has the value of undefined (more on the type, value and variable undefined here). This way your code does not rely on the “fragile” global undefined and is more robust.
More info:

2012
04.04

The more verbose way of getting the value from a key in a dictionary in Python involves checking if the key exists first and then reading the value. Otherwise an exception would be raised.
Like so:

dict = {'key':'value'}
if dict.has_key('key'):
    print dict['key']
else:
    print 'no such key'

The .get() method will do all that for you:

print dict.get('key', 'no such key') 

This is far more compact and expressive. Ref: Python Mapping Types – dictionary

2010
10.25

ubuntu_10.10_wallpapers

Earlier this month (on 10/10/10 in fact) Canonical added a brand new member to the mighty Ubuntu family – 10.10 Maverick Meerkat. If you still have not switched to it, I strongly encourage you to do it There are some great improvements and added features. And in case you have already switched, and you are just looking for some new wallpapers to bring some Ubuntu harmony to your desktop, well, you’ve stumbled upon the right URI! Here is a small, but very clean and beautiful collection of fresh desktop eye candy. The first 5 are kindly created by jbaer. Read more >>

2010
07.17

Pitfalls of CSS3

Everyone in the vast community of “web people” these days seems to be extremely excited about CSS3. Along with “HTML5″, “CSS3″ has become one of the big buzz words on the web. Browser leaders like Firefox, Chrome, Safari and Opera started adoption of CSS3 before the final specification has been released. This has made it possible for developers to tap into new style properties, selectors and even transformations. CSS3 is like the new playground that all children have been waiting for and now everyone wants to play. Everyone is excited, but is it for the right reasons? Read more >>

2010
07.08

Securing Hidden InputInput fields of type “hidden” are non-interactive form elements that are not rendered by the browser (remaining “hidden” from the user). This type of input element represents a value that is not intended to be examined or manipulated by the user. Its sole purpose is to facilitate data round-trips from and to the web server, thus, trying to solve implications caused by the fact that web servers are stateless. In some respect, the role of the hidden input field intersects with the one of the cookie – trying to maintain a state between http requests. Read more >>

2010
05.01

PHP Singleton Design PatternIn software engineering, patterns simply suggest possible solution templates for re-occurring programming challenges. Patterns are not associated with any specific programming language. They just suggest a solution blueprint that can be implemented in any language. Depending on the level at which they operate within the application, software patterns can be divided into design patterns and architectural patterns. Read more >>

2010
04.14

high performance websites

Speeding up and optimizing JavaScript

This is an excellent and extremely useful talk by Nicholas Zakas. He discusses JavaScript performance issues including scope management, data access, loops and the DOM. It’s the way these issues are approached that makes the difference between mere scripting and front-end engineering. Read more >>

2010
03.03

bezier curve actionscript image

Bezier curves, invented by french engineer Pierre Étienne Bézier, play a crucial role in the world of computer graphics (and not only). They are used to create smooth and infinitely scalable curves (and surfaces in 3D) in vector graphics. In addition, in computer animation they are used to describe and control the velocity of an object, so that a more natural motion can be achieved via ease-in and ease-out effects. Those are just some of the applications of Bezier curves. Read more >>

2010
02.27
1. Introduction

CI_jQuery_validation In a dynamic web application the database is the heart that keeps it alive pumping data in and out. The database is the very core that holds the essence of that application – the data in its basic form. That core is then wrapped with the application layer that holds all logic and operations that seal that data and control its communication with the outer world. A web application is like a living cell and if something malignant enters its nucleus, it dies or becomes harmful.
The web forms are a peculiar HTML element because they provide a pathway for external input leading to the data core of the web application. Therefore, what happens to that external input along the way before it enters the database is of crucial importance. Read more >>

2010
02.16

Apache URL mod_rewriteURL rewriting and redirecting helps web developers create websites that are more user and search engine friendly and even more secure. The URL is the pathway that leads the user (be it a human or a machine) to the valuable information your website has to offer. The longer and “dirtier” this pathway is, the more difficult it is for your information to be discovered and reached. That is not something you would like to do to your website.

There are several scenarios in which you as a developer might want to use URL rewriting and redirecting. Read more >>