Skip to content

Instantly share code, notes, and snippets.

View mbmccormick's full-sized avatar

Matt McCormick mbmccormick

View GitHub Profile
public MainPage()
{
InitializeComponent();
CameraCaptureTask cct = new CameraCaptureTask(); // initalize task
cct.Completed += new System.EventHandler<PhotoResult>(this.PhotoChooserCompleted); // wire up the event
cct.Show(); // launch camera
}
private void StartOcrConversion(Stream photoStream)
{
byte[] photoBuffer = MainPage.StreamToByteArray(photoStream);
OcrService.RecognizeImageAsync(
HawaiiClient.HawaiiApplicationId,
photoBuffer,
(output) =>
{
this.Dispatcher.BeginInvoke(() => OnOcrCompleted(output));
private void OnOcrCompleted(OcrServiceResult result)
{
if (result.Status == Status.Success)
{
int wordCount = 0;
StringBuilder sb = new StringBuilder();
foreach (OcrText item in result.OcrResult.OcrTexts)
{
wordCount += item.Words.Count;
sb.Append(item.Text);
@mbmccormick
mbmccormick / InsertStopTimes.sql
Created September 20, 2011 17:42
Bulk INSERT LINQ collection via XML serialization and stored procedures
SET ANSI_NULL ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE dbo.InsertStopTimes
@SerializedData xml,
@NewPartitionKey uniqueidentifier,
@OldPartitionKey uniqueidentifier
AS
@mbmccormick
mbmccormick / InsertStopTimes.cs
Created September 20, 2011 17:58
Bulk INSERT LINQ collection via XML serialization and stored procedures
List<StopTime> stopTimes = new List<StopTime>();
Guid newPartitionKey = Guid.NewGuid();
foreach (Stop_Time t in GTFSEngine.Stop_Times)
{
StopTime data = new StopTime();
data.RowKey = Guid.NewGuid();
data.PartitionKey = newPartitionKey;
data.StopID = t.StopID;
@mbmccormick
mbmccormick / gist:1272822
Created October 8, 2011 20:20
Remove SVN directories from Windows
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( rd /s /q "%%i" )
@mbmccormick
mbmccormick / gist:1273098
Created October 9, 2011 00:21
Install Hamachi VPN on the PogoPlug USB Device (Part 1)
mount -o rw,remount /
@mbmccormick
mbmccormick / gist:1273099
Created October 9, 2011 00:22
Install Hamachi VPN on the PogoPlug USB Device (Part 2)
wget http://github.com/downloads/mbmccormick/hamachi-pogoplug/hamachi-pogoplug.tar.gz
tar -zxvf hamachi-pogoplug.tar.gz
@mbmccormick
mbmccormick / gist:1273100
Created October 9, 2011 00:22
Install Hamachi VPN on the PogoPlug USB Device (Part 3)
cp etc/ /etc -r
cp root/.hamachi /root -r
cp sbin/ /sbin -r
cp usr/ /usr -r
cp var/ /var -r
@mbmccormick
mbmccormick / gist:1273102
Created October 9, 2011 00:23
Install Hamachi VPN on the PogoPlug USB Device (Part 4)
ln -sf /usr/lib/libstdc++.so.6.0.9 /usr/lib/libstdc++.so.6
ln -sf /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.0.9.7
ln -sf /usr/bin/hamachi /usr/bin/hamachi-init
chmod 755 /usr/bin/hamachi
chmod 700 /sbin/tuncfg