Pages

Thursday, December 8, 2011

Unknowns of JavaScript

                You will probably find some thing unknown to you if you are not an expert JavaScript programmer and not familiar with JavaScript meta programming techniques! If that is the case, i can assure you that you will find something new and useful in at least one of the following posts.

Redefine function within function to avoid unnecessary if else blocks in JavaScript - this post is about self optimizing JavaScript functions.
Identifying weather JavaScript function is used as a constructor - this tells you the difference when a JavaScript function is called with new keyword and as a regular function call.
Public, Private Methods and Variables in JavaScript - as you know there are no public or private keywords in JavaScript to define the scope as in Java. This is about doing it even without those keywords.
Retain values between function calls without using global variables - normally we use global variables to retain some value between function calls. this tells you how to do it without using global variables.


Monday, December 5, 2011

Adding source file to the Google code using TortiseSVN



Go to the source tab of your projects page. There you will find a svn checkout URL of the project and the username. My URL looked like following

https://ceyloan-wordpress-theme.googlecode.com/svn/trunk/

In the same page, you will find a link to googlecode.com password. , follow this link to get the password.
Install TortiseSVN

Right click on the folder containing the source files. Click on TortiseSVN > Import

Enter the trunk URL, you will be prompted to enter the username and password.

That’s about it!

Creating an application specific library for application developed using Zend Framework



                I just wanted to do this when I tried to implement link exchange application using Zend Framework to understand the usage of Zend.
Here is what I wanted to do,
Create an Acl plugin and put it in a folder inside the library folder. Path from the application folder in www directory is as follows

linkdir/library/Linkdir/controller/plugin/Acl.php

in order to identify the this plugin by frame work I needed to add its name space to autoloader. If you are trying to do the same solution is here. Otherwise you are at the wrong place and this won’t be of any use for you.

Here is how I did it
I added the following line on the applicatioin.ini file

autoloaderNamespaces[] = "Linkdir_"

Since I added the name space my class name also needed to reflect the name space. Therefore the class name should look like something following

Linkdir_Controller_Plugin_Acl

Folder names are separated using ‘_’ .
There might be a way to do this by overriding  _initAutoload() method in the bootstrap.php file in the application folder.