Wednesday, December 26, 2007

it's again......

Thanks for all the people who remembered the day... :)

Tuesday, November 20, 2007

Visual Studio 2008 and .NET 3.5 Released

Yesterday(November 19, 2007) Microsoft has Released Visual Studio 2008 and .NET 3.5. You can download the final release using one of the links below :

you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here. A 90-day free trial edition of Team Foundation Server can also be downloaded here.

Still they haven't announce about the trial of visual studio professional.

If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here.
If you want to just install the .NET Framework 3.5 runtime, you can download it here.

And if you wanna know about more details about this please visit ScottGu's Blog

Tuesday, August 07, 2007

Dynamic Template Columns in the ASP.NET 2.0 GridView Control: Part 2

Sorry for the delay. It's a bit late to publish the continuation of my earlier post. As I mentioned previously you can add a dynamic column to gridview. However there is another way of doing it. It depends on your requirement. The 2 nd method is much easier though.

You have to create a Usercontrol. Let's say you need to have a Text box in your grid. Then just add a text box to your Usercontrol and in HTML view you can edit it as shown below... (Other than a Textbox I have add a CompareValidator to check the data type of the Text box.)


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyUserCont.ascx.cs" Inherits="TestApp_MyUserCont" %>
' Width="90px">
ID="CompareValidator1" runat="server" Display="Dynamic" Type="Currency" Operator="DataTypeCheck"
ErrorMessage="*" ControlToValidate="txtQty">




In the code Text='<%# Bind("Quantity") %>' take care of Binding data to the Text property of the Textbox. "Quantity" is the Column name of my data table (gridview data source).

Next is to create your Dynamic column as follows...


TemplateField tmpQty = new TemplateField();
tmpQty.HeaderText = "
Quantity";
tmpQty.ItemTemplate = LoadTemplate("../
TestApp/MyUserCont.ascx");
tmpQty.Visible = true;
gvTransaction.Columns.Add(tmpQty);

Hope this will make things easier than the earlier method. But there are some limitations. So as I mentioned earlier you have to identify which method is suitable according to your requirement.




Friday, August 03, 2007

Dynamic Template Columns in the ASP.NET 2.0 GridView Control: Part 1

Recently I was involved in a project where we needed to present the results of a database query as part of an ASP.NET application. It was such that the user can select grid columns and the type of the columns also Differentiating depending on the requirement. It may be a button, column, editable column (text box,check box,etc...) It was not known until runtime how many columns has to display, which columns has to display or which SQL query is needed to satisfy the search criteria. So I had to use dynamics template coloumns for the editable coloumns.

A GridView template is a class that implements the ITemplate interface. It defines the controls that will be displayed on the GridView in a column.I thought it's worthwhile to share it here.


// Class for define Template, this class will added to your app_Code folder.
public class SampleTemplate : ITemplate
{
private string _DataField;

public
SampleTemplate (string DataField)
{
this._DataField = DataField;
}

public void InstantiateIn(Control container)
{
TextBox txtItemVal = new TextBox();
txtItemVal.DataBinding += new EventHandler(this.OnDataBinding);
txtItemVal .ID = "txtItemVal";
container.Controls.Add(
txtItemVal);
}

public void OnDataBinding(object sender, EventArgs e)
{
TextBox TXT = (TextBox)sender;
GridViewRow container = (GridViewRow)TXT.NamingContainer;
string id = ((DataRowView)container.DataItem)[_DataField].ToString();
TXT.Text= id;

}
}



Adding template to your grid.code behind file.In my case i am going through a for loop with in the user datacolumns datatable and adding coloumns to gridview.

TemplateField tmpItem= new TemplateField();

// you have to specify column name as "datafield" here.as for the gridview data source.lets say you //have Employee datatable.and you want to show Empage in this template coloumn.then you should //use empAge as your dataField

SampleTemplate TEMP1 = new SampleTemplate ("Empage");
tmpUnits.HeaderText = "Employee Age"
tmpUnits.ItemTemplate = TEMP1;
gvTransaction.Columns.Add(
tmpItem);

Thats it.Hope this will help you one day.And there's a another way also.will tell you latter. ;)



Thursday, June 07, 2007

Mahalo

Hi, I found this Mahalo while i am surfing the web.Mahalo is Hawaiian word for Thank You.But thats not the thing which i am going to talk about.Mahalo is the world's first human-powered search engine powered by an enthusiastic and energetic group of Guides.Means .Mahalo Loads only built sreach results by Mahalo Search guides.Mahalo Search guides spend their time to searching ,filtering out spam, and hand-crafting the best search results possible.If they havent built a search result, you have to request that search result. Meaning every search result is carefully reviewed by humans to select the best search results and filtering out spams.

Monday, March 12, 2007

ArrayList vs List<> Generics

when i am working with my new Team in the new place i have got a chance to work with new Generic lists witch has available in .net 2.0. when i am finding information about generic list i understood it's much more better than arraylist. i just checked

Time taken by Collection: 7044.6912 ms
Time taken by Generic: 2898.9216 ms

i just wrote small program using arraylist and the generic list witch is giving the same result.what i understood is on the Generic list you can only assign int (as for the my code.You can supply data type in to List's <> ) to the list - anything else will raise an exception.If you wanted to store a multitude of types, simply inherit from a common base, and use the base as the list identifier.(Use .GetType() ) if i simply says generic list is simple and Safe. :)

if we used arraylist in our code it has to more boxing operations b'coz it can any type.but in generic list is not allowed as i said

here is the code for what i did.


using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace Listcompare
{
class Program
{
public static DateTime startTime;
public static DateTime endTime;
public static TimeSpan timeSpan;

private void CheckGenerics()
{
int total = 0;

List lstMyList = new List();
int i = 0;
for (i = 0; i < 20; i++)
lstMyList.Add(i);

for (i = 0; i < 10000000; i++)
foreach (int el in lstMyList)
total += el;

}

private void CheckCollections()
{
int total = 0;
ArrayList al = new ArrayList();
int j = 0;
for (j = 0; j < 20; j++)
al.Add(j);
for (j = 0; j < 10000000; j++)
foreach (int el in al)
total += el;
}

private void Run()
{
startTime = DateTime.Now;
CheckCollections();
endTime = DateTime.Now;
timeSpan = endTime.Subtract(startTime);
Console.Out.WriteLine("Time taken by Collection: " + timeSpan.TotalMilliseconds + " ms");

startTime = DateTime.Now;
CheckGenerics();
endTime = DateTime.Now;
timeSpan = endTime.Subtract(startTime);
Console.Out.WriteLine("Time taken by Generic: " + timeSpan.TotalMilliseconds + " ms");

Console.WriteLine("");
Console.Read();

}
static void Main(string[] args)
{
Program myPgm = new Program();
myPgm.Run();
}
}
}

Sunday, March 11, 2007

Advanced to new Blogger

it's very close to one month from my last post.I was bit busy with work.good news !!! Sri Lanka Telecom has provided ADSL to Homagama area.guess what I am on ADSL now.

when I logged in to blogger for the last time it advice me to associate my blogger account with my gmail account for migrate to new blogger.So I have moved to new blogger but I couldn't update my blog as for the previous look and field.Today I got a chance to make it back. :)

My blogging rate is getting down now.I should start writing. so have a look again .....

Friday, February 16, 2007

Last day at work...

it's my last day at the South Asia Software... being with such a bunch of nice people was a nice experience in my life... it's really sad to leave these people... but it's for my good.. hmmm....But it's really hard to leave the place.

Miss you all. Tnx again for everything !!!

Tuesday, December 26, 2006

Once again i felt that i am not alone.

Thanks for all the people who remembered the day... :)

Wednesday, December 20, 2006

Back !!!

OH! I haven't come here for more than one month.I think I have really miss my blog hehehe.So wazz up with me? mmmmmmm

well I have moved in to C#.Net.(You was waiting to hear it from me. isn't it charith ? lol)I was working with VB.Net more than 2 years.But because of the new project that we have got we had to move in to C#.I have no choice.anyway it's pretty cool thing.

I miss Deep dive .NET 3.0 I always missing important things I do not know what's wrong with me.anyway hope to be alive with ma blog again.and bring up new things here.

cheers !!!

Wednesday, November 01, 2006

Microsoft has announced Light Weight Open Source Applications(Online)

October 30th Microsoft has released a free downloadable accounting program called Office Accounting Express 2007. This software focuses on integrating with online sites like eBay, PayPal and Office Live. See for comparison Google’s partnership with Intuit.

And 31st of October they have announced that the first version of Office Live will come as beta version on the 14th of November. Office Live is a free service with premium services for small businesses. It includes online storage, webmail and calendaring.

What will be next.....

Read more at Techcrunch.

Thursday, October 19, 2006

The Difference ...

Found a Nice story from my emails today..... I just wanted to bring it out here ,because I feel it's special.

Little girl and her father were crossing a bridge.
The father was kind of scared so he asked his little daughter, "Sweetheart, please hold my hand so that you don't fall into the river."
The little girl said, "No, Dad. You hold my hand."
"What's the difference?" Asked the puzzled father. "There's a big difference," replied the little girl.


"If I hold your hand and something happens to me, chances are that I may let your hand go. But if you hold my hand, I know for sure that no matter what happens, you will never let my hand go."


In any relationship, the essence of trust is not in its bind, but in its bond .
So hold the hand of the person whom you love rather than expecting them to hold urs...

Wednesday, October 18, 2006

Nikhil Kothari's Ajax.net presentation on JAOO 2006 Conference

Here is the link for nikhil Kothari's presentation on ASP.NET AJAX at the JAOO 2006 conference in Denmark.(In case you didnt visit Nikhil's Blog recently ;-))

And you can download the video of it from.....

http://channel9.msdn.com/Screencasts/243775_JAOOLapAroundAtlas.wmv

Tuesday, October 17, 2006

Save Your eyes !!!

Normally I use anti-reflect Lenses when I am working.But last 2 days I forgot to bring it. So I feel bit uncomfortable when I am working.One of my office buddy gave me a article about what you can do with your Monitor to Save your Eyes. So I felt it's worth while to bring out some information out here......

By side staring at my monitor hour after hour Cause headaches and eye fatigue.according to the article one of simple thing we can do to help this problem is to raise the refresh rate. Monitors often come with refresh rates set too low, I.e. 60 Hz which causes flickering. A higher refresh rate helps reduce the flickering effect and lessen eye strain.(More than 75Hz).(You can usually set your refresh rate under display properties/settings. Also, RefreshForce is a free tool that lets you quickly change the monitor's refresh rate.)

Another cause of eye strain that many people tend to just live with is font size. Higher resolutions on monitors can cause quite small fonts. Also, many web sites use small fonts. If you catch yourself leaning toward the monitor, or squinting uncomfortably, right click on your desktop to bring up display properties, select appearance, and choose font size. You can further adjust the font you see when surfing by choosing text size from Internet Explorer's view menu and selecting your preference. This may cause some of your favorite web pages to display a little oddly, but at least you'll be able to read them!

Make sure you have proper lighting on your monitor (it's more effective to have a light shining from behind your shoulder or above the monitor than behind the desk).

Even using these measures, we should take frequent breaks from the computer. Look away from your monitor at least once every fifteen minutes; preferably, step away from the computer altogether.

So try to take care of your eyes too,while you are working

Friday, October 13, 2006

After the silence....

Well, I couldn't write anything during the last 2 ,3 weeks. Many changes have been going on in ma life since that period(still the same :)). I never thought this will happen to me. For the first time I'm fed up with ma Job. And I have to tnx all my friends who were with me for all this time. It helped me a lot. I got loads of advice what I have to do in such a situation.

Anyway that's enough about that. The good news is two of my buddies have started their own Blogs. (Suresh and vajira). So good luck yo buddies. Welcome to blogging.. lol..

So now what I have to do is try to cheer up and continue my life. Isnt it?? But I'm still trying ....

Thursday, September 28, 2006

Ashi has came back...

One of ma good friend; ashini(Akki) has came back to blogging again ('coz of my request. ;-) ) She's a very close friend of mine and a good sister for me. I always try to accept all her advice ;) (even though you think you are not a good adviser. lol...) and those advice is worth for me. I have changed some qualities of mine. he he he... As my knowledge we don't know how much we are worth for others. So you have to start a new blog life with all your thoughts, and with your knowledge (which is being updated daily... ). So wish you all the best Akki !!!

You can visit her blog.... http://ashinie.blogspot.com/

Thursday, September 21, 2006

Common Table Expression(CTE)

This is a new Enhancement of SQL server 2005(as my knowledge).we can think CTE's as a simple and more powerful alternative to derived Tables.In my case Now I am using CTE's where I used Temporary Tables before and I replaced so many views.

A CTE can be defined as a temporary named result set, which is derived from a simple query and defined within the execution scope of a SELECT, INSERT, UPDATE, or DELETE statement. It is important to note that the scope of a CTE is just the statement in which it is declared. The CTE named result set is not available after the statement in which it is declared and used.

Here I am putting a code sample for CTE witch I have taken from AdventureWorks Database then you all can check this SQL script in your SQL server 2005(if you have installed AdventureWorks DB.)


WITH YearlyOrderAmtCTE(OrderYear, TotalAmount)
AS
(
SELECT YEAR(OrderDate), SUM(OrderQty*UnitPrice)
FROM Sales.SalesOrderHeader AS H JOIN Sales.SalesOrderDetail AS D
ON H.SalesOrderID = D.SalesOrderID
GROUP BY YEAR(OrderDate)
),
SalesTrendCTE(OrderYear, Amount, AmtYearBefore, AmtDifference, DiffPerc)
AS
(
SELECT thisYear.OrderYear, thisYear.TotalAmount,
lastYear.TotalAmount,
thisYear.TotalAmount - lastYear.TotalAmount,
(thisYear.TotalAmount/lastYear.TotalAmount - 1) * 100
FROM YearlyOrderAmtCTE AS thisYear
LEFT OUTER JOIN YearlyOrderAmtCTE AS lastYear
ON thisYear.OrderYear = lastYear.OrderYear + 1
)
SELECT * FROM SalesTrendCTE
GO

Monday, September 18, 2006

Down with a fever... and now Gastritis....

Now I feel bit better after the fever since last Wednesday. I wanted to be @ office last thursday and friday coz I had to complete something with new SQL Report server. But I couldn't make it. After the fever last friday i got Gastritis also. Now I have to take medicine for Gastritis too.That's a damn sickness. NowI feel bit better. And now I am trying to Eat on time. And I am warning you all my buddies. Please take care of your meals. Simply EAT ON TIME.

Tuesday, September 05, 2006

Microsoft .NET Framework 3.0

Microst has Released Microsoft .NET Framework 3.0(pre-Released) for the general public.(May be this an Old news ;) ).We can download new framework and Related resources from here. and also we can download RC1 SDK tooo.Wow.....

Thursday, August 31, 2006

Tutorials on Enterprise Library

These days i got a chance to start working with one of the tool witch i was dreaming to work with.Enterprise Library.When i am Searching for Tutorials for Enterprise Library i found Some great Great articles.So i thought to share them with you all.

The Enterprise Library Data Access Application Block

Online Tutorials about Enterprise Library

Using the Enterprise Library Data Access Block for .NET 2.0

And some Links was available in Angelos Petropoulos' WebLog

(archive Tutorials on using Enterprise Library )