Showing posts with label desktop applications. Show all posts
Showing posts with label desktop applications. Show all posts

Monday, August 10, 2009

Need references?

I've been working on an app at work that will update "slides" that we show on these huge LCD screens at each of the entrances to the building - things like the weather forecast, current tech news (since we're an IT training center), and where each class is located in the building.

It can be used either interactively or as a Scheduled Task (with the needed parameters passed as arguments in the command line). Until this morning, I've been running it myself from my laptop and updating the jpg's on the units manually about once a week. This really doesn't work for me. I'd much rather have the whole stupid process completely automated, but we're having some network issues that prevent the screens from communicating with our server room (UP&P is being blocked at the router). So until that is fixed (pr: circumvented), the jpg's have to be updated manually with a thumb drive.

Before I go any further, I should explain a little about what the app is actually doing. It opens a Powerpoint 2007 document, updates its content with information provided by the National Weather Server, Google News, and a web service from our local web server (for the course location information). Powerpoint really wasn't needed, but it did make it easier to design the slides.

So, like I said I've been running this from my laptop. I decided that it would be much better to try to put the executable right on the thumb drive and set it up so that anyone could use it. After copying the executable to a thumb drive I tried to run it from another computer (other than my laptop). I had already suspected that I would have some problems since the app is referencing the Powerpoint 2007 interop DLL, which is exactly what happened. Powerpoint 2007 had not been installed on this particular - I had chosen this set up on purpose to see what would happen.

So here was the question: How can I run this executable from a computer that doesn't have the Office 2007 DLL's on it, without having to acutally install this app?

Since I'm normally focused on Web apps, I haven't had to deal with this type of problem before. So after a little exploring in Visual Studio...

In Visual Studio, if you select the specific Reference in question (in this case the Office and Office.Powerpoint references), the IDE will expose several properties of the specific References in the Properties window. The one that I immediately focused on is called "Copy Local". This property indicates whether the reference will be copied to the output directory. After setting this option to "True" for both of the non-.NET DLL's, I rebuilt the app, copied the executable and both DLL's to the thumbdrive, and off to the "other" computer I went.

With the DLL's now in the startup folder of the executable, the app ran just fine. So next time you're at the ITTC, check out our new LCD screens powered by this little app.

Sunday, July 13, 2008

Adding URL's to email messages


I recently received a question from a co-worker about inserting URL's into emails.  Although this isn't a normal topic of this site, I thought others might find it useful as well.

Josh,
I have a quick question. I am interested in how you made this a link. 
I have copied and pasted the info but never been able turn it into a link.
Can you help me?
V/R,
Dana

Absolutely!  Take the red pill and follow me down the rabbit hole...
Outlook will automatically create a link for any valid URL (Uniform Resource
Locator) that you type into an email.  By definition, every URL must start with a protocol.  The most common example of a protocol is seen in your address bar while surfing the Internet: http.  Other examples of protocols include https, mailto, callto and file.
In regards to the last one, let's say you want to create a URL that sends people to:
P:\Information Technology Training Center\Public\SIAC Files\
Keep in mind that the example above is not yet a URL, but it is only a file path.  In order to create a URL from this path, the first thing you need to do is add a protocol at the beginning, like so:
file://P:\Information Technology Training Center\Public\SIAC Files\
Now you can see that the link was created, but it stops after the word "Information".  This is not an error.  This is because of another standard in URL's which states that there can be no spaces in a URL.  There are a couple of ways that we could remove the spaces from this URL:
1. Rename the folders and files from "SIAC Files" to "SIAC_Files", etc.
2. Encode those spaces in our URL into Unicode.
The first option could be a major pain, and probably isn't worth the time, so let's look at the second option.  While it might sound scary at first, encoding spaces into Unicode is very easy.  Simply replace all of the spaces in the URL with %20.  By doing this to our URL, it comes out looking like
this:
And, viola, we have a properly formatted URL!  Outlook, having realized this, has created the link for us.