Tuesday, November 30, 2004

Language Independant - General Software Development

Stumbled upon an excellent Article by Sergey Dmitriev on Language Oriented Programming.
I had a Lecturer in my final year of Diploma - Dr.Zhang. Man he's a cool guy. He is from China, and he was my role model. The article mentioned above covers much of what Dr. Zhang always use to teach my class - Software Developers should be programming language independant.
I am... Are you?

Dynamic SQL is the future

The most stunning thing you'll find in Frans Bouma's blog entry (see my previous entry for more links) is this statement :

There is no precompilation of stored procedure code in SqlServer. It caches execution plans for each query, also ad-hoc queries. Even better: it will parametrize queries which don't even have parameters to keep the execution plan in the cache!

Well, I couldn't belive this. All this while every article I read, and every guru I spoke to said otherwise.
Frans bases his statement on the solid ground of exerpt from SqlServer's Books Online, which atleast I can't argue with.
Overall I'd say, I'm caught up between whether to use Stored Procedures or not. I have heard nothing but praises about Stored Proceduces all my time in SW Dev. But a part of my mind does belive in Frans, and as he wrote, I do kinda agree with him - Dynamic SQL might just be the future.

Stored Procedures - Good or Bad?

Here is an interesting debate, which did grab and is still grabbing a lot of attention.
You should definetly read this...

Stored Proceudres are Bad - Frans Bouma(MVP)

Whenever possible, use stored procedures to access your data - Rob Howard(Need I say anything about him?)




Monday, November 29, 2004

Does DataReader/IDataReader has data inside ?

I guess everyone of you know this, but I just wanna write this for some soul who might be googling for this.
When we extract data into a dataset, we can simply count its rows and know if at all it contains something, but what about DataReader/IDataReader?
When you are using DataReader, .Net 1.1 brings you HasRows Property which will tell u rightaway if you have some rows to work with.
Now comes IDataReader, nothing new here :
if (!objReader.Read())
{
// there is no data
}else
{
// there is data
// NOTE : First record has been read already!
do
{
// you are already pointing to the first record,
// so your processing which should be here has started with the
// first record
}
while (objReader.Read());
// keep looping till the end of data
}
So there you go, simple things in life put into words :D
BTW, VB.NET users pls take note.(below code are in context to the above algorithm)
As above, use the Post-Test Loop
Do
' Processing is here and the fist record was already selected, so rock on!
Loop While (objReader.Read())
instead of the Pre-Test Loop
Do While (objReader.Read())
' PROBLEM!
Loop

Monday, November 22, 2004

My 23rd B'day

Yesterday was my B'day, supposedly a happy day, but just went by as any day... I guess when u get older, you dont really have much to get excited about you b'day anymore... Another year, another day... Atleast had a good service in my church yesterday... :)

Saturday, November 20, 2004

Troubles with Regular Expressions?

Check out the Regular Expression Library

Friday, November 19, 2004

Path - ASP.NET, Windows

Some of the things about Paths in .Net that migh prove usefull..

When using a windows application you can use Application.StartUpPath to get the path of the app.

But while using an ASP.NET application, you can utilize Request.PhysicalApplicationPath to get you the physical path (e.g : c:\inetpub\wwwroot\yourAppName\), whereas Request.FilePath will get you the file path (e.g : "/yourAppName/folderName/pageName.aspx")

SideNote: Use System.IO.Path.Combine to avoid forming invalid paths if you app is started from the root folder of the drive.

P.S : check out this article by Fritz Onion on Understanding Paths in ASP.NET..

Monday, November 08, 2004

Thinking Machine (chess)

see how this chess engine thinks here...


Friday, November 05, 2004

see how ASP.NET 2.0 is taking shape

in ScottGu's Blog

Thursday, November 04, 2004

Make cool ppt presentations

Make your ppt presentations really cool by Expanding PowerPoint with Plug-Ins

A cool developer has a cool desktop apprearance

Make you desktop look cool, all the detailed info you require is right here at
Neowin.net -> Customizing XP

November SgDotNet 6th User Group Meeting

Went to the SGDotNet UG meeting yesterday, lotsa great ppl.. Had fun...
Volunteered to join the Nova development team..
Lot of work ahead :)

take a look at SGDotNet.org

Wednesday, November 03, 2004

Converting a XML string to dataset (.net, webservice)

Web services, great stuff eh?a webservice IMHO should pass data back to the consumer. In one of the microsoft meeting for partners that was held recently, it was said that webservices should not pass dataset back, instead, they should pass back XML. Resons being, 1. Datasets are not universal, but XML is(so you dont have to change the webservice if you consumer changes to JAVA or SAP) 2. Dataset has a lot more overhead due to the included schemas, hence using XML reduces the data sent across size drastically)
Assuming an existing webservice was sending a dataset back to the consumer and the consumer was using this dataset. Now, i want to change this webservice method to pass xml. so this is wat I doon the webservice method :
=================
instead of returning dataset ( retrurn myDataset; )
I return xml string ( return myDataset.GetXml(); )
Note : Calling GetXml is identical to calling WriteXml(); with XmlWriteMode set to IgnoreSchema.Since GetXml(); already passes the content of a data set without the dataset's schema, we dont have to worry about removing the schema explicitly.on the Consumer side :
===============
instead of getting dataset and using it
( something.DataSource = myReturnedDatasetFromWebService)
we need to convert the xml string that we are getting and cast is to a dataset as below
' dataset to hold the data
Dim ds As New DataSet
'TextReader to get the XML
Dim xmlrder As System.Xml.XmlTextReader
'Point the xmltextreader to the string with xml contents and make it to expect an XML document
xmlrder = New System.Xml.XmlTextReader(strXML, System.Xml.XmlNodeType.Document, Nothing)
' Read all of the XML as one chunk
xmlrder.ReadOuterXml()
' Read the outer XML into the Dataset
ds.ReadXml(xmlrder)
' Tell the datagrid to use this dataset
something.DataSource = ds
' Bind the data
something.DataBind()
So, there you go... now you are just passing data(in form of a string) from the webservice.
This post is based upon the code from "Ken Cox"

Listening ports on a PC




































Protocol

Port

Commonly Used For...

FTP

21

For downloading or uploading Files over the internet servers (File Transfer Protocol)

HTTP

80

Browsing WebPages (HyperText Transfer Protocol)

HTTPS

443

Browsing WebPages over Secure and Encripted Connection

POP3

110

Used to reterive emails from mail server (Post Office Protocol 3)

SMTP

25

Use to send email to a mail server (Simple Mail Transfer Protocol)

Microsoft-DS

445

Microsoft Networking Comunication Channel


Just for reference!

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.