Latest posts.

CRM 3.0, Entity Conversion done easy! Vb.Net

Ok, so your working with Microsoft CRM 3.0, right? And you have hundreds if not thousands of leads. You need to Qualify these leads, and Convert them to Accounts or Contacts. You’ve checked the Web API, but it doesn’t seem possible, or even easy… Well it is. After I spent countless hours surfing google, looking for an answer, I couldn’t find a good one. Here it is folks, and done in the wonderful world of VB instead of C#!

The first order of business is to create a new project, and add the Web Reference for CRM 3.0 to your project. It does not matter what type of project you create, winforms, console, asp.net. This is general VB code that will sit behind what ever interface you choose.

I will not cover CRM Web Reference addition to your project, you should be able to find that through google very easily, or know it before you attempt this :).

First import the CRM namespace. For the purposes of this write up our project is called ConsoleApplication1. And our WebReference is called CRM

Imports ConsoleApplication1.CRM

Next, we need to create an instance of the CRM service.

Dim oCrmService As New CrmService

Great! Now we are getting somewhere :). Lets follow it up by creating a function to return all of our Leads. We will be using FetchXML for this. This will return formatted XML, where you will be able to pull out all of your GUIDs from the LeadID field. The prefered method here, would be to load these into a XML document. I will write an XML memory document post later.

Dim fetch1 As String = _
'change [ and ] to < and > wordpress messed this up
“[fetch mapping='logical']” + _
“[entity name='lead']” + _
“[all-attributes/]” + _
“[/entity]” + _
“[/fetch]”

‘ Fetch the results. Into a String
Dim returnString1 = service.Fetch(fetch1)

To qualify the lead, we do it like this. Very short.

Dim oLead As SetStateLeadRequest = New SetStateLeadRequest 'create request for new change to the state of the lead
'qualify the lead
oLead.EntityId = LeadGUID ' This is the GUID from the fetch statement.
oLead.LeadState = LeadState.Qualified 'set the state of the lead to qualified
oLead.LeadStatus = -1 'not open anymore
oCrmService.Execute(oLead) 'execute the lead change

Now we need to Convert the Lead to an Entity of our Choice.


Dim oContact As InitializeFromRequest = New InitializeFromRequest 'create a request to make a contact
Dim oContactResponse As InitializeFromResponse = New InitializeFromResponse
Dim oContactObject As contact
'setup a entity
oContact.EntityMoniker = New Moniker
oContact.EntityMoniker.Id = LeadGUID
oContact.EntityMoniker.Name = "target entity as string"
oContact.TargetEntityName = TargetEntity
oContact.TargetFieldType = TargetFieldType.All 'target all the records on the lead entity to the target entity
'tell crm server to setup the entity
oContactResponse = oCrmService.Execute(oContact)
'tell crm to create and confirm the entity it setup
oCrmService.Create(oContactResponse.Entity)

Now as you see, this task is much easier than you thought! And there you have it, for you in VB.NET!

Finally an easy way to Twitter… How about Wordpress Support Harper? >:D

Ok so, anyone that reads this blog, should know by now how infrequently I update this. Well that will change. From my understanding everyone whose blog I read never blogs! I’m thinking about starting the infrequent bloggers club. We would inevitably meet infrequently.

But while I’m hear, let me tell you what Harper Reed did. Harper recreated one of the best twitter bots ever. It connects twitter to jabber (google talk). Why does this rock? Its as easy as sending an IM to excla.im, and bam Twitter status updated.

This rocks, because no more multiple apps across multiple platforms to make twittering easy. Try it out.

Only one question remains, Wordpress support harper? :-D I would love this. If I could send a message from Jabber to my Wordpress blog and have it published. Perhaps I need to investigate XMPP more. :) Or just wish that someone else does it for me. Go internets!

Ok, time for some serious updates.

It has been a long time, but I am back, and with force my friends! I’m applying at a new firm, hopefully they will like my resume. I do not currently fit the job descriptions they have, but I believe I can be a new, and great addition to the team, and I am very interested in the type of work they do.

Anyway, that was a quick update, I have much time on my hands tonight as the baby has gone to sleep. Perhaps I will slip onto irc, and check with everyone. Oh and do I have some goodies in store, later.

Ok, so seriously…. 7 days? How about 736 days!? (update 7676 days is max)

update: the max number of days that can be gotten is 7676 days.

This is a call out to Codeweavers. Mainly Jeremy White. I hope you read my blog ;-) I read yours! I love Codeweavers. They have for the FIRST time in a long time, enticed me to move away from Open-Source strict software, and pay for a product. Its that good. They save me time in management. I don’t HAVE a lot of time. I don’t want to mess with winecfg, I don’t wanna dink with X11. Well thats the thing, I can’t dink with X11 anyway, because hey OSX 10.5 ;-/ kinda screwed the pooch on that one.

Apple X11 + Wine = No OpenGL support. Codeweavers, wove an amazing web. Crossover, and CrossOver Games 7.0, is awesome. Finally GUILDWARS, on my Mac. Here is the problem. I didn’t try CrossOver, until I got a Mac, Wine + X11 fairly stable in Linux, and actually I didn’t have a Linux gaming machine, I’ve been all ATI, and well we know how their track record is :-D but that is another post!

So here I am on a Mac that can game, stuck Dual booting. CrossOver gives me the ability to STOP booting Windows. YAY my Mac is happy! Because VMware takes care of the need for my day job. Sweet. I download CrossOver 6.2, which is ok so so. Its a little behind, but I take the 30 day free offer, and play loads of games. Honestly it wasn’t that great, but it worked. And I heard CrossOver Games was coming out. WELL, I downloaded the demo. And boy was I sad. I have so many MORE games I want to try with CrossOver 7.0, due to the upgraded wine. You know what, they gave me a week. OH SHIT?! I thought Jeremy White had 2 kids?! And a wife!? And articles mentioned he didn’t have a lot of time!? Jeremy, WTF? 1 week to try out 7.0!?

So here it is, proof of concept, because I don’t think its fair to post, and most of the geeks will figure it out. Extend your CrossOver Games trial, past 7 days. Note: This is illegal, I am still in my 7 day trial period, as of writing this. I do plan to purchase the software as it is great, and CodeWeavers is still the bomb. But I think they were unfair this time around.

Also Jeremy, if you do stumble across this, consider helping the Mac community out with Leopard. I know you are a big fan of giving back to the community. And the one thing that some other tinkerers and hackers would like, is to have working X11, and OpenGL with wine.

be fair

It has been a while.

So where have I been! Busy, thats where. I blew Dreamlinux in the dust, mostly because it seems like the developers, decided to shut down the forums without any notice, and they left users out in the cold dust, only to reopen a newly hosted forum, with no user migration.

It was a big irritation, that just didn’t sit right with me, so I ditched them! Ubuntu all the way! Right now however, I’ve switched to OSX in the hopes of having some good development time, and tricks and tips. Its about time I actually get on this blog, and start typing some stuff, here, instead of letting it sit on the interweb superhighway and melt away!

Vb.Net: Recursive File Count


Function CountFiles(ByVal Directory As String) As Integer
'Recursive File Counter
'by Derek Anderson
'dim variables
Dim FileCount As Integer = 0
Dim SubDirectory() As String
Dim i As Integer

'get the count of files in the current directory
FileCount = System.IO.Directory.GetFiles(Directory).Length
'get a list of sub directories from current directory
SubDirectory = System.IO.Directory.GetDirectories(Directory)

'for ever sub directory, count the files and add to file count
'this is a recursive routine, so it will call this again and
'return the file count of every directory, and add it to the file
'count originally started
For i = 0 To SubDirectory.Length - 1
FileCount = CountFiles(SubDirectory(i)) + FileCount
Next

Return FileCount

End Function

Stop with the INTEL-HDA 3Stack business.

So today, I ran into great news, back in september someone released a patch for the Intel-HDA sound card, for Alsa 1.0.15!!!! What this means to you, if of course you have an Intel-HDA, is that your headphone port will not auto switch off the speakers, and it doesn’t just decrease the preamp, it works like it did on Windows!

Ok so how can you do this? Well these instructions should pretty much work on any Debian based system for sure. Since I use Dreamlinux, I’ll be talking about that distro, and Debian Stable in general.
More… »

Why I’m growing more fond of Dreamlinux 2.2

I’ve begun to grow more fond of Dreamlinux 2.2 after finding out whats making it tick a little more. I appreciate the fact that its built pretty much right on Debian Stable (Etch). While the packages are out of date compared to Ubuntu, its making for a very usable and speedy/fast system, with little to no bugs found in say Gutsy Gibbon. Gusty Gibbon is bloated, hardly runs well on my laptop, and suffers some setback. This happens every other release of Ubuntu to me, by the time the next release of Ubuntu is coming out, the current 6 month cycle is just finishing up on being stable. And I’m really not too fond of sticking with a LTS from Ubuntu. They just havn’t proved them selves to be LTS people yet. Debian on the other hand, has roots that go way back.

For now, I’ll stick with a slightly out of date system, loving the Debian Stable branch. :)

Dreamlinux 2.2, Engage Admin, Engage and network-manager-gnome

I’m been really getting into Dreamlinux, it appears to be a distro with pretty much everything I need. Like I said in my previous post, the only downside is that the system isn’t always up to date as well as it should be. With that said, Dreamlinux doesn’t come preinstalled with an easy network manager. Nore has the Dreamlinux team made the current network manager much easier to use. The problem is most related to laptop users. Laptop users, need an easy way to scan wireless networks, and pick an available one. I wrote a quick mini tutorial at the Dreamlinux Wiki about it.

But now, I have a new gripe. Engage Panel dumps the sys tray when it recycles, I hate this, because guess what, network-manager-gnome doesn’t automatically recycle it nm-applet! In other words, edit the Engage Dock using Engage Admin, and lose system tray icons, and need to restart the applet.

I found a quick way around that, and am providing my modified Engage Admin code. Basically how this works, is you replace the current Engage Admin with my modified one (or you can install them side by side, there are only 2 line additions), install a sh script to your home directory, enter the commands to run after recycle in the sh script. And now, when you recycle the Engage Dock, it will also run the commands in the sh file, easy - no more manually reloading nm-applet! Of course you can follow the small guide here, but I’ll also be adding it to the Dreamlinux Wiki .

Just follow these codes in your terminal window:


cd /usr/local/bin
sudo mv engage_admin.rb engage_admin.rb.bak

DreamLinux 2.2 and ATI 8.42.3

Installation of the binary ATI Linux driver, always seems to be a pain in my ass. I try out generally 3-4 distributions of Linux a week. I always seem to run into the same problem with every ’special’ distribution, they don’t like the driver packages - or there is no documentation to help! That is the case with DreamLinux 2.2 MMGL. DreamLinux is a merge of several distrbutions, along with some sprinkled in love of great applications to pull it all together. While DreamLinux may have some short comings, it makes up for them more than enough, with its XFCE 4 desktop, and Engage Dock bar, and all the Multimedia goodies throwen in at the start. Its based on Debian with a Kanotix Kernel, this means that it isn’t always obvious what needs to be done to get something running with in this distro.

The biggest misfortune for DreamLinux, is the small team of developers behind it. With a group of 4 people (last I found a count), keeping the distro up to date, seems to be a little hard to do. The ATI installation script that is provided, is SEVERAL releases behind. Since 8.40 had made leaps past 8.36, it is a MUST to have the latest drivers available. However, because of the special nature of this distribution - I found it a little daunting to compile the driver into a package manually - and install. After all, we started saying this distro is Debian + Kanotix, did you know it likes to use the Ubuntu/edgy package for driver install!?

So now my mini tutorial on 8.42.3 and DreamLinux.

Obtain updated Kanotix Debian fglrx script.


cd /usr/local/bin
sudo rm install-fglrx-debian.sh
sudo wget http://kanotix.com/files/install-fglrx-debian.sh
sudo chmod 755 install-fglrx-debian.sh

Now that you have the updated script, press CTRL+ALT+F1 to switch to a text terminal (to get back to your X session, CTRL+ALT+F7). Log in to the Text Session as your self. Run the following command:

sudo fglrx-install

Now once the script is finished running, it should restart Xorg, and you should be all set and running with the latest 3D driver.

To check type


fglrxinfo

If you return Vendor: ATI you are good to go. If Vendor: Mesa, try again!