Archive for the 'Development' Category

PLS-00103: Encountered the symbol "" WHEN expecting one OF the following

Tuesday, February 17th, 2009

I recently came across this error whilst developing stored procedures in oracle. The stored procedure will be built in Oracle but marked as invalid. Trying a re-compile will give you the above error.

The problem appears to be with Windows CRLF characters on line breaks. Oracle does not treat this as white space, instead it sees it as an empty string. In order to get round this problem, convert the CRLF characters to LF characters and Oracle should be happy.

Using VB.Net To Encrypt LDAP MD5 Passwords

Wednesday, February 11th, 2009

When passwords are stored in an LDAP directory they are stored encrypted. LDAP supports different types of hashing, but I chose to use MD5.  The LDAP implementation is to use Base 64 encoding. Below is a simple function I use to convert the plain text password into a hashed string ready to be added to LDAP.

Public Shared Function EncryptPassword(ByVal value As String) As String

        Dim cryptProvider As New MD5CryptoServiceProvider
        Dim b As Byte() = Text.UTF8Encoding.UTF8.GetBytes(value)
        Dim encoded As Byte() = cryptProvider.ComputeHash(b)
        Dim hash As String = Convert.ToBase64String(encoded)

        Return hash

End Function

VB.Net HttpWebRequest Takes A Long Time On First Request

Wednesday, January 21st, 2009

I have recently been using the HttpWebRequest object in .Net Framework 2 and 3.5. I’m using it to observe the timings of requests on a project and noticed some strange behaviour. The first time you call GetResponse it can take over 30 seconds to return the response, whereas subsequent calls to the same URL will result in much quicker responses. I have found the problem to be in the use of proxies. It tries to find a proxy to use on the first request. To fix this (unless you are using a proxy of course) set the Proxy property to Nothing

request.Proxy = Nothing

By doing this it no longer looks for the default proxy and will speed up requests.

Deleting LDAP Entries

Thursday, August 14th, 2008

Following on from my popular post on searching LDAP directories I thought I’d follow up with a simple piece of code that allows you to delete entries.

There are two ways to remove an entry. The first way is to search for a node an remove it, along with all of its children. The second way is to search for a node and remove one or more of its children. (more…)

Working With LDAP In VB.Net

Friday, June 13th, 2008

I wrote a post a while ago dealing with an error that VB can throw when dealing with an LDAP connection, you can find it here. Because this post has proved popular with people searching for the error code on Google, I thought I’d put together a quick post on using LDAP in VB.Net.

(more…)

Windows Live Writer Plugin

Monday, June 9th, 2008

I have recently created my first Plugin for Windows Live Writer. I’m starting off simple with a Plugin that allows you to add Amazon affiliate links to your posts. It works with Amazons Quick Linker Widget which needs to first be added to your pages (in the footer).

I have submitted it the Windows Live Gallery, but I have no idea how long the submission process takes.

My Plugin and its details can be found here.

Tags:

AJAX Tutorials

Thursday, May 22nd, 2008

I found this very good article that has links to 30 of the best AJAX tutorials around. It covers things from drag and drop to lists, as well as the basics of AJAX.

Designs Advice

reCAPTCHA

Monday, January 7th, 2008

I recently added a contact page to my site. To do this I used a wordpress plug in,  Dagon Design. Its a very good plug in by the way. It allows you to prevent spam by adding a reCAPTCHA image to the form. I’ve always known about reCAPTCHA helping to digitise books where OCR is not working, but I have always wondered how the system knows you are correct, if the word cannot be read by computers.

After I signed up for my free account at recaptcha.net I read about how it works.

Each new word that cannot be read correctly by OCR is given to a user in conjunction with another word for which the answer is already known. The user is then asked to read both words. If they solve the one for which the answer is known, the system assumes their answer is correct for the new one. The system then gives the new image to a number of other people to determine, with higher confidence, whether the original answer was correct.

You can read more about it here.

Tags:

System.DirectoryEntry – Adding new objects

Monday, September 3rd, 2007

I have recently been playing around with Apaches Directory Service, creating custom schema types and the like but came across a problem.

In VB.Net if I tried to add a new child to a directory entry, of a custom schema type (in this case in inherited from the person class) it would throw an exception when I tried to commit changes. On closer inspection I noticed that instead of creating an object of my custom schema class, it was trying to create an object of the person class, and the error being thrown by the LDAP server was because some of the properties I was trying to set did not exist for the Person class.

I managed to get around this by adding a property ‘objectClass’ and setting the value to the type of my custom schema class. This means that when I call commit changes, the LDAP server can validate it against that class.

AddUpdateProperty(newUser, "objectClass", "myUserClass")
AddUpdateProperty(newUser, "mail", user.Email)
AddUpdateProperty(newUser, "uid", user.ID)

Technorati Tags: , ,

System.DirectoryEntry Unknown error (0×80005000)

Friday, August 31st, 2007

I have recently encountered this really unhelpful error message in VB.Net whilst trying to code a connection to an LDAP server.

After much head banging I found the solution! It’s all down to the path you supply to the constructor:

Old Connection (doesn’t work):

Using dir As New DirectoryEntry(ldap://yourserver:port)
	' Your Code
End Using

New Connection (does work):

Using dir As New DirectoryEntry(LDAP://yourserver:port)
	' Your Code
End Using

Spot the difference? That’s right! the protocol part (LDAP) is case sensitive. Changing to uppercase works like a charm.

Update: I have posted an article and sample code on working with LDAP here.

Technorati Tags: , , ,


foreandaft