LDAP Queries Continue

As in my prior post I mentioned how to retrieve the LDAP url and primary server and port for queries I found also the need to identify the path to a particular active directory object, lets say, I have a group name but I need to find the LDAP id for it, how can I do that?

We’ll, I have found an implementation on Excel (if you search for the code you will find several examples with the same thing)

I don’t remember where I found the code from, so I can’t provide a link to the source but here it is:

Function getLDAPName(ByVal SearchField As String, ByVal SearchString As String, ByVal ReturnField As String)
‘Declare Variables
Dim objAdoCon, objAdoCmd, objAdoRS
Dim objUser, objRootDSE
Dim strDomainDN, strUserFullName
Dim intAnswer As Integer
On Error GoTo Err_NoNetwork

‘ Get the DN of the user’s domain
Set objRootDSE = GetObject(“LDAP://rootDSE”)
strDomainDN = objRootDSE.Get(“defaultNamingContext”)

‘ Search the domain for the user’s account object
Set objAdoCon = CreateObject(“ADODB.Connection”)
objAdoCon.Open “Provider=ADsDSOObject;”

Set objAdoCmd = CreateObject(“ADODB.Command”)
Set objAdoCmd.ActiveConnection = objAdoCon

objAdoCmd.CommandText = _
“SELECT ADsPath,samAccountName FROM ‘LDAP://” & strDomainDN & “‘ WHERE ” & _
“objectCategory=’person’ AND objectClass=’user’ AND ” & _
SearchField & “='” & SearchString & “‘”

‘ “DisplayName='” & clockNumber & “‘”
‘ “sAMAccountName='” & clockNumber & “‘”

Set objAdoRS = objAdoCmd.Execute

‘ If found, get the displayName attribute.

If (Not objAdoRS.EOF) Then
Set objUser = GetObject(objAdoRS.Fields(“ADsPath”).Value)

objUser.GetInfoEx Array(ReturnField), 0
getLDAPName = objUser.Get(ReturnField)

Set objUser = Nothing

Else
‘ handle “not found” error here
GoTo Err_NoNetwork
End If

Set objAdoRS = Nothing
Set objAdoCmd = Nothing
objAdoCon.Close
Set objAdoCon = Nothing

Set objRootDSE = Nothing
Set WshNetwork = Nothing
GoTo Exit_Sub

Exit_Sub:
Exit Function

Err_NoNetwork:
getLDAPName = “Error”
GoTo Exit_Sub
End Function

The most important detail in this code, is the Active directory query. (you can find a list of available properties in this link)

for example in the following query

select cn from LDAP://[LDAP URL] WHERE objectCategory=’group’ and cn=’MyGroupName’

(*Update): When you are querying for a name and you need to filter on a partial string (LIKE statement) you can use the ‘*’ so ‘MyGro*’ will look for anything starting with MyGro and ‘M*yGroupName’ will search for anything with starting M and anything between the yGro.

What I am looking for is the common name of the MyGroupName, and a list of properties can be specified (the full list on the link above)

but If you change the specific attribute for a ‘*’ interestingly enough you won’t get all parameters (as a sql query would) but you receive the full LDAP object name in the value field.

The query  highlighted in blue uses * to search for a group:

WatchWindow

As you can see the value field lists the entire tree to find the object

You can review the objec with little more detail (using the immediate window)

immediateWindow

so, as you can see in this post, you can find a lot of detail for an account or group on active directory using any VBA tool available to you (instead of having to download extra tools)

 

How to find a job in technology

This blog post is intended for those who have a computer science degree or similar, but it may also apply to everyone else, to some extent.

When you come out from school you start wondering who is going to hire you, when I started my job hunt, I wasn’t even out of the school (I took my bachelor’s degree in Mexico), competition is hard, finding a job is hard …

Sure is, if you don’t know what to do to improve yourself.

image

One of the most common complains when you are a freshmen is the vicious cycle of  “experience = job = experience”, if you don’t have experience you don’t get a job, but you can’t get a job, since you don’t have any experience…

How many times we have heard that?, when internet was being adopted, it was harder to find resources, tutorials, or information about something you wanted to start. It was never hard, c’mon! you have to know how to search.

In today’s job world, is really important to show off what you can do, do you have enough time in your hands to look for a job? are you 8 hours a day outside knocking on doors? of course not; Why don’t you spend your time enhancing your resume doing actual work?

As with anything that is worth in life you have to start investing something (this is for your growth) so start thinking of spending some dollars a year for a hosting place, do some work, publish it, get involved in open source projects, create a blog, find user groups, assist and learn.

The era of the no experience no job, is easier to overcome this days.

You just have to leave your couch and start coding.

Samples?

Create an online resume builder, create an android application to create lists of tasks, create a grocery shopping list .. even a calculator will help .. do as many as you can, you can get the experience from there, expose the work you have done, publish it for free, the more they talk about it the better, accept all critics, there is a saying “Don’t criticize your enemies, they may learn something”  (don’t know who said it)

And one more suggestion, use several technologies in your project, make them interact with each other.

The grocery list, create a web application on asp.net, create an android client for the phone, manage the web services with Azure or Amazon Cloud services, synchronize the information with a windows 8 app, etc. (I omit the IPhone, IPad and junk, since its not as easy to start on it as it is with windows/java/android)

Also, you have to manage your online reputation, some of the things you may need:

  • Blog
  • Twitter account
  • Google+ identity
  • Linked in
  • About me
  • Leverage any other social sites (empireavenue.com, klout.com, etc.)

I don’t include Facebook, unless you think is worth it, as for me, I keep it as private as possible, all else is open.

As with everything, you have to start somewhere, and even if you are bad, as you continue working on it you will improve.

Tutorials? information?

bing.com, google.com, yahoo.com, are good places to start (SEARCH!)

There are so many free tools to use and also you can learn so much for free, for example you can start with:

And many more…

Is amazing the kind of things you can do, when you spend your time where you are supposed to.

Feel free to me your questions, I may be able to help out

My Hello World is here

We went to lamaze class for the baby, I read a lot of information about it, I also received multiple warnings or advises from friends regarding not sleeping, the crying, etc.

But, no matter how “prepared” you are, you are not. It’s really like when you are doing consulting services, you have the knowledge but until you face the actual problem is when you know if you really “know”.

It all start as a customer calls, “we have a problem is occurring every 10 minutes” in case of your wife she says “Honey, I’m starting to feel something, is occurring every 10 minutes”.

When the computer starts  performing poorly you run and check graphs and stuff just to figure out what is going on

 

Then you start running some tests, verifying, asking questions, checking the current status of everything, when the problem starts to increase, and a resolution is required, you jump in, attack head onto the problem, and then at some point in some way, you get it, all fixed.e

As always there is stress, specially if you are in a mission critical problem, and I have had some bad server crashes, with lots of stresses, but nothing, nothing compares to what happened on my Friday.

This is the story of how my baby came to this world.

The day before I had one of those nights when something is out of whack, we had a release scheduled which was completed successfully, as with any other release some items go flawlessly, some others require a minor tweak here and there, but all was fine, nonetheless, I was unable to sleep, something was amiss.

Next day I went to work normally, with a weird feeling that I had to finish everything that day.

I finished almost everything by 4pm, where I had a status meeting with my boss, so we started the conversation, and some minutes later I got the call which I ignored since I was in a meeting.

Then the second one, and the third one then I had to pickup

“This is tech support how can I help you?”  We are having a problem, some irregular behaviors are occurring every 10 minutes and it’s increasing.

“Thanks, I’m sorry to hear you are having some trouble” Yes, we need support on site.

So, as expected I had to cut the meeting short, and proceed to where I was needed.

Traffic was bad, as it is in this area in California (not as bad as in L.A., but still), so I made it and proceed with the evaluation.

  • When you started seeing the problem?
  • How often is happening?
  • Are you able to work?

And this is the part where it got rocky, as time progressed, it became more sensitive, it’s like when you are trying to figure out the server problem, you poke here, change a setting there and all is fine, but sometimes it just goes terribly wrong, change a setting.. BAM! blue screen, you try to recover and so you keep doing, at one time nothing I tried worked, and that is really frustrating, nothing seems to be ok. (My wife torn the house down in search for comfort)

And from there you rush to the hospital, or you call backup..

And you start monitoring other counters..

WP_000003

If a green bar all they way to the top meant something, ha!, a mere 60 here is more than you can imagine, every spike, every drop, every second, you wait and wait and wait…

And as when you find a setting in the server that seems to relief the problem you breathe, when some pain killers are added all goes to a relative calm.

But as with everything, you think you got it solved, BAM! and BAM!! there it goes again, and this time even harder, you can stay up all night checking all that, as I was this past Friday, but something else was also eating my energy, the stress my wife was feeling.

After a lot of effort on my wife’s end, and me struggling helping her out (I inadvertently took the place of a nurse that was there to help, NO WAY I was going anywhere)

After half an hour of more struggling, counting, coaching, the final push, and then the most beautiful thing my eyes ever saw came to life, a short but loud cry said it all, my wife was so relaxed afterwards it seemed she just woke up from a long peaceful dream.

WP_000013

My back, my feet, my head, all were aching, but it didn’t matter, since she was here, my small Julianna, my tiny “Hello World”  that is my world.

This weekend off to Vegas – Visual Studio – Asp.Net – Html 5 – Silverlight

Well, all the posts I have planned and currently working on will be expanded alter since I won a pass to the DevConnections in vegas  

I will be attending mainly the conferences on Visual Studio and Azure, alongside HTML 5, so expect some live updates from there (via twitter) and several blog posts regarding whatever I can find out.

I have some other posts to talk about, regarding XAML applications for Windows 8.

Its been a busy week and a lot happened, My company TKCarsites was bought by KPA,  is funny how many times I’ve changed jobs being in the same company, this time is an entirely new plan, this is going to be interesting, new challenges always come with new management.

Attached is the conference brochure, I will be back next Wednesday with more, for the time being, back to Visual Studio and Windows 8

About Being a father

mynewBaby

I am a developer, and I want to keep posting about that, but today, I wanted to express a little about the feeling of becoming a father, each one of us when the time comes will feel it in a different way, this small post is part of what I see and feel about it.

When we grow up, we follow rules we don’t understand why they are there, we cannot take part on any decision and we are just moving around understanding little of how the world works.

As you grow older you start seeing things with a different perspective, you see something you use to consider cool, as dangerous and foolish, we start looking back to those rules that at a time did not make sense and we see why those are important.

One of the things that happened today made me think, Am I ready? Can I really be a father?

My Father, is the best father there is (I hope you all can say the same).

By becoming a Father I have inherited a tough job, and I have a lot to do If I want to look at myself in the mirror and see my Father in me.

Hazards are everywhere, we want to protect our kids from the world so that they can be safe, but if we do that, the world will devour them when it has a chance.

So my goal is not to hide the world from my child, but to expose the world and the ugly faces to him/her, the more he/she learns early on, the more knowledge I’m able to give, the better decisions he/she will be able to make.

I have the best teammate I could possibly ask for, my wife, she is a strong woman, and I now that there is nothing we can’t do.

So my son/daughter, be assured that your life is going to be a wonderful ride, we will be able to learn together and grow together.

I hope to see you soon. (by the next new year)