Wednesday, December 29, 2004

MCAD/MCSD

Me and my two colleagues today decided to start on taking the MCSD Cert. So we bought the whole MCAD/MCSD study kit for a whoping SG$277.10(including delivery) and set our targets to take two exams each on the 1st of Feb.
Thing is, we don't want to use the dumps and just pass for the cert sake. We want to take the exams so that we atleast have the exam worth of knowledge after getting the cert.
But then again, doing .Net everyday does give you more than that, maybe its just a craze to study like in the old school days...
Anyways, 2 exams by begining of Feb 2005 and another 3 by March end, will give us a MCSD cert by April 2005 begining, quite a plan...

Future of .Net Remoting

Check this writing about .Net Remoting from Richard Turner's Blog

Hallmarks of a Great Developer

Check out Micahel's Blog on Hallmarks of a Great Developer here...

&& operator (C#)

Here is a post which in context to my previous post
Got this Tip from Developer Shed

This is regarding the usage of AndAlso and OrElse operators in VB.NET. These new boolean operators are introduced in VB.NET to make the compatibility of VB.NET code to C# and managed C++. This is due to the fact that && (And Operator in C#) has default behavior of AndAlso and || (OR operator in C#) has default behavior of OrElse. Here's an example:
bool Function1()
{
System.out.print("In function 1");
return false; //note this function returns false
}
bool Function2()
{
System.out.print("In function 2");
return true;
}
//so in C# && operator will not evaluate the result of Function2
public static void main (string[] args ) {
if ( Function1() && Function2() )
{
//this code never runs
System.out.print("IN the evaluation of main function");
}
}


Dynamic Controls (ASP.NET)


The other day, I was discussing with someone regarding the creation of dynamic controls. Here is one simple scenario ( I hope to include this in my article which is in the writing) :

Suppose you have to create a particular textbox with a particular value depending on the value that is in the db.

Now, the textbox is 'needed' only when the user selects a particular button. So logically it would seem to create the textbox in the event of that button click.

Now here is the problem :

If the text box were to be created in a button click event. That textbox is not included in the control tree of  the page. Hence, the control's value will not be able to squeeze itself into the viewstate. So when you try to get hold of that textbox on some event, you wont be able to...

Here are a few articles that might help you regarding this concept

Understanding ASP.NET ViewState

ASP.NET Page Object Model


Here is something that could be done :

1)During the page load a query is made to the db to get what value is in there

2)The particular textbox is created(during pageload) according to the value retrived from the db, with its visible property set to false.

3)This value from the db is also put in the viewstate, or cookie (as your situation calls)

4)Now when the button is clicked, the value that was store in the viewstate/cookie is retrieved, knowning that the particular textbox is already created with its visible property set to false, all we need to do at this point is to set the visible property of that textbox to true.

That solved the problem of dynamic textbox.

Do lemme know what you think :-)


Monday, December 20, 2004

Data binding to a dataset from everywhere (.Net General)

Q: How can i bind data to a datagrid when the data is fully in my dataset and i need to add some data from some textboxes/myself/other datasets/other datatables for every row?

Everytime someone asks this kinda question in one of the forums, I go through the pain of typing the same thing over and over again. So I decided to write it down here and point them to here. Most of you, as usual, already know all this stuff, so I'll just do it for the sake of those who posted this question and those who are still posting...
So here is goes;

In the above described case, what I usually do is to create a datatable of my own and then fill in with all the data that i need to put in and then bind this datatable to the datagrid. It doesn't matter where the data is coming from becuase we are goin to format it in our datatable as we want.
That's it, thats the answer..
Yours truly,
R. Thomas.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Naahh... Just kidding, I guess some people won't stop there, they will continue hunting for some related code, so here is a snippet.

First, create a datatable

Dim dt As DataTable = New System.Data.DataTable("Temp")

Then make this DataTable correlate your datagrid,

dt.Columns.Add("ItemA")
dt.Columns.Add("SNo")
dt.Columns.Add("ItemB")
dt.Columns.Add("Item1")
dt.Columns.Add("Item2")
dt.Columns.Add("Strange1")
dt.Columns.Add("Different1")

Now we add rows to this DataTable, here is where the concept takes place. You've gotta prepare the rows as you want

Dim dRow As DataRow
dRow = dt.NewRow
dRow(0) = 'Comes from your first datatable
dRow(1) = dtSes.Rows.Count + 1
dRow(2) = 'Comes from your second datatable
dRow(3) = 'Comes from somewhere else
dRow(4) = 'Comes from another dataset
dRow(5) = 'Comes from some other dataset's some table
dRow(6) = 'Comes from some place else
dt.Rows.Add(dRow)

This logic of fillin up the data will usually be in a loop where the data is pouring out from a reader or coming from looping thru a dataset. So you should take care that durin this you dont get an 'Index Out of bound' exception, by running out of data in one of the tables or somethin..
By the end of that loop the datatable created by you will be full of the data that you want. So all you have to do now is to bind this table to your datagrid.


myDataGrid.DataSource = dt
myDataGrid.DataBind()

That's it. you have a data grid with the data that you want.


Modal Pop-Up Window Cache (ASP.NET, Web-Services)

A strange thing happened A thing I didnt know about, happened :
I have a page which is using Web-services, lets call that page A. Page A opens up a modal popup window called Page B. Page B, OnLoad, calls a web-service to get data from the db and updates a datagrid inside itself. Now this grid, when data is added to the db during that session, doesnt seem to get updated. If debugged, the breakpoint in this method of the web-service, only gets hit the first time, and the subsequent times, its just doesn't hit the breakpoint. So if I want to see the updated data, I have to log off and log in again and then I can see the updated data. I was puzzeled about this unexpected behavior for quite long, and then I tried turning off the cache for this page.
So on PageLoad, i inserted these two statements :

Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetExpires(Now())

And _Voila!!_ it works as expected...

ieHTTPHeaders (Tool)

A great tool that can be used for dubugging web applications - ieHTTPHeaders
ieHTTPHeaders is an explorer bar for Internet Explorer that will show you the HTTP Headers IE are sending and receiving.

Tuesday, December 14, 2004

HRiders

You gotta check this out... HRiders are offering a whopping 1TB email account... Man thats lottsa space. And space is always good... No one says no to space.
No one...


MSN Toolbar Suite Beta Released

Been trying Google Desktop Search for a while now.. Actually to tell you the truth, i used it only a couple of time in the begining, but everytim i tried to search I didn't really get what I want.
I not saying Google is bad, as a matter of fact, I think its the best! But its Desktop search? Erm, didn't really work out for me. Then I came across MSN Toolbar Suite, now this is what Desktop Search means. Its very cool with a great UI. Serves all my purposes. But when it comes to searching the internet, I just can bear to leave google, I don't even dare to leave google and _TRY_ MSN... Can MS come as far as google? What do you think?

Want to publish a book by yourself?

Well, I do want to publish books one day.. Found a Self-Publishing Guide by Brian Bischof, author of Crystal Reports for .Net.
Publishing a book yourself requires a lot of effort... But looking at the profit you get compared to publishing books thru publishers, Its totally worth it!

Wednesday, December 08, 2004

If Condition statement (VB.Net)

Recently ran into a bug where  it seemed that the if statement was not working properly, turns out it was written "wrongly"
The problematic statement was this :
If (FunctionA() AndAlso FunctionB()) Then
      'Do something
EndIf

Whereas, it should be written as such :
If (FucntionA() And FunctionB()) Then
      'Do Something
EndIf

The difference is this :
The latter stops the processing if the first function i.e FunctionA() returns False, which implies that  function (FunctionB()) is never evaluated.
It may seem the right logic, but if there is some processing that is to be done is FunctionB() - it will not take place, which in some cases may not be right.
When we use the And keyword, it makes sure that both FunctionA() and FunctionB() are evaluated before it exits the If statement (assuming no exception is thrown), but for the keyword AndAlso, it exits the If statement as soon as FunctionA() returns false.
Just for the record..  ; )

Monday, December 06, 2004

Hotmail increases to 250MB

Well, Hotmail increased its mailbox quota from 2MB to 250MB. Not too much compared to GMail and yahoo, but still, Atlease we wont have to get all the big mails out of our hotmail mailbox to other mailboxes. Now you can relax with hotmail too instead of constantly clearing up mails so that your 2MB space isn't maxed out due to attachments.The new calendar feature is not too bad either....Only if they could make hotmail a bit more faster! sigh...

Wednesday, December 01, 2004

Excellent Impression Tracking Technique

Here is a post from ScottGu's Blog,Well, something that is very new for me, considering my short web-development experience, but great to know how people can derieve excellent walkarounds for things are necessary but not available.If you read thru the above Scott Gu's post, you will be amazed at what an excellent way yahoo! is using for impression/usage tracking.Also, do remember to take a look at comments below the post, apparetly, some guys have posted better ways and even how google operates.Definetly worth every second of reading!

w.bloggar

For quite some time now, ok, for quite a long time now, i have been thinking about using w.bloggar.
Well, finally I tested it. Overall I'd say its a good tool. But the sad part is that currenltly it doesn't have any support for BlogDrive. Hope they can do something about it...
Meanwhile I am using w.bloggar for posting to my blogspot blog :)

Generous MSFT

I bet there are some ppl who will be very gratefull to Microsoft because of this...
But sadly, some people will try their best to cheat!


This page is powered by Blogger. Isn't yours?

© Copyright 2005, Rohan Thomas
Disclaimer
This Blog contains findings that are self-explored and expressions that are self-evoked. They are by no meanss representions of my employer's view.