Tech in the 603, The Granite State Hacker

Url for WSDL coming back with wrong Host name in WCF service

Here’s something I don’t want to forget…  working on a WCF Service…

Using TLS, the address of the wsdl didn’t match what was in the SSL certificate.  (the server certificate had the FQDN “friendly name” (host.domain.com), and I was just getting back the “host” name. 

Naturally, this was causing problems. 

There was lots of guidance about setting the host name using some old vbs script that turned out to be a red-herring for IIS 7, anyway.

The quick & simple solution was to add in the behavior for the service:

<system.serviceModel>

    <behaviors>
      <serviceBehaviors>
        <behavior>
          <useRequestHeadersForMetadataAddress />
          <!– To avoid disclosing metadata information,

          set the value below to false and remove the metadata

               endpoint above before deployment –>
          <serviceMetadata httpGetEnabled=false httpsGetEnabled=true  />
          <!– To receive exception details in faults for debugging purposes,

          set the value below to true.  Set to false before deployment

          to avoid disclosing exception information –>
          <serviceDebug includeExceptionDetailInFaults=True />
        behavior>
      serviceBehaviors>
    behaviors>

  system.serviceModel>
configuration>

Tech in the 603, The Granite State Hacker

My Favorite “Non-Apps” for Windows Phone 7

There’s a lot of cool stuff built in the current Windows Phone 7… stuff that competing phones need to download an App for.  These are features of the Windows Phone operating system that are built-in.  You could call it “An App for That”, but it’s not something a Windows Phone user needs to spend time to find, download, and install.   (There’s something to be said that you get your choice from dozens of them on iOS and Droid.  I wonder how much time iPhone users spend figuring out which ones work well for them and which ones don’t…?)  

People Hub is one of the best.  It’s so well integrated and natural that it’s easy to take for granted. (the fact that all your contacts from all your social media hubs and work contact lists are integrated by default, and you can group and manage communications among groups very easily… hard imagine not having that.)

Some of my favorite lesser known “Non-Apps” in Windows Phone involve the built in search functionality.  Hitting the handy magnifying glass that’s an identifying feature of every Windows Phone out there brings you to Bing Search.  While I’ve been an admittedly slow adopter for Bing, the features in Windows Phone’s Bing Search are awesome.  

Visual Search just rocks.  Tapping the icon that looks like an eye from the search page fires up the device’s camera.  Simply point the camera in the direction of nearly *any* common, standardized barcode or QR code.   As soon as the phone “sees” the code, it will highlight it and immediately try to identify it. 

At Trader Joes, and want to know a bit more about their uncrystalized candied ginger?  Scan the UPC code.  It will remind you that the small package contains about 8 servings, [so don’t eat it all at once!]  🙂   Chances are just about anything you find at any store will have a barcode, QR code, or even an MS Tag associated with it.  

My favorite use for Tags, by the way, is printing Tags associated with your virtual Card on the back of classic Business Cards…  scan the Tag, and all the info on the card can be imported into your phone!  I never give out my card unless it’s Tagged. 

Tags can get really fancy, by the way… sometimes they’re almost hidden, and, especially out of context, it might take a moment for a human to recognize (but your phone will pick it out instantly!).  There’s a very creative cottage industry popping up around the art of Tagging things.  Exemplified by this Angry Birds Tag by Extreme2D.com. (Facebook) (and visit their site for an array of other very creative Tags!)

Visual Search does a whole slew of other awesome stuff too..  visual text identification (and TRANSLATION to foreign languages!)

Another favorite Windows Phone “Non-App” is Audio Search.  Let’s just say this is how I discover most of the music I download.  Ever out & about and hear a song that you are really taken by, but have no idea who it is?   Simply hit the music note icon in search, and let the phone listen for a moment. 

I heard the 2011 remaster of Pink Floyd’s The Wall, doing cuts I’d never heard before on someone’s radio not too long ago.  It was such a fresh cut that I didn’t even believe it was actually Pink Floyd’s recording of their own song.   Upon hitting it on Audio Search, I found the tune, and the album, and immediately downloaded the whole thing!   Awesome stuff!

So this doesn’t even really scratch the surface of the stuff that you don’t need an App for with Windows Phone.   It’s like that old spaghetti sauce commercial…  “It’s in there!”

What are your favorite built in (#NonApp) Windows Phone features?

.

Tech in the 603, The Granite State Hacker

Project to Help Feed Starved Kids – Jimmy Sudoku v4

UPDATE Feb 6, 2014:  http://granitestatehacker.kataire.com/2014/02/jimmy-sudoku-5-orange-edition.html

Click here to view in the Windows Phone App Marketplace.  (the app is ‘free’ with the $5 donation via purchase.  All proceeds go to #NoKidHungry.)

I’ve had a lot of fun learning the quirks of Silverlight for WP7 devices, and after playing with some of the other WP7 Sudoku’s out there, I’m very glad to have Sudoku done my way on my phone again. 🙂  I’m even more psyched that I can share my app with others, as it’s now Certified by Microsoft and available on the Windows Phone App Marketplace!

I have to admit… there’s a lot of competition out there for Sudoku’s on WP7 devices, and probably not a huge demand… I realize that for as much fun as I had polishing this app,  probably the best way to find its value is to “give it away”.  

Scan this Tag with your Windows Phone to find Jimmy Sudoku
Scan this Tag
with your phone to find
Jimmy Sudoku
in the
Windows Phone
App Marketplace

So my family & I considered some options and decided on a national organization that helps feed under-fed/malnourished children here in the US. I thought it was a fitting thing… building software is my strength, and this is a way I can share it.   I also can think back to some exceptionally lean times when I was a kid… memories I’d love to help avert for others if any way possible.  So, yes, all proceeds from paid downloads will be donated to that cause.

I finally had a chance to re-do the old .NET 2.5 Compact Framework-based app as a Silverlight 4 app for Windows Phone. I’ve been toying with this release for months (since November 2011, actually… I pulled down Visual Studio Express 2010 for Windows Phones around then, anyway).  

In case you’re wondering… I asked the charity if it was ok to use their name and maybe a logo or something, but out of respect for their other national-market beneficiaries who have already done this, I would have to also guarantee a sizable donation.  100% is the best I can do, but that’s not necessarily a sizable donation, so I can’t use any trademarked IP, which, as I understand it, includes their name.  (I’m glad I asked.  🙂    While I can’t do this now, I’m hoping that if I play by the rules and manage to make a decent contribution with it, that I’ll earn the privilege and kick the project up a notch.  (In the meantime, I wonder if the twitter hashtag #NoKidHungry counts…. )

You can also click here on just about any device to get to the Marketplace site.


Finally, please visit the Facebook Page, and feel free to Like and/or Share posts to help spread the word!  🙂

Anything you can do to help is appreciated!

Tech in the 603, The Granite State Hacker

Choen the counterBot

I’m pretty excited… both my kids seem interested in computers and what you can do with them. My daughter, especially, is very interested in learning bits and pieces about programming. My son is interested, but not so much in the nuts & bolts of programming. He is interested in numbers and performance, though. They’re both young, though… he’s in 1st grade, and she’s in 2nd.

She’s expressed some interest in programming before. Last time we talked about application design… she got extremely ambitious and drew about twenty pages of “designs” (hand-drawn mock-ups of screens) for games that she wanted to create. (Essentially knock-offs of games she’s played on favorite websites like PBS Kids and Pixie Hollow.)

More recently, she was using my computer, and discovered that when she’s logged into my computer on her account, she has access to Visual Studio Express. When she asked what it was, I told her it was tools to write programs, and she just lit up. Immediately, she wanted to start working on a simple UI that mimics a math program she uses at school.

I started to realize, however, that she needs to learn more of the basics before we dive into a full fledged user interface. I started to think about some of the earliest programs I learned to write.

Back when I was in 4th grade, I got my hands on an Apple II, and one of the first programs I learned to write on it was a program that accepted two numbers (start and finish) and simply scrolled out a count between them.

Nowadays, we have object oriented programming, and C#, but I wanted to try to keep it simple and understandable for her. I decided that we would create a “counter-bot” class, and we would create an instance of it named whatever she wanted it to be named (She decided on Choen (pronounced more like Cohen)).

Today, we got the basics of the counterBot class written, and wrote a short program to create an instance of it, initialize it, and start counting, sending the numbers out to the screen. A countBot has beginAt, finishAt, countBy properties, and Start, Count, GetCurrentNumber and isFinished commands.

Here’s the code:
counterBot.cs:
——————————————————–


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Choen_the_counterBot
{
class counterBot
{
public int beginAt;
public int finishAt;
public int countBy = 1;
private int currentNumber;

public void Start()
{
currentNumber = beginAt;
}

public int GetCurrentNumber()
{
return currentNumber;
}

public void Count()
{
currentNumber = currentNumber + countBy;
}

public bool isFinished()
{
bool result=false;
if (currentNumber > finishAt)
{
result = true;
}
return result;
}

}
}

——————————————————–

and here’s the console Main method in program.cs:
——————————————————–


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Choen_the_counterBot
{
class Program
{
static void Main(string[] args)
{
counterBot Choen = new counterBot();
Choen.beginAt = 0;
Choen.finishAt = 2000000;

Choen.Start();
DateTime startTime = DateTime.Now;

while (!Choen.isFinished())
{
Console.WriteLine(Choen.GetCurrentNumber());
Choen.Count();
}

Console.WriteLine("Finished counting from "
+ Choen.beginAt.ToString()
+ " to "
+ Choen.finishAt.ToString()
+ " by "
+ Choen.countBy
+ "'s in "
+ (DateTime.Now - startTime)
.Seconds.ToString()
+ " seconds!");

Console.ReadKey();
}
}
}

——————————————————–

I got a bit fancy and added the timer code to see how long it took. Together, my son, daughter, and I watched Choen the counterBot count out various scenarios, and got as ambitious as watching it count from zero to two million. In order to get my son’s interest, I added the timer to see how long it took. We discovered that my computer can count from zero to two million, “out loud” (showing the numbers on the screen) in 52 seconds. If we hid the console writes, it could do it in less than a second.

Next time we play with it, we’ll write a graphic UI (a windows form) and hook Choen the counter bot up to it.

Tech in the 603, The Granite State Hacker

Anonymous Form Submission to Form Library with InfoPath in MOSS

Here’s a bit of a trick I ran across while helping to develop some MOSS2007 solutions.

I needed to configure InfoPath so that it could submit documents to a site that the submitter would not be able to access. In SharePoint, this is not directly possible.

A common work-around is to set up incoming email for the target list, and submit by email to that. Unfortunately, my client is part-way through a Notes to Exchange migration, so this wasn’t practical in the given time frame.

The solution… create two sites, one that is accessible to the submitter, and the other that is not. On the accessible site, create a new, “hidden” list that the user can submit to. Add an event receiver to that list, such that whenever a new item is added, the item is moved to the real intended target using elevated privileges.

Using VSeWSS extensions, create a List Definition project that has something like this in the ItemEventReciever.cs file:

 

using System;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using VSeWSS;

namespace AutoForwardingFormLibrary
{
[CLSCompliant(false)]
[TargetList("38aea319-af78-4489-9059-d124c68bf9fe")]
[Guid("9d0f139b-d9ed-4b6c-b0ba-2353cb3bad85")]
public class AutoForwardingFormLibraryItemEventReceiver : SPItemEventReceiver
{
private SPListItem addedItem = null;

///
/// Initializes a new instance of the Microsoft.SharePoint.SPItemEventReceiver class.
///

public AutoForwardingFormLibraryItemEventReceiver()
{
}

///
/// Asynchronous after event that occurs after a new item has been added to its containing object.
///

///
/// A Microsoft.SharePoint.SPItemEventProperties object that represents properties of the event handler.
///
public override void ItemAdded(SPItemEventProperties properties)
{
addedItem = properties.ListItem;
if (addedItem == null)
{
throw new ArgumentNullException("properties.ListItem");
}
SPSecurity.CodeToRunElevated moveItem = moveItem_Elevated;
SPSecurity.RunWithElevatedPrivileges(moveItem_Elevated);
}

private void moveItem_Elevated()
{
addedItem.CopyTo(SPUrlUtility.CombineUrl("http://targetserver/sites/jimw/docs/formlibrary", addedItem.Name));
addedItem.Delete();
}
}
}


Tech in the 603, The Granite State Hacker

The Great Commandment

While I was writing a post the other day, I noticed that I had neglected a topic that I find very important in software development. Risk management.

There are only a few guarantees in life. One of them is risk. Companies profit by seizing the opportunities that risks afford. Of course, they suffer loss by incidents of unmitigated risks. All our government and social systems are devices of risk management. In business, risk management is (now, and ever shall be) the great commandment.

Many software engineers forget that risk management is not just for PM’s. In fact, software and its development is fundamentally a tool of business, and, by extension, risk management. The practice of risk management in software really extends in to every expression in every line of source code.

Don’t believe me? Think of it this way… If it wasn’t a risk, it would be implemented as hardware. I’ve often heard hardware engineers say that anything that can be done in software can be done in hardware, and it will run faster. Usually, if a solution is some of the following…
· mature,
· ubiquitous,
· standard,
· well-known,
· fundamentally integral to its working environment

…it is probably low risk, particularly for change. It can likely be cost-effectively cast in stone (or silicone). (And there are plenty of examples of that… It’s what ASIC’s are all about.)

Software, on the other hand, is not usually so much of any of those things. Typically, it involves solutions which are…
· proprietary,
· highly customized,
· integration points,
· inconsistently deployed,
· relatively complex / error-prone
· immature or still evolving

These are all risk indicators for change. I don’t care what IT guys say… software is much easier to change than logic gates on silicone.

I’ve dug in to this in the past, and will dig in more on this in future posts, but when I refer to the “great commandment”, this is what I mean.

Tech in the 603, The Granite State Hacker

Retail IT in the Enterprise

Lately, the projects I’ve been on have had me taking on roles outside my comfort zone. (I’m not talking about downtown-Boston… with the “Boston Express” out of Nashua, I’m ok with that.)

I’ve always been most comfortable, myself, in cross-discipline engineering roles, especially in smaller teams where everyone’s got good cross-discipline experience. The communications overhead is low. The integration friction is low. Everyone knows how it needs to be done, and people are busy building rather than negotiating aggressively.

These types of tight, focused teams have always had business focused folks who took on the role of principal consultant. In this type of situation, the principal consultant provides an insulation boundary between the technical team and the customer.

This insulation has made me comfortable in that “zone”: I’m a technologist. I eat, sleep, dream software development. I take the ability to communicate complex technical concepts with my peers effectively and concisely, very seriously.

So like I said, lately the projects I’ve been on have yanked me pretty hard out of that zone. I’ve been called on to communicate directly with my customers. I’ve been handling item-level projects, and it’s a different world. There is no insulation. I’m filling all my technical roles, plus doing light BA and even PM duty.

Somewhat recently, I emailed a solution description to a CFO. The response: “Send this again in user-level English.”

It killed me.

I’ve gotten so used to having others “protect” me from this sort of non-technical blunder. In contemporary projects, the insulating consulting roles are simply not present.

Makes me wonder about the most important lessons I learned during my school days… In high school days, maybe it was retail courtesy, and retail salesmanship in a technical atmosphere (“Radio Shack 101”). In college days, the key lessons might have been how to courteously negotiate customer experience levels, (from “help desk 101”).