Inauguration PhotoSynth
CNN has a very cool PhotoSynth from the 2 million people who attended the US inauguration (and who uploaded them to CNN). There is some really great angles available which I didn’t see from the TV broadcast and some great close up shots of Obama. This is just another great use of Silverlight. If you think how many will use this and how many watched it streamed live with Silverlight the question of Silverlights reach must really not becoming a serious discussion point when comparing with Flash.
If want to have a look at the PhotoSynth: http://www.cnn.com/SPECIALS/2009/44.president/inauguration/themoment/
Delphi Prism: Part 3: VS 2008
So now we have completed the install lets run it. To start off we will try VS 2008 first.
Hmm, nothing new on the slash screen.
Ah, there is a special window. This could be annoying though, maybe that Don’t Show should be default.
In the New project dialog, there it is the Delphi Prism section. Yes changing framework version changes what is available, same as in C# or VB.NET:
Interesting is this sub-section called Mono, which has GTK# and Cocoa options!!!
I first choose GTK# and I get prompted for registration… damn more remembering of that BDNCDN password :(
Right so lets just compile and run… and boom that failed :(
Right, maybe GTK# is needing something? Let’s try Cocoa (Leopard)… which also went boom :(
WinForms on OSX… that works :)
GTK#/Mono Console App… that works :) Love the base code (hello world)… I added the readkey’s to test the various styles and both work (check the screen shot)
How about good old Windows WinForms based. That worked!!! :)
So drop a button on to the form and double click… hmm no partial class support so all it goes into the main.pas, same as C# in Visual Studio 2003. Anyway this lets me try some things… first intellisense, that works great:
Error messages look slightly different:
LINQ in Delphi works!!!
Right enough basics for this post…
AD Lookup Control with Perl and JS - Day 2
So day 2 started with growing the control further, but first I wanted to set the code up to run in IIS.
Perl + IIS 7
First I created a simple application pool for this site to run in. One of the nice things is setting it to not run .NET Framework code, which just lowers your attack surface.
Next I created a simple web site to use that app pool, however there was no handler setup (odd, I thought ActivePerl’s install did this - but maybe it is IIS 6 only). To fix that I clicked on Handler Mappings
In there I added a Script Handler with the following settings:
Note I would leave Request Restrictions on the default UNLESS you have a good reason to do it.
After that brief config my Perl worked for a while, until I started getting this error (IIS Worker Process has stopped working) when browsing to the web page:
I had just changed code before that, so here is a quick test to you to try and find the fault. The snippet of Perl code looks like the following:
1: print "<html>2: <head>3: <script src='jquery.js' type='text/javascript'></script>1:
2: <script src='jquery.simplemodal.js' type='text/javascript'>1: </script>
2: <script src='test.js' type='text/javascript'></script>4:
5: </head>6: <body style='font-family: Calibri'>7:
8: Username <input type='text' id='result' readonly='readonly'/><span id='test' style='color: #0000FF; text-decoration: underline; cursor: hand'>Select User</span>9:
10: <div id='listContent' style='padding: 5px; background-color: #000000; color: #FFFFFF; border: thin solid #C0C0C0; width: 450px; overflow: scroll; height: 450px;'>11: <div style='font-size: x-small; color: #C0C0C0; text-align: right; cursor: hand;padding-right: 20px;' class='simplemodal-close'>Cancel</div>12: <span style='text-transform: capitalize; font-weight: bold; padding-bottom: 3px'>Select a user by clicking on their name</span>13: <hr />14: Filter <input type="text" id="filter" />15: <hr />";
If you are stuck the here is a hint: Line 14.
.
.
.
Ok, if you got it good. If not, well it is because the HTML I was outputting had " in it and that caused the string to close and some garbage (from the compilers POV) to be after it. Why this has to kill the process I dunno, what’s wrong with a error message like we get from .NET?!
Filtering
I added a text box to the popup dialog so I could filter using JQuery .show and .hide methods. This is not that impressive but it did lead me to needing the jQuery documentation a lot (mainly for the selectors, but I also was getting weird results with hide… until I realized I had <br/> tags there and those weren’t getting hidden) and checking with the slow internet here was not great. So I found (read: I went to the jQuery Alternative Resources page) a cheat sheet I could print and stick on the wall in front of me. There are two listed there, one Excel and one Image. The image one looks nicer and is more verbose than the Excel one, but I went with the Excel one because it has examples… and I can figure out from the examples more than the verbose text in the image gives me.
One of the other things about filtering is that I wanted to be case insensitive, but I was using :contains to do the filtering which is case sensitive. I found a great thread on adding an extension method to it with a case insensitive version of :contains. I recommend if you are stuck copy/paste that one.
CRM 4 Rollup Pack 2
If you thinking, jeez this sounds familiar well it was only 1 month and 19 days ago that rollup pack 1 shipped.
You can download it at http://www.microsoft.com/downloads/details.aspx?FamilyID=aa671769-61e9-45c4-919f-c88199aa4241&displaylang=en
So what’s new?
113 known (rather publicly known issues) and 18 private (i.e. MS did not publically post articles on those) fixes!
My highlight reel of fixes
- 949844 (http://support.microsoft.com/kb/949844/ ) The Async service stops unexpectedly or you cannot start the Async service after you import an organization from another Microsoft Dynamics CRM 4.0 deployment
- 950266 (http://support.microsoft.com/kb/950266/ ) You are looped in the sign-in page when you try to run the Data Migration Manager Wizard in Microsoft Dynamics CRM 4.0
- 950372 (http://support.microsoft.com/kb/950372/ ) You are prompted to enter your user name and password multiple times when you start Outlook, or when you click a Microsoft Dynamics CRM folder in Outlook, on a Windows Vista-based computer
- 954313 (http://support.microsoft.com/kb/954313/ ) Error message when you try to log on to the Microsoft Dynamics CRM Web site from the Microsoft Dynamics CRM 4.0 server: "Request IP Address has different address family from network address"
- 956112 (http://support.microsoft.com/kb/956112/ ) Error messages in the Application log on the Microsoft Dynamics CRM server after you delete a quick campaign: "Deletion Service failed to clean up table=[Table_Name]"
- 956282 (http://support.microsoft.com/kb/956282/ ) Error message when you use the Microsoft Dynamics CRM 4.0 SDK to develop a Custom Workflow Activity assembly: "The Key cannot be NULL"
- 956859 (http://support.microsoft.com/kb/956859/ ) The Microsoft Dynamics CRM toolbar is disabled in Outlook after you lose the network connection for less than one minute
- When you use impersonation in an Internet-Facing Deployment (IFD) environment, you receive the following error message: 0x80040204 Invalid user auth
Any major risks?
You can uninstall Update Rollup 2. So make sure you have backups if you need to re-install!
There are four fixes which you need to manually configure:
955138 (http://support.microsoft.com/kb/955138/ ) You experience slow performance or timeouts when you try to access some views in Microsoft Dynamics CRM 4.0
955452 (http://support.microsoft.com/kb/955452/ ) Line feeds are not used when you send an e-mail message that uses an e-mail template to render data that has line feeds in Microsoft Dynamics CRM 4.0
955745 (http://support.microsoft.com/kb/955745/ ) Error message when you try to configure the Microsoft Dynamics CRM 4.0 client for Outlook: "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms"
956527 (http://support.microsoft.com/kb/956527/ ) The Microsoft Dynamics CRM client for Outlook consumes three times as much memory in version 4.0 as in version 3.0
Thanks to Menno for the heads up.
Delphi Prism - Part 2: Installing
So continuing on from part 1…
My machine (Windows 2008 Server) already has Visual Studio 2008 installed so this may be different for those who do not already have it. This will be a lot of pictures showing step-by-step the install and comments on that.
The standard splash screen for any application.
First window of the wizard installer. Interesting is the version number there, I wonder if Onyx is the codename for this product?
Same as what is in license_??.rtf in the root of the disk.
Enter key, what key? Damn need to find the mail the sent me… gmail here I come. Damn no key in the mails they sent me, ok back to the Embarcadero site. Oh, look I had to do that manually. WTF why don’t you send it to me when I click download? Oh well, guess I can’t get everything.
This is interesting, as I have VS 2005 installed as well it seems to install to that too (cool). I make this assumption because the shell on the disk is only 2008. Silverlight support is also interesting.
Mono license
Hey, thanks for giving me an option to change my visual studio start page to Delphi Prism. The SQL guys could learn a lot from you (they just set it to Microsoft.com/sql regardless if you want that or not).
Mono install first, then
Prism actually installing.
And DONE! from start to finish under 10min!
Icons in the program list.
Announcing: Community Technology Preview of Visual Studio 2008 extensions for SharePoint v1.3
Copied directly from Announcing- Community Technology Preview of Visual Studio 2008 extensions for SharePoint v1.3
The Visual Studio extensions for SharePoint (VSeWSS) provide project templates for developers using Visual Studio 2008 to create, debug, package and deploy SharePoint projects including Web Parts, Data Lists, Content Types, Event Receivers, Templates, Modules and other SharePoint artifacts. The v1.3 release is an incremental release of the VSeWSS including top feature requests. It is an interim release for SharePoint Developers on the roadmap until Visual Studio 2010 is released with significantly improved SharePoint development tools as outlined here.
The Community Technology Preview (CTP) release is available here on Microsoft Connect where customers can also report any feedback they have. It is anticipated that all existing VSeWSS 1.2 projects will work with the CTP. The CTP is not supported by Microsoft Customer Support Services. You are encouraged to provide feedback through the Microsoft Connect site and to discuss the extensions on the SharePoint Development MSDN Forum.
The new features in VSeWSS 1.3 are:
· Can be installed on x64 Server OS machines running SharePoint x64. Previously only x86 Server OS could be used.
· Separate build commands for package, deploy and retract are added
· Command line build, package and retract commands are included enabling continuous integration and build servers. Previously command line build of SharePoint projects was very difficult
· Refactoring support for renaming of Web Parts. Previously renaming a web part required changes in several files in the project
· WSP View improvements for consistency of deleting feature elements, merging features and adding event receivers to features
· Solution Generator can now generate solutions from publishing sites. Previously only regular sites could be generated
· Allowing partial trust BIN deployments of web parts. CAS configuration must still be provided by the developer.
· New project item template for SharePoint RootFiles items
· Deployment will now optionally remove conflicting existing features on the development server prior to redeployment. Previously any feature name conflicts would result in an error
· Ancillary assemblies such as for business logic can now be added to the SharePoint Solution WSP
· Hidden features related to Site Definition projects are now shown in WSP View. They are no longer hidden
· For advanced users a fast deploy is included to update only the compiled assembly on the SharePoint development installation
· The User Guide is now installed with the extensions instead of being a separate download
The final release of VSeWSS 1.3 is planned for the North American Spring of 2009.
Delphi Prism - Part 1: Opening the "box"
All Prism related posts can be found in the tag Prism.
Hi, my name is Robert. I have been a closet Delphi fan for many years. <Hi Robert>. So when Borland, sorry Interprise, no I was right it’s Borland, sorry I forgot CodeGear, never mind I think it’s no Embarcadero said there was a super duper new version coming I got excited (maybe too much). So I have downloaded the trial and will blog about the experience.
Now note Delphi is NOT what I use day to day, in fact if I am choosing a language now it’s C# so don’t expect production evaluations but rather a hackers evaluations. First thing is downloading it (and finding my BDN CDN login) and waiting for the 4Gb to download to the slow internet of South Africa.
So lets see what’s in the box, or image:
First is ER/Studio Developer Edition which is a database modeling tool from Embarcadero.
InstallAware Express CodeGear edition is an installer system, ala MSI/InstallShield/NSIS etc…
InterBase 2009 Developer Edition is next, no need to mention what that is (Delphi fans will just know)
Mono is exciting, in there is the Win32 GTK version of Mono :) Cross platform dreams are coming back.
Shell contains the VS 2008 shell install.
Wiki is interesting, as it looks like a dump (dated September 29, 2008) of the one from their site with anything other than read disabled. This makes sense and is actually very useful for us in the slow internet land who may battle to get to the wiki some times. So to who ever had this idea, well done! A few of the articles that jumped out at me are:
- Win32 Delphi vs. Delphi Prism
- Delphi Prism Syntax compared with Win32 Delphi
- Migration Tools: Oxidizer – ShineOn
There is also a good logo:
AD Lookup Control with Perl and JS - Day 1
Recently I needed to do a bit of coding for a project which needed a lookup system into Active Directory written in Perl, this post explorers the excitement (read: pain) that I had with this bit of coding. I haven't touched Perl since for a few years but development is like riding a bike, isn’t it?
Setup
First problem is I used to “ride” a Linux bike where Perl is part and parcel of the world, now this Windows 2008 Server which I use on my laptop it’s another story. So step one is getting Perl for Windows, and thankfully the parts of my memory not (yet) destroyed by beer remembered about Active Perl from Active State which had a Windows version (this takes me back almost a decade to when I last used Active Perl, go strong brain cells, go!). The download and install of it was very painless, it just did it’s thing.
Next up was getting an IDE in place just to get up and running, so I found Perl Express which is a free, small IDE for Windows. It has a built in debug environment which is all I really needed. When I get to the later stuff I was confusing it with my “small” script. Lots of people have told me to get Slick Edit instead as it is much better, but it costs money and I need this for a short while. If I had to do this daily I would invest in a real one.
Install NET:LDAP Attempt 1
Next up was finding out how Perl can talk to AD. I decided that there must be LDAP support so I would look for that and found a great series on using NET::LDAP (the link goes to Bundle::NET::LDAP, but I’ll explain that later) when working with AD, you can read part 1 of that here. So I fired up Perl Express and tried the first sample and it died saying I do not have NET::LDAP. So off to find out how to get the module, which turns out needs to be obtained via the command line by typing
perl -MCPAN -e "install Net::LDAP"
However since it has dependencies it is better to get the bundle pack with everything in it so you type
perl -MCPAN -e "install Bundle::Net::LDAP"
This will download, compile and install the module. The first time I ran the command it failed because my proxy at work was blocking me, so time for the trusty 3G connection.
Install NET:LDAP Attempt 2
Run the command for a second time and it starts to fail with this pop-up:
See it needs to do a compile and when it can’t find NMake it downloads it from Microsoft. However it downloads the old 16bit version and that doesn’t run on 64bit Windows 2008 :( The internet suggested I download the Windows SDK since it had a 32bit and I found it at: Windows SDK for Windows Server 2008 and .NET Framework 3.5 but it is huge (min of a couple hundred Megs of download). But I thought I have Visual Studio installed, surely that has a copy?
Thankfully, my search kung fu (I have to stop calling skills Kung Fu - watching X-Files is doing this to me) is not limited to the in#ternets and I found a local version. To use it I needed to run the following at the command prompt PRIOR to running my perl install:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
Install NET:LDAP Attempt 3
Right, attempt number 3. This failed due to missing dependencies, you’d think when it comes up and asks you
==> Auto-install the 1 optional module(s) from CPAN? [n]
for said dependency it would do that when you say yes? Doesn’t seem so. It seems it is just a test to how many times you will run the tool.
Install NET:LDAP Attempt 4 & 5
*sigh* So now I will try and install each dependency manually first, so the commands look like this:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
perl -MCPAN -e "install GSSAPI"
perl -MCPAN -e "install IO::Socket::SSL"
perl -MCPAN -e "install XML::SAX::Writer"
perl -MCPAN -e "install Bundle::Net::LDAP"
This still complained about issues, so I run each one again (ignoring errors - ignorance is bliss) and when prompted I choose the default of no, and somehow even with errors (I think they are errors, maybe I just not used to reading these message) there in C:\Perl\site\lib\ appeared a NET folder with an LDAP.pm file in it!
5 Attempts and it is installed - yeah just like riding a bike :/
Finding my Domain Controller
The first thing I need to provide to NET::LDAP is my domain controller, which I don’t know so instead of logging a call with IT and waiting for a response I decided to figure it out myself. Thankfully I found a page on Microsoft’s site detailing How Domain Controllers are located in Windows which included directions on troubleshooting problems. One of those was manually testing with the command line
nltest /dsgetdc:<your domain>
which provided exactly what I needed!
Control Construction Step 1 - Getting the details
The first part of building my lookup control was to be able to query AD for all users and just list it back. I defined a user as someone with a surname greater than zero and with a username, if you had those you are a user and not a machine or system account (yes, SkyNet I’m looking for you).
The script in the end looked like this:
#!/usr/bin/perl
use strict;
use Net::LDAP;
use Net::LDAP::Control::Sort;
#Start of user configurable settings
my $DomainController = "<DOMAIN CONTROLLER>";
my $Username = "<USERNAME@DOMAINNAME>";
my $Password = "<PASSWORD>";
my $BaseOU = "<BASE OU>";
#End of user configurable settings
#Start of system settings
my $Attributes = "sAMAccountName,sn,displayName";
my $Filter = "(objectCategory=User)" ;
#End of system settings
print "Going to attempted to connect to ".$DomainController;
my $ad = Net::LDAP->new($DomainController)
or die "Could not connect!";
$ad->bind($Username, password=>$Password);
my $sort = Net::LDAP::Control::Sort->new(order => "displayName");
my $results = $ad->search(base=>$BaseOU, filter=>$Filter, attrs=>$Attributes, control=>[$sort]);
if ($results->count == 0)
{
die "No results returned";
}
else
{
for (my $counter=0; $counter<$results->count; $counter++)
{
my $user = $results->entry($counter);
if (defined($user->get_value("sn")) && length($user->get_value("sn")) > 0 && defined($user->get_value("sAMAccountName")))
{
print "\nUser Found:".$user->get_value("displayName")." (".$user->get_value("sAMAccountName").")";
}
}
}
$ad->unbind;
print "\nDone";
Since I don’t deserve to be called a Perl programmer (I have no skills here), this Perl Hacker did rely on the internet for help. The sites that helped me were:
- How Can I Determine the OU a User Account Belongs To? http://www.microsoft.com/technet/scriptcenter/resources/qanda/oct04/hey1021.mspx
- Perl check for nulls: http://www.unix.com/shell-programming-scripting/9856-perl-how-tell-if-variable-null.html
- Perl String Function: http://www.comptechdoc.org/independent/web/cgi/perlmanual/perlfunctstring.html
- Sorting results: http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP/Control/SortResult.pm
Control Construction Step 2 - The HTML
Since this will be a web page what I would like to do is have a page popup when you click on a text box which will let you select a user. When ever I have these scenarios I like to simply the development by creating an HTML file or two on my desktop and getting the JavaScript to work on a very tightly built scenario. This way I get the thinking and structure right without worrying about bugs being caused because of data or the perl code. Since I am going to use JavaScript it means I need to grab a copy of everyone’s (maybe not everyone, but at least me, the guys at End User SharePoint and Microsoft) favorite JS library, jQuery. That is followed by a wander through the plug-in section on jQuery to see if anyone has done what I need already (hey, I’m a busy man and don’t have time to reinvent every wheel), besides the WOW factor of some of those demo’s is just so high I get all geeked out by it. Thankfully I found Eric Martin’s wonderful Simple Modal plug-in which allowed me to put together a nice mashup of the HTML and “pop-ups”.
You can grab the source code for that mashup by clicking download below (you’ll need 7-zip to open it).
SharePoint for the Win!
Interesting article on the top 10 intranet’s of 2008 of which 5 are based SharePoint. The section on how of the 10 from 2007, they were built using 41 products while last year only 26 products. I definitely see the fact tools are getting better and better is a key factor to this and VS 2010 should improve this for SharePoint even more.
Read the article at http://www.useit.com/alertbox/intranet_design.html
Thanks to @mysharepoint for the heads up.
Tripping over logs: A story of Unity - Part 6
Intro
The final post in the series :) Get the code here, read comments on unit testing with DI, thanks, references and further reading!
This is a multi-part series as such here is the series guide in case you are looking for the rest of the series:
- Part 1 - Introduction to the problem
- Part 2 - Changing the code to use basic unity functions
- Part 3 - Life time management
- Part 4 - Changing the code to use interception
- Part 5 - Interception supplementary
- Part 6 (your are here) - Wrap up
This is just a final post to wrap up the series, you really should use the above links to get the actual value out of it.
Download the Final Code
You will need 7-Zip to open it.
My view on Unit Testing with DI
What excited me about DI initially is that it makes testing and in particular unit testing, so much better. The problem faced with any system you want to test is that if it is tightly coupled you can’t unit test, you can only do integration testing. By following DI, you are forced into a loosely coupled architecture which means that you can very easily test your individual components.
Let me give you a real world story on this, which involved the enterprise system I mentioned in the very first post. It read from system A, did processing and wrote to system B. The fact it was tightly coupled meant that I couldn’t even fake a message into the system, I had to generate real messages in system A and watch the flow of those messages. After a long time I dropped MSMQ between system A, the processing and system B to enable me to fake messages but even then it wasn’t great as I needed to re-write so much code to talk to these new interfaces. Lastly the processing took many hours to run to completion so proper end to end testing took days, and if a crash occurred certain processes needed to be started from scratch again.
If I had used DI for the system the first thing I could’ve done is written up two mock interfaces and swopped with real ones out using the config. This would mean I could simulate messages simply. System B was in fact MSCRM which I couldn’t run on my machine (laptop running Windows XP at the time) so being able to mock the interface to it could’ve meant that I could’ve worked on the processing engine without MSCRM being needed (i.e. a VM or server).
Next the tightly coupling of methods meant that the process had to run it’s time, but if I had implemented DI I would have each of the individual components of the processing separated out and would be able to have tested them individually. Yes, end to end processing would still be needed but I could’ve saved days of testing with this.
I haven’t actually done enough to write a post on this specific topic, so maybe once I have done more I will be more sure or maybe I will just tell you I was wrong.
Thanks, References and Further Reading
First off thanks to you, the reader, for spending time on this series and I hope you drop me a mail/@rmaclean/comment if this has helped you or you have any questions.
That said I could not have done with without a great posts I found on this subject - so here is my references:
- http://codebetter.com/blogs/david.hayden/archive/2008/11/07/unity-and-aop-example.aspx
- http://www.pnpguidance.net/post/UnityInterceptionExtensionExampleTransparentProxyPolicyInjectorHandlerAttributeICallHandler.aspx
- http://www.pnpguidance.net/post/TransparentProxyInterceptorUnityInterceptionExtensionExampleUnity12.aspx
- http://wolfbyte-net.blogspot.com/2008/11/unity-v12-now-with-method-interception.html
- http://www.pnpguidance.net/Post/StructureMapTutorialDependencyInjectionIoCNET.aspx
- http://www.nventive.net/Blog2/2008/11/28/InterceptionWithUnityPart4.aspx (actually the whole series but part 4 was the best)
- http://weblogs.asp.net/podwysocki/archive/2008/03/27/ioc-and-unity-configuration-changes-for-the-better.aspx
- http://dotnethitman.spaces.live.com/blog/cns!E149A8B1E1C25B14!267.entry?wa=wsignin1.0&sa=566808602
Note that Unity is an implementation of this, there is a lot of them out there. Scott Hanselman has a list at http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx
Lastly I could not end this series without a link to the definitive theory on DI, by Martin “wolfman” Fowler - Inversion of Control Containers and the Dependency Injection pattern. This is a must read for everyone.
The other must read is Jacob Proffitt (http://theruntime.com/blogs/jacob/Default.aspx) who is a .NET expert/guru etc… but is not a fan of DI. The reality check you will get from him should help balance the DI fan-boy crowds out.