<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ben Roesch&#039;s Blog</title>
	<atom:link href="http://benroesch.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://benroesch.com</link>
	<description>Tech, Travel, and Life</description>
	<lastBuildDate>Thu, 16 Jan 2014 01:29:50 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.2</generator>
	<item>
		<title>Ben &amp; Pam’s Middle Eastern Adventure – Israel</title>
		<link>http://benroesch.com/2014/01/15/ben-pams-middle-eastern-adventure-israel/</link>
		<comments>http://benroesch.com/2014/01/15/ben-pams-middle-eastern-adventure-israel/#comments</comments>
		<pubDate>Thu, 16 Jan 2014 01:29:50 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Middle East]]></category>
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=915</guid>
		<description><![CDATA[We left Doha on Wednesday afternoon to fly to Israel. Since most countries in the region have no diplomatic relations <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2014/01/15/ben-pams-middle-eastern-adventure-israel/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>We left Doha on Wednesday afternoon to fly to Israel. Since most countries in the region have no diplomatic relations with Israel, we had to fly through Amman, Jordan. Prior to the trip, we were somewhat apprehensive about going through immigration in Israel, especially with stamps in our passport from the gulf countries, but thankfully we had no issues at all. We arrived in Tel Aviv fairly late, so we took a cab to our hotel and called it a night.</p>
<p>The next morning, we walked all through Tel Aviv. We started by walking down the pedestrian path on the waterfront to Jaffa, which houses the old part of town. This area is also supposedly the location where Jonah was prior to being swallowed by a large fish. We wandered through a flea market and then back up through town. We walked through a large outdoor market that sold food, spices, and clothing that Pam loved, and then made our way north toward the Tel Aviv port. We had lunch at a restaurant on the beach, and then meandered a bit more and back toward our hotel. From there, we grabbed our bags and headed to the bus station to catch the bus to Jerusalem.</p>
<p>We arrived in Jerusalem in the late afternoon and decided to walk down to the Old City. The walls that surround the Old City were amazing and impressive. Inside, the Old City is also a sight to behold &#8212; I&#8217;ve never experienced a city like it. The buildings are very close together and at times you&#8217;re wandering through tunnels. The &#8220;roads&#8221; are really just paths/steps that also have small ramps for pushing wheeled carts up and down. This description absolutely does not do it justice, and it&#8217;s very hard to describe. European cities frequently felt old to me, but this place felt more like a different time and place, if not a different world.</p>
<div id="attachment_928" style="width: 310px" class="wp-caption aligncenter"><a href="http://benroesch.com/wp-content/uploads/2014/01/old-city-walls.jpg"><img class="size-medium wp-image-928" alt="Walls of the Old City" src="http://benroesch.com/wp-content/uploads/2014/01/old-city-walls-300x200.jpg" width="300" height="200" /></a><p class="wp-caption-text">Walls of the Old City</p></div>
<div id="attachment_929" style="width: 210px" class="wp-caption aligncenter"><a href="http://benroesch.com/wp-content/uploads/2014/01/old-city.jpg"><img class="size-medium wp-image-929" alt="Inside the Old City" src="http://benroesch.com/wp-content/uploads/2014/01/old-city-200x300.jpg" width="200" height="300" /></a><p class="wp-caption-text">Inside the Old City</p></div>
<p>Eventually, we ended up at the <a href="http://en.wikipedia.org/wiki/Western_Wall">Western Wall</a>. For anyone who doesn&#8217;t know, the Wall is the last remaining part of the temple built in Jerusalem by Solomon and expanded by Herod. The temple is considered the last known location of the Ark of the Covenant (which held the tablets with the 10 commandments). It is considered one of the holiest places on earth and you can find many people there praying. For someone who considers most of the Bible as less than factual, it was cool to see a piece of still existing history that is a part of many biblical stories. After seeing the wall, we grabbed street food for dinner and then headed back to the hotel.</p>
<p>The next morning, we had a not-so-bright and early wakeup at 3:30am for a sunrise tour of <a href="http://en.wikipedia.org/wiki/Masada">Masada</a>. Masada is a mountaintop fortress that also dates back to the time of Herod and is famous as the location of the last stand of Jewish zealots who were fighting the Romans before ultimately committing mass suicide. We hiked the mountain for what is supposedly an incredible sunrise view over the Dead Sea, but the day was cloudy and we saw no sun. Despite missing the sunrise, the ruins on the top of the mountain were awesome to see and well worth the hike on their own.</p>
<p>Next stop on the tour was Ein Gedi, a desert oasis that contains a number of waterfalls. It is known as the place where David went to hide from King Saul. We did some more hiking there and had a light lunch before hopping back into the tour van to head to the Dead Sea. At the Dead Sea, it was only about 60 degrees, but we decided to brave it and get into the water anyway. Due to the high salinity of the water in the Dead Sea, you naturally and effortlessly float. The mud on the bottom is also supposedly very good for your skin, so everyone rubs the mud all over their body. Overall, it was very cool to experience and the water turned out to not be all that cold.</p>
<p>We hopped back on the tour bus and headed back to Jerusalem. The route back took us through part of the West Bank, which surprised me a bit, but we learned that parts of the West Bank are openly accessible to Israelis. After a quick pit stop at the hotel, we headed back down to the Old City. Once there, we headed to the Church of the Holy Sepulchre, which is revered (but disputed) as the location of the crucifixion and burial of Jesus. The church was beautiful and rivaled almost any church or cathedral that I&#8217;ve been to, save St. Peter&#8217;s.</p>
<p>While we had seen the West Wall on the previous day, we had not yet seen the <a href="http://en.wikipedia.org/wiki/Dome_of_the_Rock">Dome of the Rock</a> or the <a href="http://en.wikipedia.org/wiki/Al-Aqsa_Mosque">Al Aqsa</a> mosque. I was upset to find that the Temple Mount (the area above the West Wall, where the actual Temple existed and where the Dome of the Rock and the Al Aqsa mosque are today) is closed to tourists on Fridays and Saturdays. Despite this, Pam and I were able to wander a bit into what may have been private residential property, but we got some great views that overlooked the Wall, the Dome, and the Mosque.</p>
<div id="attachment_932" style="width: 310px" class="wp-caption aligncenter"><a href="http://benroesch.com/wp-content/uploads/2014/01/wall.jpg"><img class="size-medium wp-image-932" alt="The Dome of the Rock, The Western Wall, and Al Aqsa" src="http://benroesch.com/wp-content/uploads/2014/01/wall-300x200.jpg" width="300" height="200" /></a><p class="wp-caption-text">The Dome of the Rock, The Western Wall, and Al Aqsa</p></div>
<p>Finally, we headed back toward the hotel one last time, where we found that the streets had been abandoned and the shops &amp; restaurants closed up for Sabbath. While I was disappointed that our timing prevented us from visiting the Temple Mount, it was cool to see Jerusalem during the Sabbath. When we walked into the Old City, the rest of Jerusalem was still bustling and busy. When we walked out, it was a ghost town. Pretty cool to see.</p>
<p>With that, we started our long journey home. My last major takeaway from the trip is that despite differences and complexities, most people are ultimately the same, just trying to have a decent life and to provide a better one to their children. Our media talks so much about the conflicts between people in the Middle East, but we noticed so many similarities in the people we met &#8212; pretty much all good ones. You can find rude people in every country in the world, and you can find friendly ones too. Lumping people together because they happen to live in a particular country or follow a particular religion is not only worthless, it&#8217;s probably irresponsible too. It&#8217;s hard to remember that in day to day encounters, but trying to do so seems like an unequivocally good thing to do.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2014/01/15/ben-pams-middle-eastern-adventure-israel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ben &amp; Pam’s Middle Eastern Adventure – Doha, Qatar</title>
		<link>http://benroesch.com/2014/01/11/ben-pams-middle-eastern-adventure-doha-qatar/</link>
		<comments>http://benroesch.com/2014/01/11/ben-pams-middle-eastern-adventure-doha-qatar/#comments</comments>
		<pubDate>Sat, 11 Jan 2014 18:45:55 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Middle East]]></category>
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=912</guid>
		<description><![CDATA[We arrived in Doha on Saturday, January 4. We were met at the airport by some of Lara&#8217;s extended family <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2014/01/11/ben-pams-middle-eastern-adventure-doha-qatar/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>We arrived in Doha on Saturday, January 4. We were met at the airport by some of Lara&#8217;s extended family and went directly to her aunt and uncle&#8217;s house where they had prepared a welcome meal for us. After stuffing ourselves at dinner, we relaxed at the house for a while before heading to our hotel to turn in early, given that we only had about 16 hours of sleep over the previous 4 days.</p>
<p>The next morning we headed to Souk Waqif, a traditional marketplace that sold clothes, spices, and souvenirs. We wandered around the Souk for a while and bought a hookah to bring home with us. After the Souk, we headed to the W hotel for lunch with Sean and Lara. After lunch, they went to the airport to pick up Sean&#8217;s brother, Eric, while Pam and I stopped at yet another mall to pick up a local sim card for our phone (travel pro-tip: if you have an old, off-contract phone, carriers will unlock it for you and you can take it to other countries and buy a pre-paid sim card to get internet access). A bit later, they picked us up again and we headed to Katara, a cultural village area, where we had Lebanese food for dinner. We closed out the night with a couple of drinks at Trader Vics.</p>
<p>The next morning, Sean, Eric and I went to play golf at the Doha Golf Club, where they were preparing for an upcoming PGA tour event. The course was extremely nice, and I hit the ball like I hadn&#8217;t played golf in 6 months (I hadn&#8217;t). While we golfed, Pam and Lara went for massages. That night, we had an early dinner (or lunch, as the locals call it) at an Indian restaurant and then went to a hookah bar to smoke shisha (flavored tobacco). Lastly, Lara&#8217;s cousin Dana took us to the local waterfront hangout, which looked a little (read: very) ghetto, for karak, a sweet, milky tea.</p>
<p>The next day we spent out in the desert, where we rode camels and had a guide drive us through the dunes in his 4&#215;4. He took us on some wild rides up and down the dunes. He called it the &#8220;safe&#8221; version of the tour, but I think that Pam still lost a few years off of her life. We had planned to ride ATV&#8217;s as well, but we called that off due to heavy winds. We made a couple stops on the tour, including one with a view over the border into Saudi Arabia. This video gives you a decent idea of the ride: <iframe src="http://www.youtube.com/embed/ZdgOSbi03ek" height="315" width="560" allowfullscreen="" frameborder="0"></iframe></p>
<p>After the desert, we were again treated to dinner at Lara&#8217;s aunt and uncle&#8217;s house, where we had a traditional Qatari meal of chicken and rice. Apparently Qatari food has a lot of Indian influences. After dinner, we went back to the Souk.  Pam had planned to buy one of the decorative plates there, but eventually decided against it. However, a bit later we discovered that Lara&#8217;s cousin Dana had gotten it for us as a gift, once again overwhelming us with the amount of generosity and hospitality that we encountered during the trip. We had a night cap at the Four Seasons (all the bars in the country are in foreign hotels, since normal restaurants are not allowed to serve alcohol) before turning in for the night.</p>
<p>The next morning was our last in Doha. We started with a quick boat ride on a dhow for some great views of the city skyline. We then visited the Pearl, a manmade island development, before heading to the airport to catch our flight to Israel.</p>
<p>&nbsp;</p>
<div id="attachment_924" style="width: 310px" class="wp-caption aligncenter"><a href="http://benroesch.com/wp-content/uploads/2014/01/dunes.png"><img class="size-medium wp-image-924" alt="At the Dunes, Saudi Arabia in the background" src="http://benroesch.com/wp-content/uploads/2014/01/dunes-300x197.png" width="300" height="197" /></a><p class="wp-caption-text">At the Dunes, Saudi Arabia in the background</p></div>
<div id="attachment_925" style="width: 310px" class="wp-caption aligncenter"><a href="http://benroesch.com/wp-content/uploads/2014/01/doha.png"><img class="size-medium wp-image-925" alt="Doha Skyline" src="http://benroesch.com/wp-content/uploads/2014/01/doha-300x192.png" width="300" height="192" /></a><p class="wp-caption-text">Doha Skyline</p></div>
<p>Over the course of this trip, the thing I&#8217;ve enjoyed most is talking to people and hearing their opinions and perspectives on various issues. We&#8217;ve talked a good amount about American involvement in the Middle East, the various conflicts in the area, and the general direction of countries in the region. One major thing that struck me is the inherent bias that our expectations seem to have toward maintenance of the status quo. I&#8217;m not sure why yet, but we all seem to have an inherent naiveté regarding the potential for (or even inevitability of) change. For example, 15-20 years ago, people in America would probably have had a hard time imagining the legalization of gay marriage, at least on any sort of reasonably short time horizon. Now, states are (thankfully) doing just that. Same story with marijuana legalization. I feel like we&#8217;ve run into a lot of similar issues on the trip. No one seems to expect legalization of alcohol in normal restaurants any time soon, but alcohol consumption has already come to the foreign hotel chains and Qatar is creating specialized zones where alcohol is allowed for the World Cup. Is that part of an inevitable march towards relaxing of other restrictions? I&#8217;m not sure, and the presence of theistic governments makes it difficult to predict, but it will be an interesting trajectory to watch.</p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2014/01/11/ben-pams-middle-eastern-adventure-doha-qatar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ben &amp; Pam&#8217;s Middle Eastern Adventure &#8211; Dubai</title>
		<link>http://benroesch.com/2014/01/08/ben-pams-middle-eastern-adventure-dubai/</link>
		<comments>http://benroesch.com/2014/01/08/ben-pams-middle-eastern-adventure-dubai/#comments</comments>
		<pubDate>Wed, 08 Jan 2014 11:04:13 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=901</guid>
		<description><![CDATA[Project Escape Chicago Winter, Part 2 is officially underway. Pam and I started the tradition last year with our February <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2014/01/08/ben-pams-middle-eastern-adventure-dubai/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>Project Escape Chicago Winter, Part 2 is officially underway. Pam and I started the tradition last year with our February trip to New Zealand, and are continuing it in 2014 with a trip to the Middle East. Timing couldn&#8217;t be better, given the massive dump of snow and sub-zero temperatures in Chicago right now. We started the trip in Cincinnati after a New Years Eve wedding. We were up by 7am on New Years day and headed back to Chicago. We were home just long enough to pack and then headed to the airport to meet two of our friends, Sean and Lara, at O&#8217;hare. Sean and Lara got married this past August and Lara grew up in Qatar, so when we heard they were planning this trip, we jumped at the opportunity to join them. We spent the first two hours of the trip sitting in the plane while the ground crew had some issue loading cargo. Eventually we got underway and had a relatively uneventful flight to Amsterdam. In Amsterdam, we were told that we were going to miss our connection to Doha and that we should go to the counter to re-book. We decided to ignore the warning and ended up sprinting through the Amsterdam airport and making our flight, though our bags ended up not making it onto our plane. After making it to Doha, we had another delay for our flight to Dubai and ended up not making to Dubai and bed until about 3:45am.</p>
<p>&nbsp;</p>
<p>Our first day in Dubai started with an awesome hotel breakfast (including bacon &#8212; I couldn&#8217;t believe they had it) and walk around the Dubai marina. Everything in Dubai feels (and is) brand new. It is unbelievable how many skyscrapers have been built in the last couple decades. This image gives a decent feel for it:</p>
<p style="text-align: center;"><a href="http://benroesch.com/wp-content/uploads/2014/01/dubai.jpg"><img class="aligncenter" alt="Dubai" src="http://benroesch.com/wp-content/uploads/2014/01/dubai-300x250.jpg" width="300" height="250" /></a></p>
<p>After walking around the marina, we went to one of Dubai&#8217;s famous malls to pick up some essentials, since our bags were still in Amsterdam. The mall felt extremely familiar, even more so than other foreign malls in westernized countries. A huge percentage of the stores are American or western chains &amp; brands. If the signs didn&#8217;t also contain Arabic, you could easily convince me I was in an American mall.</p>
<p>&nbsp;</p>
<p>One of Lara&#8217;s childhood friends, Jamil, picked us up from the mall and we drove onto and around <a href="http://en.wikipedia.org/wiki/Palm_Islands">The Palm</a> (a manmade island off the coast of Dubai). After that, we went to The Dubai Mall (one of the largest malls in the world) to pick up our tickets to the Burj Khalifa for the next day, and then ate a late lunch. Once again, I was surprised by the number of American/western chains. We agreed to get a more authentic Middle Eastern meal, but almost had to go in search of a non-western chain. Texas Roadhouse, PF Changs, Red Lobster, just to name a few.  We ended up at a Lebanese restaurant near the base of the Burj Khalifa. After, we argued for a solid 5-10 minutes over who would be paying for it, which is apparently commonplace in the Arab world. I&#8217;ve never encountered a group of people who feel so strongly about their hospitality and treating their guests. We then watched a fountain/water show similar to, but larger than, that of the Bellagio. After a pit stop at the hotel, we went to the <a href="http://en.wikipedia.org/wiki/Burj_Al_Arab">Burj Al Arab</a> for drinks.The Burj Al Arab bills itself as the only 7 star hotel in the world and is accordingly opulent inside. We tried to visit earlier in the day, but they require a room or restaurant reservation in order to enter the grounds. After heading home, we decided to test out fast food delivery, and had Burger King deliver a late night snack to the hotel before finally getting to bed around 3am.</p>
<p>&nbsp;</p>
<p>The next morning, we had a 6:30am wakeup in order to make our 7:30am reservation to go to the top of the <a href="http://en.wikipedia.org/wiki/Burj_Khalifa">Burj Khalifa</a> (the tallest building in the world, designed by Chicago firm Skidmore Owings &amp; Merrill). Views from the top were incredible, and we were surprised at how much undeveloped land there still is in the surrounding area. I imagine that in a few years, that will no longer be the case.   So far, a couple things about the trip have stuck out to me. First, is the palpable feeling of cognitive dissonance. We&#8217;re supposed to avoid any PDA, but we&#8217;ll walk by a Victoria&#8217;s Secret with lingerie openly displayed in the window. Or you think about the amount of anti-American/anti-west sentiment that comes out of the region, but western cars, clothes, and food are very popular among the locals. It&#8217;s a little bit hard to describe and not necessarily a bad thing, but it can be difficult to reconcile mentally. I think a large part of it comes from the absurd speed at which the region is developing, and some areas have not yet caught up to others. The second recurring theme that I&#8217;ve noticed is the friendliness and hospitality of the people here. American media seems to focus only on the negative sentiments coming out of the region, but all of our interactions have been overwhelmingly positive, both connections through Lara and strangers on the street or in stores/restaurants. We haven&#8217;t encountered a single rude person thus far.</p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2014/01/08/ben-pams-middle-eastern-adventure-dubai/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Personal Challenge</title>
		<link>http://benroesch.com/2013/06/11/the-personal-challenge/</link>
		<comments>http://benroesch.com/2013/06/11/the-personal-challenge/#comments</comments>
		<pubDate>Tue, 11 Jun 2013 15:12:36 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=809</guid>
		<description><![CDATA[At least once a week, I&#8217;ll find myself finishing up dinner when I notice a leftover cupcake or cookie and <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/06/11/the-personal-challenge/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>At least once a week, I&#8217;ll find myself finishing up dinner when I notice a leftover cupcake or cookie and get a familiar twinge. Part of me will focus on how delicious the cookie sounds and how much I want to eat it. Another part will tug in the opposite direction, wanting to be healthy and fit, avoiding mid-week junk food. Standing there in the kitchen, I feel like it&#8217;s a lose-lose situation. Skip the cookie and I feel like I don&#8217;t let myself enjoy food. Eat it and I&#8217;m being unhealthy. </p>
<p>In these moments of weakness, I&#8217;ve found a simple trick that snaps me out of it and helps me avoid temptation: I turn it into a personal challenge. Instead of playing internal tug-o-war, I ask myself &#8220;Am I capable of resisting this temptation? Do I have it in me?&#8221; Actively saying those words in my head gives me an instant boost, and I&#8217;m usually able to avoid the temptation (let&#8217;s be real though, sometimes I still eat the cookie, because cookies really are delicious).</p>
<p>In my opinion, the personal challenge trick works for a couple of reasons. First, it clearly assigns the onus of responsibility. We understand this instinctually and even craft our speech to exploit the concept. For example, imagine a boss who is pressing for an aggressive timetable on a project. His employee might externalize blame for not being able to make the timeline, saying &#8220;that timeline isn&#8217;t realistic&#8221; or &#8220;it can&#8217;t be done in that amount of time.&#8221; He avoids saying &#8220;I can&#8217;t get it done in time,&#8221; because then there is no wiggle room in assigning blame for the failure. Vocalizing a problem as a personal challenge forces you to take responsibility, which provides motivation to be successful.</p>
<p>The second reason this trick works is that it taps into our naturally competitive spirit. For example, last year I co-founded a software development consultancy, <a href="http://federisgroup.com">Federis Group</a>. By nature, I&#8217;m a left-brained code monkey who loves to solve problems with a computer. Being a salesman is not the most natural activity to me. But if I turn it into a personal challenge, my competitive streak kicks into gear. Do I have it in me to go sell our services? When phrased this way, the competitive side of me will always respond, &#8220;yes, if other people can do it, then I can do it.&#8221;</p>
<p>P.S. If you enjoyed this article, I&#8217;d love to hear from you on twitter: <a href="http://twitter.com/bcroesch">@bcroesch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/06/11/the-personal-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternatives to Spray-and-Pray Networking</title>
		<link>http://benroesch.com/2013/06/07/alternatives-to-spray-and-pray-networking/</link>
		<comments>http://benroesch.com/2013/06/07/alternatives-to-spray-and-pray-networking/#comments</comments>
		<pubDate>Fri, 07 Jun 2013 14:02:36 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=771</guid>
		<description><![CDATA[If you asked my wife how I feel about small talk, you&#8217;d probably get a raised eyebrow and a chuckle. <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/06/07/alternatives-to-spray-and-pray-networking/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>If you asked my wife how I feel about small talk, you&#8217;d probably get a raised eyebrow and a chuckle. To say the least, I&#8217;m not a fan of forced conversation. That&#8217;s not to say I hate talking to people, meeting with people, or just people in general. It&#8217;s quite the contrary. I enjoy people, but like to have purposeful, meaningful interactions that aren&#8217;t talking for the sake of talking.</p>
<p>It should come as no surprise, then, that I&#8217;ve never particularly cared for going to random events and glad-handing everyone I see. That may work for some people, but isn&#8217;t my style. Instead, I&#8217;ve found a number of other tactics that better fit my personality.</p>
<h2>The Friend of a Friend</h2>
<p>Here&#8217;s what Chuck thinks of the spray-and-pray approach to networking:</p>
<p><img src="http://benroesch.com/wp-content/uploads/2013/06/turrible-300x278.jpg" alt="turrible" width="300" height="278" class="alignnone size-medium wp-image-775" /></p>
<p>Randomly emailing people in hopes of networking with them is a great way to waste a bunch of time. I&#8217;ve had more success with warm introductions (ie. having an existing contact of yours make an introduction). Frequently, my process goes something like:</p>
<ol>
<li>Figure out the profile of the type of person I want/need to meet (e.g. Someone who went to Notre Dame, lives in Chicago, and is involved in the startup world)</li>
<li>Google/LinkedIn search until I find a couple people who match said profile</li>
<li>Try to find a person who knows both of us</li>
<li>Ask that person to make an intro</li>
</ol>
<p>Step #3 is often the most difficult, but LinkedIn is a great tool for this. If you look at someone&#8217;s profile (yes, it will tell them you looked at it &#8211; meh), there should be a feature in the right-hand column that shows you common connections. I find these are typically good candidates for an intro. It looks like this:</p>
<p><img src="http://benroesch.com/wp-content/uploads/2013/06/linkedin_connections-228x300.png" alt="linkedin_connections" width="228" height="300" class="alignnone size-medium wp-image-778" /></p>
<p>Once I get an intro, I explain who I am, why they should meet with me (I try to only ask for meetings when I have a reason to meet them, to avoid wasting someone&#8217;s time), and offer to buy them a coffee or beer. Some people may end up being too busy, but I&#8217;ve found 1 on 1 meetings tend to be much more valuable than going to random meet-ups and dumping business cards on everyone you see. If you have a connection (mutual friend, alma mater, etc.), then most people tend to be willing to help you out.</p>
<p>Your reaction might be &#8220;but I don&#8217;t want to meet with the scrubs who are one degree separated from me, I want to meet with Internet-Famous-Uber-Person-In-My-Space&#8221; (that&#8217;s my space, not MySpace). My response would be: If you&#8217;re lucky and you demonstrate to the person that you generally have it together, then they might be willing to introduce you to other people they know, and thus your network can start to grow exponentially (and by exponentially, I mean a couple meaningful connections per month). </p>
<h2>The Digi-Stalker</h2>
<p>They say imitation is the sincerest form of flattery. If that&#8217;s the case, the consolation prize goes to digital hero worship, where you excessively stalk the person until you know what bar they went to last weekend, what they ate for dinner last night, and every news article they&#8217;ve read in the past month. That way, they will be really impressed with your passion for their personal life and not, you know, call the cops or anything.</p>
<p>In all seriousness, I find that it helps to do some homework about the person&#8217;s work and background. You don&#8217;t want to make an off the cuff joke at the expense of attorneys/recruiters/punching-bag-profession-du-jour, only to find that the person is or was one. It provides some easy talking points and demonstrates that you&#8217;re someone who puts in the work to be prepared.</p>
<h2>The Altruist</h2>
<p>Patagonia makes top notch outdoor gear and clothes for yuppies who want to appear outdoorsy. Their stuff is high quality and they make good money selling it. What some people don&#8217;t know is that Patagonia is also a company that doesn&#8217;t mess around when it comes to corporate responsibility. They started &#8220;<a href="http://www.patagonia.com/us/patagonia.go?assetid=81218&#038;ln=450" target="_blank">1% for the Planet</a>,&#8221; through which they pledge 1% of sales to the preservation and restoration of the environment. They are extremely dedicated to fair labor conditions in their supply chain. In 2012, California created a new corporate structure called a &#8220;<a href="http://www.bloomberg.com/news/2012-01-04/patagonia-road-tests-new-sustainability-legal-status.html" target="_blank">Benefit Corporation</a>,&#8221; which allows companies to legally prioritize social missions over profits. Patagonia was one of the first companies to sign up.</p>
<p>Some people don&#8217;t think that profits and social good can co-exist symbiotically within a single entity, but Patagonia shows otherwise. In a similar way, I think volunteering and career-ambition can not only co-exist, but benefit from each other. Many successful people have personal causes that are important to them. I think that volunteering to help out with these causes can have numerous benefits. You get the benefits that most people associate with volunteering. You get to feel like a good person. You get the catharsis that comes with helping others. It&#8217;s simply a worthwhile cause and activity. But you also get some other bonuses, such as exposure to the successful people leading the charge. It can be a great way to gain the trust and endorsement of these people, which can help in your other endeavors. </p>
<p>P.S. I&#8217;d love to hear from you on twitter: <a href="http://twitter.com/bcroesch">@bcroesch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/06/07/alternatives-to-spray-and-pray-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving a Production Rails App to New Servers</title>
		<link>http://benroesch.com/2013/06/03/moving-a-production-rails-app-to-new-servers/</link>
		<comments>http://benroesch.com/2013/06/03/moving-a-production-rails-app-to-new-servers/#comments</comments>
		<pubDate>Mon, 03 Jun 2013 14:50:14 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=715</guid>
		<description><![CDATA[At Inkling Markets we recently moved off of dedicated servers and onto Rackspace Cloud Servers. In order to accomplish this, <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/06/03/moving-a-production-rails-app-to-new-servers/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>At <a href="http://inklingmarkets.com">Inkling Markets</a> we recently moved off of dedicated servers and onto Rackspace Cloud Servers. In order to accomplish this, we created something that we called the &#8220;migration playbook,&#8221; which outlined the steps we needed to take to ensure a smooth transition. When we first started, I looked around for something similar but didn&#8217;t find much, so I thought I&#8217;d share some interesting pieces and lessons learned from our process. I left out a number of tasks that were less interesting or difficult, but some our major pieces included:</p>
<ul>
<li>New web/app servers</li>
<li>Database migration</li>
<li>Application data/image migration</li>
<li>Email migration</li>
<li>DNS Transfer</li>
<li>Day-of Playbook</li>
</ul>
<p>Our plan called for setting up the new enivronment in its entirety, beating on that environment for a while to work out any kinks, and then having a final cut-over where we actually started pointing the inklingmarkets.com domain to the new servers.</p>
<h2>New Web/App Servers</h2>
<p>The first thing we did was set up new web/app servers. As part of the transition, we decided to switch from our old apache/haproxy/mongrel setup to nginx/unicorn. In addition to getting onto a newer and hopefully faster stack, this allowed us to cut out the haproxy piece from our puzzle. While installing nginx and unicorn is pretty straight forward, we did run into one application-related snag. When serving up user-uploaded images from the application, our app would add an X-Sendfile header to the response headers. This would result in apache serving the file directly, instead of having the mongrel servers do it. Nginx doesn&#8217;t support X-Sendfile, but fortunately it has a similar feature, called X-Accel. So instead of adding an X-Sendfile header, we changed the rails app to add an X-Accel-Redirect header, containing the path to the file. </p>
<h2>Database Migration</h2>
<p>The database migration and cutover was probably the biggest single piece of the transition. If you&#8217;re interested in how we handled it, I wrote up a separate article that covers it in depth, which you can read <a href="http://benroesch.com/2013/05/28/moving-a-live-mysql-database-to-a-new-server/">here</a>.</p>
<h2>Application Data &#038; Image Migration</h2>
<p>Our app included some user generated images that are saved on disk. To migrate this data, we used rsync. From the destination server, we used a command that looked like this:</p>
<blockquote><p><pre><code>rsync -aiv deployuser@source.server.ip:/path/to/images/dir/ /path/to/images/dir/
</code></pre></p></blockquote>
<p>To minimize downtime at the time of the actual transition, we ran this when setting up the servers to move over the bulk of the files. We then ran it again on the day of cutover, and then again after we put up maintenance pages on our old servers. The subsequent instances only needed to move the changes since the last time we ran the command, so they were fast relative to the first time.</p>
<h2>Email Migration</h2>
<p>Moving our outbound email was another major piece that merited its own post. You can find it <a href="http://benroesch.com/2013/05/30/migrating-application-email-sending-to-a-new-server/">here</a>.</p>
<h2>DNS Transfer</h2>
<p>When the day of cutover came, we had a number of tasks listed that had to get done, but the one that made the switch &#8220;official&#8221; was updating our DNS settings to point to the new servers. The process for this, while suspenseful, was pretty simple:</p>
<p>1. Lower the DNS TTL (we put it down to 30 seconds) far enough ahead of time that the old records will expire. (ie. if your ttl is 30 mins, lower it more than 30 mins before you want to make the switch)<br />
2. Once the other tasks are complete and the new servers are ready to start getting traffic, update the A records to point to new load balancer<br />
3. Verify that things are working correctly on the new servers<br />
4. Once satisfied, increase the TTL back to the previous value</p>
<h2>Day-of Playbook</h2>
<p>If anyone is going through a similar process, there&#8217;s a final piece of advice that I&#8217;d give. For our migration, we put together a day-of playbook that listed, in sequential order, all of the tasks that needed to be completed. Where pertinent, it included specific commands to run and where to run them. This helped the migration go smoothly and quickly, and I would highly recommend it.</p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/06/03/moving-a-production-rails-app-to-new-servers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrating Application Email Sending to a New Server</title>
		<link>http://benroesch.com/2013/05/30/migrating-application-email-sending-to-a-new-server/</link>
		<comments>http://benroesch.com/2013/05/30/migrating-application-email-sending-to-a-new-server/#comments</comments>
		<pubDate>Thu, 30 May 2013 14:38:16 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=731</guid>
		<description><![CDATA[At Inkling Markets, we recently moved off of dedicated hardware and onto the Rackspace Cloud. Our old servers had good <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/05/30/migrating-application-email-sending-to-a-new-server/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>At <a href="http://inklingmarkets.com">Inkling Markets</a>, we recently moved off of dedicated hardware and onto the Rackspace Cloud. Our old servers had good spam reputation, and we didn&#8217;t want to jeopardize that with the move. There are several things that you can do to help improve your reputation and deliverability, but here are a few that we did.</p>
<h2>Check the Existing Reputation of the Server&#8217;s IP</h2>
<p>If you&#8217;re using cloud servers, you could easily end up with a recycled IP address that was previously used by another server. And what type of person needs to constantly move to new servers with new IP addresses? Spammers. The first IP that we got for our jobs server turned out to be one that was recently used by someone for sending a bunch of email spam. I used <a href="http://mxtoolbox.com/blacklists.aspx">MX Toolbox</a> to check blacklists for our IP, and it was on several. The good news is that we could spin up a new cloud server and get a new IP. I would recommend checking this as soon as you get the IP, before wasting any time on configuring the server.</p>
<h2>Set Up an SPF Record</h2>
<p>SPF (sender policy framework) records verify that a server is allowed to send email for the given domain. Our new jobs server was going to be responsible for sending our email, so we simply needed to add a DNS TXT record like: <code>v=spf1 ip4:jobs.server.ip.address</code></p>
<p>For verifying spf records, I found <a href="http://www.kitterman.com/spf/validate.html">http://www.kitterman.com/spf/validate.html</a> very useful. If you use gmail, you can also open a message and select &#8220;Show Original&#8221; from the dropdown menu on the right. There should be some SPF info in the headers, which will show if the server that sent the email is designated as a permitted sender.</p>
<h2>Set Up a Reverse DNS (PTR) Record</h2>
<p>A normal DNS A record points a domain to an IP. PTR records do the opposite, pointing an IP to a domain. Many email servers use PTR records as another signal that the given IP is allowed to send email for a domain and may reject email from servers that don&#8217;t have one. These are typically set up with whomever provided you with the IP address (ie. the server provider, in our case Rackspace). So if you send email from a server with an IP of 123.123.123.123 (and your A record is mydomain.com -> 123.123.123.123), then you&#8217;d want to set a PTR that points 123.123.123.123 to mydomain.com.</p>
<h2>Warm Up the IP</h2>
<p>In the email world, there is a concept known as &#8220;warming up&#8221; an IP address, which was news to me. The idea is that if a new server pops up and starts sending massive quantities of email, it is probably spam. To avoid this, you can gradually ramp up email sending by the new server over the course of several days. This was a tricky piece for us, since we planned to have a single-night cutover where we switched everything from our old environment to the new one. Fortunately, a large proportion of our email was generated by cron jobs. We gave the new jobs server access to the old db server and, over the course of a week, we started turning off cron jobs on the old server and enabling them on the new jobs server. This allowed us to gradually ramp up the volume of email coming out of the jobs server until the day of cutover, when all of our email starting running through it.</p>
<p>If you found this post helpful, I&#8217;d love to hear from you on twitter: <a href="http://twitter.com/bcroesch">@bcroesch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/05/30/migrating-application-email-sending-to-a-new-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving a Live MySQL Database to a New Server</title>
		<link>http://benroesch.com/2013/05/28/moving-a-live-mysql-database-to-a-new-server/</link>
		<comments>http://benroesch.com/2013/05/28/moving-a-live-mysql-database-to-a-new-server/#comments</comments>
		<pubDate>Tue, 28 May 2013 16:50:38 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=632</guid>
		<description><![CDATA[At Inkling Markets, we recently moved off of dedicated servers and onto Rackspace Cloud Servers. As part of this transition, <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/05/28/moving-a-live-mysql-database-to-a-new-server/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>At <a href="http://inklingmarkets.com">Inkling Markets</a>, we recently moved off of dedicated servers and onto Rackspace Cloud Servers. As part of this transition, we needed to move our mysql database onto our new database server. If you Google for how to move a mysql database, most of the answers that you find will involve stopping mysql, taking a full backup, copying that backup to a new server, and then restoring it. In our case, with a non-trivial sized database, doing that would take far too long. In order to minimize downtime during the transition, we came up with a different approach.</p>
<p>The general outline of the plan was:</p>
<p>1. Set up new db server as a slave of the old master<br />
2. Put up a maintenance page for our app and let the new db finish replicating old master<br />
3. Promote the new db server to master<br />
4. Profit!!!</p>
<p>In our old setup, we had one server acting as master and one replication slave. To start, I spun up a new db server, installed the same version of mysql that was running on our old servers, and added firewall rules to allow the new db server to talk to both the master and slave. On the new server, which was going to serve as our future master, I configured it to have binlog on, relaylog on, and log-slave-updates off. In our case, the config settings look like this (log-slave-updates is off by default):</p>
<blockquote><p><pre><code>log-bin=/usr/local/mysql/var/newhostname-bin-log
log-bin-index=/usr/local/mysql/var/newhostname-bin-log.index
relay-log=/usr/local/mysql/var/newhostname-relay-log
relay-log-index=/usr/local/mysql/var/newhostname-relay-log.index</code></pre></p></blockquote>
<p>With this setup, the new db server can be run as a slave of the old master, but will not log the updates it gets from that replication in its binlog. However, since its binlog is on, it is ready to be promoted to master in the future (ie. when we made the actual transition to it being our production db).</p>
<p>Since the plan here is to have the new server start out as a slave of the old one, I added a replication user to the old server for the new server&#8217;s ip. On the old server:</p>
<blockquote><p><pre><code>mysql&gt; CREATE USER &#039;repl&#039;@&#039;new.server.ip&#039; identified by &#039;repl password here&#039;;
mysql&gt; GRANT REPLICATION SLAVE ON *.* TO &#039;repl&#039;@&#039;new.server.ip&#039;;</code></pre></p></blockquote>
<p>Next, I stopped mysql on the new server and set <code>server-id=3</code> in its config file. In order to get data over to the new db server, I stopped the replication on our old slave:</p>
<blockquote><p><pre><code>mysql&gt; STOP SLAVE;
mysql&gt; FLUSH TABLES;
$ /etc/init.d/mysql stop</code></pre></p></blockquote>
<p>And used rsync to copy over the mysql data directory from the old slave to the new db server:</p>
<blockquote><p><pre><code>$ rsync -avz user@old.slave.ip:/usr/local/mysql/var /usr/local/mysql/var
</code></pre></p></blockquote>
<p>I then turned the old slave back on and let it catch back up to master:</p>
<blockquote><p><pre><code>$ /etc/init.d/mysql start
</code></pre></p></blockquote>
<p>And to verify the slave there is working (you can run this command twice and Exec_Master_Log_Pos should be increasing):</p>
<blockquote><p><pre><code>mysql&gt; SHOW SLAVE STATUS\G
</code></pre></p></blockquote>
<p>Next, some files in the data dir needed to be renamed and/or updated. MySQL names some of the files according to the name of the host it is on, so they needed to be changed from the old host name to the new one. You&#8217;d need to replace newhostname with the name of your server:</p>
<blockquote><p><pre><code>$ cd /usr/local/mysql/var
$ mv oldhost-relay-log.index newhostname-relay-log.index
$ mv oldhost-relay-log.##### newhostname-relay-log.#####
$ sudo vim relay-log.info (change path &amp; name of the relay log on the first line to the new location &amp; host)
$ sudo vim newhostname-relay-log.info (change path &amp; name of the relay log on the first line to the new location &amp; host)
$ sudo vim master.info (make sure the replication user and pw are correct)</code></pre></p></blockquote>
<p>Once I fired up mysql on the new server, it immediately began pulling updates from the old server, since the data directory was copied directly off our old slave. Now, the actual switch over to the new server.</p>
<p>I put up a maintenance page on our web servers, so that no new requests would go through to the application. Then, I locked the tables on the old server so that no new updates could be made there:</p>
<blockquote><p><pre><code>mysql&gt; FLUSH TABLES WITH READ LOCK;
</code></pre></p></blockquote>
<p>And then waited for the new db server to finish processing updates. You can verify this by checking the process list (on the new server), which should say &#8216;Has read all relay log.&#8217;</p>
<blockquote><p><pre><code>mysql&gt; SHOW PROCESSLIST;
</code></pre></p></blockquote>
<p>I made a copy of the data directory, just to be safe:</p>
<blockquote><p><pre><code>$ cp -r /usr/local/mysql/var /usr/local/mysql/var_backup/
</code></pre></p></blockquote>
<p>And then promoted the new db to master:</p>
<blockquote><p><pre><code>mysql&gt; STOP SLAVE;
mysql&gt; RESET MASTER;</code></pre></p></blockquote>
<p>After a few other non-db related tasks, we changed our DNS entries to point to our new servers, and the process was complete.</p>
<p>If you found this helpful, I&#8217;d love to hear from you on twitter: <a href="http://twitter.com/bcroesch">@bcroesch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/05/28/moving-a-live-mysql-database-to-a-new-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shareable Web Links that Open iOS Deep Links</title>
		<link>http://benroesch.com/2013/05/23/shareable-web-links-that-open-ios-deep-links/</link>
		<comments>http://benroesch.com/2013/05/23/shareable-web-links-that-open-ios-deep-links/#comments</comments>
		<pubDate>Thu, 23 May 2013 15:17:51 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=650</guid>
		<description><![CDATA[When building 55Prophets (available in the app store), we built in a number of deep linking options. I wrote in-depth <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/05/23/shareable-web-links-that-open-ios-deep-links/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>When building <a href="http://55prophets.com" title="55Prophets">55Prophets</a> (available in the <a href="https://itunes.apple.com/us/app/55prophets/id622424094?ls=1&#038;mt=8" title="app store">app store</a>), we built in a number of deep linking options. I wrote in-depth about adding deep links to your iOS app <a href="http://benroesch.com/2013/05/14/creating-view-controllers-for-deep-linked-ios-apps/" title="here">here</a>. </p>
<p>Now that we have these deep links, we wanted to be able to share them with people around the web. However, sharing links that look like <code>ffprophets://leagues/22/join</code> is confusing to people and isn&#8217;t necessarily clickable/touchable in many cases. To make it easier to share deep links in the app, I added a quick and simple snippet to our nginx config that redirects deep link url&#8217;s to open inside the app. It looks like this:</p>
<blockquote><p><pre><code>location /deep_link/ {
&nbsp;&nbsp;if ($http_user_agent ~ iPhone) {
&nbsp;&nbsp;&nbsp;&nbsp;rewrite ^/deep_link/(.*) ffprophets://$1 permanent;
&nbsp;&nbsp;}

&nbsp;&nbsp;rewrite ^/deep_link/(.*) /deep_link.html last;
&nbsp;&nbsp;break;
}</code></pre></p></blockquote>
<p>Now, we can share urls like <a href="http://55prophets.com/deep_link/leagues/22/join">http://55prophets.com/deep_link/leagues/22/join</a> (download the app, visit this page on your iPhone and try it out!). When people access the url in mobile Safari on their device, it will redirect them to <code>ffprophets://leagues/22/join</code>, which will open in 55Prophets. If they access the page from a computer, it will show them the deep_link.html page, which informs them that the link needs to be opened on a mobile device with the app installed and gives them a link to download it.</p>
<p>P.S. If you found this helpful, I&#8217;d love to hear from you on twitter, <a href="http://twitter.com/bcroesch">@bcroesch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/05/23/shareable-web-links-that-open-ios-deep-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mapping Rails Errors in a Restkit-based iOS App</title>
		<link>http://benroesch.com/2013/05/20/mapping-rails-errors-in-a-restkit-based-ios-app/</link>
		<comments>http://benroesch.com/2013/05/20/mapping-rails-errors-in-a-restkit-based-ios-app/#comments</comments>
		<pubDate>Tue, 21 May 2013 02:51:13 +0000</pubDate>
		<dc:creator><![CDATA[bcroesch]]></dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://benroesch.com/?p=569</guid>
		<description><![CDATA[We used RestKit to build 55Prophets (available in the app store). Restkit&#8217;s readme page has some instructions for mapping error <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://benroesch.com/2013/05/20/mapping-rails-errors-in-a-restkit-based-ios-app/" class="more-link"><span>Continue Reading &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[<p>We used <a href="http://restkit.org/">RestKit</a> to build <a href="http://55prophets.com">55Prophets</a> (available in the <a href="https://itunes.apple.com/us/app/55prophets/id622424094?ls=1&#038;mt=8">app store</a>). Restkit&#8217;s readme page has some instructions for mapping error responses, but I ran into several problems along the way, so I came up with my own setup for taking errors that come out of our back end and presenting them to a user.</p>
<p>To start, I created a class called ErrorCollection. It is relatively simple and the header file looks like this:</p>
<blockquote><p><pre><code>//&nbsp;&nbsp;ErrorCollection.h
#import &lt;Foundation/Foundation.h&gt;

@interface ErrorCollection : NSObject

@property (nonatomic, strong) NSArray *messages;
@property (nonatomic, strong) NSString *message;

-(NSString *)messagesString;

@end</code></pre></p></blockquote>
<p>The implementation is also simple. It looks like this:</p>
<blockquote><p><pre><code>// ErrorCollection.m
#import &quot;ErrorCollection.h&quot;

@implementation ErrorCollection

-(NSString *)messagesString{
&nbsp;&nbsp;&nbsp;&nbsp;if (self.message) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return self.message;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;else{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NSMutableString *str = [[NSMutableString alloc] init];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i=0; i&lt;self.messages.count; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NSString *msg = [self.messages objectAtIndex:i];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (i==self.messages.count-1) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[str appendFormat:@&quot;%@&quot;, msg];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[str appendFormat:@&quot;%@\n&quot;, msg];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return str;
&nbsp;&nbsp;&nbsp;&nbsp;}
}

@end</code></pre></p></blockquote>
<p>Our back-end rails app either returns json in the form of <code>{&quot;errors&quot;: [&quot;error1&quot;, &quot;error2&quot; ... ] }</code> or <code>{&quot;error&quot;: &quot;error message&quot; }</code>. In the case of the former, we want to map each error string in the array to a string in the messages array of an ErrorCollection. In the case of the latter, we want to map the string to the message property of the ErrorCollection. Then, we can use messagesString method, which will give us a single string to present to the user, containing the error message or messages. </p>
<p>To get RestKit to use the ErrorCollection class, we need to add a response descriptor for it. Wherever you set up your response descriptors, add something like this:</p>
<blockquote><p><pre><code>RKObjectMapping *errorMapping = [RKObjectMapping mappingForClass:[ErrorCollection class]];

[errorMapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:@&quot;errors&quot; toKeyPath:@&quot;messages&quot;]];
[errorMapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:@&quot;error&quot; toKeyPath:@&quot;message&quot;]];

[[RKObjectManager sharedManager] addResponseDescriptor:[RKResponseDescriptor responseDescriptorWithMapping:errorMapping pathPattern:nil keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassClientError)]];</code></pre></p></blockquote>
<p>Now you can access the error collection in the failure block many of the methods of the RestKit object manager. For example:</p>
<blockquote><p><pre><code>[[RKObjectManager sharedManager] postObject:someObject path:@&quot;/object_path&quot; parameters:nil
&nbsp;&nbsp;success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// handle success
&nbsp;&nbsp;}
&nbsp;&nbsp;failure:^(RKObjectRequestOperation *operation, NSError *error){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ErrorCollection *errors = [[[error userInfo] objectForKey:RKObjectMapperErrorObjectsKey] lastObject];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NSLog(@&quot;%@&quot;, [errors messagesString]);
&nbsp;&nbsp;}];</code></pre></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://benroesch.com/2013/05/20/mapping-rails-errors-in-a-restkit-based-ios-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
