Hackathon 2012Casual dress code

Happy Diwali

Shri Jambhekar

Diwali Celebration at YP

In honor of our rich cultural diversity, and our 'Educate and Celebrate' initiative, Glendale YP team celebrated Diwali after an all hands yesterday.

The culture club committee and facilities decorated the happy hour areas with traditional Diwali decor and provided sweets - creating a beautiful celebration of this most auspicious of Hindu festivals which is celebrated over 5 days.

In addition, the team on 13th floor shared delicious Indian food today.

Diwali also known as Deepavali and the "festival of lights", is an ancient Hindu festival celebrated in autumn every year. The festival spiritually signifies the victory of light over darkness, knowledge over ignorance, good over evil, and hope over despair.

Happy Diwali to you and your families.

दीवाली की शुभकामनाएं

Generating SVG on the Fly


When developing a webapp, a great way to enhance the visual design of your site is to use beautiful, intuitive icons. Sometimes people understand images a great deal more than words. Icons take up much less space as well, giving your site a cleaner look.

With the advent of retina-resolution screens, older lower-resolution icons just don't cut it. One solution is to simply start serving higher-resolution icons. This approach causes unnecessary network load for screens that don't need the extra pixels. You can use retina.js to load higher resolution icons only when they're needed, but this requires creating multiple image files.

SVG icons provide the flexibility to display correctly on all screen densities, although you sacrifice file size, as SVG files are generally larger than PNG. The big benefit SVG provides is easy modification. Modify one field in the XML and you've changed the bakground color, for example. So when you want to dynamically generate icons, using SVG makes sense.

In my intern project I had to do just this; I needed to generate map markers with letters inside to represent waypoints. There are a few ways to generate SVG on the fly. One is by using a library like svg.js, which allows you to programmatically create SVG with a very easy-to-understand API. The other is the method I used:

Manually create an SVG image using an editor such as Inkscape. This will give you an SVG file that looks something like this:

         d="m 437,360.36218 c 0,82.29043 -66.70957,149 -149,149 -82.29043,0 -149,-66.70957 -149,-149 0,-53.23257 28.39924,-102.4215 74.5,-129.03778"
         style="fill:#ffdd00;stroke:#000000;stroke-width:10" />
         d="M 388.62072,403.36218 324.00914,514.28781 259.39756,625.21343 194.65584,514.36218 129.91412,403.51093"
         style="fill:#ffdd00;stroke:#000000;stroke-width:10;" />

Now you can edit this any way you want! For example, using a framework like Ractive.js or Angular.js, you can replace the "A" in the text node with "{{text}}" and use your framework's method of populating templates.

Another method is to use Jade templates to serve your SVG icons from a node.js endpoint. To create a Jade template from your SVG XML, modify the root node to use Jade's "Block in a Tag" feature. Your root node should look similar to:


The rest of your XML file can be copied in. Then replace whatever you'd like to change on the fly with Jade's method of inserting content:


To serve this SVG over a node.js endpoint, create a route (here using express) that sets the Content-Type to "image/svg+xml" and passes a text parameter to your Jade template:

app.get('/marker', function (req, res) {

    res.render('path/to/templateFile', {
        text: req.query.text

And here is the result:


YP Intern Hackathon 2014 Followup


I am sorry to report that we failed in our mission to eat all the food in the breakroom, though not for lack of trying. Part of the problem was that delicious food kept being brought in for us even before we could finish the last meal. While we ate everything from sandwiches to pizza to a spread that couldn't decide if it wanted to be Mediterranean or Indian, the greens went largely untouched. Who knew interns don't eat salad?

Despite our best efforts to focus on eating and playing ping-pong, however, my team (myself, Joe, Jaspreet, Kate, and Kwun; code-named GUARDIANS), managed to produce FoodDeck, an idea I had just the morning before the hackathon best summarized in the cliché formula as "like Tinder but for food."

We didn't actually get much done while at YP until at the last moment Kate saved the day by fixing an issue in less than an hour that had blocked seniors Joe and me for nearly two days. After a weekend's worth of hard work, the final app we created actually had a pretty sexy UI (if I may say so myself), and reverse-engineered the YP Android app's API call to pull data directly from YP's servers — all from a team that only had one actual Android developer intern to start.


Our "competing" team (David, Jordi, and Shrinidi; code-named AVENGERS), worked on Sage, which uses predictive regression modeling (insert other fancy words here) to correlate advertisting expenditures with potential click-through results. It sounded like it would be very useful for YP sales representatives, who can better communicate to clients what YP is able to do for them.

I am happy to say that my team's FoodDeck was pronounced the "winner" of the hackathon, though Sage seemed like it would benefit YP more (or at least much more quickly). Of course, we did have Kwun, our project manager intern who put together an awesome deck and pitch. I do have high hopes that both applications can be put into actual production, especially given our new Consumer Platforms SVP Paul Ryan's emphasis on having more than just a single core app.

Following our presentations and a giant lunch of wings, most of us headed out into the middle of nowhere to settle our differences with paintballs. I came home sore and even bloodied, though what hurt (both physically and mentally) the most was being friendly-fired by a teammate at point-blank range. Maybe removing Kate's cat pictures from the app wasn't such a good idea... :3

image From left to right: Jordi, Jaspreet, Kate, myself, Joe, David, Aaplavi, Shrinidi

What a 16th Century Samurai Teaches Us About VOICE - Part Two

Jeff Leeson

This is the second post in a series on the VOICE principles and the philosophy of Miyamoto Musashi as written in The Book of Five Rings. The translation of The Book of Five Rings used here was sourced from WikiQuote.

You can start from the beginning of the series here.

We at YP practice the VOICE principles (Velocity, Ownership, Innovation, Collaboration, and Execution), striving to embody each of them in order to become more effective at not only our jobs, but in our personal lives.

In the 16th century, a Japanese Ronin (a lord-less samurai) named Miyamoto Musashi wrote The Book of Five Rings. In it Musashi describes his philosophy, called “The Way” of sword fighting, which is still studied today and can be applied across any discipline.

This series explains how the sword fighting principles of The Way can be generalized to each VOICE principle, leading you to becoming more productive in your life. In the previous entry, I wrote about how we can apply Musashi’s teachings to the principle of Velocity. In today’s post, I’ll be covering Ownership.


The term Ownership is commonly used in reference to property, and many dictionaries define it in such terms. But ownership has a secondary definition that is often used in business, meaning to take responsibility for an issue or problem. It’s this type of ownership, one of taking personal responsibility, which we embrace as a principle and strive to achieve in our work and our lives.

We take ownership because we strive to deliver simple and robust code, we want to fix each customers’ problem and ensure they have the best experience possible. We demand quality in our personal consumption of services and products, and so should we deliver superior quality, through ownership, in our work and personal lives.

Here is what Musashi says about Ownership:

If you merely read this book you will not reach the Way of strategy. Absorb the things written in this book. Do not just read, memorise or imitate, but so that you realise the principle from within your own heart study hard to absorb these things into your body.

Ownership begins with understanding and internalizing. In other words, you must own ownership. You must understand its value and demonstrate it in your actions. If you simply perform the actions of ownership, going through the motions, the result will be significantly less successful. Only by committing yourself to the application of ownership will you be rewarded fully by its value.

The Three Methods to Forestall the Enemy

The first is to forestall him by attacking. This is called Ken No Sen (to set him up).

Another method is to forestall him as he attacks. This is called Tai No Sen (to wait for the initiative).

The other method is when you and the enemy attack together. This is called Tai Tai No Sen (to accompany him and forestall him).

There are no methods of taking the lead other than these three. Because you can win quickly by taking the lead, it is one of the most important things in strategy. There are several things involved in taking the lead. You must make the best of the situation, see through the enemy's spirit so that you grasp his strategy and defeat him.

The Three Methods to Forestall the Enemy are the fundamental ways one attacks something one owns. When you develop your strategy for approaching a given problem, your attack, or leadership, will initiate by you attacking first, allowing the problem to attack you first, or both you and the problem attacking simultaneously. In every case, velocity, or swift decisiveness, is necessary.

The strategy of going on the offensive first is the equivalent of a frontal assault on a problem, and the most common approach in applying ownership. Whether a technical problem to solve, or an opponent with whom you are arguing, attacking first is a practical approach to many situations. You identify the problem, evaluate the scope, analyze weaknesses, plan your attack, and then execute the plan.

The strategy of letting your opponent, or problem, attack first can sound counter-intuitive to ownership, but it has its uses. For example, in an argument your opponent may attack and you let yourself appear weak, or stay silent, but when the timing is right, you seize on a weakness, countering strongly to gain the upper hand. Being the owner, being responsible, means utilizing the ebb and flow of a problem or conversation, and sometimes the most practical strategy is to let the problem, or opponent, attack first.

Finally, the strategy of attacking simultaneously is when the onset of a problem occurs quickly and without warning, requiring a calm yet strong response. While some problems gain momentum over time, others come on quickly, requiring an equally rapid response. You must always be prepared to take responsibility and ownership of an issue, so you can respond swiftly yet forcefully, powerfully yet with steady determination.

"To tread down the sword" is a principle often used in strategy. First, in large-scale strategy, when the enemy first discharges bows and guns and then attacks, it is difficult for us to attack if we are busy loading powder into our guns or notching our arrows. The spirit is to attack quickly while the enemy is still shooting with bows or guns. The spirit is to win by "treading down" as we receive the enemy's attack.

In single combat, we cannot get a decisive victory by cutting, with a "tee-dum tee-dum" feeling, in the wake of the enemy's attacking long sword. We must defeat him at the start of his attack, in the spirit of treading him down with the feet, so that he cannot rise again to the attack.

"Treading" does not simply mean treading with the feet. Tread with the body, tread with the spirit, and, of course, tread and cut with the long sword. You must achieve the spirit of not allowing the enemy to attack a second time. This is the spirit of forestalling in every sense. Once at the enemy, you should not aspire just to strike him, but to cling after the attack.

To tread down the sword is a strategy that encompasses velocity, ownership, and execution. When an issue arises, you must possess the constitution to take responsibility, do what is necessary with speed and authority, and consistently follow through to completion. You must be quick in your response, taking away the ability for the problem, or opponent, to counter. The deliberateness of your actions in owning a problem, in making it your focus, your obsession, will guarantee your success.

Everything can collapse. Houses, bodies, and enemies collapse when their rhythm becomes deranged.

In large-scale strategy, when the enemy starts to collapse you must pursue him without letting the chance go. If you fail to take advantage of your enemies' collapse, they may recover.

Ownership is closely tied to execution, and consequently to perseverance. When you own a task or problem, you must be consistent in your perseverance of accomplishing or conquering that thing. Once you own something, don’t relax when you believe the problem is on the path to being solved. Follow it through to completion. Problems can reoccur and arguments can be regurgitated if your ownership wavers, so persist in dominating them to the end.

When your opponent is hurrying recklessly, you must act contrarily and keep calm. You must not be influenced by the opponent. Train diligently to attain this spirit.

As ownership is a function of leadership, when we own an issue, we must not be led by others, particularly the problem or the opponent. If you allow yourself to be influenced by your opponent, becoming frantic or panicked, the problem or opponent has begun to lead you. When your opponent is frenzied, you must fight the urge to be reactionary and stay calm and relaxed in response. This mindset will allow you to think clearly when others do not. It will frustrate your opponents and reassure your team and your allies, demonstrating your ability to lead under stress.


Now that you’ve read how The Way applies to ownership, you need to start taking ownership in new ways, and of things you haven’t before. Begin by applying ownership (decisiveness, obsession, and persistence) to your daily life. Force yourself each day to identify at least one problem, whether it’s within your line of service or not, and own that problem through to its ultimate demise.

Next in the series, we’ll read what Miyamoto Musashi writes about innovation.

YP Intern Hackathon 2014


As the first ever YP intern class, we feel it is our duty to at least attempt to be the last ever YP intern class by eating all the food in the breakroom. To this end, we are proud to annouce that we are holding what will hopefully be the first of many YP Intern Hackathons!

This will be a two-day affair lasting all of Thursday and Friday, August 7-8, from 10am to 5pm in the Glendale 5th Floor Breakroom. All YP employees are welcome to stop by and cheer us on, or even sit and code with us for a little while. We also still haven't settled what we'll be hacking, so if you have any ideas, please drop a comment or let one of the interns know, and we'll see if we can run with it.

Hope to see you there!

YP Intern Hackathon 2014

Thursday, August 07 - Friday, August 08
10am - 5pm
Glendale 5th Floor Breakroom

A special shoutout to Melissa, Rico, Nathan, and Justin for helping us figure out planning and logistics!

Tox - free, secure, distributed, peer to peer Skype replacement


I just discovered Tox. It's a secure, open-source Skype replacement - https://tox.im.

The protocol is decentralized and peer to peer. Each person in the network has a public and private key. The NaCl crypto library is used to do all of the encryption.

There are clients for Mac, Windows, Linux and Android and even a text-based one. Not all of them have video chat (yet) but it's getting there. And if you decide to try it, my user is oren@toxme.se


So you want to Load Balance your Application?


Simple Load Balancing in the Cloud

So you fixed your tricky concurrency issues, handled your null pointer exceptions, and ironed out the rest of the kinks in your application, what now? Cloud deployment!

For a web application I developed during my internship at YP, my team turned to Digital Ocean for a cloud hosting deployment solution. After spinning up some DigitalOcean virtual machines (called 'droplets') with a custom Tomcat-ready image, we used Digital Ocean's API within a Java Servlet to not only forward requests to droplets hosting our application in round-robin fashion as a conventional load balancer such as nginx might, but also for droplet management. The API allowed us to make simple calls to spin up new droplets in real time to meet high load requirements, as well as troubleshoot errant droplets and decommission them if necessary--all through the simple API.

If you're looking to host your own application in the cloud, the following is a small snippet of the code we used for the simple round-robin style load balancing, let me walk you through it!

public class Balancer extends HttpServlet {
    private static volatile ServerManager servers = new ServerManager();

    public Balancer(){

    public void doGet(HttpServletRequest req, HttpServletResponse res) 
        throws ServletException, IOException {
        String endpoint = req.getPathInfo();
        try {
        } catch (IOException e) {
            try {
            } catch (IOException e1) {

Looking at this code, we see that this Balancer class extends the abstract HttpServlet class and overrides the doGet method which handles the 'get' requests sent to the loadbalancing application. The custom ServerManager class variable is what allows us to access our droplets, and is where our calls to the Digital Ocean API reside.

Looking at the doGet method, we first extract whichever endpoint was requested by our application's lucky user. Then, we make sure to populate the ServerManager object with currently active droplets, using the droplets endpoint of the Digital Ocean API.

We can now construct a call to a specific droplet hosting our 'Clairvoyant' application. We accomplish this by calling the getServer() method of the ServerManager which incrementally iterates through the droplets found earlier in modulo fashion, and combining this server address with the endpoint and parameters requested by the user earlier.

Finally, we redirect the request to this API call which frees up resources in our Load Balancing servlet to handle other new requests while a particular droplet in the cloud can handle the user's specific request. By revolving requests in round robin fashion, we spread requests evenly across all droplets we have provisioned and ensure OPTIMAL UPTIME and HAPPY USERS.

I hope this guide shed some light on one way to achieve simple load balancing for your application, thank you for reading, happy coding!

What Does Culture Have To Do With It?

Jordi Diaz

More Than We Think

Is culture just a last name, family tradition, or second language? Or can it be more? Why and what should an intern learn about culture?

As an Intern for YP, I have come to learn that culture is not just about where we come from, but also where we would like to go. Before starting at YP, I had not given much thought to the importance of the culture a company fosters. Or realized the impact it has on the quality of not only its products but also on the quality of the effort that goes into them. Which qualities are important to your work?

Culture Points

Firstly, the big one: Communication. It is at the top of the list, of important cultural qualities, because this is what will allow you to grow. Being able to talk to your superior about where you would like to go with a project, or department or even career path is an irreplaceable quality. Being heard and acknowledged keeps us motivated and happy. This something that YP emphasizes and strives at. Everyone is open to talk about whatever is on your mind.

Secondly, Atmosphere. What kind of atmosphere are you most productive in? Knowing what work environment you are comfortable in and lets you explore creatively is an important factor to the quality of your work. Being an Intern for YP and seeing first hand has allowed me to understand that how we work is part of where we work. A relaxed working atmosphere where people wear shorts and sandals may help you be productive but may not be ideal for everyone.

Lastly, Drive. No I do not mean the getaway driver flick with Ryan Gosling. I mean motivation and ambition. I use to believe that as long as I knew how to code that I could work on anything sufficiently well. Unfortunately, having seen the experience friends have had at their internships and comparing them to mine I can see a pattern. If you are not driven to complete your project and excited about its functionality, you may not have the gusto to see it through with out burning out.

So, before you turn in that internship application make sure to check not just the pay, or the project but whether or not the existing employees like working there through GlassDoor or similar services. If it all seems to jive with who you are and they look like the employees below go ahead and click submit.

YP PDS Team image

What Does An Internship Give You?


As a YP Intern, I'm working hard. They've given me a significant amount to do and I'm having a blast doing it. But why am I doing the work? Why am I doing this internship and what am I getting out of it?

First, the obvious one: you do it for experience. But not for the experience of coding using a specific language or framework. If you've coded before, you can learn a new language or framework with a few days of immersion. Rather, the job teaches you about everything else - how to talk to and coordinate with your coworkers, how to manage upwards, and the best way to get to work in the morning. You learn more about yourself and what you want to do for a living. Sometimes you find out that you belong in that line of work and sometimes you learn that you'd rather be anywhere else, doing anything else. Both are ok - that's what internships are for.

Manage Your Career

An internship also teaches you how to manage your career. It is especially helpful if it is arranged for you to hear from Bill Theisinger, the VP of Platform Data Services here at YP. You'll hear him say things like "always counter" and "take risks" that you may have heard before, but never resonated with you quite the same way. You understand that when you're young, you have the opportunity to take risks that you'll never have again. If you're 22 and you take a big risk and fail, you pick yourself back up, live somewhere cheap and sketchy for a while, and find another path. If you're 43 and you fail, your family is affected. You have others to think about. So take risks early.

Another thing you learn from Bill is that if you're not getting what you deserve, it's your own fault. It's your responsibility to get out there and find a place that will give you what you deserve.

So remember, do internships. Be active - do a presentation or two! Take some risks. If you succeed, you get to be in charge.