Monthly Archives

April 2012

Apple Push Notifications Certificates and IIS

By | iOS | No Comments

Last week I found myself debugging an issue with Apple Push Notifications service (APNs) on one of our development servers, and learning a bit about APNs certificates and Windows Server 2008 R2 with IIS 7.5 in the process.   My first task was to try to isolate why the push notifications weren’t received by our iOS devices, so I started on my local development machine.  I installed the certificates into my personal certificate store, stepped through the notification code, and sure enough I heard my iPad chirping telling me the notifications were being received.  It turned out that the certificates…

Read More

Congratulations to NimblePros and Telerik!

By | News | No Comments

On April 25th 2012, Telerik announced the acquisition of their first Enterprise level Service company, NimblePros.  The press release can be read here. We are very excited for our friends at NimblePros and Telerik and wish to congratulate them and wish them well on this initiative to increase the level of in-house support for Telerik’s enterprise level customers.   With the tremendous success Telerik has been enjoying worldwide and phenomenal growth, selling the products was not enough for major Fortune 500 companies everywhere that require a solid commitment and hand holding for architecture advice as well as implementation tips and…

Read More

The Truth About JavaScript

By | JavaScript | No Comments

Update:  For more information, we’ve released a full JavaScript development guide: JavaScript Nuts and Bolts, and are teaching a class explaining how to use JavaScript, KendoUI and ASP.NET MVC in Telerik’s Sitefinity CMS. Sign up for Foundations of Sitefinity 5.1. JavaScript variables have inherent Boolean values (typically referred to as “truthy” and “falsy”). Interpreting these values can lead to semantic train wrecks like those in this snippet:   1: console.log(“any string” == true); // false 2: console.log(“any string” == false); // also false 3: console.log(“” == false); // true 4: console.log(null == undefined); // true 5: console.log(NaN == NaN); // false   Let’s…

Read More

Falafel Releases Sitefinity 5 Nuts & Bolts

By | .NET, Sitefinity, Web | No Comments

Today, Falafel Software, the premier Consulting & Training company for Sitefinity worldwide, released a new version of its book “Sitefinity 5 Nuts & Bolts”.   The book is released for FREE for ALL of our current Sitefinity 4 Nuts & Bolts’ customers.  Just log into your account and download the new 5.0 book. For all new customers purchasing the new Sitefinity 5.0 book, you will receive the 4.0 book as well plus all the source code for all the samples, modules and widgets. Get your copy today and start enjoying the new Sitefinity 5 product while discovering many many new…

Read More

JavaScript Scope and “Hoisting”

By | Uncategorized | No Comments

It’s best practice to declare all variables at the top of functions. Why? In JavaScript, a variable can be used before it is defined. JavaScript automatically hoists every var declaration to the top of the function. Take a look at this example where variable “volume” is declared after its used in a logging statement: function playTune(){         console.log(“Volume is ” + volume);     var volume = 1; }    playTune(); // outputs “Volume is undefined” The log prints “Volume is undefined”, exactly the behavior you’d expect for a declared, but uninitialized variable. While the declaration is moved to the top, the variable…

Read More

Silverlight DateTime Format on Mac

By | Silverlight | No Comments

The Problem I recently discovered that the default Silverlight DateTime format is different on MacOS than it is in Windows.   On Windows   On MacOS   There are a couple of differences, but the most noticeable is that time zone offset at the end of the time that shows on the Mac. On my computer the time zone offset shows as “-4:00” because I’m generating a DateTime in local time, which for me is currently Eastern Daylight Time (EDT), or 4 hours behind Coordinated Universal Time (UTC).   The application is following the best practice of storing all DateTimes…

Read More

Exceptions–The Silent Performance Killer

By | Uncategorized | No Comments

You’ve probably heard it before: “Exceptions are expensive!” Maybe if you’re like me, you heard it but you didn’t believe it, not really. How bad could they be? Well, I was recently forced face-to-face with the reality of this saying, and I’m here to tell you, exceptions are expensive! In my case, I was using a generic helper method that called Convert.ChangeType(). This method can throw, among other things, a FormatException if the input object is not in a format that can be converted to the requested type. Unfortunately, this particular class does not provide a way to check whether…

Read More

Writing a RegEx That Matches Strings Containing the Same Word Using a Zero-Width Negative Lookahead Assertion

By | Uncategorized | No Comments

I know, that title was a mouthful. Today I was posed with the challenge of writing a regular expression that would match an input that repeated the same word multiple times. Of course, it’s easy to write a regular expression that returns multiple matches of a single word, but it’s a little more challenging to write one that matches only once. Here is the sample input string we’re going to work with: “Just keep swimming. Just keep swimming. Just keep swimming, swimming, swimming.” The repeated word is “swimming”, and we only want to match inputs that repeat it 5 times…

Read More

Creating a Passive Silverlight Busy Control

By | Uncategorized | No Comments

There are some instances where the the obstructive Silverlight Toolkit BusyIndicator might not be the right choice for your application. BusyIndicator pops up a control on top of all other controls that shows a message and a graphical animation. I wanted to create a more passive control that doesn’t pop up a control but it still disables all the controls on the page and shows a message on the page. First I started by creating a User Control. Within this control I added a TextBlock and an Image that I’ll use to set some busy text and an animated image….

Read More

Using log4net with Multi-Project Solutions

By | .NET, ASP.NET, Tools | 2 Comments

log4net is a proven and simple means of enabling logging in your .NET application.  There are lots of resources available to walk you through the standard setup process, but I will give some steps for more advanced scenarios with multiple projects in a .NET solution. One Config File, Multiple Projects  In most circumstances, it is nice to be able to share a global log4net configuration file for all of the projects in your solution.  This way, you can make changes in one place and the next time you build, it will take effect for all logging in your project. To start,…

Read More

Silverlight MVVM Simple and Easy

By | C#, MVVM, Silverlight | No Comments

MVVM (Model-View-View Model) is a programming pattern similar to MVC that you can use to decouple the model and the view from business logic. There are many articles on the internet about what MVVM is so I’m not going to talk about that. In this article I want to concentrate on the most basic MVVM application, understanding it, and how to move on from there. This example doesn’t have a Model. More than likely when building even the simplest application you will need access to data. If you create an Entity Framework (ADO.NET Entity Data) Model, this would indeed be…

Read More

Why are my WCF REST call object properties null?

By | Uncategorized | No Comments

Here is a little cross platform gotcha that might save you some time, it certainly has bitten my colleagues a few times…. If you have a .NET WCF REST service, then it will by default use the DataContractSerializer. Now, imagine you have an iOS, Android or maybe a HTML client, calling that API with a JSON payload (or an XML payload), and hand constructing the HTTP payload. On the server (receiving) side, you see that some of your object properties are NULL, even though you can clearly see them being sent in Fiddler. You double check the spelling and capitalization…

Read More

Tools and Tips to Aid Regular Expression Development

By | Uncategorized | No Comments

Regular Expressions are a super powerful, widely available, high performance way to parse text into useful parts for further processing or validation. However, developing them can be difficult because the syntax is terse and difficult to read (resulting in the commonly repeated joke that regular expressions are write-only), and Visual Studio does not come with any built-in tools to aid in testing and developing them. I am going to share a tool and a few pieces of advice that I have found useful in my own development efforts in the hopes that they will be of use to others out…

Read More

Regular Expression Matches, Groups, and Captures Explained

By | Uncategorized | No Comments

When working with regular expressions, you will quickly come across these terms. Matches are usually easy to understand, but Groups and Captures can be a bit trickier to understand. I’m going to explain them with a simple and concrete example. Let’s start with this regular expression pattern: (?<AreaCode>d{3})-(?<Triplet>d{3})-(?<Quadruplet>d{4})   We’ll run it against this text: 555-867-5309. We’ll get back one Match containing several Groups, each Group having one Capture. A Match represents one complete, successful match between the regular expression pattern and the input text. In this case, the match is the complete text. However, if we were to run…

Read More

Falafel Blogs on Sitefinity 5 Released

By | Sitefinity | One Comment

Today, we are proud to announce that the final bits of the conversion of blog.falafel.com are finally in place and the blog site is better and faster than ever.  The final issue that stumped us for the last 10 days was the inability to use LiveWriter to publish blog posts to Sitefinity 5.  After serious GUID debugging, Fiddler and Wireshark sessions, we were able to pin point that the conversion from Sitefinity 3.7 to 5.0 caused a problem regarding the assignment of ONE of the Blogs (MINE ) as far as owner assignment between the OpenAccess37MembershipProvider and the Default one…

Read More

Mac Keyboard Guide for Windows Programmers

By | iOS | No Comments

What I’m Up To This week, I’m learning iOS development after 13 years of programming on the Microsoft stack (primarily .NET). Developing for iOS requires a computer running MacOS, which in turn requires a Mac (ignoring the rather iffy option of running a Hackintosh). I first learned to program on two Apple computers–BASIC on an Apple IIe and C++ on a Mac LC. It’s been many years since those machines were on my desk, and my regular Mac use has been a bit spotty since then. As a result, I’m having to refamiliarize myself with some of the little differences…

Read More

C# Parameter Instantiated Inside Method but Not Returned

By | C# | No Comments

I was working with a client recently when I encountered a completely unexpected bug. Figuring out the problem reminded me of some facts about how C# (and all the .NET languages) work and got me thinking about the fact that object-type variables in .NET are basically pointers, even though it’s hidden from you most of the time. The Problem An object instance was passed into a method. If the parameter was not null, it was simply updated, but if the parameter was null, then it was instantiated first, then updated. It looked something like this: class Widget {     public string…

Read More

Setup Apache Tomcat 6 to Run as a Service

By | Tomcat | No Comments

Recently I had the task of getting an Apache Tomcat installation working on a windows machine as a service. By following the documentation that is available on the internet I tried several techniques including the service.bat and Tomcat6.exe the service. There are tons of options available to install the service and unfortunately almost all of them are necessary. Installing the service over and over to get it running was turning out to be quite time consuming until I found the Tomcat6w.exe. The Tomcat6w.exe is a graphical editing tool for any installed Tomcat service. The fastest way i found to get…

Read More