An AJI Software Community
BLOGGER LIST

(1304, 11/07/2009) 
(1268, 11/05/2009) 
(1111, 11/07/2009) 
(851, 10/15/2009) 
(756, 7/06/2009) 
(676, 10/19/2009) 
(638, 11/02/2009) 
(615, 10/02/2009) 
(570, 11/05/2009) 
(555, 9/16/2009) 
(526, 11/02/2009) 
(472, 10/21/2009) 
(431, 10/16/2009) 
(403, 10/19/2009) 
(398, 10/17/2009) 
(391, 11/02/2009) 
(384, 9/26/2009) 
(378, 11/07/2009) 
(367, 9/18/2009) 
(353, 11/03/2009) 
(305, 11/05/2009) 
(304, 11/06/2009) 
(292, 11/04/2009) 
(258, 11/04/2009) 
(257, 10/31/2009) 
(253, 11/05/2009) 
(248, 10/02/2009) 
(243, 10/22/2009) 
(234, 10/28/2009) 
(223, 6/24/2009) 
(211, 11/02/2009) 
(202, 10/28/2009) 
(199, 10/25/2009) 
(197, 10/19/2009) 
(196, 6/03/2009) 
(191, 11/06/2009) 
(190, 10/29/2009) 
(186, 11/07/2009) 
(178, 11/06/2009) 
(170, 9/24/2009) 
(165, 6/15/2009) 
(165, 11/06/2009) 
(164, 10/01/2009) 
(161, 9/08/2009) 
(152, 8/27/2009) 
(143, 10/26/2009) 
(142, 7/10/2009) 
(140, 11/04/2009) 
(140, 11/04/2009) 
(139, 11/04/2009) 
(138, 11/03/2009) 
(136, 11/02/2009) 
(133, 6/18/2009) 
(132, 9/29/2009) 
(131, 10/19/2009) 
(125, 7/02/2009) 
(125, 7/23/2009) 
(125, 10/28/2009) 
(124, 11/06/2009) 
(124, 8/31/2009) 
(123, 10/18/2009) 
(120, 7/19/2009) 
(119, 7/01/2009) 
(112, 9/29/2009) 
(110, 5/26/2009) 
(110, 11/02/2009) 
(108, 11/05/2009) 
(107, 9/09/2009) 
(106, 10/20/2009) 
(105, 11/06/2009) 
(105, 8/06/2009) 
(104, 11/07/2009) 
(101, 10/15/2009) 
(99, 10/23/2009) 
(98, 6/05/2009) 
(97, 8/18/2009) 
(96, 10/28/2009) 
(95, 10/11/2009) 
(94, 10/22/2009) 
(93, 8/06/2009) 
(92, 10/22/2009) 
(92, 11/02/2009) 
(90, 10/19/2009) 
(84, 11/01/2009) 
(84, 5/21/2009) 
(80, 6/24/2009) 
(80, 11/05/2009) 
(77, 8/07/2009) 
(75, 8/12/2009) 
(75, 10/28/2009) 
(74, 5/20/2009) 
(72, 10/26/2009) 
(71, 11/03/2009) 
(70, 11/07/2009) 
(70, 11/04/2009) 
(70, 10/04/2009) 
(67, 10/20/2009) 
(66, 11/03/2009) 
(66, 11/05/2009) 
(64, 8/27/2009) 
(64, 9/22/2009) 
(63, 9/09/2009) 
(63, 10/22/2009) 
(62, 8/13/2009) 
(62, 11/06/2009) 
(60, 9/22/2009) 
(59, 10/20/2009) 
(58, 5/14/2009) 
(57, 10/27/2009) 
(57, 10/01/2009) 
(56, 10/14/2009) 
(56, 5/20/2009) 
(54, 11/02/2009) 
(52, 9/16/2009) 
(52, 8/20/2009) 
(51, 11/04/2009) 
(51, 5/28/2009) 
(51, 10/22/2009) 
(51, 8/19/2009) 
(51, 8/24/2009) 
(51, 11/01/2009) 
(50, 5/12/2009) 
(49, 10/21/2009) 
(49, 11/05/2009) 
(48, 10/13/2009) 
(47, 11/06/2009) 
(47, 6/16/2009) 
(47, 11/01/2009) 
(46, 11/06/2009) 
(44, 11/02/2009) 
(44, 7/08/2009) 
(44, 8/07/2009) 
(43, 10/19/2009) 
(43, 10/19/2009) 
(43, 11/07/2009) 
(43, 9/12/2009) 
(42, 10/23/2009) 
(42, 11/05/2009) 
(41, 8/17/2009) 
(40, 10/07/2009) 
(40, 11/08/2009) 
(39, 5/17/2009) 
(39, 10/15/2009) 
(39, 11/05/2009) 
(38, 9/26/2009) 
(38, 8/06/2009) 
(38, 9/16/2009) 
(37, 11/06/2009) 
(37, 7/21/2009) 
(36, 5/22/2009) 
(36, 10/15/2009) 
(36, 11/05/2009) 
(35, 8/14/2009) 
(34, 10/30/2009) 
(33, 6/04/2009) 
(32, 11/04/2009) 
(32, 8/25/2009) 
(32, 9/04/2009) 
(32, 8/27/2009) 
(31, 9/21/2009) 
(30, 6/18/2009) 
(30, 10/12/2009) 
(30, 11/02/2009) 
(29, 10/21/2009) 
(29, 10/17/2009) 
(28, 9/02/2009) 
(28, 11/02/2009) 
(28, 11/07/2009) 
(27, 11/04/2009) 
(27, 10/14/2009) 
(27, 10/30/2009) 
(27, 9/07/2009) 
(27, 10/09/2009) 
(26, 8/28/2009) 
(26, 10/18/2009) 
(26, 9/21/2009) 
(26, 10/25/2009) 
(25, 10/30/2009) 
(25, 10/15/2009) 
(25, 6/25/2009) 
(25, 9/24/2009) 
(25, 7/23/2009) 
(25, 10/31/2009) 
(24, 10/16/2009) 
(24, 7/30/2009) 
(24, 9/04/2009) 
(24, 10/13/2009) 
(24, 10/28/2009) 
(24, 8/19/2009) 
(24, 8/31/2009) 
(23, 10/19/2009) 
(23, 6/30/2009) 
(22, 11/02/2009) 
(22, 10/08/2009) 
(21, 10/19/2009) 
(21, 9/26/2009) 
(21, 7/31/2009) 
(21, 5/14/2009) 
(21, 10/23/2009) 
(21, 10/20/2009) 
(21, 10/29/2009) 
(21, 11/08/2009) 
(20, 11/06/2009) 
(20, 10/19/2009) 
(20, 10/03/2009) 
(20, 10/03/2009) 
(19, 6/01/2009) 
(19, 8/29/2009) 
(19, 10/05/2009) 
(19, 8/19/2009) 
(18, 10/25/2009) 
(18, 7/11/2009) 
(18, 9/12/2009) 
(18, 10/07/2009) 
(18, 10/01/2009) 
(17, 9/28/2009) 
(17, 8/04/2009) 
(17, 9/30/2009) 
(17, 7/08/2009) 
(17, 10/07/2009) 
(17, 10/05/2009) 
(16, 10/28/2009) 
(16, 7/27/2009) 
(16, 9/26/2009) 
(16, 10/25/2009) 
(16, 10/27/2009) 
(16, 7/08/2009) 
(16, 8/28/2009) 
(16, 8/04/2009) 
(16, 6/19/2009) 
(16, 7/13/2009) 
(15, 11/05/2009) 
(15, 8/19/2009) 
(15, 10/02/2009) 
(15, 8/11/2009) 
(15, 8/11/2009) 
(15, 11/05/2009) 
(14, 9/17/2009) 
(14, 5/12/2009) 
(14, 10/26/2009) 
(14, 9/10/2009) 
(14, 10/23/2009) 
(14, 9/27/2009) 
(14, 10/17/2009) 
(14, 10/19/2009) 
(14, 9/01/2009) 
(13, 9/04/2009) 
(13, 9/24/2009) 
(13, 6/30/2009) 
(13, 10/29/2009) 
(13, 10/20/2009) 
(13, 11/05/2009) 
(13, 8/19/2009) 
(13, 9/06/2009) 
(13, 8/04/2009) 
(13, 7/16/2009) 
(13, 9/14/2009) 
(13, 10/08/2009) 
(12, 8/21/2009) 
(12, 10/29/2009) 
(12, 6/25/2009) 
(12, 9/22/2009) 
(12, 7/01/2009) 
(12, 10/01/2009) 
(12, 11/05/2009) 
(12, 7/21/2009) 
(12, 8/21/2009) 
(12, 11/06/2009) 
(11, 10/11/2009) 
(11, 5/27/2009) 
(11, 10/11/2009) 
(11, 10/08/2009) 
(11, 10/20/2009) 
(11, 8/12/2009) 
(11, 11/03/2009) 
(11, 10/22/2009) 
(11, 7/06/2009) 
(11, 10/05/2009) 
(11, 6/18/2009) 
(11, 10/09/2009) 
(11, 10/14/2009) 
(10, 10/19/2009) 
(10, 7/07/2009) 
(10, 7/18/2009) 
(10, 7/21/2009) 
(10, 10/30/2009) 
(10, 11/07/2009) 
(10, 10/29/2009) 
(10, 10/22/2009) 
(10, 10/19/2009) 
(10, 10/11/2009) 
(10, 10/17/2009) 
(10, 6/29/2009) 
(10, 9/24/2009) 
(10, 10/29/2009) 
(9, 10/27/2009) 
(9, 8/21/2009) 
(9, 8/13/2009) 
(9, 7/31/2009) 
(9, 10/12/2009) 
(9, 11/05/2009) 
(9, 10/02/2009) 
(9, 9/04/2009) 
(9, 10/09/2009) 
(9, 10/13/2009) 
(9, 8/20/2009) 
(8, 10/26/2009) 
(8, 9/23/2009) 
(8, 11/07/2009) 
(8, 10/28/2009) 
(8, 7/30/2009) 
(8, 8/04/2009) 
(8, 9/24/2009) 
(8, 5/12/2009) 
(8, 11/04/2009) 
(8, 11/05/2009) 
(8, 9/02/2009) 
(8, 5/15/2009) 
(8, 9/04/2009) 
(8, 9/08/2009) 
(8, 8/26/2009) 
(7, 7/10/2009) 
(7, 7/19/2009) 
(7, 7/20/2009) 
(7, 9/03/2009) 
(7, 8/28/2009) 
(7, 10/27/2009) 
(7, 8/24/2009) 
(7, 8/10/2009) 
(7, 8/13/2009) 
(7, 10/23/2009) 
(7, 7/27/2009) 
(6, 10/24/2009) 
(6, 5/19/2009) 
(6, 6/05/2009) 
(6, 6/20/2009) 
(6, 10/28/2009) 
(6, 10/21/2009) 
(6, 10/30/2009) 
(6, 7/03/2009) 
(6, 11/02/2009) 
(6, 5/26/2009) 
(6, 5/10/2009) 
(6, 8/13/2009) 
(6, 5/14/2009) 
(5, 9/09/2009) 
(5, 9/09/2009) 
(5, 7/01/2009) 
(5, 10/18/2009) 
(5, 8/17/2009) 
(5, 10/20/2009) 
(5, 10/06/2009) 
(5, 6/10/2009) 
(5, 8/26/2009) 
(5, 10/01/2009) 
(5, 10/18/2009) 
(5, 10/09/2009) 
(5, 6/26/2009) 
(5, 9/12/2009) 
(5, 7/09/2009) 
(5, 6/07/2009) 
(4, 10/08/2009) 
(4, 7/27/2009) 
(4, 8/12/2009) 
(4, 7/08/2009) 
(4, 5/29/2009) 
(4, 7/08/2009) 
(4, 9/24/2009) 
(4, 6/21/2009) 
(4, 5/26/2009) 
(4, 8/14/2009) 
(4, 8/10/2009) 
(4, 8/31/2009) 
(4, 10/27/2009) 
(4, 10/13/2009) 
(4, 11/03/2009) 
(4, 11/05/2009) 
(4, 5/17/2009) 
(4, 7/24/2009) 
(3, 9/09/2009) 
(3, 9/23/2009) 
(3, 7/01/2009) 
(3, 6/09/2009) 
(3, 7/29/2009) 
(3, 9/26/2009) 
(3, 5/25/2009) 
(3, 11/06/2009) 
(3, 11/06/2009) 
(3, 10/27/2009) 
(3, 10/30/2009) 
(3, 11/03/2009) 
(3, 10/29/2009) 
(3, 7/18/2009) 
(3, 7/22/2009) 
(3, 10/06/2009) 
(3, 11/05/2009) 
(3, 7/19/2009) 
(3, 7/15/2009) 
(3, 10/03/2009) 
(3, 7/20/2009) 
(3, 10/16/2009) 
(3, 7/04/2009) 
(3, 6/15/2009) 
(3, 10/06/2009) 
(3, 7/23/2009) 
(2, 5/24/2009) 
(2, 7/17/2009) 
(2, 8/21/2009) 
(2, 6/24/2009) 
(2, 9/10/2009) 
(2, 6/19/2009) 
(2, 8/13/2009) 
(2, 7/29/2009) 
(2, 7/05/2009) 
(2, 10/04/2009) 
(2, 6/23/2009) 
(2, 8/23/2009) 
(2, 7/30/2009) 
(2, 10/03/2009) 
(2, 9/03/2009) 
(2, 8/14/2009) 
(2, 9/25/2009) 
(2, 10/15/2009) 
(2, 10/24/2009) 
(2, 10/12/2009) 
(2, 10/27/2009) 
(2, 11/07/2009) 
(2, 11/05/2009) 
(2, 11/06/2009) 
(2, 9/27/2009) 
(2, 8/19/2009) 
(2, 9/25/2009) 
(1, 11/02/2009) 
(1, 11/07/2009) 
(1, 11/06/2009) 
(1, 11/01/2009) 
(1, 10/30/2009) 
(1, 11/05/2009) 
(1, 10/20/2009) 
(1, 10/07/2009) 
(1, 9/16/2009) 
(1, 9/15/2009) 
(1, 9/04/2009) 
(1, 9/01/2009) 
(1, 8/17/2009) 
(1, 8/21/2009) 
(1, 9/04/2009) 
(1, 10/28/2009) 
(1, 7/21/2009) 
(1, 7/23/2009) 
(1, 8/03/2009) 
(1, 9/03/2009) 
(1, 8/11/2009) 
(1, 9/16/2009) 
(1, 7/27/2009) 
(1, 8/04/2009) 
(1, 6/19/2009) 
(1, 7/06/2009) 
(1, 7/02/2009) 
(1, 7/01/2009) 
(1, 5/28/2009) 
(1, 6/15/2009) 
(1, 6/03/2009) 
(1, 5/28/2009) 
(1, 5/28/2009) 
(1, 6/20/2009) 
(1, 6/20/2009) 
(1, 5/15/2009) 
(1, 6/10/2009) 
(1, 8/27/2009) 
(1, 6/22/2009) 
Tag | .NET Posts

As far as I have seen content controls in Office 2007 render to either a SdtRun or SdtBlock object. The nice thing is that both of these inherit from SdtElement. This allows you to take the query from my earlier post and replace SdtBlock with SdtElement and now you have a universal retrieval. Of course as with any tool you need to be careful you don’t take it too far. Depending on the structure of you document this may not do what you need. Technorati Tags: office Open XML,OOXML,LINQ,.NET...
If you are using a template document and replacing text programmatically using the Office Open XML SDK 2 API you will need a way to identify the target to be replaced. One option is to use a Content Control and setting the tag value the same for all of the controls that need to be substituted with a single value. After some trial and error and a lot of digging through the DocumentReflector I came up with the following LINQ query to get a list of all blocks with the same tag name. var blocks = from...
While I was planning to write about the same topic and have the draft ready in my Windows Live Writer waiting to complete, I found an interesting question in StackOVerflow and couldn’t just resist to answer: ORM/Persistence layer Advice The question starts with: I'm starting a new project and I'm looking around for either a very good ORM or for a non-SQL-based persistence layer. Then follows up with a REALLY GOOD summary of what he believes about each known ORM he knew out of his own findings and...
We have scheduled for a .NET Usergroup meeting next week on the 30th October 2009. I arranged with our training department and they have agreed to ensure that we have the room, support in resources including a laptop, projector and anything else which may be necessary. Happy days! They have also guaranteed that we can have the room each month on the last Friday. I had been in communication with Craig Murphy, who took up my tweet and made it his task to see how we can get helped in making this possible...
It took a bit for me to get comfortable enough with LINQ-to-objects to write ‘queries’ off the top of my head…but once you’re used to it you realize it’s much more concise, easier to interpret/read, and well..it’s less code. Here are some real quick examples… This first example selects the string array value as well as its position from the someItems array. Note, the user of new{} creates a new generic type that has the properties ItemName and Position. I could have called these two properties whatever...
I recently had the need to set the output path of the log files at runtime in log4net. For some reason up until now I had never attempted to accomplish this. As corporate permissions are more and more restrictive I found the need to set the FileAppender.File path at runtime to a location within the users profile. It turns out accomplishing this task is quite simple. public static void Initialize(string logDirectory) { //get the current logging repository for this application ILoggerRepository repository...
.NET University has a variety of presentations available for download, including code examples and videos. Use the materials to learn or to present at your next DNUG meeting ;) The presentations cover a variety of different topics, so if you’ve already got a presentation planned and you just want to compare, be sure to check’em out. All the popular topics like Silverlight, WPF, WCF, LINQ, and ASP.NET MVC are covered. Instant presentations, just add presenter. http://www.dotnet-u.com Technorati Tags:...
Today I took on the challenge of improving the performance of a set of repository retrieval methods that have been a bottleneck for our system for the past week. Here were the requirements and details for the most challenging method: There is a Clinic and a Service table with a joining table for the many-to-many relationship, ClinicService. A clinic provides one to many services and a service can be provided by one to many clinics. The method accepts in a list of primary key integer values for the...
Download and install owc11. Run AxImp on OWC11.dll, which will have been installed in the microsoft shared\web components directory (ie C:\Program Files\Common Files\microsoft shared\Web Components\11\). AxImp.exe can be found in the Windows SDK (ie, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\AxImp.exe). In Visual Studio project, drag OWC11.dll to a toolbox tab and drop the Excel component on form. Voila. When it comes deployment time, you’ll need the AxInterop.OWC11.dll. Some sample code:...
Just a quick tip that I found handy while doing some writing yesterday; chances are if you’ve played with LINQ you probably wrote something like this… var outputString = from s in inputString where s.Length > 1 select s; //Do some stuff with outputString in your method... Code like the above will work perfectly well if what you’re going to work with your implicit variable, outputString, within the body of the same method. But, as it stands, you can’t return outputString, or any implicit variable...
It has been a long time coming and I was finally able to find a diamond in the rough by locating a wrapper for the “challenging” yet powerful Lists.asmx service provided by WSS 3.0. On my current project we had the need to interact with WSS to pull back some document templates that reside in a document library. It only made sense for the implementation of this repository to use Lists.asmx or interact with a custom service that uses the SharePoint object model. I figured by now someone had created...
This was originally an email I sent to .NET team in my company, then decided to share as a blog post. The problem: Let’s say you have a complex application, and this application (or part of it) runs very slowly. No bug s in results, no errors or exceptions, but it just so slow! Now you want to know which part of your code is the reason, which method(s) you need to go and modify., which methods take so long to execute or consume so much memory/CPU. How would you know that? Let’s say you want to improve...
This past week I was reminded of the “fun” in which hosting an application within SharePoint can present. We are developing a custom application for our client in which some areas must reside within a SharePoint environment. We did quite a bit of our development in this first iteration within a web application in order to pull things together and present the client with a working end-to-end “prototype.” The architecture is composed of several layers all of which will be “in process” communications...
Emad Ashi (@splashup on twitter) interviewed me in the 5th episode of his first Arabic podcast series DotNetArabi to talk about Object Relational Mapping in .NET in Arabic. Podcast Page: Mohamed Meligy Talking about ORMs (MP3 Direct Download) السلام عليكم أصدقائي العرب ممن يتابعون هذه المدونة.. يسعدني أن أعلن عن أول حديث لي على الانترنت - و كذلك أول حديث لي على الانترنت بالعربية، عن الـ Object Relational Mappers – ORMs شكرا جزيلا لـ “عماد العشي” (splashup@ على تويتر) على استضافته لي في موقع “دوت...
That MS decided to totally blow it up in .NET 4.0. (weblogs.asp.net link, S/O link). Yes, that’s right, they are totally re-writing WF 4.0 from the ground-up. As the first link states, this could be for any number of reasons including lack of adoption and the perception that WF is just too complex – which I happen to agree with. 3.0/3.5 workflows will still work, but only on the 3.0 runtime. On the one hand, I have to give some credit to MS for basically saying “Hey guys, we effed up and we’re gonna...
Over the past week I have been reading the new book Silverlight 3 Programmer's Referencefrom Wrox and I have found it one of the best books on Silverlight I have seen in a good while. It is concise without being boring and it provides a wealth of information on Silverlight 3. And it is in Colour! I never would have thought that this would make such a difference, I don’t really know why I thought this as I hate looking at code in notepad, but it makes it much easier to read the code pages, both c#/vb...
I had previously created a Command Line Parser from Ray Hayes codeproject article Automatic Command Line Parsing in C#. I had adapted it to VB.NET and upgraded it to .NET 3.5 but I recently ran into the problem with wanting a single command prompt application to handle multiple processes and multiple parameters. This would allow you to group all of a particular tasks commands into a single application. With the advent of Power Shell this format is increasingly less relevant, but with the proliferation...
We found that in some cases you need to consider using Uri.EscapeDataString. In our case we are encrypting the querystring and found that UrlDecode is converting a plus (+) to space. This was causing us errors during decryption. Using Uri’s Escape and UnescapeDataString makes sense for us when constructing a custom querystring in the URL. Here are some details from another blogger… http://blog.nerdbank.net/2009/05/uriescapedatapath-and.html Technorati Tags: .NET,ASP.NET...
I am always pulling out the Unity assemblies. Maybe it is just because I am lazy, but I really can’t be bothered rolling my own dependency injection and mapping framework! I am going to use Unity only as a mapping frame work for now, I want to be able to pass an Interface into a method, and get back the correct data access class. The plan is to meet the diagram on the left. Only the factory and the interfaces are accessible, but are all set to “friend” which will require an assembly tag to be added...
I am not sure if this is a good idea, but I was bored one day and decided to add a TFS Error Log provider for Elmah. There are 2 ways you can do this. You can create a new WorkItem type and log an error report for each of the errors or you can create one work item for each error type/title. To do this you can create a title that is the combination of error message and application name and then search TFS for an existing work item. If it exists then add the error to it, if it does not then create...
Allow me to quote here some emails I sent to the the Dot NET developers group in my company, Injazat, or, as we call ourselves, Ninjazat. I thought it’ll be useful to share some with you as well. · ASP.NET MVC - 20 Hours of FREE Video Tutorials · LINQ FAQ o LINQ FAQ for Newbie’s o LINQ FAQ Part 2 · How we handle application configuration · ScottGu ASPNETMVC Session Video Available Now (Part 1/2 & 2/2) · Web Validation: Best Practices and Tutorials · Building a Single Sign On Provider Using ASPNET...
Have you ever tried to implicitly cast a larger data type into a smaller type (as far as the number of bits) through a plain old assignment? c# wont let you do it! In this case the long’s value of 5 will definitely fit into an int but the compiler will still give you a no-no. Its avoiding possibly dropping some of the 64 bits when assigning the value to 32 bits. Not to worry, you can always do the explicit cast. int myInt; long myLong = 5; myInt = (int)myLong; This lets the compiler know that you...
Recently I have been doing some work on an older system using ADODB recordsets. Every now and then we still have to support these old systems. I wanted to create an open recordset in code on the .NET side to pass to the older system, but ADODB really wants an open database connection in order to open a recordset. My first obvious attempt was to create the recordset object, then create the field objects and add them to the recordset. I could create the recordset this way, but I couldn't open it, and...
Antonio Chagoury, VB MVP, has constructed a list of Twitter accounts for VB MVPs, VB Team members, and others who are influential in the VB.NET community on his personal blog, CTO v2.0. This list has many great people who are not only talented in VB, but also who have great talents in many aspects of the .NET framework. I’m listed as a VB MVP, but if you don’t want the full list you can still check me out at http://twitter.com/svickn. However, I’d recommend checking out the rest of these guys too,...
I was going to put this on twitter but it’s a bit longer to tweet. Last week I shared some videos on Google Reader and twitter from Microsoft’s MSDN Chopsticks video website. If you don’t know it, it’s a VERY nice videos website with much content on very interesting topics and very recent products as well as different experience levels of content. http://www.microsoft.com/belux/msdn/nl/chopsticks/ Today, some other friends on twitter noticed the Chopsticks site and were wondering why it doesn’t allow...
While I was building the position heuristic function for Connect Four I ran into an interesting gotcha with F# pattern matching. Lets see if you see it before I tell you what it is: let rec heuristic (positions: (int * int) list) (pos: int*int) = match positions with | [] -> 0 | position::_ -> 1 + (heuristic (List.tl positions) pos) | _ -> heuristic (List.tl positions) pos Looking at it, it seems the code should tell me how often value is in position, right? Well it doesn’t! And there is...
I ran into some rather interesting numbers while trying to optimize my Connect Four implementation. Try to guess what this code will print out: let test= let stop1 = Stopwatch.StartNew() let list = [1..1000000] let bla = list |> List.fold (fun state x -> state + x) 0 stop1.Stop() let stop2 = Stopwatch.StartNew() let seq = seq{1..1000000} |> Seq.fold (fun state x -> state + x) 0 stop2.Stop() let stop3 = Stopwatch.StartNew() let arr = [|1..1000000|] let arr1 = arr|> Array.fold (fun state...
Last time we saw how to implement the basic miniMax algorithm, this time we will continue by designing game board representation. Basically I want to start out with the “simplest thing that might possibly work” and optimize from there. The simplest thing to use for this in F# is a 2 dimensional list. The problem is that we get some really bad performance for random access into them, because unlike C# Lists, called ResizeArray in F#, they really are represented by lists internally. To be precise they...
Ok, so do you have any idea what happens when you evaluate this? printfn "%d" -Int32.MinValue;; Well I would have guessed I´d get Int32.MaxValue, but well I was wrong. Actually it overflows again and prints Int32.MinValue. Interesting behavior that drove me mad while i was trying to implement Alpha-Beta pruning. There is a simple reason this happens: “The Int32 value type represents signed integers with values ranging from negative 2,147,483,648 through positive 2,147,483,647.” – MSDN Ok so there...
Lately there has been a lot of buzz about functional programming, mostly because it is supposed to be the cure to all of our concurrency troubles. The answer to this from MS has been to productize F#, a functional, object oriented language, running on .Net . There have been a lot of great blog posts and articles about F# in the internet, so if you are looking for a basic introduction this is not really the place. This series is supposed to fill in the whole i saw while searching for F# content. It...
Coding would be the right answer I guess, but more about that later. I will be starting out this blog with a totally useless post just to try out the GWB blogging software, so if you are reading this spare yourself the pain... Other then that I will soon start with a series on F# programming and hope to continue bringing in some .Net content. Cheers to you all and please don't flame a new blogger to much;) Technorati Tags: .Net,F#,FSharp...
1. Introduction This posting is a continuation from the previous post on Managed Extensibility Framework (MEF). If you are a new to MEF you will need to visit the MEF blog at Codeplex or Glenn’s Blog here. You will need to download the framework so you can also find out how it leverages the power of extensibility into your applications. In the previous post I showed how you can quickly create a MEF application and use the attributes to import and export different parts, and use the container to compose...
This is the first posting on MEF, in which I will be explaining some things that I discovered while playing around with MEF. I should say that all the postings on my blog, including this subject do not represent my employer or any other organization, they are merely my mumblings based on my work that I do and whatever in find interesting and would like to share. Use it at your own risk, but it works on my machine. To start with I would like you to read about the architecture of the MEF framework...
IMPORTANT UPDATE There was a sudden last-minutes issue with the transportation / flights configuration that prevented me from making it to Cairo. I’ll be unfortunately missing out this event. M. Smay my friend will be a great backup with all the additional details he has to provide about his session content as well as an open session for the convenience of all of you. Sorry for missing out. I had to. I’m working with dotNETwork to re-organize my session as part of June 2009 gathering, but this is...
Here are some screen shots from VS2010 Beta. The first thing I noticed is that Team Explorer is (finally) installed with the base install. The new look has an Expression-Blendy feel to it… Also, I noticed that it defaults to a single tool bar line at the top. Nice! VS2010 Welcome Screen Home Screen Projects Tab Visual Studio Tab New Project Dialog Box Open XAML Document with common windows open Technorati Tags: Visual Studio 2010,.NET...
A friend recently asked how do you make a call to a web page via code. For example, the web page might be designed to return some data in a text-based format and filtered by query string parameters. (While this is more commonly done using a web service, it can also be accomplished by controlling the output of the HttpResponse object.) The following is a basic demonstration of how you might go about coding this in Visual C#: 1: /// <summary> 2: /// Makes a request to a Uniform Resource Identifier...
The third Iowa Code Camp was another first-class event. Those guys do a fantastic job every time. It is a tradition at Iowa Code Camp to intersperse pictures of cows randomly throughout your slide deck. On my way to the event, I made a quick stop at Greg Wilson’s house. Greg has cows, and had used a marking spray from the vet to write on three of his cows: I was scheduled to do one session on WPF data binding as part of a three-part series with Bryan Sampica and Greg Wilson. Just as I was settling...
Technorati Tags: .NET I recently ran into this issue when I tried to connect to an Microsoft Access database with a .NET application I had written. In case you’ve ran into this issue on a .NET client application and you’re running on x64 you may need to change the Platform Target to x86 on the build tab your project properties in Visual Studio. This will force your application to run in 32 bit mode. IIRC MS has not and does not intend to build a 64 bit version of the OLEDB drivers which is what the...
On May 8 the ugMIX Event is coming to Minneapolis. This will be a special presentation of the highlights from MIX, followed by the main attraction… A private screening of the new Star Trek movie!! I can’t wait! this is turning out to be geek heaven for any .NET developer. See you there! Technorati Tags: .NET,MIX,StartTrek...
I have previously talked about code contracts in .NET 4.0, and while .NET 4.0 isn’t out yet you can work with them now in Visual Studio 2008 through MSDN DevLabs. In case you aren’t familiar with code contracts in .NET, this is a feature that was actually built by the .NET CLR team to provide a language-agnostic way to express code assumptions in the form of pre-conditions, post-conditions, and object invariants. There are currently two tools provided: Runtime Checking, which uses a binary rewriter...
On my latest project, I needed to come up with a Business and Data layer(s) with the following requirements: 1) They wanted to use a code generation tool to automatically generate the classes whenever the database (which was still under development) changed 2) The business objects would basically mirror the database tables 3) I had a couple of days to deliver. Michael Eaton suggested using Castle Active Record (which uses NHibernate). I found some Active Record templates for CodeSmith, and within...
I asked my first question on stackoverflow today. I want to make sure I’m unsubscribing from PropertyChanged events properly. Please head over and put in your two cents. Technorati Tags: PropertyChanged,.NET,StackOverflow...
I ran into the same old "cannot serialize value myType of type myType" issue the other day and knew immediately that I should check that my classes were marked with the [Serializable] attribute. Well, I checked and all of the classes had the attribute as required. So I spent an hour our so searching the web for other reasons why we might get this error. I found nothing. So I pinged a buddy of mine and I walked him through the issue. He said, "It's gotta be one of your classes missing the Serializable...
I was working on some Stream extensions today and added a method which will read all of the data from a stream in to a byte array. Some of the classes which derive from Stream provide a similar method (MemoryStream, for example, provides a GetBuffer() method to do this). The drawback here is that the base Stream class doesn’t provide an abstract GetBuffer() method; instead it’s up to each individual derived class to implement such a method. This is perfectly reasonable as a stream may not have an...
1. Introduction This is a follow-up to the "An attribute based approach to business object validation" article in which i introduced the use attributes and reflection to validate business objects. I also promised to write another article on data converters and method based validators, and here it is. 2. Background In this article i will use an example to show how you can validate your business object using a method based attribute and how you can convert data assigned to properties when it is saved...
1. Introduction This article shows how you can use attributes to validate your business objects. You may have had to write tones of code to validate your business objects without taking advantage of attributes. The value of attributes comes when you need to apply the same rules on a number of properties and the only thing you have to do is to decorate your property accordingly. For other articles on attribute based validation please check the Visual Studio Magazine and Ennis Ray Lynch, Jr. 2. Background...
Recently, I ran into a problem where I needed to cast from an unknown type to a known type. Normally this would be fine as I a generic cast. For example... 1 public static T ValueOf<T>( this OracleCommand command, string parameterName ) 2 { 3 return (T)command.Parameters[parameterName].Value; 4 } The parameter of course returns an object and I wanted to streamline the parameter value lookup process. All was well until I started using ODP.Net (instead of Microsofts OracleClient). With the OracleClient,...
I present at a lot of the local Florida code camps (and some out of state ones as well) and have a presentation that focuses on understanding Lambda expressions in .NET. This is not an exhaustive list, but it is a subset of the books, articles, blogs, and presentations that I used to form the content of my presentation. Books Essential C# 3.0: For .NET Framework 3.5 (2nd Edition) (Microsoft .Net Development Series) (Paperback) (Mark Michaelis) The C# Programming Language (3rd Edition) (Microsoft...
Developer Express, the makers of CodeRush, have teamed up with Microsoft to make a scaled down version available for free called CodeRush Xpress. This is exclusively for C# developers working in Visual Studio 2008 and includes a selection of hand-picked features from CodeRush and Refactor! Pro. A few important things to point out are that CodeRush Xpress: does not support the Visual Studio Express Editions cannot be installed side-by-side with other CodeRush or Refactor! editions There are about...
I took the certification exam for 70-528 - Web-based Client Development recently and passed it with a score of 785. Passing score is 700. I prepared from the "MCTS Self-Paced Training Kit (Exam 70-528): Microsoft® .NET Framework 2.0—Web-based Client Development" book. So I am a MCTS now. I am think of whether to take 70-529 Distributed applications or whether to become a MCPD. Technorati Tags: MCTS,70-528,.Net,Microsoft...