<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Forgettable Mister Ruthsarian</title>
	<atom:link href="http://ruthsarian.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ruthsarian.wordpress.com</link>
	<description>All manner of web development issues discussed, but with a heavy focus on CSS.</description>
	<lastBuildDate>Fri, 23 Dec 2011 23:16:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ruthsarian.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Forgettable Mister Ruthsarian</title>
		<link>http://ruthsarian.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ruthsarian.wordpress.com/osd.xml" title="The Forgettable Mister Ruthsarian" />
	<atom:link rel='hub' href='http://ruthsarian.wordpress.com/?pushpress=hub'/>
		<item>
		<title>More on Amazon Silk</title>
		<link>http://ruthsarian.wordpress.com/2011/09/29/more-on-amazon-silk/</link>
		<comments>http://ruthsarian.wordpress.com/2011/09/29/more-on-amazon-silk/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 14:41:22 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=504</guid>
		<description><![CDATA[A small Amazon Silk FAQ is now available on Amazon&#8217;s web site. Questions regarding privacy are at the bottom so hopefully you won&#8217;t read far enough down to see them. There you will find Amazon taking the opportunity to tell you how awesome Silk is and then direct you to the Amazon Silk Terms and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=504&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A small <a href="http://www.amazon.com/gp/help/customer/display.html?nodeId=200775440">Amazon Silk FAQ</a> is now available on Amazon&#8217;s web site. Questions regarding privacy are at the bottom so hopefully you won&#8217;t read far enough down to see them.</p>
<p>There you will find Amazon taking the opportunity to tell you how awesome Silk is and then direct you to the <a href="http://www.amazon.com/gp/help/customer/display.html/?nodeId=200775270">Amazon Silk Terms and Conditions</a> if you&#8217;re still interested in this silly privacy nonsense. However there is one small, but important piece before we move on to the ToC:</p>
<blockquote><p><strong>What about handling secure (https) connections?</strong></p>
<p>We will establish a secure connection from the cloud to the site owner on your behalf for page requests of sites using SSL (e.g. https://siteaddress.com). </p>
<p>Amazon Silk will facilitate a direct connection between your device and that site.  Any security provided by these particular sites to their users would still exist.</p></blockquote>
<p>If you use Amazon Silk then Amazon will be able to see everything you do over HTTPS. This is bad. Very, horribly, bad. And should be a red flag for anyone considering purchasing a Kindle Fire. Now about <a href="http://www.amazon.com/gp/help/customer/display.html/?nodeId=200775270">that ToC document</a>.</p>
<p>Straight away they give you the section on privacy and tell you that the Silk ToC includes the Amazon Privacy Notice. They&#8217;ve even gone and underlined it for you to make sure you see it. Curiously they don&#8217;t actually <em>link</em> to the document. Isn&#8217;t that a bit odd? I&#8217;ll help you out in a way Amazon.com won&#8217;t and point you to the <a href="http://www.amazon.com/gp/help/customer/display.html?nodeId=468496">Amazon.com Privacy Notice here</a>.</p>
<p>The basic idea of the Silk ToC is that they keep your information for &#8220;generally&#8221; no longer than 30 days and that everything you do over the web using Silk Amazon.com sees. Couple that with the <a href="http://www.amazon.com/gp/help/customer/display.html?nodeId=468496">privacy notice</a> and Amazon has given themselves the right to look at and analyze everything you do over the web with Silk.</p>
<p>However, there is one piece of news in the ToC:</p>
<blockquote><p>You can also choose to operate Amazon Silk in basic or “off-cloud” mode.  Off-cloud mode allows web pages generally to go directly to your computer rather than pass through our servers.  As such, it does not take advantage of Amazon’s cloud computing services to speed-up web content delivery.</p></blockquote>
<p>So it will be possible to use Silk without putting Amazon between you and the web. It&#8217;s unfortunate this option is buried in Amazon&#8217;s documentation and I suspect this option will be just as buried in Silk, but it is there. And that&#8217;s good, because <a href="http://www.informationweek.com/news/global-cio/interviews/231602369">the Kindle Fire does not support Android Market</a> which makes installing an <a href="http://www.dolphin-browser.com/">alternative browser</a> a bit problematic.</p>
<p>If I were in the market for an Android tablet I don&#8217;t think Silk would turn me off the Kindle Fire, however I am the type who likes to have as much control over my own hardware as possible and I don&#8217;t feel I would have complete control over a Kindle Fire in much the same way I don&#8217;t feel I&#8217;d have complete control over an iPad. Therefore I would probably look elsewhere.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/504/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/504/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/504/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/504/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/504/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/504/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/504/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/504/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=504&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/09/29/more-on-amazon-silk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>Amazon Silk</title>
		<link>http://ruthsarian.wordpress.com/2011/09/28/amazon-silk/</link>
		<comments>http://ruthsarian.wordpress.com/2011/09/28/amazon-silk/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 16:17:14 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=501</guid>
		<description><![CDATA[Today Amazon.com launched three new versions of their Kindle e-reader including a color tablet called Kindle Fire. In terms of hardware it&#8217;s about what you&#8217;d expect to see from something competing with the Barnes &#38; Noble NookColor that&#8217;s launched a year later; it&#8217;s slightly better, but nothing that stands out as revolutionary. But included with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=501&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today Amazon.com launched three new versions of their Kindle e-reader including a color tablet called Kindle Fire. In terms of hardware it&#8217;s about what you&#8217;d expect to see from something competing with the Barnes &amp; Noble NookColor that&#8217;s launched a year later; it&#8217;s slightly better, but nothing that stands out as revolutionary. </p>
<p>But included with the Fire is a new web browser called <a href="https://amazonsilk.wordpress.com/2011/09/28/introducing-amazon-silk/">Amazon Silk</a>. And Amazon would like you to know this is a new and different browser from anything you&#8217;ve seen before.</p>
<div style="text-align:center;">
<p><object width="600" height="338"><param name="movie" value="http://www.youtube.com/v/_u7F_56WhHk?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/_u7F_56WhHk?version=3" type="application/x-shockwave-flash" width="600" height="338" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
</div>
<p>So what&#8217;s the big deal about Silk? All you web requests go through Amazon&#8217;s servers which will handle retrieving all the content for you and optimize it wherever possible (e.g. a 3mb jpeg that&#8217;s sized to 300&#215;200 pixels will be resized by Amazon before being sent to you as a 50k jpg). Because Amazon&#8217;s servers are sitting on some of the fattest pipes on the interwebs, it&#8217;ll be able to pull down and deliver all this content to your Kindle significantly faster and more efficiently than if your browser was doing the work all by itself.</p>
<p>Sounds pretty nice, but I&#8217;m a bit of a pessimist. </p>
<p>I wonder if the image resize example given in the above video might have unexpected consequences. For example there may be web applications that purposely load a large image into your browser and allow you to zoom in and out and move around the image. Will Amazon&#8217;s services understand that scenario and know to not shrink the image? I can think of a few examples that use image clipping and revealing the full image when hovering over the clipped area using CSS. Will Amazon know that the clipped area is not the only part of the image being displayed? Perhaps only known situations are optimized rather than Amazon using software to guess.</p>
<p>My biggest worry, however, is that all your web browsing is now going through a third-party. If Amazon is making requests on your behalf it will need to preset session cookies to those sites your browsing. What happens when you need to log into a system over SSL? Does Silk make the HTTPS request through Amazon&#8217;s? Does that mean all your passwords will be, at some point, on Amazon&#8217;s servers? What happens if they&#8217;re ever compromised? Does Amazon log and can they track your browsing history? What happens when I try to go to Barnes &amp; Noble to buy something online through Amazon&#8217;s servers? Some web sites use session-hijacking prevention by comparing looking at things like your IP address. Amazon&#8217;s servers, as they point out in the video, are all over the world. Will my IP address stay the same throughout a session or will it change as requests are routed through different Amazon servers? Some web applications might break because of that.</p>
<p>Amazon must be logging your browsing with Silk. Imagine a scenario where someone posts some illegal material through Amazon Silk. Authorities will track down the IP which will lead them back to Amazon. Amazon must then have some mechanism to identify the user who posted the illegal material otherwise Silk becomes a giant anonymous proxy machine.</p>
<p>I&#8217;m very wary of Amazon Silk. I do not think I would never use it unless forced into a situation where no alternative was available. I don&#8217;t want some third-party sitting between me and the web sites I interact with, watching and recording everything I do.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/501/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=501&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/09/28/amazon-silk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>Texture &amp; Transparent Maths</title>
		<link>http://ruthsarian.wordpress.com/2011/09/26/texture-transparent-maths/</link>
		<comments>http://ruthsarian.wordpress.com/2011/09/26/texture-transparent-maths/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 17:05:29 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[alpha]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[rgba]]></category>
		<category><![CDATA[transparency]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=491</guid>
		<description><![CDATA[This is the kind of post that would benefit greatly from the addition of screenshots, but I&#8217;m far too lazy so you&#8217;re going to have to put a lot of this into your head and create your own screenshots. Now that&#8217;s out of the way, let&#8217;s talk about a situation that came up over the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=491&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the kind of post that would benefit greatly from the addition of screenshots, but I&#8217;m far too lazy so you&#8217;re going to have to put a lot of this into your head and create your own screenshots.</p>
<p>Now that&#8217;s out of the way, let&#8217;s talk about a situation that came up over the weekend. I was looking at <a href="http://teamdick.org/blog/">a particular layout</a> I&#8217;ve developed and lamented that the solid color background felt a little too empty. What it needed was some kind of texture to make it more visually interesting, but no so much that it takes attention away from the actual content of the page. What immediately came to mind were the linoleum tiles of an old grocery store I went to years ago which had solid color tiles with little dots of black and white color. I thought something like that might just pull off the trick of making things a little more visually interesting without taking away focus from the content of the page. So I needed to make some dots.</p>
<p><span id="more-491"></span><br />
<h3>Creating Texture</h3>
<p>I knew how I wanted to execute the texture: dots and short lines in colors of black, white, and a couple shades of gray with a transparent background. This way I could use this texture over any color I want and the range of colors for the dots would provide contrast with just about any background color I wanted. Perfect!</p>
<p>I fired up <a href="http://inkscape.org/">Inkscape</a> which has quickly become a favorite application of mine. On a fresh and empty canvas I created eight lines of varying length and made them all the same color. I then selected them, copied and pasted, and with the new group of lines selected, picked a different color. I repeated this process two more times to arrive at four groups of lines with the varying colors I wanted. At that point it was a simple matter of dragging the dots around and mixing them up over a relatively large, square area. Once I felt happy with the spread I selected them all, copied and pasted, and rotated the dots around to increase the density of the dots. I did some more arranging and by the time I was done I had a blob of dots on my screen.</p>
<p>I then broke out the select tool and selected an area within the blob and used Inkscape&#8217;s <em>export bitmap</em> feature (under the FILE menu) to export the selection to a PNG file. I then created a simple web page with the background color of the layout I was working with and then set this PNG as the background image. I loaded this page up in a web browser to see how things looked. It wasn&#8217;t bad, but the dots stood out a bit too much and the tiling of the image created an obvious pattern that stood out as well. These problems needed to be remedied.</p>
<p>To keep the dots from standing out so much I simply selected all the dots and set their opacity to 50%, making them semi-transparent. This cuts down on the strength of the color and the half-opacity allows the dots to blend with any background color. I exported a new PNG and reloaded the test web page. The colors were more muted, but still carried the texture. </p>
<p>To fix the tiling problem I stared at the page and let my eyes unfocus a bit and picked out what features were standing out. For example there were a group of white dots that, together, especially stood out. I broke those dots up, exported the bitmap, and reloaded the page. The tiling pattern was less obvious, but it was still noticeable. This time there were some black dots on the horizontal edges of the exported bitmap that appeared together when the image was tiled. This grouping stood out and made the tiling pattern obvious, so I move one of the dots off and exported the PNG one more time. Things were looking good. The only problem left was a small, but obvious gap of open space with no dots. I copied a couple existing dots, stuck it into the white-space, exported, reloaded, and <a href="http://home.earthlink.net/~dlarkins/slang-pg.htm#J">everything was jake</a>.</p>
<p>After applying the new PNG to the layout I thought some other elements might do with a bit of texture, especially the supplemental boxes that carry the site&#8217;s menus, so I applied the dots to those boxes as well and things looked pretty good, but the background color of menu items when the mouse was over one of them was hiding the underlying texture. I wondered if it would be possible to get the dots to show through.</p>
<h3>Transparent Maths</h3>
<p>The problem was I quite liked the color being used for the menus&#8217; hover state. If I was going to make this color transparent I needed it to be transparent in such a way that it blended with the background color to produce the same color I was using now without transparency.</p>
<p>Could that be done?</p>
<p>After a bit of internet searching I came across a simple formula used when blending two colors where the bottom color is fully opaque.</p>
<p><code>Final Color = Top Color * Top Alpha + Background Color * ( 1 - Top Alpha )<br />
or<br />
Fc = TcTa + Bc(1-Ta)</code></p>
<p>The menu background color (background color or Bc) was #f7ead5 or rgb(247,234,213). The hover state background color for menu items (the color I want to end up with or final color or Fc) was  #eecc33 or rgb(238,204,51). All I needed to do was pick a suitable transparency (or alpha) value and plug the values into the formula and solve for Tc. With an alpha value of, say, 50%, the formula could be arranged to look something like this:</p>
<p><code>Tc = (Fc - (Bc - (Bc * 0.5))) / 0.5</code></p>
<p>For example, solving for red, the formula looks like:</p>
<p><code>Tc = (238 - (247 - (247 * 0.5))) / 0.5 = 229</code></p>
<p>The new transparent color will have a red value of 229. Solving for green gives us a value of 174. However solving for blue gives us a value of -111. We can&#8217;t do negative color values, valid values are between 0 and 255. What happens if we set blue to 0?</p>
<div style="background-color:rgb(247,234,213);float:left;width:auto;line-height:2em;color:#666;padding:1px 1em;">
<div style="background-color:rgb(238,204,51);width:16em;text-align:center;margin:1em 0;">rgb(238,204,51)</div>
<div style="background-color:rgba(229,174,0,0.50);width:16em;text-align:center;margin:1em 0;">rgba(229,174,0,0.50)</div>
</div>
<div style="clear:left;">&nbsp;</div>
<p>You can see that the transparent version (using <a href="http://www.css3.info/preview/rgba/">CSS3&#8242;s rgba() color function</a>) is a bit muted in color when compared to the original. In the layout I was working with this was especially noticeable as all the colors in the layout&#8217;s palette are especially vibrant.</p>
<p>So what can we do? The first thing I did was rework the formula to solve for the alpha value that results in a blue value of 0. </p>
<p><code>Ta = (Fc-Bc / Tc-Bc) = (51-213) / (0-213) = 0.76</code></p>
<p>So an alpha value of 0.76 is the most transparent we can get to achieve the intended color of rgb(238,204,51). Plugging this new alpha value into the formula gives me a final RGBA value of rgba(235,195,0,0.76). When we use this value we see this:</p>
<div style="background-color:rgb(247,234,213);float:left;width:auto;line-height:2em;color:#666;padding:1px 1em;">
<div style="background-color:rgb(238,204,51);width:16em;text-align:center;margin:1em 0;">rgb(238,204,51)</div>
<div style="background-color:rgba(235,195,0,0.76);width:16em;text-align:center;margin:1em 0;">rgba(235,195,0,0.76)</div>
</div>
<div style="clear:left;">&nbsp;</div>
<p>That looks spot-on. I could further tinker with the alpha value a little to see how much lower I can make it before the color becomes too washed out, but for now I&#8217;m leaving it right where it is.</p>
<p>If you start playing around with overlaying transparencies like this you&#8217;ll want to watch out for your color limits. I lucked out with in this situation that I didn&#8217;t encounter any upper limits, but there are sure to be color combinations that will. My suggestion is to first solve the formulas for the transparency value you want and if any value goes beyond the 0-255 limit start playing with the formulas to find what values will keep you within limits. You may find there simply is no alpha value that will keep you within limits in which case you&#8217;re either out of luck or you need to rethink your color palette.</p>
<p>Good luck.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/491/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=491&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/09/26/texture-transparent-maths/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>SSL/TLS Broken and Disabling Javascript Fixes It</title>
		<link>http://ruthsarian.wordpress.com/2011/09/20/ssltls-broken-and-disabling-javascript-fixes-it/</link>
		<comments>http://ruthsarian.wordpress.com/2011/09/20/ssltls-broken-and-disabling-javascript-fixes-it/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 20:21:31 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=488</guid>
		<description><![CDATA[In a few days a flaw or attack on SSL/TLS (the stuff that protects your passwords and personal data as it goes across the internet) will be presented at Ekoparty. The attack requires the attacker be in position to intercept and inject into the data between the client and server, otherwise known as a man-in-the-middle [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=488&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a few days <a href="http://it.slashdot.org/story/11/09/20/1833232/Hackers-Break-Browser-SSLTLS-Encryption">a flaw or attack on SSL/TLS</a> (the stuff that protects your passwords and personal data as it goes across the internet) will be presented at <a href="http://www.ekoparty.org/">Ekoparty</a>. </p>
<p>The attack requires the attacker be in position to intercept and inject into the data between the client and server, otherwise known as a man-in-the-middle attack. The attack appears to use javascript to send out known plaintext over an encrypted channel and allow attackers to then crack the encryption key using that known plaintext.</p>
<p>The simplest solution to protect yourself is to disable javascript. </p>
<p>As a web developer I look at things like <a href="http://noscript.net/">noscript</a>, cross-site scripting, and exploits like this as reasons to believe that users of my web site may not have javascript enabled. Therefore it is vital that javascript not be a critical component to using any site I manage. That doesn&#8217;t mean never use it, it only means that your web site still be usable without it. Treat it like Flash, or Java, or any other function that isn&#8217;t explicitly defined in the HTML or CSS specs. These things can make life easier for the user, but should never be a requirement.</p>
<p>This latest exploit, with the immediate message to end-users being disable javascript until a fix is ready, puts those web developers who rely on javascript to provide critical function to their site in a bad position. Don&#8217;t be one of those developers.</p>
<p>Eventually the practice of at least a white-list approach (see noscript) to Flash, Javascript, etc., if not completely removing them from the browser, will become the norm for even basic web users. It may not happen this year, or even in the next five years, but it&#8217;s very likely to happen as attacks on the web layer continue to grow.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/488/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=488&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/09/20/ssltls-broken-and-disabling-javascript-fixes-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>printf(&#8220;Hello, world!\n&#8221;);</title>
		<link>http://ruthsarian.wordpress.com/2011/09/20/printfhello-worldn/</link>
		<comments>http://ruthsarian.wordpress.com/2011/09/20/printfhello-worldn/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 17:42:54 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=485</guid>
		<description><![CDATA[I haven&#8217;t been blogging much because I really haven&#8217;t had much to say. Browsers have gotten to a point where most people are using something that doesn&#8217;t require extensive or creative CSS hacks to work with basic CSS-driven layouts which was my bread-and-butter for the middle part of the last decade. I recently did a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=485&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t been blogging much because I really haven&#8217;t had much to say. Browsers have gotten to a point where most people are using something that doesn&#8217;t require extensive or creative CSS hacks to work with basic CSS-driven layouts which was my bread-and-butter for the middle part of the last decade.</p>
<p>I recently did a bit of contract work which inspired me to work on a new layout which then inspired me to do some spring cleaning and share with you a bunch of old designs I&#8217;ve started over the last five years, but never got around to finishing. So hang on, there&#8217;s a bunch of new stuff to get through.<br />
<span id="more-485"></span></p>
<h2><a href="http://webhost.bridgew.edu/etribou/layouts/simplify/">Simplify</a></h2>
<p><a href="http://webhost.bridgew.edu/etribou/layouts/simplify/">Simplify</a> is the new layout that I put together over the last week. I never intend for the layouts I create to be so damn boxy, but inevitably that happens. Furthermore most of the layouts I&#8217;ve been working with have multiple stylesheets and that can be a bit overwhelming especially to those relatively new to CSS. Simplify is something of an answer to those feelings of &#8220;I don&#8217;t like that&#8221; (which seems to be a primary motivator for me). </p>
<p>The layout is still a bit boxy, there are corners, but there are no edges to the page for the purpose of making the layout feel more open. The styling is intentionally plain (given the name you should expect that) with just black text on a white background.</p>
<p>There&#8217;s a famous Dutch artist named &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Piet_Mondrian&quot;Piet Mondrian</a> who got famous for painting a few boxes in solid, primary colors. I never understood that and when I enrolled in an introductory art class a few years ago my single goal was to come away with an understanding of Mondrian and I think I was successful. The idea is Mondrian was breaking down art into it&#8217;s most basic elements, a bit like scientists trying to find the most basic form of matter (atoms, quarks, etc.) From that breaking down we look to define the most basic properties of what stuff is, be it art or matter, and hopefully find a fuller understanding of the whole.</p>
<p>I think <a href="http://webhost.bridgew.edu/etribou/layouts/simplify/">Simplify</a>is a step in that direction. I&#8217;m not down to quarks; probably closer to particles of matter with atoms, protons, and quarks still to come.</p>
<h2><a href="http://webhost.bridgew.edu/etribou/layouts/portal/">Portal</a></h2>
<p><a href="http://webhost.bridgew.edu/etribou/layouts/portal/">Portal</a> is a layout I originally created for an application that would act as a transitional phase between and old portal system and a new, yet undefined system. Unfortunately the pseudo-portal application I wrote never caught, but I can at least share the layout. There&#8217;s a lot of generic styles defined in the stylesheet to be used in configuring both the layout of the page as well as individual portlets. I like the color scheme I had picked out (which is a rare thing for me) and I&#8217;d hate to see this thing go to waste so I&#8217;m sharing it in the hopes that others might find it useful.</p>
<h2><a href="http://webhost.bridgew.edu/etribou/layouts/exp/">Experimentation Chamber</a></h2>
<p>The <a href="http://webhost.bridgew.edu/etribou/layouts/exp/">Experimentation Chamber</a> has been around for quite a while, but you could only get into it if you ever noticed the little door icon in the upper-right corner of the <a href="http://webhost.bridgew.edu/etribou/layouts/">layouts page</a> (which very few did). So now I&#8217;m not only drawing attention to it, but also to the fact that I&#8217;ve added quite a lot to it.</p>
<p>Specifically you&#8217;ll want to check out the <em>Abandoned/Unfinished Layouts</em> section where you&#8217;ll find crap I started on and eventually forgot about over the years. The Flux layout is actually used right now in a production environment, but all the tweaks and changes made to that version haven&#8217;t been carried over to the version on the layouts site which is why it&#8217;s under the <em>unfinished</em> category.</p>
<p>There are a couple layouts in the wild that I produced which I can tell you a little about. One is for a blog called <a href="http://teamdick.org/blog/">Team Dick</a> and another is for <a href="http://s8.org/gargoyles/comment/">Gargoyles on Station Eight</a>. The S8 one is a couple years old, but I think has held up pretty well. I may clean that up, change the drop-down menu shadows from images to CSS3 box-shadows and release it into the public domain. The Team Dick layout won&#8217;t be released into the public domain for a while as it&#8217;s relatively new and I feel it still needs a bit of tweaking.</p>
<p>The rest of the chamber is worth going through, but the layouts are probably what most people are interested in.</p>
<h2>Xanadu</h2>
<p>Speaking of <a href="http://teamdick.org/blog/">Team Dick</a>, there&#8217;s a post on there that might actually interest people reading this blog. It&#8217;s <a href="http://teamdick.org/blog/2011/05/27/xanadu/">a post on Xanadu</a> which is a life-long project of <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Ted_Nelson">Ted Nelson</a>. Xanadu has some really interesting ideas about it that set it apart from the world wide web. It&#8217;s an interesting read if you&#8217;re into that sort of thing.</p>
<p>That&#8217;s about it for my biannual blog post.</p>
<p>Have fun!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/485/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=485&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/09/20/printfhello-worldn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>Responsive Web Design</title>
		<link>http://ruthsarian.wordpress.com/2011/02/08/responsive-web-design/</link>
		<comments>http://ruthsarian.wordpress.com/2011/02/08/responsive-web-design/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 18:12:00 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=477</guid>
		<description><![CDATA[Responsive web design is a term used to describe a web design that adapts itself to the end-user&#8217;s environment. This isn&#8217;t a new concept, but advancements in browser technology as well as a greater increase in viewing environment (desktop, netbook, smartphone, etc.) is allowing for some new and interesting tricks to our bag. Responsive web [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=477&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.alistapart.com/articles/responsive-web-design">Responsive</a> <a href="http://www.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/">web design</a> is a term used to describe a web design that adapts itself to the end-user&#8217;s environment. This isn&#8217;t a new concept, but advancements in browser technology as well as a greater increase in viewing environment (desktop, netbook, smartphone, etc.) is allowing for some new and interesting tricks to our bag.</p>
<p><em>Responsive web design</em> is something that&#8217;s been around since the first web designs came out utilizing percent values to define the widths of objects, such as TABLE, DIV, and IMG elements. The idea was that a person on a 640&#215;480 resolution screen can view the web site, but a person with a larger resolution like 1024&#215;768 would be able to see more content on their screen as the layout would expand to the edges of the larger viewport (the area in which a web page is rendered). This idea was somewhat radical back in the early 1990s as most layouts would simply set a fixed width for the layout (usually 780 or 1000 pixels) and state quite plainly on the web site that it was designed to be &#8220;best viewed in 1024&#215;768&#8243;.</p>
<p>Things got more interesting with CSS. Web designs could now use percentages for margins, padding, and placement of elements within a page. Layouts that would expand and contract with the viewport could be more complicated. Especially handy were the CSS <code>max-width</code> and <code>min-width</code> attributes. These allowed you to set limits on just how much your layout would expand or contract before forcing the viewport to stop resizing the layout. Now layouts could expand and contract, but not so much that they became unusable.</p>
<p>Enter <a href="http://www.w3.org/TR/css3-mediaqueries/">CSS3 media queries</a>.</p>
<p>But first, a small caveat to web developers.</p>
<p>The <a href="http://www.w3.org/TR/css3-roadmap/">CSS3</a> spec is not yet final. In fact there isn&#8217;t (or is, depending on your point of view) really a CSS3 spec at all. CSS3 is a collection of modules and therefore somewhat open-ended. You can see <a href="http://www.w3.org/Style/CSS/current-work">a list of some of the CSS3 modules and their curren status here</a>. Some CSS3 modules are currently in an early format and not recommended for implementation, while others have reached a state where it&#8217;s not quite final, but browser authors are encouraged to implement these modules and supply feedback to help refine the spec before it becomes final. Media queries are in such a state and as such several modern browsers have already implemented them including the latest releases of Firefox, Chrome, Safari and Opera. So web developers can start making use of them now and those users who run modern web browsers will be able to enjoy your use of CSS3.</p>
<p>At the same time, I do not recommended you rely heavily on CSS3 modules in any designs for the near future, or that if you do, you do so while making sure to check compatibility of the layout against older browsers. While the general public appears to be more capable at keeping up to date with their browser (mainly thanks to the automated update features of several OSes and the increased proliferation of broadband internet connections),  there&#8217;s still a significant number of users (<a href="http://www.netmarketshare.com/browser-market-share.aspx?qprid=2">over 50% according to this site</a>) who are using Internet Explorer 8 or earlier, which does not support media queries (or much else in the way of CSS3). <a href="http://msdn.microsoft.com/en-us/library/cc351024%28VS.85%29.aspx#media">IE9 will support media queries</a>.</p>
<p>Now that that&#8217;s out of the way, what can media queries do for us? Simply stated, you can apply styles based on <a href="http://www.w3.org/TR/css3-mediaqueries/#media1">many attributes of the viewport</a>. To keep things brief-ish and to the point, I&#8217;m going to specifically focus on width-related media queries. Let&#8217;s see what one looks like:</p>
<pre>#frame { width: 1000px; margin: 0 auto; }
@media screen and ( max-width: 480px ) {
  #frame {
    width: 100%;
  }
}</pre>
<p>The above example will make an element with the id of &#8220;frame&#8221; to be 1,000 pixels wide and will center (via the margin value <code>auto</code> for the left and right margin properties) it in the middle of the viewport if the viewport is wider than 1,000 pixels. On the second line is a media query. It begins with <code>@media screen</code> (in place of &#8220;screen&#8221; you can use &#8220;all&#8221; for any media, or &#8220;print&#8221; for print media, etc.) which lets the browser know that the following block of CSS should only be applied to the screen. This is followed by <code>and ( max-width: 480px )</code> which is the media query. It states that the following block of rules should also only be applied when the viewport is at or less than 480 pixels in width. You can also use <code>min-width</code> to tell the browser the block of rules should only be applied when the viewport is at least 480 pixels wide.</p>
<p>Why would you want such a thing? If a viewport is that narrow and you have wide elements or you have multiple columns, chances are those elements would be very usable at such a narrow width. With a media query you can change the layout to something more usable on a small screen. For example, consider a layout that has multiple columns. At 480 pixels your columns will barely fit a few words per line, if any at all. Reading text becomes very difficult. With a media query you can drop your multiple columns into a single column layout. Now each column will have the full width of the viewport to render its content, making it much more usable.</p>
<p>In the example above I am removing the fixed-width on the #frame element and resetting its width to 100% of the viewport. Smartphone users will be able to view the content of the layout much more easily and without having to scroll horizontally to read each line.</p>
<p>Excellent! Now go and design for the masses!</p>
<p>But&#8230; not quite yet. There&#8217;s one problem. Some smartphones are a bit too smart. They understand not many web designs are out there that take advantage of these features. Instead these smartphones will scale the rendering of the page. While the screen may only have 480 pixels of width, it&#8217;ll render web pages as if it had 1024 pixels of width and then scale it down to fit the screen. Media queries alone won&#8217;t fix this problem.</p>
<p>However, there is a solution.</p>
<p>The<a href="https://developer.mozilla.org/en/Mobile/Viewport_meta_tag"> viewport meta tag</a> allows you to tell browsers how to scale the web page. Most mobile browsers understand this tag including the mobile version of Safari found on may Apple devices and the mobile version of Opera which is found just about everywhere else. So to fix the mobile browser scaling issues, just include the following META tag into your web page:</p>
<pre>&lt;meta name="viewport" content="width=device-width; initial-scale=1.0;"&gt;</pre>
<p>This tag tells the browser to render the web page with a 1-to-1 pixel scaling. Meaning 1 pixel of your web site is 1 pixel on the device&#8217;s screen. There are many other attributes you can include in this META tag such as maximum and minimum scaling values or whether the user is allowed to scale the page. Disabling user scaling effectively disables the pinch-zoom feature of many mobile devices. I recommend against it.</p>
<p>One last thing to touch upon before I give you a working example. It&#8217;s a simple block of CSS that will help make everything run much more smoothly on a mobile browser:</p>
<pre>img { max-width: 100%; }</pre>
<p>This little CSS rule allows images to shrink as needed as their containing element shrinks. So a 600 pixel wide image will shrink enough to fit on a 480 pixel wide browser. It&#8217;s a cheap, but very useful trick. However I would suggest that you don&#8217;t use the exact CSS rule given above. To apply such a thing to all images may have unexpected negative effects on images that you don&#8217;t want to have shrink as needed. Instead use a more specific CSS selector such as</p>
<pre>#frame .blog-post .post-content img { max-width: 100%; }</pre>
<p>The more specific you are, the less surprises you&#8217;ll have down the road.</p>
<p>As promised, I have put together a demonstration web page that utilizes all these techniques. Grab a modern browser that isn&#8217;t Internet Explorer, open the layout, and start shrinking and growing your browser&#8217;s window to see the content and layout change to fit within the width of your window. Pop it open on your smartphone&#8217;s browser as well!</p>
<p><a style="font-size:200%;display:block;text-align:center;margin:1em 0;" href="http://webhost.bridgew.edu/etribou/layouts/exp/responsive1.htm">MARS: Responsive Layout Demo</a></p>
<p>The stylesheet is embedded in the source to encourage you to take a look at the whole source for the page. It has also been given some CSS hacks so that the layout will work even in IE 7 and IE 6 (in theory), but all the media query stuff will obviously not work.</p>
<p>One final note.</p>
<p>At home I have a very wide (16:10) monitor, while at work I have a standard (4:3) monitor. I like to set max-widths to my layouts because keeping the distance from end to end of a given line of text small helps reduce eyestrain and the whitespace on either side of the layouts is more visually pleasing. But on a very wide monitor, the whitespace on the sides is too much and it makes the layout look very small. With media queries I can fix this problem by increasing the max-width of my layout frame for those screens with a very large width (over 1280 pixels). I could also increase the font size to help with readability. The point is that media queries aren&#8217;t just for keeping your pages usable on a smartphone, but they also help keep them usable on very large screens as well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/477/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=477&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/02/08/responsive-web-design/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>A Brief Ping</title>
		<link>http://ruthsarian.wordpress.com/2011/02/07/a-brief-ping/</link>
		<comments>http://ruthsarian.wordpress.com/2011/02/07/a-brief-ping/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 16:00:22 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=475</guid>
		<description><![CDATA[It&#8217;s been nearly half a year since my last post and that needs to be rectified. There are a few things worth talking about such as the situation with the HTML spec. W3C maintains one HTML spec, while WHATWG maintains another. They were playing nicely, but there&#8217;s been a small shake-up recently with WHATWG deciding [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=475&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been nearly half a year since my last post and that needs to be rectified.</p>
<p>There are a few things worth talking about such as the situation with the HTML spec. <a href="http://www.w3.org/">W3C</a> maintains one <a href="http://www.w3.org/TR/html5/">HTML spec</a>, while <a href="http://www.whatwg.org">WHATWG</a> maintains <a href="http://www.whatwg.org/html">another</a>. They were playing nicely, but there&#8217;s been a small shake-up recently with WHATWG deciding to drop version numbers from the spec, while the W3C will continue to call the latest spec HTML5. How the hell did we wind up in this situation? Well WHATWG has a great piece in their HTML spec that gives <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/introduction.html#history-1">a brief history of the HTML spec</a>. It&#8217;s not too long and very much worth reading to get an idea of where HTML came from and where it&#8217;s going.</p>
<p>News web sites tend to have a template ready to go whenever there&#8217;s &#8220;breaking news&#8221;. It&#8217;s often a big, brightly colored box with bold text usually stating &#8220;BREAKING NEWS&#8221;. This is quite an attention getter. A fact that is not lost on modern news web site developers. Lately &#8220;BREAKING NEWS&#8221; web stingers are being used to report extremely mundane news. The reason they are using these stingers at all is to simply grab your attention and get you to click through to read the full story. The problem is these news sites are quickly diluting the news value of their &#8220;BREAKING NEWS&#8221; stingers and sooner rather than later we&#8217;ll start to ignore them alltogether. So what will news web sites do when real breaking news happens? I have some thoughts on that which I&#8217;ll save for a later blog post, but it&#8217;s something to consider.</p>
<p>A small gift to those who have read this far. <a href="http://webhost.bridgew.edu/etribou/layouts/exp/palette_test.htm">Here is a template I put together last week to test palette options.</a> This isn&#8217;t a layout. You could use it for a web site, but I haven&#8217;t done anything to make it compatible with older browsers. It&#8217;s more just to test potential color palettes for web sites. And a great place to find palettes is <a href="http://www.colourlovers.com/">COLOURlovers</a>.</p>
<p>Now that I&#8217;ve given away one of my design secrets, I&#8217;m off. I expect there will be less of a delay between this and my next post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/475/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/475/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/475/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/475/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/475/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/475/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/475/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/475/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=475&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2011/02/07/a-brief-ping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>A Look Into The Crystal Ball</title>
		<link>http://ruthsarian.wordpress.com/2010/08/03/a-look-into-the-crystal-ball/</link>
		<comments>http://ruthsarian.wordpress.com/2010/08/03/a-look-into-the-crystal-ball/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 14:58:23 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[Philosophy]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=367</guid>
		<description><![CDATA[&#8220;The Cloud&#8221; is a buzzword meaning third-party hosted internet applications. To the individual this means being able to manage your content from any location that provides some form of internet access. Things like gmail, Google Docs, Flickr, WordPress.com and YouTube are examples. To the corporation it&#8217;s a form of outsourcing. Gone are the days of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=367&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#8220;The Cloud&#8221; is a buzzword meaning third-party hosted internet applications.</p>
<p>To the individual this means being able to manage your content from any location that provides some form of internet access. Things like gmail, Google Docs, Flickr, WordPress.com and YouTube are examples. </p>
<p>To the corporation it&#8217;s a form of outsourcing. Gone are the days of large data centers to manage corporate information. Now the information is stored in the cloud. Now it&#8217;s someone else&#8217;s nightmare to manage. </p>
<p>It&#8217;s also a security nightmare for those who dare to take a moment to consider the security costs rather than the monetary costs associated with &#8220;the cloud&#8221;. You lose control of your information. You&#8217;re putting it into the hands of a third-party. You may have a contract with them that makes them responsible for any security breaches. In fact some managers prefer the cloud specifically because there&#8217;s a security contract that, in legal form at least, takes responsibility off their heads. But that doesn&#8217;t mean a security breach won&#8217;t happen. And when it does, when the genie is out of the bottle, what becomes more significant, that the information is out there or that you&#8217;re not going to get fired?</p>
<p>Sadly, I think most IT managers would answer the latter. </p>
<p>Privacy is one aspect of security, but it&#8217;s a concept that&#8217;s slowly starting to catch on. The public is slowly and painfully becoming aware that putting all their information out on third-party sites, that probably doesn&#8217;t have the individual&#8217;s best interests in mind, is a bad idea. The recent stir surrounding Facebook&#8217;s privacy issues is one example of this.</p>
<p>And as much as I would love to see this catch hold and become a driving force that tears apart &#8220;The Cloud&#8221; and everything &#8220;2.0&#8243;, it won&#8217;t. People will be quick to forgive or forget or to tolerate those privacy issues in return for easy access to information and entertainment.</p>
<p>&#8220;The Cloud&#8221; is probably not going to go away. In fact, it&#8217;s probably going to be the future. And it will be incredibly attractive.</p>
<p>I&#8217;m going to focus mainly on &#8220;the Cloud&#8221; from the individual perspective. </p>
<p>Imagine an iTunes subscription. You could stream any music you want to any device you have, be it your phone while on the way to work or a tablet while you&#8217;re at home reading a book on it or a set-top box at your friend&#8217;s house who needs some background music for his or her party. Or from your hotel room while on a trip. You don&#8217;t have to carry any actual electronic device with you. Your music is in &#8220;The Cloud&#8221; and you can stream it from any electronic device.</p>
<p>Now apply the same idea to NetFlix or Hulu. Actually, NetFlix and Hulu (in many ways) already do exactly this.</p>
<p>E-mail? Photos? Documents? Gmail. Flickr. Google Docs. </p>
<p>All your information is in &#8220;The Cloud&#8221;. Ready for you to pull it up on any internet-enabled device, from your iPhone to a computer in an internet cafe halfway around the world.</p>
<p>This type of access already exists, but the interface is too clunky. I imagine a near future with some sort of set top device that you plug into a television that would provide all of this for you. It would become a common feature at most hotels and certainly everyone from grandma on down would have one in their house. No real computer needed anymore, just a thin client with a web browser and maybe a hardware video decoder.</p>
<p>And for the high-end user there would be the portable device. Something like an iPhone4 but with extra features like a micro projector to watch movies on the wall (who needs a TV?) and a small suction-cup device that turns any flat surface (window, table, etc) into a large speaker to provide clear sound.</p>
<p>There would be movie parties. Where everyone would sign into a private room on NetFlix and could watch the same movie and talk to each other, while each person sits in their own room separated by hundreds of miles. </p>
<p>Friendships would no longer need face-to-face meetings. Everyone becomes an avatar. A projected personality that may or may not relate to the individual&#8217;s physical presence.</p>
<p>Soon meetings would be conducted in a similar fashion. No longer do we need a boardroom, simply start up your telepresence app and everyone sees and hears each other without ever having to leave their cubicle. </p>
<p>Of course in such a world a room full of cubicles with dozens of separate conversations going on would create quite a bit of background noise and interference. Which is why cubicles would become something more like miniature offices with sound proofs walls and no windows.</p>
<p>You don&#8217;t really need to see outside. Just start up the local weather app to project an image of what it looks like outside; tailor-made to your preferred surroundings of a wooded area or urban setting.</p>
<p>Eventually such archaic devices like projectors, speakers, and microphones will be made obsolete with brain implants. Telepresence becomes more real. You don&#8217;t just see, you feel and smell and taste and touch. Physical contact with others can be achieved even though your thousands of miles apart.</p>
<p>The porn industry reaches its full potential. It&#8217;s not prostitution anymore, it&#8217;s all virtual. Every depraved and deviant fetish is now catered to, and it&#8217;s all virtual, it&#8217;s all fake. But it will feel <em>very</em> real. And what is real, but signals processed by your brain. It <em>is</em> real.</p>
<p>And one day some alien race might finally find our planet. Perhaps touch down and have a look around. They&#8217;ll walk the halls of large buildings filled with small, personal-refrigerator sized cubicles. Automated machines keep everything running smoothly. Perhaps interest gets the better of them. They peek inside one of the refrigerators and find a curious gray mass in a container of goo with some probes.</p>
<p>Say hello, then, to your grandchildren a million years from now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=367&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2010/08/03/a-look-into-the-crystal-ball/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>In The Zone With Time</title>
		<link>http://ruthsarian.wordpress.com/2010/08/02/in-the-zone-with-time/</link>
		<comments>http://ruthsarian.wordpress.com/2010/08/02/in-the-zone-with-time/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 18:45:10 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Informational]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=396</guid>
		<description><![CDATA[The account-expires attribute in Active Directory carries a value of time in 100 nanosecond units since January 1, 1601 00:00 UTC. In fact quite a lot of Microsoft products are now using this epoch. Java and Unix use January 1, 1970 00:00 UTC as their epoch. This is important information if you&#8217;re ever going to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=396&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://msdn.microsoft.com/en-us/library/ms675098%28VS.85%29.aspx">account-expires</a> attribute in Active Directory carries a value of time in 100 nanosecond units since <code>January 1, 1601 00:00 UTC</code>. In fact quite a lot of Microsoft products are now using this <a href="http://en.wikipedia.org/wiki/Epoch_%28reference_date%29">epoch</a>. Java and Unix use <code>January 1, 1970 00:00 UTC</code> as their epoch.</p>
<p>This is important information if you&#8217;re ever going to develop code in ColdFusion that needs to, for example, figure out whether or not a domain account has expired.</p>
<p>Another piece of information that&#8217;s handy to have is an understanding of how ColdFusion handles large numbers. Numeric values are handled as signed 32-bit values that can range from -2,147,483,648 to 2,147,483,647. ColdFusion can handle much larger numbers, but it does so by converting numeric values into strings and then using its own library to handle math operations based on these strings. And it stores these large values in <a href="http://en.wikipedia.org/wiki/Scientific_notation">scientific notation</a>. The problem with this is you start to lose precision. For example, if you run the following CF snippet:</p>
<p><code>&lt;cfoutput&gt;#( 2147483648 * 2147483648 )#&lt;/cfoutput&gt;&lt;br&gt;<br />
&lt;cfoutput&gt;#( 2147483648 * 2147483648 + 1)#&lt;/cfoutput&gt;</code></p>
<p>The output is the same for both operations, &#8220;<code>4.61168601843E+018</code>&#8220;. This loss of precision makes it impossible to calculate the exact time <code>account-expires</code> refers to. So what else can we do?</p>
<p>One trick that sort of works is to divide the value in <code>account-expires<br />
</code> by 10000000 to convert from 100 nanoseconds to seconds. This will significantly shorten the number. So let&#8217;s try that on an account-expires value of &#8220;129247307050000000&#8243; (that&#8217;s 7/27/10 @2:58.25 EDT). The line of CF looks like this:</p>
<p><code>&lt;cfoutput&gt;#DateAdd( "s", ( 129247307050000000 / 10000000 ), "01/01/1601 12:00 AM")#&lt;/cfoutput&gt;</code></p>
<p>Try to run this code and you get the error message &#8220;Cannot convert the value 1.2924730705E10 to an integer because it cannot fit inside an integer.&#8221;. It turns out that <code>DateAdd()</code> can&#8217;t handle a number larger than 2147483647 (the limit of a 32-bit signed integer). 2,147,483,647 seconds is about 70 years of time. To use <code>DateAdd()</code> we need to make the account-expires value much smaller. We could, for example, calculate the account-expires value with respect to a different epoch, one that&#8217;s within 70 years of the time referenced by account-expires. We could use any date we want, but I&#8217;m going to stick with Java&#8217;s epoch of January 1, 1970 to keep things in-line with what&#8217;s probably the most common epoch among computer systems.</p>
<p>The number of seconds between January 1, 1601 and January 1, 1970 is 11,644,473,600. If we plug this into the code above we get this:</p>
<p><code>&lt;cfoutput&gt;#DateAdd( "s",  ( 129247307050000000 / 10000000 ) - 11644473600, "01/01/1970 12:00 AM")#&lt;/cfoutput&gt;</code></p>
<p>Run this and we get a result! Specifically <code>{ts '2010-07-27 19:58:25'}</code>. Remember this is in UTC, we&#8217;ll need to convert to our local timezone. We&#8217;ll do that in just a moment. But first&#8230;</p>
<p>You should have recognized by now that this solution won&#8217;t work forever. It will fail whenever the data in account-expires is after January 19, 2038. Perhaps this doesn&#8217;t bother you since whatever applications you&#8217;re developing now will surely be either obsolete or running on a more modern ColdFusion system where <code>DateAdd()</code> can deal with larger numbers before account-expires with that large a value are in use.</p>
<p>Perhaps. But I hate making assumptions like that. Plan for the future! Assume nothing!</p>
<p>If we want lasting code free of the 2038 limitation we&#8217;ll need to steer clear of ColdFusion date and time functions. We can do this by using Java objects, specifically <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/util/Calendar.html"><code>java.util.Calendar</code></a> to manage date and time, and <a href="http://download-llnw.oracle.com/javase/1.4.2/docs/api/java/math/BigInteger.html"><code>java.math.BigInteger</code></a> to handle the very large numbers we&#8217;ll be working with.</p>
<p>The process is fairly straightforward, but there are a few things to watch out for. Java time is measured in milliseconds, not 100 nanoseconds, so we&#8217;ll have to do some conversion. Java and Microsoft&#8217;s epochs are different. Calendar objects with a date and time earlier than Java&#8217;s epoch will have a negative millisecond value. And we need to calculate this date/time with respect to UTC (GMT timezone) not the local timezone.</p>
<p>First create a BigInteger object. Initialize it to the value of account-expires, and then convert it to milliseconds as that&#8217;s the unit of time Java likes to work with.</p>
<p><code>01: &lt;cfset variables.bigInt = CreateObject( "java", "java.math.BigInteger" ) /&gt;<br />
02: &lt;cfset variables.expTime = variables.bigInt.init( JavaCast( "String", "#arguments.accountExpires#" )) /&gt;<br />
03: &lt;cfset variables.expTime = variables.expTime.divide( variables.bigInt.valueOf( "10000" )) /&gt;</code></p>
<p>You can initialize BigInteger objects with strings and numerical values. I&#8217;m specifically casting account-expires as a string so that ColdFusion doesn&#8217;t treat it like an integer and try to put it into scientific notation. Note in line 3 the use of BigInteger&#8217;s <code>valueOf()</code> function. This takes a string and returns a BigInteger value. Math functions for BigInteger objects require BitInteger arguments, thus we need to pass all values (even static ones) through <code>valueOf()</code> instead of <code>JavaCast()</code>.</p>
<p>Next we set up the calendar object. This means creating a <code>java.util.TimeZone</code> object, a <code>java.util.Calendar</code> object, and then initializing the calendar to the GMT timezone. Once the calendar object is initialized we set it to Microsoft&#8217;s epoch.</p>
<p><code>04: &lt;cfset variables.tz = CreateObject( "java", "java.util.TimeZone" ) /&gt;<br />
05: &lt;cfset variables.Calendar = CreateObject( "java", "java.util.Calendar" ) /&gt;<br />
06: &lt;cfset variables.gCal = variables.Calendar.getInstance( tz.getTimeZone( "GMT" )) /&gt;<br />
07: &lt;cfset variables.gCal.set( 1601, 0, 1, 0, 0, 0 ) /&gt;</code></p>
<p>Note that the second argument of the calendar object&#8217;s <code>set()</code> function is 0. Java&#8217;s calendar object&#8217;s month index begins with 0 for January instead of 1. This is something to be aware of whenever dealing with Java calendar objects.</p>
<p>This next step requires a little explanation. <code>variables.expTime</code> is now in milliseconds thanks to line 3. I&#8217;m going to add the value of the calendar, in milliseconds, to <code>variables.expTime</code>. Because the calendar is set to a date before Java&#8217;s epoch it will actually be a negative number. The addition operation is actually a subtraction operation. The resulting value of <code>variables.expTime</code> will be the number of milliseconds since Java&#8217;s epoch.</p>
<p><code>08: &lt;cfset variables.expTime = variables.expTime.add( variables.bigInt.valueOf( "#variables.gCal.getTimeInMillis()#" )) /&gt;</code></p>
<p>All we need to do now is reset the calendar to the value we now have in <code>variables.expTime</code>, then convert it to our local timezone and we&#8217;re done!</p>
<p><code>09: &lt;cfset variables.gCal.setTimeInMillis( variables.expTime.longValue() ) /&gt;<br />
10: &lt;cfset variables.gCal.setTimeZone( tz.getDefault() ) /&gt;</code></p>
<p>Last, but not least, we convert the calendar object into a ColdFusion date/time object with ColdFusion&#8217;s <code>CreateDateTime()</code> function.</p>
<p><code>11: &lt;cfset variables.expDateTime = CreateDateTime(<br />
variables.gCal.get( variables.gCal.YEAR ),<br />
variables.gCal.get( variables.gCal.MONTH ) + 1 ,<br />
variables.gCal.get( variables.gCal.DAY_OF_MONTH ),<br />
variables.gCal.get( variables.gCal.HOUR_OF_DAY ),<br />
variables.gCal.get( variables.gCal.MINUTE ),<br />
variables.gCal.get( variables.gCal.SECOND )<br />
) /&gt;</code></p>
<p>Note that I&#8217;m adding 1 to the month variable because in Java 0 = January, but in ColdFusion 1 = January.</p>
<p>And there you have it. Converting from Microsoft&#8217;s 01/01/1601 100 nanosecond based timestamps to something a bit more usable in ColdFusion.</p>
<p>Of course you&#8217;ll need a reverse of this process as well, and I&#8217;ve already got that for you:</p>
<p><code>01:  &lt;cfset variables.tz = CreateObject( "java", "java.util.TimeZone" ) /&gt;<br />
02:  &lt;cfset variables.Calendar = CreateObject( "java", "java.util.Calendar" ) /&gt;<br />
03:  &lt;cfset variables.gCal = variables.Calendar.getInstance( tz.getDefault() ) /&gt;<br />
04:  &lt;cfset variables.gCal.set(<br />
Year( arguments.Date ),<br />
Month( arguments.Date ) - 1,<br />
Day( arguments.Date ),<br />
Hour( arguments.Date ),<br />
Minute( arguments.Date ),<br />
Second( arguments.Date )<br />
) /&gt;<br />
05: &lt;cfset variables.bigInt = CreateObject( "java", "java.math.BigInteger" ) /&gt;<br />
06: &lt;cfset variables.expTime = variables.bigInt.init( JavaCast( "String", "#variables.gCal.getTimeInMillis()#" )) /&gt;<br />
07: &lt;cfset variables.expTime = variables.bigInt.divide( variables.bigInt.valueOf( "1000" )) /&gt;<br />
08: &lt;cfset variables.expTime = variables.expTime.add( variables.bigInt.valueOf( "11644473600" )) /&gt;<br />
09: &lt;cfset variables.expTime = variables.expTime.multiply( variables.bigInt.valueOf( "10000000" )) /&gt;<br />
10: &lt;cfreturn variables.expTime.longValue() /&gt;</code></p>
<p>You should be able to follow along based on my explanation earlier in the article. However there are a couple extra bits I&#8217;d like to point out.</p>
<p>The calendar is initialized to the local timezone. We don&#8217;t have to worry about converting back to UTC/GMT because the calendar function getTimeInMillis() will give you the number of milliseconds from Java&#8217;s epoch, which is in UTC.</p>
<p>On line 8 I&#8217;m adding the number of seconds from Microsoft&#8217;s epoch to Java&#8217;s epoch. You&#8217;ll also notice the line before that I&#8217;m dividing by 1000 to convert time from milliseconds to seconds and after I add the epoch difference I&#8217;m converting to 100 nanoseconds by multiplying by 10000000. So why not skip the conversion to seconds and simply add three more zeroes to the end of the epoch difference (making the time in milliseconds) and multiplying by 10000?</p>
<p>The reason is that there&#8217;s a problem with precision and the resulting value will vary by a few hundred milliseconds. Since the times I&#8217;m working with are in seconds, those extra milliseconds could be ignored. But by dividing, adding, and then multiplying like this I don&#8217;t get the millisecond variances. I&#8217;m sure there&#8217;s better stuff on the &#8216;net to explain precision with BigInteger objects if you&#8217;re inclined to investigate further.</p>
<p><strong>Before you go</strong> I have one piece of information I learned while working on this particular topic.</p>
<p>ColdFusion treats all date and time values as if they are in the local timezone. Specifically, if your timezone has daylight savings then all dates are treated as if they have daylight savings, including GMT/UTC times which do NOT have daylight savings time. DateConvert() will not protect you from this issue. There&#8217;s a deeper explanation <a href="http://bit.ly/a9ZXss">here</a>.</p>
<p>My solution is to check if <code>GetTimeZoneInfo().isDSTon</code> is TRUE. If it is then I need to add (or subtract) 1 hour from my UTC time. Note that this is only needed when converting between UTC and local timezones with ColdFusion date and time functions. The above code specifically stays away from ColdFusion date and time functions so this isn&#8217;t a problem with my example. But it is something to keep in the back of your head when you start to notice dates are being calculated an hour off the time they should be.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/396/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=396&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2010/08/02/in-the-zone-with-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
		<item>
		<title>A bit of vinegar to go with the SOAP.</title>
		<link>http://ruthsarian.wordpress.com/2010/08/02/a-bit-of-vinegar-to-go-with-the-soap/</link>
		<comments>http://ruthsarian.wordpress.com/2010/08/02/a-bit-of-vinegar-to-go-with-the-soap/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 15:20:30 +0000</pubDate>
		<dc:creator>ruthsarian</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Informational]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://ruthsarian.wordpress.com/?p=394</guid>
		<description><![CDATA[Not long ago I wrote a 3-part series on using SOAP over HTTPS with ColdFusion. My final solution was to create Java objects directly, bypassing ColdFusion&#8217;s CFHTTP tag. I have since found a subtle flaw with this implementation. It&#8217;s not in the code, but in the  JVM. ColdFusion 8 ships with an older JVM. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=394&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not long ago I wrote a 3-part series on using SOAP over HTTPS with ColdFusion. My final solution was to <a href="http://ruthsarian.wordpress.com/2009/10/26/washing-client-certs-in-coldfusion-with-soap-part-3/">create Java objects directly, bypassing ColdFusion&#8217;s CFHTTP tag</a>.</p>
<p>I have since found a subtle flaw with this implementation.</p>
<p>It&#8217;s not in the code, but in the  JVM. ColdFusion 8 ships with an older JVM. I recently upgraded our JVM to a more current version in an attempt to resolve a timezone bug. In doing so my SOAP application stopped working.</p>
<p>A little research led me to <a href="http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html">this article about a TLS bug in Java</a> that could lead to a man-in-the-middle exploit. It appears the way I&#8217;m performing my SOAP operation triggers a TLS/SSL renegotiation when it receives a response from the external server.</p>
<p>The short answer is to add the following line to ColdFusion&#8217;s JVM arguments:</p>
<p><code>-Dsun.security.ssl.allowUnsafeRenegotiation=true</code></p>
<p>This does resolve the problem, but it apparently leaves the JVM vulnerable to MITM attacks. There is another bit of code in that article which shows how to change the <code>allowUnsafeRenegotiation </code>flag on-the-fly. I added this to my ColdFusion code, but changing the flag didn&#8217;t appear to have any effect.</p>
<p>If anyone else has played around with this particular problem I&#8217;d love to hear about it.</p>
<p>For now I&#8221;ve left the JVM in its vulnerable state as we only make HTTP requests from the JVM for a couple of applications and neither of them carry personally identifiable information.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruthsarian.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruthsarian.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ruthsarian.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ruthsarian.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruthsarian.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruthsarian.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruthsarian.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruthsarian.wordpress.com/394/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruthsarian.wordpress.com&amp;blog=10954861&amp;post=394&amp;subd=ruthsarian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ruthsarian.wordpress.com/2010/08/02/a-bit-of-vinegar-to-go-with-the-soap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9ea8306118a0ac9abe2db70acc8b5e6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ruthsarian</media:title>
		</media:content>
	</item>
	</channel>
</rss>
