Tips for working with BCS and FAST Search

When building a FAST search solution to crawl external entities through BCS it can get very frustrating if you deploy a change and it doesn’t get updated in all the right places.

After much trial and error I have come up with the following checklist to keep your sanity.

Rule #1: If you change the BCS model manually (i.e. using a text editor instead of Visual Studio) you need to change the Version attribute of the Entity node in the entity that you make the change in. If you don’t do this any update you make will not be applied. This can lead to very confusing behaviour since the change you made will get reflected at some point down the line.

Apart from that here goes the checklist

  1. Delete the BCS content source
  2. Restart the SharePoint Server Search service
  3. Using Task Manager kill off any mssdmn.exe that are running
  4. Deploy your updated solution
  5. Recreate the content source and run a full crawl.

If your working in a multi-farm scenario where the Search service is in a different farm to that of the BCS service then you need to do steps #2 & #3 in the server running the Search crawls. This is important because any assemblies that you have built for the entity are dynamically copied into that server and loaded into Server Search & mssdmn.exe.

If you don’t do steps #2 & #3 Search will end up using the older version of your assembly and not the one that you just deployed.

On Ode To My Father

Hi Dadda,

I’ve wanted to write this note to you for a very long time. To let you know how much you’ve taught and inspired me with your life. I know that I don’t have a really close relationship with you like I do with Mummy. That most of our time together is spent in awkward silence while we search for something to talk about. But I want to let you know today that you have been the cornerstone of my life.

Thank you Dadda for teaching me the true meaning of love. In your 35+ years of marriage I have never seen or heard you show any hatred to Mom.

Thank you for showing me that true love means sticking with and taking care of darling Mummy who is ill with Parkinson’s.

Thank you for teaching me how to respect women by never ever raising your hand against Mummy.

Thank you for teaching me how to forgive and forget. Many people have wronged you but you never hold a grudge against anyone. You would forgive them in a heartbeat and let bygones be bygones.

You taught me morality. About always doing the right thing and to always be honest even when it is difficult. You went from being a very successful businessman to someone who doesn’t have much for which the main reason was because of your honesty and refusal to bribe or cheat anyone.

You taught me the joy of giving and sharing what little you have with others, about going out of your way to help someone who can never repay you.

You taught me not to waste anything in life. Whether it be finances or the environment around you.

You taught me what it was to work hard. I was privileged enough to work under you. Although I hated it at that time as a teenager, I now value and cherish the work ethic that you instilled in me.

You didn’t have it easy in life. Your mother died when you were just three. I can only imagine how hard it must have been to grow up without a mother’s love.

You were a promising student in school but were robbed off your education when Grandpa had you leave school and start work in the family business. Because of this you made sure that your kids got the best education possible even when it was beyond your means. I didn’t understand then but having my own family now I realise that you sacrificed quite a lot to send us to the best school possible.

You believed in me. Thinking back, if I ever showed an interest in something you made sure that I explored it. From playing the guitar and organ (which I can’t do to this day) to karate lessons, soccer and basketball lessons.

It took a lot of courage for you to let me drop out of school and follow my dream. You gave me the freedom to go after what I was passionate for. You believed in me and supported me.

One of my most favourite childhood memories is going for a swim after Sunday school. It took you less than two months to teach me how to do it. Oh the wonderful times we had.

Thank you dad for showing me that it takes a lot of courage, strength and self-control to stand by your convictions. That it takes more man to stay away from the vices of drinking and smoking.

Thank you for loving me unconditionally to this day.

Thank you for showing me how to live a life of service to others. You now dedicate your time to helping people. From running errands for various non-profits like the Little Sisters of the Poor, to visiting those who are sick or in prison and praying with them, to writing daily devotionals and sharing the Good News.

Thank you for showing me that it’s never too late to make your dreams come true, at 53 your now reading for a Bachelors in Theology and kicking ass by coming out on top in class!

Above everything else I want to thank you for the deep, personal and meaningful relationship you have with your Saviour and friend Jesus. You paved the way for me to find the one eternal treasure in life that is worth living for.

I love you Dadda.

Disable Windows Live Contacts from being synchronized to Windows Phone

One very useful Windows Phone feature is that it automatically adds all your Windows Live contacts to your Windows Phone when you sign in. This is all fine and dandy if that’s your master contact  list but for me all of those contacts were carried over from MSN Messenger which I stopped using many years ago.

The most annoying bit is that there is no way to get rid of those contacts. As of WP 7.5 you only have two options either delete all your contacts from Windows Live or change your primary Windows Live ID (which required a hard reset).

There is a third option though and that is to filter out the Windows Live contacts from the People Hub.

To do so go to the People Hub -> Settings -> Filter -> Uncheck Windows Live

Tada a quick and painless way to remove the Windows Live contacts and keep your address book tidy.

LogParser – Converting IIS logs to local date and time and filtering by date range

This is a note to myself to remember how to convert the UTC date/time to the local timezone.

logparser “SELECT TO_TIMESTAMP(date, time) AS utc-timestamp, TO_LOCALTIME(utc-timestamp) AS local-timestamp,* FROM D:\Log\SearchServiceWrapperLogs\SearchServiceWrapperLogs\u_ex1202* WHERE local-timestamp between timestamp(’2012/02/02 00:00:00′, ‘yyyy/MM/dd hh:mm:ss’) and timestamp(’2012/02/03 00:00:00′, ‘yyyy/MM/dd hh:mm:ss’)” -recurse:-1 -o:csv >> fulllog.csv

Fixed: The target “GetCopyToOutputDirectoryContentProjectItems” does not exist in the project.

If your building a Windows Phone app and get this error then a quick fix is to download the XNA Game Studio 4.0 Refresh (40 MB) and install it.

This adds the missing target.

XNA Game Studio 4.0 Refresh

Downloading and installing this takes way less time than repairing the Windows Phone SDK (which asks for a reboot as well). Also repairing does not always solve the problem.

Configure the Belkin Play Max router for SLT ADSL Broadband

I’m on vacation back home in Sri Lanka and became the tech support guy for the in-laws. They were using an old D-Link router which supported just 802.11b and a draft version of g. In short ancient. The house has two stories and a terrace but the wifi wouldn’t even work on all the rooms on the same floor.

So I went to Unity plaza and checked out all the routers that are available. Unfortunately there’s not much in terms of choice. All of the available routers were the low end versions by D-Link, a few have a low-end Linksys router and some Belkin routers. You also get a handful of Asian brands of which the Unity Plaza sales guys tout the TP-Link as being the best brand, far superior to D-Link, Linksys etc.

I finally settled on the Belkin Play Max N300+300 which sells here for Rs. 16,500/-

I got home plugged it in but couldn’t get it to connect to the SLT ADSL. I spent a few hours trying various settings, calling SLT to verify the username/password all to no avail. I finally updated the router from v1.00.45 to v1.00.46 and viola it worked.

The connectivity is really good and I don’t have any dead spots in the house.

Here are a few screenshots of the config page for SLT’s settings.

Generating a mock/stub WCF web service from a WSDL

When working on integration projects you sometimes need to build a stub or mock service to emulate the behavior of the targeted system in your dev environment.

Visual Studio’s Add Service Reference dialog provides an easy way for generating the client code based on the WSDL of the service that you are invoking. Unfortunately there is no such dialog to generate a server side stub / mock.

There are various approaches you can take here but using svcutil.exe has been the most pain-free for me.

Here’s an example of how to go about it:
svcutil /mc UserService.wsdl UserTypes.xsd

The /mc parameter generates a class file with all the data types defined in the .xsd as well as the interfaces for all the operations defined in the WSDL. It also provides you with a starter .config file that you’ll then need to tweak to define the port on which the service is going to be hosted.

Once you have these files create a new WCF Service Library project, add the generated class files. Then create an implementation class that implements the interfaces that is generated. To keep things simple you might want to write code for just the operations that your calling from the client side.

Now here’s a gotcha for those stubbing out a service generated by Oracle WebLogic. The Action (SOAP Action) attribute on the operations are sometimes the same for all the operations in the interface. WCF doesn’t support this since it doesn’t conform to the WSDL specifications. You’ll easily know that you’ve hit this issue when you get the following exception when trying to host your stubbed service.

System.InvalidOperationException: The operations xxx and yyy have the same action (). Every operation must have a unique action value.
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ActionDemuxer.Add(String action, DispatchOperationRuntime operation)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime..ctor(DispatchRuntime dispatch)
at System.ServiceModel.Dispatcher.DispatchRuntime.GetRuntimeCore()
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpened()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)

To overcome this you can create a custom Dispatch Behavior that uses an alternate algorithm to assign incoming messages to operations. The Dispatch by Body Element WCF sample comes with a sample implementation that works well.

All you need to do is add the two class files in this zip file (it’s the same code that comes with the WCF samples) DispatchByBodyBehavior

Next open up the class generated by svcutil and add the DispatchByBodyBehavior attribute to the ServiceContractInterface. You should now be able to host the service in WCF without any issues.

public interface IDispatchedByBody
Message OperationForBodyA(Message msg);
[OperationContract(ReplyAction = "*"),
DispatchBodyElement("bodyB", "")]
Message OperationForBodyB(Message msg);
[OperationContract(Action="*", ReplyAction="*")]
Message DefaultOperation(Message msg);