<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BertHileman.com</title>
	<atom:link href="http://www.berthileman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.berthileman.com</link>
	<description>A Plethora of Verbal Verbosity or Nobody Cares but Me</description>
	<lastBuildDate>Fri, 01 Apr 2011 17:27:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>PHP ICS File Nugget</title>
		<link>http://www.berthileman.com/2011/04/php-ics-file-nugget/</link>
		<comments>http://www.berthileman.com/2011/04/php-ics-file-nugget/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 17:27:06 +0000</pubDate>
		<dc:creator>Bert</dc:creator>
				<category><![CDATA[Who Cares]]></category>
		<category><![CDATA[iCalendar]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.berthileman.com/?p=34</guid>
		<description><![CDATA[I typically don&#8217;t work in PHP but I have really great friend in Atlanta who sends me some php work every so often and I can&#8217;t pass up the opportunity to work with him and make a little extra money. The most recent project he wanted was a little ICS generator. ICS is the iCalendar [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I typically don&#8217;t work in PHP but I have really great friend in Atlanta who sends me some php work every so often and I can&#8217;t pass up the opportunity to work with him and make a little extra money. </p>
<p>The most recent project he wanted was a little ICS generator. ICS is the iCalendar format that can be consumed by either Outlook or Google Calendar or any other calendaring utility that can accept that standard format. We needed to be able to provide some custom information and have some static information and send the ICS file into the response stream from the server so they could download the file. </p>
<p>I did a quick search and came across this <a href="http://blog.jamiebicknell.com/post/413492676/ics-generator-php-class">excellent iCal class</a> that is lightweight and did everything I needed it to do. With a couple of query string parameters being consumed on the other end I was able to have it output my custom iCal information rather quickly. If anyone is interested in the rest of the code for the iCal stuff please reply to this feed and I&#8217;ll post it.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.berthileman.com/2011/04/php-ics-file-nugget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centering Fixed and Absolutely Positioned Elements</title>
		<link>http://www.berthileman.com/2011/02/centering-fixed-and-absolutely-positioned-elements/</link>
		<comments>http://www.berthileman.com/2011/02/centering-fixed-and-absolutely-positioned-elements/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 16:49:33 +0000</pubDate>
		<dc:creator>Bert</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Positioning]]></category>
		<category><![CDATA[Styling]]></category>

		<guid isPermaLink="false">http://www.berthileman.com/?p=21</guid>
		<description><![CDATA[So this is not a C# or .Net specific post, but I ran into a problem and needed a solution. I am working on a project where the Ajax ControlToolkit was just not an option. I therefore decided to do my own &#8220;modal popup&#8221; controls by using some fixed divs. I like fixed divs because [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>So this is not a C# or .Net specific post, but I ran into a problem and needed a solution. I am working on a project where the Ajax ControlToolkit was just not an option. I therefore decided to do my own &#8220;modal popup&#8221; controls by using some fixed divs. I like fixed divs because then if there is a scroll bar on the page the divs continue to take up the full page. The issue with this is that when you use fixed positioning or absolute positioning you can&#8217;t set the margin to auto to make it center the div as it would in normal page flow layout. This means you need to implement some kind of left or right positioning.<br />
After failing to come up with an adequate solution to this issue I found a post here: http://www.webdeveloper.com/forum/showthread.php?t=104109 that contained the answer to the question.<br />
You simply change your styling to be the following:<br />
<code><br />
.PopUpContent<br />
{<br />
&nbsp;&nbsp;postion:fixed;<br />
&nbsp;&nbsp;top: 100px;<br />
&nbsp;&nbsp;left: 50%; /*this will put the left edge 50% of the way across the screen*/<br />
&nbsp;&nbsp;margin-left: -<1/2 the width of the div>px; /*this will drag the content back the stated number of pixels*/<br />
}<br />
</code><br />
It just works. I&#8217;ve tried it in IE 7, 8 and FF. I am guessing we&#8217;ll get similar results in Chrome and Safari as well but I didn&#8217;t bother to test those just yet.<br />
Again, this post is more for my reference than anything else but if you find it useful you are welcome to use it!</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.berthileman.com/2011/02/centering-fixed-and-absolutely-positioned-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot have multiple items selected in a DropDownList</title>
		<link>http://www.berthileman.com/2011/01/cannot-have-multiple-items-selected-in-a-dropdownlist/</link>
		<comments>http://www.berthileman.com/2011/01/cannot-have-multiple-items-selected-in-a-dropdownlist/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 15:06:30 +0000</pubDate>
		<dc:creator>Bert</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Strange Errors]]></category>

		<guid isPermaLink="false">http://www.berthileman.com/?p=17</guid>
		<description><![CDATA[This error caused me at least an hour of research and nothing really helped. I found this error in an application I was building to test out some features in a Web Service I&#8217;d created. I was building a couple of ASP.Net DropDownLists to hold Day, Minute, and Hour values and just threw all of [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>This error caused me at least an hour of research and nothing really helped. I found this error in an application I was building to test out some features in a Web Service I&#8217;d created. I was building a couple of ASP.Net DropDownLists to hold Day, Minute, and Hour values and just threw all of those items into a loop. Here is the code I was using:<br />
<code><br />
 protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        if (!IsPostBack)<br />
        {<br />
            for (int i = 0; i < 60; i++)<br />
            {<br />
                ListItem li = new ListItem(i.ToString("00");<br />
                DeliveryMinute.Items.Add(li);</p>
<p>                if (i < 24)<br />
                    DeliveryHour.Items.Add(li);</p>
<p>                if (i >= 1 &#038;&#038; i < 32)<br />
                {<br />
                    if (i == DateTime.Now.Day)<br />
                    {<br />
                        li.Selected = true;<br />
                        DeliveryDay.Items.Add(li);<br />
                    }<br />
                    else<br />
                        DeliveryDay.Items.Add(li);<br />
                }<br />
            }</p>
<p>            SetListWithMonths();<br />
            DeliveryYear.Text = DateTime.Now.Year.ToString();<br />
            DeliveryHour.SelectedIndex = 0;<br />
            DeliveryMinute.SelectedIndex = 0;</p>
<p>        }<br />
    }<br />
</code><br />
Unfortunately, this code failed miserably. I could not get anything but the first item in the list to be selected. So instead I decided that the selected index would have to be set as one of the last items in the Page_Load event. I then added this before the end of the postback conditional:<br />
<code>DeliveryDay.SelectedIndex = DateTime.Now.Day - 1; </code><br />
That is when the errors started occurring. I tried to clear the selection using <code>DeliveryDay.ClearSelection();</code> to give me the desired result of clearing the selected item before I set the index of the item I wanted. This also generated the same errors. I continued to try to resolve this issue by using the FindByText() and FindByValue() methods and even tried to change my list item values by adding the date to them thinking there might be something wrong with the value and the text being the same. Of course that was not the case.<br />
Eventually I started thinking about the ListItem object. I realized that I was adding the same object to each of DropDownList's ItemCollection object. I finally realized that this was my error. So I changed my code to this:<br />
<code><br />
protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        if (!IsPostBack)<br />
        {<br />
            for (int i = 0; i < 60; i++)<br />
            {</p>
<p>                DeliveryMinute.Items.Add(i.ToString("00"));</p>
<p>                if (i < 24)<br />
                    DeliveryHour.Items.Add(i.ToString("00"));</p>
<p>                if (i >= 1 &#038;&#038; i < 32)<br />
                {<br />
                    if (i == DateTime.Now.Day)<br />
                    {<br />
                        ListItem li = new ListItem(i.ToString());<br />
                        li.Selected = true;<br />
                        DeliveryDay.Items.Add(li);<br />
                    }<br />
                    else<br />
                        DeliveryDay.Items.Add(i.ToString());<br />
                }<br />
            }</p>
<p>            SetListWithMonths();<br />
            DeliveryYear.Text = DateTime.Now.Year.ToString();<br />
            DeliveryHour.SelectedIndex = 0;<br />
            DeliveryMinute.SelectedIndex = 0;<br />
        }<br />
    }<br />
</code><br />
Now, each list contains their own ListItem object and there can be no sharing of the object between the different lists. I had mistakenly believed that each ListItem added to the collection would be passed by Value and that setting the Selected list item in one list would not affect the selected item in another list. After the page loads this seems to be the case but when initializing the page content using the same list item it can cause a world of grief.<br />
I hope this post saves someone else a bunch of time because the information is invaluable to me!</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.berthileman.com/2011/01/cannot-have-multiple-items-selected-in-a-dropdownlist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multi-threading in WPF 4.0</title>
		<link>http://www.berthileman.com/2011/01/multi-threading-in-wpf-4-0/</link>
		<comments>http://www.berthileman.com/2011/01/multi-threading-in-wpf-4-0/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 20:42:22 +0000</pubDate>
		<dc:creator>Bert</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Multi-Threading]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.berthileman.com/?p=9</guid>
		<description><![CDATA[I have to build a desktop application and decided it was about time I played with Windows Presentation Foundation because it has some exciting options when it comes to building applications. The basic concept for this application is that it will run all the time and use background worker threads to accomplish various tasks. I [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I have to build a desktop application and decided it was about time I played with Windows Presentation Foundation because it has some exciting options when it comes to building applications. The basic concept for this application is that it will run all the time and use background worker threads to accomplish various tasks.</p>
<p>I had to learn how WPF manages the display thread. I am typically a web developer so I don&#8217;t often work in a multi-threaded environment for desktop applications. I knew I needed a thread that managed the display of each object but I didn&#8217;t know how to pump those messages back to the display object from my background thread. I decided I would research it.</p>
<p>I found that WPF uses something called the Dispatcher which manages the thread that is allowed to update the display. I found a couple of tutorials which walked you through creating new threads using the Dispatcher to spawn those threads. I don&#8217;t know how well it worked though because as I tried to add some fake application latency &#8220;Thread.Sleep(2000)&#8221; the whole display object would sleep for those two seconds. That is not what I wanted at all. This is the code I was using to spawn a new StartApplication Thread.</p>
<p>this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new StartUpApp(StartUpApplication));</p>
<p>Where StartUpApp was my delegate and StartUpApplication was the method that matched the delegate signature.</p>
<p>Anyway, that was failing miserably so I was talking to a friend of mine who&#8217;s worked with his own multi-threaded applications and we talked about threading in general. He really didn&#8217;t help me along in the process, so I took a short break from what I was working on.</p>
<p>I came back to reading more documentation on the MDSN and realized that the Dispatcher message pump would always push messages back to the display thread. This meant that any Thread that was started could call back to the Dispatcher and send those messages back. So, here is what I finally came up with:</p>
<p><code><br />
 private void StartAppButton_Click(object sender, RoutedEventArgs e)<br />
        {<br />
            i = 0;<br />
            Thread startUp = new System.Threading.Thread(StartUpApplication);<br />
            startUp.Start();<br />
        }</p>
<p>public delegate void UpdateLabelDelegate(Label lb, string message);<br />
bool shouldContinue = true;</p>
<p>        public void StartUpApplication()<br />
        {</p>
<p>            while (shouldContinue)<br />
            {<br />
                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new UpdateLabelDelegate(UpdateLabel), ApplicationStatus, "Checking for job to process");<br />
                Thread.Sleep(2000);<br />
                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new UpdateLabelDelegate(UpdateLabel), ApplicationStatus, "Processing newest Job");<br />
                Thread.Sleep(2000);<br />
                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new UpdateLabelDelegate(UpdateLabel), ApplicationStatus, "Processing Completed");<br />
            }<br />
        }</p>
<p>public static void UpdateLabel(Label lb, string message)<br />
        {<br />
            lb.Content = message;<br />
        }</p>
<p></code></p>
<p>This was exactly what I was looking for. Now that I can pump messages back to the display from the processing thread I can flush out the rest of the functionality of the application.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.berthileman.com/2011/01/multi-threading-in-wpf-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://www.berthileman.com/2010/08/hello-world/</link>
		<comments>http://www.berthileman.com/2010/08/hello-world/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 23:40:17 +0000</pubDate>
		<dc:creator>Bert</dc:creator>
				<category><![CDATA[Who Cares]]></category>

		<guid isPermaLink="false">http://www.berthileman.com/?p=1</guid>
		<description><![CDATA[Do you ever discover some cryptic bit of information that solves the programming problem you are having at the moment and can&#8217;t find a place to document that fix? That is what has been happening with me lately. There seem to be a growing number of times where I figure something out and then have [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Do you ever discover some cryptic bit of information that solves the programming problem you are having at the moment and can&#8217;t find a place to document that fix? That is what has been happening with me lately. There seem to be a growing number of times where I figure something out and then have to go back and search through the code I&#8217;ve written for the fix I&#8217;ve already applied to a different site. I figured if I can just keep track of it in a blog then I&#8217;ll be so much better off. So&#8230;.Hello World! Here comes Bert&#8217;s blog. I hope it is not just a waste of internet space!</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.berthileman.com/2010/08/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

