<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-701827503635503701</id><updated>2011-07-30T12:49:59.623-07:00</updated><category term='test'/><category term='dsf'/><category term='sd'/><category term='wefwef'/><category term='fasdf'/><category term='sdfsdf'/><category term='fdsf'/><category term='java'/><category term='mosaic.flickr'/><category term='asdfawe'/><category term='wefsad'/><category term='asdfewf'/><category term='music'/><category term='tea'/><category term='sdf'/><category term='blogging hacks'/><category term='eaf'/><category term='chrome'/><category term='misc'/><category term='dsfsdf'/><title type='text'>Comment It Out</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-2926454878466974340</id><published>2010-02-15T22:58:00.003-08:00</published><updated>2010-02-15T22:58:53.475-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eaf'/><category scheme='http://www.blogger.com/atom/ns#' term='fdsf'/><category scheme='http://www.blogger.com/atom/ns#' term='sdfsdf'/><category scheme='http://www.blogger.com/atom/ns#' term='tea'/><category scheme='http://www.blogger.com/atom/ns#' term='sd'/><category scheme='http://www.blogger.com/atom/ns#' term='wefsad'/><category scheme='http://www.blogger.com/atom/ns#' term='dsf'/><category scheme='http://www.blogger.com/atom/ns#' term='dsfsdf'/><category scheme='http://www.blogger.com/atom/ns#' term='asdfawe'/><category scheme='http://www.blogger.com/atom/ns#' term='wefwef'/><category scheme='http://www.blogger.com/atom/ns#' term='fasdf'/><category scheme='http://www.blogger.com/atom/ns#' term='sdf'/><category scheme='http://www.blogger.com/atom/ns#' term='asdfewf'/><title type='text'>Test post</title><content type='html'>Test post&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-2926454878466974340?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/2926454878466974340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=2926454878466974340&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/2926454878466974340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/2926454878466974340'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/02/test-post_15.html' title='Test post'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-2828434423172923447</id><published>2010-02-15T22:58:00.001-08:00</published><updated>2010-02-15T22:58:25.395-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test'/><title type='text'>Test post</title><content type='html'>Test post&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-2828434423172923447?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/2828434423172923447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=2828434423172923447&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/2828434423172923447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/2828434423172923447'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/02/test-post.html' title='Test post'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-4626652807129158447</id><published>2010-01-13T17:34:00.001-08:00</published><updated>2010-01-13T17:34:43.915-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'></title><content type='html'>"But you, sir, are no painter. And while you hack away at your terminal, or ride your homemade Segway, we painters and musicians are going to be right over here with all the wine, hash, and hot chicks.&lt;br /&gt;&lt;br /&gt;Hee hee."&lt;br /&gt;&lt;br /&gt;Aww.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-4626652807129158447?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/4626652807129158447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=4626652807129158447&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4626652807129158447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4626652807129158447'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/but-you-sir-are-no-painter.html' title=''/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-765169887675397529</id><published>2010-01-08T16:41:00.000-08:00</published><updated>2010-01-08T17:35:10.501-08:00</updated><title type='text'>Experimenting with different fonts</title><content type='html'>Was bored today, and decided to experiment a little with different types of fonts for Visual C++. Now for the past 5 years I've been using courier new, and occasionally consolas as my editor font, but I wonder how proportional fonts can look with blocks of code. Here are my results:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/800553325-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;The original, in Courier New. Fairly readable font, the onlything that bugs me is the curly braces are fairly hard to distinguish from parenthesis.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/800572826-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;I've been using consolas for the past little while, and have few complaints. It's clean and clear, and has no big readability problems.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/801004587-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;Ah into the proportional fonts. Helvetica seems fairly difficult to read as the text comes out to be way too thin, and the text don't line up nicely(as with all proportional fonts)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/801033689-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;I actually liked gills. It looks tidy and the brackets are all fairly readable. One thing I really like about this is how wide each space is in comparison to the white space between letter. This "bunches up" the keywords and makes it really easy to read each word. One little complaint is that the number 1 looks almost indistinguishable from a small L.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/801094776-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;I was never a big fan of serif fonts in documents, but the look of this turns out better than I expected. The words are easy to read, although the width of the space seems to be a little to narrow for my liking. Also the '()' looks a bit weird.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/801141613-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;Verdana is one of the most legible fonts for programming. The L/i/1 all look different, as is O and 0. Horizontal whitespace wise it's fairly good as it has sufficent width for space to distinguish each word. The space between each letter is a bit too thin, as rn turns out to look a lot like m.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/801233017-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;Deja vu isn't as well known as the other fonts in this list, but I think that it is one of the better looking monospaced fonts. No big complaints about anything, only that the l looks a bit weird.&lt;br /&gt;&lt;br /&gt;You can get the font here: &lt;a href="http://dejavu-fonts.org/wiki/index.php?title=Download"&gt;http://dejavu-fonts.org/wiki/index.php?title=Download&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/801295749-orig.jpg"/&gt;&lt;br /&gt;&lt;br /&gt;Ah the IKEA font. Visually I think it looks the best out of all the fonts here; however one big flaw of this font is that small L looks identical to a capital i. The stacked parenthesis look a bit hard to read though(difficult to count if there are 5+ parenthesis).&lt;br /&gt;&lt;br /&gt;In the end I decided to use verdana. If I were to rank the fonts here though, these would be my top 3(Except verdana):&lt;br /&gt;1. Deja vu&lt;br /&gt;2. cambria&lt;br /&gt;3. Gills sans&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-765169887675397529?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/765169887675397529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=765169887675397529&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/765169887675397529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/765169887675397529'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/experimenting-with-different-fonts.html' title='Experimenting with different fonts'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-4805159579967840524</id><published>2010-01-05T18:01:00.000-08:00</published><updated>2010-01-05T20:41:45.237-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging hacks'/><title type='text'>Using smoothscroll on blogger</title><content type='html'>The smoothscroll plugin for chrome(&lt;a href="https://chrome.google.com/extensions/detail/cccpiddacjljmfbbgeimpelpndgpoknn"&gt;link&lt;/a&gt;) is a cute plugin that intercepts mousewheel events and animates the scrolling of the page so it scrolls in a nice fluid motion rather than the epileptic fashion of the default scrolling in chrome. After examining the source of the extension I decided to add it in to this blog, since blogger is so liberal about the use of javascript on the website.&lt;br /&gt;&lt;br /&gt;Unfortunately according to this:&lt;br /&gt;&lt;img src = "http://img1.uploadscreenshot.com/images/orig/1/502060940-orig.jpg" width = "800px"/&gt;&lt;br /&gt;&lt;br /&gt;Firefox users will not be able to experience the endless joy of scrolling smoothly; however it is compatible with most version of IE and chrome and safari.&lt;br /&gt;&lt;br /&gt;To get this working, just paste this in the blogger template somewhere in a pair of script tags in the header section:&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;// Frame Variables&lt;br /&gt;var frame = false;&lt;br /&gt;var noscrollframe = false;&lt;br /&gt;var yoff = 0;&lt;br /&gt;&lt;br /&gt;// Scroll Variables&lt;br /&gt;// tweakables&lt;br /&gt;var framerate = 60;  // hz&lt;br /&gt;var animtime = 400;  // faster than picasa&lt;br /&gt;var scrollsz = 180;  // pixels&lt;br /&gt;&lt;br /&gt;// less tweakables&lt;br /&gt;var PulseScale = 10;  // ratio of &amp;#39;tail&amp;#39; to &amp;#39;acceleration&amp;#39;&lt;br /&gt;var PulseNormalize = 1;&lt;br /&gt;&lt;br /&gt;ComputePulseScale();&lt;br /&gt;var scrolls;&lt;br /&gt;// Keyboard Settings&lt;br /&gt;var keyboardsupport = true;&lt;br /&gt;var arrscroll = 40; //in px&lt;br /&gt;var arrframes = 6;&lt;br /&gt;var pgscroll = 800; //in px&lt;br /&gt;var pgframes = 20;&lt;br /&gt;&lt;br /&gt;// Arrays of timeouts&lt;br /&gt;var up = [], down = [];&lt;br /&gt;&lt;br /&gt;// Other Variables&lt;br /&gt;var sTop = 1337;&lt;br /&gt;var delta = 0;&lt;br /&gt;var initdone = false;&lt;br /&gt;var d = 10;&lt;br /&gt;&lt;br /&gt;function onloadf() {&lt;br /&gt; if (!scrolls)&lt;br /&gt;  scrolls = setupScrolls();&lt;br /&gt; if (top != self)  { // Checks if this script is running in a frame&lt;br /&gt;  frame=true;&lt;br /&gt;  //if (document.documentElement.scrollHeight &amp;lt; (document.documentElement.clientHeight+10)) &lt;br /&gt;  if (document.body.scrollHeight &amp;lt;= (document.body.clientHeight+10))&lt;br /&gt;   noscrollframe=true;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; // Fix acid3 test -&amp;gt; make some people happy&lt;br /&gt; if (document.URL != &amp;quot;http://acid3.acidtests.org/&amp;quot;) {&lt;br /&gt; var underlay = document.createElement(&amp;#39;div&amp;#39;);&lt;br /&gt; underlay.setAttribute(&amp;quot;style&amp;quot;,&amp;quot;z-index: -1; position:absolute; top:0px; left: 0px; width: 100%; height: &amp;quot;+document.body.scrollHeight+&amp;quot;px;&amp;quot;);&lt;br /&gt; document.body.appendChild(underlay);&lt;br /&gt; /* This fixes a bug where the areas left and right &lt;br /&gt; to the content does not trigger the onmousewheel event &lt;br /&gt; on some pages */&lt;br /&gt; }&lt;br /&gt; initdone=true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function wheel(event){&lt;br /&gt; if (initdone==false) onloadf();&lt;br /&gt; var scroll=true;&lt;br /&gt; var prevent = false;&lt;br /&gt; var src = window.event.srcElement;&lt;br /&gt; var scrollup = true;&lt;br /&gt; var scrolldown = true;&lt;br /&gt; var lastdelta = delta;&lt;br /&gt; &lt;br /&gt; delta = 0;&lt;br /&gt; if (event.wheelDelta)  &lt;br /&gt;  delta = event.wheelDelta/120;&lt;br /&gt;&lt;br /&gt; do {&lt;br /&gt;  if (document.body.scrollHeight == src.scrollHeight) { &lt;br /&gt;   scroll=true;&lt;br /&gt;   break;&lt;br /&gt;  } &lt;br /&gt;  else {&lt;br /&gt;   if ((src.clientHeight+10) &amp;lt; src.scrollHeight) {&lt;br /&gt;   overflow = document.defaultView.getComputedStyle(src,&amp;quot;&amp;quot;).getPropertyValue(&amp;quot;overflow&amp;quot;);&lt;br /&gt;     if (overflow==&amp;quot;scroll&amp;quot; || overflow==&amp;quot;auto&amp;quot;) {&lt;br /&gt;      prevent = true;&lt;br /&gt;      if (src.scrollTop == sTop) {&lt;br /&gt;       if (src.scrollTop == 0) {&lt;br /&gt;        scrollup = true;&lt;br /&gt;        scrolldown = false;&lt;br /&gt;       }&lt;br /&gt;       else {&lt;br /&gt;       scrolldown = true;&lt;br /&gt;       scrollup = false;&lt;br /&gt;       }&lt;br /&gt;      } else { &lt;br /&gt;       scroll = false;&lt;br /&gt;      }&lt;br /&gt;      sTop = src.scrollTop;&lt;br /&gt;      scrollelm(delta,src,1); //Fixes a bug&lt;br /&gt;      var a = delta&amp;lt;0 ? up : down;&lt;br /&gt;      while(a.length) {&lt;br /&gt;       try {&lt;br /&gt;        clearTimeout(a.pop(a[i]));&lt;br /&gt;       } catch(e) {}&lt;br /&gt;      }&lt;br /&gt;      for (var i=0; i &amp;lt; 10; i++) {&lt;br /&gt;       d = 10;&lt;br /&gt;       (delta&amp;gt;0 ? up: down).push(setTimeout(function () {&lt;br /&gt;       scrollelm(delta,src,d)&lt;br /&gt;       }, i * 1000 / framerate + 1));&lt;br /&gt;      }&lt;br /&gt;      break;&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; } while(src = src.parentElement)&lt;br /&gt; &lt;br /&gt; if (frame==true) {&lt;br /&gt;  if (noscrollframe==true) { &lt;br /&gt;   scroll=false;&lt;br /&gt;  }&lt;br /&gt;  else {&lt;br /&gt;   if ((yoff==window.pageYOffset) &amp;amp;&amp;amp; (lastdelta&amp;lt;0)) {&lt;br /&gt;    //The last scroll downwards did nothing&lt;br /&gt;    scrollup=true;&lt;br /&gt;    scrolldown=false;&lt;br /&gt;   }&lt;br /&gt;   if ((yoff==window.pageYOffset) &amp;amp;&amp;amp; (lastdelta&amp;gt;0)) {&lt;br /&gt;    //The last scroll upwards did nothing&lt;br /&gt;    scrollup=false;&lt;br /&gt;    scrolldown=true;&lt;br /&gt;   }&lt;br /&gt;  yoff = window.pageYOffset; &lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; if (scroll==true) {&lt;br /&gt;  if (((scrolldown==true) &amp;amp;&amp;amp; (delta &amp;lt; 0)) || ((scrollup==true) &amp;amp;&amp;amp; (delta &amp;gt; 0))) {&lt;br /&gt;   handle(delta);&lt;br /&gt;   if (event.preventDefault)&lt;br /&gt;    event.preventDefault();&lt;br /&gt;   event.returnValue = false;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; if (prevent == true) {&lt;br /&gt; // Prevention for scrollable html elements&lt;br /&gt; if (event.preventDefault)&lt;br /&gt;    event.preventDefault();&lt;br /&gt;   event.returnValue = false;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; //Debug&lt;br /&gt; //console.log(&amp;quot;scrollup &amp;quot;+scrollup);&lt;br /&gt; //console.log(&amp;quot;scrolldown &amp;quot;+scrolldown);&lt;br /&gt; //console.log(&amp;quot;scroll &amp;quot;+scroll);&lt;br /&gt; //console.log(&amp;quot;frame &amp;quot;+frame);&lt;br /&gt; //console.log(&amp;quot;prevent &amp;quot;+prevent);&lt;br /&gt; //console.log(&amp;quot;noscrframe &amp;quot;+noscrollframe);&lt;br /&gt; //console.log(document.documentElement.scrollHeight);&lt;br /&gt; //console.log(document.documentElement.clientHeight+10);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// viscous fluid with a pulse for part and decay for the rest&lt;br /&gt;function Pulse_(x)&lt;br /&gt;{&lt;br /&gt;  var val;&lt;br /&gt;  &lt;br /&gt;  // test&lt;br /&gt;  x = x * PulseScale;&lt;br /&gt;  if (x &amp;lt; 1) {val = x - (1 - Math.exp(-x));} &lt;br /&gt;  else {&lt;br /&gt;    // the previous animation ended here:&lt;br /&gt;    var start = Math.exp(-1);&lt;br /&gt;&lt;br /&gt;    // simple viscous drag&lt;br /&gt;    x -= 1;&lt;br /&gt;    var expx = 1 - Math.exp(-x);&lt;br /&gt;    val = start + (expx * (1.0 - start));&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  return val * PulseNormalize;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function ComputePulseScale()&lt;br /&gt;{&lt;br /&gt;  PulseNormalize = 1 / Pulse_(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// viscous fluid with a pulse for part and decay for the rest&lt;br /&gt;function Pulse(x)&lt;br /&gt;{&lt;br /&gt;  if (x &amp;gt;= 1) return 1;&lt;br /&gt;  if (x &amp;lt;= 0) return 0;&lt;br /&gt;&lt;br /&gt;  if (PulseNormalize == 1) {&lt;br /&gt;    ComputePulseScale();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  return Pulse_(x);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function setupScrolls() {&lt;br /&gt;&lt;br /&gt; scrolls = new Array();&lt;br /&gt; &lt;br /&gt; var last = 0;&lt;br /&gt; var frm = parseInt(framerate * animtime / 1000);&lt;br /&gt; &lt;br /&gt; for (var i = 0; i &amp;lt; frm; i++) {&lt;br /&gt;&lt;br /&gt;    // scroll is [0, 1]&lt;br /&gt;    var scroll = (i + 1) / frm;&lt;br /&gt;    // transform [0, 1] -&amp;gt; [0, 1]:&lt;br /&gt;    scroll = Pulse(scroll);&lt;br /&gt;&lt;br /&gt;    // scale and quantize to int so our pixel difference works:&lt;br /&gt;    var iscroll = parseInt(scrollsz * scroll + 0.99);&lt;br /&gt;    &lt;br /&gt;    scrolls.push(iscroll - last);&lt;br /&gt;    last = iscroll;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; return scrolls;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function handle(delta) {&lt;br /&gt; var a = delta&amp;lt;0 ? up : down;&lt;br /&gt; while(a.length) {&lt;br /&gt;  try {&lt;br /&gt;   clearTimeout(a.pop(a[i]));&lt;br /&gt;  } catch(e) {}&lt;br /&gt; }&lt;br /&gt; for (var i=0; i &amp;lt; scrolls.length; i++)&lt;br /&gt;  (delta&amp;gt;0 ? up : down).push(setTimeout(&amp;#39;window.scrollBy( 0 ,&amp;#39; + -delta * scrolls[i] + &amp;#39;);&amp;#39;, i * 1000 / framerate + 1));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function scrollelm(delta,src,d) {&lt;br /&gt; if (delta &amp;gt; 0) {&lt;br /&gt; src.scrollTop -= d;&lt;br /&gt;  } else {&lt;br /&gt; src.scrollTop += d;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function keypress()&lt;br /&gt;{&lt;br /&gt;       if(window.event) {&lt;br /&gt;               if (!(event.target instanceof HTMLInputElement) &amp;amp;&amp;amp;&lt;br /&gt;                   !(event.target instanceof HTMLTextAreaElement) &amp;amp;&amp;amp;&lt;br /&gt;       (event.target.contentEditable == &amp;quot;false&amp;quot;) &amp;amp;&amp;amp;&lt;br /&gt;                   !(event.ctrlKey || event.altKey || event.shiftKey)) {&lt;br /&gt;                       if(event.keyCode==38) {&lt;br /&gt;                               arrscrollwindow(event.altKey ? 2 : 1);&lt;br /&gt;                               event.preventDefault();&lt;br /&gt;                       }&lt;br /&gt;                       if(event.keyCode==40) {&lt;br /&gt;                               arrscrollwindow(event.altKey ? -2 : -1);&lt;br /&gt;                               event.preventDefault();&lt;br /&gt;                       }&lt;br /&gt;               }&lt;br /&gt;               if(event.keyCode==33 &amp;amp;&amp;amp; !event.ctrlKey &amp;amp;&amp;amp; !event.metaKey &amp;amp;&amp;amp; !event.shiftKey &amp;amp;&amp;amp; !event.altKey) {&lt;br /&gt;                       pgscrollwindow(1);&lt;br /&gt;                       event.preventDefault();&lt;br /&gt;               }&lt;br /&gt;               if(event.keyCode==34 &amp;amp;&amp;amp; !event.ctrlKey &amp;amp;&amp;amp; !event.metaKey &amp;amp;&amp;amp; !event.shiftKey &amp;amp;&amp;amp; !event.altKey) {&lt;br /&gt;                       pgscrollwindow(-1);&lt;br /&gt;                       event.preventDefault();&lt;br /&gt;               }&lt;br /&gt;       }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function arrscrollwindow(delta) {&lt;br /&gt; var a = delta&amp;lt;0 ? up : down;&lt;br /&gt; while(a.length) {&lt;br /&gt;  try {&lt;br /&gt;   clearTimeout(a.pop(a[i]));&lt;br /&gt;  } catch(e) {}&lt;br /&gt; }&lt;br /&gt; for (var i=0; i &amp;lt; arrframes; i++)&lt;br /&gt;  (delta&amp;gt;0 ? up : down).push(setTimeout (&amp;#39;window.scrollBy( 0 ,&amp;#39; + -delta * (arrscroll/arrframes) + &amp;#39;);&amp;#39;, i * 25));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function pgscrollwindow(delta) {&lt;br /&gt; var a = delta&amp;lt;0 ? up : down;&lt;br /&gt; while(a.length) {&lt;br /&gt;  try {&lt;br /&gt;   clearTimeout(a.pop(a[i]));&lt;br /&gt;  } catch(e) {}&lt;br /&gt; }&lt;br /&gt; for (var i=0; i &amp;lt; pgframes; i++)&lt;br /&gt;  (delta&amp;gt;0 ? up : down).push(setTimeout (&amp;#39;window.scrollBy( 0 ,&amp;#39; + -delta * (window.innerHeight/pgframes) + &amp;#39;);&amp;#39;, i * 25));&lt;br /&gt;}&lt;br /&gt;window.onmousewheel = wheel;&lt;br /&gt;window.onload = onloadf;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Basically I just deleted the parts in the plugin source that was communicating with the plugin internals, which makes this any plain old javascript.&lt;br /&gt;&lt;br /&gt;Original source by: patrickb1991, &lt;a href="https://chrome.google.com/extensions/detail/cccpiddacjljmfbbgeimpelpndgpoknn"&gt;https://chrome.google.com/extensions/detail/cccpiddacjljmfbbgeimpelpndgpoknn&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-4805159579967840524?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/4805159579967840524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=4805159579967840524&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4805159579967840524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4805159579967840524'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/using-smoothscroll-on-blogger.html' title='Using smoothscroll on blogger'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-4719409518323693091</id><published>2010-01-04T21:13:00.000-08:00</published><updated>2010-01-04T21:32:01.652-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>Rolling Stones releases 100 top albums of the decade</title><content type='html'>The link can be found here:&lt;br /&gt;&lt;a href="http://www.rollingstone.com/news/story/31248017/100_best_albums_of_the_decade/print"&gt;http://www.rollingstone.com/news/story/31248017/100_best_albums_of_the_decade/print&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, as much as I approve of their decision to put Kid A as the album of the decade, I think the rest of the list is utter shit.&lt;br /&gt;&lt;br /&gt;"Is This It" was a fairly 'listenable' album. By listenable, I mean precisely that: all tracks were fairly straightforward, nothing experimental going on, all potential radio hits. Surely some solid tracks such as Someday and Trying Your Luck was on the album, I definitely would not have put it as the number 2 album of the decade.&lt;br /&gt;&lt;br /&gt;Seeing MGMT's Oracular Spectacular in the top 20 makes me die a little inside. Seriously? These guys are pretty much the definition of throwing pretentious shit together and calling it art. Most tracks had the formulaic structure of a catchy electronic riff with heavy distortion bass undertones, and upon hearing the vocals, I realize WHY they were trying to drown it out with the distortion bass.&lt;br /&gt;&lt;br /&gt;Coldplay's "A Rush Of Blood to The Head" at 21? I didn't realize the Rolling Stones put elevator music on such a high pedestal. &lt;br /&gt;&lt;br /&gt;After reading this list, I realize Kanye West's ENTIRE DISCOGRAPHY was feature, yet I hear no mention of Lady Gaga anywhere. Yes I understand that Kanye's rise to fame is one of the most discussed topics in the decade, but it's incomprehensible how the female icon of pop -perhaps the most talented entertainer in the industry in years- was never even mentioned. Yet Kanye West, someone in a similar position and already on his fall from grace, is given recognition and praise.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-4719409518323693091?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/4719409518323693091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=4719409518323693091&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4719409518323693091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4719409518323693091'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/rolling-stones-releases-100-top-albums.html' title='Rolling Stones releases 100 top albums of the decade'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-4014513162299046379</id><published>2010-01-03T19:22:00.000-08:00</published><updated>2010-01-05T17:59:28.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='mosaic.flickr'/><title type='text'>Implementation of the classes in mosaic.flickr</title><content type='html'>After I had the idea of coding this I had this feeling of "fuck this is so brilliant why am i not coding" whenever i was NOT at the computer and typing" , so in about 8 hours of straight coding I had pretty much the rough implementation finished. in the next few posts i'll briefly describe their conception and show off some pretty neat code.&lt;br /&gt;&lt;br /&gt;Photostream Class:&lt;br /&gt;This class was pretty easy to write considering that a fairly large amount of work has been devoted to creating a useable flickr API for java. Thanks to &lt;a href="http://jickr.org/"&gt;jickr&lt;/a&gt;(which unfortunately, is no longer being developed), obtaining a stream of photos based on a search string has about all the difficulty of stealing candy from a well endowed baby. Based on a few search parameters, the Photostream class returns a list of Photo objects, from which I can obtain a BufferedImage of a desireable size. &lt;br /&gt;&lt;br /&gt;ProcessPhotostream class:&lt;br /&gt;This class will omnomnom the list of Photos and eventually organize them in an accessible datastructure. For simplicity's sake, I will save the bufferedimages at the size of 75x75 in folders, since by storing the data on the harddrive we sort of create a cache that's easily acccessed at the cost of some speed and storaged. To keep track of the folders we can use an int array to keep track of number of bufferedimages in each subfolder.&lt;br /&gt;This class will begin by iterating through the list of photos, obtain the corresponding BufferedImages, and by some sort of analyzation method, sort them into folders. Firstly I will try to sort them by dominant hue, then I can write the code to sort by brightness(which is considerably simpler). Therefore the flow of this class will be like this:&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;for(Photo p:photos){&lt;br /&gt;BufferedImage i = p.getImage(Photo.Size.Square);&lt;br /&gt;process(i);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void process(BufferedImage b){&lt;br /&gt;if(b==null)return;&lt;br /&gt;...//insert processing code&lt;br /&gt;&lt;br /&gt;//obtain an 'index' value which represents the image&lt;br /&gt;&lt;br /&gt;//increment the counter in the int array which represents the number of pages with the current counter&lt;br /&gt;database.map[index]++;&lt;br /&gt;&lt;br /&gt;/*write the image to a file with its corresponding index.*/&lt;br /&gt;ImageIO.write(b,"png",new File("output/"+index+"/"+database.map[index]+".png"));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To process the image, a simple(probably inefficient) way would be loop through all the pixels, and do calculations on the RGB value of each pixel. Since we want to find the dominant color of an image, we can simply find the average RGB of each pixel, and the resulting RGB will be the 'dominant' color. This is, of course, a large oversimplification of image processing, but it will have to do.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;/*store the overall rgb values in these three variables, might have to use long for really large images*/&lt;br /&gt;         int r=0;&lt;br /&gt; int g=0;&lt;br /&gt; int b=0;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; if(Constants.colored){//have a simple control variable for colored/monotone images&lt;br /&gt; for(int i =0;i&amp;lt;Constants.size;i++){&lt;br /&gt;  for(int j =0;j&amp;lt;Constants.size;j++){&lt;br /&gt;&lt;br /&gt;//getRGB() returns the colorvalue in the form of 0xAARRGGBB, a signed int&lt;br /&gt;   int c = bi.getRGB(i,j);&lt;br /&gt;&lt;br /&gt;//performing &amp; operation isolates the third byte, and shifts over by 2 bytes = 0x000000RR&lt;br /&gt;   int  red = (c &amp; 0x00ff0000) &amp;gt;&amp;gt; 16;&lt;br /&gt;&lt;br /&gt;//isolates the second byte, shifts over by one byte = 0x000000GG&lt;br /&gt;   int  green = (c &amp; 0x0000ff00) &amp;gt;&amp;gt; 8;&lt;br /&gt;&lt;br /&gt;//isolates the first byte = 0x000000BB&lt;br /&gt;   int  blue = c &amp; 0x000000ff;&lt;br /&gt;&lt;br /&gt;//add the RGB values to the tracker variables&lt;br /&gt;   r+=red;&lt;br /&gt;   g+=green;&lt;br /&gt;   b+=blue;&lt;br /&gt;  }&lt;br /&gt;   &lt;br /&gt; }&lt;br /&gt;//find the avg rgb&lt;br /&gt;        r/=Constants.size*Constants.size;&lt;br /&gt;        g/=Constants.size*Constants.size;&lt;br /&gt;        b/=Constants.size*Constants.size;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;At this point, we can get by with simply 8 bit color(256 possible colors). however, for future development we might want more colors.&lt;br /&gt;&lt;br /&gt;The 8 bit color architecture is a bit icky. in 8 bit color, the bits are ordered as RRRGGGBB in binary, which means 3 bits are devoted to red, 3 bits to green, and 2 bits to blue.&lt;br /&gt;&lt;br /&gt;So first we'll want to convert the corresponding rgb values to its corresponding 8 bit color value:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;r=(r&amp;gt;&amp;gt;5);//r was 8 bits, now it will be 3 bits&lt;br /&gt;g=(g&amp;gt;&amp;gt;5);//g was 8 bits, now it will be 3 bits&lt;br /&gt;b=(b&amp;gt;&amp;gt;6);//b was 8 bits, now it will be 2 bits&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//r is now 00000RRR, shifting it to the left by 5 will make it RRR00000&lt;br /&gt;//g is now 00000GGG, shifting it to the left by 2 will make it 000GGG00&lt;br /&gt;//b is now 000000BB, no need to shift&lt;br /&gt;//adding them together will produce RRRGGGBB&lt;br /&gt;int index = (r&amp;lt;&amp;lt;5)+(g&amp;lt;&amp;lt;2)+b;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: Just because we shift r to the right by 5, then left by 5, does not mean these 2 operations cancel out. By shifting r to the right by 5, we effectively "set" the 5 rightmost bits to 0 when we shift it back to the left.&lt;br /&gt;&lt;br /&gt;With the index we can now store the image to the appropriate folder and increment the appropriate element in the database array.&lt;br /&gt;&lt;br /&gt;Next: using the image database to generate a mosaic.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-4014513162299046379?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/4014513162299046379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=4014513162299046379&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4014513162299046379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/4014513162299046379'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/implementation-of-classes-in.html' title='Implementation of the classes in mosaic.flickr'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-8884218523783008664</id><published>2010-01-02T09:53:00.000-08:00</published><updated>2010-01-03T19:22:42.782-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mosaic.flickr'/><title type='text'>Building a photo mosaic generator - that uses Flickr</title><content type='html'>after looking at some of the cool pictures that are made from a mosaic of photos i realized that the only thing amazing about them is the sheer amount of information they contain. after all, if you have all the photos stored in an organized data structure, the creation of the mosaic is some pretty basic image processing.&lt;br /&gt;then i realized, why not have something that reads from a large image aggregator, in particular, flickr, and use the results to create an arbitrarily large piece of mosaic? &lt;br /&gt;the choice of language to do this for me would be java, considering that it would be cross-platform, and i am somewhat adept to image processing in java, in comparison to c++ or javascript.&lt;br /&gt;&lt;br /&gt;this mosaic generator would roughly have these divisions:&lt;br /&gt;&lt;br /&gt;PhotoStream class: responsible for fetching the image data based on a set of parameters; probably uses flickr api to do this&lt;br /&gt;ProcessPhotoStream class: processes the photo data fetched by the PhotoStream class. Maybe sort the photos by average color and store them into a map with a key value of an arraylist of the bufferedimages that has the corresponding color.&lt;br /&gt;ProcessMosaic class: processes the image to turn into a mosaic. Resizes it to an appropriate size and decrease the amount of colors in the image.&lt;br /&gt;CreateMosaic class: take the data returned by ProcessPhotoStream and construct an image that looks like the original image from them. If more image is required(not enough colors), it will call PhotoStream/ProcessPhotoStream again.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Things to watch out for:&lt;br /&gt;long loading/processing time of PhotoStream means a lot of optimizations will need to be made.&lt;br /&gt;Resizing/processing images requires a shitload of processing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-8884218523783008664?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/8884218523783008664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=8884218523783008664&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/8884218523783008664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/8884218523783008664'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/building-photo-mosaic-generator-that.html' title='Building a photo mosaic generator - that uses Flickr'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-3751689768924833385</id><published>2010-01-01T20:47:00.000-08:00</published><updated>2010-01-01T21:45:14.149-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>Chrome extension development #4 - making a custom toolbar GUI procedurally</title><content type='html'>since this project is based on fast loading time and minimalism, loading a billion images on load would defeat the purpose of this undertaking; therefore i will try to focus on generating a clean looking gui with pure css and html. &lt;br /&gt;&lt;br /&gt;why do we need a seperate gui on this? isn't it functional already?&lt;br /&gt;&lt;br /&gt;through user feedback, i realized that the plugin is missing a key feature: removing the frame itself. instead of reinventing the wheel, i just turned to google images' framing system. i figured that i could include an 18 px high bar on top of the right side that can contain various functions/information, and it shouldn't be too much of an obstruction to the user.&lt;br /&gt;&lt;br /&gt;in this post i will explain how each of the functions on the toolbar is coded. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/1/105044988-orig.jpg" title="I did NOT copy vimeo's interface! I swear!"/&gt;&lt;br /&gt;&lt;br /&gt;going from the left to right, the first button is the 'resize' button. on click, the button enlarges the frame on the right. click again, and the button resizes it back to normal. instead of an instant onclick = "document.getElementById('leftFrameCell').setAttribute('style','width = 20%');", i chose to be cute and add a sliding animation to the resizing of the frame(or table cell rather, since the frame sits in a td element).&lt;br /&gt;&lt;br /&gt;to achieve animation we need to have a pause in between each different width. if we were going from 50% to 20%, we might first set it to 48, then 46, then 44, until we hit 20. i can't just put a for loop like this:&lt;br /&gt;&lt;pre class='brush: js'&gt;&lt;br /&gt;for(i=50;i----&gt;20;)&lt;br /&gt;     document.getElementById('leftFrameCell').setAttribute('style','width = '+i+'%');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;because this for loop would be evaluated instantly and it would be the same as &lt;br /&gt;&lt;pre class='brush: js'&gt;&lt;br /&gt;document.getElementById('leftFrameCell').setAttribute('style','width = 20%');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;in java or c++ i would just put a sleep(20) or Thread.sleep(20) in the loop so it would set the width, wait 20 ms, then set the width again, thus achieving the illusion of animation.&lt;br /&gt;&lt;br /&gt;however, javascript does not have a sleep(20) function, which makes my life that much harder. jscript does, however, have a setTimeout('f()',delay) function, which evals f() after 'delay' seconds. a clever way to use this to simulate sleep() would be using setTimeout to recursively call the function, as such:&lt;br /&gt;&lt;br /&gt;&lt;pre class='brush: js'&gt;&lt;br /&gt;var i = 50;&lt;br /&gt;function a(){&lt;br /&gt;    document.getElementById('leftFrameCell').setAttribute('style','width = '+i+'%');&lt;br /&gt;    if(i==0) return;&lt;br /&gt;    i----;&lt;br /&gt;    setTimeout('a()',delay);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;with this we can achieve a sliding animation without freezing the browser.&lt;br /&gt;&lt;br /&gt;the second item on the toolbar is a textbox for the URL. this is also quite a hassle to code as it is impossible to find out the URL of a frame after user interaction. the quick and dirty way i did it was just modified the onclick events of the links in the google search results to change the value the textbox. since it's not cross domain scripting(the page containing the frame is in the same domain as the frame), the frame can access the methods/variables of the parent page.&lt;br /&gt;&lt;br /&gt;the third and forth buttons are remove frame, and show the link in a new tab. these are pretty straight forward as they just involve changing document.location.href, and window.load().&lt;br /&gt;&lt;br /&gt;Changing the looks of the toolbar is a lot like writing css for an html page, except instead of writing the css, i have to write the css, and inject the css into the page. we can access the stylesheets of a webpage by: &lt;br /&gt;&lt;pre class='brush: js'&gt;document.styleSheets;&lt;br /&gt;/*msdn: document.styleSheets: Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.*/&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;from that, i can access each stylesheet by referencing document.styleSheets[0] or document.styleSheets[i]. to add a style for buttons or textboxes, i can call the addRule() method:&lt;br /&gt;&lt;br /&gt;&lt;pre class='brush: js'&gt;&lt;br /&gt;document.styleSheets[0].addRule("input.btn","height: 22px; margin:0 2% 0 0;color:#FEFEFE;font-family:\"Helvetica\",Sans Serif; background-color:#505050;  border:0px solid; -webkit-border-radius: 3px; border-color: #505050;");&lt;br /&gt;document.styleSheets[0].addRule("input.btnhov","border-color: #1286FF;background-color:#1286FF;");&lt;br /&gt;document.styleSheets[0].addRule("input.txt","height: 18px; margin:0 4% 0 0;color:#424242;font-family:\"Helvetica\",Sans Serif; background-color:#FEFEFE;  border:2px solid; -webkit-border-radius: 2px; border-color: #505050;");&lt;br /&gt;document.styleSheets[0].addRule("input.txthov","border-color: #1286FF;background-color:#FEFEFE;");&lt;br /&gt;document.styleSheets[0].addRule("input.label","height: 22px; margin:0 1% 0 0;color:#FEFEFE;font-family:\"Helvetica\",Sans Serif; background-color:#505050;  border:0px solid; -webkit-border-radius: 3px; border-color: #505050;");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; thankfully for css 3.0, i was able to create buttons/textbox with a rounded corner with the -webkit-border-radius property. i can then set the class of the buttons by just using a setAttribute('class','btn'), and i can create a rollover button by just doing:&lt;br /&gt;&lt;pre class='brush: js'&gt;&lt;br /&gt;left.setAttribute("onmouseover","this.className='btn btnhov'");&lt;br /&gt;left.setAttribute("onmouseout","this.className='btn'");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;that's about it! a nice looking(and functional) toolbar is made with pure dom javascript.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-3751689768924833385?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/3751689768924833385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=3751689768924833385&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/3751689768924833385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/3751689768924833385'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2010/01/chrome-extension-development-4-making.html' title='Chrome extension development #4 - making a custom toolbar GUI procedurally'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-3962054898851696287</id><published>2009-12-30T20:20:00.000-08:00</published><updated>2010-01-01T20:50:49.357-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>Chrome extension development #3</title><content type='html'>after the basic layout of the page is created i can put the content of the pages in. for the content of the page displaying the results, a simple &lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;leftFrame.setAttribute('src',document.location.href);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;would suffice.&lt;br /&gt;However we would need some way of preventing the script from recursively injecting itself(since the contentscript is injected into all levels, which means a seperate copy is injected into each frame). &lt;br /&gt;this can be done by:&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;if(parent){&lt;br /&gt;...//main execution part&lt;br /&gt;}&lt;br /&gt;else{&lt;br /&gt;...//seperate handler for when it is in a frame&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;this works because of the weirdness of the scoping with injected javascripts. When injected into a frame, the top level domwindow object is NOT visible to the injected javascript, thus if parent is NOT null, the page must not be in a frame.&lt;br /&gt;the src for the frame on the right is just about:blank, and it carries a unique name that can be the target of the links on the results page, so the results would be displayed on the right.&lt;br /&gt;&lt;br /&gt;we can stick all the code that reformats the search results into the if(parent){} clause and not worry about it afterwards.&lt;br /&gt;&lt;br /&gt;in order to change the targets of the links on the results page, we would have to have access to the dom objects of that page. the code block from before becomes quite convenient, as we can just stick that in the else{} clause (executes when the page IS in a frame).&lt;br /&gt;&lt;br /&gt;to find all the links we would have to invoke the links[] object, and loop through it to find out which ones we modify. &lt;br /&gt;&lt;br /&gt;&lt;img src = "http://img1.uploadscreenshot.com/images/orig/12/36406023164-orig.jpg" title = "ale-ale-jandro" width = "600px"/&gt;&lt;br /&gt;&lt;br /&gt;these are the links we want to modify to display in the other frame. by looking through the elements list of the google's webpage, we can see that each div has its unique class. all the classes can be found and made to be the condition to modify.&lt;br /&gt;&lt;br /&gt;after we identify the links to modify, we change them by just&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;links[i].setAttribute("target","targetFrame");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;after this point, the extension is pretty much finished. anything more we add on will not be necessary, and so we must consider the trade off between loading speed/memory usage and functionality.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-3962054898851696287?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/3962054898851696287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=3962054898851696287&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/3962054898851696287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/3962054898851696287'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2009/12/chrome-extension-development-3.html' title='Chrome extension development #3'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-3081723391605570903</id><published>2009-12-30T12:56:00.000-08:00</published><updated>2009-12-31T15:47:56.240-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>Chrome extension development #2</title><content type='html'>once i got the underlying control structure for the plugin down, the matter of writing the code for the reformatting of the google page.&lt;br /&gt;&lt;br /&gt;The google search result page is fairly complicated(most of google's code seem cryptic and hard to understand). this is basically the structure of google's search result page&lt;br /&gt;&lt;br /&gt;&lt;img src="http://img1.uploadscreenshot.com/images/orig/12/36321073269-orig.jpg" border="0" title="chrome has sexy dev tools"/&gt;&lt;br /&gt;&lt;br /&gt;finding the div that contains the stuff that i want is pretty much impossible. so instead of trying to reformat google's page, i'll make a new page and format it however i like. this way i won't have to worry about google's restructuring of their webpage, and at the same time i won't have to touch their code.&lt;br /&gt;&lt;br /&gt;first i start off by finding their body and replacing it with an empty one, and set override google's css so it would kill the 8 px margin on top/bottom.&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;var obody = document.getElementById("gsr");//note the id from google's body is 'gsr'&lt;br /&gt;var body = document.createElement("body");//a new body&lt;br /&gt;body.setAttribute("searchw");&lt;br /&gt;body.setAttribute("leftmargin","0");&lt;br /&gt;body.setAttribute("topmargin","0");&lt;br /&gt;body.setAttribute("rightmargin","0");&lt;br /&gt;body.setAttribute("bottommargin","0");&lt;br /&gt;body.setAttribute("style","margin: 0px 0px;");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;then i just need to replace the old body with the new one.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;obody.parentNode.replaceChild(body,obody);//parentNode == html tag&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;at this point I have two choices, either split the page in half with a frameset, or with a table. considering framesets can only contain frames, which can ONLY be links to pre existing html, it would be fairly difficult for me to insert my own html if i want to in the future.&lt;br /&gt;&lt;br /&gt;splitting the page into two with table is fairly simple, and splitting the page in two i can just stick an iframe in both cells, with the left iframe containing the results page, and the right iframe displaying links clicked on the left iframe.&lt;br /&gt;&lt;br /&gt;Why not frames? why iframes?&lt;br /&gt;&lt;br /&gt;no particular reason, it's just that creating a frame i need to contain it with frameset tags, while iframes are independent. creating objects with javascript DOM is quite bothersome, so i'm just trying to minimize the amount of code typed.&lt;br /&gt;&lt;br /&gt;the google search page now looks like this:&lt;br /&gt;&lt;img src=http://img1.uploadscreenshot.com/images/orig/12/36321282049-orig.jpg border="0"/&gt;&lt;br /&gt;&lt;br /&gt;of course there's actually NOTHING in the iframes. but we can fix that easily by linking appropriate pages in them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-3081723391605570903?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/3081723391605570903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=3081723391605570903&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/3081723391605570903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/3081723391605570903'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2009/12/chrome-plugin-development-2.html' title='Chrome extension development #2'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-701827503635503701.post-7707579128292465253</id><published>2009-12-30T11:59:00.000-08:00</published><updated>2010-01-01T20:52:00.071-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>Chrome extension development #1</title><content type='html'>this actually started right after i got my second monitor(1600x900 more pixels of fun!)  and noticed the ghastly look of the horizontal whitespace on google's search results. normally i'd just copy pasta bits of code from here and there and hack together something useful, but this time i'm actually committed to code this from scratch. although it's partly the result of the lack of development in chrome's extensions community.&lt;br /&gt;&lt;br /&gt;(the finished product is over at: https://chrome.google.com/extensions/detail/hcoffdchjckinjfjgekdiljgihnpmdoe)&lt;br /&gt;&lt;br /&gt;writing a chrome extension is actually easier than i thought. the entire extension 'is controlled by a JSON serializeable object which has several parts working/communicating with each other. almost all extensions have a background page(written in html, javascript), which is the entity of the extension itself. only one instance will be running at once, and it's usually the center that controls everything. then you have a couple minions working for the background page. in my case there was only a contentscript(a javascript file), which is injected into the page that matches the pattern. the contentscript first sends a message seemingly to no particular receiver, asking for its fate:&lt;br /&gt;&lt;pre class="brush: js"&gt;//send request to bg page for the state of the injection&lt;br /&gt;chrome.extension.sendRequest({request: "state"},function(response){&lt;br /&gt;state = response.state;&lt;br /&gt;if(state == "true"){&lt;br /&gt;        searchw();//function to start the shit up&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The background page, hearing the distress of the contentscript, responds based on whether the plugin is enabled or not:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;br /&gt;chrome.extension.onRequest.addListener(&lt;br /&gt;function(request, sender, sendResponse) {&lt;br /&gt;if(sender.id = extensionID){&lt;br /&gt;      sendResponse({state: localStorage["state"]});//retrieve the state from settings, and send it back&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;      sendResponse({});//it's not our script calling, ignore&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;once the contentscript gets the go ahead from the background page, it starts doing it's work.&lt;br /&gt;&lt;br /&gt;when i started coding this plugin i had 2 goals in mind: 1. the plugin must be aesthetically pleasing. This is obvious because the point of the plugin is so that a more useable state is derived from a less useable state.&lt;br /&gt;&lt;br /&gt;and 2. the plugin must be non obtrusive. which meant that the plugin must be minimalistic and efficient, so the user would not notice a drop in performance(of the browser)&lt;br /&gt;&lt;br /&gt;1. is fairly simple to achieve. the difficulty lies in achieving 1. while achieving 2.&lt;br /&gt;&lt;br /&gt;to achieve my second goal i had to make 2 sacrifices: no local txt/html will be used. using DOM to dynamically generate the html would shave off the time reading from the hard drive. in addition, no local images will be used. again, generating the graphics procedurally means lower load time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/701827503635503701-7707579128292465253?l=commentitout.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commentitout.blogspot.com/feeds/7707579128292465253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=701827503635503701&amp;postID=7707579128292465253&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/7707579128292465253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/701827503635503701/posts/default/7707579128292465253'/><link rel='alternate' type='text/html' href='http://commentitout.blogspot.com/2009/12/chrome-extension-development-1.html' title='Chrome extension development #1'/><author><name>Comment It Out</name><uri>http://www.blogger.com/profile/16210454830770261229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
