July 6, 2009

cloudgen 的無名小站


April 15, 2010

Server-side Javascript for client-side redirect

In the previous article, we have shown you how to encode a piece of javascript into a series of decimal numbers (decimalized). Now we put it a step further. We create a client side redirect script using the decimalize technique. For a normal client side redirection (say to www.google.com), we can use the following javascript code:
  window.location.replace("http://www.google.com");

If we want to hidden the links of google, we can use the decimalize technique and our code becomes:


April 15, 2010

How to obfuscate and encrypt your javascript in decimal number

If you want to encrypt say alert("Hello"), first you should convert your string into every character represented by their ASCII.

For instance, "alert" is represented by "97,108,101,114,116"

where "a" has the ASCII code of 97;


August 20, 2009

The complete guide for obtaining the class name of an Javascript Object (5)


August 20, 2009

The complete guide for obtaining the class name of an Javascript Object (4)


August 20, 2009

The complete guide for obtaining the class name of an Javascript Object (3)


August 20, 2009

The complete guide for obtaining the class name of an Javascript Object (2)


August 20, 2009

The complete guide for obtaining the class name of an Javascript Object (1)

It's a big challenge for Javascript programmer to obtain the class name of an Javascript Object even before the starting of "Browser War". Let's explain how difficult it is for us to complete the mission.



August 10, 2009

How to write a spanish Date function?

The spanish date usually has the following format:

24 de Febrero de 2008


July 18, 2009

jscript Utility for VBScript, ties two extreme and leads to an even better web development la

I used to write a lot of classical ASP. The company I am working uses classical ASP as the main development platform for eight years. Since most of the modules are developed in ASP, and the existing system too complicated than most of us expected, that's one of the reason why we keep developing modules in classical ASP. Another main reason for using classical ASP is that, when we modified some pages and upload them to the server, we don't reset the session data for the exiting users. That means, the users even alert the changes you've applied.

To me, classical ASP is a great development tools for maintaining a website 24x7. VBScript is the mostly used language in classical ASP due to the reason that there is plenty of examples and resources found in the internet, the language is a good starting computer language too.


July 18, 2009

Javascript function closures and design of encapsulated javascript object and class

In the previous article "Add property to Javascript Object in "jQuery" style and "One line properties setter and getter for Javascript class", we use the technique of function closures to create private variables for an object as well as private varibles for a javascript class. Let's examine the concept behind: function closures:

Variables declared inside a function using reserved word "var" are local to the function, i.e., the variables are independent to variables outside the function. Let's see the following code:

var a="15";
function inner(){
	var a="16";
}
inner();
document.write(a);


July 15, 2009

One line properties setter and getter for Javascript class

In the previous article, "Add property to Javascript Object in 'jQuery' style", I have mentioned the technique of how to add a property to a Javascript Object. With the predefined rules set to the properties, we can create pretty good Javascript Objects with encapsulation, and furthermore, we can prevent the misuse of the Javascript Object by other user who can access the object.


However, the situation becomes complex if we want to create more objects. You will notice that we have to add the properties to the object one by one. The direct solution for this is to create a Javascript class for the collection of objects.


July 14, 2009

A javascript class for retrieving query string

In the previous article, "Add property to Javascript Object in 'jQuery' style", I have mentioned the technique of how to add a property to a Javascript Object. With the predefined rules set to the properties, we can create pretty good Javascript Objects with encapsulation, and furthermore, we can prevent the misuse of the Javascript Object by other user who can access the object.


Object Oriented programmers are not satisfied with "Encapsulated Javascript Object". It's better if we can extend the "Encapsulated Javascript Object" to "Encapsulated Javascript Class". The basic for creating encapsulated javascript class requires javascript function enclosures. If you are not familar with javascript enclosures, you can see the article:"Javascript function closures and design of encapsulated javascript object and class". The following code is an updated version of "encapsulated javascript class"


July 7, 2009

Load a cross-server javascript dynamically

In our internet world, there are a lot of web spaces for storing our source code. It will be quite convenient to maintain our javascript source code in a number of different servers, and at the same time, we can add the code whenever we needed it.


If one of the servers is down, we can load the same object from other server. To achieve this, we should have a script that is able to load a remote script anytime it is need.


July 6, 2009

Make a javascript function lazy

After reading Oliver Steele's article "One-Line JavaScript Memorization", I recall the similar situation before when I was request to design a JScript registry sytem for a portal site. Adding or setting a transaction in a registry is fast, however, the generation of registry, part of the registry or reindexing is slow. To memorized the previous result is useful in these cases. In order to extend the scope of application, I have rewrite Oliver's code into prototype version.


Adding the prototype of reCalc to avoid any possible error of resetting a calculation method using its reCalc() before makeLazy() is called.



unlog_NVPO 0