Tag Archives: Programming

IP30 Programming – Part 2

The batteries on the IP30 and CN3 are fully charged and ready for some tinkering.

Upgrading the Firmware from 3.01 to 3.16

I looked into upgrading the firmware on the IP30 and it looks to require a MiniSD card. MiniSD is the never-mentioned step brother of SD and MicroSD… meaning stores don’t carry it anymore. I’ve got a MiniSD card and reader on order from Amazon… so updating the IP30 will have to wait.

Available Commands

To receive the available commands on the IP30, the HELP command can be issued. Here’s the response for BRI 3.01 on the IP30:

Reading Tags

Issuing a READ command causes the IP30 to read all tags in the vicinity and report them back in one shot. Tested and this works. Turns out the 8 tags that I have for testing all have the same ID… not optimal but it will work for now.

Next

This is probably it for testing the IP30 with Windows and Tera Term. I’m going to activate my license to Xamarin (have to purchase just to deploy to the device…wish they had some better pricing for education) and get to programming.

Communicating with the Intermec IP30 RFID reader over bluetooth…hopefully with Android

I’m starting work on a project for my MBA program that involves using a mobile RFID reader with an Android device. I’ve purchased a Nexus 7 for the project, and the school has loaned me an Intermec IP30 RFID reader. I’m going to detail my steps in getting this going here.

10/5/2012

Acquired the IP30 from my university. This IP30 is attached to the Intermec CN3 handheld computer, which is running some old version of Windows Mobile. I’ve confirmed that the CN3 can actually communicate with the IP30 and read tags – yay! I don’t plan on using the CN3, but it’s a nice reference for how the communication is supposed to work.

The IP30 is communicated to from the CN3 by bluetooth. Intermec offers some libraries for C# development, but I won’t be using them as this will be an Android application. I’ll be using Xamarin’s Mono for Android (C#), but the Intermec assembly uses some Windows CE libraries so it’s no help. Luckily, it looks like the IP30 works with Intermec’s “Basic Reader Interface” or BRI. This is an ASCII-based protocol over serial/bluetooth. They even have a handy doc on all the relevant commands and how to structure your app if going straight against BRI.

At this point, my goal is to communicate with the IP30 using a hyperterminal on my Windows 7 box. I wore the battery down on the IP30 trying to use PUTTY to for communication and couldn’t manage to get it to respond to any command. I believe that I just wasn’t sending the necessary CRLF at the end of each command for the IP30 to respond, so I’ve downloaded a different hyperterminal – Bray++’s Terminal. Whenever the battery charges up for the IP30, I’ll start whittling at it again :)

Later…

Couldn’t get Bray’s Terminal to connect to the IP30. It would cause Windows to beep, then I’d not be able to connect to the IP30 with anything (including Putty) until I reset the connection by pulling the battery out of the IP30 and putting it back in.

I downloaded Tera Term and have success! It was indeed the newline setting for transmission. I had to change this setting in the Terminal setup and also enable local echo so I could see what I was typing…

This is what I’m seeing when issuing a command through Tera Term:

Luckily in my searching for IP30 related posts, I ran across a page on Intermec’s site where another developer was trying to do what I’m doing through HyperTerminal and had an issue. Issuing FACDFLT4 (which is issued in the BRI manual I referenced earlier) reset the device to factory settings – so I should be good to go!

To be continued…

Hands down, the best blog post on helpful utility programs ever.

If you’re a developer, or an admistrator, or just command your home machine with extreme prejudice – you need to read Scott Hanselman’s 2011 Ultimate Developer and Power Users Tool List for Windows. Lots of good utilities to be found there. Some may even change your life…

Jon’s General SharePoint 2010 Development Tips

In the time I’ve been doing SharePoint development, and SharePoint 2010 development in particular, I’ve tried to blog about the snags or neat stuff I’ve come across. This post is for all those little pieces of knowledge that come from working with the platform that don’t seem large enough for their own post. If you find it useful, let me know in the comments.

The Very Basics

The better understanding of the following resources you have as a SharePoint developer, the better. These are considered absolute must-knows.

Deploying .WSP solution packages

Don’t use Visual Studio 2010 to do this. ”But Jon! They built it to do that! Why shouldn’t I use it?” There are a few reasons why you shouldn’t use VS to do your deployment. Here are a few I’ve learned:

  • You as a SharePoint developer need to be 100% comfortable with using PowerShell to do your deployments. You shouldn’t be using stsadm anymore, and neither should your administrator(s). Learn the commandlets for every part of deployment through using them in your own development environment.
  • Visual Studio 2010 out of the box wants to activate all of your features on every web application in the farm. This isn’t how you’ll treat your production environment, so don’t do it in your dev environment. You can disable this behavior, but then using VS for your deployment doesn’t net you much time savings.
  • Bad things happen when developing content types and site columns. From my experience, Visual Studio keeps a connection to your application open to help you with developing content types and site columns – that’s cool, but not always the best thing. Whenever you retract your solution, make some changes to content types or site columns and redeploy - you’re very likely to end up with Visual Studio telling you that some of those content types and site columns already exist. You can either sort through getting rid of these through powershell/the UI and then continuing to use Visual Studio while trying to make it not have this behavior – or just use PowerShell for your solution/feature deployment and enablement. I chose PowerShell after 2 long days of fighting Visual Studio and haven’t looked back (and haven’t had the issue either!)

Debugging your deployed code

Deploying with PowerShell now? Good. You still need to debug your code. Here are some gotchas.

  • How to attach the Visual Studio debugger manually: If you’re new to SharePoint 2010 and don’t know how to debug without letting Visual Studio 2010 manager your deployment – here are the steps to attach the debugger manually:
    • Build and Package your latest solution package using Visual Studio (I use Ctrl + Shit + B to build, and then click Package in the Build menu).
    • Deploy the solution package using PowerShell.
    • Attach the debugger by clicking the “Debug” menu and “Attach to Process”. Next make sure the “Show processes from all users” and “Show processes in all sessions” are selected. If you’re debugging something running in a web application, select all w3wp processes. If you’re debugging feature activation, attach to your powershell process. If you are debugging a timer job, attach to the owstimer.exe process.
    • Set a breakpoint and debug as normal.
  • Debugging Feature Receivers using PowerShell: PowerShell is really slick. It’s not your normal commandline though. It acts like a .NET application. That means that the first time it loads a dll to run some code, it keeps it handy in memory and doesn’t go and load that dll again. So – if you are testing a feature, checking your results, redeploying your code, and retesting…you’re not going to get the results you want. Why? Because the first time you activated your feature and tested, PowerShell cached your code. It didn’t reload it for your second test run. The solution? Close the PowerShell window and re-open. Repeat as necessary.
  • Debugging Timer Jobs: This has the same caveat as debugging a feature receiver. OWSTimer will cache your dll the first time it runs any code from it. Need to change something in a timer job and retest? Deploy your solution and then restart the “SharePoint 2010 Timer” service in Server Manager. Reattach your debugger if necessary. Retest.

Writing Console Applications against the SharePoint Object Model

This is a really handy way of proving out some application logic, or when you need to provide a utility to your administrator(s) that would just be too complex and hairy to write using PowerShell.

  • To use the SharePoint Object Model, your Console Application needs to be compiled for x64 processors. Go to your Project Properties, and under the Build tab change the “Platform Target” to x64. This setting is specific to the chosen build configuration (most likely “Debug” for your current app). So – if you change your build configuration to Release, you’ll need to set the Platform Target to x64 again.
  • Certain actions in the Object Model require that you have an HttpContext open to the web you’re working with. I ran into this when working with the webpart manager for a web. Google should be able to help you with establishing an HttpContext from within your console application.

Provisioning the User Profile Service Application

  • The instructions on MSDN indicate that the service account running this service app should be a local administrator. In my experience, this means the account must be directly in the Administrators group. It’s not enough to have it in a security group that is then nested in the Administrators group. If you do this, it will be stuck on “starting”.

I’ll add to this as I come across little snippets of knowledge. Have a quick tip for SP2010 to share? Let me know.

Activation could not be completed because the InfoPath Forms Services support feature is not present.

Got this error after migrating a SP2007 application to SP2010.

Activation could not be completed because the InfoPath Forms Services support feature is not present.

The feature it is complaining about is a hidden feature with displayname “IPFSSiteFeatures”. This feature was already enabled on the migrated application…but resolving the error was as simple as disabling and then re-enabling the feature. Here’s the PowerShell to do that:

Disable-SPFeature "IPFSSiteFeatures" -url "http://yourwebapp"
Enable-SPFeature "IPFSSiteFeatures" -url "http://yourwebapp"

Print Helper for Google Calendar


Published my first Google Chrome extension today, Print Helper for Google Calendar. It allows people to print multiple weeks or months of their Google Calendar(s) at a time. This is something that Google doesn’t show in the print UI – but is available if you tweak the URL that is sent to generate the printable pages. I’m not sure why Google doesn’t expose the date selection themselves, as it’s a very needed feature for those using Google Apps day to day.

Enjoy!

Update 1/18/2011: Released v1.1, which now allows more urls when determining when to activate the icon. This should resolve the reported issue. Found that the icon was now appearing on the print preview window, so released v1.2 which keeps the icon from appearing there.

Update 2/11/2011: Released v1.21, which just added the ™ to abide by Google’s branding rules for extensions. Released v1.30 – allowing generated calendars to be in other languages, show/hide weekends, and set week start day.

SharePoint WebPart implementing ICallbackEventHandler does not work properly in Web Part Gallery

In migrating some WebParts from SP2007 to SP2010, I came across a webpart that implements ICallbackEventHandler. This webpart was working fine when placed on the page, but did not work correctly in the webpart gallery. The specific error message being received was “The target ‘ctl00$PlaceHolderMain$ctl00′ for the callback could not be found or did not implement ICallbackEventHandler”. This error is due to the webpart being added to the preview page dynamically at runtime. Everything online I’ve seen assumes that pages doing this can be modified to load controls dynamically either in the Init event or on each Load event. Since SharePoint developers can’t affect the Web Part preview page – the best I could come up with is to prevent the registratration for callback by checking the ID of the control in the Load event. This will tell you if the control is being loaded dynamically, or if it has been placed on a page.

Here’s the code to use in the OnLoad event:

if (this.ID == null)
{
  // This occurs in the webpart gallery and causes it to throw a javascript error.
  Controls.Add(new LiteralControl("This webpart does not function correctly in the webpart gallery. Please test on a page within a webpart zone."));
} else {
  // Do what you normally do.
}

Have a better idea on how to get this to work in the web part preview page? Let me know. At this point I’m content not throwing the javascript error.