by Jason Williams
31. December 2011 16:31
In the first part of this post, I discussed REST and how it compares to SOAP-based services. In this part, we’ll figure out how to create a REST service with WCF and what it takes to start thinking in a “RESTful” way when designing a REST service.
More...
by Jason Williams
28. December 2011 17:09
SOAP and REST Compared
REST services are the new “hotness.” All of the cool kids are doing them. I (not that cool of a kid) feel as though I’ve been left behind -- holding onto my SOAP messages like an old curmudgeon holding on to his last dollar. After all, SOAP-based services have served me well; all the way back to the .ASMX days. So, I’m the first to admit that traditional (SOAP-based) web services still have a place. They are extraordinarily easy to use, nowadays, because the tooling around them is so polished. On top of that, I can’t think of a platform that doesn’t support them, today.
More...
by Jason Williams
12. October 2011 16:41
Visual Studio LightSwitch is a relatively new development tool from Microsoft that allows a developer to quickly create database-driven, Silverlight applications. While I won’t give you the full sales pitch in this post – since it is my first post on LightSwitch, I should at least mention that you can find more information here
We’ll take a look at setting control properties from code-behind. Specifically, we’ll see how we might store some settings in a database table, read them, and apply them to a control.
More...
by jason
28. August 2011 03:36
I’m looking for several people to help me beta-test a LightSwitch extension. The extension allows you to capture an image from your webcam and save it directly to a screen in LightSwitch. I’m planning to sell the extension for a small fee, but if you are one of the beta testers, you will get it for free.
If you think you can help, please use the menu on this site to contact me and I’ll get you setup with access to the extension.
Thanks!
by jason
11. April 2011 00:34
Recently, I was asked which gets called first: the Application_Launching, Application_Activated, Application_Deactivated, and Application_Closing events or the page-specific OnNavigatedTo and OnNavigatedFrom overrides. It turns out, the answer is – both.
When the application first runs from the start screen, Application_Launching gets called first. Then, the page-specific OnNavigatedTo gets called.
When navigating back to the start screen (by pressing the start button), the page-specific OnNavigatedFrom override gets called and then the Application_Deactivated event gets fired.
When navigating back to the app (using the back button), the Application_Activated fires first, and then the page’s OnNavigatedTo override gets hit.
So, the rule of thumb seems to be, if you are on a page, that page’s overrides will be called first. If you are entering the app from elsewhere, the Application events will fire first. Now you (and I) know!
by jason
5. April 2011 23:29
When writing a Windows Phone 7 application in Silverlight, you will find a property on every TextBox control called “InputScope.” The primary use of this property is to alter the way the Software Input Panel (SIP or on-screen keyboard) works. Depending on what you set its value to, the SIP will include certain character sets, auto-complete features, and can auto-capitalize phrases and words for you. There’s no question you should be using this built-in feature. However, sometimes it’s hard to remember what each value of the InputScopeNameValue Enumeration actually does.
As it turns out, Microsoft lists only 10 modes the SIP can be put into. Below, you will find a screenshot of each and a list of the InputScope values associated with each.
More...
by jason
26. August 2010 04:36
I had a great time speaking at the “Super Laptop Meeting” last night. My 20-minute talk was “Best Practices for Custom WF Activities.” I even won the grand prize, so thanks to all of you that voted for me!
If you are interested in the slides and the demo I showed, you can download them by clicking here. If you want to know more about the Lincoln .NET Users Group, you can do so at http://www.lincolndev.net
by jason
10. June 2010 17:27
If you are even a little bit familiar with the Model-View-View Model pattern and its implementation in WPF, you have probably run into the ItemsControl control. Actually, even if you haven’t used MVVM, you may have used it. Somewhat like the Repeater control in ASP.NET, this control allows you to bind to a data source and do something in XAML for each of the items in that data source. In any case, let’s play around with the ItemsControl element in WPF a little bit.
More...
by jason
29. March 2010 12:14
Recently, I was writing a report that selected some data out of a normalized SQL Server database. For one of the queries, I needed a “flattened” form of the rows in one of the tables. In essence, what I needed to do was turn several rows of data into a single column.
More...
by jason
3. February 2010 13:16
I recently ran into a situation that has come up plenty of times for plenty of people. I had an array of integers and I needed to figure out if any of the numbers were in the array more than once.
A variety of solutions ran through my head: sorting, looping, searching, etc. However, LINQ seemed like the most elegant solution. Here’s what I finally settled on:
var duplicates = activityIds.GroupBy(g => g)
.Where(w => w.Count() > 1)
.Select(s => s.Key);
if (duplicates.Count() > 0)
{
errorMessage = "You may only register for a particular activity once";
return false;
}
The first line simply groups the integers by their value. The second and third lines find and select every integer that appears in the array more than once (Count() > 1). In my case, I just needed to know if there were any duplicates, but you can see how you could easily list the duplicated values by iterating over the “duplicates” variable.
This same method can be used to find duplicates across any LINQ to objects – compatible collection and I’ll certainly be using it more in the future.