A few good reasons to consider keeping your IT infrastructure up to snuff…
http://edgewatertech.wordpress.com/2012/08/21/time-to-remodel-the-kitchen/
(I’m honored to have the post accepted & published on Edgewater’s blog.) 🙂
Granite State Users Groups, LLC
#NHCommunityEnabled
A few good reasons to consider keeping your IT infrastructure up to snuff…
http://edgewatertech.wordpress.com/2012/08/21/time-to-remodel-the-kitchen/
(I’m honored to have the post accepted & published on Edgewater’s blog.) 🙂
I’ve recently had the opportunity to brush off my SSIS skills and revisit this toolset. In my most recent usage, I had a requirement to use SSIS to pull data from a WCF web service that was a) using the net.tcp protocol, and b) used transport security with a client X.509 certificate for authentication.
This was fun enough by itself. Configuring WCF tend typcially to be non-trival even when you don’t have to tweak app.config files for SQL SSIS services. One of my goals, in fact, was to avoid having to update that, meaning I had to put code in my SSIS Script block in the data flow to configure my channel & security & such.
Luckily, I was able to find examples of doing this with wsHttpBinding’s, so it wasn’t a stretch to tweak it for netTcpBinding with the required changes to support certificate authenticated transport security.
Here’s the code…
using System;usingSystem.Data;usingMicrosoft.SqlServer.Dts.Pipeline.Wrapper;usingMicrosoft.SqlServer.Dts.Runtime.Wrapper;usingSystem.ServiceModel;usingSC_13defb16ae45414dbac17137434aeca0.csproj.PaymentSrv;[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]public class ScriptMain : UserComponent{ChannelFactory<IProfile> channelFactory;IProfileclient;public override voidPreExecute(){base.PreExecute();
boolfireAgain = false;this.ComponentMetaData.FireInformation(0, “Pull From Profile Service.PreExecute”, “Service URI: ‘” + this.Variables.varProfileServiceUrl + “‘”, null, 0, ref fireAgain);this.ComponentMetaData.FireInformation(0, “Pull From Profile Service.PreExecute”, “Cert Fingerprint: ‘” + this.Variables.varClientCertFingerprint + “‘”, null, 0, ref fireAgain);//create the bindingNetTcpBindingbinding = new NetTcpBinding();binding.Security.Mode = SecurityMode.Transport;binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;binding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;EndpointAddressendpointAddress = new EndpointAddress(this.Variables.varPaymentServiceUrl);channelFactory = new ChannelFactory<IProfile>(binding, endpointAddress);channelFactory.Credentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine,System.Security.Cryptography.X509Certificates.StoreName.My,System.Security.Cryptography.X509Certificates.X509FindType.FindByThumbprint,this.Variables.varClientCertFingerprint);//” x8 60 66 09 t6 10 60 2d 99 d6 51 f7 5c 3b 25 bt 2e 62 32 79″);channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode =System.ServiceModel.Security.X509CertificateValidationMode.PeerTrust;//create the channelclient = channelFactory.CreateChannel();IClientChannel channel = (IClientChannel)client;channel.Open();this.ComponentMetaData.FireInformation(0, “Pull From Profile Service.PreExecute”, “Open Succeeded.”, null, 0, reffireAgain);}public override voidPostExecute(){base.PostExecute();//close the channelIClientChannelchannel = (IClientChannel)client;channel.Close();//close the ChannelFactorychannelFactory.Close();}public override voidInput0_ProcessInputRow(Input0Buffer Row){GuidtxGuid = Guid.NewGuid();Profileprofile = null;try{profile = client.getProfile(txGuid, Row.ProfileId);Row.PSProfileType = GetProfileType(profile);}catch (Exception ex){stringmessage = ex.Message();Log(message, 0, null);}}private string GetProfileType(Profileprofile){return “x”;}}
So one of the challenges I encountered while using this method had to do with the client certificate. This error drove me nuts:
The credentials supplied to the package were not recognized.
Server stack trace:
at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)
at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)
at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)
at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)
at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at System.ServiceModel.Channels.SslStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorBase.InitiateUpgrade(Stream stream)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.ICommunicationObject.Open()
at ScriptMain.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
If you look at it, this is an authentication error. Tracing the code, it happens AFTER the code successfully retrieves the client certificate from the certificate store. The call to SetServerCertificate succeeds without incident.
The error hits when the code opens the channel, and tries to use the private key attached to the client certificate to prove to the server that “I’m a valid client.”
I went nuts because I was an administrator on the machine, and had installed the client certificate to the certificate store myself. It initially worked, and there was no indication that there was a problem getting the certificate from the cert store.
It turns out that when you use the machine store under these circumstances, I needed to give myself explicit permission to the client certificate in order for the SetServerCertificate to get the private key along with the client certificate. This was counter-intuitive for two *additional* reasons: 1) I was an administrator on the box, and already should have had this permission by the fact that my login account belonged to the administrators group (which you can see from the pic below, also had access.) 2) It worked the day before. When I imported the private key originally to the key store, it appears somewhere in the depths of Windows 7 (and this applied on Server 2008 R2 as well) I still had permission in my active session context. When I logged out, that login context died, and, coming back the next day, I logged in again, not realizing I wouldn’t be able to access the key. Giving myself explicit permission as shown below allowed me to run my SSIS package within Visual Studio and from SSMS.
I’ve learned a few things in the past months in working with the SharePoint community. Namely, if you don’t have something nice to say, don’t say anything at all. In today’s age of social media meeting business networking, this is more important than ever.
I hope, however, that Microsoft’s Windows Phone Dev Team forgives me for the tough love I dished out on them back in May. (I won’t even link to that post.)
I love developing apps in Silverlight & C# for my phone, and I’m so happy to see an update that directly impacts us App Developers…
Here’s the Windows Phone Developers Blog:
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2012/08/07/meet-the-windows-phone-dev-center.aspx
Here’s the great looking new app publisher’s experience for Windows Phone Developers:
https://dev.windowsphone.com/
I haven’t fully explored it yet, but at first glance, it looks much more like the excellent developer’s & publishers’ experience I’ve come to take for granted from Microsoft… I can’t wait to explore it more and see how it all came together.
In modern programming, there’s a lot of cool stuff that can be done with metadata. Failing to consider it in one form or another is setting aside a major tool in any system architecture. Sadly, I see this from time to time, a project with a lot of information associated with it… typically the metadata ends up being expressed only as requirements… and is not applied any further in automation. My post on Edgewater’s blog highlights code generation as one of my favorite ways metadata can be leveraged using things like standardized requirements documentation as metadata.
Wikipedia argues that metadata is divided into two categories, “data about data types” such as XSDs and WSDLs, and “data about content” is only helpful in determining application. According to their current article, metadata is akin to information about a container such as a box.. how big is it? how much can it hold? Metacontent is information about what the box contains… what is it? how much does it weigh? what are its storage instructions? what are the contents of the instruction manual? The former information is often best applied at design time. The latter, is often more economically applied at runtime. I would argue that it goes deeper than that, as well. One man’s metacontent is another’s metadata. The term metadata could be used to cover:
Metadata in information systems has two major aspects: expression and application. Expression is everything from the media used to the language (even characters) that are used to communicate information. Expression implies how the information can be managed and transmitted, and even how the information can be applied. Application is all about how the information is used, impacting utilization of resources requried to leverage it at the time that it is applied.
In application development, metadata can take many forms. It can look like lots of different things. Here’s a list enumerating a few forms in the development world, along with pros and cons of each:
Metadata application, in programming terms, can be accomplished in several different places. It can be applied at:
At the end of the day, the business solution is always the most important part of the equation, but it’s not the only part. While I’m working on a solution, I’m also looking at tools, scaffolding, and framework. This is especially true if others are going to be working on the project, and that accounts for nearly every non-trivial project.
How easy is it to set up? How easy is it to work with? Do the expressions make sense? Can I hand it off to my least experienced teammate, get them to pick this up, and expect reasonable results? (For that matter, can I hand it off to my most experienced teammate and expect them to respect the design decisions I made? )
Keeping my head in the code is critical. Loosing touch with tools means shooting in the dark on the above questions. It doesn’t matter what their experience is, if you ask someone to push a tack into a corkboard, hand them the wrong tools for the job, they won’t be able to push the thumbtack into the corkboard… or you’ll nuke your budget paying for tools that are overpowered for the job. (But that thumbtack will be SO IN THERE!)
In any case, in most projects, after the architecture & technical designs have been sorted out, frameworks, built, automations put in place, I’ll take on the coding, too.
Of course, I’ve said this before… if you can really simplify the work, what’s to stop you from taking the extra step and automating it? I’m always eyeing code, especially “formulaic”, repetititive stuff, looking for opportunities to simplify, abstract, and/or automate.
Caught a question from Stacy Draper, @StacyDraper this morning about custom guids, to make them more recognizable.
It reminded me of a post I saw recently about Facebook using hex characters to make IPv6 addresses more recognizable.
Here’s what I was thinking… create a guid that has an embedded word.
For example, the following code creates a Guid that always starts with FACEB00C:
byte[] random = Guid.NewGuid().ToByteArray();
byte[] final = new byte[16];
for(int idx = 0; idx <16; idx++)
{
if(idx >= custom.Length)
{
final[idx] = random[idx];
}
else
{
final[idx] = custom[idx];
}
}
result = newGuid(final);
returnresult;
}
}
}
I’m please to say my hobby project, a Windows Phone app I call “Jimmy Sudoku” is now available both for free or for purchase.
The two SKUs in the Windows Phone App Marketplace are identical.
The free version is available in almost all markets around the world (including the US).
The paid version is only available in the US and 100% of the proceeds continue to support #NoKidHungry.
Link to Free SKU
Link to #NoKidHungry SKU
Please… Enjoy! 🙂
My “artisan portfolio” of Windows Phone apps just DOUBLED in size! Yes, I’ve now successfully published my second Windows Phone app. 🙂
The Granite State SharePoint Users Group Hub is a somewhat minimal app, but if you’re a member of the group, it’s got some useful features. My favorites are being able to get info about the next meeting, (both in the app, and as a live tile) and being able to RSVP through EventBright.
The direct link to find it in the Marketplace on your Windows Phone is this.
Regarding the name… GSSPUG? Ya, I know… it’s not quite as intuitive as NHSPUG…
If you’re from New Hampshire, you know you search for “Granite State” any time you’re looking for something local… and if you don’t know that, it probably is just as well you don’t find it. 😉
One other nice thing is that the content is largely driven from the group’s web site, which, of course, is a SharePoint site. The app does require a network connection, but it can be updated without having to go through the week-long process of publishing an update.
Like Jimmy Sudoku, the app uses your phone’s system wide theme colors.
Essentially this is what ends up in the Hub app.
And it appears like so:
I’ve had this thought cross my mind, too… some time ago, actually. My smartphone, a Windows Phone, is a natural social network browser; a mature response to “how to make social networking easy, practical, and physically portable”.
I would roughly guestimate that a good 50% of the OS, fresh out of the box, is dedicated to it (particularly the part known as the “People Hub”). Interestingly, the People Hub isn’t a Facebook app. It’s exactly what it sounds like… a contacts hub, a leads hub, management hub, a communications hub, a social hub… your people hub. Twitter, Facebook, LinkedIn, multiple Exchange domains, even Windows Live.
Some time ago I actually deleted the Facebook app from my phone, because I couldn’t think of a good reason to let it take up space on my phone. That was when it hit me. Aside from the basic description in settings here & there, the Facebook brand did not really exist on my phone. Nor did any of its advertisements. My phone became the better part of the Facebook experience… without Facebook.
It doesn’t surprise me in the least that this has come to light in the recent IPO. I gather that Facebook intends to start adding ads to news feeds. I wonder how long it will be before Facebook starts offering subscriptions to remove them. Or how long it will be before someone figures out how to filter them out again.
http://www.insidermonkey.com/blog/the-problem-of-mobility-and-facebook%E2%80%99s-battle-for-revenue-10985/
I have to say, though, the Facebook 2.5 update (relatively new) for Windows Phone does offer a couple features that make it worth keeping on the device.
The latest Facebook app can be found here:
http://www.windowsphone.com/en-US/apps/82a23635-5bd9-df11-a844-00237de2db9e
Found this post on porting apps from Android to Silverlight for Metro/Windows Phone.
http://buildmobile.com/migrating-android-applications-to-windows-phone-7/
I’ve not had the opportunity to build an Android app, but this looks like a great primer.