Tuesday, March 24, 2009

Download JavaScript Gridview

I have developed a JavaScript Gridview. You can download and use it in your website. It is very customizable for which you just have to change css styles. And it can sort the data rows columnwise(eg. sort by name, DOB) by just clicking on the header row. I will release the next version with more additional functions like paging. Please leave the comments how you like it?

download

Friday, March 13, 2009

Fundamentals of Prototype Object in JavaScript

[click on the picture to enlarge it]

I got a chance to read the specification of the JavaScript where I learned about the fundamentals of object and its prototype object. We create an object in JavaScript by
function obj(){
this.prop1=sth;
}
When we create an object, JavaScript also create a “prototype object” for that particular object.
By default, JavaScript will also create properties like .constructor (To learn about it, I would like to recommendhttp://www.w3schools.com.) and .prototype. This .prototype property of the object points to its prototype object.
Now, when we create an instance of the object by using new keyword, it makes a replica of the object. The instance has a copy of properties as well as methods in itself.(unlike other object oriented programming language like c++, Java where the instance keeps a copy of properties only but methods remain with the object and all instances share the same methods).

instance1= new obj();
But all the instances of the object share the same prototype object which means all the properties and methods in the prototype object are shared by all the instances.

For example:
obj.prototype.sharedprop1=”sharedvalue”

document.write(instance1.prototype.sharedprop1)
Output: ”sharedvalue”

document.write(instance1.prototype.sharedprop1)
Output: ”sharedvalue”

So, if the methods and shared properties/variable are put in prototype object, the instance always consumes less memory. If you are creating large number of instances of the object, you really have to work on with prototype object.

If you write document.write(instance1.sharedprop1) it will still work and gives output “sharedvalue” because what JavaScript does is, when it doesn’t find out the sharedprop1 in instance1, it lookups for that property in prototype object and get it. In the same way it works for methods also.
Links:
http://www.ecma-international.org/publications/standards/Ecma-262.htm
http://www.slideshare.net/s.barysiuk/javascript-basics-and-dom-manipulation-presentation

Thursday, February 12, 2009

ADOBE-AIR

I used Adobe- air to convert HTML, javascript web pages into desktop app. I think Adobe AIR will last long .I am sure AIR will be a part of cloud computing because it supports HTML, JavaScript, XML which are the major client-technologies that cloud-computing uses.Besides acting like a web-client, it also can be a desktop agent. AIR is bridging the gap between desktop application and web application. "Jaya hos ADOBE AIR ko. Pasupati nath le raksha garun"

Tuesday, January 27, 2009

Integrating Asp.net with Ext js



Today, I wrote a sample program using Ext-js on the client side and asp.net on the server side. This sample program has a form with a textbox and combo box and the items in the combo box are loaded from the database (Department table of the adventure works). This should be pretty much simple task for those who have been using Ext js. But it took me couple of hours to get Ext js config objects.
When you have to send object to the client, you can either serialize in the json or xml. Here in my sample program, I used json formatted data. For converting the .net objects into json, I had to use the codes from this site http://james.newtonking.com/projects/json-net.aspx (http://www.codeplex.com/json/) because .net framework doesn’t have json serializer.
Steps:

  • I created a project- web application extjs and added “linq to sql” item in the project(adventureworks.dbml) and added department table into the design surface.

  • In code-behind of default.aspx page, I wrote these codes.
    I couldn't upload the code file. I will upload it later.

  • In default.aspx I wrote ext js codes.
    I couldn't upload the code file. I will upload it later.

  • Then got the output.


Monday, November 10, 2008

A Fix : Firebug Debugger doesn't work

I spent hours in starting debugger on Firebug 1.2.1 . I didnt know what the problem was. Under script tab, I put the breakpoints on the code but none of the buttons like Run, step into, step over , step out was active. Then, I finally found in one of the blogs that something wrong with the profile Manager in Mozilla Firefox. Then the problem was fixed as I ran the firefox profile Manager.
Steps :
1.Close all the instances of firefox browser.
2.In Windows/ Start/ Run cmd: firefox.exe -profilemanager

Then the debugger started working. So, there was some problem with my profile. But still don't know what was that.Now, I can see the active debugger buttons as shown below.

Sunday, November 9, 2008

Ext JS- power of javascript

Last month, my friend Bikash who is working in Washington was talking about the challenges that he had faced on binding the data on Ext js controls which I had never heard before. I was wondering what in the earth that is. Then I explored Ext js which is an extended library of javascript where most of the stuffs are in Json. When I saw the sample controls, I was awed. Oh man! Unbelievable! Superfast control! Awesome GUI!
Ext js also provides the framework library which I downloaded and installed it in my IIS and started writing Ext js.

Thursday, October 2, 2008

Trace into .NET Framework codes

I am finding lots of interesting things these days. I was reading Scott Gutrie's blog and found out a link from there to the other blog http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx where I found the details about tracing into .Net framework codes. Now we will be pressing F11 more than before.

Wow! Google Custom Search Engine



Google has given us lots of good stuffs for free.I found the custom search engine in this URL http://www.google.com/coop/cse/ .I can customize the keywords for search and list out the URLs to search within.This is wow..It saves my lot of time by filtering the unwanted results.

Sunday, September 28, 2008

C# 3.0 Getter and Setter property

I am reading 'C# in Depth' by Jon Skeet. I am loving this book because this book has presented the evolution of codes in different versions of C#.
I was excited to learn about this cool time saving feature.
In C# 3.0 Property, we dont have to declare a member variable to create a property and we can use getter as public and set the setter as private in Property initialization. The following code will create a property Name in c# 3.0

public String Name
{
get;
private set;
}

Monday, June 30, 2008

I started LINQ- my First program(Linq to XML)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;

namespace Linqex_1
{
class Program
{
static void Main(string[] args)
{
XElement xml= new XElement("Bookstore",
new XElement("Book",
new XElement("Author","J K Rowling"),
new XElement("Title","Harry Poter")
),
new XElement("Book",
new XElement("Author","William Sakespeare"),
new XElement("Title","Hamlet")
)
);
xml.Save("c:\\Bookstore.xml");

//Loading xml -Writing Linq Expression to printout element's text
XDocument doc = XDocument.Load("c:\\Bookstore.xml");
var q = from c in doc.Descendants("Book")
select (String) c.Element("Title");

foreach (string s in q)
{
Console.WriteLine(s);
}
Console.WriteLine(xml);

}
}
}

Friday, June 20, 2008

Binding CheckBoxList with Arraylist -A Problem

Though I can bind the ArrayList as a DataSource for the checkBoxList Control, but it became a problem for me. When I tried to get the selected item
----------------------
CheckBoxList1.Items[i].Checked
---------------------------
It always returns false, no matter you check the checkboxes or not.
So, To get rid of this roadblock I had to use DataTable as the DataSource.

Monday, March 31, 2008

I upgraded to .Net 3.0

I just accepted the Microsoft EULA for .Net 3.0 and clicked ok Button for Installation.
Today I officially upgraded to .Net Framework 3.0 from .Net Framework 2.0.
I am excited to learn about WCF,WPF,WWF and LINQ.
Yahoooooooo!

Monday, March 24, 2008

.Net Framework has ThreadSafety in Static Variable Initialization

Its a great thing to know about some facts that reduce your coding time .Net Framework JIT compiler only initializes the static variable only when any method uses it. Static field is instantiated with a thread safe. .Net Framework cares all about it. You dont have to add Thread Safe code for initializing static property.

For example : http://msdn2.microsoft.com/en-us/library/ms954629.aspx

Tuesday, February 26, 2008

Login failed for user computername\ASPNET

$exception {"Cannot open database \"Pasal\" requested by the login. The login failed.\r\nLogin failed for user 'owner-CC6FEF3\\ASPNET'."} System.Exception {System.Data.SqlClient.SqlException}

Try to solve this kind of error by adding below lines in web.config file.
<system.web>

<identity impersonate="true" userName="abc" password="abc" />

</system.web >

Wednesday, February 13, 2008

Unable to connect to Visual Studio's Localhost Web Server

This Problem occured when I was trying to compile ASP.net in VS 2005. I tried for 2-3 hours tyring every possibilities like changing browser settings, turning off windows firewall but nothing works. At last I found in some forums that it might be the problem with the file WebDev.WebServer.exe which comes with the .net framework. Then I copied WebDev.WebServer.exe from other machine and replace it and it worked. my gosh ! the file was corrupted.

Sunday, January 20, 2008

Teach Yourself Programming in Ten Years

I found this article interesting. It is written by Google Researcher Peter Norvig.Most of us who have taken AI courses might have read his popular book AI: A Modern Approach (book)
link for the article is :

http://norvig.com/21-days.html

places I have visited