« September 2005 | Main | November 2005 »
October 29, 2005
Fixing ASP.NET
My ASP.NET bombed out yesterday. Despite rebooting my box several times (something that I really really ... really hate doing) it wouldn't start.
After a frustrating a couple of hours trying to fix it, a colleague mentioned that I probably should re-run the aspnet_regiis.exe tool, which pretty much re-install ASP.NET to IIS. Suffice to say it pretty much fixed the problem. Heh ...
This is also usefull if you are running multiple version of .NET and need to rebind different ASP.NET to IIS. This tool is located in your Framework directory ie: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
Posted by vhadiant at 09:14 AM | Comments (0) | TrackBack
October 19, 2005
Oracle BLOB/CLOB array problem
Try as I might I couldn't get .NET to work correctly with CLOB/BLOB array in Oracle. I have a stored proc that really needs a BLOB array as a parameter and I keep getting "Internal Error" (couldn't remember the code now). Google doesn't return that many suggestion either. I eneded up had to concatenate all my BLOB together, send another array to indicate the size of each chunk of the BLOB and split it in the stored proc. Thankfully we can do this quite easily using the dbms_lob.read method. It's frustrating really, but I couldn't find a single example that shows CLOB/BLOB with PL/SQL AssociativeArray working nicely with .NET.
Posted by vhadiant at 11:54 PM | Comments (0) | TrackBack
October 18, 2005
Very simple comment spam protection
This is a really dumb and simple hack, but when I removed the "Post" option from the comment page (forcing to "Preview" first rather than "Post") my comment spam drop to zero.
Update: This is really amazing. I haven't got any comment spam since I do this.
Posted by vhadiant at 12:39 PM | Comments (0) | TrackBack
October 17, 2005
Overflow checking in .NET
An interesting information that took me a while to find out. I had some overflow problem earlier today and I expected that .NET will throw an overflow exception (of some sort) whe this happen, but by default .NET does not turn on overflow checking for performance reasons. It will only throw an exception if it happen on constants expressions. So how do I turn on overflow checking? You can turn this on from Visual Studio.NET option or you can use the checked/unchecked keywords.
Posted by vhadiant at 10:29 PM | Comments (0) | TrackBack
October 13, 2005
Empty array in Oracle and .NET
Looks like Oracle doesn't like you passing an empty array. I've been getting this weird OracleParameter.Value is invalid. The strange thing is checking out Google doesn't give me much, this one kinda describe my problem:
http://forums.oracle.com/forums/message.jspa?messageID=947090
Basically if you have an array in your stored proc as a parameter, you need to make the array size to be at least 1, otherwise the said error will happen. This is really inconvenient since now you have to check whether it's your workaround or it's a real value.
One way to get around this is to have an array size parameter, this will work alright if you are converting DataTable into arrays, 1 parameter can indicate the size of the collection of array you are sending to Oracle. However for a single array send up this can be really annoying.
Posted by vhadiant at 06:46 PM | Comments (0) | TrackBack
October 06, 2005
XPath and default namespace in .NET
I've been having a problem with running XPath query on XML document with a default namespace. It has something to do with NamespaceManager and prefixing all your XPath with the prefix that you set in the NamespaceManager. For example, if you have XML document as follow:
<MyXml xmlns="http://tempuri.org/myxml">
<name>Victor Hadianto</name>
</MyXml>
When you run a simple XPath such as /MyXml/name it will fail. Why? Because of the default namespace, .NET doesn't seem to know that if you don't prefix your query just use the default namespace. For example:
XmlNode node = xmlDoc.SelectSingleNode(@"/MyXml/name");
// node is null
The way to fix this is as follow:
// First create the NamespaceManager
XmlNamespaceManager nm = new XmlNamespaceManager(xmlDoc.NameTable);
// You have to create a prefix with the same URI as your default xmlns
nm.AddNamespace("bc", "http://tempuri.org/myxml");
// Now you can run the query
XmlNode node = xmlDoc.SelectSingleNode(@"/MyXml/name", nm);
// node won't be null here
Posted by vhadiant at 06:07 PM | Comments (0) | TrackBack
