Richmond Code Camp 3 Presentations

Richmond Code Camp 3 was a huge success. There were some really great topics presented and prizes given away.

I presented two sessions on WPF. The first on XAML and the second on Code; both sessions were based on the most excellent book by Charles Petzold called Applications = Code + Markup, A Guide to the Microsoft Windows Presentation Foundation. If you are new to WPF and have .NET development experience with C#, then this book is for you.

The slide decks will be published shortly. You will be able to download them here:

–Mark

Posted in WPF | 1 Comment

Retrieve the Current User & Set the Combo Box: Access 2003

It’s been six years since I did any real Microsoft Access development.  I am currently on a short engagement to enhance an Access database for a “Major Nationwide Electronics and Stuff Retailer.”  In reality, I’m building them a completely new database.   I am hoping that this will lead to an overhaul of their department operations, which I hope will lead to a lengthy .NET conversion project.  A lot of applications actually start out this way.  I’ve worked on several Microsoft Office application to .NET conversions.   Access programming may not be as glamorous as say building .NET driven robots, but it is still pretty fun.


Retrieve the UserName


To retrieve the currently logged in user, created a helper class, and place the following method in it:



Public Function GetCurrentUserName() As String



GetCurrentUserName = Environ(“USERNAME”)


End Function


In the old days of Access programming, a complicated API call had to be made to achieve the above.   The example will also work in other Office applications.



Retrieve the UserID from the Users Table



Create a table of Users that contains the UserID, UserName, FirstName, LastName, and so on.   Then match the value returned from GetCurrentUserName() with the value that is in the UserName field of the table.  Use the following method to retrieve any given value from the Users table based upon the UserName:



Public Function GetUserNamePart(returnPart As String) As String



Dim user As String
user = GetCurrentUserName


Dim cmdText As String
cmdText = “SELECT ” & returnPart & ” FROM Users WHERE UserName = ‘” & user & “‘”


Dim cmd As New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = cmdText


Dim rst As New ADODB.recordset
Set rst = cmd.Execute


Dim namePartValue As String



If Not rst.BOF And Not rst.EOF Then


    namePartValue = rst(0).value

Else


    namePartValue = user
   
End If


rst.Close
Set rst = Nothing
Set cmd = Nothing


GetUserNamePart = namePartValue


End Function



For example, if the UserID is need, make the following call to the above method:


Public Function GetUserID() As Long



GetUserID= GetUserNamePart(“UserID”)


End Function



Set the Default Value of the Combo Box


I have forms that track various bits of data that can be associated with a person other than the current user.  I created a Combo Box that is bound to the UserID of the table that is bound to the form, while the Combo Box gets its display data from the Users table.  When the value of the Combo Box changes, it will be stored in the table that is bound to the form.  Without making any changes, the Combo Box will default to the first row that is retrieved.  This can become painful if the user has a last name that starts with “S” or a latter letter in the alphabet and has to key in 100+ items.


On the Form_Load() event of the form, add the following code:



UserList.DefaultValue = HelperFunctions.GetUserID


This will tell the Combo Box to default to the currently logged in user, and will also give the user the ability to change the value.



Additional Resources:
http://blogs.officezealot.com/charles/archive/2004/12/10/3574.aspx
http://www.vba-programmer.com/

–Mark
 


Posted in Uncategorized | 1 Comment

Windows CE Emulator Error Message

I finally got my Virtual PC development environment configured so I can develop a Windows CE application in Visual Studio.NET 2003.  I created a new project (Smart Device Application), then pressed F5 to see what would happen.  Here is the error message I received.



–Mark

Posted in Uncategorized | 7 Comments

Publishing Office Documents as HTML to SharePoint

My boss came to me today with the need to have a list he is maintaining published to a SharePoint site.  This list needed to be viewed only by a select group of people.  This list was rather dynamic, and columns could be added or removed as needed.  He needed this published by COB today.  He also requires the ability to publish this list whenever the need arises.

The solution I implemented only took about five minutes of my time.  Here is what I did:

SharePoint Configuration:


  • Created a site and added my boss as an administrator. (He can add people as he see fit).

  • Modified the homepage.  I removed all the default web parts except events.
  • Added a Page Viewer Web Part and the widths were set to 900 by 900 pixels and set the Frame Style to none.

  • Added a default webpage called pageview.htm (you can name this whatever you like) to the Shared Documents document library.
  • Pointed the Page Viewer Web Part to pageview.htm.
Office Application Configuration:


  • Saved Excel file as a webpage and name it pageview.htm –works with Word too :).
  • Uploaded this document to the Shared Documents document library of the new site.
  • Alternatively, you can tell the office application to publish to the document library (on Save As).
I accomplished all of this in under five minutes.  Now my boss can make changes to his document, and share it as a webpage whenever he likes.  The best part is that he can do this himself.  He doesn’t need an “IT” person to push a webpage to the portal site.

–Mark

Posted in SharePoint | 153 Comments

Problems with Rhapsody to Go

Surprisingly, this is actually my first “rant” of 2005.  I am completely frustrated with Real Networks new Rhapsody subscription, “Rhapsody to Go.


On April 26th, Real Networks announced Rhapsody 3.0 and a new subscription tiers.  So I upgraded to Rhapsody to Go.  This subscription is $14.99 per month, and is supposed to allow you to download all the music you want to your portable device.  Take a look at their help documentation here.


The device I am transferring to is my IPod Shuffle which is supported (http://music.guide.real.com/rhapsodydevices).  Here is my problem: every time I try to transfer music to my portable device, I get prompted to pay 89 cents for each song that I want to transfer.


So I emailed customer support twice, then finally called (to get a phone number, you have to try to cancel your subscription from within Rhapsody).  They told me that anytime I want to transfer music I have to pay 89 cents regardless of the “To Go” subscription that I have.  This in complete contradiction to what they are advertising with their subscription serviceQuite frankly, I am in disbelief.  This seems to me like false advertising, pure and simple.



[Update (thanks to Brandon Paddock) :  It seems that I, along with the Rhapsody customer service reps missed the little bit of info :

Basic: Plays simple MP3, WMA, AAC etc.
Download: Plays all of the above, PLUS secure music purchased from Rhapsody
Subscription: Plays all of the above, PLUS subscription downloads from Rhapsody To Go

I wish this was posted in a more conspicuous place]


This is the first paragraph from this help file:


“A portable player or device allows you to take your local music with you wherever you go. But with a the appropriate Rhapsody subscription, you can download and transfer thousands of Rhapsody subscription tracks, at no additional cost beyond your subscription rates. Much of the vast Rhapsody Music Guide library is yours to put in your pocket and take with you anywhere.”


This is from their advertisement from their site:




  • Unlimited access to over 1 million songs


  • Unlimited transfers to your portable devices


  • Unlimited pre-programmed and custom radio


  • Effortless music playback and discovery


  • Personalized music recommendations

These statements clearly state that I do not have to pay for each song.  What part of “no additional cost” includes 89 cents per track?  What part of “Unlimited transfers to your portable devices” includes 89 cents per track?


I have since cancelled my Rhapsody subscription, and I will purchase one or two albums from ITunes a month from now on.


–Mark

Posted in Uncategorized | 56 Comments