<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-32773047</id><updated>2024-10-24T02:25:28.124-07:00</updated><category term="C#"/><category term="asp.net"/><category term="javascript"/><category term="MFC"/><category term="html"/><category term=".net"/><category term="DateTime"/><category term="Visual C++"/><category term="programming"/><category term="MVC"/><category term="Strings"/><category term="datatable"/><category term="performance"/><category term="visual studio"/><category term="C++"/><category term="Conversion"/><category term="Drawing"/><category term="GDI+"/><category term="OleDB"/><category term="Threading"/><category term="Visual C#"/><category term="firefox"/><category term="jquery"/><category term="networking"/><category term="productivity"/><category term="regular expressions"/><category term="software"/><category term="sql server"/><category term="windows forms"/><category term="2d Drawing"/><category term="DataBinding"/><category term="DataGridView"/><category term="Formattting"/><category term="XML"/><category term="converter"/><category term="copy"/><category term="cut"/><category term="databases"/><category term="datareader"/><category term="dataset"/><category term="development"/><category term="excel"/><category term="fragmentation"/><category term="ip address"/><category term="memory leaks"/><category term="mozilla"/><category term="multithreading"/><category term="open source"/><category term="pinvoke"/><category term="shareware"/><category term="unmanaged"/><category term=".ini"/><category term="API"/><category term="Access"/><category term="Accordion"/><category term="AntiAlias"/><category term="BackgroundWorker"/><category term="C# Queueing RabbitMQ Producer Consumer"/><category term="C# WPF XAML"/><category term="Code Reviews"/><category term="Color"/><category term="DataGrid"/><category term="Date"/><category term="Design Patterns"/><category term="Diagnostics"/><category term="Entity Framework"/><category term="Fiscal Year"/><category term="Formatting"/><category term="Fullscreen"/><category term="Globalization"/><category term="Google Maps API"/><category term="IDE"/><category term="Kendo UI"/><category term="Kendo UI grid"/><category term="LED"/><category term="LINQ"/><category term="MD5"/><category term="MSMQ 3.0"/><category term="NTidy"/><category term="ODBC"/><category term="Oracle"/><category term="Paging"/><category term="Parallel.For"/><category term="Process"/><category term="SMTP"/><category term="SSRS"/><category term="STL"/><category term="Search"/><category term="Serialization"/><category term="Singleton"/><category term="Telerik"/><category term="ThreadPool"/><category term="Threads"/><category term="Time"/><category term="TreeView"/><category term="Unicode"/><category term="UserControls"/><category term="VC++"/><category term="WPF"/><category term="Win32"/><category term="app.config"/><category term="arrays"/><category term="balloon tool tips"/><category term="batch files"/><category term="beta"/><category term="binary tree"/><category term="bitmap"/><category term="caching"/><category term="com"/><category term="custom collections"/><category term="data structures"/><category term="data types"/><category term="debugging"/><category term="dll"/><category term="documentation"/><category term="driving directions"/><category term="email"/><category term="encoding"/><category term="enums"/><category term="export"/><category term="freemasonry"/><category term="freeware"/><category term="graphics"/><category term="guid"/><category term="hashing"/><category term="image"/><category term="images"/><category term="java"/><category term="jqGrid"/><category term="jsp"/><category term="localization"/><category term="mail"/><category term="marshal"/><category term="message queues"/><category term="msmq"/><category term="mySQL"/><category term="nesting"/><category term="notify icon"/><category term="paste"/><category term="pdf"/><category term="preparedness"/><category term="python"/><category term="raspberry pi 3"/><category term="registry"/><category term="remote desktop"/><category term="repeater"/><category term="repeaters"/><category term="searches"/><category term="servlet"/><category term="sql"/><category term="sql server reporting services"/><category term="system tray"/><category term="tips"/><category term="tool tips"/><category term="transactions"/><category term="visual basic"/><category term="web"/><category term="win 32"/><category term="zip files"/><title type='text'>Justins Fat Tire</title><subtitle type='html'>I&#39;m a nerd, yep I admit it freely.  I read slashdot and my job title is Software Engineer.  These are my rambling on .NET, C++, Programming, and Technology overall.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>125</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-32773047.post-8277825032210731243</id><published>2020-04-30T10:04:00.000-07:00</published><updated>2020-04-30T10:07:28.945-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C# Queueing RabbitMQ Producer Consumer"/><title type='text'>C# Producer Consumer using Rabbit MQ</title><content type='html'>So I&#39;ve been learning about the different message queuing systems and discovered rabbit MQ, an open source and very popular message queuing system. I&#39;ve created a very basic producer/consumer system that sends a message to a rabbit MQ queue.&lt;br /&gt;
&lt;br /&gt;
Producer/Consumer is pretty simple, you have two systems a producer that writes to a queue and a consumer that reads from a queue. This is desirable because it splits responsibility and allows for scalability. The code below is going to assume you have a rabbit MQ instance installed on your local machine. You can get rabbit MQ here:&amp;nbsp;&lt;a href=&quot;https://www.rabbitmq.com/&quot;&gt;https://www.rabbitmq.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now the code is broken down into 3 parts, the main program, the producer, and the consumer. This is a basic example so its using old school threading rather than the new async/await .net prefers. But this is just to show how to use rabbit MQ in C# and to demonstrate a producer/consumer example. You will need to make sure your project has the rabbit MQ client nuget package installed as well.&lt;br /&gt;
&lt;br /&gt;
The code in a nutshell starts two threads, a producer thread, and a consumer thread. The producer writes to the queue and the consumer reads from it. I&#39;m sure this code could be much more optimized and in production these would most likely be completely separate processes but for demonstration we are using threads.&lt;br /&gt;
&lt;br /&gt;
The main program:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; using System;  
 using System.Threading;  
 namespace ProducerConsumer  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       Console.WriteLine(&quot;Starting Producer/Consumer Threads&quot;);  
       var producerThread = new Thread(new ThreadStart(RunProducer));  
       var consumerThread = new Thread(new ThreadStart(RunConsumer));  
       producerThread.Start();  
       consumerThread.Start();  
       producerThread.Join();  
       consumerThread.Join();  
       while (true) { }  
     }  
     public static void RunProducer()  
     {  
       var producer = new Producer();  
       producer.SendMessage();  
     }  
     public static void RunConsumer()  
     {  
       var consumer = new Consumer();  
       consumer.Receive();  
     }  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
The Producer Code:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; using RabbitMQ.Client;  
 using System;  
 using System.Text;  
 using System.Threading;  
 namespace ProducerConsumer  
 {  
   internal class Producer  
   {  
     public void SendMessage()  
     {  
       var counter = 1;  
       while(true)  
       {  
         var factory = new ConnectionFactory() { HostName = &quot;localhost&quot; };  
         using (var connection = factory.CreateConnection())  
         using (var channel = connection.CreateModel())  
         {  
           channel.QueueDeclare(queue: &quot;test-queue&quot;,  
                      durable: true,  
                      exclusive: false,  
                      autoDelete: false,  
                      arguments: null);  
           var message = $&quot;Hello World {counter++}!&quot;;  
           var body = Encoding.UTF8.GetBytes(message);  
           channel.BasicPublish(exchange: &quot;test-exchange&quot;,  
                      routingKey: &quot;test&quot;,  
                      basicProperties: null,  
                      body: body);  
           Console.WriteLine(&quot; [x] Sent {0}&quot;, message);  
         }  
         Thread.Sleep(1000);  
       }  
     }  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
The Consumer Code:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; using RabbitMQ.Client;  
 using RabbitMQ.Client.Events;  
 using System;  
 using System.Text;  
 using System.Threading;  
 namespace ProducerConsumer  
 {  
   internal class Consumer  
   {  
     public void Receive()  
     {  
       var factory = new ConnectionFactory() { HostName = &quot;localhost&quot; };  
       using (var connection = factory.CreateConnection())  
       using (var channel = connection.CreateModel())  
       {  
         channel.QueueDeclare(queue: &quot;test-queue&quot;,  
                    durable: true,  
                    exclusive: false,  
                    autoDelete: false,  
                    arguments: null);  
         var consumer = new EventingBasicConsumer(channel);  
         consumer.Received += Consumer_Received;  
         while (true)  
         {  
           channel.BasicConsume(queue: &quot;test-queue&quot;,  
                      autoAck: true,  
                      consumer: consumer);  
           Thread.Sleep(1000);  
         }  
       }  
     }  
     private void Consumer_Received(object sender, BasicDeliverEventArgs e)  
     {  
       var body = e.Body;  
       var message = Encoding.UTF8.GetString(body.ToArray());  
       Console.WriteLine(&quot; [x] Received {0}&quot;, message);  
     }  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/8277825032210731243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/8277825032210731243?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/8277825032210731243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/8277825032210731243'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2020/04/c-producer-consumer-using-rabbit-mq.html' title='C# Producer Consumer using Rabbit MQ'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-2095851065659789938</id><published>2020-04-28T09:05:00.001-07:00</published><updated>2020-04-28T09:05:37.696-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="DateTime"/><title type='text'>C# DateTime Formatting</title><content type='html'>C# Offers a wide variety of formatting date times using the ToString method. Below you will see the various options you can use and the results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table bgcolor=&quot;#ffffff&quot; border=&quot;1&quot; cellspacing=&quot;1&quot; style=&quot;border-collapse: collapse; color: #333333; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 16px; outline: 0px; width: 100%px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;
&lt;tr bgcolor=&quot;#0270bf&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; color: white;&quot;&gt;Format&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; color: white;&quot;&gt;Result&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MM/dd/yyyy&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05/29/2015&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;dddd, dd MMMM yyyy&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Friday, 29 May 2015&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;dddd, dd MMMM yyyy&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Friday, 29 May 2015 05:50&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;dddd, dd MMMM yyyy&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Friday, 29 May 2015 05:50 AM&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;dddd, dd MMMM yyyy&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Friday, 29 May 2015 5:50&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;dddd, dd MMMM yyyy&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Friday, 29 May 2015 5:50 AM&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;dddd, dd MMMM yyyy HH:mm:ss&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Friday, 29 May 2015 05:50:06&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MM/dd/yyyy HH:mm&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05/29/2015 05:50&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MM/dd/yyyy hh:mm tt&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05/29/2015 05:50 AM&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MM/dd/yyyy H:mm&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05/29/2015 5:50&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MM/dd/yyyy h:mm tt&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05/29/2015 5:50 AM&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MM/dd/yyyy HH:mm:ss&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05/29/2015 05:50:06&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;MMMM dd&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;May 29&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss.fffffffK&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;2015-05-16T05:50:06.7199222-04:00&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;Fri, 16 May 2015 05:50:06 GMT&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;2015-05-16T05:50:06&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;HH:mm&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05:50&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;hh:mm tt&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05:50 AM&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;H:mm&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;5:50&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;h:mm tt&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;5:50 AM&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;HH:mm:ss&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;05:50:06&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;DateTime.Now.ToString(&quot;yyyy MMMM&quot;)&lt;/td&gt;&lt;td style=&quot;border: 1px dashed rgb(171, 171, 171); box-sizing: border-box;&quot;&gt;2015 May&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol style=&quot;background-color: white; box-sizing: border-box; color: #212121; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 16px;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;d&lt;/strong&gt;&amp;nbsp;-&amp;gt; Represents the day of the month as a number from 1 through 31.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;dd&lt;/strong&gt;&amp;nbsp;-&amp;gt; Represents the day of the month as a number from 01 through 31.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;ddd&lt;/strong&gt;-&amp;gt; Represents the abbreviated name of the day (Mon, Tues, Wed, etc).&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;dddd&lt;/strong&gt;-&amp;gt; Represents the full name of the day (Monday, Tuesday, etc).&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;h&lt;/strong&gt;-&amp;gt; 12-hour clock hour (e.g. 4).&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;hh&lt;/strong&gt;-&amp;gt; 12-hour clock, with a leading 0 (e.g. 06)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;H&lt;/strong&gt;-&amp;gt; 24-hour clock hour (e.g. 15)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;HH&lt;/strong&gt;-&amp;gt; 24-hour clock hour, with a leading 0 (e.g. 22)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;m&lt;/strong&gt;-&amp;gt; Minutes&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;mm&lt;/strong&gt;-&amp;gt; Minutes with a leading zero&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;M&lt;/strong&gt;-&amp;gt; Month number(eg.3)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MM&lt;/strong&gt;-&amp;gt; Month number with leading zero(eg.04)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MMM&lt;/strong&gt;-&amp;gt; Abbreviated Month Name (e.g. Dec)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MMMM&lt;/strong&gt;-&amp;gt; Full month name (e.g. December)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;s&lt;/strong&gt;-&amp;gt; Seconds&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;ss&lt;/strong&gt;-&amp;gt; Seconds with leading zero&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;t&lt;/strong&gt;-&amp;gt; Abbreviated AM / PM (e.g. A or P)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;tt&lt;/strong&gt;-&amp;gt; AM / PM (e.g. AM or PM&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;y&lt;/strong&gt;-&amp;gt; Year, no leading zero (e.g. 2015 would be 15)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;yy&lt;/strong&gt;-&amp;gt; Year, leading zero (e.g. 2015 would be 015)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;yyy&lt;/strong&gt;-&amp;gt; Year, (e.g. 2015)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;yyyy&lt;/strong&gt;-&amp;gt; Year, (e.g. 2015)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;K&lt;/strong&gt;-&amp;gt; Represents the time zone information of a date and time value (e.g. +05:00)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;z&lt;/strong&gt;-&amp;gt; With DateTime values represents the signed offset of the local operating system&#39;s time zone from&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Coordinated Universal Time (UTC), measured in hours. (e.g. +6)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;zz&lt;/strong&gt;-&amp;gt; As z, but with leading zero (e.g. +06)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;zzz&lt;/strong&gt;-&amp;gt; With DateTime values represents the signed offset of the local operating system&#39;s time zone from UTC, measured in hours and minutes. (e.g. +06:00)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;f&lt;/strong&gt;-&amp;gt; Represents the most significant digit of the seconds&#39; fraction; that is, it represents the tenths of a second in a date and time value.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;ff&lt;/strong&gt;-&amp;gt; Represents the two most significant digits of the seconds&#39; fraction in date and time&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;fff&lt;/strong&gt;-&amp;gt; Represents the three most significant digits of the seconds&#39; fraction; that is, it represents the milliseconds in a date and time value.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;ffff&lt;/strong&gt;-&amp;gt; Represents the four most significant digits of the seconds&#39; fraction; that is, it represents the ten-thousandths of a second in a date and time value. While it is possible to display the ten-thousandths of a second component of a time value, that value may not be meaningful.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;fffff&lt;/strong&gt;-&amp;gt; Represents the five most significant digits of the seconds&#39; fraction; that is, it represents the hundred-thousandths of a second in a date and time value.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;ffffff&lt;/strong&gt;-&amp;gt; Represents the six most significant digits of the seconds&#39; fraction; that is, it represents the millionths of a second in a date and time value.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;fffffff&lt;/strong&gt;-&amp;gt; Represents the seven most significant digits of the second&#39;s fraction; that is, it represents the ten-millionths of a second in a date and time value.&lt;/li&gt;
&lt;/ol&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/2095851065659789938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/2095851065659789938?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/2095851065659789938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/2095851065659789938'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2020/04/c-datetime-formatting.html' title='C# DateTime Formatting'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7780973329097575658</id><published>2020-04-13T15:13:00.000-07:00</published><updated>2020-04-13T15:13:44.250-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="networking"/><title type='text'>C# Getting your IP address</title><content type='html'>Sometimes you need to know your ip address in code. With the following snippet you can!

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; var hostName= new HostInformation();  
 var address = Dns.GetHostEntry(hostName).AddressList[0].ToString();  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7780973329097575658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7780973329097575658?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7780973329097575658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7780973329097575658'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2020/04/c-getting-your-ip-address.html' title='C# Getting your IP address'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-6713882347041076934</id><published>2019-09-17T13:59:00.002-07:00</published><updated>2019-09-17T14:15:33.109-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><title type='text'>Old School C++ guess the number game</title><content type='html'>It&#39;s been a while since I blogged but I&#39;ve got some old fashioned code I&#39;ve updated using the latest versions. This is some C++ code for a simple guessing game. You get 10 tries to guess a number between 1 and 100. The game picks the number randomly and tells you if you&#39;ve guessed to low, to high, or correctly. This is written using the newer C++ 11 standard so you&#39;ll notice some weird stuff with the random number generating. I will post some links to this below.

&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; #include &amp;lt;iostream&amp;gt;  
 #include &amp;lt;random&amp;gt;  

 using namespace std;  

 int main()  
 {  
      random_device randomDevice;  
      mt19937 mt(randomDevice());  
      uniform_real_distribution&amp;lt;double&amp;gt; dist(1.0, 100.0);  
      
      int numberOfTries = 0;  
      int numberToGuess = dist(mt);  
      int maxNumberOfTries = 10;  
      int currentGuess = 0;  
      
      bool wonGame = false;  
      
      cout &amp;lt;&amp;lt; &quot;Welcome to guess the number&quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; endl  
           &amp;lt;&amp;lt; &quot;Your goal is to guess the number between 1 and 100 in 10 tries or less&quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; endl;  

      do  
      {  
           cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; &quot;Guess(&quot; &amp;lt;&amp;lt; numberOfTries + 1 &amp;lt;&amp;lt; &quot;): &quot;;  
           cin &amp;gt;&amp;gt; currentGuess;  
           if (!cin.fail() &amp;amp;&amp;amp; currentGuess &amp;gt; 0 &amp;amp;&amp;amp; currentGuess &amp;lt;= 100 )  
           {  
                if (currentGuess == numberToGuess)  
                {  
                     wonGame = true;  
                     break;  
                }  
                else   
                {  
                     if (currentGuess &amp;gt; numberToGuess)  
                     {  
                          cout &amp;lt;&amp;lt; &quot;Too High&quot; &amp;lt;&amp;lt; endl;  
                     }  
                     else  
                     {  
                          cout &amp;lt;&amp;lt; &quot;Too Low&quot; &amp;lt;&amp;lt; endl;  
                     }  
                     numberOfTries++;  
                }  
           }  
           else  
           {  
                cin.clear();  
                cin.ignore();  
                cout &amp;lt;&amp;lt; &quot;Invalid guess&quot; &amp;lt;&amp;lt; endl;  
                continue;  
           }  
      } while (numberOfTries &amp;lt; maxNumberOfTries);  

      if (wonGame)  
      {  
           cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; &quot;Congratulations you guessed the secret number: &quot; &amp;lt;&amp;lt; numberToGuess &amp;lt;&amp;lt; &quot; in &quot; &amp;lt;&amp;lt; numberOfTries &amp;lt;&amp;lt; &quot; tries.&quot; &amp;lt;&amp;lt; endl;  
      }  
      else  
      {  
           cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; &quot;Sorry you didn&#39;t guess the secret number: &quot; &amp;lt;&amp;lt; numberToGuess &amp;lt;&amp;lt; &quot; in 10 tries or less.&quot; &amp;lt;&amp;lt; endl;  
      }  
 }  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/6713882347041076934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/6713882347041076934?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/6713882347041076934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/6713882347041076934'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2019/09/old-school-c-guess-number-game.html' title='Old School C++ guess the number game'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-4273008141122641304</id><published>2018-03-25T16:33:00.000-07:00</published><updated>2018-03-25T17:15:09.750-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi 3"/><title type='text'>Raspberry PI 3+ python blinking LED</title><content type='html'>I&#39;ve recently been getting into the raspberry PI world. I have a model 3+ that one of my first projects was to get an LED to blink. The following below will make an LED blink for a random amount of time for a random amount of times.

&lt;pre  style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3QuL_Dfk1H2OuigG76XpcdPV4WRUzTWxiWVyJgFQ6uqXdilOguSqWsZKtV2nlQMuroYjamSVq2LNZkFm9nb6TnMCPjAmIAxqNEkNghpooFSO4mR5T_oNFk8n6bpb05qs3Ha5vQ/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; import RPi.GPIO as GPIO  
 import time  
 import random  
 from random import *  
 # set the output mode of the GPIO pins  
 GPIO.setmode(GPIO.BCM)  
 # don&#39;t show warnings in the console  
 GPIO.setwarnings(False)  
 # this sets the output to pin 18 (positive)  
 GPIO.setup(18,GPIO.OUT)  
 # we randomly pick some numbers  
 numberOfBlinks = randint(10,30)  
 blinkLength = randint(1,5)  
 print(numberOfBlinks,blinkLength)  
 print(&quot;LEDs on&quot;)  
 counter = 0  
 # loop through and turn the LED on and off  
 while counter &amp;lt;= numberOfBlinks:  
   # set the output to high (ON)  
   GPIO.output(18,GPIO.HIGH)  
   # wait for X seconds  
   time.sleep(blinkLength)  
   # set the output to low (OFF)  
   GPIO.output(18,GPIO.LOW)  
   counter = counter + 1  
   print(counter)  
 print(&quot;LEDs off&quot;)  
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/4273008141122641304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/4273008141122641304?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/4273008141122641304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/4273008141122641304'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2018/03/raspberry-pi-3-python-blinking-led.html' title='Raspberry PI 3+ python blinking LED'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-3427673422606191267</id><published>2017-05-04T16:54:00.000-07:00</published><updated>2017-05-04T16:56:19.468-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C# WPF XAML"/><title type='text'>WPF create a grid splitter</title><content type='html'>You will often find yourself needing to have two panels on a screen with a slider between them. WPF gives you a nice way to handle this with the GridSplitter control. You will need to create a column for the actual splitter and it will use the width you give it in the column definition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
   &amp;lt;Grid&amp;gt;  
     &amp;lt;Grid.ColumnDefinitions&amp;gt;  
       &amp;lt;ColumnDefinition Width=&quot;*&quot; /&amp;gt;  
       &amp;lt;ColumnDefinition Width=&quot;5&quot; /&amp;gt;  
       &amp;lt;ColumnDefinition Width=&quot;*&quot; /&amp;gt;  
     &amp;lt;/Grid.ColumnDefinitions&amp;gt;  
     &amp;lt;TextBlock FontSize=&quot;55&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Center&quot; TextWrapping=&quot;Wrap&quot;&amp;gt;Left side&amp;lt;/TextBlock&amp;gt;  
     &amp;lt;GridSplitter Grid.Column=&quot;1&quot; Width=&quot;5&quot; HorizontalAlignment=&quot;Stretch&quot; /&amp;gt;  
     &amp;lt;TextBlock Grid.Column=&quot;2&quot; FontSize=&quot;55&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Center&quot; TextWrapping=&quot;Wrap&quot;&amp;gt;Right side&amp;lt;/TextBlock&amp;gt;  
 &amp;lt;/Grid&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/3427673422606191267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/3427673422606191267?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/3427673422606191267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/3427673422606191267'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2017/05/wpf-create-grid-splitter.html' title='WPF create a grid splitter'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-6072152844878910517</id><published>2017-04-20T13:46:00.000-07:00</published><updated>2017-04-20T14:04:03.076-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="DataBinding"/><category scheme="http://www.blogger.com/atom/ns#" term="enums"/><category scheme="http://www.blogger.com/atom/ns#" term="WPF"/><title type='text'>WPF Bind a combobox to an enumeration</title><content type='html'>I&#39;ve often found myself needing to bind a combo box to an enumeration I&#39;ve created. You can do this in WPF but it&#39;s a bit complicated. You end up needing to create a static resource. I had mine in a user control.

First the enumeration I was using:

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; namespace XmlCoderBI.Enums  
 {  
   /// &amp;lt;summary&amp;gt;  
   /// An enumeration that represents the type of conversion we&#39;re doing  
   /// &amp;lt;/summary&amp;gt;  
   public enum ConversionType  
   {  
     /// &amp;lt;summary&amp;gt;  
     /// The binary  
     /// &amp;lt;/summary&amp;gt;  
     [Description( &quot;Binary&quot; )]  
     Binary = 0,  
     /// &amp;lt;summary&amp;gt;  
     /// The base64  
     /// &amp;lt;/summary&amp;gt;  
     [Description( &quot;Binary&quot; )]  
     Base64 = 1,  
     /// &amp;lt;summary&amp;gt;  
     /// The hexadecimal  
     /// &amp;lt;/summary&amp;gt;  
     [Description( &quot;Hexadecimal&quot; )]  
     Hexadecimal = 2,  
     /// &amp;lt;summary&amp;gt;  
     /// The UTF-8  
     /// &amp;lt;/summary&amp;gt;  
     [Description( &quot;Hexadecimal&quot; )]  
     UTF8 = 3,  
     /// &amp;lt;summary&amp;gt;  
     /// The UTF-16  
     /// &amp;lt;/summary&amp;gt;  
     [Description( &quot;Hexadecimal&quot; )]  
     UTF16 = 4  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
This is just an ordinary enum. Now you need to add this to your XAML references:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;xmlns:System=&quot;clr-namespace:System;assembly=mscorlib&quot;
xmlns:enums=&quot;clr-namespace:XmlCoderBI.Enums;assembly=XmlCoderBI&quot; 
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The first line adds a reference to the mscorlib library which lets us use Enums. The second is the reference to the library where you have your enumeration stored.

Now to create the static resource and bind it to our combbox, I used mine in a user control, but this can go in any place you need it.

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;Usercontrol.Resources&amp;gt;  
     &amp;lt;objectdataprovider methodname=&quot;GetValues&quot; objecttype=&quot;{x:Type System:Enum}&quot;
     x:key=&quot;dataFromEnumImport&quot;&amp;gt;  
     &amp;lt;objectdataprovider .methodparameters=&quot;&quot;&amp;gt;  
         &amp;lt;x:type typename=&quot;enums:ConversionType&quot;&amp;gt;  
       &amp;lt;/x:type&amp;gt;&amp;lt;/objectdataprovider&amp;gt;  
     &amp;lt;/objectdataprovider&amp;gt;&amp;lt;/usercontrol&amp;gt;  
&amp;lt;/UserControl.Resources&amp;gt;

&amp;lt;combobox itemssource=&quot;{Binding Source={StaticResource dataFromEnumImport}}&quot;
 selecteditem=&quot;{Binding ImportFileType}&quot; width=&quot;100&quot; /&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
You can see it&#39;s binding the ItemSource to our enum using the key we define in the static resource. The SelectedItem is also bound to a property I have defined in my DataContext. I use this for easy tracking of the selected value but you don&#39;t have to bind the SelectedItem.

</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/6072152844878910517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/6072152844878910517?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/6072152844878910517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/6072152844878910517'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2017/04/wpf-bind-combobox-to-enumeration.html' title='WPF Bind a combobox to an enumeration'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-423541494079870443</id><published>2017-02-28T11:11:00.000-07:00</published><updated>2017-02-28T11:11:28.245-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="multithreading"/><title type='text'>C# async and await</title><content type='html'>The async and await keywords in C# are the heart of async programming. By using those two keywords, you can use resources in the .NET Framework or the Windows Runtime to create an asynchronous method almost as easily as you create a synchronous method. Asynchronous methods that you define by using async and await are referred to as async methods.
The following example shows an async method. Almost everything in the code should look completely familiar to you. The comments call out the features that you add to create the asynchrony.

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; // Three things to note in the signature:   
 // - The method has an async modifier.    
 // - The return type is Task or Task&amp;lt;T&amp;gt;. (See &quot;Return Types&quot; section.)   
 //  Here, it is Task&amp;lt;int&amp;gt; because the return statement returns an integer.   
 // - The method name ends in &quot;Async.&quot;   
 async &lt;task&gt;&lt;int&gt; AccessTheWebAsync()   
 {    
   // You need to add a reference to System.Net.Http to declare client.   
   HttpClient client = new HttpClient();   
   // GetStringAsync returns a Task&lt;string&gt;. That means that when you await the   
   // task you&#39;ll get a string (urlContents).   
   Task&amp;lt;string&amp;gt; getStringTask = client.GetStringAsync(&quot;http://msdn.microsoft.com&quot;);   
   // You can do work here that doesn&#39;t rely on the string from GetStringAsync.   
   DoIndependentWork();   
   // The await operator suspends AccessTheWebAsync.   
   // - AccessTheWebAsync can&#39;t continue until getStringTask is complete.   
   // - Meanwhile, control returns to the caller of AccessTheWebAsync.   
   // - Control resumes here when getStringTask is complete.    
   // - The await operator then retrieves the string result from getStringTask.   
   string urlContents = await getStringTask;   
   // The return statement specifies an integer result.   
   // Any methods that are awaiting AccessTheWebAsync retrieve the length value.   
   return urlContents.Length;   
 }   
&lt;/string&gt;&lt;/int&gt;&lt;/task&gt;&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/423541494079870443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/423541494079870443?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/423541494079870443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/423541494079870443'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2017/02/c-async-and-await.html' title='C# async and await'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-3552276442030923466</id><published>2016-10-05T11:01:00.000-07:00</published><updated>2016-10-05T11:01:32.857-07:00</updated><title type='text'>C# Updated on Threading with .net 4</title><content type='html'>With .NET 4 we now have better ways of handling threads. So in this post I&#39;m going to demonstrate several ways of creating and waiting for threads to finish.&lt;br /&gt;
&lt;br /&gt;
First example is creating 10 threads with the new Task.Factory.StartNew() method then we call Task.WaitAll and the framework handles the rest. This call will however block until all the tasks are finished.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; // Wait for all tasks to complete.  
       Task[] tasks = new Task[10];  
       for (int i = 0; i &amp;lt; 10; i++)  
       {  
         tasks[i] = Task.Factory.StartNew(() =&amp;gt; DoSomeWork(10000000));  
       }  
       Task.WaitAll(tasks);  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The second way allows us to no block.

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; var task1 = DoWorkAsync();  
 var task2 = DoMoreWorkAsync();  
 await Task.WhenAll(task1, task2);  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/3552276442030923466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/3552276442030923466?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/3552276442030923466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/3552276442030923466'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/10/c-updated-on-threading-with-net-4.html' title='C# Updated on Threading with .net 4'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-672185952452866543</id><published>2016-10-03T08:47:00.001-07:00</published><updated>2016-10-03T14:23:47.939-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>C# parse invalid XML characters</title><content type='html'>I&#39;ve been dealing with XML a bit lately and have found that when you don&#39;t control the data you get all sorts of weird stuff. XML 1.0 doesn&#39;t allow certain characters or the XML is invalid. I tested a variety of ways using streams and string builders but I found a bit of LINQ and using a .NET function and in two lines you get a string of XML that only has valid characters.

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; var validXmlChars = val.Where( ch =&amp;gt; XmlConvert.IsXmlChar( ch ) ).ToArray();  
 return new string( validXmlChars );  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/672185952452866543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/672185952452866543?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/672185952452866543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/672185952452866543'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/10/ive-been-dealing-with-xml-bit-lately.html' title='C# parse invalid XML characters'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-5407657917102985019</id><published>2016-08-16T10:37:00.000-07:00</published><updated>2017-04-20T14:11:15.534-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="html"/><category scheme="http://www.blogger.com/atom/ns#" term="jqGrid"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>using jqGrid in an MVC View</title><content type='html'>Since MVC has gotten so popular and for a good damn reason we&#39;ve lost the venerable WebForms grids. However a great replacement is the jqGrid an extension of the jQuery UI. However it does take some setup in your View and I personally find their documentation horrendous. Below is a very basic jqGrid but you need an empty table with the id that matches what&#39;s in the grid and a div that&#39;s used for the pager.&lt;br /&gt;
&lt;br /&gt;
You&#39;ll notice these items have to match and the div MUST be below the table for the display to work correctly. I&#39;m using an MVC controller to get the data for the grid back. Now this won&#39;t let you add, delete, edit, etc because that gets a lot more complicated. For me this is a pretty basic grid. You need to specify a url to get data, I almost always use json as my datatype, and a GET to the server. Whatever data your return needs to be in a JSON format that matches the format in the&amp;nbsp;&lt;span style=&quot;background-color: #f0f0f0;&quot;&gt;jsonReader section of the grid. See another post of mine on how to return that from an MVC controller.&lt;/span&gt;&amp;nbsp; You will need to set your columns of course to your needs.&lt;br /&gt;
&lt;br /&gt;
There are a lot more options if you try and read the jqGrid docs.



&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://jqgrid.com/&quot; target=&quot;_blank&quot;&gt;jqGrid Home Page&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre 0px=&quot;&quot; 12px=&quot;&quot; 20px=&quot;&quot; 99=&quot;&quot; arial=&quot;&quot; auto=&quot;&quot; font-size:=&quot;&quot; height:=&quot;&quot; left=&quot;&quot; line-height:=&quot;&quot; overflow:=&quot;&quot; padding:=&quot;&quot; style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black;&quot; text-align:=&quot;&quot; width:=&quot;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;

&amp;lt;table class=&quot;container&quot; id=&quot;usersGrid&quot;&amp;gt;
&amp;lt;div id=&quot;usersGridPager&quot;&amp;gt;

&amp;lt;script&quot;&amp;gt;
 $(document).ready(function () {  
     jQuery(&quot;#usersGrid&quot;).jqGrid(  
     {  
       url: &quot;@Url.Action( &quot;Get&quot;, &quot;Users&quot; )&quot;,  
       datatype: &quot;json&quot;,  
       mtype: &#39;GET&#39;,  
       colNames: [&#39;Id&#39;,&#39;Username&#39;, &#39;Name&#39;, &#39;Email Address&#39;, &#39;Created On&#39;],  
       colModel: [  
              { name: &#39;Id&#39;, index: &#39;Id&#39; },  
              { name: &#39;Username&#39;, index: &#39;Username&#39; },  
              { name: &#39;Name&#39;, index: &#39;Name&#39; },  
              { name: &#39;EmailAddress&#39;, index: &#39;EmailAddress&#39; },  
              { name: &#39;Created&#39;, index: &#39;Created&#39;}],  
       pager: &quot;#usersGridPager&quot;,  
       viewrecords: true,  
       autowidth: true,  
       multiselect: false,  
       height: &#39;100%&#39;,  
       width: &#39;100%&#39;,  
       rowNum: 20,  
       caption: &#39;Users&#39;,  
       emptyrecords: &#39;No Users&#39;,  
       rowList: [10, 20, 30, 40, 50],  
       altRows: true,  
       loadonce: false,  
       loadtext: &quot;Loading Users...&quot;,  
       jsonReader: {  
         root: &quot;rows&quot;,  
         page: &quot;page&quot;,  
         total: &quot;total&quot;,  
         records: &quot;records&quot;,  
         repeatitems: false,  
         Id: &quot;0&quot;  
       }  
     });  
  
   });  
&amp;lt;/script&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/5407657917102985019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/5407657917102985019?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/5407657917102985019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/5407657917102985019'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/08/using-jqgrid-in-mvc-view.html' title='using jqGrid in an MVC View'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7219185145332150678</id><published>2016-08-16T08:44:00.005-07:00</published><updated>2016-09-27T15:09:21.366-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>jqGrid get data from MVC Controller</title><content type='html'>So ever since MVC for asp.net started becoming all the rage, and for good reason! Many people have bemoaned the loss of the venerable DataGrid from WebForms. Well there are a few options out there. You have Teleriks Kendo UI suite which is great but costs money. There are a few other options but the best jqGrid a jQuery plugin.&lt;br /&gt;
&lt;br /&gt;
Now this grid can be a bit tricky to use. I personally find the documentation a bit short to put it politely. I&#39;ve done enough grids now I&#39;m getting the hang of it and want to share some pointers for other ASP.net MVC developers out there. Now let&#39;s assume in your View you have a nice jqGrid pointed to a controller action (I&#39;ll make another post about this as well). jqGrids are very powerful and support paging, grouping, filtering, sorting, etc. Now the bad part is you have to handle all that in your controller. This controller action will show you have to sort, page, and generally retrieve data.&lt;br /&gt;
&lt;br /&gt;
Now for the jqGrid to work correctly it needs to have a very unique signature.

&lt;br /&gt;
&lt;br /&gt;
We need 4 parameters, these names must BE AS SHOWN, if not you won&#39;t get the values to fully sort, etc.&lt;br /&gt;
&lt;br /&gt;
sidx - &amp;nbsp;Sorting index, the column name being sorted&lt;br /&gt;
&lt;br /&gt;
sord - Sorting direction this will DESC or ASC&lt;br /&gt;
&lt;br /&gt;
page - The page number the grid is on&lt;br /&gt;
&lt;br /&gt;
rows - The number of items per page&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; public ActionResult Get( string sidx, string sord, int page, int rows )  
     {  
       // check if we have a sort, null means nothing  
       &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;sord&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;= ( &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;sord&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;== null ) ? &quot;&quot; : &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;sord&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;;  &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;
&lt;/span&gt;
       // get the page index into an int (which page we&#39;re on)  
       int pageIndex = Convert.ToInt32( page ) - 1; 
 
       // get the number of items per page  
       int pageSize = rows;  

       // get some data from an Entity Framework source  
       // you can get it from anywhere  
       var users = _db.Users.Select(  
         user =&amp;gt; new UsersGridModel  
         {  
           Id = user.Id,  
           Username = user.UserName,  
           EmailAddress = user.EmailAddress,  
           Name = user.FirstName + &quot; &quot; + user.LastName,  
           Created = user.Created  
         } );  

       // get the total count of records to displau  
       int totalRecords = users.Count();  
       
       // get the total number of pages to display  
       var totalPages = (int)Math.Ceiling( (float)totalRecords / (float)rows );  

       // check which direction if any we&#39;re sorting  
       if( &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;sord&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;.ToUpper() == &quot;DESC&quot; )  &lt;/span&gt;
       {  
         // you need to look at the sidx (sorting index) this will be a column name  
         // use the correct item in your source to sort the column correctly  
         users = users.OrderByDescending( t =&amp;gt; t.Id );  
         users = users.Skip( pageIndex * pageSize ).Take( pageSize );  
       }  
       else  
       {  
         // you need to look at the sidx (sorting index) this will be a column name  
         // use the correct item in your source to sort the column correctly  
         users = users.OrderBy( t =&amp;gt; t.Id );  
         users = users.Skip( pageIndex * pageSize ).Take( pageSize );  
       }  

       // we need to send back JSON in a very specific format  
       var jsonData = new  
       {  
         total = totalPages,  
         page,  
         records = totalRecords,  
         rows = users  
       };  

       // send it back, the AllowGet isn&#39;t required since MVC 4 or 5 but it&#39;s good practice  
       return Json( jsonData, JsonRequestBehavior.AllowGet );  

     }  &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Now if you have a lot of columns that sorting section can get hairy, I would move it into another function. In fact you could modularize this and try and make it pretty generic but this is a one off example. But this is a basic way to get data to a jqGrid from an MVC Controller.</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7219185145332150678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7219185145332150678?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7219185145332150678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7219185145332150678'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/08/jqgrid-get-data-from-mvc-controller.html' title='jqGrid get data from MVC Controller'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-1213287129365323578</id><published>2016-05-04T13:47:00.003-07:00</published><updated>2016-05-04T13:48:06.780-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="Kendo UI"/><category scheme="http://www.blogger.com/atom/ns#" term="Kendo UI grid"/><category scheme="http://www.blogger.com/atom/ns#" term="Telerik"/><title type='text'>Kendo UI grid update row using Javascript/jQuery</title><content type='html'>I&#39;ve been working on a project that utilizes the Telerik Kendo UI grid. I&#39;ve found that I have a need to change the values in the current row using client side tech (Javascript/jQuery). It&#39;s actually pretty easy to do. You get the grid, then the model bound to the grid and change the values on the model. This will refresh the values in the grid on the client side. You can save these new values in the Update controller action you define in the grid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; // get the grid and model used to bind against the grid  
 var grid = $(&quot;#AdminFalloutMappingGrid&quot;).data(&quot;kendoGrid&quot;),  
    model = grid.dataItem(this.element.closest(&quot;tr&quot;));  
 // get a value from the model, using the property name on the model  
 var something = model.get(&quot;PropertyName&quot;);  
  // update the model using the Property Name  
 model.set(&quot;PropertyName&quot;, &quot;value&quot;);  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/1213287129365323578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/1213287129365323578?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/1213287129365323578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/1213287129365323578'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/05/kendo-ui-grid-update-row-using.html' title='Kendo UI grid update row using Javascript/jQuery'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7254454631189510082</id><published>2016-03-24T19:12:00.000-07:00</published><updated>2016-04-07T05:21:33.353-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Drawing"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>ASP.net MVC dynamically create and return image from Controller</title><content type='html'>I&#39;ve found that I have a need to create an image dynamically (or read from a file) and return it directly from a controller. We can do that pretty easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First add this method to a controller:

&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;public class ImageController : Controller
{
     public void Generate()  
     {  
       try  
       {  
         //when we create a pixel we need to make it a random color  
         Random randomGen = new Random();  
         Bitmap image = new Bitmap( width, height );  
         // create the graphics drawing tool  
         using ( Graphics gfx = Graphics.FromImage( image ) )  
         // create a solid brush to draw the image, I&#39;m using random colors  
         using ( SolidBrush brush = new SolidBrush( Color.FromArgb( randomGen.Next( 255 ), 
                                                    randomGen.Next( 255 ),
                                                    randomGen.Next( 255 ) ) ) )  
         {  
           gfx.FillRectangle( brush, 0, 0, width, height );  
         }  

         // save the image to a memory stream  
         MemoryStream ms = new MemoryStream();  
         pixel.Image.Save( ms, ImageFormat.Jpeg );  
         ms.Position = 0;  

         // send the image back  
         return new FileStreamResult( ms, &quot;image/jpeg&quot; );  

       }  
       catch(Exception ex)  
       {  
         Console.WriteLine( ex.ToString() );  
       }  
    }     
}  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you in an image tag set the src property to your controllers action as follows:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  img src=&quot;@Url.Content(&quot;~/ImageController/Generate&quot;)&quot; 
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7254454631189510082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7254454631189510082?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7254454631189510082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7254454631189510082'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/03/aspnet-mvc-dynamically-create-and.html' title='ASP.net MVC dynamically create and return image from Controller'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7900134957099467600</id><published>2016-03-15T17:42:00.003-07:00</published><updated>2016-03-15T17:58:21.045-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>ASP.net MVC Ajax.BeginForm with busy icon</title><content type='html'>So I&#39;ve been exploring the world of MVC and found it&#39;s pretty easy to do a postback to a controller and do it with AJAX and show a busy icon and keep the user from pressing the submit button. This is MVC 5 with the Razor rendering engine. Below is the entire section:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%&quot;&gt;&lt;code&gt;&amp;lt;div id=&amp;quot;divSendEmail&amp;quot;&amp;gt;
        @using ( Ajax.BeginForm( &amp;quot;SendEmail&amp;quot;, &amp;quot;Contact&amp;quot;,
            new AjaxOptions { UpdateTargetId = &amp;quot;result&amp;quot;, LoadingElementId = &amp;quot;loading&amp;quot;, OnBegin= &amp;quot;sendEmailLoad()&amp;quot;, OnComplete= &amp;quot;completeSendEmailLoad()&amp;quot; } ) )
        {
            &amp;lt;div id=&amp;quot;loading&amp;quot; style=&amp;quot;display: none; position: absolute; top: 50%; left: 50%; margin-top: -50px; margin-left: -50px; width: 100px; height: 100px;&amp;quot;&amp;gt;
                &amp;lt;img src=&amp;quot;~/Content/images/gears_animated.gif&amp;quot; /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;fieldset&amp;gt;
                Name: &amp;lt;input type=&amp;quot;text&amp;quot; class=&amp;quot;form-control&amp;quot; id=&amp;quot;textName&amp;quot; name=&amp;quot;textName&amp;quot; required=&amp;quot;required&amp;quot; maxlength=&amp;quot;255&amp;quot;&amp;gt;&amp;lt;br&amp;gt;
                Email: &amp;lt;input type=&amp;quot;email&amp;quot; class=&amp;quot;form-control&amp;quot; id=&amp;quot;textEmail&amp;quot; name=&amp;quot;textEmail&amp;quot; required=&amp;quot;required&amp;quot; maxlength=&amp;quot;255&amp;quot;&amp;gt;&amp;lt;br&amp;gt;
                Message: &amp;lt;textarea class=&amp;quot;form-control&amp;quot; rows=&amp;quot;5&amp;quot; id=&amp;quot;textMessage&amp;quot; name=&amp;quot;textMessage&amp;quot; required=&amp;quot;required&amp;quot;&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;br&amp;gt;
                &amp;lt;input type=&amp;quot;submit&amp;quot; id=&amp;quot;buttonSubmit&amp;quot; name=&amp;quot;buttonSubmit&amp;quot; value=&amp;quot;Send Email&amp;quot; class=&amp;quot;btn btn-primary&amp;quot; /&amp;gt;
            &amp;lt;/fieldset&amp;gt;
            &amp;lt;div id=&amp;quot;result&amp;quot; class=&amp;quot;container&amp;quot;&amp;gt;
            &amp;lt;/div&amp;gt;
        }
    &amp;lt;/div&amp;gt;
&amp;lt;script&amp;gt;
        function sendEmailLoad() {
            document.getElementById(&amp;quot;buttonSubmit&amp;quot;).disabled = true;
            return false;
        }

        function completeSendEmailLoad() {
            document.getElementById(&amp;quot;buttonSubmit&amp;quot;).disabled = false;
            return true;
        }
    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
First is the AjaxBeginForm. We pass the Action, Controller, and AjaxOptions we want to use. The LoadingElementId is a div we have defined that contains an image that is centered in the middle of the screen with an animated gif that is set to not display. The OnBegin is a javascript function that disables the submit button to prevent multiple postbacks. The OnComplete is a javascript function that enables the submit button once the AJAX call is done.</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7900134957099467600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7900134957099467600?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7900134957099467600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7900134957099467600'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/03/aspnet-mvc-ajax-form-post-with-busy-icon.html' title='ASP.net MVC Ajax.BeginForm with busy icon'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-8457186635549637527</id><published>2016-02-28T17:10:00.004-07:00</published><updated>2016-02-28T17:10:57.931-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Date"/><category scheme="http://www.blogger.com/atom/ns#" term="Formatting"/><category scheme="http://www.blogger.com/atom/ns#" term="MFC"/><category scheme="http://www.blogger.com/atom/ns#" term="Time"/><title type='text'>MFC getting the current date and time </title><content type='html'>I&#39;ve been updating some older MFC/C++ applications and I found I needed to get the current system time. There&#39;s a way in the Win32 API but it&#39;s clunky. MFC gives you a simple way.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;lang-cpp prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px;&quot;&gt;CTime&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt; t &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px;&quot;&gt;CTime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px;&quot;&gt;GetCurrentTime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px;&quot;&gt;CString&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt; s &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt; t&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px;&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;border: 0px; color: maroon; margin: 0px; padding: 0px;&quot;&gt;&quot;%m%d%Y&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;lang-cpp prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px;&quot;&gt;The Format method can take a wide variety of parameters.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;lang-cpp prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;&quot;&gt;See this &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx&quot; target=&quot;_blank&quot;&gt;MSDN&lt;/a&gt; link&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/8457186635549637527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/8457186635549637527?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/8457186635549637527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/8457186635549637527'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/02/mfc-getting-current-date-and-time.html' title='MFC getting the current date and time '/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7940309470223781101</id><published>2016-02-14T17:07:00.000-07:00</published><updated>2016-02-14T17:08:34.321-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="Accordion"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>ASP.NET dynamically load AJAX toolkit accordion panes</title><content type='html'>I love the Accordion pane from the AJAX toolkit, but I&#39;ve found myself needing to dynamically add accordion panes to it. To do this you need to some work on the back end. The following code loops through a DataSet and dynamically creates a Label control for the header and content. It then adds those controls to a new AccordionPane and then add it to your Accordion.

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; for ( var i = 0; i &amp;lt; ds.Tables[10].Rows.Count; i++ )  
         {  
           Label lblContent = new Label();  
           lblContent.ID = Guid.NewGuid().ToString();  
           Label lblTitle = new Label();  
           lblTitle.ID = Guid.NewGuid().ToString();  
           lblTitle.Text = ds.Tables[2].Rows[i + 1][1].ToString();  
           lblContent.Text = ds.Tables[10].Rows[i][1].ToString();  
           AjaxControlToolkit.AccordionPane pane = new AjaxControlToolkit.AccordionPane();  
           pane.ID = Guid.NewGuid().ToString();  
           pane.HeaderContainer.Controls.Add( lblTitle );  
           pane.ContentContainer.Controls.Add( lblContent );  
           this.Accordion1.Panes.Add( pane );  
         }  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7940309470223781101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7940309470223781101?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7940309470223781101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7940309470223781101'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2016/02/aspnet-dynamically-load-ajax-toolkit.html' title='ASP.NET dynamically load AJAX toolkit accordion panes'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-8540707804847105407</id><published>2015-11-25T11:45:00.003-07:00</published><updated>2017-04-20T14:13:30.515-07:00</updated><title type='text'>C# Read File one line at a time</title><content type='html'>This might seem simple, but often times you find yourself needing to read a file one line at a time no matter what language you do it in. C# makes this very easy with a StreamReader. You simply create the stream reader passing in the file name to the constructor and then call ReadLine on it. See the code below:&lt;br /&gt;
&lt;br /&gt;
&lt;pre  style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3QuL_Dfk1H2OuigG76XpcdPV4WRUzTWxiWVyJgFQ6uqXdilOguSqWsZKtV2nlQMuroYjamSVq2LNZkFm9nb6TnMCPjAmIAxqNEkNghpooFSO4mR5T_oNFk8n6bpb05qs3Ha5vQ/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; string line = null;  
 // always use a using with a stream, this ensures it gets disposed of properly  
  using(StreamReader sr = new StreamReader(fileName))  
 {  
   // we use a while loop until line == null which means end of file  
    while( (line = sr.ReadLine() ) != null )  
    {  
       // Do something here              
    }  
 }  
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/8540707804847105407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/8540707804847105407?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/8540707804847105407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/8540707804847105407'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2015/11/c-read-file-one-line-at-time.html' title='C# Read File one line at a time'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-1432108700026701743</id><published>2013-08-21T09:31:00.000-07:00</published><updated>2013-08-21T09:31:54.884-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Three simple tricks for better C# code</title><content type='html'>Here are 3 tricks that once you start using them can save you a lot of typing when dealing with C#.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The Null Coalescing Operator (??)

This is a short-cut for the ternary operator (?:) checking against a null:

&lt;pre  style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3QuL_Dfk1H2OuigG76XpcdPV4WRUzTWxiWVyJgFQ6uqXdilOguSqWsZKtV2nlQMuroYjamSVq2LNZkFm9nb6TnMCPjAmIAxqNEkNghpooFSO4mR5T_oNFk8n6bpb05qs3Ha5vQ/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt;string name = value;  
      
   if (value == null)  
   {  
     name = string.Empty;  
   }  
&lt;/code&gt;&lt;/pre&gt;

Can now be condensed into one line:

&lt;pre  style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3QuL_Dfk1H2OuigG76XpcdPV4WRUzTWxiWVyJgFQ6uqXdilOguSqWsZKtV2nlQMuroYjamSVq2LNZkFm9nb6TnMCPjAmIAxqNEkNghpooFSO4mR5T_oNFk8n6bpb05qs3Ha5vQ/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; string name = value ?? string.Empty;  
&lt;/code&gt;&lt;/pre&gt;


2. Auto properties

There is no need to define a variable for simple backing fields for most properties in C#.  In fact most things like int, strings, double i just let the compiler handle it.

&lt;pre  style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3QuL_Dfk1H2OuigG76XpcdPV4WRUzTWxiWVyJgFQ6uqXdilOguSqWsZKtV2nlQMuroYjamSVq2LNZkFm9nb6TnMCPjAmIAxqNEkNghpooFSO4mR5T_oNFk8n6bpb05qs3Ha5vQ/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; public class MyPoint  
   {  
    public int X { get; set; }  
    public int Y { get; set; }  
  }  
&lt;/code&gt;&lt;/pre&gt;

3. Is vs As

You should try and avoid the is operator when you can do an as cast.  The is requires two casts where the as does just one.  Even with the added null check it&#39;s always going to be faster to do an as vs is.

&lt;pre  style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3QuL_Dfk1H2OuigG76XpcdPV4WRUzTWxiWVyJgFQ6uqXdilOguSqWsZKtV2nlQMuroYjamSVq2LNZkFm9nb6TnMCPjAmIAxqNEkNghpooFSO4mR5T_oNFk8n6bpb05qs3Ha5vQ/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; var sq = Square as Shape;  
   if ( sq != null )  
   {  
     volume = sq.CalculateVolume();  
     // ...  
  }  
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/1432108700026701743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/1432108700026701743?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/1432108700026701743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/1432108700026701743'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2013/08/three-simple-tricks-for-better-c-code.html' title='Three simple tricks for better C# code'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7777710887058478098</id><published>2013-03-28T13:51:00.002-07:00</published><updated>2013-03-28T13:52:21.252-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="UserControls"/><title type='text'>ASP.NET User Control with Template Content</title><content type='html'>Asp.net user controls are great. &amp;nbsp;I use them all the time when working on .net websites. &amp;nbsp;I was working on a site using the asp.net ajax extender toolkit. &amp;nbsp;I created a panel that could be expanded collapsed with a button click. &amp;nbsp;I inserted a few into the site and liked them so much I made some more. &amp;nbsp;Well after the 7th panel it started getting tedious. &amp;nbsp;What a perfect place for a user control. &amp;nbsp;The problem was I needed to be able to place whatever custom content I wanted inside the panel. &amp;nbsp;After much searching around I wasn&#39;t finding what I wanted. &amp;nbsp;The answer it turns out is an asp.net user control with custom templates.&lt;br /&gt;
&lt;br /&gt;
Create a new user control for your asp.net site.&amp;nbsp; Mine is called CollapsiblePanel.&amp;nbsp; In the code behind for the page you need to add a new class MessageContainer that inherits from Control and implements the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.ui.inamingcontainer.aspx&quot; target=&quot;_blank&quot;&gt;INamingContainer Interface&lt;/a&gt;.&amp;nbsp;&amp;nbsp; Then in the user controls OnInit method you need to check for content and add it to your user control.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Test.UserControls
{
&amp;nbsp;&amp;nbsp; &amp;nbsp;// this is a message container, it contins the data we want to display
&amp;nbsp;&amp;nbsp; &amp;nbsp;// as well as the index of the container
&amp;nbsp;&amp;nbsp; &amp;nbsp;public class MessageContainer : Control, INamingContainer
&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private int index;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;internal MessageContainer(int index) { this.index = index; }
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public int Index { get { return index; } }
&amp;nbsp;&amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; // this is the user control I have created
&amp;nbsp;&amp;nbsp; //its an ajax extended collapsible panel with some custom content
&amp;nbsp;&amp;nbsp; &amp;nbsp;public partial class CollapsiblePanel : System.Web.UI.UserControl, INamingContainer
&amp;nbsp;&amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private ITemplate _contentTemplate = null;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[TemplateContainer(typeof(MessageContainer))]
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public ITemplate Content
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;get { return _contentTemplate; }
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set { _contentTemplate = value; }
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp; 
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;protected override void OnInit(EventArgs e)
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;base.OnInit(e);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// if we have a content template in the markup then add it to our container
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (_contentTemplate != null)
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MessageContainer container = new MessageContainer(0);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_contentTemplate.InstantiateIn(container);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.ContentHolder.Controls.Add(container);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp;}
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now to use our new user control in an aspx page with some content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;&amp;lt;uc:CollapsiblePanel runat=&quot;server&quot; ID=&quot;CollapsiblePanel1&quot;&amp;gt;
        &amp;lt;content&amp;gt;
          CONTENT GOES HERE,You can drop anything, asp.net controls, etc.            
        &amp;lt;/content&amp;gt;
    &amp;lt;/uc:CollapsiblePanel&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7777710887058478098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7777710887058478098?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7777710887058478098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7777710887058478098'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2013/03/aspnet-user-control-with-template.html' title='ASP.NET User Control with Template Content'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-4218936975815996957</id><published>2013-03-28T13:19:00.000-07:00</published><updated>2013-03-28T13:23:06.090-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="STL"/><category scheme="http://www.blogger.com/atom/ns#" term="Unicode"/><title type='text'>C++ convert char * to to wide string wstring</title><content type='html'>Often times when working with older code you find yourself staring at some old char* variables.  I often find myself having to convert them to wide strings for unicode support (wstring).  I created a handy function that makes this simple.

&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%&quot;&gt;&lt;code&gt;wstring charToWideString( const char* src )
{
    return std::wstring( src, src + strlen(src) );
}
&lt;/code&gt;&lt;/pre&gt;

Now simply call thus:


&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%&quot;&gt;&lt;code&gt;wstring thus = charToWideString( &quot;thus&quot; );
&lt;/code&gt;&lt;/pre&gt;

Drop this function in a static class or header file and use it anywhere.</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/4218936975815996957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/4218936975815996957?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/4218936975815996957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/4218936975815996957'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2013/03/c-convert-char-to-to-wide-string-wstring.html' title='C++ convert char * to to wide string wstring'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-7798569814581666198</id><published>2013-03-14T08:17:00.000-07:00</published><updated>2013-03-14T08:20:41.647-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>ASP.NET Create Javascript Alert on Server Side</title><content type='html'>Many times in ASP.net you find yourself needing to create an alert on the client side but you&#39;re processing on the server side.  The trick is to register a Javascript to the client from the server.  I have found a nifty way of creating a class that will allow you to do this.

&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;public static class ClientMessageBox
{

    public static void Show(string message, Control owner)
    {
        Page page = (owner as Page) ?? owner.Page;

        if (page == null)
        {
          return;
        }

        page.ClientScript.RegisterStartupScript(owner.GetType(),
            &quot;ShowMessage&quot;, string.Format(&quot;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;;alert(&#39;{0}&#39;)&amp;lt;/script&amp;gt;&quot;,
            message));

    }

}

// Example of using class and method
protected void Page_Load(object sender, EventArgs e)
{
    ClientMessageBox.Show(&quot;Hello World&quot;, this);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
You can now call ClientMessageBox.Show(&#39;text&#39;, this ); anywhere server side and get a nice javascript alert.  Now of course there are AJAX control toolkits and other things that do this for you but this is a bare bones pure C# solution.</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/7798569814581666198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/7798569814581666198?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7798569814581666198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/7798569814581666198'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2013/03/aspnet-create-javascript-alert-on.html' title='ASP.NET Create Javascript Alert on Server Side'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-2527465934187946745</id><published>2013-01-25T10:53:00.002-07:00</published><updated>2013-01-25T10:53:36.417-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="windows forms"/><title type='text'>C# Numeric Only TextBox</title><content type='html'>Once in a while you find yourself needing to stop certain keypresses in a C# desktop application.&amp;nbsp; I&#39;ve found the best way is to handle this in the keypress event of a text box.&amp;nbsp; This is some very small code that shows how to only allow numeric digits to be pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;private void textBox_KeyPress( object sender, KeyPressEventArgs e )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Handled = !char.IsDigit( e.KeyChar );
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Now if you want to allow other characters, like the decimal, etc you need to get a bit fancier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;private void textBox_KeyPress( object sender, KeyPressEventArgs e )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( char.IsDigit( e.KeyChar ) || 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.KeyChar == &#39;.&#39; )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Handled = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Handled = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
To allow more characters you just need to modify that first if parameter to your needs.</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/2527465934187946745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/2527465934187946745?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/2527465934187946745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/2527465934187946745'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2013/01/c-numeric-only-textbox.html' title='C# Numeric Only TextBox'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-3127224013813104349</id><published>2012-11-30T12:13:00.000-07:00</published><updated>2012-12-02T11:52:00.924-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Fullscreen"/><category scheme="http://www.blogger.com/atom/ns#" term="Visual C#"/><category scheme="http://www.blogger.com/atom/ns#" term="windows forms"/><title type='text'>C# Form Application in Kiosk Mode/Fullscreen</title><content type='html'>Sometimes you need to have a C# windows form application run in full screen mode. &amp;nbsp;Like you see on a kiosk at a mall or some stand alone machine. &amp;nbsp;It&#39;s fairly easy you just need to set some of the properties on the Form either in it&#39;s OnLoad method or directly in the designer.&lt;br /&gt;
&lt;br /&gt;
In the OnLoad method of the main Form set these values, or again set them directly in the designer.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;this.MaximizeBox = false;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;this.TopMost = true;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;this.WindowState = System.Windows.Forms.FormWindowState.Maximized;&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/3127224013813104349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/3127224013813104349?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/3127224013813104349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/3127224013813104349'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2012/11/c-form-application-in-kiosk.html' title='C# Form Application in Kiosk Mode/Fullscreen'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-32773047.post-6825868127581708801</id><published>2012-11-14T14:47:00.000-07:00</published><updated>2012-11-14T14:51:48.545-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="Strings"/><title type='text'>C# String Performance</title><content type='html'>In C# I have read a lot of debate over which way is the best way to do String&amp;nbsp;Concatenation. &amp;nbsp;I have often read never ever use String1 + String2 due to the memory allocations and time constraints. &amp;nbsp;I decided to run some tests on the various way of doing String manipulation. &amp;nbsp;The table below shows the iterations, total times, and average times for some common way of doing string addition. &amp;nbsp;This was just a test of time, there was no memory consumption test. &amp;nbsp;All tests were doing adding 7 strings together that were stored in variable names. &amp;nbsp;There was no string a = &quot;a&quot; + &quot;b&quot;; &amp;nbsp;It was all string a &amp;nbsp;= var1 + var2; &amp;nbsp;These were creating a single string for the listed iterations using the method(s) below.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I was surprised to see the + method came out ahead in all the tests. &amp;nbsp;String builder came in a close second. &amp;nbsp;String.Format was extremely slow but allows for localization which is another story. &lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1px solid white;&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th nowrap=&quot;nowrap&quot;&gt;iterations&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;String +&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;average&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;String.Concat&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;average&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;String.Format&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;average&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;StringBuilder&lt;/th&gt;
&lt;th nowrap=&quot;nowrap&quot;&gt;average&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0.001&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0.0004&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;0.0007&lt;/td&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;td&gt;0.0021&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0.0004&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100000&lt;/td&gt;
&lt;td&gt;38&lt;/td&gt;
&lt;td&gt;0.00038&lt;/td&gt;
&lt;td&gt;82&lt;/td&gt;
&lt;td&gt;0.00082&lt;/td&gt;
&lt;td&gt;69&lt;/td&gt;
&lt;td&gt;0.00069&lt;/td&gt;
&lt;td&gt;44&lt;/td&gt;
&lt;td&gt;0.00044&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000000&lt;/td&gt;
&lt;td&gt;272&lt;/td&gt;
&lt;td&gt;0.000272&lt;/td&gt;
&lt;td&gt;525&lt;/td&gt;
&lt;td&gt;0.000525&lt;/td&gt;
&lt;td&gt;784&lt;/td&gt;
&lt;td&gt;0.000784&lt;/td&gt;
&lt;td&gt;306&lt;/td&gt;
&lt;td&gt;0.0003067&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000000&lt;/td&gt;
&lt;td&gt;2569&lt;/td&gt;
&lt;td&gt;0.0002569&lt;/td&gt;
&lt;td&gt;5133&lt;/td&gt;
&lt;td&gt;0.0005133&lt;/td&gt;
&lt;td&gt;6245&lt;/td&gt;
&lt;td&gt;0.0006245&lt;/td&gt;
&lt;td&gt;2917&lt;/td&gt;
&lt;td&gt;0.0002917&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://justins-fat-tire.blogspot.com/feeds/6825868127581708801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/32773047/6825868127581708801?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/6825868127581708801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/32773047/posts/default/6825868127581708801'/><link rel='alternate' type='text/html' href='http://justins-fat-tire.blogspot.com/2012/11/c-string-performance.html' title='C# String Performance'/><author><name>jlechem</name><uri>http://www.blogger.com/profile/14670970446696919360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwUepqN4n6OXskLajHijyUOdsRoJ_PlAdAGztoh-4kHJEEw7hf1htPE86Uv5ZHm49_JF8ZaEyzWvjHGe9hW-1bFrGOcIOTjjUa3l_y_1c4Hm3r8jfC06MPsxJXomFzWg/s220/62425268_10158662577957782_6830676555463655424_o.jpg'/></author><thr:total>0</thr:total></entry></feed>