<?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>Hawk Software</title>
	<atom:link href="http://hawksoft.com/feed" rel="self" type="application/rss+xml" />
	<link>http://hawksoft.com</link>
	<description>Programming, web design, and more</description>
	<lastBuildDate>Wed, 25 Aug 2010 19:46:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ask Phil &#8211; Tweaking the TCP time-out</title>
		<link>http://hawksoft.com/2010/ask-phil-tweaking-the-tcp-time-out-491.shtml</link>
		<comments>http://hawksoft.com/2010/ask-phil-tweaking-the-tcp-time-out-491.shtml#comments</comments>
		<pubDate>Tue, 24 Aug 2010 02:12:50 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=491</guid>
		<description><![CDATA[Kama asked:
I have a question related to the tweaking of TCP timeouts and retries. Basically I have an application that connects to a remote server to perform various operations. If the server dies however, it will perform operations on a local database then sync up with the server later. In linux, if the remote server [...]]]></description>
			<content:encoded><![CDATA[<p>Kama asked:</p>
<p><em><strong>I have a question related to the tweaking of TCP timeouts and retries. Basically I have an application that connects to a remote server to perform various operations. If the server dies however, it will perform operations on a local database then sync up with the server later. In linux, if the remote server is offline, the application tries to reach the server for approximately 2 minutes before it gives up and uses the local database. This of course makes the application seem like it has hung.</strong></em></p>
<p><em><strong>I&#8217;ve done some research into tweaking tcp settings. I&#8217;ve found various settings that I can tweak in the proc systems using sysctl. I&#8217;m not sure which ones will work for this task. I&#8217;m currently playing with:</strong></em></p>
<p><em><strong>tcp_orphan_retries<br />
tcp_retries1<br />
tcp_retries2</strong></em></p>
<p><em><strong>Does anyone know if I&#8217;m on the right track? Also I know these flags alter the settings based on the retransmission timeout (RTO). Is there anyway of tweaking the RTO? Or will tweaking one of the above flags suffice?</strong></em></p>
<p>My reply:<span id="more-491"></span></p>
<p><em><strong>I think you are doing it the hard way&#8230;</strong></em></p>
<p><em><strong>The most common way to get around long connect times is to set the socket to non-blocking, call connect(), then call select() on the socket with a reasonable time-out, checking for errors and writability. If the select times out or shows a socket error then you know the connect() has not completed and you can close the socket. If select() returns that the socket is writable then the connect() was successful.</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/ask-phil-tweaking-the-tcp-time-out-491.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I use the GPL/LGPL, but don&#8217;t buy into the full GNU philosophy</title>
		<link>http://hawksoft.com/2010/why-i-use-the-gpllgpl-but-dont-buy-into-the-full-gnu-philosophy-471.shtml</link>
		<comments>http://hawksoft.com/2010/why-i-use-the-gpllgpl-but-dont-buy-into-the-full-gnu-philosophy-471.shtml#comments</comments>
		<pubDate>Thu, 19 Aug 2010 01:49:11 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=471</guid>
		<description><![CDATA[I use the GPL/LGPL (GPL for short) for current projects, and new projects will use the GPL Version 3.  But, I am no big fan of Richard Stallman, so why use the GPL at all, when there are so many other free and open source licenses?  Why do I use a free license at all?  [...]]]></description>
			<content:encoded><![CDATA[<p>I use the GPL/LGPL (GPL for short) for current projects, and new projects will use the GPL Version 3.  But, I am no big fan of Richard Stallman, so why use the GPL at all, when there are so many other free and open source licenses?  Why do I use a free license at all?  I will answer this second question first since it has a lot to do about how I came to be a programmer.<span id="more-471"></span></p>
<p>I first began programming back in 1978 using BASIC.  There were a few books available with sample programs, and I learned BASIC and assembler.  But I was also lucky  because a fellow calculator toting math geek (my TI-30 was kept in a  denim-look case which attached to my belt; very hip for 1978) had some sort of access to source code from a university.  The BIG software project that distracted us for months was a Star Trek game, which we modified weekly.  My friend told me about all the free software available at colleges and universities; some of it in cool languages like Pascal and C.</p>
<p>After taking some college courses, which included Pascal and Image (a database for HP minicomputers), I hardly programed at all for 10 years until I got an AT clone running DOS and Windows 3.1.  I briefly programmed with Turbo Pascal, but then decided I wanted to jump into C headfirst.  But how?  I did not have the time or funds to take formal courses, so I turned to free/open source code which was available on my local BBS (Bulletin Board System).  It was great!  With the free DJGPP C compiler for DOS I was able to learn by doing.  I also purchased a special introductory version of Visual C++ that just built Win16 programs, but I never used it much.</p>
<p>I was able to quickly learn about inlined assembly, VESA frame-buffer graphics, OpenGL, IPX and TCP/IP networking, and finally speech compression using free and open source code software.   So you might say I am making software available free as payback.  I like to think I am providing stepping stones for others to go further than I have, and just maybe someday they will provide stepping stones I can use to go even further myself.</p>
<p>Now to the first question: Why do I use the GPL?  The main reason is that it is extensively used, and it has been tested in court.  While I hope to never need to enforce a free software license in court, the fact that the GPL has been found to be enforceable adds a little peace of mind.</p>
<p>Another, somewhat selfish, reason is that the GPL is considered to be non-friendly to commercial software.  While this is based more on ignorance than on truth, the fact is that is the way it is seen.  But this allows me to periodically dual-license some of my code which pays to keep this site up and allows me to purchase software and hardware to support current and future projects.</p>
<p>In conclusion, while I promote and contribute to free and open source code projects, I still believe there is a place for commercial software.  And right now the GPL is the best license I can use to pay back to the free/open source code community, yet still make a little money.</p>
<p>Phil Frisbie, Jr.</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/why-i-use-the-gpllgpl-but-dont-buy-into-the-full-gnu-philosophy-471.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy 8/9/10 11:12</title>
		<link>http://hawksoft.com/2010/happy-8-9-10-11-12-497.shtml</link>
		<comments>http://hawksoft.com/2010/happy-8-9-10-11-12-497.shtml#comments</comments>
		<pubDate>Mon, 09 Aug 2010 18:12:09 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=497</guid>
		<description><![CDATA[I scheduled this quick post just for fun.
Phil Frisbie, Jr.
]]></description>
			<content:encoded><![CDATA[<p>I scheduled this quick post just for fun.</p>
<p>Phil Frisbie, Jr.</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/happy-8-9-10-11-12-497.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ask Phil &#8211; Losing UDP packets</title>
		<link>http://hawksoft.com/2010/ask-phil-losing-udp-packets-485.shtml</link>
		<comments>http://hawksoft.com/2010/ask-phil-losing-udp-packets-485.shtml#comments</comments>
		<pubDate>Fri, 06 Aug 2010 01:14:07 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=485</guid>
		<description><![CDATA[Maxime once asked:
My C program needs to send UDP packets in burst. I have the following code:
send_data()
{
err = sendto(sock, &#38;msg1, len1, &#38;add, lenadd);
err = sendto(sock, &#38;msg2, len2, &#38;add, lenadd);
err = sendto(sock, &#38;msg3, len3, &#38;add, lenadd);
err = sendto(sock, &#38;msg4, len4, &#38;add, lenadd);
err = sendto(sock, &#38;msg5, len5, &#38;add, lenadd);
}
I do not get any error.
When I look on [...]]]></description>
			<content:encoded><![CDATA[<p>Maxime once asked:</p>
<p><em><strong>My C program needs to send UDP packets in burst. I have the following code:</strong></em></p>
<p><em><strong>send_data()</strong></em><br />
<em><strong>{<br />
err = sendto(sock, &amp;msg1, len1, &amp;add, lenadd);<br />
err = sendto(sock, &amp;msg2, len2, &amp;add, lenadd);<br />
err = sendto(sock, &amp;msg3, len3, &amp;add, lenadd);<br />
err = sendto(sock, &amp;msg4, len4, &amp;add, lenadd);<br />
err = sendto(sock, &amp;msg5, len5, &amp;add, lenadd);<br />
}</strong></em></p>
<p><em><strong>I do not get any error.</strong></em></p>
<p><em><strong>When I look on the network with a sniffer, sometimes, I [see] packets. but the missing packets are never put on the network.</strong></em></p>
<p><em><strong>How can I lose packets if I have a private network with only two nodes?</strong></em></p>
<p><em><strong>I use setsockopt(sock,SOL_SOCKET, SO_SNDBUF, &amp;maxsize, sizeof(int)); function to be sure I have enough buffer memory, but that not seams to help.</strong></em></p>
<p><em><strong>I have the same result with Windows or Linux.</strong></em></p>
<p><em><strong>Does someone have an idea?<span id="more-485"></span></strong></em></p>
<p>My obnoxious reply [I guess I used to be grumpier than I am now!]:</p>
<p><em><strong>Repeat after me: UDP is not reliable. UDP is not reliable&#8230;&#8230;</strong></em></p>
<p><em><strong>REALLY! The TCP/IP stack can drop UDP datagrams at ANY time, even if there is buffer space, even on a loopback address! The sooner you understand and acknowledge this the less frustration you will experience.</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/ask-phil-losing-udp-packets-485.shtml/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Be careful when using dynamic menus</title>
		<link>http://hawksoft.com/2010/be-careful-when-using-dynamic-menus-406.shtml</link>
		<comments>http://hawksoft.com/2010/be-careful-when-using-dynamic-menus-406.shtml#comments</comments>
		<pubDate>Thu, 15 Jul 2010 04:10:40 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=406</guid>
		<description><![CDATA[The #1 reason I browse the Internet is to look for information and news.  The #2 reason is to look at all the cool things web designers come up with.  Cool layouts, color schemes, navigation, etc.  However, all the while in the back of my mind I always wonder about accessibility: are these cool pages [...]]]></description>
			<content:encoded><![CDATA[<p>The #1 reason I browse the Internet is to look for information and news.  The #2 reason is to look at all the cool things web designers come up with.  Cool layouts, color schemes, navigation, etc.  However, all the while in the back of my mind I always wonder about accessibility: are these cool pages still accessible to those using alternative browsers or screen readers?  The sad thing is many times the answer is &#8216;no&#8217;, but they could have been.  Menus (and links in general) are the worst offenders, and usually JavaScript or <a href="http://www.adobe.com/flashplatform/">Flash</a> is an accomplice.<span id="more-406"></span></p>
<p>JavaScript or Flash in themselves are not really the problem; it is how they are used.  I am most familiar with JavaScript, so I will use it for my examples.  I suppose you can also abuse <a href="http://silverlight.net">Silverlight</a>, but I am not familiar with people using it for dynamic menus.  Basically, your menus should either gracefully degrade when scripting is not available or you should provide an alternate menu.</p>
<p>There are some very cool JavaScript menus.  Most work by dynamically hiding/displaying links based on what your mouse pointer is hovering over.  If the menu is made up of an unordered list, or nested lists, the menu will likely expand so that all choices are visible when JavaScript is disabled.  The menu may look ugly, but it will work!</p>
<p>Other menus are actually based on CSS &#8211; the CSS controls the hiding/displaying &#8211; and JavaScript is just an enhancement.  The <a href="http://www.ca.gov/">State of California</a> template does it this way.</p>
<p>Before you choose a JavaScript menu try disabling JavaScript in your browser to see what  happens.  If it does not degrade to something usable you either need to keep looking or add an optional menu in a noscript tag.  Personally, I would avoid the noscript tag option because it means you need to maintain another menu.</p>
<p>The last thing you need to do is to insure the menu is accessible without a mouse (both with and without scripting).  Try using just your tab and enter keys to navigate your site; you just might be surprised how hard or tedious it is!  While it is good practice to have your most used links near the top, or beginning, of your menu, it is critical for keyboard-only users.</p>
<p>I will talk more about menus and accessibility in a future post.</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/be-careful-when-using-dynamic-menus-406.shtml/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ask Phil &#8211; Can an LGPL library be used for commercial software?</title>
		<link>http://hawksoft.com/2010/ask-phil-can-an-lgpl-library-be-used-for-commercial-software-467.shtml</link>
		<comments>http://hawksoft.com/2010/ask-phil-can-an-lgpl-library-be-used-for-commercial-software-467.shtml#comments</comments>
		<pubDate>Thu, 08 Jul 2010 01:09:38 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=467</guid>
		<description><![CDATA[Many times I have been asked:
I would like to use your library HawkNL (or HawkVoiceDI) in a commercial application.  Does the LGPL allow me to do this? Or can I license your library for a commercial application?
My reply:
First, please read he full terms of the LGPL Version 2.  Basically, if you use the library as [...]]]></description>
			<content:encoded><![CDATA[<p>Many times I have been asked:</p>
<p><strong><em>I would like to use your library HawkNL (or HawkVoiceDI) in a commercial application.  Does the LGPL allow me to do this? Or can I license your library for a commercial application?</em></strong></p>
<p>My reply:</p>
<p><strong><em>First, please read he full terms of the<a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html"> LGPL Version 2</a>.  Basically, if you use the library as a Windows DLL or *nix loadable module or shared object, then you only need to provide source for the library and any modifications you added.  The end user MUST be able to modify the library source and recompile the library if they choose.  A good example of this was Sony&#8217;s use of HawkVoiceDI in the game <a href="http://planetside.station.sony.com/">Planetside</a>.  Sony used HawkVoiceDI as a DLL and <a href="http://planetside.station.sony.com/howto/manual_detail.vm?handle=6.14">provided a link to the source code</a> in the online manual.</em></strong></p>
<p><strong><em>And yes, these libraries, and some of my other code, is available under a commercial license.  Hawk Software is a part-time job for me, so licensing helps keep this website up!</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/ask-phil-can-an-lgpl-library-be-used-for-commercial-software-467.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Real posts 64, spam 1860, and a fixed point conversion update</title>
		<link>http://hawksoft.com/2010/real-posts-64-spam-1860-and-a-fixed-point-conversion-update-460.shtml</link>
		<comments>http://hawksoft.com/2010/real-posts-64-spam-1860-and-a-fixed-point-conversion-update-460.shtml#comments</comments>
		<pubDate>Thu, 24 Jun 2010 02:45:44 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Speech/Voice Compression]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=460</guid>
		<description><![CDATA[Whew!  Just got done reviewing posts to weed out the real ones from the spam.  The amount of spam has greatly increased over the last week, and out of 70 posts since yesterday there was ONE real post.  Or, at least, it was not obviously spam!
I know some are waiting for the rest of the [...]]]></description>
			<content:encoded><![CDATA[<p>Whew!  Just got done reviewing posts to weed out the real ones from the spam.  The amount of spam has greatly increased over the last week, and out of 70 posts since yesterday there was ONE real post.  Or, at least, it was not obviously spam!</p>
<p>I know some are waiting for the rest of the floating point to fixed point series, and I am sorry that it is taking a lot more time than I anticipated.  <span id="more-460"></span>I had outlined the entire series and completed the first two parts before I began posting, and I thought that a week between parts would be sufficient to get through it, but I was wrong.  When dealing with code originally converted seven years ago my memory takes extra time to retrieve all the details.  And some intermediate code versions are missing, so I am recreating some intermediate code to properly show the steps.</p>
<p>Also, some steps are so detailed that I will just provide an overview in this series, and will post more detailed explanations in future posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/real-posts-64-spam-1860-and-a-fixed-point-conversion-update-460.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate your web pages for better accessibility</title>
		<link>http://hawksoft.com/2010/validate-your-web-pages-for-better-accessibility-403.shtml</link>
		<comments>http://hawksoft.com/2010/validate-your-web-pages-for-better-accessibility-403.shtml#comments</comments>
		<pubDate>Wed, 16 Jun 2010 01:15:34 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=403</guid>
		<description><![CDATA[This was originally going to be a VERY short post; I mean, how tough is this subject?  It is really just common sense that if you are using properly formed, standards compliant HTML or XHTML you are assured any compliant browser will be able to properly parse the page and present it in whatever form [...]]]></description>
			<content:encoded><![CDATA[<p>This was originally going to be a VERY short post; I mean, how tough is this subject?  It is really just common sense that if you are using properly formed, standards compliant HTML or XHTML you are assured any compliant browser will be able to properly parse the page and present it in whatever form the user needs.  For example, many visually impaired users need a browser that incorporates text-to-speech technology, or they may just need to override the style to increase the font size and/or change the background and text colors for higher contrast.</p>
<p>For these reasons I always validate my pages as they are being developed, and occasionally I perform spot checks later.  So I was VERY surprised when I validated my last blog entry and discovered it was no longer valid XHTML Strict due to an attribute I had never heard of:  &#8216;aria-required&#8217;.<span id="more-403"></span>The <a href="http://validator.w3.org/">W3C Validator</a> was not much help, it simply said &#8216;there is no attribute area-required&#8217;.  So on to <a href="http://www.google.com/">Google</a>&#8230;</p>
<p>ARIA stands for <a href="http://www.w3.org/TR/wai-aria/"><strong>A</strong>ccessible <strong>R</strong>ich <strong>I</strong>nternet <strong>A</strong>pplications</a>, and it is currently a W3C draft. It was created by the <a href="http://www.w3.org/WAI/">Web Accessibility Initiative (WAI)</a>.  The ARIA specifications are designed to allow an author to properly convey user interface behaviors  and structural information in document-level markup, to assistive  technologies (browsers).</p>
<p>I then found this is a common issue with current <a href="http://wordpress.org/">WordPress</a> themes.  The issue is within the templates for comments, the comments.php and comments-popup.php files.  If the author name and email address are required then the template adds the area-required attribute to these two text  input fields.  This may at first seem redundant; the template will also add the text (required) to those fields.  However, by including the attribute the assistive browser can insure the user completes those fields before they are allowed to submit the form, helping to eliminate the  confusion of an error box or error page.</p>
<p>The  bottom line is this is a great addition for web accessibility, and I commend the creators of the current WordPress theme templates, but the ARIA specifications are still draft.  As a purist when it comes to standards, it puts me in a though spot: do I leave it and live with pages that do not pass validation; do I use a JavaScript hack to add the attribute to the input tags so that the Validator is happy (but the final XHTML presented to the browser will still not be valid); or do I remove it?</p>
<p>Well, for now I have decided to leave it in the hope that the ARIA specification will be adopted soon.  I think if it helps just one of my users then it will be worth it.  But that does not mean I will stop looking for other alternatives to pass validation!</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/validate-your-web-pages-for-better-accessibility-403.shtml/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Terms of Use &#8211; Don&#8217;t do it like Bill Gates!</title>
		<link>http://hawksoft.com/2010/creating-terms-of-use-dont-do-it-like-bill-gates-439.shtml</link>
		<comments>http://hawksoft.com/2010/creating-terms-of-use-dont-do-it-like-bill-gates-439.shtml#comments</comments>
		<pubDate>Fri, 11 Jun 2010 01:57:30 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=439</guid>
		<description><![CDATA[I have been working on my own Terms of Use page for this website.  Nothing too complicated; most web users are familiar with basic usage and privacy concerns related to blogs.  Still, it is one of those little details that need to get done, so I have kept my eye out for good and bad [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on my own Terms of Use page for this website.  Nothing too complicated; most web users are familiar with basic usage and privacy concerns related to blogs.  Still, it is one of those little details that need to get done, so I have kept my eye out for good and bad examples to use as a guide.  For example, I just saw a link to the Terms of Use for the Bill and Melinda Gates Foundation website.  Copy and paste this in your browser if you would like to read it for yourself: http://www.gatesfoundation.org/about/Pages/terms-of-use.aspx</p>
<p>I would have linked it, but I did not want to take the time to get permission first! You think I am kidding?  Here is section 11 in its entirety (emphasis is mine):<span id="more-439"></span></p>
<p style="padding-left: 30px;"><strong>11.</strong> Linked Sites<br />
Our Links to Other Sites: Our Site  may contain links to Web sites of third parties. We provide these links  as a convenience, but do not endorse the linked site or anything on it.  While their information, products, services and information may be  helpful to you, they are independent entities and we do not control or  endorse them. You agree that any visits to linked sites are at your own  risk and governed by their privacy policies (if any).</p>
<p style="padding-left: 30px;"><strong><em>Your Links to Our Site</em>: You are  not permitted to link or shortcut to our Site from your Web site, blog  or similar application, without obtaining prior written permission from  us.</strong></p>
<p>I have read many stories over the years about how Bill did not really understand the Internet back in the mid-to-late 90s, but if he approved this then it shows he still doesn&#8217;t understand.  Linking is at the core of the web; it is expected, even courteous, to link to sites that are mentioned.  I am not happy when I read an article that mentions another site/company/product but does not include a link so I can get the direct information without added opinion.  I cannot think of a good reason for requiring permission other than control.</p>
<p>Then there is the rather funny section 17:</p>
<p style="padding-left: 30px;"><strong>17.</strong> System Requirements<br />
Depending upon what you would  like to do with the Foundation (e.g., if you apply for a job or grant or  if you want to download certain items), you may need to make  adjustments to your computer hardware or software so that you will be  able to view or receive documents as intended by us. To deal with us  electronically, you agree to obtain or use a system at least meeting  these requirements:</p>
<p style="padding-left: 30px;">Basic Requirements</p>
<ol style="padding-left: 30px;">
<li>
<div>a computer, monitor, cable or modem  allowing Internet access or direct-dial accessibility, and a printer  capable of printing documents (and website screens) or a hard drive  capable of storing data;</div>
</li>
<li>
<div>one of these computer operating systems:<br />
a.  Windows NT<br />
b. Windows 2000<br />
c. Windows XP<br />
d. Mac OSX 10.4.4</div>
</li>
<li>
<div>any of these Internet browsers:<br />
a. IE  5.5 (for Windows NT, Windows 2000)<br />
b. IE 6.0, IE 7.0 (for Windows  XP, Windows NT, Windows 2000)<br />
c. NS 7.1 (for Windows XP, Windows NT,  Windows 2000)<br />
d. AOL 7.0, AOL 8.0 (for Windows XP, Windows NT,  Windows 2000)<br />
e. Firefox 1.5, Firefox 2.0 (for Windows XP, Windows  NT, Windows 2000, Mac OSX 10.4.4)<br />
f. Safari 2.0 (for Mac OSX 10.4.4);</div>
</li>
<li>
<div>this software: Adobe Acrobat Reader 7.0  or Adobe Acrobat 5.0 or higher;</div>
</li>
<li>
<div>a printer of the ability to make,  download or store an electronic copy of any contracts or legal  disclosures that we may provide (such as in connection with a job  application).</div>
</li>
</ol>
<p style="padding-left: 30px;">We reserve the right to change system requirements at any time  without prior notice. If we were required to obtain your consent to  dealing with us electronically and we change our system requirements, we  will give notice and a right to withdraw your previous consent, if and  as required by applicable law.</p>
<p>Is that VERY specific, or not?  When you are too specific you must regularly update your information or else it looks out of date and amateurish.  OK, it DOES say you need to &#8220;use a system at least meeting  these requirements.&#8221;  So my Windows 7 system meets the qualifications, but does my Ubuntu 10.4 system with Firefox 3.6?  I think so, but does Bill?</p>
<p>There is more if you decide to read it for yourself, but at over 5,400 words it may put you to sleep <img src='http://hawksoft.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Anyway&#8230;I am still working on a SIMPLE terms of service, which includes only what is necessary and cannot be used as a sleep aid!</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/creating-terms-of-use-dont-do-it-like-bill-gates-439.shtml/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Floating point to fixed point code conversion – Part 3: Using macros to bridge the conversion process</title>
		<link>http://hawksoft.com/2010/floating-point-to-fixed-point-code-conversion-part-3-using-macros-to-bridge-the-conversion-process-419.shtml</link>
		<comments>http://hawksoft.com/2010/floating-point-to-fixed-point-code-conversion-part-3-using-macros-to-bridge-the-conversion-process-419.shtml#comments</comments>
		<pubDate>Sat, 05 Jun 2010 05:40:30 +0000</pubDate>
		<dc:creator>Phil Frisbie, Jr.</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Speech/Voice Compression]]></category>

		<guid isPermaLink="false">http://hawksoft.com/?p=419</guid>
		<description><![CDATA[Be sure to read Part 1 for an introduction to fixed point math, and Part 2 for guidelines in preparing your floating point code for conversion to fixed point.
I begin the conversion process by adding these macros to the source files to emulate the fixed point math functions which will be used later:
#define fixed32  [...]]]></description>
			<content:encoded><![CDATA[<p>Be sure to read <a href="http://hawksoft.com/2010/floating-point-to-fixed-point-code-conversion-part-1-introduction-366.shtml">Part 1</a> for an introduction to fixed point math, and <a href="http://hawksoft.com/2010/floating-point-to-fixed-point-code-conversion-part-2-preparing-your-code-371.shtml">Part 2</a> for guidelines in preparing your floating point code for conversion to fixed point.</p>
<p>I begin the conversion process by adding these macros to the source files to emulate the fixed point math functions which will be used later:</p>
<pre><strong>#define fixed32         float
#define ftofix32(x)     ((float)(x))  /* float value to fixed */
#define itofix32(x)     ((float)(x))  /* integer value to fixed */<span id="more-419"></span>
#define fixtoi32(x)     ((int)((x) &lt; 0.0f ? (x) - 0.5f : (x) + 0.5f))  /* fixed value to integer with rounding */
#define fixtof32(x)     (x)  /* fixed value to float */
#define fixabs32(x)     fabs(x)  /* absolute value */
#define fixmul32(x, y)  ((float)(x) * (float)(y))  /* multiply x and y */
#define fixdiv32(x, y)  ((float)(x) / (float)(y))  /* divide x by y */
#define fixadd32(x, y)  ((float)(x) + (float)(y))  /* use only where you suspect large values will be accumulated */
#define fixsub32(x, y)  ((float)(x) - (float)(y))  /* same caution as add */

</strong></pre>
<p>First go through your code and replace every instance of &#8216;float&#8217; with &#8216;fixed32&#8242;:</p>
<pre><strong>void hp100(fixed32 *speech, long end, struct lpc10_encoder_state *st)
{
    fixed32 z11;
    fixed32 z21;
    fixed32 z12;
    fixed32 z22;
</strong></pre>
<p>Then go through and modify each use of a static float or integer (integers only if they are used in floating point math equations) to use the macros:</p>
<pre><strong>static fixed32 enscl[8] = { ftofix32(.0204f),ftofix32(.0167f),ftofix32(.0145f),ftofix32(.0147f),
ftofix32(.0143f),ftofix32(.0135f),ftofix32(.0125f),ftofix32(.0112f) };

static fixed32 vdcl[10] = { itofix32(600),itofix32(450),itofix32(300),itofix32(200),itofix32(0), itofix32(0),
itofix32(0),itofix32(0),itofix32(0),itofix32(0) };

</strong></pre>
<p>Convert casts to use the macros:</p>
<pre><strong>minamd = fixtoi32(amdf[*minptr]);</strong></pre>
<p>Then convert each fabs, multiply, and divide:</p>
<pre><strong>ivrc[1] = fixdiv32((r[2] - fixmul32(ivrc[0], r[1])), (r[0] - fixmul32(ivrc[0], r[1])));</strong></pre>
<pre><strong> </strong></pre>
<p>Now look carefully through your code and look for other floating point functions used.  Add macros as necessary and convert the code to use them:</p>
<pre><strong>#define fixsqrt32(x)    (float)sqrt(x)
#define fixexp32(x)     (float)exp(x)
#define fixlog32(x)     (float)log(x)
 </strong></pre>
<p>Regularly make sure your floating point code still works while converting it to use the macros.  Use the test framework or reference data you created in part 2.  At this point your code should still be bit-exact.</p>
<p><strong><em>NOTE: It is possible that using these macros will cause some floating calculations to no longer be bit-exact.  It is common for x86 compilers to use 80-bit registers for intermediate results for increased speed, and then round/truncate back to 32 bits just before storing the values.  These macros may reduce the use of the 80-bit registers by causing rounding/truncating more often.  The differences will be insignificant for most calculations, but they can be noticeable in a loop which performs a multiply and accumulate for thousands of values.  It is not really that these macros are reducing the precision of the calculations; it is that they are only allowing it to be at 32-bits and not higher.</em></strong></p>
<p>Now it is time to determine the fixed point precision and perform scaling as needed.  At this point my instructions will become a little fuzzy due to differences in compilers and platforms.  How easy your own conversion is from here on will be determined by how well you really understand the code you are converting and how well you command the <a href="http://en.wikipedia.org/wiki/Force_%28Star_Wars%29">Force</a> <img src='http://hawksoft.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Remember from Part 1 that our fixed point values are using a 32 bit integer partitioned into bits for the whole number (and sign) and the rest of the bits for the fraction.   I usually begin with 16.16 fixed point (16 bits for each), but it depends on how large your large values are compared with the precision needed for the smallest values.  It is a balancing act.  Sometimes you are lucky and your code is only dealing with large values or very small values, but often different parts of your code are using both.  To see how large your values are first add these two additional defines:</p>
<pre><strong>#define precision       16 /* bits for the fractional part */</strong></pre>
<pre><strong>#define floatlimit      (float)(((1 &lt;&lt; (32 - precision)) / 2) - 1 )</strong></pre>
<pre><strong> </strong></pre>
<p>Then replace your macros with these functions:</p>
<pre><strong>fixed32 fixmul32(fixed32 x, fixed32 y)
{
    fixed32 temp = x * y;

    if(temp &gt; floatlimit)
    {
        return floatlimit;
    }
    else if(temp &lt; -floatlimit)
    {
        return -floatlimit;
    }
    return temp;
}
fixed32 fixdiv32(fixed32 x, fixed32 y)
{
    fixed32 temp = x / y;
    if(temp &gt; floatlimit)
    {
        return floatlimit;
    }
    else if(temp &lt; -floatlimit)
    {
        return -floatlimit;
    }
    return temp;
}
fixed32 fixadd32(fixed32 x, fixed32 y)
{
    fixed32 temp = x + y;
    if(temp &gt; floatlimit)
    {
        return floatlimit;
    }
    else if(temp &lt; -floatlimit)
    {
        return -floatlimit;
    }
    return temp;
}
fixed32 fixsub32(fixed32 x, fixed32 y)
{
    fixed32 temp = x - y;
    if(temp &gt; floatlimit)
    {
        return floatlimit;
    }
    else if(temp &lt; -floatlimit)
    {
        return -floatlimit;
    }
    return temp;
}

</strong></pre>
<p>The code above works for me with Visual Studio; I simply set up breakpoints on all the appropriate return lines to detect overflow.  When the code hits a break I look back through the stack trace to see where the overflow occurred.  You can also change these functions to defines and use asserts or print out the locations of the overflows.</p>
<p>In the new defines we just added I began with 16-bits of precision for the fractional part of the fixed point values.  If you are getting overflows reduce the fractional precision, one bit at a time, and retest until you either eliminate the overflows or fail your test.  If you can back off the fractional precision to eliminate the overflows, and your code still passes your tests, then you are one lucky developer!  But more likely when you reduce the fractional precision enough to eliminate the overflows your code will be broken. <img src='http://hawksoft.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Part 4 will cover scaling and modifying algorithms in preparation for the actual fixed point conversion</p>
]]></content:encoded>
			<wfw:commentRss>http://hawksoft.com/2010/floating-point-to-fixed-point-code-conversion-part-3-using-macros-to-bridge-the-conversion-process-419.shtml/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
