Posts

Lessons from a 20 year-old web app

After I read " Why billing systems are a nightmare for engineers ", I thought it would be fun to write about my own experience. Specifically lessons I've learned from building and supporting a 20 year old (and counting) "ERP" web app. But first, let me explain a bit how this came to be. The web app is a general ledger, project management, inventory management, HR, and general " ERP " system (including billing, invoicing, foreign currency purchases, etc.) for 20-30 users at a small interior finishing supplies company which my grandfather founded. It has been used every day for at least 20 years. Building iteratively for years My Dad decided to give me a chance at building software for the family business before I was out of high school. I had shown an aptitude for programming and was making good money with friends building local websites. He built a COBOL system for the family business when he was my age, so the legacy was passed on to me (which I am ve

Done button on iOS NumberPad with Xamarin

Image
There are a ton of potential solutions on the Internet for adding a Done button to a NumberPad-type of UITextField on iOS.  Unfortunately most of them are old, use custom images or even require iterating through sub views to find the target keyboard. Below is a solution -- using Xamarin -- to add a Done button without fear of index-out-of-bound exceptions or using out-dated custom images. The trick is using the WeakInputDelegate of the UITextField & adding a custom button to that. A full working project is available on github . public override void ViewDidLoad () { base.ViewDidLoad (); // Your stuff NSNotificationCenter.DefaultCenter.AddObserver ("UIKeyboardWillShowNotification", KeyboardWillShow); } public void KeyboardWillShow(NSNotification notification) { var doneButton = new UIButton (UIButtonType.Custom); doneButton.Frame = new RectangleF (0, 163, 106, 53); doneButton.SetTitle ("DONE", UIControlState.Normal); do

Xamarin .xib Tree Hierarchy Cleanup

Image
Another annoyance with Xamarin Studio is when adding a new iPhone View Controller and the csproj's hierarchy is different than what you'd expect (or what is used in the mobile-samples ). So I whipped up another Python script to save me some time & appease my obsessiveness. Let's add a new iPhone View Controller simply called "MainMenu"... Notice how the tree hierarchy has the .designer.cs file nested underneath the controller .cs file -- and the .xib file is completely independent. Now let's run xamarin_tree_clean.py available at  https://gist.github.com/xeb/5907008 And when we head back over to Xamarin Studio, it will automatically reload the project file & our tree hierarchy will be clean again.

Switch Xamarin Studio to Xcode5 for iOS 7.0 Development (and back)

Image
I enjoy using Xamarin .  I also want to play with the Xcode5 Developer Preview . But sometimes I want to switch back & forth between Xcode5 and Xcode4.  Why?  Because of this: That's the message you'll get in Xamarin if you use Xcode5-DP.  So I hacked out a quick Python script to help me switch back & forth in my project. It's simple enough to just be worthy of a Gist.  See: xamarin_switch.py at https://gist.github.com/xeb/5890019 . Use it within the directory of the solution & csproj that you are working with.  Then just run the script & specify which verison of Xcode you want.  (Either a 4 or a 5 or "xcode4" or "xcode5"). Example: Again thats.... xamarin_switch.py xcode4 To go to Xcode4 + iOS 5.1/6.0/etc. and xamarin_switch.py xcode5 To go to Xcode5-DP + iOS 7.0 This did three things: Changed the SDK Location of Xamarin Studio Changed the first CSPROJ file to the correct iOS Build version Launched Xamar

Unconventional Technical Leadership

I just finished reading David Byttow's Effective Technical Leadership post.  There are some unsaid ideas that he did not present that I wanted to share.  But first... Why listen to me?  I'm a Lead Software Engineer at a large video game developer ( google me ).  I've stopped posting to this blog since joining the company as a Software Engineer in 2010.  But in 2 years, I've been promoted 3 times and now lead a team that develops a massive amount of live operation.  I will get called at 3am if something breaks.  Or is too slow.  There is no one above me that has more technical knowledge of the systems I work on.  Once its escalated to me -- I have to fix it.  If something happens 1-in-a-million times in our codebase, it may happen 100 times a day. It is not easy  keeping people productive, effective & reliable in a medium sized team.  Below are some random bits of advice I can offer after spending a decade creating large scale systems and leading a wide variet

Applying WebInvoke without an Attribute

Haven't posted in a long time but thought I'd post this bit of WCF extensibility I was working on at home. There is nothing on the Internet about how to do this & I felt I should figure something out. Scenario: You have legacy WCF services that you want to switch to a WebHttpBinding w/ JSON but don't want to update 1,337 service contracts to include a WebInvoke attribute, UriTemplates and Request/Response Body Types In this scenario I'll be assuming use of IIS and Windows Process Activation Services to host your service. The WebInvokeAttribute implements IOperationBehavior. So what we need to do is somewhere in the WCF stack apply this operation behavior programmatically to our Endpoint's Contract.Operations. Let's start from the bottom up & take a look at an extension method that does this. /// <summary> /// Automatically applies the Web Invoke behavior to all operations in the collection /// </summary> /// <param name="operatio

MapReduce in C# using Task Parallel Library

Back in August I starting playing with a C# implementation of Google's MapReduce algorithm. The implementation was based on something Stephan Brenner did, although I completely refactored it. Today I added a little bit of logic to split up the actual execution of Map & Reduce in this implementation using the Task Parallel Library in .NET 4.0. Check out the source code for MapReduce in C# on GitHub. Below is an excerpt from the Tests on how to implement the library. Counting Words in Files public static List<KeyValuePair<string, int>> Map(FileInfo document, string text) { var items = text.Split('\n', ' ', '.', ',','\r'); return items.Select(item => new KeyValuePair<string, int>(item, 1)).ToList(); } public static List<int> Reduce(string word, List<int> wordCounts) { if (wordCounts == null) return null; var result = new List<int> { 0 }; foreach (var value in wordC