<?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>zombiehugs* &#187; experimental</title>
	<atom:link href="https://www.zombiehugs.com/codetopics/experimental/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.zombiehugs.com</link>
	<description>code solutions from a code dunce</description>
	<lastBuildDate>Tue, 26 Nov 2013 15:47:32 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.7.41</generator>
	<item>
		<title>ASP.NET MVC AJAX Action Button (Unobtrusive)</title>
		<link>https://www.zombiehugs.com/2013/10/asp-net-mvc-ajax-action-button/</link>
		<comments>https://www.zombiehugs.com/2013/10/asp-net-mvc-ajax-action-button/#comments</comments>
		<pubDate>Tue, 15 Oct 2013 22:38:10 +0000</pubDate>
		<dc:creator><![CDATA[gerdsen]]></dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[experimental]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.zombiehugs.com/?p=235</guid>
		<description><![CDATA[It&#8217;s been a while since I&#8217;ve made a post, mostly because I&#8217;ve been busy and mostly because I usually post information I feel will be helpful to others. Today I want to share a snippet of code that I put together because I was unable to track down the answer I was looking for. Currently [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a while since I&#8217;ve made a post, mostly because I&#8217;ve been busy and mostly because I usually post information I feel will be helpful to others. Today I want to share a snippet of code that I put together because I was unable to track down the answer I was looking for.</p>
<p>Currently I am in a long term project that is primarily based ASP.NET MVC3 and with that comes troubles of its own. The trouble I was having was I wanted to create an HTML BUTTON that behaved much like MVC&#8217;s Ajax.ActionLink does. I wanted to be able to specifiy some button content as well as AjaxOptions for Unobtrusive parsing. I looked on the web, no luck. So I ventured out and created my own extension that I hope you find worthy.<br />
<strong><br />
C# (Place in new or existing file)<br />
</strong></p>
<pre class="prettyprint">public static MvcHtmlString ActionButton(this AjaxHelper ajaxHelper,
   string buttonText,
   string iconSrc,
   AjaxOptions ajaxOptions,
   object routeValues = null,
   object htmlAttributes = null,
   object iconAttributes = null)
{
UrlHelper urlHelper = new UrlHelper(ajaxHelper.ViewContext.RequestContext);
RouteValueDictionary htmlAttributeDictionary =
    HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
string imgUrl = urlHelper.Content(iconSrc);
&#47;&#47;Build icon for use in button
TagBuilder buttonIcon = new TagBuilder(&#34;img&#34;);
buttonIcon.MergeAttribute(&#34;src&#34;, imgUrl);
buttonIcon.MergeAttributes(new RouteValueDictionary(iconAttributes));
&#47;&#47;Text
TagBuilder text = new TagBuilder(&#34;span&#34;) { InnerHtml = buttonText };
&#47;&#47;Build Button and place text and icon inside
TagBuilder button = new TagBuilder(&#34;button&#34;);
button.MergeAttributes(ajaxOptions.ToUnobtrusiveHtmlAttributes());
button.MergeAttributes(htmlAttributeDictionary);
button.InnerHtml = buttonIcon.ToString(TagRenderMode.SelfClosing) + text.ToString();
return MvcHtmlString.Create(button.ToString());
}</pre>
<p>You can of course overload or customize this extension method to suit your needs (remove routeValues, htmlAttributes, etc&#8230;), we actually have a few variants (icon, no icon) for use in our system for different calls but I wanted to show you a full capability call.</p>
<p><strong>We are not out of the woods just yet, Microsoft&#8217;s Unobtrusive AJAX support library for jQuery does not attach to Buttons!</strong> They support attaching to A, Form, INPUT[type=image] and Submit but not to regular ole Button. So you are going to need to add a little binding in there to get you hooked up. Copy and paste the following.</p>
<p><strong>JavaScript (Place in your Unobtrusive jQuery Library File)</strong></p>
<pre class="prettyprint">    $(&#34;button&#91;data-ajax=true&#93;&#34;).live(&#34;click&#34;, function (evt) {
        evt.preventDefault();
        if (!$(this).attr(&#34;disabled&#34;)) {
            asyncRequest(this, {
                url: this.href,
                type: &#34;GET&#34;,
                data: &#91;&#93;
            });
        }
    });</pre>
<p>&nbsp;</p>
<p><strong>Making the call.<br />
</strong> Now that you are all set you can use the following in your code in your View to return unobtrusive BUTTONS with AJAX bindings, below is a sample call.</p>
<pre class="prettyprint">    @Ajax.ActionButton(&#34;Button Text&#34;, &#34;&#47;Images&#47;x_sm.png&#34;, new AjaxOptions
                {
                    Url = Url.Action(&#34;Add&#34;),
                    UpdateTargetId = &#34;Details&#34;,
                    OnComplete = &#34;javascript: weAreDone();&#34;,
                    InsertionMode = InsertionMode.Replace,
                    OnSuccess = &#34;javascript: hooray();&#34;
                },
                null,
                new { id = &#34;btn1&#34;})</pre>
<p>&nbsp;</p>
<p>That&#8217;s it. Now you have an unobtrusive button in MVC3. Get to styling.</p>
<p>I hope this helps you. I think in the future I will allow for iconAttributes to allow for height/width options. Maybe IDK, I might just leave it all up to CSS.</p>
<p>&nbsp;</p>
<p><strong>HTML Output from above call:<br />
</strong></p>
<pre class="prettyprint">
&lt;button id=&#34;btn1&#34; data-ajax-update=&#34;#Details&#34; data-ajax-success=&#34;javascript:
hooray();&#34; data-ajax-mode=&#34;replace&#34; data-ajax=&#34;true&#34; data-ajax-url=
&#34;&#47;Assignments&#47;Assignments&#47;Add&#34; data-ajax-complete=&#34;javascript: weAreDone();&#34;&gt;
   &lt;img src=&#34;&#47;Images&#47;x_sm.png&#34; alt=&#34;&#34; &#47;&gt;
   &lt;span&gt;Button Text&lt;&#47;span&gt;
&lt;&#47;button&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>https://www.zombiehugs.com/2013/10/asp-net-mvc-ajax-action-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating Signal Strength on Telit GPRS Module</title>
		<link>https://www.zombiehugs.com/2011/09/calculating-signal-strength-on-telit-gprs-module/</link>
		<comments>https://www.zombiehugs.com/2011/09/calculating-signal-strength-on-telit-gprs-module/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 01:04:15 +0000</pubDate>
		<dc:creator><![CDATA[gerdsen]]></dc:creator>
				<category><![CDATA[experimental]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://www.zombiehugs.com/?p=194</guid>
		<description><![CDATA[I currently have a project in the works that incorporates the Telit862 Quad GPRS module. After having some issues with signal quality in my area I decided it would be good for me to know the current signal strength given there is no visible display for this on the module. Given this fact I decided [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I currently have a project in the works that incorporates the Telit862 Quad GPRS module. After having some issues with signal quality in my area I decided it would be good for me to know the current signal strength given there is no visible display for this on the module. Given this fact I decided to incorporate a meter into my application and after a little research I found some articles that explained how AT&amp;T classifies signal strength groups into their now famous &#8220;bars&#8221;.</p>
<h4>Reading CSQ Value from serial</h4>
<p>On the Telit module you can issue the AT+CSQ command to have it return the <a href="http://en.wikipedia.org/wiki/Received_signal_strength_indication">rssi</a> value (http://en.wikipedia.org/wiki/Received_signal_strength_indication). The rssi value is important because it will be used to determine signal strength.</p>
<p>Using a serial connection you can connect to your Telit GPRS module and issue the <strong><em>AT+CSQ</em></strong> command. I am using <em>minicom</em> for this purpose however there might be other applications for your setup.</p>
<p>Anywho after launching minicom and issuing the AT+CSQ command into the prompt my window looks like this.</p>
<pre>Welcome to minicom 2.4
OPTIONS: I18n
Compiled on Sep  7 2010, 01:26:06.
Port /dev/ttyS1

Press CTRL-A Z for help on special keys

AT+CSQ
+CSQ 16, 0</pre>
<p>You can see the AT+CSQ command returned &#8220;<strong><em>+CSQ rssi, ber</em></strong>&#8220;, now this doesn&#8217;t help us a whole lot right off the bat as there is still some more processing that needs to be done. What we are looking for is the rssi value in this return; it will be used to convert into dBm. dBm is a power ratio in decibels and it is used to judge quality of reception in wireless comm. Well what&#8217;s the &#8220;ber&#8221; for? Don&#8217;t worry about it as you won&#8217;t necessarily need it we aren&#8217;t that sweet and tight. </p>
<h4>Strip all unnecessary string information from return</h4>
<p>You will need to be able to read this return from serial port using whichever language you desire. Once you read back &#8220;+CSQ rssi,ber&#8221; you will need to use some string functions to strip away the unneccesary &#8220;+CSQ&#8221; and &#8220;,ber&#8221; leaving you with just the rssi integer, but I&#8217;ll leave that part up to you.</p>
<h4>Translate rssi to dBm</h4>
<p>Telit states that it&#8217;s rssi values correspond into dBm as following:<br />
<strong>0 &#8211; (-113dBm or less)<br />
1 &#8211; (-111dBm)<br />
2 thru 30 &#8211; (-109 dBm thru -53dBm, which equates to about a +2 dBm per rssi step)<br />
31 &#8211; (-51 dBm or greater)<br />
99 &#8211; (signal unknown)</strong></p>
<p>Ok so this might be confusing but it&#8217;s not all that difficult. Telit states that 2-30 rssi range is equal to -109 dBm thru -53 dBm or steps of 2 dBm for each rssi. <em>Note: We know that when our Telit sends back 1 as our rssi value that it is -111dBm, well that&#8217;s probably going to be 0 bars and 99 is an unknown signal according to Telit.</em></p>
<p><strong>Again so <em>for every rssi value our dBm increases 2</em>. So we get the following&#8230;</p>
<p>2 rssi = -109 dBM<br />
3 rssi = -107 dBm<br />
4 rssi = -105 dBm<br />
5 rssi = -102 dBm<br />
&#8230;<br />
30 rssi = -55 dBm<br />
31 rssi = -53 dBm</strong></p>
<p>Now that we know what each rssi is equal to we can move forward.</p>
<h4>AT&#038;T Bars Formula</h4>
<p>According to a blog I found on the internet this guy states that he believes AT&amp;T to categorize their &#8220;bars&#8221; the following way based on dBm:</p>
<p><strong>5 Bars / -75 dBm or greater<br />
4 Bars / -83 to -74 dBm<br />
3 Bars / -95 to -82 dBm<br />
2 Bars / -105 to -94 dBm<br />
1 Bar  / -110 to -104 dBm<br />
0 Bars / -111 or less</strong></p>
<p>Ok great but what the shit does that do for me? Well we now know how to bracket our values into bars to get an easy to read signal meter. </p>
<h4>Conclusion</h4>
<p>If you do the legwork and convert the rssi into dBm using the two step method you will find out the following:<br />
If rssi is equal to <strong>1</strong> you have <strong>0 Bars</strong><br />
If rssi is greater than <strong>1</strong> and less than <strong>6</strong> you have <strong>1 Bar</strong><br />
If rssi is greater than or equal to <strong>6</strong> and less than <strong>10</strong> you have <strong>2 Bars</strong><br />
If rssi is greater than or equal to <strong>10</strong> and less than <strong>15</strong> you have <strong>3 Bars</strong><br />
If rssi is  greater than or equal to <strong>15</strong> and less than <strong>20</strong> you have <strong>4 Bars</strong><br />
If rssi is greater than or equal to <strong>20</strong> but not equal to <strong>99 </strong>you have <strong>5 Bars</strong></p>
<p><em>Remember RSSI of 99 is an unknown signal as stated by Telit.</em></p>
<div class="hugs"><(x_-)></div>
]]></content:encoded>
			<wfw:commentRss>https://www.zombiehugs.com/2011/09/calculating-signal-strength-on-telit-gprs-module/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing Windows Phone 7 Developer Tools on XP</title>
		<link>https://www.zombiehugs.com/2011/07/installing-windows-phone-7-developer-tools-on-xp/</link>
		<comments>https://www.zombiehugs.com/2011/07/installing-windows-phone-7-developer-tools-on-xp/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 17:50:33 +0000</pubDate>
		<dc:creator><![CDATA[gerdsen]]></dc:creator>
				<category><![CDATA[experimental]]></category>
		<category><![CDATA[ramblings]]></category>
		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://www.zombiehugs.com/?p=171</guid>
		<description><![CDATA[I have an old development machine at home that still runs XP. Shoot me. The damn thing works fine and I&#8217;m not about to drop the money to upgrade the OS and hardware. I do from time to time like to use it for things it&#8217;s not designed for. I recently got an invitation to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I have an old development machine at home that still runs XP. Shoot me. The damn thing works fine and I&#8217;m not about to drop the money to upgrade the OS and hardware. I do from time to time like to use it for things it&#8217;s not designed for. I recently got an invitation to update my Windows Phone to the latest release of Mango. Well after reading the instructions I noticed I had to install the Windows Phone SDK 7.1, requirements are Vista or Windows 7. Problem.</p>
<p>Solution I found for this was the following:</p>
<p>   1. Download the Windows Phone Developer Tools RTW from Microsoft Download Center<br />
   2. Extract the downloaded package by running vm_web.exe /x<br />
   3. Go to the folder of the extracted package &#038; open the file baseline.dat in any text editor<br />
   4. Look for the ‘gencomp7788’ section and change this two entries from 1 to 0:<br />
          * InstallOnLHS=0<br />
          * InstallOnWinXP=0<br />
   5. Save the file baseline.dat<br />
   6. Run setup.exe /web</p>
<p>Thanks to <a href="http://www.redfrogfish.com/" target="_blank">Red Frogfish</a> for this information. Hope this helps others.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.zombiehugs.com/2011/07/installing-windows-phone-7-developer-tools-on-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
