C# As Attack


Get a plan!

Posted in General by billupton on January 23, 2010

Here’s one of my favorite quotes: 

“The trouble with most people is that they think with their hopes or fears or wishes rather than with their minds.” - Will Durant

So true. So often we move forward entirely convinced that we need a particular  outcome to happen in our careers or lives but do not devote that same energy and passion towards the steps for making that happen.  You can see it most blatently in politics these days where the politicians are convinced they must be seen as the champions of a particular cause but have little or no understanding of the kind of plan that will make it happen.  They can’t even remember the history of last year let alone the economics of Stalin’s time for example.  My hope for the next election cycle is that we put people in office who are committed to a plan for success that is based on the historically proven principles of the past. 

“A goal without a plan is merely a wish.” – Antoine de Saint Exupéry

Folks, the power of the plan is all around us. Take These Guys for example, New York Task Force One. They have a plan. They practice the plan and they practice being successful.  Look at the results (click the picture):

When we are passionate about successful outcomes we need to #1) have a proven plan and #2) be passionate about it.  It works!  CLICK HERE TO SEE THE VIDEO

Architecting WPF Apps: Model-View-ViewModel

Posted in Application Development, Technical by billupton on January 19, 2010

This is an older blog post but I came across it recently. Here’s a cool video demo for some best practices for creating apps in WPF. Specifically it shows the paradigm of using the Model-View-ViewModel (M-V-VM) pattern to help improve the managibility, readability, reusability, and testability of the components of your enterprise caliber app:  http://blog.lab49.com/archives/2650

Here’s another blog which John Gossman (One of the MS’ WPF architects) calls an excellent introduction to M-V-VM:
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx  This is a newer article and comes complete with an example project download…enjoy!

Comments Off

AVATAR: Go See It But Read This First

Posted in Personal by billupton on January 1, 2010

I just got done seeing the movie Avatar in 3D IMAX. Overall I liked it (which is good considering the price – $14.75). I believe you’ll feel as I do after seeing it that the craft of creating movies has taken another leap forward. The awesome visuals would make me recommend that anyone go see it.

The downside however is that their ability to tell the story overshadows the story itself. I’m not saying the visuals should be toned down. I’m saying that, with visuals that good, they might want to find a story worthy of being told. Before I enumerate some of the problems I have with the ridiculous story I remind you – I liked the movie. Go see it. You’ll like it too. The flying around in 3D didn’t bother me at all. I loved it and, although I’m usually prone to motion sickness, I was unaffected.

My main beef is that the story involves silly earth worship. Nature actually makes a poor god. In the movie, the main character actually states humans killed their “mother earth” and are now doomed to live on their own “dead” world.  Just for the record, any god that is killable isn’t a god at all (as my wife says). In the movie’s world called Pandora a simple bulldozer is apparently enough to threaten the existence of the god of the natives.  In fact there are several lame political notions that the Avatar story is promoting. Here are a few:

  • man is bad / natives good
  • military people are good for nothing and are only happy if they are killing
  • given the oppotunity, man would rather kill now to make $5 than negotiate to make $100 a week from now
  • corporations and money are evil
  • man needs to return to the pure (stoneage) days where we are all exacly equal in our loin cloths

If you buy into any of this idiocy, try to forget that only a multi-million dollar corporation could create a film like this and, of course, try to forget it was done for profit alone. http://www.firstshowing.net/2009/11/24/fox-chairman-has-no-doubt-that-avatar-will-make-a-profit/ 

One scene that really bothered me was that a human killing to save himself was deemed evil but natives that kill with compassion for food (natives that whisper into the dying animal’s ear “I’m returning you to mother nature”)- they are deemed good!  This story is a complete load of crap.  Its unfortunate that some people might start to believe this junk.

Having said all that, ignore the mother earth garbage and go see it! The integration of reality and animation is seamless and the environment is just visually stunning. To see beings interacting and flying around within that beauty I was wowed!

Comments Off

Foodie Blog

Posted in General, Personal by billupton on August 22, 2009

Just FYI, I got my foodie blog going here: http://demowss.insource.com/restaurantBlog/default.aspx

We were just showing some out-of-the-box things (like blogging) that WSS can do when it got out of hand.

Searching Google From C#

Posted in Application Development, Technical by billupton on August 6, 2009

We have a client that may be needing this soon and, since the old way of calling a Google search web service is going away, I thought I would throw together a class that performs the work in the new manner which is to use the Google AJAX Search API. Make sure you follow their terms which are more limiting than before.

First of all, the new API uses REST to invoke the search and returns the results as JSON. So there would be a couple more things to learn. However I’ve used a JSON library I’ve found on CodeProject that makes things easy: http://www.codeproject.com/KB/recipes/JSON.aspx (Thanks Andy Kernahan).  I added this project to a solution that will be referenced by two new classes I’ve written – a GoogleResults class for doing the search and a class for each single result called GoogleResult (singular). I won’t go into the single result class here since it just exposes the data returned by the search as an object with properties.

My GoogleResults class has one static method called GetResults.  It’s called like this:

string query = "billupton";
List results = GoogleResults.GetResults(query);
foreach (GoogleResult result in results)
{
    //...Do something with the result here...
}

Click the new Google AJAX Search API link to see all the parms you can put on the search. In my example I’m paging through results until I do not get a status of 200 (a better way might limit the page count to pull back).  Here’s what the code looks like:

//property to enforce consistent calling of the search api
private static string _searchUrl =
   "http://ajax.googleapis.com/ajax/services/search/web?" +
   "v=1.0&filter=1&rsz=large&start={0}&q={1}";

///
/// Static function to get results from Google.
///
///
///
public static List GetResults(string query)
{
    List list = new List();
    int curRec = 0;
    JsonObject account;
    JsonObject responseData;
    JsonNumber responseStatus;

    //Retrieve in chunks of 8 until we get a bad status code.
    WebRequest request = WebRequest.Create(
        string.Format(_searchUrl, curRec, query));
    WebResponse response = request.GetResponse();
    StreamReader reader = new StreamReader(
        response.GetResponseStream());
    string json = reader.ReadLine();
    reader.Close();

    //Parse it into usable objects
    using (JsonParser parser = new JsonParser(new
        StringReader(json), true))
    {
        account = parser.ParseObject();
        responseStatus = (JsonNumber)account["responseStatus"];
    }

    while (responseStatus == 200)
    {
        responseData = (JsonObject)account["responseData"];
        JsonObject responseCursor =
            (JsonObject)responseData["cursor"];
        JsonString estimatedCount =
            (JsonString)responseCursor["estimatedResultCount"];
        JsonArray results = (JsonArray)responseData["results"];
        foreach (JsonObject result in results)
        {
            list.Add(new GoogleResult(result));
        }

        //Keep reading pages until there are no more
        curRec += 8;
        request = WebRequest.Create(string.Format(_searchUrl,
            curRec, query));
        response = request.GetResponse();
        reader = new StreamReader(
            response.GetResponseStream());
        json = reader.ReadLine();
        reader.Close();

        using (JsonParser parser = new JsonParser(new
            StringReader(json), true))
        {
            account = parser.ParseObject();
            responseStatus =
                (JsonNumber)account["responseStatus"];
        }
    }
    return list;
}

Engaging Virtual Earth (Bing Maps)

Posted in Application Development, Technical by billupton on August 2, 2009

I look forward to working with more mature geodata APIs but I see now you can do quite a bit of cool stuff quickly with Virtual Earth. This version has drag-n-drop layer activation, Transtar Cam integration, clickable Greenway Plaza buildings, etc… Nothing too fancy.

Click HERE to see the demo

On the left side there’s a control bar. Try dragging camera icons into the show column etc…

Screen Pop ~ Unified Communications Demo

Posted in Application Development, Technical, Unified Communications by billupton on July 27, 2009

I’ve just completed a simple demo of screen pop functionality that I’ve written using Microsoft’s Unified Communications APIs.  If you want to try a copy, contact me. 

Overview
  
The Call Assistant is an application that determines who an inbound call is from and then brings up a screen of data associated with that person to assist the receiver of the call. The types of screens that will pop up depend on the rights granted to the user by administrators but it could include one or many types of screens depending on the type of business the user deals with.
 
Using the Application
 
After installing the app, a user can run it by clicking it’s shortcut or by clicking C:\Program Files\Insource Technology\CallAssistant\CallAssistant.exe in windows explorer.  A login screen will pop up.

This application uses the login from Microsoft Communicator if the user is signed in and chooses default credentials.  It is possible, however, to use the Call Assistant without Communicator running or when Communicator is logged in under some other userid. In this mode, the Call Assistant presence beans will not be active nor have call out functionality associated with them.  This mode of entering different credentials is useful if working somewhere without Communicator or for testing when OCS login is different from the Windows login.
 
Once logged in the user will see the status window.

The Type dropdown shows which types of screens a user has permissions to see – HR, Accounting, Sales…Currently only HR screens are available. At this point the Call Assistant is running and waiting for a call. The window can be closed but the phone icon in the system tray shows that it continues to run in the background.
 
To exit the application, right-click the phone icon in the sysem tray and choose Exit.  To bring the status window back up again you can double-click the icon. 
 
When the user gets call, the Call Assistant will pop up a screen associated with the caller assuming that person can be identified. For example. if a non-employee were to call into someone with the HR screen configured, nothing would pop up.  If the user is configured to see screen pops for Sales contacts and an employee calls in, nothing would pop up.  Here’s an example of a HR screen pop.  Note that the content fields are dumbed down for demo purposes:
 

Depending on the back-end data source, the data shown on these screens can be editable. A database would be preferrable. This example uses an Excel spreadsheet for a data source.  The screen pop can be closed any time. 
 
Note that the main call status window tracks past callers. For this demo we are not saving this data but the contact “beans” have complete OCS functionality:

Technical Stuff
 
Technically speaking the majority of this application is written using th Microsoft Unified Communications Client SDK. Extra features were added on by using the Communicator Automation API to support presence easily and to provide call out functionality. Let me know if you have any questions…
-BU

UCCAPI Cheat Sheet for Developing Client Apps

Posted in Application Development, Technical, Unified Communications by billupton on July 14, 2009

When working with UC, or anything that has some involvement with COM objects, one tends to notice the environment can be a bit unforgiving.  UC is new as well and sometimes bits of answers are scattered all over the internet.  When getting applications developed using the Microsoft Unified Communications Client SDK (UCCAPI) I’ve had a bit of trouble remembering all the particulars so I’ve made this cheatsheet:

  • Turn off the Access Control feature if you are on Vista
  • Project Build Properties: Platform Target = x86
  • Copy the following DLLs to the project: UccApi.dll, RTMPLTFM.dll
  • Add a reference to this in the project: On the COM tab | MIcrosoft.Office.Interop.UccApi
  • Create a manifest file, add it to the project. Set its properties to always copy to the output folder
  • Make sure the name of the manifest file matches the project name as do the identities within the file.
  • On the application tab of the Project properties, ensure that the correct manifest file is chosen from the Resources | Manifest: dropdown.
  • Ensure that click-once configuration has not been set in the project properties. This causes manifest conflicts and deletes dlls from the output folder (which in turn causes file not found issues w/UCCAPI.dll).

Templates good

Posted in Personal by billupton on July 8, 2009

Me like. Check out this site I quickly built last year…cheap too (thanks to templatemonster.com):  LauraUpton.Com .  A whole site devoted to my favorite subject!

Comments Off

Up and Walking

Posted in General by billupton on July 8, 2009

Well, hello! I’m working on a new blog that will store some of my rants as a .Net developer. Let’s hope they are sharp witted otherwise I will have to change the name of the blog yet again. I’m not sure what the old title means anyway…kind of like the lyrics to your favorite band in high school. They sound great, sophisticated, cool…

A tired mind become a shape shifter,
Everybody need a soft filter,
Everybody need reverse polarity.

…but they mean nothing..as does the title of my blog so please accept my apology in advance.

If you were wondering, the actual subject matter of this blog should revolve around technical stuff however I’ll throw in a couple personal rants now and then.

Regards and welcome.

Comments Off