<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Chris Kaczor</title>
  <subtitle>Code, Critters, and whatever I feel like writing about.</subtitle>
  <link href="https://chriskaczor.com/feed/feed.xml" rel="self" />
  <link href="https://chriskaczor.com/" />
  <updated>2024-11-11T00:00:00Z</updated>
  <id>https://chriskaczor.com/</id>
  <author>
    <name>Chris Kaczor</name>
  </author>
  <entry>
    <title>Where did the time go?</title>
    <link href="https://chriskaczor.com/blog/where-did-the-time-go/" />
    <updated>2024-11-11T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/where-did-the-time-go/</id>
    <content type="html">&lt;p&gt;Whoa - where the hell did all the time go?!  I knew in the back of my mind that I was being a huge slacker by not updating in a while, but almost 5 years?  That&#39;s crazy!  My initial reaction was that the timestamp of my last post had gotten screwed up somehow, but the details of what I wrote proves that the time is right.&lt;/p&gt;
&lt;p&gt;I&#39;ll fill in more details in upcoming posts but some highlights of the last 5 years:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Continued working on my software and hardware projects&lt;/li&gt;
&lt;li&gt;Starting playing around with 3D printing&lt;/li&gt;
&lt;li&gt;Took a fairly intensive master&#39;s degree program in software engineering&lt;/li&gt;
&lt;li&gt;Cataract surgery for my right eye (my left was April 2018 which I never wrote about)&lt;/li&gt;
&lt;li&gt;Made it through all the craziness of 2020 and beyond&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&#39;m sure there are other things, but they&#39;re not coming to mind right now - I&#39;ll bring them up if I think of them later.&lt;/p&gt;
&lt;p&gt;If you&#39;ve been here before you might notice that this site looks completely different now.  I had been using WordPress because I wanted something easy - I had a feeling that if I picked something that needed some coding I&#39;d end up getting lost in all of that rather that writing, but with dispute between WordPress and WP Engine (and some stuff done by Mullenweg that I think is pretty shady) I decided it was time to bail on it completely.  The site has switched to Eleventy, and I&#39;ve done some minimal tweaking to make it look the way I want for now.  I&#39;m sure I&#39;ll end up making some adjustments as I go, but I need to just make the switch and go with it.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Back Again</title>
    <link href="https://chriskaczor.com/blog/back-again/" />
    <updated>2019-12-13T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/back-again/</id>
    <content type="html">&lt;p&gt;When I started this blog I had recently been laid off and figured it was as good a time as any to give some visibility to the code I had been creating over the years rather than hoarding it like a jealous dragon. I intended to keep up with it but then I started a new job and the writing sort of fell by the wayside. I kept working on projects when I could but never really got the chance to write about them. I&#39;m hoping to be a bit more consistent this time around but only time will tell.&lt;/p&gt;
&lt;p&gt;I&#39;ve been mostly working on completely recreating my home monitoring project with both new hardware and software - I&#39;ll write more about that in upcoming posts.&lt;/p&gt;
&lt;p&gt;For the last week or so I&#39;ve been doing &lt;a href=&quot;https://adventofcode.com/&quot;&gt;Advent of Code 2019&lt;/a&gt; so that I can follow along with my son. He got a good head start due to a few snow days at the beginning of the month but I&#39;ve gotten ahead of him a bit as the challenges have gotten harder. We just spent some time getting his Intcode computer for day 9 working properly and I nearly swore off the entire contest while doing the second part of day 12 - the coding for that part wasn&#39;t really a problem but it took me a bit to figure out the concept for doing it without brute force. I think it would have been more fair if the challenge better explained how to solve the problem and left the coding up to the participant but that&#39;s probably just me being whiny. =) We&#39;ve been posting our code in our GitHub repos in case anyone wants a peek:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/ckaczor/Advent2019&quot;&gt;https://github.com/ckaczor/Advent2019&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Zakury/Advent-of-Code&quot;&gt;https://github.com/Zakury/Advent-of-Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&#39;ve been working in C# and he has been doing it in Python so it has been interesting to compare the two languages. I&#39;ve been trying to get him to debug with breakpoints in Visual Studio Code rather than going old-school with print statements. It is definitely a process but we&#39;re getting there!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Etsy Shop Widget</title>
    <link href="https://chriskaczor.com/blog/etsy-shop-widget/" />
    <updated>2018-04-20T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/etsy-shop-widget/</id>
    <content type="html">&lt;p&gt;My wife and a friend run The Crafty Coop (edit: now closed) - an event planning business that also sells handmade party decorations/favors online and at craft shows. One of the ways I help out is as the designated &amp;quot;IT guy&amp;quot; by handling the web/email hosting and other technical stuff.&lt;/p&gt;
&lt;p&gt;When we were initially setting up the website using WordPress we looked for a widget that would generate a listing of their Etsy shop items but we weren&#39;t really happy with the ones we found - they either required that the Etsy shop be broken up into sections or they didn&#39;t quite display the way we wanted. I decided to try to write my own instead of tweaking one of the existing ones and &lt;a href=&quot;https://github.com/ckaczor/etsy-shop-widget&quot;&gt;Etsy Shop Widget&lt;/a&gt; was born.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/etsy-shop-widget/images/etsy-shop-widget-widget.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/ZuxNaFUA1y-280.avif 280w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/ZuxNaFUA1y-280.webp 280w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/ZuxNaFUA1y-280.png&quot; alt=&quot;&quot; width=&quot;280&quot; height=&quot;391&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I decided early on that I wanted to avoid generating the HTML in PHP as much as possible. I knew I&#39;d have use some PHP for the WordPress admin settings but I wanted to use a front-end framework for the widget itself. I was already using &lt;a href=&quot;https://vuejs.org/&quot;&gt;Vue.js&lt;/a&gt; in other projects so when I found a &lt;a href=&quot;https://github.com/caldera-learn/vue-webpack-wordpress-plugin&quot;&gt;template project&lt;/a&gt; for creating a WordPress plugin that used Vue.js I was good to go.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.etsy.com/developers/documentation/getting_started/api_basics&quot;&gt;Etsy API&lt;/a&gt; requires an API key and is rate limited so I wanted to cache the results rather than fetch them each time the page loaded. I added standard WordPress settings for the API key, the shop name, and the cache time and put them all in a settings section.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/etsy-shop-widget/images/etsy-shop-widget-settings.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/rbvGYcCS3i-544.avif 544w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/rbvGYcCS3i-544.webp 544w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/rbvGYcCS3i-544.png&quot; alt=&quot;&quot; width=&quot;544&quot; height=&quot;289&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Right now this limits the widget to only one shop per WordPress installation but that&#39;s all we need right now. In the future I&#39;ll move the shop name to an attribute of the widget instead.&lt;/p&gt;
&lt;p&gt;On the back end I created a custom WordPress action that uses the WordPress &lt;a href=&quot;https://codex.wordpress.org/Transients_API&quot;&gt;transients API&lt;/a&gt; to store the cached data from Etsy. Basically if get_transient returns some data then that data is simply returned to the caller, otherwise wp_remote_request is used to make the call to the Etsy API and the returned data is stored using set_transient with the appropriate cache duration.&lt;/p&gt;
&lt;pre class=&quot;language-php&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;ESW_Listings_request&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$listings&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;get_transient&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;etsy_shop_widget_listings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$listings&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token variable&quot;&gt;$options&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;get_option&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;ESW_settings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token variable&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wp_remote_request&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;https://openapi.etsy.com/v2/shops/&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;ESW_Etsy_Shop_Name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;/listings/active?includes=MainImage&amp;amp;amp;amp;amp;amp;amp;api_key=&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;ESW_Etsy_API_Key&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token variable&quot;&gt;$listings&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;body&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token function&quot;&gt;set_transient&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;etsy_shop_widget_listings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$listings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;ESW_Cache_Time&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$listings&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;die&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;add_action&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;admin_post_esw_listings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;ESW_Listings_request&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;add_action&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;admin_post_nopriv_esw_listings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;ESW_Listings_request&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The rest of the PHP side is pretty straightforward - there&#39;s an &amp;quot;[etsy-shop-widget]&amp;quot; shortcode that generates an empty div with an ID of &amp;quot;etsy-shop-widget&amp;quot; that is used as the root of the Vue.js application and some code that links the styles and scripts generated by webpack when building the Vue.js code.&lt;/p&gt;
&lt;p&gt;The front-end code is currently pretty basic as well. The Vue.js application just makes an AJAX request to the WordPress custom action, stores the resulting data in a component, and then uses the data to render a list of the item names, pictures, and prices.&lt;/p&gt;
&lt;pre class=&quot;language-jscript&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-jscript&quot;&gt;@Component
export default class App extends Vue {
	listings: Array&lt;EtsyListing&gt; | null = null;

	async mounted() {
		const response = await Axios.get&lt;EtsyResult&gt;(window[&#39;esw_wp&#39;].siteurl + &#39;/wp-admin/admin-post.php?action=esw_listings&#39;);

		this.listings = response.data.results.sort((a, b) =&gt; a.last_modified_tsz - b.last_modified_tsz);
	}
}&lt;/EtsyResult&gt;&lt;/EtsyListing&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-xml&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-xml&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;template&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;esw-listing-container&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;esw-listing-item&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;v-for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;listing in listings&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;&lt;span class=&quot;token namespace&quot;&gt;v-bind:&lt;/span&gt;key&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;listing.listing_id&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;:href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;listing.url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;_blank&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
				&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;esw-listing-item-image&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;:src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;listing.MainImage.url_170x135&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;

			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;:href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;listing.url&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;_blank&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
				&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;esw-listing-item-title&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;v-html&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;listing.title&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;

			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;esw-listing-item-price&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
				
				
			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;template&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At some point I&#39;d like the make the listing a little fancier - maybe with a single image and previous/next buttons rather than a simple scrolling list but we&#39;re happy with the way it is working for now.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Feed Center</title>
    <link href="https://chriskaczor.com/blog/feed-center/" />
    <updated>2018-04-04T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/feed-center/</id>
    <content type="html">&lt;p&gt;One of my most complete projects is &lt;a href=&quot;https://github.com/ckaczor/FeedCenter&quot;&gt;Feed Center&lt;/a&gt; - an RSS feed reader designed to blend in with the Windows desktop.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/feed-center/images/Feed-Center.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/uZeAJYpepW-300.avif 300w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/uZeAJYpepW-300.webp 300w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/uZeAJYpepW-300.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;188&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Years ago when push technology was the hot new thing I got my online news from applications like PointCast and MSNBC News Alert - but they were eventually discontinued as web sites moved to other delivery mechanisms like RSS feeds. I tried to find an RSS reader but never really found one that I liked. I didn&#39;t want some Outlook lookalike that I had to specifically open and read through. I wanted an app that would blend in with my desktop as much as possible and be something that I could glance at every so often for the latest news. At some point I started fiddling with creating my own and Feed Center is the result.&lt;/p&gt;
&lt;p&gt;In theory Feed Center supports all of the common RSS versions and Atom with some special handling for common errors. The fact that I&#39;m parsing the feeds with an XML parser makes it a little harder to handle the edge cases but it works well enough so far.&lt;/p&gt;
&lt;p&gt;Feeds are added in a &amp;quot;default&amp;quot; category but they can optionally be organized into any number of other categories. The top of the main window has a selector for the current category - I&#39;m not sure I like the way it looks but I haven&#39;t come up with anything better yet.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/feed-center/images/Options-Feed.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/4GWlZwTcq7-706.avif 706w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/4GWlZwTcq7-706.webp 706w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/4GWlZwTcq7-706.png&quot; alt=&quot;&quot; width=&quot;706&quot; height=&quot;353&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The arrows at the top of the window (as well as mouse buttons 4 and 5 if you have them) will scroll through the feeds in the current category in alphabetical order. The current feed will also scroll automatically every minute unless the mouse is hovering over the window - it would be annoying to have the feed change when you&#39;re getting ready to read one.&lt;/p&gt;
&lt;p&gt;Double clicking an article will open the web page for the article. By default the system default browser will be used but there&#39;s an option to choose another browser instead. There&#39;s also buttons to open all of the articles for the current feed and to mark all of the articles as having been read.&lt;/p&gt;
&lt;p&gt;The code base has had some major changes over the years - originally the UI was done using WinForms and I used XML files as storage. After a few corrupt XML files from power failures I switched to using SQLite and then to SQL Server Compact. At some point I rewrote the UI using WPF so I could get rid of a bunch of custom painting for the feed list.&lt;/p&gt;
&lt;p&gt;The project has a full installer created with &lt;a href=&quot;http://wixtoolset.org/&quot;&gt;WiX&lt;/a&gt; that uses a &lt;a href=&quot;https://github.com/ckaczor/WixBalExtensionExt&quot;&gt;modified bootstrapper&lt;/a&gt; to automatically relaunch the application after an upgrade.&lt;/p&gt;
&lt;p&gt;Other than the code on GitHub I haven&#39;t made anything public yet but I plan to use &lt;a href=&quot;https://www.appveyor.com/&quot;&gt;AppVeyor&lt;/a&gt; for build and deployment at some point - probably with the installer served as a GitHub release.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Laundry Monitor – Software</title>
    <link href="https://chriskaczor.com/blog/laundry-monitor-software/" />
    <updated>2018-04-02T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/laundry-monitor-software/</id>
    <content type="html">&lt;p&gt;The software side of &lt;a href=&quot;https://github.com/ckaczor/LaundryMonitor&quot;&gt;LaundryMonitor&lt;/a&gt; is currently pretty straightforward. The &lt;a href=&quot;https://getchip.com/pages/chip&quot;&gt;C.H.I.P.&lt;/a&gt; runs a Node.js application that keeps track of a GPIO pin for each current switch - when the switch is closed the appliance is on and when the switch is open the appliance is off. The application exposes a websocket that applications like &lt;a href=&quot;https://github.com/ckaczor/HomeStatusWindow&quot;&gt;HomeStatusWindow&lt;/a&gt; can watch and messages are sent to a family Telegram channel.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/laundry-monitor-software/images/HomeStatusWindow.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/t0izVudIyW-107.avif 107w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/t0izVudIyW-107.webp 107w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/t0izVudIyW-107.png&quot; alt=&quot;&quot; width=&quot;107&quot; height=&quot;48&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/laundry-monitor-software/images/LaundryBot.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/MWYQsdWfr9-238.avif 238w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/MWYQsdWfr9-238.webp 238w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/MWYQsdWfr9-238.png&quot; alt=&quot;&quot; width=&quot;238&quot; height=&quot;300&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I use the &lt;a href=&quot;https://github.com/fivdi/onoff&quot;&gt;onoff&lt;/a&gt; library to poll the GPIO pins every 500 milliseconds and wait for a pin to be steady for 10 seconds before registering the new state. Originally I tried to use an interrupt but during testing I found that the onoff library could get stuck if switch events came in too fast. I decided that I didn&#39;t need real-time updates so a polling mechanism would be enough. I also originally didn&#39;t have the 10 second wait time but I found that the washer had a few periods where it would stop completely between wash phases and it made the Telegram alerts somewhat spammy. It looks like there have been a lot of updates to onoff since I first created the application so I plan to see if the interrupt issue has been fixed and if I can use the new debounce support rather than my own custom code.&lt;/p&gt;
&lt;p&gt;Since I&#39;m planning to monitor more devices in the future I&#39;m thinking about making the application that runs on each C.H.I.P. generic and moving the alert and websocket implementation to a central &amp;quot;home monitor&amp;quot; service. The monitor application on each C.H.I.P. would be the same (other than configuration settings) and just report the status to the central service which would be in charge of everything else.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Laundry Monitor - Hardware</title>
    <link href="https://chriskaczor.com/blog/laundry-monitor-hardware/" />
    <updated>2018-03-29T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/laundry-monitor-hardware/</id>
    <content type="html">&lt;p&gt;The next project up is &lt;a href=&quot;https://github.com/ckaczor/LaundryMonitor&quot;&gt;LaundryMonitor&lt;/a&gt; which uses the most hardware of anything I&#39;ve done so far.&lt;/p&gt;
&lt;p&gt;I&#39;d always wanted something that would let us tell if the washing machine or dryer was running but I never knew exactly the right way to detect it. After we got our solar panels I was doing research on how to track power usage and came across an article about current sensors and had the idea that I could hook up a current sensor to each appliance and watch the output voltage to know if the appliance was running. While trying to find a decent sensor I stumbled across a current switch which was more or less the same idea but had everything in one package - when the current was over a certain threshold the switch would close and that could be easily detected.&lt;/p&gt;
&lt;p&gt;My first thought was to use a &lt;a href=&quot;http://www.powerswitchtail.com/powerstate-tail&quot;&gt;PowerState Tail&lt;/a&gt; but only a 120V version was available - there was nothing like it I could use for the 240V of the dryer. Eventually I settled on a &lt;a href=&quot;https://smile.amazon.com/gp/product/B00I9IFJOM/ref=oh_aui_search_detailpage?ie=UTF8&amp;amp;psc=1&quot;&gt;Dwyer Miniature Current Switch&lt;/a&gt; and I&#39;d use one each for both the washer and dryer just to be consistent.&lt;/p&gt;
&lt;p&gt;Next up was to figure out how to monitor the switch. I was going to use a &lt;a href=&quot;https://www.phidgets.com/?tier=1&amp;amp;catid=2&amp;amp;pcid=1&quot;&gt;Phidget I/O Board&lt;/a&gt; attached to a central server and run wires across the house from the washer and dryer to the I/O board but the idea of running all the wires wasn&#39;t too appealing. I was about to try some sort of &lt;a href=&quot;https://www.sparkfun.com/pages/xbee_guide&quot;&gt;XBee&lt;/a&gt; setup when I found the &lt;a href=&quot;https://getchip.com/pages/chip&quot;&gt;C.H.I.P.&lt;/a&gt; Kickstarter and it seemed like it was worth a try - the C.H.I.P. was cheap, had digital I/O, had WiFi, and I could use anything that&#39;d run on Linux to make it all work. The full board is probably a bit of overkill for just monitoring two switches but at $9 a device it really didn&#39;t bother me that much.&lt;/p&gt;
&lt;p&gt;Hooking up the dryer was relatively easy - I opened the control panel, used the schematic to find the wire that powers the motor, disconnected the wire, ran the wire through the current switch, and reconnected the wire. I mounted the sensor on the back of the dryer for easy access in case I needed to adjust it but the motor draws enough current that the switch was able to detect it easily.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/laundry-monitor-hardware/images/Dryer.jpg&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/7D8kV0Tyqw-225.avif 225w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/7D8kV0Tyqw-225.webp 225w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/7D8kV0Tyqw-225.jpeg&quot; alt=&quot;&quot; width=&quot;225&quot; height=&quot;300&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The washer was pretty much the same but I decided to monitor the main power line so I could detect if the washer was running at any point in the cycle. The trouble was that at certain times (like when the washer was filling) the current draw was way too low for the switch to detect even with the sensitivity set as low as possible. I solved this by looping the wire through the sensor several times to amplify the current to the point where the switch could pick it up.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/laundry-monitor-hardware/images/Washer.jpg&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/Qvfav4t14w-225.avif 225w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/Qvfav4t14w-225.webp 225w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/Qvfav4t14w-225.jpeg&quot; alt=&quot;&quot; width=&quot;225&quot; height=&quot;300&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From here on out things were simple - I just had to run some smaller wires from the switch to the digital I/O ports on the C.H.I.P. and then start working on the software. I ended up sticking the C.H.I.P. a few feet away by the power outlet so I didn&#39;t need too long a USB cable to power it.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/laundry-monitor-hardware/images/Chip.jpg&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/y6v3-1HpL1-225.avif 225w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/y6v3-1HpL1-225.webp 225w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/y6v3-1HpL1-225.jpeg&quot; alt=&quot;&quot; width=&quot;225&quot; height=&quot;300&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So far this has been running for a little over two years and the hardware continues to work well. I&#39;m planning to do a similar build to monitor two sump pumps - the only change is that I&#39;m planning to use the PowerState Tail since they&#39;re both 120V with standard plugs so it&#39;ll be a lot easier to hook up.&lt;/p&gt;
&lt;p&gt;I&#39;ll cover the software side of the project in my next post - right now the monitor is a standalone service that does all the work but since I&#39;m going to be adding more devices I&#39;m thinking that I need to break things up a bit.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Work Indicator</title>
    <link href="https://chriskaczor.com/blog/work-indicator/" />
    <updated>2018-03-19T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/work-indicator/</id>
    <content type="html">&lt;p&gt;I&#39;m going to take a break from status windows for a little bit to cover my &lt;a href=&quot;https://github.com/ckaczor/WorkIndicator&quot;&gt;WorkIndicator&lt;/a&gt; project.&lt;/p&gt;
&lt;p&gt;I&#39;ve been working remotely for almost 14 years now and my family found it hard to tell when I was working or on the phone. It often looks the same whether I&#39;m working or not - I&#39;m sitting at my computer, sometimes with my headset on. At some point I came across a &lt;a href=&quot;https://www.hanselman.com/blog/IsDaddyOnACallABusyLightPresenceIndicatorForLyncForMyHomeOffice.aspx&quot;&gt;blog post&lt;/a&gt; by Scott Hanselman that described hooking up a status light to Lync and I was inspired to create something similar.&lt;/p&gt;
&lt;p&gt;The first task was to find something I could use as a status light - after some research I settled on a &lt;a href=&quot;https://www.delcomproducts.com/productdetails.asp?PartNumber=907241&quot;&gt;USB HID Green/Yellow/Red Visual Indicator&lt;/a&gt; from Delcom. I liked that it had a stoplight design and it came with a C# sample - perfect!&lt;/p&gt;
&lt;p&gt;My main workflow is to connect to my work system using Microsoft Remote Desktop so the easiest way to detect if I am working or not is to look for the remote desktop window. I created a class that uses SetWinEventHook to get ObjectCreate, ObjectDestroy, and ObjectNameChanged events and watch for a window with the title of my remote desktop window. If the window was found I&#39;d set the indicator lights to yellow, otherwise I&#39;d set them to green. Lately I&#39;ve been using a VM as well so I updated the code to be able to look for multiple window titles - if any of them are detected the light is set to yellow.&lt;/p&gt;
&lt;p&gt;Originally there was also Skype integration - I was able to use the Skype API to detect if I was on a call and if the call was muted. If I was on a muted call the right light would be on, and if I wasn&#39;t muted the red light would blink. This made it easy for the kids to tell how quiet they needed to be when coming into the room. Unfortunately Skype no longer supports this API (and I&#39;m not using Skype anymore anyways) so I removed this code from the project.&lt;/p&gt;
&lt;p&gt;The application also has a tray icon with a menu so I can manually set my status - for example, I can select &amp;quot;talking&amp;quot; and the red light will blink. This is my workaround until I come up with something that&#39;ll work for my current phone setup.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>System Temperature Status Window</title>
    <link href="https://chriskaczor.com/blog/system-temperature-status-window/" />
    <updated>2018-03-19T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/system-temperature-status-window/</id>
    <content type="html">&lt;p&gt;Next up in the &amp;quot;floating status window&amp;quot; category is &lt;a href=&quot;https://github.com/ckaczor/SystemTemperatureStatusWindow&quot;&gt;SystemTemperatureStatusWindow&lt;/a&gt;. This one does exactly what it says on the tin - it shows various system temperature values.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/system-temperature-status-window/images/SystemTemperatureStatusWindow.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/LBCvSAQh1L-121.avif 121w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/LBCvSAQh1L-121.webp 121w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/LBCvSAQh1L-121.png&quot; alt=&quot;&quot; width=&quot;121&quot; height=&quot;118&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The sensor data is read using the &lt;a href=&quot;http://openhardwaremonitor.org/&quot;&gt;Open Hardware Monitor&lt;/a&gt; library which is pretty straightforward - the one catch is that it requires running as an administrator and getting a UAC prompt each time the application starts got a bit annoying after a while.&lt;/p&gt;
&lt;p&gt;I first tried to solve this by splitting the application into two parts - a Windows service that ran with administrator privileges to read the sensors and a normal application to handle the display. While this got past the annoying UAC prompts (after the service was installed) I found that Windows doesn&#39;t let you get GPU information from inside a Windows service.&lt;/p&gt;
&lt;p&gt;After doing some more research I came across a workaround of using the Windows Task Scheduler to run the service as an administrator. I just turned the service into a regular application and set up the Task Scheduler to run it on system startup - problem solved.&lt;/p&gt;
&lt;p&gt;Later on I added some command line switches to the service application that&#39;d do the installation automatically. All I had to do was run the service once with a command line of &amp;quot;-install&amp;quot; and everything would get setup properly with just one UAC prompt.&lt;/p&gt;
&lt;p&gt;I haven&#39;t gotten around to adding an installer for this one yet but I definitely have plans to do so. I expect some minor complications setting up the service in Squirrel due to the need for administrator access but I think it&#39;ll end up being doable.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>CPU Usage Status Window</title>
    <link href="https://chriskaczor.com/blog/cpu-usage-status-window/" />
    <updated>2018-03-08T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/cpu-usage-status-window/</id>
    <content type="html">&lt;p&gt;Now that I&#39;ve written about my &lt;a href=&quot;https://github.com/ckaczor/FloatingStatusWindow&quot;&gt;FloatingStatusWindow&lt;/a&gt; library I can start to talk about the projects that use it. First up is the &lt;a href=&quot;https://github.com/ckaczor/ProcessCpuUsageStatusWindow&quot;&gt;ProcessCpuUsageStatusWindow&lt;/a&gt; project.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/cpu-usage-status-window/images/ProcessCpuUsageStatusWindow.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/L-UgyKZ-NI-373.avif 373w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/L-UgyKZ-NI-373.webp 373w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/L-UgyKZ-NI-373.png&quot; alt=&quot;&quot; width=&quot;373&quot; height=&quot;139&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is basically a mini task manager showing the top X processes by CPU usage and the total CPU usage of the system. The values update automatically every 2 seconds.&lt;/p&gt;
&lt;p&gt;CPU usage is calculated by taking a snapshot of &amp;quot;% processor time&amp;quot; for the &amp;quot;Process&amp;quot; performance counter category every 2 seconds and having the counter sample calculate the percent usage for each process based on the previous snapshot.&lt;/p&gt;
&lt;p&gt;This ended needing a lot more calculation than I had hoped although I don&#39;t remember all the details as to why - one of the perils of blogging so long after the code was written. From what I remember what I first tried was built into .NET and was easier to code but used a lot more processor time than I was comfortable with. Perhaps that has since been fixed in a later framework version - someday I&#39;ll have to try to recreate what I was doing.&lt;/p&gt;
&lt;p&gt;One caveat - the code doesn&#39;t always work quite right. I have seen a few times where the calculation comes out way over 100% but I haven&#39;t been able to reliably reproduce it. It seems to be when either something hangs Windows or there&#39;s exceptionally high disk usage. Either way - it works well enough for getting a quick look at CPU usage so I haven&#39;t spent much time on it.&lt;/p&gt;
&lt;p&gt;This was also the first project where I tried using &lt;a href=&quot;https://github.com/Squirrel/Squirrel.Windows&quot;&gt;Squirrel&lt;/a&gt; for installation and updates. I had used both &lt;a href=&quot;http://wixtoolset.org/&quot;&gt;WiX&lt;/a&gt; (with custom update detection and installation) and &lt;a href=&quot;https://en.wikipedia.org/wiki/ClickOnce&quot;&gt;ClickOnce&lt;/a&gt; in other projects and I think I&#39;ll probably go with Squirrel for most things going forward.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Floating Status Window</title>
    <link href="https://chriskaczor.com/blog/floating-status-window/" />
    <updated>2018-02-21T00:00:00Z</updated>
    <id>https://chriskaczor.com/blog/floating-status-window/</id>
    <content type="html">&lt;p&gt;Something that shows up in a lot of my projects is my &lt;a href=&quot;https://github.com/ckaczor/FloatingStatusWindow&quot;&gt;FloatingStatusWindow&lt;/a&gt; library. It allows the creation of something akin to a desktop widget that displays simple text and blends in with the Windows desktop. This is what several of them look like in the corner of my secondary monitor:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/floating-status-window/images/Windows-Locked.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/-IG3SLpr1H-770.avif 770w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/-IG3SLpr1H-770.webp 770w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/-IG3SLpr1H-770.png&quot; alt=&quot;&quot; width=&quot;770&quot; height=&quot;303&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Each one is a separate project that uses the core library to create and manage the window. The code for a few of these is on &lt;a href=&quot;https://github.com/ckaczor&quot;&gt;GitHub&lt;/a&gt; and I&#39;m working to add more.&lt;/p&gt;
&lt;p&gt;The windows are locked by default to prevent accidentally moving them but they can be unlocked in order to move or resize them. When moving or resizing the windows will snap to each other and the sides of the screen. This is what the example above looks like unlocked:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/floating-status-window/images/Windows-Unlocked.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/2zWtBO5eyV-1358.avif 1358w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/2zWtBO5eyV-1358.webp 1358w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/2zWtBO5eyV-1358.png&quot; alt=&quot;&quot; width=&quot;1358&quot; height=&quot;354&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Basic appearance settings are built into the library itself along with a dialog to change them:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://chriskaczor.com/blog/floating-status-window/images/Window-Appearance.png&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://chriskaczor.com/img/mcAwKnxf5g-436.avif 436w&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://chriskaczor.com/img/mcAwKnxf5g-436.webp 436w&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://chriskaczor.com/img/mcAwKnxf5g-436.png&quot; alt=&quot;&quot; width=&quot;436&quot; height=&quot;298&quot;&gt;&lt;/picture&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Each individual project is responsible for the text, the text layout, using a non-default text color, and keeping the text up to date. Some projects will update using a timer while others will wait for some sort of event and update as needed.&lt;/p&gt;
&lt;p&gt;I had tried a number of applications that could do custom widgets but none of them quite worked the way I wanted. I read an article about transparent WPF windows and decided to create something myself.&lt;/p&gt;
&lt;p&gt;Originally it was implemented as a single application that could load a number of plugins but that ended up being a bit of a pain - when working on a new window I had to close and restart everything and if a plugin crashed it&#39;d take down all of the rest. I decided to convert it into a library that could detect other instances of the window so they worked together but were implemented as separate binaries.&lt;/p&gt;
&lt;p&gt;There will be more about the library later when I write about the various applications that use it.&lt;/p&gt;
</content>
  </entry>
</feed>