Portland Code Camp Resources: Facebook C# SDK Canvas

As promised here are the resource URLs from my Code Camp presentation on developing Facebook canvas applications with the Facebook C# SDK. Thanks to everyone who came by. It was a lot of fun!

Facebook Developers Home
http://developers.facebook.com/

Facebook C# SDK
http://facebooksdk.codeplex.com/

Facebook Developers “My Apps” Page
https://www.facebook.com/developers/apps.php

Facebook Query Language (FQL)
http://developers.facebook.com/docs/reference/fql/

Permissions Page
http://developers.facebook.com/docs/authentication/permissions/

Graph API
http://developers.facebook.com/docs/reference/api/

Controlling Caching in a generic handler (.ashx)

While working on a code update today I came across the following comment left by another developer.

“IE is stupid and caches every GET request with the same URL. In order to guarantee that no caching happens, we will make sure every GET URL is unique by adding a timestamp onto the URL as a GET parameter. We do nothing else with it.”

Well this certainly does work, but a better option is to set your caching policy in your ASHX file. IE isn’t actually being stupid here. It’s simply trying to be efficient based on it’s local caching policy. This is actually a behavior we want, and it can save round trips if the same resources are used over and over. This is a topic I’ve talked about in the past.

So, how do you control the caching policy? Well the following line of code get’s the job done in my current case.

context.Response.Cache.SetCacheability(HttpCachability.NoCache);

In the ProcessRequest method of your http handler class, context is of type “HttpContext”. If you want to allow caching, you can do that with the Cache object as well. For example you could set the cache to expire after a set time limit.

context.Response.Cache.SetCacheability(HttpCachability.Public);
context.Response.Cache.SetExpires(DateTime.Now.AddDays(1));

Here is the MSDN link for the Cache object, for further reading.

Happy coding!

Allowing HTML submittal in a 4.0 world

Just ran across this and thought I’d pass it along. Ever needed to allow html to be submitted as a part of an ASP.NET form? You go to test it and low and behold you get an error message stating that it is a “Potentially dangerous script…” You yell DOH!! Slap your head and go to the page declaration to add [ValidateRequest=”False”]. No problemmo. Bob’s your uncle, fanny’s your aunt, and all’s well with the world.

But wait. You’re living in .NET 4.0 now. Your still getting the error message. How can this be? Well in .NET 4.0 you need to do a little extra. IT seems they REALLY don’t want you to do this. So you have two choices.

` Add JavaScript to intercept the string before it is sent, Html encode it, and THEN send it to the server. Oh and don’t fore get to reverse the process whenever you need that data.

` Add the following extra tag to the section of your web.config file to tell .net that its ok.

` * <httpRuntime requestValidationMode=”2.0” />

The new error message gives you this info if you read it closely, but since it was a known error I didn’t look closely at it until I had found the fix online. For those who want more technical information here is a link to the article I found.

.NET, SharePoint and Eclipse? Oh my!

Earlier today someone asked me if it was feasible to do SharePoint development in Eclipse. So while my first thought was, “Are you f’n kidding me?” I decided to do a little looking around as I’m always interested in finding a way to do more .NET development on my Mac.

So here is my ultimate response to the question.

Short Answer: No. It is not feasible to do SharePoint development in Eclipse.

Long Answer: I could probably come up with a methodology to utilize eclipse (Assuming Java), to write some customizations that would interact with SharePoint web services, but it would never be truly integrated. Customizations might be in the form if an iframe out to a java page, or perhaps a java plugin embedded into an html/aspx page. I’ve done something similar with flash in the past. In fact if you really want to go down this road you’d probably be better off writing controls in flash, than Java, since you’d at least get a rich UI out of it. Of course with both tracks you’d probably spend more money in extra development time trying to get it all to work the way they wanted, than to just pay for a couple of VS licenses.

Now if you’re talking about using eclipse to develop some ajax functionality, that’s a little different. You’d still end up needing a tool like SharePoint Designer (SPD) to get the code into SharePoint (Though you could probably make due with just uploading the pages if it’s a publishing site). Eclipse might be a good ide to get the functionality working as a prototype. I sometimes use Coda the same way on the mac.

Now if you’re thinking about using a C# plug-in for eclipse, there’s no point. Even with all of the features that Visual Studio Express (The free version of Visual Studio) is missing it can still do more than any of the plug-ins I found for eclipse. You’ll also have no issues getting express for the latest version of Visual Studio. With plug-ins you normally have quite a bit of lag from the time a new version of Visual Studio comes out. And oh, did I mention that it’s free? Some of the plug-ins for eclipse cost money and the ones that don’t just seem to do syntax highlighting, and activate the compiler via a command line call. I can get that with Notepad++ (Also free).

Hope this helps any of you who might be curios about the same thing. I’m still looking for a good way to code .NET on the Mac. So far the best I’ve come up with are syntax highlighters since I’m usually dealing with versions too current for projects like Mono, but that’s better than nothing.

UPDATE 11/5/2011:

I’ve been using MonoDevelop off and on for a while, and while I like it, the issue I keep coming back to is that it will always be out of date. For example I like to do all of my web development using the Razor syntax in MVC 3. While Mono can execute MVC 3 and Razor code compiled from windows, the MonoDevelop tool cannot deal with Razor. (MVC 3 with asp.net seems to work fine.) This means that, for me at least, I still default to opening up a virtual machine for .Net development.

My Blog Reading List – The Quest To Keep Up

A few weeks ago I talked about reading blogs to keep up with trends. This time I thought I’d share some of the blogs I’m currently tracking. I use google reader to manage my blogs and separate every thing into folders. Here is a list of my folders with a brief description, and also a few notes about the blogs I’m tracking in them as well as at what activity level I track them at.

Development – Blogs primarily about, what else, Software development. I don’t actually track a lot here, but what I do track I tend to read through. There are a few others I track, but they post so infrequently I’m not even going to list them here.
* Coding Horor: Jeff Atwood’s blog
* Scott Hanselman’s Computer Zen
* ScottGu’s Blog: Scott Guthrie’s blog (Or as Hanselman refers to him “His Gu-ness”
* iPhone Developer News: This is really just so I don’t have to get Spam for Apple.
* Martin Fowler’s “bliki”: Mostly about Agile and customer interaction. More the business of software development as opposed to the implementation.

Marketing – These are blogs I follow to try and keep up with what is being discussed in the brand and user interaction world. While I’m not a marketer I like to know what is going on in this industry. Remember that the same poeple that marketers are trying to reach work at the companies that internal systems are also interacting with. If you ignoring what people are doing and interacting with outside of work, how can you expect to be able to build systems that help and engage them in the work place. I mostly just track through these quickly.
* Adverblog: I skim this one
* Advertising Age: I skim this one too
* BuzzMachine: It’s a skimmer
* Seth’s Blog: Seth Godin’s blog. This is probably the only one in this folder that I actually make an effort to read. If you’re familiar with Mr. Godin you’ll see some influences from him in my recent posts. While I don’t always agree with him I do find him interesting and thought provoking.

Geek Tech – These are blogs about cool technology. Everyone should be familiar with these, but I don’t think anyone has time to read all the posts. Besides most of them tend to report on the same thing. I usually skim for a while an only stop on items I think are interesting.
* Endgadget
* Gizmodo
* Mashable!
* Slashdot

Well I think that’s it. There are some others I track that are way off topic here such as Comic Book Resources, but this mostly covers the technology blogs. These add up to a lot of posts in a day and a week. It’s important to keep in mind that I many of these categories I skim in a few minutes and then mark everything as read. You don’t need to kill yourself to try and stay relevant.

Year of The Lemur

If I were an international spy or super villain, I’d want to be known as “The Lemur.” I’d get a lemur, name him Maurice, and train him to discretely take care of my enemies… This post has nothing to do with lemurs. Nor does it have anything to so with my plans to rule the Evil League of Evil (E.L.E). Sorry.

2009 was not a good year for me. I don’t feel the need to go into any details, and all things being equal it certainly doesn’t compare to the year my father passed away. However, as we head into the end of January I’m feeling good about 2010, and wanted to share some of the reasons why.

In 2009 I spent too much time trying to do what I thought was right for others rather than simply what I thought was right. When I tried to fit into the mold others wanted to put me in, I was unhappy and, surprise, failed. I’ve gotten to where I am because I don’t fit the mold. This year is about being my non-conformist self again, with no apologies.

I’m revitalizing my interest in technology and solutions I care about, and continuing my personal journey and exploration of how technology can be used to communicate. I’ll have more to say on this later.

I’m going to be writing more. This is one area where I actually thought I had kept momentum up last year. Then I realized that the majority of writing I did in 2009 was either at the beginning of the year or at the end. My goal this year is to not loose momentum. This also extends into my work with sequential art. In addition to the blog I also have some side projects that marry both technology and writing. I’m actually very excited about this and hopefully will be publishing further information about this in the next month or so.

This year more than any other I feel like the confluence of my skills, knowledge and interests has great potential. It’s this potential confluence that I’d like to spend the rest of the post exploring. When I mentioned my exploration of technology and communication earlier it was a bit myopic. Before I got involved in the technology sector I was a trained stage director and playwright. One of the primary themes I continually touched on was how people communicate, or rather how they don’t communicate.

This theme was fueled by something I see as a part of the human condition. It isn’t just a need to communicate with one another, but also a need to commune with one another, to understand in an unspoken way. This is the same need that spurs us to create art. Now there are some very practical reasons this need is baked into our dna. Humans are social animals, and it is this need to live, work and communicate that allowed us to survive in the face of nature and other predators. Humans are not the only social animals on the planet, not even the most socially centered. The insect world beats us hands down when it comes to structured social behavior. However I think it was the way this need to commune with one another combined together with a capacity for knowledge acquisition and application, which turned our tribes into cities. As our technology takes us beyond our physical communities and borders, we still have a need to bond and communicate. I think we take for granted how much interaction and communication is non-verbal. The saying that a picture is worth a 1000 words is not only true, but I’d bet that as you read it you pulled up a mental picture that demonstrated the concept. When you talk to someone on the phone do you mentally picture that person as they talk? As our communications get briefer how many of us resort to emoticons and lolspeak to help fill in the gaps and communicate mood? We are at a point where we need to look at how we communicate and interact in our new cyber communities. We need to look not only at how to use the tools we have but also to discover new tools to move us forward.

We all traverse along our own journey though our lives whether we choose to recognize and embrace it, or simply go along for the ride. Mine has taken me down a path from art to socio-cultural anthropology (for lack of a better term), and then turned down the path of technology. As an artist I explored how we communicate, which got me interested in human culture and social interactions. As a technologist I have been interested not only in how we interact with our technology, but also how our technology interacts with other bits of technology on our behalf. My hobbyist interest in AI was never been to be able to build sky-net, but to use it as a model to better understand human thought and motivation. I feel that there is an opportunity, and in some ways a need, to bring all of these interests and disciplines together that excites me.

So. With all of this in mind, I hereby declare 2010 the year of The Lemur.

PS: I used the word “confluence” a few times in this post. I feel this word, more than any other, helps describe the themes I’m talking about here. To show how long I’ve been ruminating on some of these topics, when I ran my own theatre company back in the mid 90’s I named it the Wormwood Theatre Confluence. I’ve also owned the domain dataconfluence since 2003, though I’ve never done anything with it.