All New Sun SPOT Manager Feature!
By user9157252 on Feb 26, 2010
With no fanfare, and an awful lot of trouble, I released this week a new version of the Sun SPOT Manager application to the world. (Or should I say I inflicted it upon the world?). There were a few hiccups in the release, but those are behind us now, and things are smooth sailing again.
So why am I writing about this new release of Sun SPOT Manager? Well, because I've added a new "Community Building" feature to it that I hope you'll all start to use and find useful.
When Sun SPOTs first arrived in our offices -- the very first ones that ran on 2 "AA" batteries -- we all started busily trying to write applications for them. We also started walking up and down the halls of Sun Labs, and sending a flurry of emails, about how exactly to write applications for Sun SPOTs. Randy Smith wrote, we think, the first Sun SPOT application that exercised all the sensors on the sensor board. His code touched every sensor, and the LEDs (there were only 2 in those days). So we all immediately began copying and pasting the small bits of code we wanted out of Randy's application into our own. Making a few changes here and there as needed, and extending the code to suit our needs. In essence, every Sun SPOT app we have written has been an extension of, and built off of, this original code (at least to some degree).
So we thought it would be a great thing to make it easy to find useful bits of code -- we call them 'snippets' now -- and to be able to share bits of code easily. Enter the 'Sharing' tab on Sun SPOT Manager:
So far, we've got only 5 categories of Code snippets (Sensor, General, Host, Driver and Communication) for you to choose from, but we can add more as needed. You'll need a live internet connection to use the Sharing tab, as it connects live to our Snippet Database where all the code is stored. Also, as this is a new feature, the Snippet Database is a bit light on content but we're counting on all of you to quickly add your snippets and build it up. This is a resource for and by our community of users and developers, so build your resource!
Part of any community is your 'standing' in the community. It never hurts to have the respect of your peers. And we've made it possible to develop a 'following' and build your credibility in the Sun SPOT Snippet community (of course!). Your peers will be able to 'rate' your code snippets (no, you can't rate your own! We figure that you'd rate it a 5 out of 5 anyway, otherwise why would you be posting it?) and comment on your code snippets. So you'll be able to see how much people like your code, and how useful it is (and yes, it will be 'policed' to be nice, keep it reasonable, and remember, this is a community!)
Using the Sharing Panel
So how does this 'Sharing' work? Well, like the rest of the Sun SPOT Manager, I tried to make it as easy and intuitive as possible, but I'll give a short tutorial here (and please, if you, as a user of Sun SPOT Manager, find things that don't make sense or that you think need to be improved or changed, by all means let me know! I love feedback!).
As you can see in Figure 1 above, just click on the "Sharing" tab and you'll see the 3-paned window for Snippet Sharing. On the left side is the list of categories (if all the categories I listed above aren't showing, it just means that we don't currently have a Snippet in our database for that category, so please add one!). Clicking on a category will expand it, showing you the snippets in that category.
As you can see from Figure 2, if you hover your mouse over a snippet in the list you will see some additional information about it including a longer description, the author, and the rating. If you then select that snippet, the contents of the snippet will load into the 'Source Code' pane, and the rating and any comments will load into the pane below. YOu can drag these panels to resize them to fit your needs.
The Source Code window shows the Source of the Snippet in a syntax-aware code editor window (well, you can't actually edit the code in there, but it is a full code-editor window so you get syntax highlighting, etc. If you want to save the Code Snippet for your use, you can either select and copy as you would in any application, or click the 'Save..." button to save the snippet as a file on your local machine.
Sharing a Code Snippet
So how do you share a Code Snippet that you have? Again, I tried to make this as easy and intuitive as possible, so just click on the 'New' Button. You'll see the Snippet Entry Window and you can either cut/paste a portion of code into the Source Code Editor, type it in directly, or select an existing Source Code file from your local computer.
The code will enter complete with syntax highlighting, etc. (though we don't provide code-completion). Once you're done, just click the 'Share' button to upload the Snippet to the Snippet Database. (Note: You'll need an account within the Sun SPOT Forums area of Sunspotworld.com in order to upload snippets. If you don't have one, please register here!) Once you're logged in, you can name your Snippet, and provide a brief description. Note that the brief description is what will show up in the pop-up as seen in Figure 2, so keep it short. You can however use some limited html syntax here like <strong> or <b> or <i> or make an unordered list (<ul> etc. You can't include URLs, graphics, etc. though.
Once you have uploaded your snippet, the Share Panel should re-load, and you should be able to find your new Code Snippet! (If it doesn't reload, just hit the 'Refresh' button to get a reload.
Updating or Removing your Snippets
You may notice (once you have uploaded a snippet or two) that when you select one of your own snippets, the 'Update' and 'Delete' button become available. Also, if you have selected one of your own Snippets the Code View window becomes editable and you can make changes to your Snippet. Once you've made changes, just click the 'Update' button to write those changes back to the database.
Likewise, if you decide that your Snippet really isn't your best work, and you'd like to delete it altogether, just click the 'Delete' button. Keep in mind, however, that this will delete your Snippet, any and all Comments, and the rating of your Snippet and it cannot be undone. All of that data will be lost forever.
Commenting on and Rating Snippets
Rating a Snippet is about the easiest thing to do: Just click on a coffee cup! They rank from left-to-right, so clicking on the left-most coffee cup will rate the Snippet a '1' (you'll have a chance to confirm your rating before it's submitted). Again, you need to be logged in to Comment on and Rate Snippets.
To Comment on a Snippet, just click on the 'Comment' button and fill out the form! You'll see any existing comments (in case you're responding to one) and can enter your own comment text. If you don't want your name displayed with your comment, just un-check the "Show Name" box (Note: choosing not to display your name will, in the tradition of slash-dot, list your comment as having been submitted by "Anonymous Coward").
That's all there is to it!
Again, this is your community of Snippets and fellow developers! Share your best stuff!