Champions league final
Unlucky to Manchester United but the better team won. I don’t think there is any shame in losing to Barcelona. Awesome team.
Unlucky to Manchester United but the better team won. I don’t think there is any shame in losing to Barcelona. Awesome team.
Hi, I thought I check out Tumblr as an alternative to paying for a hosted Wordpress blog. I don’t really blog a lot though!!
Unfortunately Apple decided they would like to charge for people to be able to download ringtones for songs they already bought. Luckily there is a way you can use iTunes to get ringtones from any MP3 file for free, here’s how.
The process seems a bit complicated and painful, but after you have done it a couple of times it will only take a minute to create custom ringtones from any MP3 file in your library, and it’s free. If you prefer to use an editor like Sony Sound Forge for you editing needs (in order to play around with samples and get better accuracy when cropping) you can still go ahead and use it. Simply create your file in the editor and export it. Add it to your iTunes library and follow the instructions from step 4. Hope this helps.
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.
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
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 = NothingBy doing this it no longer looks for the default proxy and will speed up requests.
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. Below I will demonstrate both methods.
Dim dir As New LdapConnection(MySettings)
Using users As DirectoryEntry = dir.GetObject(MyQuery)
For Each r As DirectoryEntry In users.Children
users.Children.Remove(r)
Next
users.CommitChanges()
End Using
Above shows us searching for a node then looping through each child and removing it. We could also examine the properties and delete based on that.
If you want to delete a specific item its easier and more efficient to use the following method
Using users As DirectoryEntry = dir.GetObject(MyUserQuery)
users.DeleteTree()
users.CommitChanges()
End Using
In the above example we just search directly for a single node (user) then call the ‘DeleteTree’ method. It the entry we searched for had any children, they would also be deleted.
I hope this helps you out. Don’t forget to leave comments if this helped, or you need any more info, thanks.
I’ve just installed the Wordpress iPhone application on my iPod Touch, and am giving it a go. Have you used it? What do you think?
I don’t know if this is a new feature of the iPhone 2.0 software (I doubt it) but you can take screen shots from your iPhone or iPod Touch!
When your on the screen you want to capture just hold down the ‘Home’ key and press the ‘Sleep’ button. The screen will flash and the screen shot will now be in your pictures folder. The screen shots are stored in PNG format and can be transferred to a PC or Mac. This even works on the iPod touch. Once you have taken a screen shot the next time you plug the iPod into the computer you will see the iPod as a drive in your system. The pictures can then just be drag and dropped.
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.
To perform a simple query you can use the following syntax:
Dim results as SearchResultCollection
Using dir As New DirectoryEntry(connectionPath, principle, credentials, AuthenticationTypes.ServerBind)
Dim s As New DirectorySearcher
s.SearchRoot = dir
s.Filter = (&(objectClass=groupOfUniqueNames)(cn=techSupport))
s.SearchScope = SearchScope.Subtree
results = s.FindAll
End Using
This is a very basic example of searching the directory. The directory is searchable on any property that an object may have, e.g. you may want to find all entries whose are inetOrgPerson and have a surname of smith. In that example your filter would be
(&(objectClass=inetOrgPerson)(sn=Smith))
You can perform an update on a directory entry just like you can in a database. When performing an update it is important to remember an entry can have multiple properties of the same name. In other words the properties are in fact arrays. The following is an example of an update.
Public Sub UpdateUser(ByVal username as String, ByVal firstName as String, ByVal surname as String)
Dim myUserDN As String = String.Format("{0}uid={1},{2}", _settings.LDAPUrl, username, _settings.UsersDN)
Using u As New DirectoryEntry(myUserDN, _settings.Principle, _settings.Credentials, AuthenticationTypes.ServerBind)
AddUpdateProperty(u, "cn", firstName)
AddUpdateProperty(u, "sn", surname)
u.CommitChanges()
End Using
End Sub
Private Sub AddUpdateProperty(ByVal r As DirectoryEntry, ByVal propName As String, ByVal value As Object)
If r.Properties(propName).Count = 0 Then
r.Properties(propName).Add(value)
Else
r.Properties(propName).Item(0) = value
End If
End Sub
The above code shows two sub routines. Lets look at the first one, UpdateUser:
Performing an insert on the directory is very similar to performing an update. The code below shows how we can insert a new user type entry.
Using users As New DirectoryEntry(userDNRoot, _settings.Principle, _settings.Credentials, AuthenticationTypes.ServerBind)
Using newUser As DirectoryEntry = users.Children.Add(String.Format("uid={0}", username), "person")
' add user required properties
AddUpdateProperty(newUser, "cn", forename)
AddUpdateProperty(newUser, "sn", surname)
newUser.CommitChanges()
End Using
End Using
Lets look at the code:
You can download this sample project to check out some working examples.
If you have found the above article useful, have any comments or questions on it please leave a comment, and if you are a Digg user, don’t forget to give it a Digg, thanks.