<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>David Tulig</title>
 <link href="http://www.davidtulig.com/atom.xml" rel="self"/>
 <link href="http://www.davidtulig.com"/>
 <updated>2015-05-21T02:20:03+00:00</updated>
 <id>http://www.davidtulig.com</id>
 <author>
   <name>David Tulig</name>
   <email>david.tulig@gmail.com</email>
 </author>

 
 <entry>
   <title>Launching Indeed Around the World</title>
   <link href="http://www.davidtulig.com/talks/launching-indeed-around-the-world"/>
   <updated>2014-05-28T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/talks/launching-indeed-around-the-world</id>
   <content type="html">&lt;p&gt;Indeed launched its first job search site in 2004, allowing job seekers to find jobs in the US. Three years later, we launched our first non-US site. Over the next 5 years, we expanded to more than 50 countries and 27 languages. In this talk we will share our experience iteratively expanding Indeed to these new markets, and explain how you can use data to drive the business and product decisions involved in these launches. We will also describe the engineering and operational infrastructure we built to succeed worldwide.&lt;/p&gt;

&lt;p&gt;This talk was given at &lt;a href=&quot;http://engineering.indeed.com/talks/internationalize-success/&quot;&gt;@IndeedEng&lt;/a&gt;, Indeed’s public tech talk series.&lt;/p&gt;

&lt;h2 id=&quot;slides&quot;&gt;Slides&lt;/h2&gt;

&lt;p&gt;
&lt;iframe src=&quot;https://www.slideshare.net/slideshow/embed_code/35440098&quot; width=&quot;558&quot; height=&quot;420&quot; frameborder=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot; style=&quot;border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px; max-width: 100%;&quot; allowfullscreen=&quot;&quot;&gt; &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2 id=&quot;video&quot;&gt;Video&lt;/h2&gt;

&lt;p&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/WcutrMiAhLk&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Building Indeed Resume Search</title>
   <link href="http://www.davidtulig.com/talks/building-indeed-resume-search"/>
   <updated>2013-05-08T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/talks/building-indeed-resume-search</id>
   <content type="html">&lt;p&gt;I dive into the architecture of Indeed’s Resume Instant Search and our use of the Google Closure tools. I explain how we write maintainable, efficient JavaScript components for Resume Instant Search and other Indeed products. I discuss how we create templates that run on both client and server, providing fast initial page load time and search engine-friendly pages with the responsiveness of client-side rendering.&lt;/p&gt;

&lt;p&gt;This talk was given at &lt;a href=&quot;http://engineering.indeed.com/blog/2013/05/may-indeedeng-talk/&quot;&gt;@IndeedEng&lt;/a&gt;, Indeed’s public tech talk series.&lt;/p&gt;

&lt;h2 id=&quot;slides&quot;&gt;Slides&lt;/h2&gt;

&lt;p&gt;
&lt;iframe src=&quot;https://www.slideshare.net/slideshow/embed_code/24018470&quot; width=&quot;558&quot; height=&quot;420&quot; frameborder=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot; style=&quot;border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px; max-width: 100%;&quot; allowfullscreen=&quot;&quot;&gt; &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2 id=&quot;video&quot;&gt;Video&lt;/h2&gt;

&lt;p&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/ezT6l1FFKfo&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Google Closure Tools: Building Resume Instant Search</title>
   <link href="http://www.davidtulig.com/talks/google-closure-tools-building-resume-instant-search"/>
   <updated>2012-08-21T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/talks/google-closure-tools-building-resume-instant-search</id>
   <content type="html">&lt;p&gt;This talk will start by going over the components of the Google Closure Tools and will cover the templates, which are usable on both the client and server, the library, which comes with a dependency management system and a large set of utilities, and the compiler, which performs advanced optimizations to speed up your JavaScript and reduce the size of the final application. It then goes into detail on how Indeed has leveraged those tools to build resume instant search, covering using the closure tools in development, discussing the architecture that drives the product, and the advantages gained by using the closure tools.&lt;/p&gt;

&lt;p&gt;This talk was given at &lt;a href=&quot;http://austinjavascript.com/august-2012-austin-javascript-meetup-details-announced/&quot;&gt;Austin JavaScript&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;video&quot;&gt;Video&lt;/h2&gt;

&lt;p&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/WdbmfojihZM&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>The HTML5 DOM Element API: classList</title>
   <link href="http://www.davidtulig.com/posts/the-html5-dom-element-api-classlist"/>
   <updated>2011-11-08T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/posts/the-html5-dom-element-api-classlist</id>
   <content type="html">&lt;p&gt;The &lt;code&gt;classList&lt;/code&gt; object is a set of functions that helps you manipulate the &lt;code&gt;class&lt;/code&gt; attribute on a node. It provides functionality that allows you to add a class to the node, remove a class, find out if a node contains a class, and lets you toggle a class. It is a pretty simple API to interact with so let us run through an example that uses the available functions.&lt;/p&gt;

&lt;p&gt;Starting HTML:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1347084.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;And now for the JavaScript:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1347059.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;This is something that JavaScript libraries have been helping us with for awhile and it is great to see it make its entrance as a native API. Unfortunately, support is still lagging a bit. You will find it available in Firefox and Chrome; the rest of the browsers only have it in more recent versions and IE does not have support for it at all, at the time of this post. Here is the full &lt;a href=&quot;http://caniuse.com/#search=classList&quot;&gt;caniuse&lt;/a&gt; page.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>3 Day Startup from a Mentor's Perspective</title>
   <link href="http://www.davidtulig.com/posts/3-day-startup-from-a-mentor-s-perspective"/>
   <updated>2011-11-01T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/posts/3-day-startup-from-a-mentor-s-perspective</id>
   <content type="html">&lt;p&gt;What is 3 day startup? From the &lt;a href=&quot;http://3daystartup.org/&quot;&gt;3DS website&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote class=&quot;posterous_medium_quote&quot;&gt;The idea of 3 Day Startup is simple: start tech companies over the course of three days. We rent work space for an entire weekend, recruit 40 student participants with a wide range of backgrounds, cater food and drinks, and bring in top-notch entrepreneurs and investors. The participants pick the best ideas for startups during the Friday brainstorming session and deliver prototypes and investor pitches on Sunday night.&lt;/blockquote&gt;

&lt;p&gt;I helped mentor the October 21-23, 2011 3 day startup in Austin and in addition to having a lot of fun myself, I came away with some insights of what made teams successful and ideas for what could have gone better.&lt;/p&gt;

&lt;h2 id=&quot;the-initial-idea&quot;&gt;The initial idea&lt;/h2&gt;

&lt;p&gt;The best initial pitches were those that had a small focus and scope. A great way to know if you have a clear idea is if you can explain it and have others understand it in a 10-20 second summary. In that summary you want to describe the problem, the solution, and how it will make money.&lt;/p&gt;

&lt;p&gt;A small focus and scope does not end at the end of brainstorming. Even if your idea changes from what it was during the initial brainstorming, keeping the new scope small really helps ensure that you have enough time to do research and prepare answers to the common questions at the final pitch.&lt;/p&gt;

&lt;h2 id=&quot;learn-the-basics-of-software-engineering&quot;&gt;Learn the basics of software engineering&lt;/h2&gt;

&lt;p&gt;Before the event, have experience with a version control system like subversion or git. While dropbox is good for sharing files, you will find it is much easier to work on a team project with real version control. It also would not hurt to read up on best practices for web development and familiarize yourself with mobile application, web or native, development.&lt;/p&gt;

&lt;h2 id=&quot;build-a-project-with-django-or-ruby-on-rails&quot;&gt;Build a project with Django or Ruby on Rails&lt;/h2&gt;

&lt;p&gt;While you will not be building the final production quality product in three days, having a functional prototype is an impressive addition to the final pitch and gives you the opportunity to test it out on real customers during the weekend. Why Django or Ruby on Rails? Both have plugins and publicly available applications that make it very easy to get the generic parts out of the way quickly such as user management, administration panels, and debugging tools. I also recommend learning how to deploy an application to a production environment, your own server or a service such as Heroku, EC2, or the Google App Engine.&lt;/p&gt;

&lt;p&gt;If you already know another framework that you are comfortable with, go with it. Django and Ruby on Rails are merely suggestions if you are starting from scratch.&lt;/p&gt;

&lt;p&gt;To be even more prepared, setup a subversion repository on your computer or a server you own and setup a bare bones project ahead of time. When you form your team, you can immediately start iterating on the product.&lt;/p&gt;

&lt;h2 id=&quot;the-final-pitch&quot;&gt;The final pitch&lt;/h2&gt;

&lt;p&gt;If using a technical demo, have a backup plan as part of your slides. If the tech demo fails, you can quickly fall back to a walk through.&lt;/p&gt;

&lt;p&gt;You will want your pitch to answer these common questions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;What is the problem you are trying to solve?&lt;/li&gt;
  &lt;li&gt;What is it that your product provides that differentiates you from the competition.&lt;/li&gt;
  &lt;li&gt;How are you going to make money?&lt;/li&gt;
  &lt;li&gt;How are you going to acquire customers or users?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When responding to questions about your pitch, keep the answers short and on point, you don’t want to ramble. If you do not have an answer to a question, say so and take it as something you need to research. You only have three days, you cannot know everything about your product.&lt;/p&gt;

&lt;h2 id=&quot;closing&quot;&gt;Closing&lt;/h2&gt;

&lt;p&gt;Most importantly, have fun and meet people! 3DS brings together 40+ people who enjoy building products. So much so that they have given up their weekend to do it, just like you have. Even if your product does not make it out of the weekend, you now have some friends you can call for any future endeavors.&lt;/p&gt;

&lt;p&gt;To find out if there is a 3 day startup at your university or for more information about 3 day startup, visit the &lt;a href=&quot;http://3daystartup.org/&quot;&gt;3ds website&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The HTML5 DOM Element API: Dataset</title>
   <link href="http://www.davidtulig.com/posts/the-html5-dom-element-api-dataset"/>
   <updated>2011-10-18T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/posts/the-html5-dom-element-api-dataset</id>
   <content type="html">&lt;p&gt;Datasets are one of the new Element features added with the HTML5 spec. They allow you to add arbitrary attributes to DOM Elements that can be easily accessed and modified via JavaScript. These attributes are great for adding additional information for projects such as photo galleries that can use the attributes to enhance the display.&lt;/p&gt;

&lt;h2 id=&quot;using-data-attributes-on-elements&quot;&gt;Using data attributes on elements&lt;/h2&gt;

&lt;p&gt;Datasets are added to an element via element attributes. A dataset attribute is prefixed by &lt;code&gt;data-&lt;/code&gt; and followed by the name. For example, &lt;code&gt;data-author&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For this post, we are going to use a photo gallery as an example of when you might want to use datasets to add additional markup to your HTML. To start, let us create the first &lt;code&gt;div&lt;/code&gt; with attributes that define the author, location, and date of the photo. Here is the markup:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1294430.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;As you can see, the three items we want in the dataset are prefixed by &lt;code&gt;data-&lt;/code&gt; and are assigned a value the same way as any other HTML attribute.&lt;/p&gt;

&lt;h2 id=&quot;accessing-an-elementrsquos-dataset&quot;&gt;Accessing an element’s dataset&lt;/h2&gt;

&lt;p&gt;To access the dataset of an element, simply use the attribute &lt;code&gt;dataset&lt;/code&gt;. Here is a quick example.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1294438.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The &lt;code&gt;dataset&lt;/code&gt; attribute returns a &lt;a href=&quot;https://developer.mozilla.org/en/DOM/DOMStringMap&quot;&gt;DOMStringMap&lt;/a&gt;, a new datatype added for datasets. Note: hyphenated attribute names are turned into camel case for JavaScript access.&lt;/p&gt;

&lt;h2 id=&quot;modifying-and-removing-an-elementrsquos-dataset&quot;&gt;Modifying and removing an element’s dataset&lt;/h2&gt;

&lt;p&gt;Modifying an item in the dataset is very easy, just assign the property in the dataset a new value.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1294440.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Deleting is equally easy, just use the keyword &lt;code&gt;delete&lt;/code&gt; and specify the property of the dataset to delete.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1294441.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;using-data-attributes-with-css&quot;&gt;Using data attributes with CSS&lt;/h2&gt;

&lt;p&gt;Like other HTML Element attributes, dataset attributes can be used as part of CSS selectors. Adding a blue background to all divs with Dave as the author looks like the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1294516.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Datasets provide an easy way to associate little bits of meta data with your HTML tags and allows easy access from your JavaScript. For more intensive JavaScript applications you will still be better off using JavaScript objects to hold your state. However, for quick projects like a photo gallery, dataset attributes provide easy access to additional data for each element. As far as browser support, here is the &lt;a href=&quot;http://caniuse.com/#search=dataset&quot;&gt;caniuse&lt;/a&gt; page.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Introduction to Google Guava's Joiner class</title>
   <link href="http://www.davidtulig.com/posts/introduction-to-google-guava-s-joiner-class"/>
   <updated>2011-10-11T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/posts/introduction-to-google-guava-s-joiner-class</id>
   <content type="html">&lt;p&gt;The &lt;code&gt;Joiner&lt;/code&gt; class performs the complementary function of the &lt;code&gt;Splitter&lt;/code&gt; class. The &lt;code&gt;Joiner&lt;/code&gt; class will join an &lt;code&gt;Iterable&lt;/code&gt;, an array, or a variable argument list using a given separator in between them.&lt;/p&gt;

&lt;h2 id=&quot;starting-with-the-basics&quot;&gt;Starting with the basics&lt;/h2&gt;

&lt;p&gt;The basic usage of the &lt;code&gt;Joiner&lt;/code&gt; uses the &lt;code&gt;on&lt;/code&gt; function and then by calling &lt;code&gt;join&lt;/code&gt; with an array or &lt;code&gt;Iterator&lt;/code&gt; object. To demonstrate this, let us use a &lt;code&gt;Set&lt;/code&gt; of names to create a comma separated list.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1277164.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;dealing-with-nulls&quot;&gt;Dealing with nulls&lt;/h2&gt;

&lt;p&gt;Like the &lt;code&gt;Splitter&lt;/code&gt;, the &lt;code&gt;Joiner&lt;/code&gt; comes with a couple of utilities for dealing with &lt;code&gt;null&lt;/code&gt; in the input. The first is the &lt;code&gt;skipNulls&lt;/code&gt; function that will return a &lt;code&gt;Joiner&lt;/code&gt; which will automatically skip over any nulls it encounters when iterating over the elements. The second is the &lt;code&gt;useForNull&lt;/code&gt; function which will use the parameter it was given in place of nulls. Here are examples of using each one:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1277178.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;If you use both the &lt;code&gt;skipNulls&lt;/code&gt; and &lt;code&gt;useForNull&lt;/code&gt; on the same joiner, it will throw an &lt;code&gt;UnsupportedOperationException&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;using-the-codejoinercode-class-to-build-up-a-codestringbuildercode&quot;&gt;Using the &lt;code&gt;Joiner&lt;/code&gt; class to build up a &lt;code&gt;StringBuilder&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;In addition to joining a &lt;code&gt;String&lt;/code&gt; all at the same time, you can build it up instead using a &lt;code&gt;StringBuilder&lt;/code&gt;. The &lt;code&gt;appendTo&lt;/code&gt; function of the &lt;code&gt;Joiner&lt;/code&gt; takes the same arguments as the &lt;code&gt;join&lt;/code&gt; function: an Iterable, array, or argument list an will work for both &lt;code&gt;StringBuilders&lt;/code&gt; and any &lt;code&gt;Appendable&lt;/code&gt; object. One caveat of this function is that it will only add the separator between elements within each function call. Below is an example of using it with a &lt;code&gt;StringBuilder&lt;/code&gt;.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1277255.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;As you can see, the commas were only added in between elements in the same &lt;code&gt;appendTo&lt;/code&gt; call which is why &lt;code&gt;johndanmatt&lt;/code&gt; was not separated.&lt;/p&gt;

&lt;h2 id=&quot;using-the-mapjoiner-new-in-guava-100&quot;&gt;Using the MapJoiner (new in Guava 10.0)&lt;/h2&gt;

&lt;p&gt;A good example of using a &lt;code&gt;MapJoiner&lt;/code&gt; is to create a query string out of a &lt;code&gt;Map&lt;/code&gt; of query parameters. Let us use the following map:&lt;/p&gt;

&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;{&amp;quot;param&amp;quot;: &amp;quot;v&amp;quot;, &amp;quot;p2&amp;quot;: &amp;quot;v2&amp;quot;, &amp;quot;q&amp;quot;: &amp;quot;java&amp;quot;}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And the code:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1277093.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The &lt;code&gt;MapJoiner&lt;/code&gt; does not have utilities for trimming and cleaning up the strings, so that will have to be done while building the &lt;code&gt;Map&lt;/code&gt;. You can read the full documentation on the &lt;code&gt;Joiner&lt;/code&gt; class &lt;a href=&quot;http://docs.guava-libraries.googlecode.com/git-history/v10.0.1/javadoc/index.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;/blog/introduction-to-google-guavas-splitter-class&quot;&gt;View the previous post on Google Guava’s Splitter class&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Introduction to Google Guava's Splitter class</title>
   <link href="http://www.davidtulig.com/posts/introduction-to-google-guava-s-splitter-class"/>
   <updated>2011-10-08T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/posts/introduction-to-google-guava-s-splitter-class</id>
   <content type="html">&lt;p&gt;The &lt;code&gt;Splitter&lt;/code&gt; class takes a common, and what should not have to be verbose, exercise and makes it easy and readable. Let us start with a scenario, you have a list of key value pairs that you need to parse into a map. We are also going to assume the input could be malformed with empty entries and extra spaces. For the sake of this example, let us use names and user ids.&lt;/p&gt;

&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;&amp;quot;dave:123, john:314,, matt:989&amp;quot;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now, how this is typically handled:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1271799.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;This ends up being rather verbose and also error prone. We will see how the &lt;code&gt;Splitter&lt;/code&gt; class makes this much easier and readable.&lt;/p&gt;

&lt;h2 id=&quot;starting-with-the-basics&quot;&gt;Starting with the basics&lt;/h2&gt;

&lt;p&gt;The simplest example of the &lt;code&gt;Splitter&lt;/code&gt; is parsing a standard comma separated list.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1271773.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Pretty straightforward. In addition to a string separator, the &lt;code&gt;Splitter.on&lt;/code&gt; function can also use a &lt;code&gt;char&lt;/code&gt;, &lt;code&gt;CharSequence&lt;/code&gt;, or a &lt;code&gt;Pattern&lt;/code&gt;. The API provides a convenience method &lt;code&gt;Splitter.onPattern&lt;/code&gt; that will turn a &lt;code&gt;String&lt;/code&gt; into a java &lt;code&gt;Pattern&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;utilities-to-sanitize-the-input&quot;&gt;Utilities to sanitize the input&lt;/h2&gt;

&lt;p&gt;We saw in the initial scenario a poorly formatted string that required us to check for &lt;code&gt;null&lt;/code&gt; and trim at various points to clean up the input. The &lt;code&gt;Splitter&lt;/code&gt; class comes with the utility functions &lt;code&gt;omitEmptyStrings&lt;/code&gt; and &lt;code&gt;trimResults&lt;/code&gt; to take away some of that boilerplate code.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1271776.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Another benefit of using the utility functions to clean up the split string is readability. When someone is reading your code, it is much easier to understand what is happening when seeing &lt;code&gt;omitEmptyStrings&lt;/code&gt; and &lt;code&gt;trimResults&lt;/code&gt; versus checks for &lt;code&gt;null&lt;/code&gt;, checks for empty string, and various trim calls.&lt;/p&gt;

&lt;h2 id=&quot;using-the-mapsplitter-new-in-guava-100&quot;&gt;Using the MapSplitter (new in Guava 10.0)&lt;/h2&gt;

&lt;p&gt;The MapSplitter allows you to take a list of key value pairs and easily turn it into a Java Map. Well, that sounds great for solving our initial scenario, let us see it in action.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1271761.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;That looks much better. We removed the loop, the input was sanitized, we threw out any empty strings, and we broke up the separated values into key/value pairs. It also reads a lot better:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Split a string on comma, omit empty strings, trim those results, then use colon as a key value separator. With these rules, split &lt;code&gt;stringToSplit&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is much easier to read than our initial version. You can read the full documentation on the &lt;code&gt;Splitter&lt;/code&gt; class &lt;a href=&quot;http://docs.guava-libraries.googlecode.com/git-history/v10.0/javadoc/index.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>JavaScript Error Logging</title>
   <link href="http://www.davidtulig.com/posts/javascript-error-logging"/>
   <updated>2010-10-15T00:00:00+00:00</updated>
   <id>http://www.davidtulig.com/posts/javascript-error-logging</id>
   <content type="html">&lt;p&gt;A useful technique that I have been using to help keep track of JavaScript errors has been to use the &lt;code&gt;OnError&lt;/code&gt; event to help log client side errors that slip through the testing process. In addition to the properties that come with the JavaScript exception (the error message, the url of the script, and the line number) I log the url of the page that they were on when the problem occurred which makes reproducing the situation much easier. Another nice little benefit of catching errors through my own callback is being able to suppress the error message from the user, in some browsers this can be as invasive as a popup (IE). On to some code.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/621590.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The code should be fairly straightforward. The &lt;code&gt;OnError&lt;/code&gt; event is assigned my own error handler. Whenever a JavaScript error occurs a request is sent to &lt;code&gt;/rpc/client-error-log&lt;/code&gt; with the details of the problem. The &lt;code&gt;return true&lt;/code&gt; at the end of &lt;code&gt;errorHandler&lt;/code&gt; suppresses the error message from the user. On the server side, I log the error that occurred. Every morning I send myself an email with all the error messages for the past 24 hours. A fair number of them are problems that I cannot, or have not, figured out how to fix such as “Error loading script”. Although when I occasionally introduce a bug into the wild, this gives me all the information I need to reproduce and fix it (usually).&lt;/p&gt;
</content>
 </entry>
 

</feed>
