Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Friday, June 20, 2008

46893711600000 - what does this number signify?

46893711600000 is the number of seconds since "00:00:00 January 1, 1970." that it will take to get unlimited storage space on gmail ...:) If the javascript in the gmail login page is to be belived.

So we will get unlimited storage space in gmail at 01-02-3456 07:00:00 hours.
However, the year 2038 problem if not fixed in future versions of the browsers for Javascript the program will just fail. If you just google for 46893711600000 you will be surprised by the number of results you will get though.

Friday, April 11, 2008

Passing values between Javascript and Vbscript

Very few applications are using Vbscript, but lot of old code exsists that use Vbscript. So its not very difficult to run into a situation where values have to be passed from one to the other. First i was thinking of using a hidden text box to pass values between the two... but its much easier. You can call variables from both, meaning variables are not specific to the scripting langauge as both are client side scripting langauges.

See the following code:

<html>
<body>

<script>
jvalue=confirm('Pass a value to Javascript');
</script>

<script type="text/vbscript">
document.write(lcase(jvalue))
<!--javascript variable used in Vbscript function -->

vvalue=ucase("vbscript here")
</script>

<script>

alert(vvalue)
</script>
<!--Vbscript variable used in Javascript function -->

<input type='hidden' name='passval'>

<!--no need of hidden text box-->

</body>
</html>


This example shows how one can use variables from javascript in vbscript and also vice-versa.
The situation is very different when values are to be passed between a client side script and a server side script.

Saturday, March 8, 2008

Cows and bulls practical

The correct guess to try in the practical version of cows and bulls encrypted is 6598. the number of cows and bulls are displayed in the alert box. The logic is simple....the RSA public key cryptography is used with a preset key of 17 and 3233. The example is taken right out of wikipedia. The guesses that are entered are taken and there position is appended to it(i.e, 1,2,3 and 4). This value is then encrypted and compared with the values stored in arrays 'a' and 'b', a has the values that are bulls and b has all the cows. The values are given below:
bulls
64-1577
53-652
92-2762
81-1485
cows
63-2909
62-1162
61-178
54-1978
52-3094
51-2985
94-205
93-456
91-3157
84-1820
83-3185
82-2661
The game in practicallity would have to have more number of such encrypted arrays. One of them would have to be choosen randomly. However, the randomess doesnt need to be hidden.If a higher degree of encryption is needed, the keys can be changed and the arrays and the function that is used to encrypt can be changed at the server side when the javascript is generated.

Tuesday, March 4, 2008

Cow and bulls-javascript posible?

This post assumes you know what a trap door function is, and also about Gautham B Pai... and his cow and bulls game and the challenges he seems to be facing with javascript....
The challenge is to make the game completely using javascript and only upload the results back to the server. This seems to be one of the ways to "Make the game run completely using javascript"....

First all the numbers 0 to nine are encrypted using a trap door function such as RSA. The numbers have to written in words(filled with blanks to make all the numeric words equal) to prevent easily breaking the code by trial and error. If further higher levels of security are needed the number combinations should be used.

Ok so basically we have an array of encoded numbers in word form.We also have the public key to encrypt the guesses from the user. Based on the output from random number function, a variable set is choosen from the array. The values entered by the user are encrypted using the public key and compared with value stored in the choosen variable set. If both are equal, the results are sent to server...

This method can be effective if the public key seed value is defined by the server at the time the javascript is generated.This ensures the effective and secure game plan...!!!!!!! Since the player cant know the actual value of the number even if he knows the encrypted form of the number this should work..

Wednesday, June 20, 2007

Rediffmail greasemonkey version 0.1

To use this greasymonkey script, u need to have installed the greasemonkey on your firefox browser. The script is for the new rediffmail which has the largest inbox in the world. It is the preliminary version and has just two features-
  1. Removes the banner ads from the free versions inbox.
  2. Provides google talk on rediffmail homepage and inbox.
The following screen shot shows the inbox without the right side banner ads. The Google talk is on the left side bar. To be able to use google talk you need to be logged into gmail. rediffmail greasemonkey
The main page of the rediffmail has been modified to remove the sponsored links and the advertisement at the left top corner has been replaced by gtalk.
rediff gtalk greasemonkey

To install the grease monkey just click on Nagarjunvs rediffmail version 0.1 in firefox and a dialog box will appaer which can be followed to install the greasy monkey.

Tuesday, June 19, 2007

Eclipse Monkey-get ur program written by a monkey

Eclipse is a highly extensible IDE(Integrated Development Environment) and much much more. The eclipse monkey from project dash is a great addition to eclipse. To put it in a single sentence the eclipse monkey is the eclipse equivalent of greasemonkey. Eclipse monkey provides javascript extensions for "eclipse", which is best suited for small additions.

A example of what eclipse monkey can do is the "comment" script- it simply adds "//"in front of the selected lines of code. The repetitive tasks that may be specific to a project can be done by these monkeys.

Some features that are needed by eclipse monkey are-
  1. A script manager-Now "Scripts are installed in the Monkey menu by placing them in "*.em" files in a top-level "monkey" folder of any project (obviously, scripts are un-installed by renaming or moving them). The complete set of scripts is the union of the scripts in all the top-level monkey folders in the workspace."However, it would be better to have a script manager that lists the various scripts that are present. The projects for which the scripts are needed are to be included or excluded using the script manager.
  2. Undo script action--even for scripts run during past sessions.
  3. Running multiple scripts in combination-a sort of piping.For example-a script to find all lines with "system.out.println" should pipe its output to the script that will comment these lines. Separate monkeys should work together without the need for writing new scripts.
Enough of feature requests. It would be better if we wrote monkeys to get all these features.

Wednesday, May 2, 2007

Posts of Note-Add your blog posts here.

Today Posts of note seems ready to work on both firefox and internet explorer. It is a online application powered by lazybase, you can add blog posts that you find noteworthy. You simply give the title and URL in the add post page. Giving a description is optional.

The posts can also be ranked on a scale of 1 to 5. The concept behind the Posts of note
is that of a newspaper. The articles that are worthy are put in a single place for people to read. Rather than having to subscribe to multiple blog feeds, you can directly subscribe to the feed of posts of note.

The only modifications, technically made by me is modifications to the java script file obtained from lazybase. The redirect page has been modified from the self to the home page. The entire exercise gave some idea of using external add scripts. The meaning is we can use scripts present on an external server for our own purpose with modifications.

If you want to make modifications to your lazybase script take a look at the source code of the add a post page. However, editing of data using an external script seems impossible with lazybase. Hope to find a work around for that soon. If you find Posts of note useful do let me know.