<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - jimfred</title>
<link>http://snipplr.com/users/jimfred</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Tue, 14 Feb 2012 00:19:16 GMT</pubDate>
<item>
<title>(C#) C# Speech example</title>
<link>http://snipplr.com/view/59895/c-speech-example/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 18 Oct 2011 06:32:52 GMT</pubDate>
<guid>http://snipplr.com/view/59895/c-speech-example/</guid>
</item>
<item>
<title>(C#) Get .CFG or .INI filename based on current application name</title>
<link>http://snipplr.com/view/59875/get-cfg-or-ini-filename-based-on-current-application-name/</link>
<description><![CDATA[ <p>Single-line expression provides .CFG filename based on application name.
The .CFG file is in the same directory as the application.
Application.ExecutablePath returns the app's path, with directory, including the trailing .EXE.
Regex is used to replace the .EXE with a .CFG or .INI</p> ]]></description>
<pubDate>Mon, 17 Oct 2011 07:39:33 GMT</pubDate>
<guid>http://snipplr.com/view/59875/get-cfg-or-ini-filename-based-on-current-application-name/</guid>
</item>
<item>
<title>(C#) C# example using WeifenLuo.WinFormsUI.Docking.DockPanel from http://sourceforge.net/projects/dockpanelsuite/</title>
<link>http://snipplr.com/view/58068/c-example-using-weifenluowinformsuidockingdockpanel-from-httpsourceforgenetprojectsdockpanelsuite/</link>
<description><![CDATA[ <p>How to use: 
[1] In main form, set IsMdiContainer, add a WeifenLuo.WinFormsUI.Docking.DockPanel and set dockPanel.Dock = DockStyle.Fill;
[2] Add Forms. Have these new forms inherit from WeifenLuo.WinFormsUI.Docking.DockContent
[3] Modify main form constructor. Example below.</p> ]]></description>
<pubDate>Sun, 21 Aug 2011 14:50:03 GMT</pubDate>
<guid>http://snipplr.com/view/58068/c-example-using-weifenluowinformsuidockingdockpanel-from-httpsourceforgenetprojectsdockpanelsuite/</guid>
</item>
<item>
<title>(SQL) split multiple columns into multiple rows - UNPIVOT</title>
<link>http://snipplr.com/view/57489/split-multiple-columns-into-multiple-rows--unpivot/</link>
<description><![CDATA[ <p>UNPIVOT a table to create more rows using two approaches

Convert this...


K   North   South   East    West
0   1   0   0   0
1   0   1   0   0
2   0   0   1   0
3   0   0   0   1


... to this...


K   PortName    PortOk
0   North   1
0   South   0
0   East    0
0   West    0
1   North   0
1   South   1
1   East    0
1   West    0
2   North   0
2   South   0
2   East    1
2   West    0
3   North   0
3   South   0
3   East    0
3   West    1
</p> ]]></description>
<pubDate>Tue, 02 Aug 2011 05:59:14 GMT</pubDate>
<guid>http://snipplr.com/view/57489/split-multiple-columns-into-multiple-rows--unpivot/</guid>
</item>
<item>
<title>(C#) Get a web page in a dot.net app.</title>
<link>http://snipplr.com/view/56071/get-a-web-page-in-a-dotnet-app/</link>
<description><![CDATA[ <p>These static functions will execute an http GET and get the response as a string. The seconds function uses a user/password to login.</p> ]]></description>
<pubDate>Mon, 04 Jul 2011 10:47:14 GMT</pubDate>
<guid>http://snipplr.com/view/56071/get-a-web-page-in-a-dotnet-app/</guid>
</item>
<item>
<title>(C#) Get current function name</title>
<link>http://snipplr.com/view/54305/get-current-function-name/</link>
<description><![CDATA[ <p>This is useful to get the name of the current function for trace purposes or to name a thread.</p> ]]></description>
<pubDate>Tue, 24 May 2011 09:12:25 GMT</pubDate>
<guid>http://snipplr.com/view/54305/get-current-function-name/</guid>
</item>
<item>
<title>(C++) MFC, Determine if \'this\' app has focus</title>
<link>http://snipplr.com/view/53574/mfc-determine-if-this-app-has-focus/</link>
<description><![CDATA[ <p>Determine if 'this' app has focus.
Using MFC.</p> ]]></description>
<pubDate>Sat, 14 May 2011 07:00:39 GMT</pubDate>
<guid>http://snipplr.com/view/53574/mfc-determine-if-this-app-has-focus/</guid>
</item>
<item>
<title>(C#) Use a Visual Studio embedded resource to store binary blobs of data (like a ZIP file)</title>
<link>http://snipplr.com/view/52866/use-a-visual-studio-embedded-resource-to-store-binary-blobs-of-data-like-a-zip-file/</link>
<description><![CDATA[ <p>Retrieve a byte array from an embedded resource.
 This function uses Assembly.GetManifestResourceStream() and Stream.Read() to read an embedded resource.
 The use of embedded resources allows the .EXE or assembly to be used as a container for data/blobs that might otherwise be stored in an external file.

Instructions:
 1) Add a file to the Visual Studio project e.g., MyData.bin, text.txt, database.mdb, final.hex etc.
 2) For that file, set its Properties / Build Action = Embedded Resource.    Other properties keep defaults (do not copy, blank tool, blank namespace).
 3) At runtime, retrieve resource using this static function.
  
 Notes:
 1) A re-build of the project includes any changes to the resource file - automatically.
  2) The resource editor isn't used and doesn't show the embedded resource.
  3) This technique can be used for 'blobs' or non-typical resources such as: Binary data, databases, information generated by external compilers/tools.
 4) To get a list of resource names during development, inspect this: System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames(). The resource name is the embedded file, prepended with the app name e.g., "MyApplication.MyData.bin" and the name passed to this function would be "MyData.bin" (without the app name).
 5) This function is static; can be accessed by forms, app etc.
 6) For big resources, consider using the stream rather than a byte[].
 7) resourceManager is an alternative approach to get a stream But, the resource name gets changed/mangled. ResourceManager resourceManager = new ResourceManager(assembly.GetName().Name + ".Properties.Resources", assembly); stream = resourceManager.GetStream(resourceNameArg); 
 8) A clumsy alternative to an embedded resource might involve converting data into C# code used to initialize a byte array.</p> ]]></description>
<pubDate>Mon, 02 May 2011 06:31:24 GMT</pubDate>
<guid>http://snipplr.com/view/52866/use-a-visual-studio-embedded-resource-to-store-binary-blobs-of-data-like-a-zip-file/</guid>
</item>
<item>
<title>(C++) MFC, Text to clipboard</title>
<link>http://snipplr.com/view/51796/mfc-text-to-clipboard/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 09 Apr 2011 02:19:26 GMT</pubDate>
<guid>http://snipplr.com/view/51796/mfc-text-to-clipboard/</guid>
</item>
<item>
<title>(C#) Get assembly name and version into a string.</title>
<link>http://snipplr.com/view/50768/get-assembly-name-and-version-into-a-string/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 17 Mar 2011 09:57:45 GMT</pubDate>
<guid>http://snipplr.com/view/50768/get-assembly-name-and-version-into-a-string/</guid>
</item>
<item>
<title>(C#) Launch File Explorer for application\'s current working directory</title>
<link>http://snipplr.com/view/50761/launch-file-explorer-for-applications-current-working-directory/</link>
<description><![CDATA[ <p>I frequently add a link to utilities to open the app's CWD.</p> ]]></description>
<pubDate>Thu, 17 Mar 2011 08:21:29 GMT</pubDate>
<guid>http://snipplr.com/view/50761/launch-file-explorer-for-applications-current-working-directory/</guid>
</item>
<item>
<title>(C#) Scroll multiple RichTextBoxes (or TextBoxes) in unison (synchronized scrolling).</title>
<link>http://snipplr.com/view/50758/scroll-multiple-richtextboxes-or-textboxes-in-unison-synchronized-scrolling/</link>
<description><![CDATA[ <p>This is useful for WinForm apps with multiple TextBoxes that need to be scrolled in unison. Similar applications are diff GUIs that show 2 or more files side-by-side, where each window needs to be scrolled in unison.

The approach below is a simpler alternative to http://stackoverflow.com/questions/1827323/c-synchronize-scroll-position-of-two-richtextboxes</p> ]]></description>
<pubDate>Thu, 17 Mar 2011 06:30:15 GMT</pubDate>
<guid>http://snipplr.com/view/50758/scroll-multiple-richtextboxes-or-textboxes-in-unison-synchronized-scrolling/</guid>
</item>
<item>
<title>(C#) RichTextBox, append a text string and high-light portions of the string that don\'t match a reference string.</title>
<link>http://snipplr.com/view/50731/richtextbox-append-a-text-string-and-highlight-portions-of-the-string-that-dont-match-a-reference-string/</link>
<description><![CDATA[ <p>This static function will append a string to a RichTextBox while high-lighting characters that don't match a reference string. It's similar to a file-compare GUI that high-lights mis-matched characters.

![alt text](https://docs.google.com/uc?id=0Bw1KoEBfCFrEMmY1ZmVjZjUtMGE4Ny00OWE0LTg1YWItNDkzNzljMWZiYTA2&amp;export=download&amp;authkey=CNOQvbwI&amp;hl=en)</p> ]]></description>
<pubDate>Wed, 16 Mar 2011 14:34:01 GMT</pubDate>
<guid>http://snipplr.com/view/50731/richtextbox-append-a-text-string-and-highlight-portions-of-the-string-that-dont-match-a-reference-string/</guid>
</item>
<item>
<title>(C#) C#, getting a reference to a property such as CheckBox.Checked</title>
<link>http://snipplr.com/view/40343/c-getting-a-reference-to-a-property-such-as-checkboxchecked/</link>
<description><![CDATA[ <p>It\'s not possible to get a reference to a property in C#. A reference would allow getting/setting a property inside another function or while enumerating a list. The infoof operator would work but it doesn\'t exist yet. This code shows several ways to get a PropertyInfo for a given property. #4 is the simplest but has the disadvantage that the string will not auto-rename.</p> ]]></description>
<pubDate>Sun, 12 Sep 2010 11:18:48 GMT</pubDate>
<guid>http://snipplr.com/view/40343/c-getting-a-reference-to-a-property-such-as-checkboxchecked/</guid>
</item>
<item>
<title>(C#) C#, Bind a list of value-name pairs to a combobox</title>
<link>http://snipplr.com/view/40319/c-bind-a-list-of-valuename-pairs-to-a-combobox/</link>
<description><![CDATA[ <p>This example shows how to bind a combobox to a list of value-name pairs. Selecting a value results in the appropriate text being displayed. This example uses both a Dictionary and an enum.</p> ]]></description>
<pubDate>Sat, 11 Sep 2010 06:32:42 GMT</pubDate>
<guid>http://snipplr.com/view/40319/c-bind-a-list-of-valuename-pairs-to-a-combobox/</guid>
</item>
<item>
<title>(C#) \'which\' command, in C#</title>
<link>http://snipplr.com/view/38735/which-command-in-c/</link>
<description><![CDATA[ <p>This code came from the cs-script project. It\'s a C# implementation of the which command.</p> ]]></description>
<pubDate>Mon, 09 Aug 2010 07:04:48 GMT</pubDate>
<guid>http://snipplr.com/view/38735/which-command-in-c/</guid>
</item>
<item>
<title>(C#) C# WinForm, subclass a Checkbox control to create a better two-state button (Adds Checkbox within a Button)</title>
<link>http://snipplr.com/view/38657/c-winform-subclass-a-checkbox-control-to-create-a-better-twostate-button-adds-checkbox-within-a-button/</link>
<description><![CDATA[ <p>See comments in code.</p> ]]></description>
<pubDate>Sat, 07 Aug 2010 05:43:08 GMT</pubDate>
<guid>http://snipplr.com/view/38657/c-winform-subclass-a-checkbox-control-to-create-a-better-twostate-button-adds-checkbox-within-a-button/</guid>
</item>
<item>
<title>(DOS Batch) Recursively clean Visual Studio SLN files</title>
<link>http://snipplr.com/view/38288/recursively-clean-visual-studio-sln-files/</link>
<description><![CDATA[ <p>Simple batch file to recursively do a Clean for Visual Studio .SLN files.</p> ]]></description>
<pubDate>Wed, 04 Aug 2010 01:32:10 GMT</pubDate>
<guid>http://snipplr.com/view/38288/recursively-clean-visual-studio-sln-files/</guid>
</item>
<item>
<title>(C#) c#, deep compare</title>
<link>http://snipplr.com/view/37436/c-deep-compare/</link>
<description><![CDATA[ <p>SequenceEqual</p> ]]></description>
<pubDate>Thu, 15 Jul 2010 06:12:18 GMT</pubDate>
<guid>http://snipplr.com/view/37436/c-deep-compare/</guid>
</item>
<item>
<title>(C#) Modal Progress dialog with cancel for time-consuming operations, C#, WinForms</title>
<link>http://snipplr.com/view/36749/modal-progress-dialog-with-cancel-for-timeconsuming-operations-c-winforms/</link>
<description><![CDATA[ <p>Features/Requirements:\r\n\r\n[1] lightweight, easy-to-add\r\n[2] Display progress of long operation using (a) progress bar and (b) user-text.\r\n[3] Close dialog upon (a) Normal completion of long operation or (b) Cancel button used for early cancellation of long operation\r\n[4] GUI not hung/hourglassing during long operation. This can be done using threads or DoEvents. This example uses the BackgroundWorker class as a member of a Form.\r\n[5] Synchronized with no race conditions.\r\n\r\nThe form displayed consists of three elements: label, progress bar and a cancel button.  The label auto-sizes so that user text will be displayed.  The application constructs the dialog with parameters for titlebar text and a delegate for the long operation. The long operation reports progress using BackgroundWorker.ReportProgress. The long operation checks for cancellation using BackgroundWorker.CancellationPending\r\n\r\nSee code for example usage.</p> ]]></description>
<pubDate>Tue, 06 Jul 2010 13:23:35 GMT</pubDate>
<guid>http://snipplr.com/view/36749/modal-progress-dialog-with-cancel-for-timeconsuming-operations-c-winforms/</guid>
</item>
</channel>
</rss>
