Recently I was doing a project that required a signature applet. Since silverlight has ink support it was the logical choice. However, after many hours of searching around, I couldn’t seem to figure out how to save the ink without programming in C#. So here’s a solution that can turn the ink from an InkPresenter into XAML and back into ink again.
getStrokesAsString = function(inkpresenter) {
var strokes = inkpresenter.strokes;
var buffer = "<inkpresenter .Strokes>";
for (x = 0; x < strokes.Count; x++) {
buffer += "<Stroke>" +
"<stroke .DrawingAttributes>" +
"<drawingattributes Color='#FF000000' Height='1.75' Width='1.75'/>" +
"</stroke>" +
"<stroke .StylusPoints>";
var curstroke = strokes.getItem(x);
if (curstroke) {
var sps = curstroke.StylusPoints;
for (y = 0; y < sps.Count; y++) {
buffer += "<StylusPoint X='" + sps.getItem(y).X + "' Y='" + sps.getItem(y).Y + "' />";
}
}
buffer += "</stroke>";
buffer += "";
}
buffer += "</inkpresenter>";
return buffer;
}
setStrokesFromString = function(inkpresenter, silverlightobj, strokestring) {
inkpresenter.strokes.Clear();
var allstrokes = "allstrokes";
var allstrokes = silverlightobj.content.createFromXAML(strokestring);
inkpresenter.strokes = allstrokes;
}
Sorry it’t not formatted nicely — wordpress stripped all that out.
Use the getStrokesAsString method to get a XAML string representing all the strokes; just pass it the inkpresenter element.
Use the setStrokesFromString method to transfer a XAML string representing the strokes into actual strokes on the canvas. Pass it the inkpresenter element, the silverlight object (usually window.silverLight), and the XAML stroke string.
I know summer doesn’t start until the end of June, but I’m starting earlier. I’ll be spending May working at Microsoft, so updates will be limited or nonexistent.
Once I get back from the internship, I’ll be redesigning this site to be more friendly to tracking downloads and keeping them separate from blog posts. If I end up writing a custom program for this, I’ll make it available for download.
In addition to the new site, I’ll be writing a system (in collaboration with Blueshift Labs) called CompactIS which is too complicated to explain on here. The spec on the protocol will be made available as soon as possible.
This has been around for awhile and a lot of people know about it, but heres a little trick to confuse your friends. This ONLY works on VERIZON LG PHONES.
Go into the phone’s menu
Type 0 (zero) seven times
Hit #
Go to ‘Motor Test’
Turn it on
Then the phone will vibrate until you go back in and turn it off.
I’ve finally created a page that has a list of all downloads available on the site. The downloads are sorted in order by date added, with the most recent first.
I’m thinking about writing a desktop Facebook application. If anyone has ideas let me know. Should I find a good idea, I’ll also write a custom C# client class and make that available for download.
Ever wanted to play a trick on friends or coworkers by making them think their computer has crashed? The easiest way is with my new Fake Blue Screen of Death (FBSOD). Just run it, enter a sleep time, and then wait for the Blue Screen of Death to appear.
Note: This is a beta, more features WILL be available soon Another Note: You need .NET 2.0 to run this.
Sometime soon I plan on adding an easier way to change the text, and to make the error messages look more authentic, but for now, this is a good solution. Note that the FBSOD will capture all keys and key combinations (except Ctrl+Alt+Delete), so there’s no way to exit unless you know how to use the task manager, or if you know the secret.
To exit the FBSOD, move the mouse all the way to the top of the screen and click.
To change the FBSOD text, create a file called C:\windows\bsodtext.txt
Internet Connection Monitor version 3.1 has been released.
This version includes a few minor interface changes as well as a few changes to the backend. There are now 2 new options which allow you to hide outages if they are less than a certain length (default: 30 seconds), and another which allows you to disable the notifications when the connection goes down, so the tray icon simply changes color and writes the log. Here’s a total list of changes:
Under the hood:
Better error handling
More efficient log parser
Interface Changes:
Renamed a few menu items in the log viewer so they are more descriptive
Added an option to hide the notifications when the connection goes up or down (default: show notifications)
Added an option that allows the LogViewer to hide outages if the connection is down for a negligible time (default: 30 seconds)
LogViewer automatically scrolls to the end of the file
LogViewer will now open plaintext files in the viewer rather than trying to parse them out (which adds support for version 2 logs)
IE doesn’t show table cells if they are empty, which can cause a lot of problems. The most obvious fix is to just put <td> </td>, but this isn’t a viable solution if you are generating data from a table or if your site is already created. If you are using IE, below is an example of a table that doesn’t show empty cells:
wefaew
oweifj
woeifj
As you can see (if you’re using IE), the cells simply don’t show up and it looks extremely ugly. It looks even worse when using special borders. Here is a simple script that will go through all tables on your page and fill the contents of the empty cells with
Put this script in the <head> of your document to show empty cells in IE:
note: the <!–[if lte IE 7]> line allows this script to run only in IE browsers.
With the holidays approaching, I’ve been busy with a few projects. Here’s what’s coming the the (kinda) near future:
ICM Version 3.1 - A few bug fixes and feature adds. The most noticeable feature will be the ability to hide outages under x seconds, as well as a few other GUI interface additions and changes
Easythumb 1.0 - A PHP Page for quickly generating image thumbnails, with support for adding watermarks as well
Just released:
Internet Connection Monitor version 3.0
Most of you have never heard of this, but it’s been a project of mine for the past 2 years, although I haven’t really actively been updating it. Just a brief history:
This was created to monitor my internet connection because it frequently cuts out for long periods of time. I needed something to show my ISP to prove to them that the service kept dropping. For this, I created a simple BASH script that would ping our ip every x seconds, and wrote a log of outages. This system was extremely limited, however, so about 6 months later, I wrote a Python version. Still, this version was buggy and inadequate. So now I release version 3.0.
It is written in C# and:
Puts an icon in the system tray that shows the current status of the connection (red for down, green for up)
Shows balloon tips when the connection drops or comes back up
Options for changing polling interval, port, server, and where to save the logfiles
A logfile viewer that parses the logfiles and tells you how long the connection was down
FilePurge: Recursively search (supports regular expression search) a directory for files that match a regular expression. Then it gives you the option to delete or rename the files. Requires .NET 2.0
If you are familiar with the AnAppADay project (http://www.anappaday.com’) you have probably heard of Jedi’s “Jedi Concentrate” app (Day 10: Jedi Concentrate). 2 hours after its release, I released a version with options for setting the opacity and fade speed.
UPDATE: Added Option for picking fade color (9/26/2006)
The Gyrolabs mobile portal is up. You can visit this link from your phone or PDA and it will save your past links and provide you with a list of the most commonly typed in links. To make sure that your URLs are saved, use a username. To get to Gyrolabs mobile: http://m.gyrolabs.com/
and if you want to use a username: http://m.gyrolabs.com/?username