<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEYCQX0_fCp7ImA9WhBbFU8.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979</id><updated>2013-05-14T14:32:40.344+05:30</updated><category term="java7" /><category term="Just Like That" /><category term="Maer" /><category term="MyJerry" /><category term="Creativity Concepts" /><category term="Spring Framework" /><category term="Apache Flex" /><category term="Code Challenge" /><category term="ActionScript" /><category term="Tools" /><category term="Link Listings" /><category term="Project Euler" /><category term="Adobe AIR" /><category term="My Projects" /><category term="Workarounds" /><category term="Interview Questions" /><category term="Java" /><category term="Blogger" /><category term="Coding Techniques" /><category term="Evenstar" /><category term="Web" /><category term="Scalability" /><title>Keep Walking!</title><subtitle type="html">Keep Walking!</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.sangupta.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.sangupta.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>164</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Azcarya" /><feedburner:info uri="azcarya" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>20.2</geo:lat><geo:long>70.3</geo:long><feedburner:emailServiceId>Azcarya</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;C08HSXgzeyp7ImA9WhJXGE4.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-5731373494883145278</id><published>2012-08-13T09:53:00.000+05:30</published><updated>2012-08-13T09:53:58.683+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-13T09:53:58.683+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Workarounds" /><title>Change Eclipse Juno UI to match Eclipse Indigo</title><content type="html">Some of the Windows users, like me, who have switched to Eclipse Juno (Eclipse 4.2) might not have liked the theme that ships as default. Specially, the piece around the toolbar backgrounds, the code editing theme, the absence of left border along side line numbers, and the overtly flashy UI containers.&lt;br /&gt;
&lt;br /&gt;
To put in plain simple words: Eclipse Juno theme actually sucks. All the hype around CSS based styling might be very good technically, and a step forward, but per UX standards it sucks, and it sucks hard.&lt;br /&gt;
&lt;br /&gt;
But we have a quick workaround: For those who wish to move to using the Eclipse Indigo looks, a version prior, simply, rename the folder,&lt;br /&gt;
&lt;pre&gt;plugins\org.eclipse.platform_4.2.0.v201206081400\css&lt;/pre&gt;&lt;br /&gt;
to something like,&lt;br /&gt;
&lt;pre&gt;plugins\org.eclipse.platform_4.2.0.v201206081400\css.old&lt;/pre&gt;&lt;br /&gt;
And you are done! Launch your eclipse and enjoy the old theme.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; Make sure Eclipse is not-running when making this change.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/wGjFsH9m4Yo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/5731373494883145278/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=5731373494883145278&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/5731373494883145278?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/5731373494883145278?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/wGjFsH9m4Yo/change-eclipse-juno-ui-to-match-eclipse.html" title="Change Eclipse Juno UI to match Eclipse Indigo" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/08/change-eclipse-juno-ui-to-match-eclipse.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYMQnY7eip7ImA9WhJQFEg.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-3214721913126329425</id><published>2012-07-28T11:46:00.001+05:30</published><updated>2012-07-28T11:46:23.802+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-28T11:46:23.802+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><title>Pepmint now in Maven Central</title><content type="html">I am pleased to announce the immediate availability of &lt;a href="http://www.sangupta.com/projects/pepmint"&gt;Pepmint&lt;/a&gt;, a Java wrapper over the Python &lt;a href="http://pygments.org"&gt;Pygments&lt;/a&gt; library in Maven Central. Use the following to include it as a dependency,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;com.sangupta&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;pepmint&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.1.2&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
For more information on usage, visit the project page at &lt;a href="http://www.sangupta.com/projects/pepmint"&gt;http://www.sangupta.com/projects/pepmint&lt;/a&gt;&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/pMP7lqWMEh0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/3214721913126329425/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=3214721913126329425&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/3214721913126329425?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/3214721913126329425?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/pMP7lqWMEh0/pepmint-now-in-maven-central.html" title="Pepmint now in Maven Central" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/07/pepmint-now-in-maven-central.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMFQHczeyp7ImA9WhJREEU.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-4316538806730697126</id><published>2012-07-12T14:10:00.000+05:30</published><updated>2012-07-12T14:10:11.983+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-12T14:10:11.983+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><title>Saving HTML5 canvas to Java server</title><content type="html">If you are working with HTML5 Canvas element and are looking to save the generated PNG file back on to the server via Java - it is not as easy as saving the byte array. The reason that the generated PNG data is URL encoded and is prefixed with the dataURI format headers.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: javascript"&gt;    var canvas = document.getElementById('#myCanvas');
    var pngData = canvas.toDataURL('image/png');
&lt;/pre&gt;&lt;br /&gt;
The following code will convert the raw bytes by stripping off the headers, and coverting the Base64 encoded data to the raw PNG bytes.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;private void saveImage(byte[] pngData) {
 String png = new String(pngData);
 String find = "base64%2C";
 String tokens = png.substring(png.indexOf(find) + find.length());
 String decoded = StringUtils.replace(tokens, "%2F", "/");
 byte[] bytes = new Base64Encoder().decode(decoded);

 // save the generated bytes
 // which can then be read in a BufferedImage
 BufferedImage image = ImageIO.read(new ByteArrayInputStream(bytes));
 
 // mroe code
}
&lt;/pre&gt;&lt;br /&gt;
Hope this helps.&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/K50ITFoc31c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/4316538806730697126/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=4316538806730697126&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/4316538806730697126?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/4316538806730697126?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/K50ITFoc31c/saving-html5-canvas-to-java-server.html" title="Saving HTML5 canvas to Java server" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/07/saving-html5-canvas-to-java-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4HSXs_eip7ImA9WhJSGUQ.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-5383051192956116701</id><published>2012-07-11T13:18:00.000+05:30</published><updated>2012-07-11T13:18:58.542+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-11T13:18:58.542+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><title>Trim down HTML content to desired text length</title><content type="html">&lt;tt&gt;Problem:&lt;/tt&gt; Given some HTML code, trim it down into valid HTML code that contains text of desired length.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;pre class="brush: java"&gt;String s1 = "Text with &lt;b&gt;bold&lt;/b&gt;, &lt;i&gt;italic&lt;/i&gt; phrases.";
String s2 = trimHTML(s1, 12);
System.out.println(s2);
&lt;/pre&gt;should return&lt;br /&gt;
&lt;pre class="brush: java"&gt;Text with &lt;b&gt;bo&lt;/b&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;tt&gt;Solution:&lt;/tt&gt; For a project of mine, I had to use such a functionality. A quick google did not result in any existing function, and thus I ended up coding the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;/**
 * Strip the given HTML content to specified text length. All opening
 * tags are then closed to make sure that the HTML is perfectly safe.
 * 
 * Tags such as &lt;code&gt;br&lt;/code&gt; are skipped for closing.
 * 
 * @param content the HTML content that you want to trim down
 * @param length the desired length of the text field
 * @return the HTML code that contains text trimmed down to said length
 */
public static String trimHTML(String content, int length) {
 int currentIndex = 0;
 int chosenTextLength = 0;
 String tag;
 Stack&lt;String&gt; tags = new Stack&lt;String&gt;();
 do {
  int index = content.indexOf('&lt;', currentIndex);
  if(index &gt; currentIndex) {
   chosenTextLength += (index - currentIndex - 1);
   currentIndex = index;
  }
  
  if(chosenTextLength &gt;= length) {
   break;
  }
  
  if(index != -1) {
   index = content.indexOf('&gt;', index);
   tag = content.substring(currentIndex + 1, index);
   if(!tag.startsWith("/")) {
    if(tag.endsWith("/")) {
     tag = tag.substring(0, tag.length() - 1);
    }
    
    tags.push(tag.trim());
   } else {
    tag = tag.substring(1);
    do {
     if(tags.size() == 0) {
      break;
     }
     
     String pop = tags.pop();
     if(pop.equalsIgnoreCase(tag)) {
      break;
     }
    } while(true);
   }
   
   currentIndex = index;
  }
  
  if(index == -1) {
   break;
  }
 } while(true);
 
 if(chosenTextLength &gt; length) {
  int subtract = chosenTextLength - length;
  currentIndex = currentIndex - subtract;
 }
 
 if(tags.size() == 0) {
  return content.substring(0, currentIndex);
 }
 
 StringBuilder builder = new StringBuilder(content.substring(0, currentIndex));
 int size = tags.size();
 for(int index = 0; index &lt; size; index++) {
  tag = tags.pop();
  
  if(!"br".equalsIgnoreCase(tag)) {
   builder.append("&lt;/");
   builder.append(tag);
   builder.append('&gt;');
  }
 }
 
 return builder.toString();
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
The code is also available under the &lt;a href="http://www.sangupta.com/projects/jerry"&gt;Jerry&lt;/a&gt; project. You may browse the latest edition of this utility function in the &lt;a href="https://github.com/sangupta/jerry"&gt;GitHub repository&lt;/a&gt; in &lt;a href="https://github.com/sangupta/jerry/blob/master/src/main/java/com/sangupta/jerry/util/HtmlUtils.java"&gt;HtmlUtils.java&lt;/a&gt; file.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/lbu80e7I2J0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/5383051192956116701/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=5383051192956116701&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/5383051192956116701?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/5383051192956116701?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/lbu80e7I2J0/trim-down-html-content-to-desired-text.html" title="Trim down HTML content to desired text length" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/07/trim-down-html-content-to-desired-text.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQAQnkzeyp7ImA9WhVVEU8.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-6340523191986155287</id><published>2012-05-04T15:09:00.001+05:30</published><updated>2012-05-04T15:09:03.783+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-04T15:09:03.783+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tools" /><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Workarounds" /><title>Merge different SCM snapshots</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;This post is about MergeRepo a small script that allows to merge two different snapshots of the same repository from different SCMs into one.&lt;br /&gt;
&lt;br /&gt;
Recently, I had to collaborate on a project where the code was in Subversion. As we usually use Perforce, we forked a copy of the SVN trunk into Perforce and started our development. Once, the development was complete, we wanted to merge back in Subversion. And now, the nightmare started. SVN showed all files (thousands) to have been modified, due to a change in the timestamp or the change in line-ending character.&lt;br /&gt;
&lt;br /&gt;
The issue with line-ending character was easier to resolve, but the change in timestamp still created havoc. Thus, the need for this tool emerged. I wrote this simple script to ignore timestamp, and &lt;tt&gt;EOL&lt;/tt&gt; character, and merge the removed/added/modified files back into the SVN folder, so that only such files were shown for commit.&lt;br /&gt;
&lt;br /&gt;
The tool allows us to resolve such situations. It compares the two snapshots (folders/trees) and generates the merged repository with the only the modified files, so that it can be checked back into the original line. The tool can be used as,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: text"&gt;Usage:    $ java com.sangupta.keepwalking.MergeRepo &amp;lt;previous&amp;gt; &amp;lt;newer&amp;gt; &amp;lt;destination&amp;gt;

          previous      The folder corresponding to the older repository snapshot.
          newer         The folder corresponding to the newer repository snapshot.
          destination   The folder where the updated repository will be created.
&lt;/pre&gt;&lt;br /&gt;
The source code for the same is available on my &lt;a href="https://github.com/sangupta/BlogExamples/blob/master/KeepWalking/src/com/sangupta/keepwalking/MergeRepo.java"&gt;GitHub repository&lt;/a&gt;, or below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;/**
 *
 * MergeRepo - allows to merge two different snapshots of the same repository
 * Copyright (c) 2012, Sandeep Gupta
 * 
 * Read more at http://blog.sangupta.com
 * 
 * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package com.sangupta.keepwalking;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;

/**
 * Allows to merge two different snapshots of the same repository which are checked
 * in to two different SCM versions.
 *
 * @author sangupta
 */
public class MergeRepo {

 /**
  * @param args
  * @throws IOException 
  */
 public static void main(String[] args) throws IOException {
  if(args.length != 3) {
   usage();
   return;
  }
  
  final String previousRepo = args[0];
  final String newerRepo = args[1];
  final String mergedRepo = args[2];
  
  final File previous =  new File(previousRepo);
  final File newer = new File(newerRepo);
  final File merged = new File(mergedRepo);
  
  if(!(previous.exists() &amp;amp;&amp;amp; previous.isDirectory())) {
   System.out.println(&amp;quot;The previous version does not exists or is not a directory.&amp;quot;);
   return;
  }
  
  if(!(newer.exists() &amp;amp;&amp;amp; newer.isDirectory())) {
   System.out.println(&amp;quot;The newer version does not exists or is not a directory.&amp;quot;);
   return;
  }
  
  final IOFileFilter directoryFilter = FileFilterUtils.makeCVSAware(FileFilterUtils.makeSVNAware(null));
  
  final Collection&amp;lt;File&amp;gt; olderFiles = FileUtils.listFiles(previous, TrueFileFilter.TRUE, directoryFilter);
  final Collection&amp;lt;File&amp;gt; newerFiles = FileUtils.listFiles(newer, TrueFileFilter.TRUE, directoryFilter);

  // build a list of unique paths
  System.out.println(&amp;quot;Reading files from older version...&amp;quot;);
  List&amp;lt;String&amp;gt; olderPaths = new ArrayList&amp;lt;String&amp;gt;();
  for(File oldFile : olderFiles) {
   olderPaths.add(getRelativePath(oldFile, previous));
  }

  System.out.println(&amp;quot;Reading files from newer version...&amp;quot;);
  List&amp;lt;String&amp;gt; newerPaths = new ArrayList&amp;lt;String&amp;gt;();
  for(File newerFile : newerFiles) {
   newerPaths.add(getRelativePath(newerFile, newer));
  }
  
  
  // find which files have been removed from Perforce depot
  List&amp;lt;String&amp;gt; filesRemoved = new ArrayList&amp;lt;String&amp;gt;(olderPaths);
  filesRemoved.removeAll(newerPaths);
  System.out.println(&amp;quot;Files removed in newer version: &amp;quot; + filesRemoved.size());
  for(String removed : filesRemoved) {
   System.out.print(&amp;quot;    &amp;quot;);
   System.out.println(removed);
  }
  
  // find which files have been added in Perforce depot
  List&amp;lt;String&amp;gt; filesAdded = new ArrayList&amp;lt;String&amp;gt;(newerPaths);
  filesAdded.removeAll(olderPaths);
  System.out.println(&amp;quot;Files added in newer version: &amp;quot; + filesAdded.size());
  for(String added : filesAdded) {
   System.out.print(&amp;quot;    &amp;quot;);
   System.out.println(added);
  }
  
  // find which files are common 
  // now check if they have modified or not
  newerPaths.retainAll(olderPaths);
  List&amp;lt;String&amp;gt; modified = checkModifiedFiles(newerPaths, previous, newer);
  System.out.println(&amp;quot;Files modified in newer version: &amp;quot; + modified.size());
  for(String modify : modified) {
   System.out.print(&amp;quot;    &amp;quot;);
   System.out.println(modify);
  }
  
  // clean any previous existence of merged repo
  System.out.println(&amp;quot;Cleaning any previous merged repositories...&amp;quot;);
  if(merged.exists() &amp;amp;&amp;amp; merged.isDirectory()) {
   FileUtils.deleteDirectory(merged);
  }
  
  System.out.println(&amp;quot;Merging from newer to older repository...&amp;quot;);
  // copy the original SVN repo to merged
  FileUtils.copyDirectory(previous, merged);
  
  // now remove all files that need to be
  for(String removed : filesRemoved) {
   File toRemove = new File(merged, removed);
   toRemove.delete();
  }
  
  // now add all files that are new in perforce
  for(String added : filesAdded) {
   File toAdd = new File(newer, added);
   File destination = new File(merged, added);
   FileUtils.copyFile(toAdd, destination);
  }
  
  // now over-write modified files
  for(String changed : modified) {
   File change = new File(newer, changed);
   File destination = new File(merged, changed);
   destination.delete();
   FileUtils.copyFile(change, destination);
  }
  
  System.out.println(&amp;quot;Done merging.&amp;quot;);
 }
 
 private static void usage() {
  System.out.println(&amp;quot;RepoMerge: Command-line tool to merge two snapshots of a single repositories that come from &amp;quot;);
  System.out.println(&amp;quot;           different sources. Like you have your older repository in SubVersion and the newer&amp;quot;);
  System.out.println(&amp;quot;           code in Perforce. Now you want to merge the code and bring SVN back to the level of&amp;quot;);
  System.out.println(&amp;quot;           Perforce.&amp;quot;);
  System.out.println(&amp;quot;&amp;quot;);
  System.out.println(&amp;quot;Usage:    $ java com.sangupta.keepwalking.MergeRepo &amp;lt;previous&amp;gt; &amp;lt;newer&amp;gt; &amp;lt;destination&amp;gt;&amp;quot;);
  System.out.println(&amp;quot;&amp;quot;);
  System.out.println(&amp;quot;          previous      The folder corresponding to the older repository snapshot.&amp;quot;);
  System.out.println(&amp;quot;          newer         The folder corresponding to the newer repository snapshot.&amp;quot;);
  System.out.println(&amp;quot;          destination   The folder where the updated repository will be created.&amp;quot;);
 }

 /**
  * Checks if the file with given path is different in two different folders/branches
  *  
  * @param commonPath
  * @param svn
  * @param perforce
  * @return
  * @throws IOException
  */
 private static List&amp;lt;String&amp;gt; checkModifiedFiles(List&amp;lt;String&amp;gt; commonPath, File svn, File perforce) throws IOException {
  List&amp;lt;String&amp;gt; changed = new ArrayList&amp;lt;String&amp;gt;();
  
  for(String filePath : commonPath) {
   File svnFile = new File(svn, filePath);
   File perforceFile = new File(perforce, filePath);
   
   boolean equal = FileUtils.contentEqualsIgnoreEOL(svnFile, perforceFile, Charset.defaultCharset().name());
   if(!equal) {
    changed.add(filePath);
   }
  }
  
  return changed;
 }

 /**
  * Extract the relative path of the file from the absolute path, given the parent.
  * 
  * @param file
  * @param parent
  * @return
  */
 private static String getRelativePath(File file, File parent) {
  String path = file.getAbsolutePath();
  String parentPath = parent.getAbsolutePath();
  if(path.startsWith(parentPath)) {
   return path.substring(parentPath.length() + 1);
  }
  
  return path;
 }

}
&lt;/pre&gt;&lt;br /&gt;
Hope it helps, some one out there!&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/OSQePGZPUqY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/6340523191986155287/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=6340523191986155287&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6340523191986155287?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6340523191986155287?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/OSQePGZPUqY/merge-different-scm-snapshots.html" title="Merge different SCM snapshots" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/05/merge-different-scm-snapshots.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4ARHk6eSp7ImA9WhVWFUQ.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-4260643584460963673</id><published>2012-04-28T13:12:00.002+05:30</published><updated>2012-04-28T13:12:25.711+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-28T13:12:25.711+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ActionScript" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><category scheme="http://www.blogger.com/atom/ns#" term="Adobe AIR" /><title>Introducing as3dribbble - ActionScript Client Library for Dribbble.com</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I am happy to announce the availability of &lt;b&gt;as3dribbble&lt;/b&gt;, an ActionScript client library for working with &lt;a href="http://dribbble.com/"&gt;Dribbble.com&lt;/a&gt; APIs. The library is strongly-typed, pagination-aware, and rate-limit aware for accessing all the current APIs. The library also exposes a convenience class called &lt;tt&gt;DribbbleInvoker&lt;/tt&gt; that may be used to add more APIs (should they get added in future and this library looses track). The invoker is rate-limit safe.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Usage&lt;/h3&gt;A simple example to use is as under,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: as3"&gt;private function getShotDetails():void {
    var client:DribbbleClient = new DribbbleClient();

    // the requestID can then be used to check which request failed
    var requestID:uint = client.getShot(12, showShot, errorHandler);
}

private function showShot(shot:Shot):void {
    trace('received shot details: ' + shot);
}

private function errorHandler(id:uint):void {
    // error occured when fetching shot details
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Pagination Support&lt;/h3&gt;All API methods that support pagination have a corresponding, pagination-aware method available as well. For example, when fetching comments for a shot you may do,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: as3"&gt;var client:DribbbleClient = new DribbbleClient();

private function getShotComments():void {
    var requestID:uint = client.getShotComments(123, showComments, errorHandler);
}

private function showComments(list:CommentList):void {
    // do something with these comments

    var requestID:uint;

    // check for more comments
    if(list.getPage() &amp;lt; list.getPages()) {
        // fetch results from page 2
        requestID = client.getShotComments(1, showComments, errorHandler, 2);

        // or, may provide the number of results to fetch as well
        // fetch results from page 2, with 15 results per page
        requestID = getShotComments(1, showComments, errorHandler, 2, 15);
    }
}
&lt;/pre&gt;The current default for number of results per page is 15 per Dribbble API. Refer &lt;a href="http://dribbble.com/api"&gt;http://dribbble.com/api&lt;/a&gt; for more details.  &lt;br /&gt;
&lt;h3&gt;Rate-Limiting and Exceptions&lt;/h3&gt;By default, the &lt;tt&gt;DribbbleClient&lt;/tt&gt; will throw a &lt;tt&gt;DribbbleApiRateLimitException&lt;/tt&gt; run-time error when the request rate goes over the board. This makes sure that your client does not need to catch unnecessary exceptions during invocation.  In case you wish, you may catch this exception and delay the request to a future time as,  &lt;br /&gt;
&lt;pre class="brush: as3"&gt;private function getShot():void {
    var shot:Shot = null;
    var shotID:uint = 1;

    try {
        var requestID:uint = client.getShot(shotID, showShot, errorHandler);
    } catch(e:DribbbleApiRateLimitException) {
        // wait for a minute
        setTimeOut(getShot, 1000 * 60); // call again after a minute
    }
}
&lt;/pre&gt;If you wish to prevent the code from throwing the &lt;tt&gt;DribbbleApiRateLimitException&lt;/tt&gt; exception, you can do so when creating the client.  &lt;br /&gt;
&lt;pre class="brush: as3"&gt;var client:DribbbleClient = new DribbbleClient(false);
&lt;/pre&gt;Any invocations on this client, will not throw the error, but return a &lt;tt&gt;null&lt;/tt&gt; back as the result to the completion handler you specified.  &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;The library does not depend on any third-party libraries and is self-contained. The library has been compiled and tested using Adobe Flex 4.6/Adobe AIR 3.0.  &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Project Links&lt;/h3&gt;More details on the project can be found on project home page, &lt;a href="http://www.sangupta.com/projects/as3dribbble"&gt;http://www.sangupta.com/projects/as3dribbble&lt;/a&gt;.&lt;br /&gt;
Source Code: &lt;a href="https://github.com/sangupta/as3dribbble"&gt;https://github.com/sangupta/as3dribbble&lt;/a&gt;&lt;br /&gt;
Downloads: &lt;a href="https://github.com/sangupta/as3dribbble/downloads"&gt;https://github.com/sangupta/as3dribbble/downloads&lt;/a&gt;&lt;br /&gt;
Issue Management: &lt;a href="https://github.com/sangupta/as3dribbble/issues"&gt;https://github.com/sangupta/as3dribbble/issues&lt;/a&gt; &lt;br /&gt;
Usage Instructions: &lt;a href="https://github.com/sangupta/as3dribbble/blob/master/README.md"&gt;https://github.com/sangupta/as3dribbble/blob/master/README.md&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Keep Dribbbling!&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/LL973wiDnag" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/4260643584460963673/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=4260643584460963673&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/4260643584460963673?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/4260643584460963673?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/LL973wiDnag/introducing-as3dribbble-actionscript.html" title="Introducing as3dribbble - ActionScript Client Library for Dribbble.com" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/04/introducing-as3dribbble-actionscript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cARn88cCp7ImA9WhVWEUo.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-526448074776328218</id><published>2012-04-23T15:27:00.001+05:30</published><updated>2012-04-23T15:27:27.178+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-23T15:27:27.178+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><title>Introducing Pepmint!</title><content type="html">I am happy to introduce &lt;a href=""&gt;PepMint&lt;/a&gt;, a JAVA wrapper over the awesome &lt;a href="http://pygments.org/"&gt;Python's Pygments&lt;/a&gt; code syntax highlighting library. With Pepmint you can easily syntax highlight your own piece of snippet using code. This essentially helps us to build tools that consume code and output HTML - blog engines, presentation tools, documentation generators etc.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Usage&lt;/h3&gt;Super-easy way to use the library is described in the example below,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:java"&gt;public String highlight(String code, String language) {
    Pepmint pepmint = null;
    Lexer lexer = pepmint.newLexer(format);
    Formatter formatter = pepmint.newHtmlFormatter(formatterParams);

    String formattedCode = pepmint.highlight(code, lexer, formatter);
    return formattedCode;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Dependencies&lt;/h3&gt;The library is self-contained and does not depend on any third-party library. It is built using,&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Java 1.6&lt;/li&gt;
&lt;li&gt;Jython 2.5.6&lt;/li&gt;
&lt;li&gt;Pygments 1.4&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;h3&gt;Project Links&lt;/h3&gt;More details on the project can be found on project home page, &lt;a href="http://www.sangupta.com/projects/pepmint"&gt;http://www.sangupta.com/projects/pemint&lt;/a&gt;.&lt;br /&gt;
Source Code: &lt;a href="https://github.com/sangupta/pepmint"&gt;https://github.com/sangupta/pepmint&lt;/a&gt;&lt;br /&gt;
Downloads: &lt;a href="https://github.com/sangupta/pepmint/downloads"&gt;https://github.com/sangupta/pepmint/downloads&lt;/a&gt;&lt;br /&gt;
Issue Management: &lt;a href="https://github.com/sangupta/pepmint/issues"&gt;https://github.com/sangupta/pepmint/issues&lt;/a&gt;&lt;br /&gt;
Usage Instructions: &lt;a href="https://github.com/sangupta/pepmint/blob/master/README.md"&gt;https://github.com/sangupta/pepmint/blob/master/README.md&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Have Fun Highlighting!&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/3hgl36fF6I0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/526448074776328218/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=526448074776328218&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/526448074776328218?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/526448074776328218?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/3hgl36fF6I0/introducing-pepmint.html" title="Introducing Pepmint!" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/04/introducing-pepmint.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04GSHc8eyp7ImA9WhVXF04.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-8340798346267003591</id><published>2012-04-18T14:35:00.000+05:30</published><updated>2012-04-18T14:35:29.973+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-18T14:35:29.973+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><title>Rate-Limited Java Client Dribbble API</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I am happy to finish and open-source a strongly-typed, rate-limited Java Client library for &lt;a href="http://dribbble.com/"&gt;Dribbble&lt;/a&gt; called &lt;b&gt;dribbble-java-client&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;dribbble-java-client&lt;/b&gt; is a strongly typed Java library for accessing &lt;a href="http://dribbble.com/"&gt;http://dribbble.com&lt;/a&gt; API. The library provides support for rate limiting requests. All objects implement the necessary &lt;tt&gt;equals&lt;/tt&gt;, &lt;tt&gt;hashcode&lt;/tt&gt; and &lt;tt&gt;toString&lt;/tt&gt; methods for easier usage. Also, implemented is the Comparable interface for comparison and sorting.&lt;br /&gt;
&lt;br /&gt;
The library also exposes a convenience class called &lt;tt&gt;DribbbleInvoker&lt;/tt&gt; that may be used to add more APIs (should they get added in future and this library looses track). The invoker is rate-limit safe.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Usage&lt;/h3&gt;&lt;pre class="brush: java"&gt;DribbbleClient client = new DribbbleClient();

// get info on shot with ID: 1
Shot shot = client.getShot(1);

// get info on this shot's player
Player player = client.getPlayer(shot.getPlayer().getId());

// do more...
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Pagination Support&lt;/h3&gt;All API methods that support pagination have a corresponding, pagination-aware method available as well. For example, when fetching comments for a shot you may do,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;DribbbleClient client = new DribbbleClient();

CommentList list = getShotComments(1);

// do something with these comments

if(list.getPage() &amp;lt; list.getPages()) {
    list = getShotComments(1, 2); // to get default page 2

    // or, may provide the number of results to fetch as well
    list = getShotComments(1, 2, 15);
}

// get more comments
&lt;/pre&gt;&lt;br /&gt;
The current default for number of results per page is 15 per Dribbble API. Refer &lt;a href="http://dribbble.com/api"&gt;http://dribbble.com/api&lt;/a&gt; for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Project Links&lt;/h3&gt;More details on the project can be found on project home page, &lt;a href="http://www.sangupta.com/projects/dribbble-java-client"&gt;http://www.sangupta.com/projects/dribbble-java-client&lt;/a&gt;.&lt;br /&gt;
Source Code: &lt;a href="https://github.com/sangupta/dribbble-java-client"&gt;https://github.com/sangupta/dribbble-java-client&lt;/a&gt;&lt;br /&gt;
Downloads: &lt;a href="https://github.com/sangupta/dribbble-java-client/downloads"&gt;https://github.com/sangupta/dribbble-java-client/downloads&lt;/a&gt;&lt;br /&gt;
Issue Management: &lt;a href="https://github.com/sangupta/dribbble-java-client/issues"&gt;https://github.com/sangupta/dribbble-java-client/issues&lt;/a&gt;&lt;br /&gt;
Usage Instructions: &lt;a href="https://github.com/sangupta/dribbble-java-client/blob/master/README.md"&gt;https://github.com/sangupta/dribbble-java-client/blob/master/README.md&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/9ZFo5eYOw6E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/8340798346267003591/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=8340798346267003591&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8340798346267003591?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8340798346267003591?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/9ZFo5eYOw6E/rate-limited-java-client-dribbble-api.html" title="Rate-Limited Java Client Dribbble API" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/04/rate-limited-java-client-dribbble-api.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIMSXg9fip7ImA9WhRbEEw.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-1531666796150182852</id><published>2012-01-27T18:09:00.000+05:30</published><updated>2012-01-31T18:09:48.666+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-31T18:09:48.666+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apache Flex" /><title>Proposed Apache Flex Logos | Round II - Results</title><content type="html">The Apache Flex logo contest came to end today with the results for Round 2 being announces by &lt;b&gt;Doug Arthur&lt;/b&gt;. And the winner is,&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://s.apache.org/af-logo-42"&gt;Logo #42&lt;/a&gt;:&lt;br /&gt;
Total: 77 Votes&lt;br /&gt;
Community: 61 *&lt;br /&gt;
PPMC: 16 *&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://s.apache.org/af-logo-49"&gt;Logo #49&lt;/a&gt;:&lt;br /&gt;
Total: 49 Votes&lt;br /&gt;
Community: 44&lt;br /&gt;
PPMC: 5&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Congrats to the team behind logo #42.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Full results are available &lt;a href="http://people.apache.org/~dougarthur/apache_flex_logo_votes_round2.pdf"&gt;here (PDF)&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Quoting Doug,&lt;br /&gt;
&lt;blockquote&gt;Finally, Tomasz Maciag's logo will appear as the new Apache Logo (As stated in the &lt;a href="http://incubator.apache.org/flex/logo-contest.html"&gt;contest rules&lt;/a&gt;, tweaks will be allowed now that the contest has been finalized. )&lt;/blockquote&gt;&lt;br /&gt;
For the over eagerly,&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.fusecollective.com/apache-flex/apache-flex-fusecollective_v2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="221" src="http://www.fusecollective.com/apache-flex/apache-flex-fusecollective_v2.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Disclaimer:&lt;/b&gt; I voted for #42.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/sdasW9IgEyc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/1531666796150182852/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=1531666796150182852&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/1531666796150182852?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/1531666796150182852?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/sdasW9IgEyc/proposed-apache-flex-logos-round-ii.html" title="Proposed Apache Flex Logos | Round II - Results" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/01/proposed-apache-flex-logos-round-ii.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYHR38zeSp7ImA9WhRbEEw.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-7931001492032499881</id><published>2012-01-24T18:00:00.000+05:30</published><updated>2012-01-31T18:02:16.181+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-31T18:02:16.181+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apache Flex" /><title>Proposed Apache Flex Logos | Round I - Results</title><content type="html">From among all the contenders, after the first round of voting, the results are as under:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://s.apache.org/af-logo-49"&gt;Logo #49&lt;/a&gt;:&lt;br /&gt;
  Total: 106.5 Pts&lt;br /&gt;
  Community: 83.5 *&lt;br /&gt;
  PPMC: 23&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://s.apache.org/af-logo-42"&gt;Logo #42&lt;/a&gt;:&lt;br /&gt;
  Total: 99.5&lt;br /&gt;
  Community: 68.5&lt;br /&gt;
  PPMC: 31 *&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://s.apache.org/af-logo-40"&gt;Logo #40&lt;/a&gt;:&lt;br /&gt;
  Total: 65&lt;br /&gt;
  Community: 63&lt;br /&gt;
  PPMC: 2&lt;br /&gt;
&lt;br /&gt;
A list of aggregated first round results is available &lt;a href="http://people.apache.org/~dougarthur/apache_flex_logo_votes.xlsx"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The voting will now continue to choose the one from these three.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Disclaimer:&lt;/b&gt; The results are based on the vote of the community on Apache Flex Dev mailing-list.&lt;br /&gt;
&lt;br /&gt;
Happy Flexing!&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/G6ziU1aVOxE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/7931001492032499881/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=7931001492032499881&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/7931001492032499881?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/7931001492032499881?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/G6ziU1aVOxE/proposed-apache-flex-logos-round-i.html" title="Proposed Apache Flex Logos | Round I - Results" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/01/proposed-apache-flex-logos-round-i.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8CQHc_cCp7ImA9WhRVEEU.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-1980895675591499719</id><published>2012-01-07T21:42:00.001+05:30</published><updated>2012-01-09T09:17:41.948+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-09T09:17:41.948+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apache Flex" /><title>Proposed Apache Flex Logos | Part II</title><content type="html">In continuation of my previous post on &lt;a href="http://blog.sangupta.com/2012/01/proposed-apache-flex-logos.html"&gt;Proposed Apache Flex Logos&lt;/a&gt; here are some more logos that have been posted. Check them out.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;By Mihai Ene&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://cs.ibaneasa.ro/flex/flexlogoprop2-graybg.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="284" src="http://cs.ibaneasa.ro/flex/flexlogoprop2-graybg.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://cs.ibaneasa.ro/flex/flexlogoprop3-blankbg.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="285" src="http://cs.ibaneasa.ro/flex/flexlogoprop3-blankbg.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://cs.ibaneasa.ro/flex/flexlogoprop4-adobestyle.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="285" src="http://cs.ibaneasa.ro/flex/flexlogoprop4-adobestyle.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h3&gt;By Carlos Rovira - Updated&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.carlosrovira.com/apache-flex-logo-proposal-2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://www.carlosrovira.com/apache-flex-logo-proposal-2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h3&gt;By Peter Elst&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://peterelst.com/tmp/apacheflex-logo-proposal.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="252" src="http://peterelst.com/tmp/apacheflex-logo-proposal.png" width="550" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Update: 9 Jan 2012&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;By Doug McCune&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dougmccune.com/apache_flex_logo.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="600" src="http://dougmccune.com/apache_flex_logo.jpg" width="800" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/ibaWviSBvCg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/1980895675591499719/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=1980895675591499719&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/1980895675591499719?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/1980895675591499719?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/ibaWviSBvCg/proposed-apache-flex-logos-part-ii.html" title="Proposed Apache Flex Logos | Part II" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/01/proposed-apache-flex-logos-part-ii.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QARnY7eip7ImA9WhRWGE8.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-2199067782003892843</id><published>2012-01-06T09:26:00.001+05:30</published><updated>2012-01-06T11:25:47.802+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-06T11:25:47.802+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apache Flex" /><title>Proposed Apache Flex Logos</title><content type="html">As we all have heard that &lt;a href="http://www.adobe.com"&gt;Adobe&lt;/a&gt; has started donating the &lt;a href="www.adobe.com/products/flex.html"&gt;Flex framework&lt;/a&gt; to the &lt;a href="http://www.apache.org"&gt;Apache&lt;/a&gt; foundation. The project was approved over the holidays and the combat has begun.&lt;br /&gt;
&lt;br /&gt;
The first blood was shed yesterday with some designers proposing new logos for the &lt;a href="http://incubator.apache.org/flex/"&gt;Apache Flex framework&lt;/a&gt;. Below are the logos submitted by the time of writing. Please vote for your favorite ones at the project's &lt;a href="http://incubator.apache.org/flex/mailing-lists.html"&gt;mailing list&lt;/a&gt;s.&lt;br /&gt;
&lt;br /&gt;
In case you are enthusiastic enough and are a designer, it would be helpful to propose your own thoughts for the same. Make sure you go over the &lt;a href="http://www.apache.org/licenses/icla.txt"&gt;Individual Contributor License Agreement&lt;/a&gt; for you would need to donate your work to &lt;a href="http://www.apache.org"&gt;Apache&lt;/a&gt; in its accordance.&lt;br /&gt;
&lt;br /&gt;
Without much ado, in no particular order:&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;By Erik Lundgren&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://lndgrn.se/ApacheFlexLogo_01_01.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="600" width="800" src="http://lndgrn.se/ApacheFlexLogo_01_01.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h3&gt;By Rick Winscot&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.quilix.com/images/Apache_Flex_01.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="118" width="147" src="http://www.quilix.com/images/Apache_Flex_01.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h3&gt;By Tink&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.tink.ws/Flex-Logo.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="500" width="500" src="http://www.tink.ws/Flex-Logo.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h3&gt;By Randy Troppmann&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://randytroppmann.com/flex/apache-flex-logo.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="200" width="173" src="http://randytroppmann.com/flex/apache-flex-logo.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h3&gt;By Carlos Rovira&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.carlosrovira.com/apache-flex-logo-proposal.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="600" width="800" src="http://www.carlosrovira.com/apache-flex-logo-proposal.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="clear: both"&gt;&lt;/div&gt;&lt;br /&gt;
Happy Flexing! :)&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/9E2jh5Ge4ns" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/2199067782003892843/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=2199067782003892843&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/2199067782003892843?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/2199067782003892843?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/9E2jh5Ge4ns/proposed-apache-flex-logos.html" title="Proposed Apache Flex Logos" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2012/01/proposed-apache-flex-logos.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4GQnY-fip7ImA9WhRQE0k.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-2898284498595263583</id><published>2011-12-08T16:57:00.001+05:30</published><updated>2011-12-08T17:02:03.856+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-08T17:02:03.856+05:30</app:edited><title>Mission Accomplished - Greplin Programming Challenge!</title><content type="html">After a lull yesterday, I could finally find time to solve the third puzzle in the &lt;a href="http://challenge.greplin.com/"&gt;Greplin Programming Challenge&lt;/a&gt;. At first the puzzle seemed tricky, considering my bad with combinatory logic with numbers. However after many trials and errors I could solve the puzzle. And now I can sit and relax, and look at my stupid face as to why I was writing over 100 lines of code to solve, when the solution was simply a few lines.&lt;br /&gt;
&lt;br /&gt;
Anyways, am done with the challenge and I have my passcode now! Next steps involve dropping them a mail with my solutions.&lt;br /&gt;
&lt;br /&gt;
For those interested, the code is available on &lt;a href="https://github.com/sangupta/greplin"&gt;my GitHub repository&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Happy Coding!&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/48_wIRxGa5A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/2898284498595263583/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=2898284498595263583&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/2898284498595263583?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/2898284498595263583?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/48_wIRxGa5A/mission-accomplished-greplin.html" title="Mission Accomplished - Greplin Programming Challenge!" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/12/mission-accomplished-greplin.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQCRnw6fyp7ImA9WhRQEk4.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-4440455499375929165</id><published>2011-12-07T10:08:00.001+05:30</published><updated>2011-12-07T10:19:27.217+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-07T10:19:27.217+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Challenge" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><title>Greplin Programming Challenge</title><content type="html">Yesterday evening I came across another programming challenge called &lt;a href="http://challenge.greplin.com/"&gt;Greplin Programming Challenge&lt;/a&gt;. The challenge presents three problems which requires one to write small pieces of code to solve, and provide the solution as the password to the next level. Something similar to &lt;a href="http://projecteuler.net/"&gt;Project Euler&lt;/a&gt; problems.&lt;br /&gt;
&lt;br /&gt;
The challenge claims it may take from anywhere between 20 minutes and 2 hours. The first and second level are quite easy and should be completed within 15 minutes (including the time to fire up the IDE and keying in code, lazying around in bed). The third level requires some combinatory logic and thus may require a little extra time. I am done with the first 2 levels and planning for the third today evening.&lt;br /&gt;
&lt;br /&gt;
For those interested, the code is available on &lt;a href="https://github.com/sangupta/greplin"&gt;my GitHub repository&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Looks like am developing a liking for coding problems... Anyone recommending another?&lt;br /&gt;
&lt;br /&gt;
Have. Fun. Coding.&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/FK6PjvfNFkk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/4440455499375929165/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=4440455499375929165&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/4440455499375929165?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/4440455499375929165?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/FK6PjvfNFkk/greplin-programming-challenge.html" title="Greplin Programming Challenge" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/12/greplin-programming-challenge.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUMRH4zfyp7ImA9WhRQEk4.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-6474523474298968444</id><published>2011-12-07T09:48:00.001+05:30</published><updated>2011-12-07T10:01:25.087+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-07T10:01:25.087+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Challenge" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><title>Image Unshredder - Update</title><content type="html">In continuation of my &lt;a href="http://blog.sangupta.com/2011/12/instagrams-engineering-challenge.html"&gt;earlier post&lt;/a&gt; about &lt;b&gt;Instagram's Engineering Challenge on an Image Unshredder&lt;/b&gt;, I took some time out yesterday and completed the automatic strip width detection piece. The approach was easy, the euclidean distance on the strip edge will be too high than the normal values. For example the values may look like,&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;3, 4, 3, 5, 3, 2, 6, &lt;b&gt;22&lt;/b&gt;, 4, 3, 2, 3, 4, 3, 2, &lt;b&gt;27&lt;/b&gt;, 3, ...&lt;/pre&gt;&lt;br /&gt;
One just needs to take the average of above values, then find the average of values greater than this average. Once you have the maxAverage, one can run a loop and find the value where the ratio of (value / minimum) is close to the ratio of (maxAverage / minimum). The first index where this happens is the strip width. To be doubly sure that we have chosen the right value, make sure the strip width divides the image width in whole.&lt;br /&gt;
&lt;br /&gt;
I tested my code with many a free images from &lt;a href="http://www.flickr.com/"&gt;Flickr&lt;/a&gt; and it all worked. Though I did find a couple of issues with images that had a dark background and no front object - like a huge clear sky running in. &lt;br /&gt;
&lt;br /&gt;
As the challenge was to unshred the shredded &lt;b&gt;Tokyo&lt;/b&gt; image, it stands completed. The remaining improvements, I will leave for some other day.&lt;br /&gt;
&lt;br /&gt;
I have also added an &lt;b&gt;image shredder&lt;/b&gt; and a test suite that takes in images from a given folder, shreds and then unshreds them.&lt;br /&gt;
&lt;br /&gt;
For those interested the code is posted on my &lt;a href="https://github.com/sangupta/image-unshred"&gt;GitHub repository&lt;/a&gt; at &lt;a href="https://github.com/sangupta/image-unshred"&gt;https://github.com/sangupta/image-unshred&lt;/a&gt;&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/6ameoxNmYks" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/6474523474298968444/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=6474523474298968444&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6474523474298968444?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6474523474298968444?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/6ameoxNmYks/image-unshredder-update.html" title="Image Unshredder - Update" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/12/image-unshredder-update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcMRHs7cCp7ImA9WhRQEUk.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-8202826302890036281</id><published>2011-12-06T09:00:00.000+05:30</published><updated>2011-12-06T09:31:25.508+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-06T09:31:25.508+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Challenge" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><title>Instagram's Engineering Challenge: The Unshredder</title><content type="html">Three weeks ago, Instagram posted an engineering challenge: &lt;a href="http://instagram-engineering.tumblr.com/post/12651721845/instagram-engineering-challenge-the-unshredder"&gt;The Unshredder&lt;/a&gt;. The challenge presented an image that had been vertically shredded/spliced and then rejoined randomly, thus resulting in an image that looks like a puzzle. What one had to do was to write a script to take that image and unshred it - yes, reconstruct the original image. &lt;br /&gt;
&lt;br /&gt;
From their blog,&lt;br /&gt;
&lt;blockquote style="padding-left: 20px;"&gt;Your challenge, if you choose to accept it, is to write a simple script that takes a shredded image in as input:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.tumblr.com/tumblr_luigsoCv3s1qm4rc3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://media.tumblr.com/tumblr_luigsoCv3s1qm4rc3.png" width="500" /&gt;&lt;/a&gt;&lt;/div&gt;and outputs an unshredded and reconstituted image. That is, imagine if you took an image, divided it into an even number of columns and shuffled those columns randomly to produce a shredded image. Then, take that image into the script and output the original image:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.tumblr.com/tumblr_luih7og6QM1qm4rc3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://media.tumblr.com/tumblr_luih7og6QM1qm4rc3.png" width="500" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;
I happened to read and pick up this challenge yesterday, and it was surprising to find that the solution was a very simple best-match function that had to place a given slice alongside another based on how close the left-pixels of one were to the right-pixels of another. I used Java and the built in AWT package to load the image and read the pixel colors at various coordinates. Reconstructing the image was again super easy using AWT. To test that the solution was a generic one, I sliced some 50 random images and then reconstructed them using my code for varying slice-widths - ranging from 4 pixel wide to 64 pixel wide.&lt;br /&gt;
&lt;br /&gt;
My algorithm worked in the following way:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Find out the number of stripes in the image (as the strip-width is known)&lt;/li&gt;
&lt;li&gt;Slice the image and store all sub-images in a given array&lt;/li&gt;
&lt;li&gt;Pick the first slice from the array&lt;/li&gt;
&lt;li&gt;Now for each other slice in the array (slices that have not yet been used) - compute the average Euclidean distance of the left edge of the given slice and the right edge of the test slice. Similarly, compute the average distance of the right edge of the given slice and the left edge of the test slice.&lt;/li&gt;
&lt;li&gt;Find the slices that have the least scores for left and right side&lt;/li&gt;
&lt;li&gt;Now, insert the one of the test slice to the left or to the right, depending on which test slice and edge had the lowest average distance&lt;/li&gt;
&lt;li&gt;Work this way to arrange each unused slice to the set of arranged slices&lt;/li&gt;
&lt;li&gt;At the end, you have all the slices in order resulting in the reconstructed image&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
For those interested the code is posted on my &lt;a href="https://github.com/sangupta/image-unshred"&gt;GitHub repository&lt;/a&gt; at &lt;a href="https://github.com/sangupta/image-unshred"&gt;https://github.com/sangupta/image-unshred&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I haven't yet completed the bonus part of it due to lack of time, but hope to push it in a day or two.&lt;br /&gt;
&lt;br /&gt;
Happy Coding!&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/JVkp1ibgBh8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/8202826302890036281/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=8202826302890036281&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8202826302890036281?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8202826302890036281?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/JVkp1ibgBh8/instagrams-engineering-challenge.html" title="Instagram's Engineering Challenge: The Unshredder" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/12/instagrams-engineering-challenge.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQFQno7fSp7ImA9WhRQEUk.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-6082245938844687990</id><published>2011-11-17T19:42:00.001+05:30</published><updated>2011-12-06T09:18:33.405+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-06T09:18:33.405+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Challenge" /><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><title>The Luhny Bin</title><content type="html">Two days ago, &lt;a href="http://blog.crazybob.org/"&gt;Bob Lee&lt;/a&gt; posted a fun challenge on the &lt;a href="http://blog.crazybob.org/2011/11/coding-challenge-luhny-bin.html"&gt;Luhny Bin&lt;/a&gt;. It was not before a day has passed that I could get to know of the problem and try my hands at it. The delay being attributed to absence of &lt;b&gt;Cygwin&lt;/b&gt; on my Windows machine which was needed to run the test harness (refer original post on details).&lt;br /&gt;
&lt;br /&gt;
Yesterday, I spent most of my time first trying to get the harness running without using Cygwin. The solution was a bit tricky as I had to figure out how the test harness was actually running. Anyhow, my solution is available at &lt;a href="https://github.com/sangupta/luhnybin/blob/master/src/com/squareup/luhnybin/Main.java"&gt;here&lt;/a&gt; wherein I modified the original &lt;tt&gt;Main.java&lt;/tt&gt; file. The change was simple: first, change &lt;tt&gt;mask.sh&lt;/tt&gt; on line &lt;tt&gt;41&lt;/tt&gt; to say &lt;tt&gt;mask.bat&lt;/tt&gt; and second, modify line &lt;tt&gt;81&lt;/tt&gt; to correctly build the process.&lt;br /&gt;
&lt;br /&gt;
Once, I had it setup and after loosing all day, I was ready to start coding the actual solution. Before I dozed off to my bed, I had made sure that my code passed 18 of the 20 tests. The &lt;b&gt;19th test&lt;/b&gt; was tricky. It had many over-lapping &lt;tt&gt;luhn&lt;/tt&gt; numbers, and hence I had some leftover in the end which was not being cleaned up. This single test made me completely rewrite the piece introducing a third buffer (which came down to two, as I directly now wrote to &lt;tt&gt;System.out&lt;/tt&gt;).&lt;br /&gt;
&lt;br /&gt;
Anyways, the solution is now complete and posted on my fork of the &lt;a href="https://github.com/sangupta/luhnybin"&gt;LuhnyBin Github&lt;/a&gt; repository.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/f1qJRDqRJxc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/6082245938844687990/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=6082245938844687990&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6082245938844687990?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6082245938844687990?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/f1qJRDqRJxc/luhny-bin.html" title="The Luhny Bin" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/11/luhny-bin.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUABQnw_eip7ImA9WhRTGUk.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-8844734209617607504</id><published>2011-11-10T21:48:00.001+05:30</published><updated>2011-11-10T22:19:13.242+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-10T22:19:13.242+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Workarounds" /><title>EGit GitHub Commit API and Commit Stats</title><content type="html">While working today with &lt;a href="http://www.eclipse.org/egit"&gt;EGit&lt;/a&gt; for the &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt; API, I found out that there is no way to get the Commit statistics and the various file details. If you ponder over the API details at &lt;a href="http://developer.github.com/v3/repos/commits/"&gt;http://developer.github.com/v3/repos/commits/&lt;/a&gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: text"&gt;GET /repos/:user/:repo/commits/:sha
&lt;/pre&gt;&lt;br /&gt;
the response for the API contains details about the lines added/deleted in the commit. The response also contains details about the various files that are impacted. See the *stats* and the *files* section below:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: text"&gt;{
  "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "commit": {
    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "author": {
      "name": "Monalisa Octocat",
      "email": "support@github.com",
      "date": "2011-04-14T16:00:49Z"
    },
    "committer": {
      "name": "Monalisa Octocat",
      "email": "support@github.com",
      "date": "2011-04-14T16:00:49Z"
    },
    "message": "Fix all the bugs",
    "tree": {
      "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    }
  },
  "author": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "url": "https://api.github.com/users/octocat"
  },
  "committer": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "url": "https://api.github.com/users/octocat"
  },
  "parents": [
    {
      "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    }
  ],
  "stats": {
    "additions": 104,
    "deletions": 4,
    "total": 108
  },
  "files": [
    {
      "filename": "file1.txt",
      "additions": 10,
      "deletions": 2,
      "total": 12
    }
  ]
}
&lt;/pre&gt;&lt;br /&gt;
As I needed these values, I happened to go over the source code for *EGit* and find a way around. Must say, the way the source code is structured makes it super-easy to modify the code for additional API values.&lt;br /&gt;
&lt;br /&gt;
Below are the two simple changes I made to make sure the API returns the details I needed,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Add the following class &lt;tt&gt;org.eclipse.egit.github.core.Stats&lt;/tt&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush: java"&gt;package org.eclipse.egit.github.core;

public class Stats {
 
 private int additions;
 
 private int deletions;
 
 private int total;

 public int getAdditions() {
  return additions;
 }

 public void setAdditions(int additions) {
  this.additions = additions;
 }

 public int getDeletions() {
  return deletions;
 }

 public void setDeletions(int deletions) {
  this.deletions = deletions;
 }

 public int getTotal() {
  return total;
 }

 public void setTotal(int total) {
  this.total = total;
 }

}&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Modify the class &lt;tt&gt;org.eclipse.egit.github.core.RepositoryCommit&lt;/tt&gt;&lt;/b&gt; to add the following lines:&lt;br /&gt;
&lt;pre class="brush: java"&gt;private Stats stats;
 
 private List&amp;lt;CommitFile&amp;gt; files;

 public Stats getStats() {
  return stats;
 }

 public void setStats(Stats stats) {
  this.stats = stats;
 }

 public List&amp;lt;CommitFile&amp;gt; getFiles() {
  return files;
 }

 public void setFiles(List&amp;lt;CommitFile&amp;gt; files) {
  this.files = files;
 }
&lt;/pre&gt;&lt;br /&gt;
And we are done. Calling the following API,&lt;br /&gt;
&lt;pre class="brush: java"&gt;public void test() {

    CommitService commitService = new CommitService();

    RepositoryCommit commit = commitService.getCommit(repository, sha);

    System.out.println("Total lines impacted: " + commit.getTotal());

    System.out.println("Total files impacted: " + commit.getFiles().size());
}
&lt;/pre&gt;&lt;br /&gt;
should return back the various statistics as returned by *GitHub*.&lt;br /&gt;
&lt;br /&gt;
Hope this helps!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update:&lt;/b&gt; Added the files as a GitHub gist at &lt;a href="https://gist.github.com/1355351"&gt;https://gist.github.com/1355351&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/-zi-drrt0T4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/8844734209617607504/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=8844734209617607504&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8844734209617607504?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8844734209617607504?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/-zi-drrt0T4/egit-github-commit-api-and-commit-stats.html" title="EGit GitHub Commit API and Commit Stats" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/11/egit-github-commit-api-and-commit-stats.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8BSH0zcSp7ImA9WhdbEk8.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-3495951014372198703</id><published>2011-10-10T12:10:00.001+05:30</published><updated>2011-10-10T12:10:59.389+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-10T12:10:59.389+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Creativity Concepts" /><category scheme="http://www.blogger.com/atom/ns#" term="Adobe AIR" /><title>Preview: Connecting Content and Community in the Cloud</title><content type="html">&lt;b&gt;Jay Dutta&lt;/b&gt;, Experience Design Manager and &lt;b&gt;Luanne Seymour&lt;/b&gt;, Sr. Instructional Designer at &lt;a href="http://www.adobe.com"&gt;Adobe&lt;/a&gt; presented a Social Study on how to connect content and community in the cloud at &lt;a href="http://max.adobe.com/attend"&gt;Adobe MAX 2011&lt;/a&gt;.&lt;br /&gt;
As mentioned for the video,&lt;br /&gt;
&lt;blockquote&gt;See how a few simple UX design patterns can facilitate a shared, social learning experience that blurs the boundaries between inspiration and instruction, as well as between content and community. Three trends are currently sweeping digital media: Tablets are moving from content consumption to creation, social features are increasingly pervasive, and everything is shifting to the cloud. Join us to explore how this trifecta creates exciting opportunities for designers and developers, and to examine our own promising effort at taking advantage of these trends.&lt;/blockquote&gt;&lt;br /&gt;
Watch the video on &lt;a href="http://tv.adobe.com/watch/max-2011-envision/social-studies-connecting-content-and-community-in-the-cloud/"&gt;Adobe TV&lt;/a&gt; or,&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;iframe allowfullscreen="" frameborder="0" height="296" scrolling="no" src="http://tv.adobe.com/embed/802/11308/" title="AdobeTV Video Player" width="480"&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/9YdPYNP8qDs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/3495951014372198703/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=3495951014372198703&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/3495951014372198703?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/3495951014372198703?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/9YdPYNP8qDs/preview-connecting-content-and.html" title="Preview: Connecting Content and Community in the Cloud" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/10/preview-connecting-content-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUICQX8_cSp7ImA9WhdUF0w.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-6610685970250149080</id><published>2011-10-04T13:50:00.001+05:30</published><updated>2011-10-04T14:09:20.149+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-04T14:09:20.149+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ActionScript" /><category scheme="http://www.blogger.com/atom/ns#" term="Adobe AIR" /><title>AIR 3.0 Native Extensions and Samples</title><content type="html">Today at &lt;a href="http://max.adobe.com"&gt;MAX 2011&lt;/a&gt;, Adobe &lt;a href="http://blogs.adobe.com/flashplayer/2011/10/adobe-flash-player-11-air-11-available-later-today.html"&gt;released&lt;/a&gt; the latest version of their Flash platform SDKs - Flash Player 11 and AIR 3.0. The most noticeable and exciting amongst &lt;a href="http://blogs.adobe.com/flashplatform/2011/09/announcing-flash-player-11-and-air-3.html"&gt;new features of AIR 3.0&lt;/a&gt; is the introduction of &lt;a href="http://www.adobe.com/devnet/air/articles/extending-air.html"&gt;Native Extensions&lt;/a&gt;. Native Extensions allow a developer to extend the capabilities of the AIR platform by running native code directly from their AIR applications. Quoting from Adobe's site,&lt;br /&gt;
&lt;blockquote&gt;This new capability allows developers to:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Achieve deeper integration with target devices&lt;/li&gt;
&lt;li&gt;Incorporate legacy native code in their application&lt;/li&gt;
&lt;li&gt;Achieve maximum performance for critical code&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
I am not going to delve into what the feature introduces a developer to, for the same one may go ahead and read this &lt;a href="http://www.adobe.com/devnet/air/articles/extending-air.html"&gt;article by Oliver Goldman&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Following are the links to the various Native Extensions that have been built and are available for ready use:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;A &lt;a href="http://www.adobe.com/devnet/air/articles/developing-native-extensions-air.html"&gt;Hello World&lt;/a&gt; example to beign with&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/notification.html"&gt;Push Notification native extension sample&lt;/a&gt; for Android and iOS&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.adobe.com/devnet/air/articles/android-licensing-native-extensions.html"&gt;Licensing Adobe AIR applications&lt;/a&gt; on Android&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/gyroscope.html"&gt;Gyroscope native extension&lt;/a&gt; sample&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/networkinfo.html"&gt;NetworkInfo native extension&lt;/a&gt; sample&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html"&gt;Vibration native extension&lt;/a&gt; sample&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://custardbelly.com/blog/2011/09/21/air-native-extension-example-ibattery-for-ios/"&gt;iBattery for iOS native extension&lt;/a&gt; sample&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.magicalhobo.com/2011/09/12/air-3-native-extension-imageprocessor/"&gt;Image Processor native extension&lt;/a&gt; sample for Windows&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.aboutme.be/2011/10/02/kinect-native-extension-for-adobe-air/"&gt;Kinect native extension&lt;/a&gt; library&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.riaspace.com/2011/09/as3c2dm-air-native-extension-to-push-notifications-with-c2dm/"&gt;Android Cloud to Device Messaging Framework&lt;/a&gt; native extension library&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.magicalhobo.com/2011/10/01/air-3-native-extension-example-pentablet/"&gt;Read Pressure Sensitivity of a Pen Tablet&lt;/a&gt; on Windows&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
If you know of more example extensions that are publicly available, please drop a comment and I will include them in the list.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/6bxaUpw0ZCo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/6610685970250149080/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=6610685970250149080&amp;isPopup=true" title="15 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6610685970250149080?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/6610685970250149080?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/6bxaUpw0ZCo/air-30-native-extensions-and-samples.html" title="AIR 3.0 Native Extensions and Samples" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>15</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/10/air-30-native-extensions-and-samples.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEHQnwzeyp7ImA9WhdUEEw.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-5401651689116368863</id><published>2011-09-26T10:37:00.000+05:30</published><updated>2011-09-26T10:37:13.283+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-26T10:37:13.283+05:30</app:edited><title>Function Overloading in ActionScript</title><content type="html">We all know that function overloading, or for that matter Constructor overloading, is not supported in ActionScript. This is not a big deterrent till what you are writing your own code, but becomes a major blocker when you plan to port some code from a code piece written in another language. Recently, I have started migrating one of the de-facto open-source Java software to ActionScript. And the piece is huge. Giving different names to each overloaded method and then making sure that you call the right one tends to get complicated.&lt;br /&gt;
&lt;br /&gt;
Assigning a variable &lt;tt&gt;Object&lt;/tt&gt; to method arguments and then writing the overloaded method is so so messy and ugly. While porting this piece, this problem had been in my mind for almost a week now, and today morning it occurred that I could use &lt;tt&gt;abstraction&lt;/tt&gt; to solve my problem. To outline the methodology I adopted to solve this problem is as under. Suppose you have the following java code, &lt;br /&gt;
&lt;pre class="brush: java"&gt;public class Example {

    public void method(int x) { ... }

    public void method(int x, int y) { .... }

    public void method(String x) { .... }

    public void method(int x, String y) { .... }

}&lt;/pre&gt;&lt;br /&gt;
The most commonly used methodology when porting to ActionScript would be,&lt;br /&gt;
&lt;pre class="brush: as3"&gt;public class Example {

    public function method(x:*, y:* = undefined):void {
        if(x is int &amp;&amp; y is undefined) { ... }

        else if(x is String &amp;&amp; y is undefined) { ... }

        else if(x is int &amp;&amp; y is int) { .... }

        else if(x is int &amp;&amp; y is String) { ... }
    }

}&lt;/pre&gt;&lt;br /&gt;
This method has its own disadvantages as it looses type safety. We can thus utilize abstraction to make sure that we achieve the method overloading without loosing the type safety as below. First, define a marker interface that indicates that a given class encapsulates arguments for a given method, such as,&lt;br /&gt;
&lt;pre class="brush: as3"&gt;public interface IMethodArguments {

}
&lt;/pre&gt;Next define one class for each of the arguments type and the number of arguments as,&lt;br /&gt;
&lt;pre class="brush: as3"&gt;public class SingleIntegerArguments implements IMethodArguments {

    public var x:int;

}

public class TwoIntegerArguments implements IMethodArguments {

    public var x:int;

    public var y:int;

}

public class SingleStringArguments implements IMethodArguments {

    public var x:String;

}

public class IntegerStringArguments implements IMethodArguments {

    public var x:int;

    public var y:String;

}
&lt;/pre&gt;Lastly, modify the original method to check against the implementing class of the object passed as argument. This makes sure that none of the variables declared anyplace is of type &lt;tt&gt;Object&lt;/tt&gt; or &lt;tt&gt;Variable '*'&lt;/tt&gt;.&lt;br /&gt;
&lt;pre class="brush: as3"&gt;public class Example {

    public function method(argument:IMethodArguments):void {
        if(argument is SingleIntegerArguments {
            ...
        } else if(argument is TwoIntegerArguments) {
            ...
        } else if(argument is SingleStringArguments) {
            ...
        } else if(argument is IntegerStringArguments) {
            ...
        }
    }
}&lt;/pre&gt;&lt;br /&gt;
The method outlined here is nothing novel but just a different approach to providing a functionality that is very common in the programming world in a type-safe way.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/mOXXpT97Gnc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/5401651689116368863/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=5401651689116368863&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/5401651689116368863?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/5401651689116368863?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/mOXXpT97Gnc/function-overloading-in-actionscript.html" title="Function Overloading in ActionScript" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/09/function-overloading-in-actionscript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQBQHY4fSp7ImA9WhdVFko.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-2183895486792508447</id><published>2011-09-22T12:21:00.003+05:30</published><updated>2011-09-22T12:22:31.835+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-22T12:22:31.835+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Coding Techniques" /><category scheme="http://www.blogger.com/atom/ns#" term="Interview Questions" /><title>parseDouble() in Java</title><content type="html">&lt;tt&gt;Problem:&lt;/tt&gt; Impement the &lt;b&gt;Double.parseDouble()&lt;/b&gt; method of Java.&lt;br /&gt;
&lt;br /&gt;
&lt;tt&gt;Solution:&lt;/tt&gt; A classic interview problem where one needs to check in for all boundary combinations and all representations of a number. The following number representations are perfectly fine and should be accounted for,&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;23&lt;/li&gt;
&lt;li&gt;+23&lt;/li&gt;
&lt;li&gt;-23&lt;/li&gt;
&lt;li&gt;+0.23&lt;/li&gt;
&lt;li&gt;-0.23&lt;/li&gt;
&lt;li&gt;.23&lt;/li&gt;
&lt;li&gt;-.23&lt;/li&gt;
&lt;li&gt;00000.23&lt;/li&gt;
&lt;li&gt;0.23000000&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
The code for the same is as under, and is also available on &lt;a href="https://github.com/sangupta/BlogExamples/blob/master/KeepWalking/src/com/sangupta/keepwalking/ParseDouble.java"&gt;GitHub&lt;/a&gt; for reference.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;/**
 * Copyright (C) 2011, Sandeep Gupta
 * http://www.sangupta.com
 * 
 * The file is licensed under the the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * 
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package com.sangupta.keepwalking;


/**
 * A simple Java implementation of the Java's &lt;code&gt;Double.parseDouble()&lt;/code&gt; function.
 * 
 * @author Sandeep Gupta &lt;a href="http://www.sangupta.com"&gt;[email]&lt;/a&gt;
 * @version 1.0
 * @since 22 Sep 2011
 */
public class ParseDouble {
	
	/**
	 * Some tests to run.
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(parseDouble(".23"));
	}

	/**
	 * A simple implementation that takes a number as a string and converts it
	 * to a double method, similar to what &lt;code&gt;Double.parseDouble()&lt;/code&gt; does.
	 * 
	 * The following number values are supported,
	 * +23
	 * -23
	 * +0.23
	 * +.23
	 * 0.23
	 * .23
	 * 0000.23
	 * 0.23000
	 * 
	 * @param string the string representation of the number
	 * @return the double value
	 * @throws NumberFormatException if the string does not represent a number or is malformed
	 */
	private static double parseDouble(String num) {
		if(num == null || "".equals(num.trim())) {
			throw new NumberFormatException("Number cannot be null/empty.");
		}
		
		// remove any leading or trailing spaces
		num = num.trim();
		final int size = num.length();
		
		// holds the starting position of the digits
		int index = 0;
		boolean isNegative = false;
		boolean hasDecimal = false;
		
		// check for unary operators
		char first = num.charAt(0);
		switch(first) {
			case '+':
				index++;
				break;
				
			case '-':
				index++;
				isNegative = true;
				break;
				
			case '.':
				index++;
				hasDecimal = true;
				break;
				
			default:
				throw new NumberFormatException("Number is malformed: " + num); 
		}
		
		// start the parsing logic
		
		double ip = 0.0, dp = 0.0;
		double fd = 1.0;
		
		for(int i = index; i &lt; size; i++) {
			char c = num.charAt(i);
			int digit = c - '0';
			
			if(isNumeric(c) &amp;&amp; digit != '0') {
				if(!hasDecimal) {
					ip *= 10;
					ip += digit;
				} else {
					dp *= 10;
					dp += digit;
					fd *= 10;
				}
			} else if(c == '.') {
				if(hasDecimal) {
					throw new NumberFormatException("Number is malformed: " + num);
				}
				
				hasDecimal = true;
			} else {
				throw new NumberFormatException("Number is malformed: " + num);
			}
		}
		
		// add the decimal fraction
		dp = dp / fd;
		double number = ip + dp;
		
		// test for negative
		if(isNegative) {
			number = 0 - number;
		}
		
		return number;
	}

	/**
	 * Tests whether the given character is a digit or not.
	 * 
	 * @param digit the character to be tested
	 * @return &lt;code&gt;true&lt;/code&gt; if character is a digit, else &lt;code&gt;false&lt;/code&gt;
	 */
	private static boolean isNumeric(char digit) {
		if('0' &lt;= digit &amp;&amp; digit &lt;= '9') {
			return true;
		}
		
		return false;
	}
	
}
&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/ffANnh9S_v0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/2183895486792508447/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=2183895486792508447&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/2183895486792508447?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/2183895486792508447?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/ffANnh9S_v0/problem-impement-double.html" title="parseDouble() in Java" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/09/problem-impement-double.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04DRH49fSp7ImA9WhdVFE8.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-3658094829345683594</id><published>2011-09-19T14:06:00.001+05:30</published><updated>2011-09-19T14:16:15.065+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-19T14:16:15.065+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="My Projects" /><category scheme="http://www.blogger.com/atom/ns#" term="Adobe AIR" /><title>FRAG for Free Rice</title><content type="html">&lt;a href="http://www.freerice.com"&gt;Free Rice&lt;/a&gt; is a site that helps one improve their English vocabulary (the first feature/section they rolled). Quite Simple, huh? No - for every word one gets right they donate 10 grains of rice to the World Food Programme to help end hunger. The cause itself along with the methodology they employ makes it a huge attraction. I am addicted to the game myself, but the professional commitments do not let me make the most of it.&lt;br /&gt;
&lt;br /&gt;
Thus, I decided to use some of my skills to better use... and developed &lt;b&gt;FRAG - Free Rice Avant Garde&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Frag_(video_gaming)"&gt;Frag&lt;/a&gt; as per &lt;a href="http://en.wikipedia.org"&gt;Wikipedia&lt;/a&gt; is,&lt;br /&gt;
&lt;blockquote&gt;Frag is a computer and video game term originating from the word fragging, a term indicating to kill an unpopular superior officer with a fragmentation grenade. A frag is roughly equivalent to "kill", with the typical main difference that the player being "fragged" can instantly respawn (play again) in most games, i.e. the "kill" is only temporary&lt;/blockquote&gt;&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Avant-garde"&gt;Avant Garde&lt;/a&gt; as per &lt;a href="http://en.wikipedia.org"&gt;Wikipedia&lt;/a&gt; is,&lt;br /&gt;
&lt;blockquote&gt;Avant-garde means "advance guard" or "vanguard". The adjective form is used in English to refer to people or works that are experimental or innovative, particularly with respect to art, culture, and politics.&lt;/blockquote&gt;&lt;br /&gt;
Thus, FRAGs is an automated bot that &lt;b&gt;kills&lt;/b&gt; the hunger monster, by experimenting with technology where the arena relates to art and culture.&lt;br /&gt;
&lt;br /&gt;
Simply, FRAGs for FreeRice is an automated bot that can play the game on your behalf. It comes with its own memory of answers, but is geared to keep building its memory as and when more questions are added to the game. It can play at a rate of 1 question every 3 seconds, thus accumulating 200 grains of rice every minute, or more than 0.25 million grains per day. Currently, the bot can play the following subjects,&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Algebra&lt;/li&gt;
&lt;li&gt;Capitals&lt;/li&gt;
&lt;li&gt;English Vocabulary&lt;/li&gt;
&lt;li&gt;Multiplication&lt;/li&gt;
&lt;li&gt;Paintings&lt;/li&gt;
&lt;li&gt;Periodic Table&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
The bot is written in &lt;a href="http://get.adobe.com/air"&gt;Adobe AIR&lt;/a&gt; technology and demonstrates how one can interact between the HTML of a loaded page with &lt;tt&gt;ActionScript&lt;/tt&gt;.&lt;br /&gt;
&lt;br /&gt;
The source code for the bot is available on &lt;a href="http://github.com/sangupta/frag"&gt;GitHub&lt;/a&gt;. A downloadable binary will be available soon.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/AwUfN-QATMg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/3658094829345683594/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=3658094829345683594&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/3658094829345683594?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/3658094829345683594?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/AwUfN-QATMg/frag-for-free-rice.html" title="FRAG for Free Rice" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/09/frag-for-free-rice.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08CSXo7eCp7ImA9WhdWE0U.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-8067648911607556014</id><published>2011-09-07T13:21:00.000+05:30</published><updated>2011-09-07T13:21:08.400+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-07T13:21:08.400+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Project Euler" /><title>Project Euler Problem 348 Solution</title><content type="html">&lt;b&gt;&lt;u&gt;Problem&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Many numbers can be expressed as the sum of a square and a cube. Some of them in more than one way.&lt;br /&gt;
&lt;br /&gt;
Consider the palindromic numbers that can be expressed as the sum of a square and a cube, both greater than 1, in &lt;b&gt;exactly&lt;/b&gt; 4 different ways.&lt;br /&gt;
For example, 5229225 is a palindromic number and it can be expressed in exactly 4 different ways:&lt;br /&gt;
&lt;br /&gt;
2285&lt;sup&gt;2&lt;/sup&gt; + 20&lt;sup&gt;3&lt;/sup&gt;&lt;br /&gt;
2223&lt;sup&gt;2&lt;/sup&gt; + 66&lt;sup&gt;3&lt;/sup&gt;&lt;br /&gt;
1810&lt;sup&gt;2&lt;/sup&gt; + 125&lt;sup&gt;3&lt;/sup&gt;&lt;br /&gt;
1197&lt;sup&gt;2&lt;/sup&gt; + 156&lt;sup&gt;3&lt;/sup&gt;&lt;br /&gt;
&lt;br /&gt;
Find the sum of the five smallest such palindromic numbers.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Analysis&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The given palindrome number is 7 digit. Hence, we start iterating with all palindromes that are atleast 7 digits in length and go up to the point where we find the first 5 palindromes satisfying the given condition. Finding palindromes iterating over a sequence is time consuming, hence, create a small function that generates only palindromes.&lt;br /&gt;
&lt;br /&gt;
For a palindrome of digit length n, when n is even, a simple loop of n/2 digits can be run. Thus for palindromes of length 4, a loop from 10 to 99 can be run, where the number and its reverse are appended. Similarly for a palindrome of digit length n, when n is odd, a first loop for (n - 1)/2 digits and a second loop from 0 to 9 can be run. Thus for palindromes with a length 5, run an outerloop from 10 to 99 and an inner loop from 0 to 9. Concatenate the number, the middle element and the reverse of the number to generate the palindromes.&lt;br /&gt;
&lt;br /&gt;
To check for the given condition that the number be expressed as a sum of square and cube, where both numbers are greater than 2. Simply run a loop from 2 to cube root of number minus 4 (for the square will be of atleast 2). Then see if the square root is perfect or not. Keep counting valid combinations. If a number has 4 such combinations consider it for the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Solution&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Code part of &lt;a href="https://github.com/sangupta/maer"&gt;Project Maer on Github&lt;/a&gt;. Runs under 2 seconds in Java 6.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: java"&gt;package com.sangupta.maer.page7;

import com.sangupta.maer.util.MathUtil;

/**
 * Problem 348 on Project Euler, http://projecteuler.net/index.php?section=problems&amp;id=348
 *
 * @author &lt;a href="http://www.sangupta.com"&gt;Sandeep Gupta&lt;/a&gt;
 * @since 06-Sep-2011
 */
public class Problem348 {
	
	private static int found = 0;
	
	private static long sum = 0;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		iterateOnPalindromes(7, 12);
		System.out.println("Sum: " + sum);
	}
	
	private static void iterateOnPalindromes(final int startDigits, final int maxDigits) {
		for(int numDigits = startDigits; numDigits &lt;= maxDigits; numDigits++) {
			if(MathUtil.isEven(numDigits)) {
				long end = (long) Math.pow(10, (numDigits / 2));
				long start = end / 10;
				
				// loop
				for(long i = start; i &lt; end; i++) {
					String palindrome = String.valueOf(i);
					palindrome = palindrome + new StringBuilder(palindrome).reverse().toString();
					boolean stopLoop = checkPalindrome(palindrome);
					if(stopLoop) {
						return;
					}
				}
			} else {
				// this is odd digit based
				int digitGroupLength = numDigits - 1;
				long end = (long) Math.pow(10, (digitGroupLength / 2));
				long start = end / 10;
				
				// loop
				for(long i = start; i &lt; end; i++) {
					// the middle digit comes from the second loop
					for(int middle = 0; middle &lt; 10; middle++) {
						String palindrome = String.valueOf(i);
						palindrome = palindrome + String.valueOf(middle) + new StringBuilder(palindrome).reverse().toString();
						boolean stopLoop = checkPalindrome(palindrome);
						if(stopLoop) {
							return;
						}
					}
				}				
			}
		}
	}

	/**
	 * @param palindrome
	 * @return
	 */
	private static boolean checkPalindrome(String palindrome) {
		Long number = Long.parseLong(palindrome);
		if(isPalindromeRepresentable(number)) {
			System.out.println("Found " + number);
			found++;
			sum += number;
		}
		
		if(found == 5) {
			return true;
		}
		return false;
	}

	private static boolean isPalindromeRepresentable(final long number) {
		int cubeLimit = (int) Math.cbrt(number - 4);
		
		int countForms = 0;
		
		for(int testNumber = 2; testNumber &lt;= cubeLimit; testNumber++) {
			int cube = testNumber * testNumber * testNumber;
			long diff = number - cube;
			double squareRoot = Math.sqrt(diff);
			int intSquareRoot = (int) squareRoot;
			if(squareRoot == intSquareRoot) {
				countForms++;
			}
		}
		
		if(countForms == 4) {
			return true;
		}
		
		return false;
	}
}&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/f0vhhzitdyo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/8067648911607556014/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=8067648911607556014&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8067648911607556014?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/8067648911607556014?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/f0vhhzitdyo/project-euler-problem-348-solution.html" title="Project Euler Problem 348 Solution" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/09/project-euler-problem-348-solution.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcCQns8fip7ImA9WhdRE0s.&quot;"><id>tag:blogger.com,1999:blog-3969325917870221979.post-902271578107834045</id><published>2011-08-03T14:47:00.001+05:30</published><updated>2011-08-03T14:47:43.576+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-03T14:47:43.576+05:30</app:edited><title>Magic of flash.trace.Trace</title><content type="html">One of the hidden treasures in the Flash Player is the &lt;tt&gt;flash.trace.Trace&lt;/tt&gt; class. It was meant to be hidden, but in open-source nothing can be treasured without the world knowing it. The actual class implementation is available in the &lt;a href="http://hg.mozilla.org/tamarin-central/file/e774dfe22b39/extensions/Trace.as"&gt;tamarin-central&lt;/a&gt; codebase. An excerpt of the class implementation is as under (copyright notices etc removed),&lt;br /&gt;
&lt;pre class="brush:as3"&gt;package flash.trace
	public class Trace
	{
		/* levels of desired logging */
		public static const OFF:int = 0;
		public static const METHODS:int = 1;						// method entry only 
		public static const METHODS_WITH_ARGS:int = 2;				// method entry and arguments
		public static const METHODS_AND_LINES:int = 3;				// method entry and line numbers
		public static const METHODS_AND_LINES_WITH_ARGS:int = 4;	// method entry, arguments and line numbers

		/* used to select either file or listener callback logging. */
		public static const FILE = 1;
		public static const	LISTENER = 2;

		public static native function setLevel(l:int, target:int=LISTENER);
		public static native function getLevel(target:int=LISTENER):int;

		/**
		 * Register a listener to receive trace callbacks upon method and/or 
		 * line number changes.  Passing null to this function effectively
		 * 'unregisters' the listener and only a single listener can 
		 *  be specified.
		 * 
		 *  The callback funcition must have the following signature:
		 *
		 *     function foo(file_name:String, linenum:int, method_name:String, method_args:String):void
		 *
		 *  Depending upon the setting of the trace level, 2 or more arguments may be non-empty.  
		 *  In all cases file_name and method_name are obtained and passed to the callback.  If 
		 *  the trace level include line numbers information then this value is also obtained 
		 *  and passed into the callback.  Setting the trace level to include method arguments implies
		 *  that the 'method_args' parameter will be filled with string representation of the arguments
		 *  passed into the call.
		 */
		public static native function setListener(f:Function);
		public static native function getListener():Function;
	};
};&lt;/pre&gt;&lt;br /&gt;
Harnessing the power of the same in ActionScript is easy. &lt;b&gt;The magic lies in the fact that for every executed line, the listener as provided in the class above would be called, giving out the class name, the method name, the file name, and yes, the method arguments as well.&lt;/b&gt; Don't believe it. Try it.&lt;br /&gt;
&lt;br /&gt;
The following class is a wrapper over the &lt;tt&gt;flash.trace.Trace&lt;/tt&gt; class to see the code execution between two points.&lt;br /&gt;
&lt;pre class="brush:as3"&gt;package com.sangupta.utils
{
	import flash.trace.Trace;

	public class TraceUtility {
		
		private static var init:Boolean = false;
		
		private static var linesExecuted:uint = 0;
		
		public function TraceUtility() {
			super();
		}
		
		public static function startTracing():void {
			if(!init) {
				Trace.setListener(traceListener);
				init = true;
			}
			
			Trace.setLevel(Trace.METHODS_AND_LINES_WITH_ARGS, Trace.LISTENER);
		}
		
		public static function stopTracing():void {
			Trace.setLevel(Trace.OFF, Trace.LISTENER);
			trace('Total lines executed: ' + linesExecuted);
			linesExecuted = 0;
		}
		
		private static function traceListener(fileInfo:String, lineNumber:String, classAndMethod:String, methodArguments:String):void {
			linesExecuted++;
			trace(classAndMethod + '(' + methodArguments + ')'); 
		}
	}
}&lt;/pre&gt;&lt;br /&gt;
Usage is simple in a class, say, &lt;i&gt;MyWorker&lt;/i&gt;:&lt;br /&gt;
&lt;pre class="brush:as3"&gt;package com.sangupta.utils
{
	import TraceUtility;

	public class TraceUtilityTest {
		
		public function myWorkingMethod():void {
			TraceUtility.startTracing();

			// do something expensive here

			TraceUtility.stopTracing();
		}
		
	}
}&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Notes:&lt;/b&gt; First, as for every executed line the listener is called, this will slow down the execution of the code. Second, this is not meant to replace the &lt;b&gt;Application Profiling&lt;/b&gt; workflows. Lastly, in a nutshell, this technique should not be used in releasable code.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;img src="http://feeds.feedburner.com/~r/Azcarya/~4/ttsG0d4K2C0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.sangupta.com/feeds/902271578107834045/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3969325917870221979&amp;postID=902271578107834045&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/902271578107834045?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3969325917870221979/posts/default/902271578107834045?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Azcarya/~3/ttsG0d4K2C0/magic-of-flashtracetrace.html" title="Magic of flash.trace.Trace" /><author><name>Sandeep Gupta</name><uri>https://plus.google.com/110645714607919970386</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-fgzHpYBSqzA/AAAAAAAAAAI/AAAAAAAAG-0/ixmCNG09Gwc/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://blog.sangupta.com/2011/08/magic-of-flashtracetrace.html</feedburner:origLink></entry></feed>
