web developing
27 May
Recently we (Petar Atanasov and me) were working on a Zend Framework project, which requires more than one database connections. The framework as a typical MVC architecture does not allow that functionality forcing the user to use one single connections. However there is the setDefaultAdapter in ZF which is enough to think about switching the default adapter between the different connections.
The detailed tutorial how to make it work you can find on my colleague’s blog here.
25 May
Let’s assume we’ve a JavaScript file which rewrites the location.href, resulting in changes in the URI of the browser. Everything is OK till you work with Latin alphabet. The problem arises when you decide to put some Cyrillic symbols into the string.
With that function you can encode the URL if you have some entity symbols. It is not like but it should be something like encodeURI in PHP. The problem is that this function does not work correctly with Cyrillic symbols.
There is another usefull function which does this. It’s called encodeURIComponent, and I strongly recomment its use.
25 May
Everybody knows how to debug the front end on Firefox. There are some awsome tools, which help to manage your work. We all use “Web Developer” and the ready to enter the history “Firebug”. Both tools can be downloaded and installed for free, but what about IE and the misterious DOM rendering there.
One of the two plugins I recommend for IE is IE Developer Toolbar. That plugin perfectly solves the problem of viewing the rendered code from the browser. That helps a lot when debuggin front end, and I mainly use it for that. Download from here.
That’s the most famous IE plugin for web developers with no need to be commented. Every web developer with no exception should use it on IE to find the mistery around that browser. Download from here.
25 May
to generate a random number between any two interger unsigned numbers. Let’s assume we’ve two numbers ‘a’ and ‘b’, where b > a. (I don’t count the case with b==a, cause it seems to be pretty strange!). The formula should be like that:
Math.random() * (b-a+1) + a
because simply by using Math.random() * a gives a random between 0 and a-1. With the expresion (b-a+1) gives a random number between 0 and (b-a+1) and than by adding the value of a we’ve the number between a and b.
25 May
JQuery is one of the most famous JavaScript library online. There are so much articles in the web about it, that I feel useless to describe it again. The good parts of that library is the amazing way it handles the DOM. It is so good at that that I usually use it with other JavaScript libraries.
Now I’m working on a task and one of the main target of the completed task was the RAM usage of the code. It just has about 100 dynamic DOM elements which on every event should be removed form the tree and the RAM should be freed. (more…)