<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>otaku-elite</title>
 <link href="https://otaku-elite.com/atom.xml" rel="self"/>
 <link href="https://otaku-elite.com"/>
 <updated>2025-10-03T10:15:31-05:00</updated>
 <id>https://otaku-elite.com</id>
 <author>
   <name>Gregory McQuillan</name>
   <email>void@otaku-elite.com</email>
 </author>

 
 <entry>
   <title>New Web Comics Section Added!</title>
   <link href="https://otaku-elite.com/blog/2025/04/15/web-comics/"/>
   <updated>2025-04-15T07:06:08-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2025/04/15/web-comics</id>
   <content type="html">&lt;p&gt;While staying in Japan for the past few weeks, I’ve encountered a lot of strange
and fun situations I’ve decided to write about. However, rather than writing
about them in a blog I thought it would be more fun to illustrate these crazy
scenes as a way to also keep up a new drawing habit I’ve been wanting to start
for a while.&lt;/p&gt;

&lt;p&gt;Say hello to &lt;a href=&quot;/comics/&quot;&gt;the new comics section&lt;/a&gt; of the website. My first
strip is titled &lt;em&gt;Meanwhile in Japan&lt;/em&gt; and features my fun-filled crazy action-packed
— okay maybe it’s none of these — adventures.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/comics&quot;&gt;
    &lt;img style=&quot;margin: 0 auto&quot; src=&quot;/comics/meanwhile-in-japan/cover.jpeg&quot; alt=&quot;Meanwhile in Japan book cover&quot; /&gt;
&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>鮭のホイル焼き作りましょ！Let's Make Salmon Foil-Yaki!</title>
   <link href="https://otaku-elite.com/japanese/2015/02/22/sake-no-hoiruyaki-tsukurimasho/"/>
   <updated>2015-02-22T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2015/02/22/sake-no-hoiruyaki-tsukurimasho</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/2015/02/22/sake-no-hoiruyaki.png&quot; alt=&quot;Sake no Hoiruyaki&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;日本語で-japanese-version&quot;&gt;日本語で！ Japanese Version&lt;/h1&gt;

&lt;p&gt;皆のもの！今日は鮭のホイル焼きのレシピを紹介するでござる！
これも日本の友達が俺に教えてくれたレシピでござる。
簡単に調理できるので是非作ってみてね。
用意するものはアルミホイルだよ！&lt;/p&gt;

&lt;h2 id=&quot;材料&quot;&gt;材料&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;鮭 (４きれ)&lt;/li&gt;
  &lt;li&gt;キャベツ (半個)&lt;/li&gt;
  &lt;li&gt;玉ねぎ (半分)&lt;/li&gt;
  &lt;li&gt;バター (お好み)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;調味料&quot;&gt;調味料&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;味噌 (レンゲ２杯)&lt;/li&gt;
  &lt;li&gt;みりん (レンゲ２杯)&lt;/li&gt;
  &lt;li&gt;酒 (レンゲ２杯)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
  &lt;li&gt;調味料を混ぜる&lt;/li&gt;
  &lt;li&gt;鮭と野菜を切る。キャベツの芯の部分は使わない。
&lt;img src=&quot;/images/2015/02/22/ingredients-chopped.png&quot; alt=&quot;ingredients chopped&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;アルミホイルの上にキャベツ、玉ねぎ、鮭の順にのせ、①をかける。
&lt;img src=&quot;/images/2015/02/22/ingredients-in-foil.png&quot; alt=&quot;ingredients in foil&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;最後にバターをのせて空気が逃げないようにしっかりホイルを閉じる
&lt;img src=&quot;/images/2015/02/22/wrapped-foil.png&quot; alt=&quot;wrapped foil&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;フライパンに水150mlと④を並べたら蓋をして強火で5分煮る。
&lt;img src=&quot;/images/2015/02/22/foil-in-pan.png&quot; alt=&quot;foil in pan&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;中火に切り替え、10分程度したら火を止める。
やわらかめがお好みの人は8分したら火を止めましょう。&lt;/li&gt;
  &lt;li&gt;お皿に移して完成です！&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a name=&quot;eigo&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;english-version-英語で&quot;&gt;English Version 英語で！&lt;/h1&gt;

&lt;p&gt;Hey everybady~ Today we’re gonna cook &lt;strong&gt;鮭のホイル焼き&lt;/strong&gt; or &lt;strong&gt;Foil-cooked Salmon&lt;/strong&gt;.
This recipe was also taught to me by my Japanese friend.
It’s super easy to cook.
To prepare this meal you will need aluminum foil, of course.&lt;/p&gt;

&lt;h2 id=&quot;ingredients&quot;&gt;Ingredients&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;4 slices Salmon (tail is better)&lt;/li&gt;
  &lt;li&gt;1/2 Small Cabbage.&lt;/li&gt;
  &lt;li&gt;1/2 Onion&lt;/li&gt;
  &lt;li&gt;Butter&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;seasoning&quot;&gt;Seasoning&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;2 renge &lt;a href=&quot;http://www.amazon.com/Hikari-Kodawattemasu-Organic-Paste-1-65lb/dp/B003T2TZQQ/ref=sr_1_32?ie=UTF8&amp;amp;qid=1424645792&amp;amp;sr=8-32&amp;amp;keywords=miso+hikari&quot;&gt;Miso&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;2 renge Mirin&lt;/li&gt;
  &lt;li&gt;2 renge Sake&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;instructions&quot;&gt;Instructions&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;In a small bowl mix the seasoning together&lt;/li&gt;
  &lt;li&gt;Cut the cabbage and salmon. You don’t need the hard center part of the cabbage.
&lt;img src=&quot;/images/2015/02/22/ingredients-chopped.png&quot; alt=&quot;ingredients chopped&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;On top of a sheet of aluminum foil, place the cabbage, 
onion, and salmon, in that order. Drizzle the season from
step ① on top.
&lt;img src=&quot;/images/2015/02/22/ingredients-in-foil.png&quot; alt=&quot;ingredients in foil&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Put thin slices of butter over the salmon and close the
foil tightly so that no air can escape.
&lt;img src=&quot;/images/2015/02/22/wrapped-foil.png&quot; alt=&quot;wrapped foil&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Add the 150ml of water to the frying pan and the tightly
wrapped fish-foils from step ④ and cover with lid.
Cook on high heat for 5 minutes.
&lt;img src=&quot;/images/2015/02/22/foil-in-pan.png&quot; alt=&quot;foil in pan&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Switch to medium heat for about 10 minutes, then stop the heat.
If you prefer a softer texture you can stop the heat at about 8 minutes or so.&lt;/li&gt;
  &lt;li&gt;Place foils on a plate and serve!&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>親子丼作りましょ！ Let's Make Oyakodon!</title>
   <link href="https://otaku-elite.com/japanese/2015/02/21/oyakodon-tskuru/"/>
   <updated>2015-02-21T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2015/02/21/oyakodon-tskuru</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/2015/02/21/oyakodon.png&quot; alt=&quot;Oyakodon&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;日本語で-japanese-version&quot;&gt;日本語で！ Japanese Version&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;#eigo&quot;&gt;Skip to english&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;皆のもの！今日は親子丼のレシピを紹介するでござる！
日本人の友達が俺に教えてくれたレシピでござる。
店で食べる親子丼より美味しいので是非作ってみてね。
特別な調味料がいります：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;鶏もも肉 (2,3枚)&lt;/li&gt;
  &lt;li&gt;溶き卵 (３個分)&lt;/li&gt;
  &lt;li&gt;玉ねぎ (半分)&lt;/li&gt;
  &lt;li&gt;米 (１合)&lt;/li&gt;
  &lt;li&gt;水 (150ml)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;調味料:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;醤油 (レンゲ八分目２杯)&lt;/li&gt;
  &lt;li&gt;みりん (レンゲ八分目２杯)&lt;/li&gt;
  &lt;li&gt;酒 (レンゲ１)&lt;/li&gt;
  &lt;li&gt;砂糖 (小さじ１)&lt;/li&gt;
  &lt;li&gt;本だし (小さじ１)&lt;/li&gt;
  &lt;li&gt;めんつゆ (少々)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
  &lt;li&gt;鶏肉と玉ねぎをお好みの大きさに切ります。&lt;/li&gt;
  &lt;li&gt;水と調味料をフライパンに入れて、温めます&lt;/li&gt;
  &lt;li&gt;フライパンが煮立ったら玉ねぎを加えます&lt;/li&gt;
  &lt;li&gt;火が通ったら鶏肉も加えます。&lt;/li&gt;
  &lt;li&gt;両面に火が通るように時間が立ったら裏返して下さい。&lt;/li&gt;
  &lt;li&gt;玉ねぎと鶏肉に火が通ったら卵を３分の２入れます。&lt;/li&gt;
  &lt;li&gt;フライパンをかき混ぜ少し立ったら残りの卵を入れます。&lt;/li&gt;
  &lt;li&gt;火を止めた後、フライパンにふたをすることで蒸気で残りの卵にも火が通ります。&lt;/li&gt;
  &lt;li&gt;炊きたてのご飯の上にのせて完成です。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;はいっっっ！次に英語で書きます！&lt;/p&gt;

&lt;p&gt;&lt;a name=&quot;eigo&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;english-version&quot;&gt;English Version&lt;/h1&gt;

&lt;p&gt;Hey everybady~! Introducing today’s &lt;strong&gt;Oyakodon&lt;/strong&gt; recipe. My Japanese friend taught me how to make oyakodon, and it’s better than the restaurant version :D&lt;/p&gt;

&lt;p&gt;First, you will need some &lt;strong&gt;ingredients&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;2 or 3 Boneless chicken thighs&lt;/li&gt;
  &lt;li&gt;3 scrambled eggs&lt;/li&gt;
  &lt;li&gt;1/2 Onion&lt;/li&gt;
  &lt;li&gt;150ml Water&lt;/li&gt;
  &lt;li&gt;1 cup Rice&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and special &lt;strong&gt;seasoning&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;2 &lt;a href=&quot;http://www.amazon.com/Asian-Chinese-Black-Melamine-Ladle/dp/B00BOSKPZC/ref=sr_1_5?ie=UTF8&amp;amp;qid=1424580281&amp;amp;sr=8-5&amp;amp;keywords=japanese+spoon&quot;&gt;renge&lt;/a&gt; Soysauce&lt;/li&gt;
  &lt;li&gt;2 renge &lt;a href=&quot;http://www.amazon.com/Kikkoman-Aji-Mirin-Sweet-Cooking-Rice/dp/B0002YB20Q/ref=sr_1_2?ie=UTF8&amp;amp;qid=1424580430&amp;amp;sr=8-2&amp;amp;keywords=mirin&quot;&gt;Mirin&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;1 renge Sake&lt;/li&gt;
  &lt;li&gt;1 tsp Sugar&lt;/li&gt;
  &lt;li&gt;1 tsp &lt;a href=&quot;http://www.amazon.com/Ajinomoto-Dashi-Bonito-Soup-Stock/dp/B00OE30IBU/ref=sr_1_1?ie=UTF8&amp;amp;qid=1424580546&amp;amp;sr=8-1&amp;amp;keywords=hondashi&quot;&gt;Hondashi&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;A dash&lt;/em&gt; of &lt;a href=&quot;http://www.amazon.com/Kikkoman-Hon-Tsuyu-17-Ounce-Pack/dp/B0046GHLAG/ref=sr_1_1?ie=UTF8&amp;amp;qid=1424580584&amp;amp;sr=8-1&amp;amp;keywords=mentsuyu&quot;&gt;Mentsuyu&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we begin, start cooking the rice (you’re on your own for that part)&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Cut the chicken and onions to preference.&lt;/li&gt;
  &lt;li&gt;Heat up the water and the seasoning in a frying pan&lt;/li&gt;
  &lt;li&gt;Once the mixture starts bubbling, add the onions.&lt;/li&gt;
  &lt;li&gt;Once the onions are half cooked, add the chicken&lt;/li&gt;
  &lt;li&gt;After the side of the chicken pieces starts to turn white, flip the chicken pieces over to cook the underside.&lt;/li&gt;
  &lt;li&gt;When the chicken and onions are cooked through, add 2/3 of the scrambled eggs into the frying pan&lt;/li&gt;
  &lt;li&gt;Stir the ingredients in the frying pan, then let it sit for a little bit and add the rest of the eggs.&lt;/li&gt;
  &lt;li&gt;Turn off the heat and cover with lid until the eggs are half cooked.&lt;/li&gt;
  &lt;li&gt;Serve over rice.&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>日本に行きます！ (Going to Japan)</title>
   <link href="https://otaku-elite.com/japanese/2015/02/20/nihon-ni-ikimasu-going-to-japan/"/>
   <updated>2015-02-20T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2015/02/20/nihon-ni-ikimasu-going-to-japan</id>
   <content type="html">&lt;p&gt;皆さん、こんにちは！
今日から一ヶ月後に日本に行くことになりました。東京と大阪か博多に行く予定です。
友達に会いに行きます。僕は日本にまだ行ったことがないので少し不安ですがとても楽しみにしています。
まだ詳しい予定は立ておわっていませんが、面白いレストランや観光地に行く予定です。
日本での写真をたくさん載せるので楽しみにしててね :D
もう眠いので詳しいことはまた明日書きます〜&lt;/p&gt;

&lt;p&gt;じゃあねー&lt;/p&gt;

&lt;p&gt;Hey everybody!  In exactly one month from today I’ll be going to Japan. I’m
going to Tokyo and I’mma prolly hit up Osaka or Hakata. I’ve never been to
Japan before so I’m a little scared but it’ll be a lot of fun, no doubt.  I
still haven’t solidified the details of my trip but I plan on visiting many
interesting restaurants and some touristy places, too.  I’ll be posting lots of
photos from Japan. I’m kinda sleepy now though so I’ll write more tomorrow.&lt;/p&gt;

&lt;p&gt;Later!&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Adding [Text] Shadows in iOS</title>
   <link href="https://otaku-elite.com/code/2014/11/29/adding-text-shadows-in-ios/"/>
   <updated>2014-11-29T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/11/29/adding-text-shadows-in-ios</id>
   <content type="html">&lt;p&gt;Although it’s very simple, I often forget how to add a shadow in iOS using Objective-C. It’s not so much that I &lt;em&gt;forget&lt;/em&gt;, but that there are certain required parameters that need to be set in order for it to work.&lt;/p&gt;

&lt;p&gt;So I’ll post some examples here.&lt;/p&gt;

&lt;p&gt;Using CALayer on a UILabel (Should work with any UIView subclass):&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOffset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//default is (0.0, -3.0)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Default value is opaque black.&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowRadius&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//default is 3.0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOpacity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//default is 0.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Important Notes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;CALayer’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shadowColor&lt;/code&gt; property takes a CGColor not a UIColor. You can convert UIColor to CGColor using UIColor’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CGColor&lt;/code&gt; property as shown above.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shadowOpacity&lt;/code&gt; defaults to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0.0&lt;/code&gt;, if you don’t set it, &lt;strong&gt;&lt;em&gt;you will not see your shadow.&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check the &lt;a href=&quot;https://developer.apple.com/library/mac/Documentation/GraphicsImaging/Reference/CALayer_class/index.html#//apple_ref/occ/instp/CALayer&quot;&gt;CALayer documentation&lt;/a&gt; for more information on the default values and their types.&lt;/p&gt;

&lt;p&gt;Adding to a UIButton:&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;btnRollTheDice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titleLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOffset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//setting stately shadow color, also takes a UIColor, not a CGColor.&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;btnRollTheDice&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;setTitleShadowColor:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;forState:&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;UIControlStateNormal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Adding to a UILabel &lt;em&gt;without CALayer&lt;/em&gt;:&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOffset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//takes a UIColor&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Adding to a UIButton &lt;em&gt;without CALayer&lt;/em&gt;.&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;btnRollTheDice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titleLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOffset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;btnRollTheDice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titleLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;btnRollTheDice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titleLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOpacity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;adding-drop-shadow-to-a-uiview&quot;&gt;Adding drop shadow to a UIView.&lt;/h2&gt;
&lt;p&gt;If you want to add a drop shadow to a UIView (not a text shadow) you can apply the same CALayer approach as detailed in the first example.&lt;/p&gt;

&lt;h2 id=&quot;tidying-up&quot;&gt;Tidying up&lt;/h2&gt;
&lt;p&gt;Usually if you have one drop shadow (or text shadow) you want more. We can tidy up and centralize that using a &lt;a href=&quot;http://rypress.com/tutorials/objective-c/categories.html&quot;&gt;Category&lt;/a&gt; in objective-c. See also: &lt;a href=&quot;https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html&quot;&gt;Programming with Objective-C: Customizing Existing Classes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In Xcode 6, select &lt;strong&gt;File &amp;gt; New &amp;gt; Objective-C File&lt;/strong&gt; then select &lt;strong&gt;Category&lt;/strong&gt; as your file type. I named mine &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DropShadow&lt;/code&gt;. Type &lt;strong&gt;UIView&lt;/strong&gt; under &lt;strong&gt;Class&lt;/strong&gt;. This creates the appropriate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIView+DropShadow&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;This is what my code looks like:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIView+DropShadow.h:&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &amp;lt;UIKit/UIKit.h&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UIView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;DropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;withOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;offset&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;radius&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;radius&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the implementation file,&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIView+DropShadow.m:&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &quot;UIView+DropShadow.h&quot;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UIView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;DropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;withOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;offset&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;radius&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;radius&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;opacity&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOffset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowRadius&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;radius&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOpacity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and a sample invocation:&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                      &lt;span class=&quot;nl&quot;&gt;withOffset:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;nl&quot;&gt;radius:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;
                      &lt;span class=&quot;nl&quot;&gt;opacity:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s ultimately the same amount of lines—&lt;em&gt;if you are hard line wrapping like I am&lt;/em&gt;—however now we have autocompletion and tabbing.&lt;/p&gt;

&lt;p&gt;The next step would be to add some sensible defaults and convenience methods. I added one to our new category, for example:&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGSize&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DS_DEFAULT_OFFSET&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DS_DEFAULT_RADIUS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DS_DEFAULT_OPACITY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;color&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;withOffset:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DS_DEFAULT_OFFSET&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;radius:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DS_DEFAULT_RADIUS&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;opacity:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DS_DEFAULT_OPACITY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now I can add shadows like this:&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;btnRollTheDice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lblChampionName&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addDropShadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&lt;/span&gt;
                      &lt;span class=&quot;nl&quot;&gt;withOffset:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;nl&quot;&gt;radius:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;
                      &lt;span class=&quot;nl&quot;&gt;opacity:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Learn more about &lt;a href=&quot;http://stackoverflow.com/questions/12268706/cgsizemake-doesnt-work-for-constant&quot;&gt;const CGStruct&lt;/a&gt; and the possible caveats of using the initializer list.&lt;/p&gt;

&lt;p&gt;If you wanted to, you could probably add some sort of class methods to change the defaults, that way you could on a per-project basis change your default shadow arguments without too much trouble. But I won’t go into that for now.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Debugging Cordova</title>
   <link href="https://otaku-elite.com/code/2014/11/06/debugging-cordova/"/>
   <updated>2014-11-06T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/11/06/debugging-cordova</id>
   <content type="html">&lt;p&gt;I had to revisit an old project today that was built on &lt;a href=&quot;http://cordova.apache.org/&quot;&gt;Cordova&lt;/a&gt; and &lt;a href=&quot;http://app-framework-software.intel.com/&quot;&gt;App Framework&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It was like hell reacquainting myself with the application and I’m still not through, but I thought I’d post a few quick references that helped me along the way.&lt;/p&gt;

&lt;h2 id=&quot;app-cache&quot;&gt;App Cache&lt;/h2&gt;
&lt;p&gt;Since our App uses HTML5 &lt;a href=&quot;http://www.w3schools.com/html/html5_app_cache.asp&quot;&gt;Application Cache&lt;/a&gt; and one of our greatest assets in Cordova development is Google Chrome and its robust set of dev tools, I needed a way to &lt;a href=&quot;http://imwill.com/how-clear-html5-app-cache-chrome/#.VFvdN4fF84S&quot;&gt;clear the app cache in Google Chrome&lt;/a&gt;. Which I found is possble by navigating your browser to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chrome://appcache-internals/&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;android-chrome-dev-tools&quot;&gt;Android-Chrome Dev Tools&lt;/h2&gt;
&lt;p&gt;I also found out with &lt;a href=&quot;https://developer.chrome.com/devtools/docs/remote-debugging#setting-up-device&quot;&gt;USB Debugging enabled&lt;/a&gt; you can &lt;a href=&quot;https://developer.chrome.com/devtools/docs/remote-debugging#debugging-webviews&quot;&gt;remotely debug WebViews on android&lt;/a&gt;, but it might require additional code:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SDK_INT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;VERSION_CODES&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;KITKAT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;WebView&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setWebContentsDebuggingEnabled&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For debuggable mode only use the following:&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SDK_INT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;VERSION_CODES&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;KITKAT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getApplicationInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;flags&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;FLAG_DEBUGGABLE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;WebView&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setWebContentsDebuggingEnabled&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then you can open chrome to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chrome://inspect&lt;/code&gt; and select the device from a list and poke around using Chrome dev tools to mess with JavaScript or CSS on your device on the fly. Another advantage–&lt;em&gt;this one’s my favorite&lt;/em&gt;–you can refresh the embedded WebView with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;⌘ + R&lt;/code&gt; (or I guess &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl-R&lt;/code&gt; for windows) from the chrome inspector.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Finding The Right Objective C Singleton Idiom</title>
   <link href="https://otaku-elite.com/code/2014/11/04/finding-the-right-objective-c-singleton-idiom/"/>
   <updated>2014-11-04T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/11/04/finding-the-right-objective-c-singleton-idiom</id>
   <content type="html">&lt;p&gt;In our app at work we use singletons in a few places. But when you search google for you get mixed answers for the right way to implement it.&lt;/p&gt;

&lt;p&gt;I became curious as to what the &lt;em&gt;proper&lt;/em&gt; way to accomplish this is, and I did some searching. I eventually found the solution and explanation I was searching for in addition to some really good reasons not to use singletons at all. So I’ll discuss all of that right here.&lt;/p&gt;

&lt;p&gt;#Method 1. @synchronize
When I was doing my original search this seemed to be the most popular answer. This is the way it was implemented in many places in the app.&lt;/p&gt;

&lt;h2 id=&quot;header-file&quot;&gt;header file&lt;/h2&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;
#import &amp;lt;FacebookSDK/FacebookSDK.h&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;INTUser&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;NSObject&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@property&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nonatomic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facebookId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@property&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nonatomic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;readonly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facebookBirthday&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@property&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nonatomic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;readonly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facebookName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... some other code here ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instancetype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... some more code here to access/modify the object ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;implementation-file&quot;&gt;implementation file&lt;/h2&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;INTUser&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... some other code here ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instancetype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;INTUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selfUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;@synchronized&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selfUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;selfUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;alloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selfUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... some more code ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;usage&quot;&gt;usage&lt;/h2&gt;
&lt;p&gt;Then we use it like this…&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;INTUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INTUser&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##how it works
From the Apple documentation regarding the &lt;a href=&quot;https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW3&quot;&gt;@synchronized directive&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The @synchronized directive is a convenient way to create mutex locks on the fly in Objective-C code. The @synchronized directive does what any other mutex lock would do—it prevents different threads from acquiring the same lock at the same time. In this case, however, you do not have to create the mutex or lock object directly. Instead, you simply use any Objective-C object as a lock token, as shown in the following example:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;myMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;anObj&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;@synchronized&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anObj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// Everything between the braces is protected by the @synchronized directive.&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We create a mutex using Apple’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronized&lt;/code&gt; directive to prevent anyone else from setting ourself (&lt;em&gt;say what?&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;Some sources claim that this method is slow, and that when you pass &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nil&lt;/code&gt;—which would essentially happen the first run through—the mutex is actually doing nothing.&lt;/p&gt;

&lt;p&gt;I haven’t been able to uncover anything &lt;em&gt;specifically&lt;/em&gt; mentioning that you can’t use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronized&lt;/code&gt; directive on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self&lt;/code&gt; or its behavior when you pass &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nil&lt;/code&gt;, but I did find some evidence that it &lt;em&gt;might&lt;/em&gt; be slow. Which is really just Apple making a generic statement about &lt;a href=&quot;https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW7&quot;&gt;thread synchronization&lt;/a&gt; as a whole:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Synchronization tools are a useful way to make your code thread-safe, but they are not a panacea. Used too much, locks and other types of synchronization primitives can actually decrease your application’s threaded performance compared to its non-threaded performance. Finding the right balance between safety and performance is an art that takes experience. The following sections provide tips to help you choose the appropriate level of synchronization for your application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Apple’s documentation continues under a section titled &lt;a href=&quot;https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW7&quot;&gt;Avoid Synchronization Altogether&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Avoid Synchronization Altogether
For any new projects you work on, and even for existing projects, designing your code and data structures to avoid the need for synchronization is the best possible solution. Although locks and other synchronization tools are useful, they do impact the performance of any application. And if the overall design causes high contention among specific resources, your threads could be waiting even longer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;The best way to implement concurrency is to reduce the interactions and inter-dependencies between your concurrent tasks. If each task operates on its own private data set, it does not need to protect that data using locks. Even in situations where two tasks do share a common data set, you can look at ways of partitioning that set or providing each task with its own copy. Of course, copying data sets has its costs too, so you have to weigh those costs against the costs of synchronization before making your decision.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So it seems like the general message here is to avoid using synchronization wherever possible.&lt;/p&gt;

&lt;h1 id=&quot;method-2-dispatch_once&quot;&gt;Method 2. dispatch_once&lt;/h1&gt;

&lt;p&gt;After finding more recent results from rewording my search terms, I came across the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt; method, which replaces the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronize&lt;/code&gt; directive with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;header-file-1&quot;&gt;header file&lt;/h2&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;INTHomePresenter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;NSObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INTHomeModuleInterface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CLLocationManagerDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@property&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nonatomic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;INTHomeViewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;homeView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;presentSearchFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIViewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;viewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... other code ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instancetype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sharedInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;implementation&quot;&gt;implementation&lt;/h2&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;INTHomePresenter&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... other stuff ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instancetype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sharedInstance&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatch_once_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sharedInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;dispatch_once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sharedInstance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;alloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sharedInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//... other stuff ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;usage-1&quot;&gt;usage&lt;/h2&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INTHomePresenter&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sharedInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;presentSearchFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nav&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;how-it-works&quot;&gt;how it works&lt;/h2&gt;
&lt;p&gt;We replace the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronize&lt;/code&gt; directive with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt; guarantees us that this code will only be fired once, and other threads should be blocked from this as well, which is important because we only want this code to fire once, even if it’s hit by two separate threads. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt; is also synchronous.&lt;/p&gt;

&lt;p&gt;It is recommended to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt; because it is much faster than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronized&lt;/code&gt; and it is also more clear that not only do we want our code to be thread safe, but more importantly we only want this code block to be executed one time during our program’s execution. Even if we used the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronized&lt;/code&gt; method, the if statement would still be evaluated every time we call our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sharedInstance:&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;The method naming convention also changed (at least from the examples that I found) to a more specific name, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sharedInstance:&lt;/code&gt;. This lets us know that it is retrieving an instance of the class and the instance it retrieves will be shared across the application.&lt;/p&gt;

&lt;p&gt;There’s also a &lt;a href=&quot;http://stackoverflow.com/questions/9119042/why-does-apple-recommend-to-use-dispatch-once-for-implementing-the-singleton-pat&quot;&gt;discussion on stackoverflow&lt;/a&gt; that confirms the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt; method is actually a replacement for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@synchronized&lt;/code&gt; idiom, and may offer some added value from a short read.&lt;/p&gt;

&lt;p&gt;If you care to learn more about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt; I found a blog article that reveals &lt;a href=&quot;https://mikeash.com/pyblog/friday-qa-2014-06-06-secrets-of-dispatch_once.html&quot;&gt;the secrets of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dispatch_once&lt;/code&gt;&lt;/a&gt;. Which was a little bit more than I cared to read about.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;After getting all hung up with the proper way to implement a singleton, I stumbled across another article titled &lt;a href=&quot;http://www.objc.io/issue-13/singletons.html&quot;&gt;Avoid Singleton Abuse&lt;/a&gt;, which talks about why using a singleton in general might be a bad idea. He also talks about using &lt;a href=&quot;http://www.objc.io/issue-15/dependency-injection.html&quot;&gt;dependency injection&lt;/a&gt; as a plausible solution to using too many singletons.&lt;/p&gt;

&lt;p&gt;He explains that in most cases even though when we are starting the development of our application we tend to believe, “Oh I will only ever have one instance of &lt;em&gt;this&lt;/em&gt; object,” a lot of the times we update our applications in ways that prove us wrong. So it’s important to realize that &lt;em&gt;a singleton is a global scope in sheep’s clothing.&lt;/em&gt; Be aware that it will create application states that will have to be maintained if there is ever a change to the behavior of that application.&lt;/p&gt;

&lt;p&gt;After sifting through those last two blog posts I came to the conclusion that I could have probably better resolved my original issue with the use of &lt;abbr title=&quot;Dependency Injection&quot;&gt;DI&lt;/abbr&gt; by injecting through a constructor, and I will probably be looking to update this code in the near future.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>5 Things I Wish I Knew About When I Started iOS Development</title>
   <link href="https://otaku-elite.com/code/2014/10/29/5-things-i-wish-i-knew-when-i-started-ios-development/"/>
   <updated>2014-10-29T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/10/29/5-things-i-wish-i-knew-when-i-started-ios-development</id>
   <content type="html">&lt;p&gt;There are 5 things I &lt;em&gt;really&lt;/em&gt; wish I knew about when I started ios development. If you’re just getting into it now, I think it will help. So let’s jump in.&lt;/p&gt;

&lt;h1 id=&quot;1-constraints-constraints-constraints&quot;&gt;1. Constraints, Constraints, Constraints!&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/2014/10/30/constraints-project.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2014/10/30/constraints.gif&quot; style=&quot;float: right; margin-left: 10px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Constraints are a very important aspect of Objective-C programming as far as GUI is concerned. They allow you to position and size the elements—known as views—on the screen. This is an extremely painful to understand topic when you are first getting to know it.&lt;/p&gt;

&lt;p&gt;There are multiple ways of making constraints. For learning purposes I recommend using &lt;strong&gt;Interface Builder&lt;/strong&gt; to play around with them this will give you the quickest, most interactive/visual way to understand how constraints behave.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2014/10/30/constraints-warnings.png&quot; style=&quot;float: left; margin-right: 10px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you are applying constraints programmatically and running into issues, I always recommend to keep a scrap &lt;em&gt;constraints&lt;/em&gt; project available and use it to &lt;em&gt;reenact&lt;/em&gt; or stage the same issues you are experiencing with your constraints in code. This will give you a more visual way to troubleshoot them.&lt;/p&gt;

&lt;p&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With the coming of iOS 8 there is a new debugger tool for constraints that can be used as well, but it only works when you are running the simulator for iOS 8 or higher, so if you’re targeting iOS 7 still it won’t help for much.&lt;/p&gt;

&lt;p&gt;If you are creating constraints programmatically you should also have a quick read through &lt;a href=&quot;http://www.thinkandbuild.it/learn-to-love-auto-layout-programmatically/&quot;&gt;LEARN TO LOVE AUTO LAYOUT… PROGRAMMATICALLY&lt;/a&gt;. It will teach you &lt;abbr title=&quot;Visual Format Language&quot;&gt;VFL&lt;/abbr&gt;. If you can understand &lt;em&gt;VFL&lt;/em&gt;, then you will gain a better understanding from the output window when your app is suddenly “Unable to simultaneously satisfy constraints:”&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don&apos;t want. Try this: (1) look at each constraint and try to figure out which you don&apos;t expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you&apos;re seeing NSAutoresizingMaskLayoutConstraints that you don&apos;t understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    &quot;&amp;lt;NSLayoutConstraint:0x7f9cf2e5bdf0 V:[UIButton:0x7f9cf2e60090(30)]&amp;gt;&quot;,
    &quot;&amp;lt;NSLayoutConstraint:0x7f9cf2c8d5d0 V:[UIView:0x7f9cf2c8d620(30)]&amp;gt;&quot;,
    &quot;&amp;lt;NSLayoutConstraint:0x7f9cf2c8d8f0 V:|-(0)-[UIButton:0x7f9cf2e60090]   (Names: &apos;|&apos;:UIView:0x7f9cf2c8d620 )&amp;gt;&quot;,
    &quot;&amp;lt;NSLayoutConstraint:0x7f9cf2c8d990 V:[UICollectionView:0x7f9cf4861000]-(0)-|   (Names: &apos;|&apos;:UIView:0x7f9cf2c8d620 )&amp;gt;&quot;,
    &quot;&amp;lt;NSLayoutConstraint:0x7f9cf2c8d9e0 V:[UIButton:0x7f9cf2e60090]-(2)-[UICollectionView:0x7f9cf4861000]&amp;gt;&quot;
)

Will attempt to recover by breaking constraint 
&amp;lt;NSLayoutConstraint:0x7f9cf2e5bdf0 V:[UIButton:0x7f9cf2e60090(30)]&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;2-use-simpler-modern-objective-c-syntax&quot;&gt;2. Use Simpler, &lt;em&gt;Modern&lt;/em&gt; Objective-C Syntax&lt;/h1&gt;
&lt;p&gt;Use &lt;em&gt;&lt;a href=&quot;https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html&quot;&gt;Modern Objective-C&lt;/a&gt;&lt;/em&gt; wherever possible. This includes cleaning up a lot of horrible readability issues with subscripting and literals, but also addresses management of class properties using the &lt;a href=&quot;#properties&quot;&gt;@property&lt;/a&gt; keyword.&lt;/p&gt;

&lt;h2 id=&quot;subscripting&quot;&gt;Subscripting&lt;/h2&gt;

&lt;h3 id=&quot;before&quot;&gt;before&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;profiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;profile&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectAtIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indexPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;after&quot;&gt;after&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;profiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;profile&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indexPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you don’t want to convert your project manually Xcode provides a refactoring tool for this that will run over your whole project (&lt;strong&gt;Edit&lt;/strong&gt; &amp;gt; &lt;strong&gt;Refactor&lt;/strong&gt; &amp;gt; &lt;strong&gt;Convert to Modern Objective-C Syntax…&lt;/strong&gt;).&lt;/p&gt;

&lt;h2 id=&quot;literals&quot;&gt;Literals&lt;/h2&gt;

&lt;h3 id=&quot;before-1&quot;&gt;before&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Flurry&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;logEvent:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Purchase Intend&quot;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;withParameters:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;dictionaryWithObjectsAndKeys:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;productId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;@&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Util&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getDeviceId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;@&quot;deviceId&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;after-1&quot;&gt;after&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Flurry&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;logEvent:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Purchase Intend&quot;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;withParameters:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;@{&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;@&quot;id&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;productId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;@&quot;deviceId&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Util&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getDeviceId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;before-2&quot;&gt;before&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GALog&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;LogEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;history&quot;&lt;/span&gt;
     &lt;span class=&quot;nl&quot;&gt;withAction:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;profile&quot;&lt;/span&gt;
      &lt;span class=&quot;nl&quot;&gt;withValue:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSNumber&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;numberWithInteger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indexPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;after-2&quot;&gt;after&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GALog&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;LogEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;history&quot;&lt;/span&gt;
         &lt;span class=&quot;nl&quot;&gt;withAction:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;clear&quot;&lt;/span&gt;
          &lt;span class=&quot;nl&quot;&gt;withValue:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indexPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;3-use-property-where-applicable&quot;&gt;3. Use &lt;a name=&quot;properties&quot;&gt;@property&lt;/a&gt; where applicable&lt;/h1&gt;
&lt;p&gt;This is still technically a part of modern objective-c, but I felt it was important enough to call it out as a separate bulletpoint.&lt;/p&gt;

&lt;p&gt;It’s important to understand that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@property&lt;/code&gt; is just a way to automatically generate a setter, getter, and an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ivar&lt;/code&gt; and that these things are named based on convention.&lt;/p&gt;

&lt;p&gt;When I started I had no idea that implementing a method called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setId:&lt;/code&gt;, which accepts an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSString&lt;/code&gt; would allow me to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object.id = @&quot;something&quot;&lt;/code&gt; in addition to the more obvious, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[object setId:@&quot;something&quot;];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here’s my short example:&lt;/p&gt;

&lt;h2 id=&quot;before-3&quot;&gt;before&lt;/h2&gt;

&lt;h3 id=&quot;personh&quot;&gt;Person.h&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;NSObject&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;personm&quot;&gt;Person.m&lt;/h3&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &quot;Person.h&quot;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;implementation&quot;&gt;implementation&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bob&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bob&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Bob&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Name: %@&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bob&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//prints Name: Bob&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jill&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;jill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;Jill&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Name: %@&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//prints: Name: Jill&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//both of these work with same class implementation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;after-3&quot;&gt;after&lt;/h2&gt;

&lt;h3 id=&quot;personh-1&quot;&gt;Person.h&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;NSObject&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@property&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nonatomic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;personm-1&quot;&gt;Person.m&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#import &quot;Person.h&quot;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;implementation-1&quot;&gt;implementation&lt;/h3&gt;
&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bob&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bob&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Bob&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Name: %@&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bob&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//prints Name: Bob&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jill&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;jill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;Jill&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;Name: %@&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//prints: Name: Jill&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//same code, still works both ways&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;side-note&quot;&gt;Side note&lt;/h2&gt;
&lt;p&gt;It should also be noted that since &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@property&lt;/code&gt; is generating iVars, the private variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_name&lt;/code&gt; can still be accessed using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_name&lt;/code&gt;. However, when using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self.name&lt;/code&gt; (from within the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Person&lt;/code&gt; class) we are actually making a call to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt; method to retrieve our name and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setName:&lt;/code&gt; method to assign the value, instead of retrieving/assigning them directly.&lt;/p&gt;

&lt;h1 id=&quot;4-advanced-breakpoints&quot;&gt;4. Advanced Breakpoints&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/2014/10/30/advanced-breakpoints-assignment.gif&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Xcode has a lot of shortcomings, there are lots of things that I hate about it—and I &lt;em&gt;do&lt;/em&gt; complain daily—however, discovering some of the debugger’s power has me seeing Xcode in a &lt;em&gt;slightly&lt;/em&gt; different light.&lt;/p&gt;

&lt;p&gt;Using the Xcode breakpoints you can inspect or even &lt;em&gt;inject&lt;/em&gt; values in your code and allow the application to continue over that breakpoint automatically. This allows easier testing for different values and gives you a really nice tool for debugging weird issues in your app. Use it.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Create a breakpoint&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Right Click&lt;/strong&gt; &amp;gt; &lt;strong&gt;Edit Breakpoint…&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Add action&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Then check &lt;strong&gt;Automatically continue after evaluating actions&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;5-viper&quot;&gt;5. VIPER&lt;/h1&gt;

&lt;p&gt;&lt;abbr title=&quot;View Interactor Presenter Entity Routing&quot;&gt;VIPER&lt;/abbr&gt; is an iOS application architecture that will help you get better organized for large projects and teams.&lt;/p&gt;

&lt;p&gt;I’m not going to preach to everyone and say that you absolutely must incorporate &lt;a href=&quot;http://www.objc.io/issue-13/viper.html&quot;&gt;VIPER&lt;/a&gt; and strictly adhere to their guidelines for all of your projects, but I &lt;em&gt;do&lt;/em&gt; believe that giving the article a thorough read—or two or three—will change the way you think about iOS programming when it comes to architecting your apps.&lt;/p&gt;

&lt;p&gt;Again, the main point here is not to &lt;em&gt;use&lt;/em&gt; VIPER, necessarily, but to spark your own creativity and help break you free from the ubiquitous &lt;strong&gt;M&lt;/strong&gt;assive &lt;strong&gt;V&lt;/strong&gt;iew &lt;strong&gt;C&lt;/strong&gt;ontroller that they mention early on in the article. Just because iOS is using a “ViewController” as a core mechanism does not necessarily tie you to implementing both functionalities (view and controller) in the same place.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Help! My iPhone Contacts Won't Sync!</title>
   <link href="https://otaku-elite.com/blog/2014/06/26/help!-my-iphone-contacts-won't-sync!/"/>
   <updated>2014-06-26T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2014/06/26/help!-my-iphone-contacts-won't-sync!</id>
   <content type="html">&lt;p&gt;Today I installed iOS 8 beta 2. After installing, my contacts were gone and absolutely refused to sync from the Exchange account I had set up for my gmail.&lt;/p&gt;

&lt;p&gt;I’m going to teach you how to fix the sync issue and a bunch of other tricks I picked up along the way.&lt;/p&gt;

&lt;p&gt;#The Fix&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In &lt;em&gt;Settings&lt;/em&gt; &amp;gt; &lt;em&gt;General&lt;/em&gt; &amp;gt; &lt;em&gt;Mail, Contacts, Calendar&lt;/em&gt; select &lt;strong&gt;Add an Account…&lt;/strong&gt;
&lt;img src=&quot;/images/2014/06/26/2-add-account.png&quot; width=&quot;320&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Select &lt;strong&gt;other&lt;/strong&gt;&lt;br /&gt;
&lt;img src=&quot;/images/2014/06/26/3-other.png&quot; width=&quot;320&quot; /&gt;&lt;br /&gt;
3 Select &lt;strong&gt;Add CardDAV Account&lt;/strong&gt;.&lt;br /&gt;
Enter &lt;em&gt;google.com&lt;/em&gt; for the server.&lt;br /&gt;
and &lt;em&gt;your full gmail email address&lt;/em&gt; as the &lt;em&gt;User Name&lt;/em&gt;
&lt;img src=&quot;/images/2014/06/26/4-carddav.png&quot; width=&quot;320&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Follow the remaining steps (if any, I don’t remember exactly) and your contacts should start to sync immediately.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Doing this also unlocks a new &lt;em&gt;Default Account&lt;/em&gt; option in the &lt;em&gt;Contacts&lt;/em&gt; section of the &lt;em&gt;Mail, Contacts, Calendars&lt;/em&gt; screen for the account that you just created.&lt;/p&gt;

&lt;p&gt;I’m still trying to figure out if it’s possiblet to sync to both Gmail and iCloud at the same time, but right now I’m unsure.&lt;/p&gt;

&lt;p&gt;#Neat tricks
What I did find out though, is that if you log into your gmail at &lt;a href=&quot;http://gmail.com&quot;&gt;gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Select &lt;strong&gt;Contacts&lt;/strong&gt; from the &lt;em&gt;Gmail&lt;/em&gt; menu.&lt;br /&gt;
&lt;img src=&quot;/images/2014/06/26/1-gmail-contacts.png&quot; width=&quot;135&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;You will be able to select &lt;em&gt;More&lt;/em&gt; &amp;gt; &lt;em&gt;Export …&lt;/em&gt; &lt;br /&gt;
&lt;img src=&quot;/images/2014/06/26/2-export.png&quot; width=&quot;231&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;and export to a format that iContact will understand and import that using your Mac’s &lt;em&gt;Contacts&lt;/em&gt; app!&lt;br /&gt;
&lt;img src=&quot;/images/2014/06/26/3-export-options.png&quot; width=&quot;502&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;いいね？！ Pretty sweet, huh?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Homebrew Packages Not Found After Upgrading OS X</title>
   <link href="https://otaku-elite.com/osx/2014/06/10/homebrew-packages-not-found-after-upgrading-os-x/"/>
   <updated>2014-06-10T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/osx/2014/06/10/homebrew-packages-not-found-after-upgrading-os-x</id>
   <content type="html">&lt;p&gt;Today at work I ran into a really irritating issue. None of my installed &lt;a href=&quot;http://brew.sh/&quot;&gt;homebrew&lt;/a&gt; packages were found and when I tried to install them again using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew install&lt;/code&gt; it told me they were already installed. My paths all checked out fine and I couldn’t figure out what the problem was.&lt;/p&gt;

&lt;p&gt;Then I realized that this all happened &lt;strong&gt;after upgrading OS X&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;#How to fix a broken homebrew install after upgrading OS X&lt;/p&gt;

&lt;p&gt;The trick to fixing homebrew after upgrading OS X is a script I found in &lt;a href=&quot;http://apple.stackexchange.com/questions/85480/how-should-i-fix-my-homebrew-installation-after-upgrading-os-x#123234&quot;&gt;this stackexchange post&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;FORMULAS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;brew list&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;FORMULA &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FORMULAS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[@]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;do 
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;brew unlink &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FORMULA&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;brew link &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FORMULA&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;brew &lt;span class=&quot;nb&quot;&gt;unlink&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$FORMULA&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$OUTPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;brew &lt;span class=&quot;nb&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$FORMULA&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$OUTPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This solved the issue for me, and if that doesn’t work it was suggested to uninstall and reinstall all packages using the following:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew list &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; brew-list.txt
brew uninstall &amp;lt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;brew-list.txt&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &amp;lt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;brew-list.txt&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which appears way more time consuming, so I would only use that as a last resort.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>XCode Opens Storyboard as XML</title>
   <link href="https://otaku-elite.com/code/2014/06/03/xcode-opens-storyboard-as-xml/"/>
   <updated>2014-06-03T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/06/03/xcode-opens-storyboard-as-xml</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/2014/06/03/1-xcode-xml@2x.png&quot; width=&quot;540px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you’ve just run into a problem where your storyboard or UI files in XCode open in a code editor it can be tedious to figure out what the problem is.&lt;/p&gt;

&lt;p&gt;The first time this happened to me I was getting compiler warnings on my storyboard file, and I thought this was causing the problem. As it turns out–that had nothing to do with it. I don’t know what triggered this to be the default behavior but the solution is easier than it seems.&lt;/p&gt;

&lt;p&gt;Just &lt;strong&gt;Right-Click&lt;/strong&gt; your storyboard in the &lt;em&gt;Project Naviator&lt;/em&gt; and click &lt;strong&gt;Open As… &amp;gt; Interface Builder - iOS Storyboard&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2014/06/03/2-open-as-interface@2x.png&quot; width=&quot;602px&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Preparing for iOS Development</title>
   <link href="https://otaku-elite.com/code/2014/06/01/preparing-for-ios-development/"/>
   <updated>2014-06-01T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/06/01/preparing-for-ios-development</id>
   <content type="html">&lt;p&gt;Soon I’ll begin blogging more and more about iOS development. I hate XCode. Here are a few things to help get us started:&lt;/p&gt;

&lt;h1 id=&quot;xvim&quot;&gt;XVim&lt;/h1&gt;
&lt;p&gt;If you’re an absolute vim addict, such as myself, then pretty much everything you do on your computer is goverened by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hjlk&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/JugglerShu/XVim&quot;&gt;XVim&lt;/a&gt; is an XCode plugin that will bring vim keybindings to your XCode. This helps make things a &lt;em&gt;little bit&lt;/em&gt; more bearable for me. I still have other issues with XCode, like the way that XCode’s interface seems to randomly change itself based on what you’re doing to “accommodate” you better, but this helps ease the pain a little… for me :)&lt;/p&gt;

&lt;p&gt;Follow the directions to install:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;download the code&lt;/li&gt;
  &lt;li&gt;change the target&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;XVim will build itself into the appropriate location. You may have to restart XCode after.&lt;/p&gt;

&lt;p&gt;If you get an error like:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;error: garbage collection is no longer supported
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then you are probably trying to compile the XCode 4 version on XCode 5. Make sure to switch the build target.
Also make sure to click &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Edit Schemes...&lt;/code&gt; and select &lt;strong&gt;Release&lt;/strong&gt;&lt;/p&gt;

&lt;h1 id=&quot;color-themes&quot;&gt;Color Themes&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/2014/06/02/1-color-scheme@2x.png&quot; width=&quot;540px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Another important aspect for me to start coding is having a color theme that’s easy on my eyes.
I hate Visual Studio in the same way I don’t like most IDEs. But one thing I do like about Visual Studio is the &lt;strong&gt;Obsidian&lt;/strong&gt; color theme. Because I did a little research before I already knew there was one available for XCode. You can grab the &lt;a href=&quot;https://gist.github.com/subdigital/837656&quot;&gt;Obsidian XCode Theme&lt;/a&gt; from a GitHub gist. If you’re on XCode 4+ (which you probably should be if you’re reading this now) you can use this magic one-liner to install it (&lt;em&gt;I’m gonna love myself for this later!&lt;/em&gt;):&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; ~/Library/Developer/Xcode/UserData/FontAndColorThemes &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; https://gist.githubusercontent.com/subdigital/837656/raw/9a97509e573b2ad9cbb3e48a1e56f6fdf5bb1c49/ObsidianCode.dvtcolortheme
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The font’s a little too big for me (Menlo 18pt) so I change the font size to 10pt and disable antialiasing from OS X on fonts under that size. Right now, I’m not sure how to disable the antialiasing on Retina displays (or if it’s even possible) but from what I remember, this should handle it on non-retina displays:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled &lt;span class=&quot;nt&quot;&gt;-bool&lt;/span&gt; YES
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;hex-colorpicker&quot;&gt;Hex ColorPicker&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/2014/06/02/2-color-picker@2x.png&quot; width=&quot;215px&quot; style=&quot;float: left; margin-right: 15px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://wafflesoftware.net/hexpicker/&quot;&gt;The Hex ColorPicker&lt;/a&gt; is an extension to the built in OS X color picker and it will allow you to enter a hex value on any color picker. It’s very useful in XCode if you are using the interface builder at all and makes creating custom color palettes easier in OS X as well.&lt;/p&gt;

&lt;p&gt;To install, copy the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HexColorPicker.colorPicker&lt;/code&gt; to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/Library/ColorPickers&lt;/code&gt; directory. If it doesn’t exist, create it.&lt;/p&gt;

&lt;p&gt;After that you might have to restart any applications you want to have the color picker available in.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h1 id=&quot;tips-for-development&quot;&gt;Tips for Development&lt;/h1&gt;

&lt;h2 id=&quot;cmd--shift--o&quot;&gt;CMD + Shift + O&lt;/h2&gt;
&lt;p&gt;CMD + Shift + O. This keyboard shortcut will open any file or symbol in the current project or workspace, just start typing the name and it will come up. Pressing &lt;strong&gt;enter* will open the file. Pressing **alt + enter&lt;/strong&gt; will open the file in a split pane (but always on the Assistant Panel).&lt;/p&gt;

&lt;h2 id=&quot;swapping-capslock-and-ctrl-keys&quot;&gt;Swapping Capslock and Ctrl keys&lt;/h2&gt;
&lt;p&gt;Something I recommend to anyone developing on any platform is to swap your CTRL and Capslock keys. Is there any time you really even need the capslock key? I know I never use it.&lt;/p&gt;

&lt;p&gt;Some keyboards (like &lt;a href=&quot;http://www.wasdkeyboards.com/&quot;&gt;WASDKeyboards&lt;/a&gt; and &lt;a href=&quot;http://www.duckychannel.com.tw/en/&quot;&gt;Ducky&lt;/a&gt;) have dip switches underneath to toggle functionality of these keys on/off and swap them. This is the best way to assign Capslock to CTRL, but of course it’s not the only way. OS X also allows you to change this yourself from &lt;strong&gt;System Preferences&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Under &lt;strong&gt;System Preferences &amp;gt; Keyboard&lt;/strong&gt; select &lt;em&gt;*Modifier Keys…&lt;/em&gt; and swap to your heart’s desire:
&lt;img src=&quot;/images/2014/06/02/3-control-key@2x.png&quot; width=&quot;782px&quot; /&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Open Random File Command Line Osx</title>
   <link href="https://otaku-elite.com/blog/2014/04/20/open-random-file-command-line-osx/"/>
   <updated>2014-04-20T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2014/04/20/open-random-file-command-line-osx</id>
   <content type="html">&lt;p&gt;Ever want to select a random file on the command line? Or just randomize anything? Well it’s possible using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shuf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shuf&lt;/code&gt; command to shuffle any input from stdin. Use&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;shuf&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;to pull a random file. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-n1&lt;/code&gt; switch tells shuf to select only the first file. Without it you’ll get a totally randomized list of the entire directory. Neat!&lt;/p&gt;

&lt;h1 id=&quot;background&quot;&gt;Background&lt;/h1&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shuf&lt;/code&gt; is a utility from GNU &lt;strong&gt;coreutils&lt;/strong&gt;. It &lt;em&gt;should&lt;/em&gt; be available out of the box on any regular linux install, but for OS X you will have to take an extra step.&lt;/p&gt;

&lt;h2 id=&quot;os-x&quot;&gt;OS X&lt;/h2&gt;
&lt;p&gt;On OS X, coreutils can be installed on the commandline using &lt;a href=&quot;http://brew.sh/&quot;&gt;homebrew&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;coreutils
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;important-note-for-osx&quot;&gt;Important Note for OSX&lt;/h3&gt;
&lt;p&gt;Now that coreutils is installed you can call each coreutils application by its &lt;em&gt;prefixed&lt;/em&gt; name, just add a &lt;strong&gt;g&lt;/strong&gt; in front:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; | gshuf &lt;span class=&quot;nt&quot;&gt;-n1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;chain-it&quot;&gt;Chain it&lt;/h1&gt;
&lt;p&gt;You can use the output of this command to send it to other applications.
For example, on OS X we can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;open&lt;/code&gt; command to actually &lt;em&gt;open&lt;/em&gt; the random file we’ve selected:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;open &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; | gshuf &lt;span class=&quot;nt&quot;&gt;-n1&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Gurai VS. Goro: The Final Showdown</title>
   <link href="https://otaku-elite.com/japanese/2014/03/22/goro-vs.-gurai/"/>
   <updated>2014-03-22T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2014/03/22/goro-vs.-gurai</id>
   <content type="html">Most of my Japanese I&apos;ve picked up simply from talking to native speakers in Japanese. Asking them to repeat themselves a few hundred times, texting on &quot;LINE&quot;:http://line.me/en/ and using my favorite iPhone Japanese Dictionary &quot;imiwa?&quot;:https://itunes.apple.com/us/app/imiwa-japanese-dictionary/id288499125?mt=8.

One thing I picked up rather quickly was the use of くらい or ぐらい, which means &quot;about&quot; as in an approximation. For example if I was talking to a friend about going to the mall or a movie and they asked me how far it is I could tell them,

bq. 車で１５分ぐらい。&lt;br&gt;
&quot;By car, about 15 minutes.&quot;&quot;

For a while I was also misusing くらい or ぐらい when telling that something will happen at _around_ a certain time. For example if someone asked:

bq. パーティーは何時ですか？&lt;br&gt;
&quot;What time is the party?&quot;

I might answer:

bq. 午後８時ぐらい。&lt;br&gt;
&quot;Around 8PM&quot;

Finally corrected me and told me that ぐらい or くらい with a specific time is a no-no. Instead I should use ころ or ごろ in the same way, but I was understood.

So when a friend asks

bq. イベントは何時？&lt;br&gt;
&quot;What time is the event?&quot;

You should answer with ころ・ごろ:

bq. ８時ごろ

h2. Conclusion

Even though I was understood using the wrong word, it&apos;s probably a better idea to get it straight in my head. So you can use this small cheat sheet to help:

|_.日本語|_.When to use|_.Example|
|ころ・ごろ|use with specific time|パーティー何時ですか？&lt;br&gt;*８時ごろです*|
|くらい・ぐらい|use with a _duration_ of time.|日本語はどのくらい勉強しますか？&lt;br&gt;*２年くらい*|

</content>
 </entry>
 
 <entry>
   <title>Going Angular</title>
   <link href="https://otaku-elite.com/code/2014/03/19/going-angular/"/>
   <updated>2014-03-19T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/03/19/going-angular</id>
   <content type="html">Lately at work I&apos;ve been doing a lot of research and not a lot of blogging. I am going to make an attempt over the course of the next few days to update my blog to reflect the massive amount of new stuff my brain has absorbed over the past few weeks.

h2. Background

The first thing I want to touch on is javascript. Our current mobile application is on the Apple App Store and the Android Market. What most people don&apos;t realize is that 90% of our code is javascript and html. 90% being a number solely fabricated in my mind, but I assure you the guts of the app is in fact JS, HTML and CSS.

This can be accomplished with the help of projects like &quot;Cordova&quot;:https://cordova.apache.org/ and &quot;PhoneGap&quot;:http://phonegap.com/ I won&apos;t go into detail to explain how these products work or how they are different, since the focus here is on the JS side.

We had a very loose code base that was mostly hand-written from scratch with the help of some mobile libraries like &quot;iScroll&quot;:http://cubiq.org/iscroll-5 and &quot;Intel&apos;s App Framework&quot;:http://app-framework-software.intel.com/, which continues to get better and better. Our application is very data-driven and so it completely centers around grabbing information from web services and displaying it to the users. The javascript code was a little bit sloppy since it was originally written very quickly, with many rewrites of huge chunks of the code, and not much refactoring was done. There was no unit testing or any way to check for broken code when big changes were made. This was gradually slowing us down over time. This combined with a poor code organization and overall bad practices left me craving for some kind of structure so I went on a one-week journey to explore alternative, _structured_ solutions: javascript frameworks.

h2. Possible solutions

I won&apos;t go into detail about all of what I found but it all led to a showdown between &quot;AngularJS&quot;:http://angularjs.org/ and &quot;Backbone.js&quot;:http://backbonejs.org/. We chose Angular. If you want to see about other options check out &quot;TodoMVC&quot;:http://todomvc.com/, a site dedicated to writing a todo app using javascript MVC libraries.

h2. Why Angular?

We chose angular _because_ the application was so heavily dependent on web services and Angular made this a breeze. In addition to the awesome support by Google and the rest of the community, the dependency injection and what appeared to be a wide enough adoption rate. AngularJS provides a lot of free functionality, and often times there is a solution available to common problems in the form of a community contributed AngularJS plugin.

Some examples of AngularJS plugins:

* Slide-In menus for mobile are possible using &quot;angular-snap&quot;:https://github.com/jtrussell/angular-snap.js, an AngularJS wrapper to &quot;Snap.js&quot;:https://github.com/jakiestfu/Snap.js.
* Mobile device touch gestures are possible with &quot;angular-gestures&quot;:https://github.com/wzr1337/angular-gestures, an AngularJS wrapper for &quot;Hammer.js&quot;:http://eightmedia.github.io/hammer.js/

h2. Angularing

So AngularJS by itself can be used just like a library, but like I said I was craving structure so I hunted around and found a couple of solutions.

h3. angular-seed

AngularJS references the &quot;angular-seed&quot;:https://github.com/angular/angular-seed project in their documentation. They created it and it is highly recommended (by them). I created our first prototype using angular-seed. It was great but there were a few things I didn&apos;t like about it. Here&apos;s a list of what I liked and hated:

h4. Cons

* Initial setup requires editing multiple files
* Default controller/services/filters/directives separation is hairy
* No build process

h5. Initial set up requires editing multiple files

Multiple files need to be edited for the initial set up (things like your project name and the module names and so on)


h5. Default set up for controllers and services is hairy

The default configuration puts all controllers into a single @controllers.js@ file. The same thing is done for @directives@, @filters@, and @services@. They claim this is because most applications are small enough to pull this off. I call bullshit. I think it&apos;s sloppy and I don&apos;t like it. Of course you&apos;re not locked into using that style, but separating things out _is_ an extra step, after all.

h5. There is no build process

I forgot to mention before that I was looking to have a build process. The type of thing that would allow me to lint my code, check it for errors, minify it and compress it, and have everything set for deployment. This isn&apos;t really a problem with AngularJS, it&apos;s just that out of the box it is missing.

h4. Pros

* Project skeleton organizes everything for you (it&apos;s pretty well organized)
* Fast kick start to your project
* Works out of the box
* Comes with sample unit tests out of the box!

I won&apos;t go into details about the pros --- but trust me, it&apos;s good! (Even though I did complain about it)

h3. Yeoman

Building with Yeoman is another option, but requires a lot of dependencies (on the development side).

So what is Yeoman? &quot;Yeoman&quot;:http://yeoman.io/ is a &quot;web scaffolding tool.&quot; Fancy mambo-jumbo aside, Yeoman is a project creation tool. It will create your project and help you manage it. It is a commandline tool so you cli junkies are gonna love it (_probably_).

Yeoman uses several other tools, namely &quot;Grunt&quot;:http://gruntjs.com/ and &quot;Bower&quot;:http://bower.io/ to give you a full development work flow. If you are unfamiliar with these, let me give you a quick introduction. *Grunt* is a build tool, you can think of Grunt as the GNU @make@ of javascript. *Bower* is a package manager. It will download packages for you, tracing their dependencies, and dump them out on to your filesystem in a directory (default is @bower_components/@).

Here&apos;s a quick guide I found to &quot;Automate AngularJS With Yeoman, Grunt &amp; Bower&quot;:http://newtriks.com/2013/06/11/automating-angularjs-with-yeoman-grunt-and-bower/, it&apos;s not my favorite but I can&apos;t find the link that I liked best at this time.

h4. Cons

* You have to install A LOT OF STUFF to get started
* Learning what tools serve what purpose and how to use them
* The default linter is @jshint@ (I prefer @gjslint@ for maximum control: you can suppress any linter message you want)
* The template code style might not agree with your linter out of the box


h4. Pros

* Handles project creation (adding controllers, models, etc is all automated)
* Has a build process (minifies your code and automatically makes appropriate replacements for you in your files)

h2. Conclusion

AngularJS is awesome, how you implement it is up to you. I don&apos;t have too much experience yet with the Yeoman method since I didn&apos;t find it until after prototyping using angular-seed. However, I do have a lot of faith that Yeoman is a good solution and I like the way it handles things for you.

Next time I will try to publish some guide of my own with some sample code. I&apos;ve also started learning objective-c and I will start posting on that as well.
</content>
 </entry>
 
 <entry>
   <title>What's Your Major?</title>
   <link href="https://otaku-elite.com/japanese/%E6%97%A5%E6%9C%AC%E8%AA%9E/2014/03/18/whats-your-major/"/>
   <updated>2014-03-18T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/japanese/%E6%97%A5%E6%9C%AC%E8%AA%9E/2014/03/18/whats-your-major</id>
   <content type="html">This is kind of embarrassing because it&apos;s something that I really should know but somehow I skipped over learning.

For today&apos;s blog post I&apos;m going to quickly review some vocabulary and phrases related to &quot;your major.&quot; Granted I&apos;m not a college student, but lots of my friends still are so it could come in handy.

h1. Vocabulary

h2. Subjects

These are subjects you can use in school to describe your classes or your
&lt;abbr title=&quot;せんこう&quot;&gt;専攻&lt;/abbr&gt;（major).


table(subjects).
|_.日本語|_.English|
|&lt;abbr title=&quot;かがく&quot;&gt;科学&lt;/abbr&gt;&lt;br&gt;かがく|science|
|&lt;abbr title=&quot;けいざい&quot;&gt;経済&lt;/abbr&gt;&lt;br&gt;けいざい|economics|
|&lt;abbr title=&quot;せいじ&quot;&gt;政治&lt;/abbr&gt;&lt;br&gt;せいじ|politics;&lt;br&gt;government|
|&lt;abbr title=&quot;ぶんがく&quot;&gt;文学&lt;/abbr&gt;&lt;br&gt;ぶんがく|literature|
|&lt;abbr title=&quot;れきし&quot;&gt;歴史&lt;/abbr&gt;&lt;br&gt;れきし|history|

And the word for professor is &lt;abbr title=&quot;きょうじゅ&quot;&gt;教授&lt;/abbr&gt;

h2. Putting it all together

So with this we can put together some simple sentences for practice:

table(sentences).
|_.日本語|_.English|
|専攻は何？&lt;br&gt;せんこうは　なに？|What is your major?|
|専攻は歴史です。&lt;br&gt;せんこうは　れきし　です|My major is history.|
|政治は詰まらないよ！&lt;br&gt;せいじは　つまらないよ！|Government is boring!|


More to come later! I&apos;ll try to keep them short and sweet :)</content>
 </entry>
 
 <entry>
   <title>Journaling In Japanese, Day 1</title>
   <link href="https://otaku-elite.com/blog/2014/03/04/journaling-in-japanese,-day-1/"/>
   <updated>2014-03-04T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/blog/2014/03/04/journaling-in-japanese,-day-1</id>
   <content type="html">&lt;p&gt;Somewhat inspired by my Japanese teacher’s request for me to write down (preferably on paper, with my own two hands) a journal entry—one sentence for each day of the week—I’ve decided to do it on the internet instead (where I don’t actually have to write anything).&lt;/p&gt;

&lt;p&gt;I know, I know. It kind of defeats the purpose of practicing hiragana, etc. but I think it may prove to be a little more valuable especially since I’m planning to write more than just one sentence—as proposed by the original idea.&lt;/p&gt;

&lt;p&gt;I will call it… &lt;em&gt;Journaling in Japanese!&lt;/em&gt; Or JiJ! Or… because that sounds horrible I’ll call it Jiji—it’s cute and rolls off the tongue. Also according to my [dictionary] Jiji (時事) also means “events of the day” or “current affairs,” which is also irocinally suiting.&lt;/p&gt;

&lt;p&gt;My current level of Japanese is somewhat baby-level, so I will be mostly speaking informally with no clue how to properly construct my sentences. Constructive criticism is allowed here.&lt;/p&gt;

&lt;p&gt;とにかく、行くぜ！
今日会社に行った。昼休みで帰って、ご飯食べた。
ふぅーん、これはちょっと変と思うね。時事が多分詰まらない。めんどくさい。&lt;/p&gt;

&lt;p&gt;会社で新しいPackage Managerを見つけた！やってみたいよ！名前はYeomanだよ！
今やってみる〜&lt;/p&gt;

&lt;p&gt;じゃね〜&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>5 Easy Steps to Writing Better Code</title>
   <link href="https://otaku-elite.com/code/2014/02/15/5-easy-steps-to-writing-better-code/"/>
   <updated>2014-02-15T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2014/02/15/5-easy-steps-to-writing-better-code</id>
   <content type="html">&lt;p&gt;I’ve seen a lot of bad code written before. This is partially because I’ve
written a lot of bad code myself in the past (and for that matter, I still do
sometimes). The first step to solving any problem is to admit that you have one.
This means you need to recognize bad code when you see it. Here is a list of
some serious coding mistakes that I see time and time again.&lt;/p&gt;

&lt;h2 id=&quot;1-dont-copy-and-paste&quot;&gt;1. Don’t copy and paste!&lt;/h2&gt;
&lt;p&gt;I get a lot of pushback on this from &lt;em&gt;everyone&lt;/em&gt;, but I feel really strongly about it.&lt;/p&gt;

&lt;p&gt;While copy and paste is great for moving things around, it causes problems, too. Like duplicating existing code where normally you could use a function or a loop to accomplish the same task or creating 5 copies of the same function that each have only one line of code that separates them from their bretheren.&lt;/p&gt;

&lt;p&gt;You should re-type the code by hand instead. This seems to involve more effort (especially if your typing skills are not up to par) but it will also help you find issues in your code faster, since it gives you more time to think about what you are writing.&lt;/p&gt;

&lt;p&gt;By using copy and paste you are distancing yourself from the meaning of the code and its existing design problems. By typing it out again your brain has to process everything you are writing and you might jump up and say to youself, “wait… why am I doing this again? This is way too much work…” where as if you had copy and pasted it you would not notice.&lt;/p&gt;

&lt;h2 id=&quot;2-avoid-vague-or-non-descriptive-variable-and-function-names&quot;&gt;2. Avoid vague or non-descriptive variable and function names&lt;/h2&gt;

&lt;p&gt;It is very crucial to have meaningful variable names. I find myself getting confused every day at work because of variable names that have no meaning. Remember that what makes sense to you at the time may not make sense to the rest of your team. It might also not make sense to you later. It &lt;em&gt;does&lt;/em&gt; make the naming situation a little more challenging.&lt;/p&gt;

&lt;p&gt;Taking the time to clearly think about the name of a variable could save you and your team hours when trying to debug code later on.&lt;/p&gt;

&lt;p&gt;In the past I have even done this to myself. I will pick a name for a variable, put the code down and come back to it months later and then try to use the same variable to do something completely different than what it was intended for—just because the name was suggesting something else.&lt;/p&gt;

&lt;p&gt;This is such an important topic that I will provide some examples of bad variable names. These are taken from &lt;strong&gt;real production code.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;superAddressBookList&lt;/li&gt;
  &lt;li&gt;superRelativesList&lt;/li&gt;
  &lt;li&gt;result&lt;/li&gt;
  &lt;li&gt;data&lt;/li&gt;
  &lt;li&gt;pid&lt;/li&gt;
  &lt;li&gt;obj&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pid&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;obj&lt;/code&gt; are probably ubiquitous in the programming realm but I am going to tell you exactly why I hate them. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data&lt;/code&gt; can mean anything. Everything is data. You might as well name your variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;everything&lt;/code&gt;. Because as far as I’m concerned, that’s what’s in it.&lt;/p&gt;

&lt;p&gt;The same goes for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;obj&lt;/code&gt;. I’m assuming &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;obj&lt;/code&gt; is an object, but what kind of object? Give me a little more information about what to expect from this object and how I can use it. Even something like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;personObject&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;animalObject&lt;/code&gt; sounds better to me. Although my ears still twitch every time I hear the word “object” being used, I guess that’s what you might call a &lt;em&gt;personal problem.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I don’t like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pid&lt;/code&gt; because while the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt; part is likely not a Freudian reference the letter &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p&lt;/code&gt; could stand for anything. This variable could be storing the &lt;strong&gt;process&lt;/strong&gt; id of a thread, or a &lt;strong&gt;product&lt;/strong&gt; id (in an eccomerce situation) or even a &lt;strong&gt;purchase&lt;/strong&gt; id. God forbid there’s a purchase id and a product id! Then what do we do? &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pid1&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pid2&lt;/code&gt;? Don’t be lazy. Type. If you are working in the field as a software engineer I have earth shattering news for you: you are being paid to type.&lt;/p&gt;

&lt;p&gt;Here are some function names that also don’t make any sense:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;void dataLoadToPage()&lt;/li&gt;
  &lt;li&gt;void sendDataToPage()&lt;/li&gt;
  &lt;li&gt;void supportTabActive()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;I’m still not sure how the first two are different&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;supprtTabActive&lt;/code&gt; based on the name might be a boolean function, or it might be a void function that activates the support tab.&lt;/p&gt;

&lt;p&gt;This is one is a really good example loop that I found:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;people&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//code does something in here&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Seeing the word “bi” and “people” next to one another in code makes me wonder what’s really going on in that loop.&lt;/p&gt;

&lt;h2 id=&quot;3-review-your-code&quot;&gt;3. Review Your Code&lt;/h2&gt;
&lt;p&gt;Seriously. Take a break after you’ve gotten your stuff to work and re-read what you’ve written. If you have someone else you can pull in to review your code with you, that’s even better. They will help point out certain things that you might not see since your eyes have become accustomed to the code.&lt;/p&gt;

&lt;p&gt;Sometimes finding a problem with your code is like trying to find those misplaced car keys. You know you put them on your desk somewhere but since you know the layout of your desk so well there are certain places your brain will rule out searching automatically; those are precisely the places you need to be looking.&lt;/p&gt;

&lt;h2 id=&quot;4-be-consistent&quot;&gt;4. Be Consistent&lt;/h2&gt;
&lt;p&gt;Adopt a consistent style of coding. Things like tabs vs spaces, how many tabs, when to indent, which lines to place the opening and closing brackets on, etc.
Also be careful when naming your variables. If you are using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;camelCase&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;under_scores&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CAPS_AND_UNDER_SCORES&lt;/code&gt;. Remember that just because you use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;camelCase&lt;/code&gt; for your local variables doesn’t mean that you should rule out using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CAPS_AND_UNDER_SCORES&lt;/code&gt; for constants, for example (or something like that).&lt;/p&gt;

&lt;h2 id=&quot;5-pay-attention-to-logic&quot;&gt;5. Pay Attention To Logic&lt;/h2&gt;
&lt;p&gt;Watch out for setting variables and conditions and then repeating the exact same code unconditionally. I’ve seen a lot of code that looks something like this:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;weWantToHaveFun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;getBeer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;throwAParty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;fireLaserBeams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;weWantToHaveFunWithoutBeer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;throwAParty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;fireLaserBeams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;fireLaserBeams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this code, we fire laser beams no matter what. It would be smarter to pull that line outside of the if statements entirely. Also notice that you are repeating the code (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fireLaserBeams()&lt;/code&gt;) 3 times.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>MySQL Dump/Restore With Progress Indicator</title>
   <link href="https://otaku-elite.com/nix/2013/06/06/mysqldump-and-restore-with-progress-indicator/"/>
   <updated>2013-06-06T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/nix/2013/06/06/mysqldump-and-restore-with-progress-indicator</id>
   <content type="html">&lt;p&gt;Today I just found out about a great utility called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bar&lt;/code&gt;. bar shows a progress indicator on the command line.&lt;/p&gt;

&lt;p&gt;Bar can be installed via homebrew on os x:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew install bar
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I don’t know the exact syntax for the command, I only have my working examples to show… The help message isn’t too helpful and I don’t seem to have any man pages available.&lt;/p&gt;

&lt;p&gt;Here’s a sample of what it looks like:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# where local_db and remote_db are strings with mysql args and tmpfile is created via mktemp&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Dumping database...&apos;&lt;/span&gt;
mysqldump &lt;span class=&quot;nv&quot;&gt;$local_db&lt;/span&gt; | bar &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$tmpfile&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Restoring database to production...&apos;&lt;/span&gt;
bar &lt;span class=&quot;nv&quot;&gt;$tmpfile&lt;/span&gt; | mysql &lt;span class=&quot;nv&quot;&gt;$remote_db&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the output looks like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Dumping database...
      100% [==============================================================]
Restoring database to production...
      100% [==============================================================]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There also another tool called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pv&lt;/code&gt; which stands for &lt;strong&gt;pipe viewer&lt;/strong&gt; I’m currently trying to work out how to use that tool so I can use it instead. It seems to be more common, documented and feature-rich.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Rake - Command failed with status (127)</title>
   <link href="https://otaku-elite.com/blog/2013/06/06/rake-status-127/"/>
   <updated>2013-06-06T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2013/06/06/rake-status-127</id>
   <content type="html">&lt;p&gt;So today I got this annoying message from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake&lt;/code&gt; that I have seen way too many times. It looks something like the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ rake updb
scripts/updb.sh
rake aborted!
Command failed with status (127): [./scripts/updb.sh...]
/path/to/Rakefile:16:in `block in &amp;lt;top (required)&amp;gt;&apos;
Tasks: TOP =&amp;gt; updb
(See full trace by running task with --trace)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Status 127 is code for “command not found.” The problem was caused by my Rakefile which had a task called “updb” which I use to upload the current local copy of a database to production. And it looks like this:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Uploads database to production&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:updb&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;./scripts/updb.sh&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem here is that even though the script is set to be executable, it’s still not in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$PATH&lt;/code&gt; and even though &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./scripts/updb.sh&lt;/code&gt; will actually run on the command line, we need to specify the shell to run and pass the script as an argument. The working task now looks like this:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Uploads database to production&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:updb&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sh scripts/updb.sh&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you run into the same issue:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;try double checking that the command you are running is in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$PATH&lt;/code&gt; and that it is actually a command.&lt;/li&gt;
  &lt;li&gt;If the command is not in your path, either move it there or use the full path name to it. You can make this cleaner by using a variable to store the path to the command.&lt;/li&gt;
  &lt;li&gt;Call any scripts using their respective interpreters and pass the file names as arguments.&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Adding Videos</title>
   <link href="https://otaku-elite.com/blog/2013/06/02/adding-videos/"/>
   <updated>2013-06-02T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2013/06/02/adding-videos</id>
   <content type="html">&lt;p&gt;Hey all, I haven’t been updating too much recently so I wanted to drop you a line and let you know what’s going on.&lt;/p&gt;

&lt;p&gt;I am starting to design some new sections of the site, since for a long time I really haven’t given the site any thought for design at all. I will be slowly adding some videos to a new videos section that I am working on; you will see them appear on the home page. I am adding them in the dates they were originally published which unfortunately means having some back dated posts.&lt;/p&gt;

&lt;p&gt;I am going to try and tag them all with the &lt;a href=&quot;/tags.html#videos-ref&quot;&gt;videos&lt;/a&gt; tag, so you should be able to find them through there until the actual design of the videos page is completed.&lt;/p&gt;

&lt;p&gt;I am also working on a profile page for the authors of this site (which currently is just myself). It will have detailed information about me with resources to &lt;a href=&quot;http://twitch.tv/sekkzpekk&quot;&gt;my twitch.tv stream&lt;/a&gt; and list all of my videos and posts. It will probably take me a while to design it and implement it so please be patient!&lt;/p&gt;

&lt;p&gt;I hope it turns out ok :3&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Sick And Sad Guitar Cover</title>
   <link href="https://otaku-elite.com/videos/2013/05/31/sick-and-sad-guitar-cover/"/>
   <updated>2013-05-31T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2013/05/31/sick-and-sad-guitar-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/FRrI_2Iu2Bc&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Here is a cover of me playing Sick and Sad (&lt;a href=&quot;http://www.youtube.com/watch?v=W7s2hd80zyI&quot;&gt;Original Song&lt;/a&gt; by Catch 22)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hearing Japanese - Kaichou wa Maid-sama!</title>
   <link href="https://otaku-elite.com/japanese/2013/05/30/hearing-japanese-kaichou-wa-maid-sama/"/>
   <updated>2013-05-30T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2013/05/30/hearing-japanese-kaichou-wa-maid-sama</id>
   <content type="html">Ah! Sorry I have not been keeping up with my studious ways. My Japanese P.I.C. (that&apos;s partner-in-crime, or in normal people speak my &quot;study buddy&quot;) has been largely unavailable so I haven&apos;t been doing anything much in the line of studying. But I will try to get back on the wagon again (is it _on_ the wagon, or _off_ the wagon? I can never remember).

Kaichou wa Maid-sama (&lt;a href=&quot;http://en.wikipedia.org/wiki/Maid_Sama!&quot;&gt;wiki&lt;/a&gt;) is the next anime I started watching after Magi. It&apos;s a school-life shoujo type romantic comedy (I guess) about a girl who attends a mostly rufian-boy high school. She is the class president but she has a little secret... She works in a Maid cafe as a waitress! One of her fellow students, a lady killer named Osui, decides to keep this little secret for himself in order to try and make her his personal maid for a day.

I&apos;ll try to organize them by episode... I only started doing that as of Episode 4 however, so 1-3 will be clumped together. As of this writing I&apos;m on episode 20 something and I stopped taking notes at episode 10. Woops.

h1. Episodes 1-3

h2. Vocabulary List

table(vocab).
|_.What I thought I heard|_{width: 150px}.What I actually heard|_.Meaning|
|seita kaichou|せいとう　かいちょう|Class President|
|futsu|ふつう|general; ordinary; usual; normal|
|mendokuse|めんどうくさい&lt;br&gt;面倒くさい|troublesome, bothersome, tiresome.&lt;br&gt;めんどう means &quot;trouble&quot; or &quot;difficulty&quot;|
|shinsengumi|しんせんぐみ&lt;br&gt;新選組|Shinsengumi was a shogunate police and military force located in Kyoto dedicated to suppressing anti-shogunate activities during the Edo period.&lt;br&gt;&lt;br&gt;I&apos;ve seen it commonly referenced in anime so I decided to research.|
|zaken|ざけん&lt;br&gt;ざけんなよ&lt;br&gt;ざけんじゃねーよ|(vulgar) fuck you!&lt;br&gt;don&apos;t fuck with me!&lt;br&gt;don&apos;t fuck around!&lt;br&gt;don&apos;t be a screw off!|
|ni ku ni|2-2|く means section; district; ward.&lt;br&gt;Ni Ku Ni refers to the class 2 section 2... Or something like that.|
|touzen|とうぜん|natural; as a matter of course|
|sentai|せんたい&lt;br&gt;戦隊|Squadron|
|moe|もえ&lt;br&gt;萌え|(_Manga Slang_) crush; fascination; infatuation&lt;br&gt; _Don&apos;t laugh I really didn&apos;t know this one!_|
|seigan|せいがん&lt;br&gt;請願&lt;br&gt;正眼|Not sure which definition was the right one here&lt;br&gt;petition;&lt;br&gt;aiming at the eye (with a sword)&lt;br&gt;&lt;br&gt;It could have been either one, I don&apos;t remember the episode clearly and since shinsengumi was mentioned the swordplay is a possibility|
|doshitan|どうしたん|What&apos;s the matter?; what&apos;s wrong?|
|tsundere|つんでれ|being sharp and sarcastic (tsuntsun) on the surface, but being lovestruck and fawning (deredere) underneath. This is a personality type commonly acted out.|
|bikkuri|びっくり|(_suru verb_) to be astonished; surprised; amazed; frightened|


h2. Phrases

bq. じつはかくれるオタクなんだか
Jitsu wa kakureru otaku nandaka

|_.word|_.meaning|
|じつ|(_expr_) To be honest;&lt;br&gt;to tell you the truth|
|かくれる&lt;br&gt;隠れる|to hide; to be hidden; to conceal oneself; to disappear|
|なんだか&lt;br&gt;何だか|(a) little; somewhat; somehow|

My translation:

bq. To tell you the truth, I&apos;m a bit of a closet otaku.</content>
 </entry>
 
 <entry>
   <title>The Legend of Zelda - A Link to the Past <span class="subtitle">Episode 01 - Rescue Zelda</span></title>
   <link href="https://otaku-elite.com/videos/2013/05/17/the-legend-of-zelda-a-link-to-the-past-01-rescue-zelda/"/>
   <updated>2013-05-17T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2013/05/17/the-legend-of-zelda-a-link-to-the-past-01-rescue-zelda</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/fmmR9POVYW0&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Here is the first episode of my first-ever video game playthrough. The Game is &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Legend_of_Zelda:_A_Link_to_the_Past&quot;&gt;The Legend of Zelda: A Link to the Past&lt;/a&gt; for SNES. Hope you all enjoy it!&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Hearing Japanese - Magi, Part 2</title>
   <link href="https://otaku-elite.com/japanese/2013/05/12/hearing-japanese-magi-part-2/"/>
   <updated>2013-05-12T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2013/05/12/hearing-japanese-magi-part-2</id>
   <content type="html">I finished up watching the Magi anime a few days ago and took some more notes. Here they are:

h2. Vocabulary List:

table(vocab).
|_.What I thought I heard|_.What I actually heard|_.Meaning|
|yatsura|やつら&lt;br&gt; 奴ら|those guys|
|shikashi|しかし|However; but|
|nakimishiku|&lt;span class=&quot;error&quot;&gt;なきみそくん&lt;br&gt; 泣き味噌くん&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;correction&quot;&gt;なきむしくん&lt;br&gt;泣き虫くん&lt;/span&gt;|&lt;span class=&quot;error&quot;&gt;なきみそ&lt;/span&gt; &lt;span class=&quot;correction&quot;&gt;*なきむし*&lt;/span&gt; means &quot;crybaby&quot; &lt;small&gt;* Updated 2013.05.20&lt;/small&gt;|
|mochiron|もちろん|of course|
|yuuki|ゆうき&lt;br&gt; 勇気|bravery; courage; valor|
|suma wa|すまは|corner; nook; recess -- _this one I don&apos;t exactly remember_|

h2. Phrases

I also heard one phrase I decided to translate:

bq. それはきっとある
sore wa kitto aru

|_.word|_.meaning|
|きっと| surely; undoubtedly; most likely|
|ある| to be (for inanimate objects); &quot;to happen&quot;|

The translation I came up with for this was:

bq. It will surely happen.

So I&apos;m hoping it&apos;s accurate :)

_Side note: I will also be utilizing &quot;textile&quot;:http://redcloth.org/hobix.com/textile/ for these posts going forward, since tables are quicker to create than in HTML. I&apos;m also dropping out the romaji except for the &quot;what I thought I heard.&quot; This is because I write them down quickly as I hear them and I&apos;m not as fast at writing the kana just yet. I will post a good kana reference later for those who are unsure. Essentially I&apos;m forcing you to learn it one way or another--It&apos;s good practice, I promise;_</content>
 </entry>
 
 <entry>
   <title>Change Date Modified On A File Osx</title>
   <link href="https://otaku-elite.com/osx/nix/2013/05/11/change-date-modified-on-a-file-osx/"/>
   <updated>2013-05-11T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/osx/nix/2013/05/11/change-date-modified-on-a-file-osx</id>
   <content type="html">&lt;p&gt;In order to test some file based caching I designed in PHP the other day I had to expire one of my cache files by making it older than 1 day.&lt;/p&gt;

&lt;p&gt;To do that I used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;touch -mt&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-mt&lt;/span&gt; 201305100419 sekkzpekk.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Briefly from the man page:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;-m      Change the modification time of the file.

-t      Change the access and modification times to the specified time instead of the current time of day.  The argument is of the form ``[[CC]YY]MMDDhhmm[.SS]&apos;&apos; where each pair of letters represents
the following:

    CC      The first two digits of the year (the century).
    YY      The second two digits of the year.  If ``YY&apos;&apos; is specified, but ``CC&apos;&apos; is not, a value for ``YY&apos;&apos; between 69 and 99 results in a ``CC&apos;&apos; value of 19.  Otherwise, a ``CC&apos;&apos; value of
           20 is used.
    MM      The month of the year, from 01 to 12.
    DD      the day of the month, from 01 to 31.
    hh      The hour of the day, from 00 to 23.
    mm      The minute of the hour, from 00 to 59.
    SS      The second of the minute, from 00 to 61.

 If the ``CC&apos;&apos; and ``YY&apos;&apos; letter pairs are not specified, the values default to the current year.  If the ``SS&apos;&apos; letter pair is not specified, the value defaults to 0.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Originally spotted on &lt;a href=&quot;http://danilo.ariadoss.com/howto-change-date-modified-date-created-mac/&quot;&gt;Danilo Stern-Sapad’s&lt;/a&gt; blog&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Creating A Keyboard Shortcut In Sublime To Open Specific Files</title>
   <link href="https://otaku-elite.com/code/2013/05/10/creating-a-keyboard-shortcut-in-sublime-to-open-specific-files/"/>
   <updated>2013-05-10T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2013/05/10/creating-a-keyboard-shortcut-in-sublime-to-open-specific-files</id>
   <content type="html">&lt;p&gt;Today I figured out how to create a keyboard shortcut to open a specific file in Sublime Text 2.&lt;/p&gt;

&lt;p&gt;This is useful, for example, for hotkeying my &lt;a href=&quot;http://mamp.info&quot;&gt;MAMP&lt;/a&gt; apache vhosts file—a file I commonly edit.&lt;/p&gt;

&lt;p&gt;Add the following to your user keybindings file in sublime to set the &lt;strong&gt;F1&lt;/strong&gt; Key to open the MAMP vhosts file:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;f1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;open_file&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Change the keys and filenames to fit your needs.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Japanese Section Launched!</title>
   <link href="https://otaku-elite.com/blog/2013/05/09/japanese-section-launched!/"/>
   <updated>2013-05-09T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2013/05/09/japanese-section-launched!</id>
   <content type="html">&lt;p&gt;Despite the fact that I did start writing articles yesterday tonight is the actual night I am launching the content, since I had to do quite a bit of work to figure out how I wanted the pages to be formatted.&lt;/p&gt;

&lt;p&gt;The basic idea is that going forward I will be taking notes while listening to japanaese music, watching anime or interacting with any other japanese content in any way. This way I can really take a minute to break down and process everything I’ve heard or been subjected to and analyze it, learn from it, and share it with everyone else.&lt;/p&gt;

&lt;p&gt;I am hoping it will also bring back some more relevant “otaku” content to a site whose original purpose may have been long forgotten :)&lt;/p&gt;

&lt;p&gt;Check out the first article: &lt;a href=&quot;/japanese/2013/05/08/hearing-japanese-1-magi/&quot;&gt;Hearing Japanese - Magi&lt;/a&gt;.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Hearing Japanese - Magi</title>
   <link href="https://otaku-elite.com/japanese/2013/05/08/hearing-japanese-1-magi/"/>
   <updated>2013-05-08T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/japanese/2013/05/08/hearing-japanese-1-magi</id>
   <content type="html">&lt;p&gt;Today I started studying Japanese together with a friend. We both had studied separately and decided to brush up on our japanese.&lt;/p&gt;

&lt;p&gt;In addition to going through my beginner textbook, &lt;a href=&quot;http://www.amazon.com/Japanese-Busy-People-Version-attached/dp/1568363850&quot;&gt;Japanese for Busy People&lt;/a&gt;, I decided that I would augment my studying by watching excessive amounts of anime, listening really carefully to the dialog and taking notes.&lt;/p&gt;

&lt;p&gt;Today is the first day of my notes so I don’t know how the format will turn out but hopefully I get this down to something practical.&lt;/p&gt;

&lt;p&gt;One of my goals in doing this is to track my progress as well as having a set of notes to look back on&lt;/p&gt;

&lt;p&gt;Today’s vocabulary list comes from an anime called &lt;a href=&quot;http://en.wikipedia.org/wiki/Magi:_The_Labyrinth_of_Magic&quot;&gt;Magi&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;What I thought I heard&lt;/td&gt;
        &lt;td&gt;What I really heard&lt;/td&gt;
        &lt;td&gt;Meaning&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;
            tatoe&lt;br /&gt;
            tatoeba
        &lt;/td&gt;
        &lt;td&gt;
            tatoe (たとえ)&lt;br /&gt;
            tatoeba (たとえば)
        &lt;/td&gt;
        &lt;td&gt;
            Tatoe means &quot;however&quot;, &quot;example&quot;.&lt;br /&gt;
            The expression tatoeba means &quot;for example&quot;
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;tonikaku&lt;/td&gt;
        &lt;td&gt;
            tonikaku&lt;br /&gt;
            とにかく
        &lt;/td&gt;
        &lt;td&gt;
            Anyway&lt;br /&gt;
            generally speaking
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;
            soueba?&lt;br /&gt;
            soyeba?
        &lt;/td&gt;
        &lt;td&gt;
            soieba&lt;br /&gt;
            そういえば
        &lt;/td&gt;
        &lt;td&gt;
            Come to think of it...&lt;br /&gt;
            Now that you mention it...
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;&lt;em&gt;nanda&lt;/em&gt; koko wa&lt;/td&gt;
        &lt;td&gt;
            &lt;em&gt;nanda&lt;/em&gt; koko wa&lt;br /&gt;
            &lt;strong&gt;なんだ&lt;/strong&gt;ここは&lt;br /&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;em&gt;Nanda&lt;/em&gt; is an interjection meaning &quot;what&quot;
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;hachimitsu&lt;/td&gt;
        &lt;td&gt;
            hachimitsu&lt;br /&gt;
            はちみつ
        &lt;/td&gt;
        &lt;td&gt;
            Honey&lt;br /&gt;
            &lt;em&gt;Note: Hachi (はち) means bee.&lt;br /&gt;
                Mitsu (みつ) means nectar.&lt;/em&gt;
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;Koko ni iru wa zenbu Toran no muran ningen tachi sa&lt;/td&gt;
        &lt;td&gt;
            Koko ni iru wa zenbu Toran no munou ningen tachi sa&lt;br /&gt;
            ここにいるはぜんぶToranのむのうにんげんたちさ
        &lt;/td&gt;
        &lt;td&gt;&lt;em&gt;Here are all the incompetent humans of Toran&lt;/em&gt;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;Nante hidoi koto&lt;/td&gt;
        &lt;td&gt;
            Nante hidoi koto&lt;br /&gt;
            なんてひどいこと
        &lt;/td&gt;
        &lt;td&gt;
            How cruel&lt;br /&gt;
            (koto - matter, thing or event)
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;Boku &lt;strong&gt;ni&lt;/strong&gt; mo wakaranai&lt;/td&gt;
        &lt;td&gt;Boku &lt;strong&gt;ni&lt;/strong&gt; mo wakaranai&lt;/td&gt;
        &lt;td&gt;
            I don&apos;t understand either&lt;br /&gt;
            (to me, I also don&apos;t undertand)
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;
            ochitsuke&lt;br /&gt;
            ochitsuite
        &lt;/td&gt;
        &lt;td&gt;
            ochitsuke (おちつけ)&lt;br /&gt;
            ochitsuite (おちついて)
        &lt;/td&gt;
        &lt;td&gt;
            ochitsukeru (おちつける) - to quiet / to calm down&lt;br /&gt;&lt;br /&gt;
            I believe &lt;em&gt;ochitsuite&lt;/em&gt; is the て form of ochitsukeru
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;Hitotsu &lt;em&gt;onegai&lt;/em&gt; da&lt;/td&gt;
        &lt;td&gt;
            Hitotsu onegai da&lt;br /&gt;
            ひとつおねがいだ
        &lt;/td&gt;
        &lt;td&gt;
            &lt;em&gt;One request&lt;/em&gt;&lt;br /&gt;
            Hitotsu means &quot;one&quot;&lt;br /&gt;
            Onegai used as a noun means &quot;request&quot;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

</content>
 </entry>
 
 <entry>
   <title>Adding Keywords From Firefox Address Bar</title>
   <link href="https://otaku-elite.com/blog/os%20x/2013/04/18/adding-keywords-from-firefox-address-bar/"/>
   <updated>2013-04-18T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/os%20x/2013/04/18/adding-keywords-from-firefox-address-bar</id>
   <content type="html">&lt;p&gt;Typically for development I like to use the Firefox &lt;a href=&quot;http://www.wikihow.com/Use-Firefox-Keywords&quot;&gt;keywords&lt;/a&gt; feature to get me to where I need to be faster. The irritating part of this is that in order to create a keyword for a site you typically have to first add the bookmark (which can be done quickly using the &lt;strong&gt;star icon&lt;/strong&gt; in the address bar) and then open up the &lt;strong&gt;Bookmarks Library&lt;/strong&gt; Then several clicks later you can add a keyword.&lt;/p&gt;

&lt;p&gt;Wouldn’t it be nice to add a Firefox keyword straight from the star icon? Well I found this &lt;a href=&quot;http://www.guidingtech.com/5941/add-keywords-bookmark-firefox-address-bar/&quot;&gt;old blog post&lt;/a&gt; that explains how it’s done on Windows. I’ve taken the instructions and converted it for OS X quickly. It still works as of today (2013.04.18).&lt;/p&gt;

&lt;p&gt;On the command line, find your &lt;strong&gt;Profile Folder&lt;/strong&gt; for Firefox. This will probably be different for everyone. Mine was in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/Library/Application Support/Firefox/Profiles/&lt;/code&gt; there should be another hidden folder (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ls -la&lt;/code&gt;) in here called &lt;em&gt;something&lt;/em&gt;.default. &lt;em&gt;This&lt;/em&gt; is your profile folder. The full path to my profile folder was &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/Library/Application Support/Firefox/Profiles/4xw04oq0.default&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Simply copy the following css excerpt:&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;#editBMPanel_locationRow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;#editBMPanel_keywordRow&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;visible&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;-moz-box-align&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;center&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;#editBMPanel_tagsSelector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;collapsed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and in your profile folder execute the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir -p chrome/ &amp;amp;&amp;amp; pbpaste &amp;gt;&amp;gt; chrome/userChrome.css
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will create the necessary directory if it’s not there and append your CSS snippet to the end of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;userChrome.css&lt;/code&gt; if it already exists.&lt;/p&gt;

&lt;p&gt;Restart Firefox for the changes to apply.&lt;/p&gt;

&lt;p&gt;Your star icon should now change from:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2013/04/18/ffox-before.png&quot; alt=&quot;Before&quot; /&gt;&lt;/p&gt;

&lt;p&gt;to:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2013/04/18/ffox-after.png&quot; alt=&quot;After&quot; /&gt;&lt;/p&gt;

&lt;p&gt;* Lifehacker also had &lt;a href=&quot;http://lifehacker.com/5738698/add-bookmark-keywords-to-firefox-from-the-address-bar&quot;&gt;an article about this&lt;/a&gt;.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>WordPress - Programmatically Getting the Latest Post in a Category</title>
   <link href="https://otaku-elite.com/code/2013/04/08/wordpress-programmatically-get-latest-post-in-category/"/>
   <updated>2013-04-08T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2013/04/08/wordpress-programmatically-get-latest-post-in-category</id>
   <content type="html">&lt;p&gt;I’ve seen a lot of solutions for this online but I didn’t really like any of them and they didn’t seem to fit my needs. Here is a function I wrote that you can add to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;functions.php&lt;/code&gt; in your custom theme which will retreive the latest post in a category when you supply the category id:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;cd&quot;&gt;/**
 * Returns the latest post in a category.
 *
 *
 * Quick explanation:
 * ok, the results from WP_Query are stored in an array of WP_Post objects.
 * the &quot;array keys&quot; in WP_Post are actually just attributes, as in:
 * $latest_post-&amp;gt;post_content, etc...
 *
 * @param  [int] $category_id category id by number, use get_cat_ID() with the full category name i.e., get_get_ID(&apos;My Example Category&apos;) to specify category names.
 * @return [WP_Post] object containing post data
 */&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;latest_post_in_category&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$category_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$latest_posts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_posts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;posts_per_page&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;category&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$category_id&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

    &lt;span class=&quot;nv&quot;&gt;$return_post&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$latest_posts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$latest_post&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$latest_posts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$latest_post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The function returns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt; when no post is found. So you can safely check for nulls.&lt;/p&gt;

&lt;p&gt;Here is an example of the function in action. I created another function to pull the latest post from a specific category, by its name:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;latest_on_demand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;latest_post_in_category&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_cat_ID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;On Demand&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And here’s an example of &lt;em&gt;that&lt;/em&gt; function used inside a template:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$latest_post&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;latest_on_demand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;is_null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$latest_post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$latest_post&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post_content&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;endif&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To get the other attributes of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WP_Post&lt;/code&gt; object you can always &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;var_dump($latest_post)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Have fun!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Wordpress 500 Errors, White Screen of Death (WSOD), the Cause and the Cure.</title>
   <link href="https://otaku-elite.com/code/2013/04/04/wordpress-500-errors-wsod-cause-and-cure/"/>
   <updated>2013-04-04T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/code/2013/04/04/wordpress-500-errors-wsod-cause-and-cure</id>
   <content type="html">&lt;p&gt;Since many of you are probably looking for an immediate solution to the problem I will post my solution first.&lt;/p&gt;

&lt;p&gt;#The Cure
Let’s dive right in. First thing you should probably do is check your error logs (i.e., your apache error logs). If your error logs aren’t giving you any strong hints then try some of the solutions listed below.&lt;/p&gt;

&lt;p&gt;##MySQL - Bad plugins
Executing the following SQL statement will disable all plugins. If this fixes your problem, you will be able to log back into Wordpress and enable plugins one by one til you find the issue.&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;update&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wp_options&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;option_value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;a:0:{}&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;where&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;option_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;active_plugins&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For me this fixed it. I had my doubts about this working in general, but I tried it anyway and it worked, it turns out that one of my plugins was failing (even though it was working on my previous hosting &lt;em&gt;and&lt;/em&gt; my local environment)&lt;/p&gt;

&lt;p&gt;Once the plugins have all been disabled via the query above, it is safe to attempt toggling them on one by one, as Wordpress seems to have some sort of built-in security for testing out the modules and disabling them immediately if they cause any errors to occur.&lt;/p&gt;

&lt;p&gt;##.htaccess
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt; is another common offender of 500 errors. You can try disabling the .htaccess file by simply renaming it to something else (i.e., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess-off&lt;/code&gt;). If this works, then you have to turn it back on and figure out what’s causing the issue inside of the .htaccess.&lt;/p&gt;

&lt;p&gt;When performing a move of a wordpress blog from one server to another I checked my apache logs and noticed that apache was having issues with the RewriteRule directives in my .htaccess file. I got the following message in my error log:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Invalid command &apos;RewriteRule&apos;, perhaps misspelled or defined by a module not included in the server configuration
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This was a friendly reminder that I forgot to enable apache’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mod_rewrite&lt;/code&gt;.
On a default ubuntu server setup you can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a2enmod&lt;/code&gt; utility for enabling apache2 modules:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;a2enmod rewrite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##File permissions
I’ve also been told that file permissions could be the cause of this. I’m not sure that file permissions had any part in my issues specifically, but clean permissions are always a good idea.&lt;/p&gt;

&lt;p&gt;This is especially helpful if you have shell access to your web hosting. A lot of shared hosting companies &lt;em&gt;do&lt;/em&gt; provide ssh access, sometimes you have to just submit a special request ticket to support.&lt;/p&gt;

&lt;p&gt;Here’s what you want to check:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Proper ownership of files. Files should be owned by the appropriate user for apache. A user like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;www-data&lt;/code&gt; or perhaps your own user name in a shared hosting setup.&lt;/li&gt;
  &lt;li&gt;Proper file permissions. File permissions can be reset using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;find&lt;/code&gt; utility:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;find /path/to/wordpress &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;nt&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;644 &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\;&lt;/span&gt;
find /path/to/wordpress &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; d &lt;span class=&quot;nt&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;755 &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above is a commonly used set of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;find&lt;/code&gt; commands to reset file permissions to their defaults.&lt;/p&gt;

&lt;p&gt;#What is WSOD? What’s a 500 Error?
I gave a few tips about how to fix the White Screen of Death and the 500 errors, but what are they?&lt;/p&gt;

&lt;p&gt;##WSOD.
First the &lt;acronym title=&quot;White Screen of Death&quot;&gt;WSOD&lt;/acronym&gt;. The &lt;em&gt;White Screen of Death&lt;/em&gt; is a common term used on the web to describe when you try to access your site and all you see is a blank white page. This is caused by a combination of different things.&lt;/p&gt;

&lt;p&gt;The first part of this problem is that there is an error somewhere in your code. The second part of the problem is that your error reporting is silenced on the front end. Surpressing errors from displaying on your website is recommended for production websites, but it can leave you confused if you don’t know to expect the white screen when something blows up. This same behavior can be seen in almost any web application, not just Wordpress.&lt;/p&gt;

&lt;p&gt;If the errors aren’t showing on the frontend—and they shouldn’t in production—the errors will be available via the log files I was talking about earlier. On most linux setups I believe the logs should be in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/apache2/&lt;/code&gt; depending on your configuration, however, the log files could be anywhere.&lt;/p&gt;

&lt;p&gt;##500 Error
I was poking around the Wordpress forums to see what people were doing to fix 500 errors, and I really couldn’t find anything. For those who do not know, 500 errors typically look like this:
&lt;img src=&quot;/images/2013/04/05/500.png&quot; alt=&quot;500 error&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What I did find, however, was a common misconception of what a 500 error &lt;em&gt;is&lt;/em&gt;. I believe one person stated it as being the result of exceeding your bandwidth on your web host, which is more than likely &lt;em&gt;not&lt;/em&gt; the problem most of the time.In fact, I’m not even sure if that’s possible for it to be the issue.&lt;/p&gt;

&lt;p&gt;The bottom line is this: A random error has occurred, it could be anything. It’s usually something to do with the web server—like an apache or php module that has not been enabled or configured properly—or the code that it is running—in our case the PHP code from wordpress or one of its pluginsns.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Letters To You - Guitar Cover</title>
   <link href="https://otaku-elite.com/videos/2013/03/12/letters-to-you-guitar-cover/"/>
   <updated>2013-03-12T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2013/03/12/letters-to-you-guitar-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/kJYYL04bOqo&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Acoustic guitar cover of me playing &lt;a href=&quot;http://www.youtube.com/watch?v=0_I_6lZSCnU&quot;&gt;Letters To You&lt;/a&gt; by Finch.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Quickly Showing a Hidden OS X Dock</title>
   <link href="https://otaku-elite.com/nix/os%20x/2013/01/10/quickly-show-hidden-os-x-dock/"/>
   <updated>2013-01-10T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/os%20x/2013/01/10/quickly-show-hidden-os-x-dock</id>
   <content type="html">&lt;p&gt;A friend of mine for years has been searching for a way to instantly show his
auto-hidden dock, with zero delay. Until he recently discovered &lt;a href=&quot;http://osxdaily.com/2012/03/27/remove-auto-hide-dock-delay-mac-os-x/&quot;&gt;the trick to
removing the delay&lt;/a&gt; and shared it with me I could not understand why
he cared so much.&lt;/p&gt;

&lt;p&gt;##How to do it
To remove the delay from your hidden OS X dock, enter the following on the
command line:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;defaults write com.apple.Dock autohide-delay -float 0 &amp;amp;&amp;amp; killall Dock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##Reverting
To undo the change and go back to the default auto-hide option with the slight
delay, you can just use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;defaults delete&lt;/code&gt; like so:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;defaults delete com.apple.Dock autohide-delay &amp;amp;&amp;amp; killall Dock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##Conclusion
I thought it was pretty useless until I tried it myself. It makes a huge
difference. The only down side to it is having the dock show up when I
occasionally bump into the screen edge by accident, which isn’t very often at
all.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://osxdaily.com&quot;&gt;OSX Daily&lt;/a&gt; post referenced above cites an &lt;a href=&quot;http://hints.macworld.com/article.php?story=20120326061614691&quot;&gt;original
post&lt;/a&gt; from &lt;a href=&quot;http://macworld.com&quot;&gt;MacWorld&lt;/a&gt;.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Creating CSS Sprites for LESS</title>
   <link href="https://otaku-elite.com/nix/2013/01/02/creating-css-sprites-for-less/"/>
   <updated>2013-01-02T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/2013/01/02/creating-css-sprites-for-less</id>
   <content type="html">&lt;p&gt;Recently I’ve been working on a project which is using
&lt;a href=&quot;http://lesscss.org/&quot;&gt;LESS&lt;/a&gt; to preprocess its CSS. The mockup design I was given requires
image rollovers—which for the sake of having the rollover image ready and
loaded—calls for the use of &lt;a href=&quot;http://www.alistapart.com/articles/sprites&quot;&gt;CSS sprites&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;##The Problem
I’m lazy. Well, not &lt;em&gt;that&lt;/em&gt; lazy. Writing the sprite CSS is trivial, but creating the
image can be problematic.  Creating the original sprite is not too much work,
but after subsequent changes maintaining a sprite image costs time and I want
automation.&lt;/p&gt;

&lt;p&gt;##The Solution
The first solution I found is to use &lt;a href=&quot;http://compass-style.org/&quot;&gt;Compass&lt;/a&gt;, which supports
&lt;a href=&quot;http://compass-style.org/help/tutorials/spriting/&quot;&gt;spriting&lt;/a&gt; out of the box. Compass is based on
&lt;a href=&quot;http://sass-lang.com/&quot;&gt;SASS&lt;/a&gt; and since I’m not using SASS, I don’t consider this an option. I
will, however, keep this in mind when starting my next project.&lt;/p&gt;

&lt;p&gt;The next option I discovered is &lt;a href=&quot;http://csssprites.org/&quot;&gt;SmartSprites&lt;/a&gt; which works great
on its own, but it requires annotations—CSS comments that resemble the
following:&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/** sprite-ref: mysprite; */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##The Problem Part II
I am using Twitter &lt;a href=&quot;https://github.com/twitter/recess&quot;&gt;recess&lt;/a&gt; to process my LESS files.&lt;/p&gt;

&lt;p&gt;Since they are just comments this &lt;em&gt;shouldn’t&lt;/em&gt; be an issue, but for some reason
recess seems to be &lt;em&gt;inconsistently&lt;/em&gt; removing these comments with no basis for
why.&lt;/p&gt;

&lt;p&gt;##The &lt;em&gt;Real&lt;/em&gt; Solution
I decided to do some preprocessing of my own. This solution requires
SmartSprites, so &lt;a href=&quot;http://csssprites.org/&quot;&gt;go download it now&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I created my own “spec” for a new CSS property that I called
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;background-sprite&lt;/code&gt;; it accepts all of the variables that the the annotations
from smartsprites would normally use but with a different syntax, which was
gracefully accepted by recess. Here’s a sample of the LESS code to do it:&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/* First, declare the sprite normally which strangely works without issues */&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;/** sprite: broadcaster; sprite-image: url(&apos;../img/broadcaster-sprite.png&apos;); sprite-layout: vertical; */&lt;/span&gt;

&lt;span class=&quot;nc&quot;&gt;.channels&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;/* then inside a css rule: */&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;background-sprite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;url(&apos;../img/channel.png&apos;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sprite-ref&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;broadcaster&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sprite-alignment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Of course this is only half of the problem, because now we need to convert
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;background-sprite&lt;/code&gt; properties into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;background-image&lt;/code&gt; properties with the
appropriate trailing comment on the same line.&lt;/p&gt;

&lt;p&gt;I created a python script (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pysprite&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env python
&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;&apos;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;
preprocesses less-generated CSS files to convert background-sprite: to
annotated background-image:
&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&apos;&apos;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stdin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;readlines&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sprite_regex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;background-sprite:\s*.+(url\(.+?\)) (.+)&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sprite_regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;background-image: %s; /** %s **/&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;;;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;rstrip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rakefile&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;n&quot;&gt;less_path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;path/to/less_files&apos;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Generates regular CSS (dev mode)&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:css&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;recess &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;less_path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/app.less --compile|pysprite &amp;gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;less_path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/../app.css&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;rm webroot/sprite.php&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Generates sprite CSS&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:sprites&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;recess &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;less_path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/app.less --compile|pysprite &amp;gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;less_path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/../app.css &amp;amp;&amp;amp; smartsprites --root-dir-path &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;less_path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/../.&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;echo &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;?php &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;$app_css = &apos;app-sprite.css&apos; ?&amp;gt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &amp;gt; webroot/sprite.php&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;to chain everything together. Since I don’t want to manually run rake every time
I make changes, I then set my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake css&lt;/code&gt; task to run every time I save a LESS
file in vim, using the following &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;autocmd&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-vim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;au&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;BufWritePost&lt;/span&gt; *&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;less &lt;span class=&quot;k&quot;&gt;silent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!&lt;/span&gt;rake css
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now since I might not always be using sprites, rather than throwing this autocmd
into my vimrc, I set it at runtime from the command line with an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;edit&lt;/code&gt; script I
wrote, which sits in my repository root directory, right above the public webroot:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
mvim &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;au BufWritePost *.less silent !rake css&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note on linux you would change &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mvim&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gvim&lt;/code&gt; or just plain &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt; if you
prefer.&lt;/p&gt;

&lt;p&gt;You will also notice I create and remove a
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sprite.php&lt;/code&gt; file. I use this file to dynamically set the stylesheet based on
the last ran task so that I am not wasting time recreating a sprite image every
time I save a file.&lt;/p&gt;

&lt;p&gt;This means that during development I use regular image rollovers and when the
site is ready for production I just have to run a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake sprites&lt;/code&gt; before
uploading, which can easily be chained into a deployment process.&lt;/p&gt;

&lt;p&gt;##Troubleshooting
For everything to work, each one of these scripts needs to be executable (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chmod
u+x&lt;/code&gt;) and in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$PATH&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Getting smartsprites to work outside its own path took a bit of finagling in the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smartsprites.sh&lt;/code&gt; script:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Add extra JVM options here&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;OPTS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-Xms64m -Xmx256m&quot;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;LINKPATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;which &lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;SCRIPTPATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINKPATH&lt;/span&gt;/&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;readlink&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;which &lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)))&lt;/span&gt;

java &lt;span class=&quot;nv&quot;&gt;$OPTS&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-Djava&lt;/span&gt;.ext.dirs&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$SCRIPTPATH&lt;/span&gt;/lib org.carrot2.labs.smartsprites.SmartSprites &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Of course the quickest way to fix it if this modification not work is to change
the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-Djava.ext.dirs=&lt;/code&gt; to point to the absolute path of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smartsprites/lib&lt;/code&gt;
directory.&lt;/p&gt;

&lt;p&gt;I also symlinked it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smartsprites&lt;/code&gt; (without the “sh”).&lt;/p&gt;

&lt;p&gt;##Conclusion
It may seem a bit excessive, but with the added simplicity of vim’s autocmd, it
becomes a very elegant solution to use, once implemented.&lt;/p&gt;

&lt;p&gt;If you are still on the fence about LESS vs SASS and you know there may be image
sprites in your future, to keep things straight forward you might want to opt
for a SASS and Compass based approach.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Upgrading grep in OS X Revisited</title>
   <link href="https://otaku-elite.com/osx/2013/01/02/upgrading-grep-os-x-revisited/"/>
   <updated>2013-01-02T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/osx/2013/01/02/upgrading-grep-os-x-revisited</id>
   <content type="html">&lt;p&gt;Just the other day I realized I was using the OS X stock &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt;, which was
lacking a few features I wanted, some features in particular are the ability to
fully color highlight grep results with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--color&lt;/code&gt; option, or to exclude
directories from searches using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--exclude-dir&lt;/code&gt; option.&lt;/p&gt;

&lt;p&gt;I was shocked to find one of the first results in google was my own blog from
when &lt;a href=&quot;/osx/2012/03/14/upgrading-grep-os-x/&quot;&gt;I previously wrote about this back in March&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Well, the old method for upgrading grep using
&lt;a href=&quot;http://mxcl.github.com/homebrew/&quot;&gt;homebrew&lt;/a&gt; no longer works. Luckily
I found a &lt;a href=&quot;http://superuser.com/questions/419467/grep-in-mac-os-xs-terminal-only-displaying-one-color&quot;&gt;post on superuser&lt;/a&gt;
which describes a new method for upgrading grep via homebrew.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew tap homebrew/dupes
brew install homebrew/dupes/grep
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that the new grep will install to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/bin&lt;/code&gt; which usually appears
&lt;em&gt;after&lt;/em&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/bin/&lt;/code&gt; which contains your stock OS X grep, giving priority to the
OS X grep.&lt;/p&gt;

&lt;p&gt;You can either finagle the paths in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.profile&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bash_rc&lt;/code&gt; or do as I
did and create a one-off alias for any OS X duplicate software you’ve installed,
which I feel gives more control over switching it on and off if you need to for
some reason.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;alias grep=&apos;/usr/local/bin/grep --color&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Another bonus to using this method is that it will put the duplicated packages
you are currently using in plain site in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.profile&lt;/code&gt;.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Steam Powered SSD</title>
   <link href="https://otaku-elite.com/blog/2012/04/20/steam-powered-ssd/"/>
   <updated>2012-04-20T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/blog/2012/04/20/steam-powered-ssd</id>
   <content type="html">&lt;p&gt;Anyone who owns a solid state hard drive and has a &lt;a href=&quot;http://steampowered.com&quot;&gt;steam&lt;/a&gt; account
can know how frustrating it may be running low on hard disk and not being able
to split up your steam games.&lt;/p&gt;

&lt;p&gt;Today I’ve come up with a solution for this. While it may not be a very elegant
one, it still allows me to solve one of my biggest issues: being able to move
steam games I do not play often to a mechanical drive.&lt;/p&gt;

&lt;p&gt;First thing you’ll need for this is a shell extension called &lt;a href=&quot;http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html#download&quot;&gt;Link Shell
Extension&lt;/a&gt;, it essentially allows us to create symbolic links on windows.
Grab the prerequisit VC++ Redistributable Package and Link Shell Extension
installer from their site. Install Link Shell Extension following the
instructions on their site.&lt;/p&gt;

&lt;p&gt;The reason we need this symlink functionality is because &lt;a href=&quot;https://support.steampowered.com/kb_article.php?ref=7710-TDLC-0426&quot;&gt;according to the Steam
support team&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Steam installs to the following folder by default:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\Steam&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Files for games installed on Steam are stored in the following folder:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files\Steam\steamapps\&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;During the installation of Steam, you have the option to install Steam to a
   location other than the default. Since Steam relies on the game files
   residing in the SteamApps folder, your game files will go to whatever folder
   you have Steam installed in. The game files must be in the SteamApps folder
   in order to function.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Steam suggests you move the entire directory to a new drive. I suggest moving
only the games you want to. You may be limited in that some of the valve games
all share a common directory but I’m not too sure since I haven’t played around
with this too much as of yet.&lt;/p&gt;

&lt;p&gt;#Let’s Do It
Here’s the process in a nutshell&lt;/p&gt;

&lt;p&gt;##Moving the game&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Open Windows Explorer up to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steamapps&lt;/code&gt; directory (should be something
like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Program Files (x86)\Steam\steamapps&lt;/code&gt;). Pick a folder for a game
you want to move. In my test case I used &lt;em&gt;Magicka&lt;/em&gt; since it was a relatively
small game.&lt;/li&gt;
  &lt;li&gt;**Right click &amp;gt; Cut **&lt;/li&gt;
  &lt;li&gt;Open your mechanical drive or partition where you are going to dump it and
**Right Click &amp;gt; Paste **&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;##Creating a Symlink
Here’s where the magic happens:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In your mechanical location, &lt;strong&gt;right click&lt;/strong&gt; the newly pasted directory and
click &lt;strong&gt;Pick Link Source&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Go back to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steamapps&lt;/code&gt; directory and &lt;strong&gt;right click&lt;/strong&gt; then click &lt;strong&gt;Drop
As… &amp;gt; Symbolic Link&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If everything went well you should be able to launch the game through steam.&lt;/p&gt;

&lt;p&gt;I found the tool from &lt;a href=&quot;http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/&quot;&gt;a howtogeek article&lt;/a&gt; that came up in a google
search for symlink on windows 7.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Upgrading grep in OS X</title>
   <link href="https://otaku-elite.com/osx/2012/03/14/upgrading-grep-os-x/"/>
   <updated>2012-03-14T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/osx/2012/03/14/upgrading-grep-os-x</id>
   <content type="html">&lt;div class=&quot;deprecated&quot;&gt;
    &lt;h2&gt;This Article Is Outdated&lt;/h2&gt;
    &lt;p&gt;
        The information in this article is outdated and may contain information
        which is now incorrect.
        A &lt;a href=&quot;/osx/2013/01/02/upgrading-grep-os-x-revisited/&quot;&gt;newer version
        of this article&lt;/a&gt; is now available.
    &lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;By default OS X (10.7 in this case) comes installed with grep version 2.5.1.
Unfortunately if you want to use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--exclude-dir&lt;/code&gt; option (which you probably
will if you are using any type of
&lt;abbr title=&quot;Version Control System&quot;&gt;VCS&lt;/abbr&gt;) then you will have to upgrade
it, since this is a feature of grep version &amp;gt;= 2.5.1a. If you are using
&lt;a href=&quot;http://macports.org&quot;&gt;macports&lt;/a&gt; or &lt;a href=&quot;http://finkproject.org&quot;&gt;fink&lt;/a&gt; then the
solution is simple, install via the command line.&lt;/p&gt;

&lt;p&gt;Recently, I have been using &lt;a href=&quot;http://mxcl.github.com/homebrew/&quot;&gt;homebrew&lt;/a&gt;. Today
I found out that the use of homebrew to install already-bundled system
applications (like grep) is discouraged and unsupported, except with certain
special cases. Due to the way homebrew recipes work, however, this does not stop
us from making our own. In this case, I found one on the web. To install the
latest grep via homebrew:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew install xz #required for installing grep through homebrew
brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/grep.rb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After grep is installed via homebrew do a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep --version&lt;/code&gt;. If you are still
showing version 2.5.1 (which you should be) then you need to update your paths.
For some reason in OS X, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/bin&lt;/code&gt; comes before &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/bin&lt;/code&gt;, and for our
version of grep to be found by default we need to rearrange this. &lt;a href=&quot;http://stackoverflow.com/questions/5364614/is-there-a-problem-with-having-usr-local-bin-before-usr-bin-on-the-path-in-os&quot;&gt;From what I
read on stack overflow&lt;/a&gt; this is pretty harmless.&lt;/p&gt;

&lt;p&gt;There is a file called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/paths&lt;/code&gt; which lists paths one per line, if you have
administrator rights and you don’t feel guilty about modifying system files you
can rearrange this file to put &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/bin&lt;/code&gt; in front of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/bin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The other option is the more obvious per-user change in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt; or
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.profile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For more information and recipes not included in homebrew by default, check out
the &lt;a href=&quot;https://github.com/adamv/homebrew-alt/&quot;&gt;homebrew-alt&lt;/a&gt; repository on github.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Gettin' Tango Wid it</title>
   <link href="https://otaku-elite.com/osx/2012/03/13/gettin-tango-wid-it/"/>
   <updated>2012-03-13T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/osx/2012/03/13/gettin-tango-wid-it</id>
   <content type="html">&lt;p&gt;Recently I decided to give &lt;a href=&quot;http://www.sequelpro.com/&quot;&gt;Sequel Pro&lt;/a&gt; another whirl instead of running
&lt;a href=&quot;http://webyog.com&quot;&gt;SQLyog&lt;/a&gt; as I normally do on OS X under wine using &lt;a href=&quot;http://winebottler.kronenberg.org/&quot;&gt;WineBotter&lt;/a&gt;. My
first objective, however, was to customize the color scheme to something my eyes
are more accustomed to: the &lt;a href=&quot;http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines#Color_Palette&quot;&gt;tango color palette&lt;/a&gt;. Here’s a small preview
of what it looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/03/13/tango-light.png&quot; class=&quot;colorbox&quot;&gt;
    &lt;img src=&quot;/images/2012/03/13/tango-light-tn.png&quot; alt=&quot;My &apos;Tango Light&apos; Color Palette in Sequel Pro&quot; /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’ve also taken it upon myself to create a color palette for the built in OS X
color palette widget. You can download them both from the links below:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/files/2012/03/13/TangoLight.spTheme&quot;&gt;Tango Light Sequel Pro Theme&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/files/2012/03/13/Tango.clr&quot;&gt;Tango Light OS X Theme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>S&amp;M - Drum Cover</title>
   <link href="https://otaku-elite.com/videos/2012/03/12/s-m-drum-cover/"/>
   <updated>2012-03-12T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2012/03/12/s-m-drum-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/lk8dDBqeork&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Me rocking out to some Rihanna on my drum set. The original song is &lt;a href=&quot;http://www.youtube.com/watch?v=KdS6HFQ_LUc&quot;&gt;S&amp;amp;M by Rihanna&lt;/a&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Monaco "Bold" - Fixing the Ugly OS X Fonts in Lion</title>
   <link href="https://otaku-elite.com/nix/osx/2012/02/29/monaco-bold-fixing-the-ugly-os-x-fonts-in-lion/"/>
   <updated>2012-02-29T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/osx/2012/02/29/monaco-bold-fixing-the-ugly-os-x-fonts-in-lion</id>
   <content type="html">&lt;p&gt;One thing that’s really bugged me since I started using OS X Lion was the way my
favorite coding font—&lt;a href=&quot;http://en.wikipedia.org/wiki/Monaco_%28typeface%29&quot;&gt;Monaco&lt;/a&gt;—appears at 14pt and above. On my Snow Leopard
installation of OS X the fonts appear bold-ish, but on Lion they appear narrow
and emaciated. The characters actually appear so thin that it’s hard to read and
the font just does not look good. This forced me into using the font
&lt;a href=&quot;http://9-bits.com/post/123940811/menlo-font-macosx&quot;&gt;Menlo&lt;/a&gt;, which was Apple’s replacement to Monaco as a default terminal
font since Snow Leopard (10.6).&lt;/p&gt;

&lt;p&gt;Today I found the solution while complaining to a colleague of mine. I honestly
do my best problem solving while whining. Originally, I thought the problem was
that the font itself had changed. As I was explaining it I figured out
that the issue was maybe not the font, but the antialiasing applied to that
font. A quick search led me to an article on &lt;a href=&quot;http://rubenerd.com/font-smoothing-snow-leopard/&quot;&gt;font smoothing in snow
leopard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Following the guide there all that was left is to execute the command:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and restart my terminal and MacVim.&lt;/p&gt;

&lt;p&gt;Here is a before and after:&lt;/p&gt;

&lt;p&gt;&lt;a class=&quot;colorbox&quot; rel=&quot;images&quot; href=&quot;/images/2012/02/29/font-before.png&quot;&gt;
    &lt;img alt=&quot;ugly font rendering before&quot; src=&quot;/images/2012/02/29/t/font-before.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a class=&quot;colorbox&quot; rel=&quot;images&quot; href=&quot;/images/2012/02/29/font-after.png&quot;&gt;
    &lt;img alt=&quot;pretty font rendering after&quot; src=&quot;/images/2012/02/29/t/font-after.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think valid values to substitute in for the int are in the range 0–4.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>PHPUnit Fails Silently, Returning Code 255</title>
   <link href="https://otaku-elite.com/code/2012/02/27/phpunit-fails-silently-returning-code-255/"/>
   <updated>2012-02-27T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2012/02/27/phpunit-fails-silently-returning-code-255</id>
   <content type="html">&lt;p&gt;A few days ago I set up &lt;a href=&quot;http://phpunit.de&quot;&gt;PHPUnit&lt;/a&gt; on my OS X using &lt;a href=&quot;http://mamp.info&quot;&gt;MAMP&lt;/a&gt;’s
pear. Everything seemed to be set up properly except I kept getting this weird
issue anytime I ran phpunit, I would get the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;specs/ (dev) $ phpunit .
specs/ (dev) $ echo $?
255
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;No errors output, and phpunit is returning code 255. It took me forever to
figure out what this meant and none of the search results in google were helping
either. I finally realized the issue today.&lt;/p&gt;

&lt;p&gt;PHPUnit was encountering a php error. While I &lt;em&gt;thought&lt;/em&gt; I had &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;error_reporting&lt;/code&gt;
enabled in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt;. A few days later, I realized I had &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;display_errors&lt;/code&gt; set
to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Off&lt;/code&gt;. If you want to see what’s going on you have to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;display_errors&lt;/code&gt; to
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;On&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now I am getting more meaningful output (truncated):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Warning: require_once(PHPUnit/Framework.php): failed to open stream: No such file or directory

Fatal error: require_once(): Failed opening required &apos;PHPUnit/Framework.php&apos; (include_path=&apos;.:/Applications/MAMP/bin/php/php5.2.17/lib/php/PHPUnit:/Applications/MAMP/bin/php/php5.2.17/lib/php:/Users/gmcquillan/Sites/ZendFramework-1.10.6/library/&apos;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which I thought meant it’s not finding my PHPUnit library in my php include path.
I tried finagling with my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;include_path&lt;/code&gt; for quite a while.&lt;/p&gt;

&lt;p&gt;According to the output it was searching in the right spot, but still not coming
up for some reason. I eventually figured out that the cause of this issue was a
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;require_once&lt;/code&gt; statement that I had at the top of my unit test code file:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;PHPUnit/Framework.php&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When I looked in my PHPUnit directory I noticed this file did not exist, so it
must have been a difference between the version of PHPUnit I was using
previously and the current version.&lt;/p&gt;

&lt;p&gt;Here are some quick wins to help you solve your issue:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;display_errors&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt; (In MAMP 2.0.5 that’s in
 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/Applications/MAMP/bin/php/php5.2.17/conf/php.ini&lt;/code&gt; and of course if you’re
 using php 5.3 you should be editing the one in your php5.3 directory&lt;/li&gt;
  &lt;li&gt;Check the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;error_reporting&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once you are able to see the error message output, the problem should be very
clear. When changing php.ini the cli php will see changes immediately (unlike
apache where you will have to restart the server for changes to take effect)&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Autocompleting Rake Tasks In Bash</title>
   <link href="https://otaku-elite.com/code/2012/02/27/autocompleting-rake-tasks-in-bash/"/>
   <updated>2012-02-27T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2012/02/27/autocompleting-rake-tasks-in-bash</id>
   <content type="html">&lt;p&gt;I found out today that it’s possible to autocomplete rake tasks in bash. All
that’s needed is a simple ruby script and some changes to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.profile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;(Original information taken from &lt;a href=&quot;http://project.ioni.st/post/212&quot;&gt;a tumble blog
post&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;First you need to grab a script called
&lt;a href=&quot;https://raw.github.com/hk0i/dotfiles/macx/bin/rake-completion.rb&quot;&gt;ruby-completion.rb&lt;/a&gt;,
which I’ve already added to my github dotfiles repository.&lt;/p&gt;

&lt;p&gt;Then, as per the script comments, add the following to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.profile&lt;/code&gt; or
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;complete -C /path/to/rake-completion.rb -o default rake
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Make sure that the script has execute permissions (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chmod u+x
ruby-completion.sh&lt;/code&gt;) or it will return some strange results when you hit
tab&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Including Files Using Straight HTML</title>
   <link href="https://otaku-elite.com/nix/2012/02/23/including-files-using-straight-html/"/>
   <updated>2012-02-23T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/2012/02/23/including-files-using-straight-html</id>
   <content type="html">&lt;p&gt;Getting the job done for a particular task always calls forth the need for the
proper set of tools. In this particular case, the task was to create a
single-page static html content-rich site. When I say the site is “content-rich”
what I actually mean is that there are paragraphs upon paragraphs of copy: text,
images, etc.&lt;/p&gt;

&lt;p&gt;Editing a giant HTML page no different than editing a large file of code written
in any other language: &lt;em&gt;it is a maintenance nightmare&lt;/em&gt; and so it is what you
call &lt;strong&gt;not fun&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;##Searching for Solutions
I knew about &lt;a href=&quot;http://jekyllrb.com&quot;&gt;jekyll&lt;/a&gt; and of course since I love it so much, I wanted to
use it, however jekyll is way too much for what is needed. All I really need for
this particular project is a way to use include statements in HTML.&lt;/p&gt;

&lt;p&gt;###Server-Side Options
There are a number of different ways to include one HTML document inside of
another, but none of these methods are incorporated by using HTML directly by
itself. Anyone who is familiar with &lt;a href=&quot;http://php.net&quot;&gt;PHP&lt;/a&gt; is familiar with the
PHP [include]&lt;a href=&quot;&quot;&gt;php-include&lt;/a&gt; function:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;myfile.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;while those who haven’t used php who have used &lt;a href=&quot;http://apache.org&quot;&gt;apache&lt;/a&gt; or
Microsoft IIS are familiar with &lt;abbr title=&quot;Server Side Includes&quot;&gt;SSI&lt;/abbr&gt;,
which may appear in the form of something like:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- #include virtual=&quot;myfile.html&quot; --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Neither one of these options seemed all too appealing to me. They both required
some kind of processing from a server which is not testable offline without
running a local server and also requires processing on every page hit.&lt;/p&gt;

&lt;p&gt;What I really wanted was a way to be able to do this offline, and “build” my
site by piecing it together somehow.&lt;/p&gt;

&lt;p&gt;##Building Offline
Here are the other methods I came across, starting with the simplest ideas of my
own and moving on to the better ideas that I came across on the web.&lt;/p&gt;

&lt;p&gt;###The Unix cat Utility
The first thing I came up with was using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat&lt;/code&gt;. In case you don’t know, cat is
the unix utility which concatenates multiple files. This was my sure-fire way to
get the project moving assuming I couldn’t come up with something better. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat&lt;/code&gt;
has a few advantages and disadvantages.&lt;/p&gt;

&lt;p&gt;Advantages to using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;I already know how to use it&lt;/li&gt;
  &lt;li&gt;It’s fairly simple&lt;/li&gt;
  &lt;li&gt;There’s no way it won’t work&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages to using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;It is extremely messy&lt;/li&gt;
  &lt;li&gt;It will require start and end tags to be separated across multiple files&lt;/li&gt;
  &lt;li&gt;If there is an HTML error it will be hard to track across these multiple
files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;###Using sed and cat
The second idea I came up with was to create some kind of template, with
separate pages and somehow include them. I thought it might be possible to
somehow use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; to do a &lt;a href=&quot;http://regular-expressions.info&quot;&gt;regex&lt;/a&gt; replace, find
and replace something like&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ include myfile.html }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;with the value of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat myfile.html&lt;/code&gt;. This seemed kind of tricky and too much
work.&lt;/p&gt;

&lt;p&gt;Advantages of using sed and cat:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Gets me that nice looking template I wanted&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages of using sed and cat:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Requires a lot of coding and time spent trouble shooting regex, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;###Using the C Preprocessor
I went for some help on IRC after many failed attempts to return relevant search
results for my regex replacement method. After explaining my situation someone
recommended the use of a preprocessor—which is exactly what I was creating
without even realizing it. We found a document on the web with instructions on
&lt;a href=&quot;http://www.cs.tut.fi/~jkorpela/html/cpre.html&quot;&gt;Using a C preprocessor as an HTML authoring tool&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In short, this allows me to create a template file:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;blickity blah&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        #include &quot;mypage.html&quot;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and run it through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gcc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gcc -E -x c -P -C sample.htm &amp;gt; output/sample.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The original document goes through a breakdown of each flag, optionally you
could read the manpages for more detail (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;man gcc&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;This was pretty neat and I could have even stopped at this but I decided to go
with a slightly more elegant solution and rather than using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gcc&lt;/code&gt; I decided to
go with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m4&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Advantages to using C Preprocessor:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The tools and language are pre-existing&lt;/li&gt;
  &lt;li&gt;It is fairly easy to invoke&lt;/li&gt;
  &lt;li&gt;No extra work needed to be done&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages to using C Preprocessor:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Remembering the proper gcc arguments to disable the c compiler and enable
it for preprocessing only is a bit cumbersome unless you are extremely
familiar with gcc’s command line options.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;###Using M4
This method is identical to using the C Preprocessor. The difference here is
that it’s a little simpler. We create a template file similar to before:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;blickity blah&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        include(mypage.html)
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and run it through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m4&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;m4 index.html &amp;gt; output/index.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The only issue I had here with m4 is that it was adding a newline character
after my include for some reason. To fix that I used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dnl&lt;/code&gt; which I believe
stands for “discard new line.” If that’s too hard to remember, I like to think
of it as “do not line,” mostly because this makes no sense at all but keeps the
meaning clear. Now the original template looks something more like this:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;blickity blah&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        include(mypage.html)dnl
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Advantages to using m4:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The tools and language are pre-existing&lt;/li&gt;
  &lt;li&gt;It is fairly easy to invoke&lt;/li&gt;
  &lt;li&gt;No extra work needed to be done&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and for disadvantages… There are no real show-stopping disadvantages that I
can come up with.&lt;/p&gt;

&lt;p&gt;##Wrapping it Up
Here is how I set up a small example for production work.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir site
cd site/
mkdir pages templates webroot
for i in {1..5}; do echo &quot;&amp;lt;p&amp;gt;This is page $i&amp;lt;/p&amp;gt;&quot; &amp;gt; pages/page-$i.html; done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which leaves us with:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;.
├── pages
│   ├── page-1.html
│   ├── page-2.html
│   ├── page-3.html
│   ├── page-4.html
│   └── page-5.html
├── templates
└── webroot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here’s my explanation. Pages (or sections) will go into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pages/&lt;/code&gt; directory.
All templates will go under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;templates/&lt;/code&gt; the published result will be compiled
and sent to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webroot/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now let’s create a simple template (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim templates/index.html&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot;
&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Test Page&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            include(pages/page-1.html)dnl
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-2&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            include(pages/page-2.html)dnl
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-3&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            include(pages/page-3.html)dnl
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-4&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            include(pages/page-4.html)dnl
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            include(pages/page-5.html)dnl
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To help manage everything, I’m using a &lt;a href=&quot;http://docs.rubyrake.org/tutorial/index.html&quot;&gt;rakefile&lt;/a&gt;. If you don’t like rake
you’re welcome to use make or a shell script of your own. Here’s what the
Rakefile looks like (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim Rakefile&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;rake/clean&apos;&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;SRC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;templates/*.html&apos;&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;DEST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;webroot&apos;&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;CLEAN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DEST&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:compile&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Compiling...&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;templates&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;FileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SRC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;templates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;m4 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &amp;gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DEST&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:tidy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Tidying...&apos;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;FileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DEST&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/*.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;tidy -i -n -m &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:default&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;compile&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s somewhat configurable by changing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SRC&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DEST&lt;/code&gt; variables at the
top, to allow you to name your directories differently.&lt;/p&gt;

&lt;p&gt;Running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake&lt;/code&gt; will default to compiling your HTML:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rake
tree
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Outputs:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;.
├── Rakefile
├── pages
│   ├── page-1.html
│   ├── page-2.html
│   ├── page-3.html
│   ├── page-4.html
│   └── page-5.html
├── templates
│   └── index.html
└── webroot
    └── index.html

3 directories, 8 files
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and if we examine the output file:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot;
&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Test Page&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is page 1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-2&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is page 2&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-3&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is page 3&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-4&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is page 4&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is page 5&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Success!
If you noticed, I also added a bonus &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tidy&lt;/code&gt; task which can be invoked with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake
tidy&lt;/code&gt; afterwards, this will allow us to format the html in a pretty way and
validate it.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Custom Mission Control Keyboard Shortcuts in OS X</title>
   <link href="https://otaku-elite.com/nix/osx/2012/02/16/custom-mission-control-shortcuts-in-os-x/"/>
   <updated>2012-02-16T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/osx/2012/02/16/custom-mission-control-shortcuts-in-os-x</id>
   <content type="html">&lt;p&gt;One aspect of Mission Control in OS X Lion I found irritating was similar to
the problem I had with Spaces on Leopard and Snow Leopard: customizing the
shortcut keys to whatever I wanted.&lt;/p&gt;

&lt;p&gt;For a while, I had been using the middle mouse click as a method for showing
Mission Control, because it was more convenient than using CTRL + ↑. This
provided the disadvantage that I could not use the middle mouse button for
anything else—which I commonly use for opening new tabs in Firefox.&lt;/p&gt;

&lt;p&gt;Today I realized the solution here is similar to the solution of a previous
issue I had with customizing keyboard shortcuts. There is an entire section in
the &lt;strong&gt;Preferences Pane&lt;/strong&gt; dedicated to &lt;strong&gt;Keyboard Shortcuts&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open your &lt;strong&gt;Preferences Pane&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Click **Keyboard **&lt;br /&gt;
 &lt;img src=&quot;/images/2012/02/16/pref-pane.png&quot; alt=&quot;Preferences Page&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Click &lt;strong&gt;Keyboard Shortcuts&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Select &lt;strong&gt;Mission Control&lt;/strong&gt; on the left pane&lt;/li&gt;
  &lt;li&gt;Click on the box next to the mission control on the right side to specify a
 new shortcut
&lt;img src=&quot;/images/2012/02/16/kb-shortcuts.png&quot; alt=&quot;Keyboard Shortcuts&quot; /&gt;&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>Stop Rearranging My Spaces, OS X!</title>
   <link href="https://otaku-elite.com/blog/2012/02/09/stop-rearranging-my-spaces-os-x-lion/"/>
   <updated>2012-02-09T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/blog/2012/02/09/stop-rearranging-my-spaces-os-x-lion</id>
   <content type="html">&lt;p&gt;One of the most aggravating things I’ve had to put up with in Lion so far since
I started using it a month back probably has to be the revamped concept of
&lt;em&gt;spaces&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Being a huge linux nerd, I jumped for joy when I discovered that the
key shortcuts for spaces were now more customizable from Snow Leopard rendering
them “actually usable” for my purposes. One of the biggest downsides to the way
the new spaces work, however, is that the desktops will randomly get mixed up or
out of order. This leaves me with something like “Desktop 1, Desktop 3, Desktop
4, Desktop 2” which just seems kind of silly to me. The shortcuts will always
bring you to the right desktop no matter what, but if you use a touch pad
gesture or mouse button to show mission control it can be frustrating trying to
find the right desktop.&lt;/p&gt;

&lt;p&gt;Today I finally got fed up enough to find the solution. After scouring the net
for a hot minute I found a &lt;a href=&quot;http://lockergnome.net/questions/158698/os-x-lion-desktop-order&quot;&gt;post on lockergnome.net&lt;/a&gt; that led me to the
right answer.&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;System Preferences &amp;gt; Mission Control&lt;/strong&gt;, and uncheck &lt;strong&gt;Automatically
rearrange spaces based on most recent use&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2012/02/09/mc.png&quot; alt=&quot;Mission Control Preferences&quot; /&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Editing An Incorrect Commit Message In Git</title>
   <link href="https://otaku-elite.com/code/2012/02/08/editing-an-incorrect-commit-message-in-git/"/>
   <updated>2012-02-08T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2012/02/08/editing-an-incorrect-commit-message-in-git</id>
   <content type="html">&lt;p&gt;To fix an incorrect commit message to the head of a repository use the following
command:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git commit --amend
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will allow you to enter a new message for the previous commit.
From &lt;a href=&quot;http://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git#179147&quot;&gt;stack overflow&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Used to amend the tip of the current branch. Prepare the tree object you would
want to replace the latest commit as usual (this includes the usual -i/-o and
explicit paths), and the commit log editor is seeded with the commit message
from the tip of the current branch. The commit you create replaces the current
tip – if it was a merge, it will have the parents of the current tip as
parents – so the current top commit is discarded.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;It is a rough equivalent for:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ git reset --soft HEAD^
$ ... do something else to come up with the right tree ...
$ git commit -c ORIG_HEAD
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;but can be used to amend a merge commit.&lt;/p&gt;
&lt;/blockquote&gt;

</content>
 </entry>
 
 <entry>
   <title>MySQL and Rake - Library Not Loaded</title>
   <link href="https://otaku-elite.com/code/mysql/2012/02/03/mysql-and-rake-library-not-loaded/"/>
   <updated>2012-02-03T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/mysql/2012/02/03/mysql-and-rake-library-not-loaded</id>
   <content type="html">&lt;p&gt;When trying to run a Rakefile that I created under a linux environment on OS X
for the first time I ran into this message:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dlopen(/Users/myuser/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/myuser/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/myuser/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle

(See full trace by running task with --trace)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note: I was using MySQL provided by the OS X installer PKG file from the mysql
website, rather than using MAMP&lt;/p&gt;

&lt;p&gt;I googled the issue and found the problem on a &lt;a href=&quot;http://stackoverflow.com/questions/4254128/passenger-error-library-not-loaded&quot;&gt;stack overflow
post&lt;/a&gt;—which seemed to have useful information—but it didn’t work for
me.&lt;/p&gt;

&lt;p&gt;A comment one on one of the answers stated:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Your instance of the mysql2 gem was built against the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/mysql/lib/libmysqlclient.16.dylib&lt;/code&gt; library. For one reason or
another, that library is not currently available on your system at that
pathname (MySQL removed/moved/upgraded?).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and another comment had to offer:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;You probably need to rebuild your mysql2 gem and point it to the mysql_config (or mysql_config5) from your MySQL installation (in /usr/bin?):&lt;/p&gt;

  &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gem install mysql2 -- --with-mysql-config=/usr/bin/mysql_config
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;I tried the second option, by replacing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--with-mysql-config=&lt;/code&gt; with the one
I found on my system in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/mysql/bin/mysql_config&lt;/code&gt; but this didn’t
help. Then I looked at my error message and compared it to the one on the stack
overflow post and I realized the problem: the dylib was not in my path.&lt;/p&gt;

&lt;p&gt;##The Solution
The solution was to add the library to my path. Once again I poked around in
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/mysql/&lt;/code&gt; and located the proper path to the dylib and added it to my
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DYLD_LIBRARY_PATH&lt;/code&gt; environment variable in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.profile&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#add mysql dylib to dylib path&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DYLD_LIBRARY_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/mysql/lib/&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Managing Images with Jekyll</title>
   <link href="https://otaku-elite.com/code/2012/01/31/managing-images-with-jekyll/"/>
   <updated>2012-01-31T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/2012/01/31/managing-images-with-jekyll</id>
   <content type="html">&lt;p&gt;I’ve only been using &lt;a href=&quot;http://jekyllrb.com&quot;&gt;Jekyll&lt;/a&gt; for about a week now and I can already see
how managing images for each post could be an issue. I figure, I can’t have just
one &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;image/&lt;/code&gt; directory and dump everything in there because at some point the
file names will overlap and then I have to try to uniquely name all of my
images, which seems pretty complicated. The next idea I had was to create an
image directory to mimic the current date/time of the post, this way I could
have something like the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;images/
└── 2012
    └── 01
        ├── 24
        │   ├── keyboard-extra-key-small.png
        │   ├── keyboard-extra-key.jpg
        │   ├── keyboard-problem-small.png
        │   ├── keyboard-problem.jpg
        │   ├── keyboard-solution-small.png
        │   └── keyboard-solution.jpg
        └── 31
            ├── a.jpg
            ├── q.gif
            └── test.png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A somewhat structured and organized way of managing my images. &lt;em&gt;But wait!&lt;/em&gt; That
looks like a pain in the neck to create all of those directories and then move
all of my files in there! (Actually… it is).&lt;/p&gt;

&lt;p&gt;So here is my solution. I have added a rake task which will cleverly do all this
grunt work for me, plus one extra handy feature: it will move all of the loose
images in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images/&lt;/code&gt; directory where they belong.&lt;/p&gt;

&lt;p&gt;This is what it looks like:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Move all images in images/ to the current date image directory&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:images&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;images&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;FileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;images/*.*&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Rake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;original_dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;strftime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;/%Y/%m/%d/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;#unless the file list is empty&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;existing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;empty?&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Cleaning images: &apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;existing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos; =&amp;gt; &apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;begin&lt;/span&gt;
        &lt;span class=&quot;no&quot;&gt;Dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mkdir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;rescue&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;mv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;existing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With this, I can just dump all of the images relevant to the article post I’m
currently working on into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images/&lt;/code&gt;, then when I’m ready run a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake images&lt;/code&gt; and
have all of the images moved into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images/%Y/%m/%d&lt;/code&gt; according to the current
date/time.&lt;/p&gt;

&lt;p&gt;Note: this moves &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*.*&lt;/code&gt; which could be any type of file that has an extension,
not just images. I thought it would be too inaccurate to copy only specific file
extensions and I should only be putting images or anything I might consider an
image in there, anyway. Maybe a better name for this would be &lt;em&gt;media&lt;/em&gt; and then I
would rename &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images/&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;media/&lt;/code&gt; and have all media served from there.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Tab Settings Based On Filetype</title>
   <link href="https://otaku-elite.com/vim/2012/01/30/tab-settings-based-on-filetype/"/>
   <updated>2012-01-30T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/vim/2012/01/30/tab-settings-based-on-filetype</id>
   <content type="html">&lt;p&gt;This one is a widely known feature of vim, as it should be for any other editor
out there. Here’s a brief example on how to set your tab spacing settings
depending on the filetype in vim. Add the following to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-vim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;autocmd Filetype html &lt;span class=&quot;k&quot;&gt;setlocal&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;
autocmd Filetype &lt;span class=&quot;k&quot;&gt;ruby&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;setlocal&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;
autocmd Filetype javascript &lt;span class=&quot;k&quot;&gt;setlocal&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;(As seen on &lt;a href=&quot;http://stackoverflow.com/questions/1562633/setting-vim-whitespace-preferences-by-filetype&quot;&gt;stack
overflow&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;To find out the filetype of the current file in vim, type:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:set filetype
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Settings will take effect when the file is loaded, so you may need to source
your vimrc (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:so ~/.vimrc&lt;/code&gt;) and then &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:e&lt;/code&gt; your file again.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Terminal.app: Highlight Full File Path on Double Click (OS X)</title>
   <link href="https://otaku-elite.com/nix/osx/2012/01/30/terminal-app-highlight-full-file-path-on-double-click-os-x/"/>
   <updated>2012-01-30T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/osx/2012/01/30/terminal-app-highlight-full-file-path-on-double-click-os-x</id>
   <content type="html">&lt;p&gt;One of my biggest complaints about the terminal in OS X—vs. gnome-terminal in
the linux world, and possibly a few other terms—is that when I am using git or
svn and I want to add or commit only one file I can’t just double click the full
path to select it.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# Untracked files:
#   (use &quot;git add &amp;lt;file&amp;gt;...&quot; to include in what will be committed)
#
#   assets/themes/twitter/css/hi3.css
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;the default action when you double click on the word &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;twitter&lt;/code&gt; is that Terminal.app
will highlight only the word twitter. I wanted a way to make it highlight the
entire file path without grabbing the hash mark at the beginning of the line.
While it’s not my favorite solution, I did come across a forum post today that
explained holding the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmd&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shift&lt;/code&gt; keys when you double click will cause
Terminal.app to select the whole file path. Someone else added on later that
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmd + shift + double clicking&lt;/code&gt; a URL will open it.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Unknown Column Display Price Group 0 In Field List</title>
   <link href="https://otaku-elite.com/code/mysql/2012/01/30/unknown-column-display-price-group-0-in-field-list/"/>
   <updated>2012-01-30T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/mysql/2012/01/30/unknown-column-display-price-group-0-in-field-list</id>
   <content type="html">&lt;p&gt;Today while trying to apply my catalog price rules I came across the following
message:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SQLSTATE[42S22]: Column not found: 1054 Unknown column &apos;e.display_price_group_0&apos; in &apos;field list&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After searching google I found out that this can be fixed by rebuilding the
Flat Catalog &lt;em&gt;Product&lt;/em&gt; cache.&lt;/p&gt;

&lt;p&gt;source: &lt;a href=&quot;http://www.magentocommerce.com/boards/viewthread/42770/&quot;&gt;Magento Forum&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A Better Solution for Less.css</title>
   <link href="https://otaku-elite.com/vim/2012/01/26/a-better-solution-for-less-css/"/>
   <updated>2012-01-26T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/vim/2012/01/26/a-better-solution-for-less-css</id>
   <content type="html">&lt;p&gt;Recently I’ve discovered the joys of working with &lt;a href=&quot;http://lesscss.org/&quot;&gt;less.css&lt;/a&gt; (not to be
confused with the &lt;a href=&quot;http://lessframework.com/&quot;&gt;less framework&lt;/a&gt;, which is also related to CSS). I
think the one thing that turned me on to the idea was the &lt;a href=&quot;http://incident57.com/less/&quot;&gt;Less.app&lt;/a&gt; GUI
application for Mac OS X.&lt;/p&gt;

&lt;p&gt;Less.app monitors a directory and when there are any file changes to any
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.less&lt;/code&gt; files, it compiles a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.css&lt;/code&gt;, minifies it, and places it in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/css&lt;/code&gt;
directory, preserving a directory structure like the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;site/
├── css
│   └── main.css
└── less
    └── main.less
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I kind of liked this idea because I thought it kept everything neat. The only
problem I had with Less.app is that it didn’t seem to work very often. I had a
lot of issues where I would save a file and it would not pick the changes up. I
had to hit save &lt;em&gt;twice&lt;/em&gt; for it to pick up the changes, and even then sometimes
it would crash completely and have to be restarted. It got to the point where I
would have to restart Less.app 2–5 times in a one hour session. I am assuming
that it was related to the way vim saves files, otherwise nobody else would be
using this app. After 3 or 4 program updates I noticed the problem was still
there and something had to be done.&lt;/p&gt;

&lt;p&gt;I found out from a buddy that another tool called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lessc&lt;/code&gt; was available
from the creators of less. I had seen it mentioned in blog posts but I was never
able to find it until one day I realized it was on their &lt;a href=&quot;https://github.com/cloudhead/less.js&quot;&gt;github page&lt;/a&gt; in
the &lt;a href=&quot;https://github.com/cloudhead/less.js/tree/master/bin&quot;&gt;bin&lt;/a&gt; directory.&lt;/p&gt;

&lt;p&gt;Grab &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lessc&lt;/code&gt; and make sure it’s in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$PATH&lt;/code&gt;.
In order to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lessc&lt;/code&gt;, you need to install &lt;a href=&quot;http://nodejs.org/&quot;&gt;node.js&lt;/a&gt;. On OS X, this can
be done via &lt;a href=&quot;http://mxcl.github.com/homebrew/&quot;&gt;homebrew&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;node
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or &lt;a href=&quot;http://macports.org&quot;&gt;macports&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;port &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;node
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or on Ubuntu using the following:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;python-software-properties
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;add-apt-repository ppa:chris-lea/node.js
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nodejs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I created this bash script which wraps &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lessc&lt;/code&gt; to add some functionality:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lesscomp&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#compile less.css files, and compress them hardcore.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$# &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; 1 &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;infile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;outfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;basename&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;infile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;%.*&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;outpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$infile&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/../css&quot;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$outpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;outfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$outpath&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$outfile&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.css&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else
        &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;outfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$infile&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$outfile&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.css&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi
    &lt;/span&gt;lessc &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$infile&lt;/span&gt; |perl &lt;span class=&quot;nt&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;chomp; print &quot;$_&quot;;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$outfile&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The script attempts to save the output file to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;css/&lt;/code&gt; directory one level up
from the .less file, assuming that directory exists. If it cannot find a
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;../css/&lt;/code&gt; then it will output to the same directory as the input file.  Place it
somewhere in your path, I usually throw all of my scripts into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/bin&lt;/code&gt; and
add that to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$PATH&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then, add the following to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vimrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-vim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;au&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;BufWritePost&lt;/span&gt; *&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;less &lt;span class=&quot;k&quot;&gt;silent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!&lt;/span&gt;lesscomp %
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Excel vs. CSV</title>
   <link href="https://otaku-elite.com/blog/misc/2012/01/25/excel-vs-csv-well-thats-silly/"/>
   <updated>2012-01-25T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/blog/misc/2012/01/25/excel-vs-csv-well-thats-silly</id>
   <content type="html">&lt;p&gt;I came across an interesting bug today with Microsoft Excel 2012.
Historically, Excel has had this lovely issue of not being able to handle
importing CSV data when there is an endline character in the middle of a
field. So if your file looks like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot;name&quot;,&quot;description&quot;,&quot;price&quot;
&quot;coffee&quot;,&quot;delicious coffee from Brazil
*mud flavor available!&quot;,&quot;10.99&quot;
&quot;green tea&quot;,&quot;tea which is green&quot;,&quot;5.99&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Excel will see the endline in the first record and immediately assume that the end
of the line means the end of the record. Creating a second row with the name
“*mud flavor available!” and a description of “10.99” which is clearly not what
we want.&lt;/p&gt;

&lt;p&gt;Today I found out that for whatever god forsaken reason, Microsoft has decided
that when you &lt;em&gt;double click&lt;/em&gt; the csv file to open it, these situations are
handled properly. However if you attempt to do a &lt;em&gt;data import&lt;/em&gt; from inside
Excel, the behavior changes and Excel is unable to handle the endlines.&lt;/p&gt;

&lt;p&gt;Another important thing to note is that Excel will &lt;strong&gt;not&lt;/strong&gt; recognize &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\n&lt;/code&gt; as an
endline character, it &lt;em&gt;has&lt;/em&gt; to be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\r\n&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Excel also appears to be unable to open csv files from the &lt;em&gt;File &amp;gt; Open&lt;/em&gt; menu.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: this was noted &amp;amp; tested on Excel 2012 for OS X&lt;/strong&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Disabling A Key On Your Keyboard</title>
   <link href="https://otaku-elite.com/nix/2012/01/24/disabling-a-key-on-your-keyboard/"/>
   <updated>2012-01-24T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/2012/01/24/disabling-a-key-on-your-keyboard</id>
   <content type="html">&lt;p class=&quot;post-img&quot;&gt;
    &lt;img src=&quot;/images/2012/01/24/keyboard-extra-key-small.png&quot; alt=&quot;extra backspace key located above keypad minus&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.microsoft.com/hardware/en-us/p/natural-ergonomic-keyboard-4000&quot;&gt;Microsoft Natural Ergonomic Keyboard 4000&lt;/a&gt; that I use at work has
this lovely extra backspace button that I always seem to hit by mistake against
the bottom side of the desk when using the keyboard on my lap, which I do often.&lt;/p&gt;

&lt;p class=&quot;post-img&quot;&gt;
    &lt;img src=&quot;/images/2012/01/24/keyboard-problem-small.png&quot; alt=&quot;keyboard on lap bumps against desk&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;I never thought much of this until one day I almost deleted a table in my dev
database (luckily it was on dev and luckily SQLyog asked for confirmation first)
This raised a red flag, I knew something had to be done. “Ah”, I thought, “I’ll
just use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xmodmap&lt;/code&gt; to remap the extra backspace key to do nothing.” Here are the
steps I took:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Load up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xev&lt;/code&gt; from the terminal. xev (x-event) is a tool which will help you
capture all x events.&lt;/li&gt;
  &lt;li&gt;Press the desired key&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Grab the &lt;strong&gt;keycode&lt;/strong&gt; section of the output from the terminal. For example,
 pressing the ‘a’ key yields the keycode &lt;strong&gt;38&lt;/strong&gt;:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; KeyRelease event, serial 35, synthetic NO, window 0x7200001,
 root 0x27a, subw 0x0, time 607631713, (-736,656), root:(702,705),
 state 0x10, keycode &amp;gt;&amp;gt;&amp;gt; 38 &amp;lt;&amp;lt;&amp;lt; (keysym 0x61, a), same_screen YES,
 XLookupString gives 1 bytes: (61) &quot;a&quot;
 XFilterEvent returns: False
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;In the case of my extra backspace, the keycode resolved to &lt;strong&gt;22&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xmodmap&lt;/code&gt; to unassign the key. I believe there is actually a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;remove&lt;/code&gt;
directive, but since I don’t know exactly how to use it I just assign it to
nothing:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; xmodmap -e &apos;keycode 22 = &apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Now try using the key you disabled!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Awesome! My extra backspace key stopped working. I tested it on the other
machine as well through synergy just to make sure and all was well there, too!&lt;/p&gt;

&lt;p&gt;##But wait, there’s more!
I went back to work and soon I discovered my mistake. Keycode 22 is the same
keycode that the normal backspace key produces. I cursed out Microsoft but only
until I came up with a reliable, more &lt;a title=&quot;Take that, Microsoft!&quot; href=&quot;/images/2012/01/24/keyboard-solution.jpg&quot; class=&quot;colorbox&quot;&gt;cross-platform
solution&lt;/a&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Mouse and Keyboard - Simple Sharing with Synergy</title>
   <link href="https://otaku-elite.com/nix/2012/01/23/mouse-and-keyboard-simple-sharing-with-synergy/"/>
   <updated>2012-01-23T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/nix/2012/01/23/mouse-and-keyboard-simple-sharing-with-synergy</id>
   <content type="html">&lt;p&gt;When working with multiple computers it can be a pain to have to interface with
multiple inputs such as keyboards, mice, etc. Not only does it get confusing
from time to time, but it’s just plain annoying. Especially when there is a
laptop in play.&lt;/p&gt;

&lt;p&gt;In my case, I wanted to use my mac laptop (lid closed) and an external display,
since staring down at a 13” screen for 8+ hours a day wasn’t going over too well
with my neck. The way to go about doing this is to close the lid, plug in
another input device and monitor and start typing or clicking on it and
unlocking the screen. With the mac laptops this is also only possible when the
AC power adapter is connect. Due to some networking issues at work I was also
required to plug in to a wired network as well. So now I had to plug in: power,
mouse, keyboard, monitor, and a network cable. This worked well for me for about
2–3 days. Then I realized something.  Plugging all of this junk into the
the laptop every day when I get into the office and unplugging it when I leave
was a pain in the ass. That’s when I remembered about an old &lt;em&gt;friend&lt;/em&gt; of mine
called &lt;a href=&quot;http://synergy-foss.org/&quot;&gt;synergy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;##synergy
Synergy is a software package that attempts to emulate a KVM switch, minus the
video portion—since it’s software. It works by running a client/server desktop
application. One computer acts as the server, sharing its mouse and keyboard,
while the other computer connects to it as a client to borrow the shared input
devices.&lt;/p&gt;

&lt;p&gt;I’m not going to get into the basics of configuring synergy from the ground up
(after all, I did say it was an &lt;em&gt;old&lt;/em&gt; friend, right?). The point I wanted to
focus on in this post was how I took it a step further by adding &lt;strong&gt;encryption&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I was a little bit concerned about security this time around, since previously
when I used synergy at work I was connecting a linux computer (host) to a
windows box (client) and I didn’t really care about security on windows
because—well—it’s windows. Now I am using synergy to connect the peripherals
which are attached to the same linux machine to a mac laptop. Mac OS X—like
linux—requires authentication every now and then, and my login password isn’t
something I wanted to broadcast over the office network in broad daylight. After
doing a bit of research I found out that I can tunnel the synergy client via SSH
to encrypt it. After following the instructions and doing some tests I created a
couple of scripts to do this for me:&lt;/p&gt;

&lt;p&gt;##synergy-connect
The first script is called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;synergy-connect&lt;/code&gt;. It creates the SSH tunnel on my
localhost and it forwards all requests on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;24800&lt;/code&gt; (the default synergy
port) to the same port on a different host name.&lt;/p&gt;

&lt;p&gt;Remember that when configuring synergy, synergy &lt;strong&gt;requires&lt;/strong&gt; a host name to be
used. Synergy will &lt;em&gt;not&lt;/em&gt; connect to an IP address. This means that if you are
having trouble connecting your synergy to an IP address it’s time to add some
entries to your hosts file and optionally set up a static IPs for the machines as
well.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;synergy-connect&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

ssh &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-N&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; localhost:24800:remoteHostName:24800 remoteHostName
synergyc localhost
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##resyn
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;resyn&lt;/code&gt; is another script that I created which closes out synergy and reconnects
it, this is extremely convenient for when you need to reconnect and doing so
means losing your only input device to type in the connect command again after
disconnecting it.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;resyn&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

killall &lt;span class=&quot;nt&quot;&gt;-9&lt;/span&gt; ssh
killall &lt;span class=&quot;nt&quot;&gt;-9&lt;/span&gt; synergyc
synergy-connect
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Working With Comma Separated Lists In Mysql</title>
   <link href="https://otaku-elite.com/code/mysql/2012/01/23/working-with-comma-separated-lists-in-mysql/"/>
   <updated>2012-01-23T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/code/mysql/2012/01/23/working-with-comma-separated-lists-in-mysql</id>
   <content type="html">&lt;p&gt;I was asked recently to provide a feed from Magento which would provide a list
of all active SKUs, with product names, descriptions, urls and a comma separated
list of categories &lt;strong&gt;by name&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I assembled a query in MySQL. I grabbed all the products from
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;catalog_product_entity&lt;/code&gt; and joined it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;catalog_product_entity_int&lt;/code&gt; to
determine if the products are enabled—pretty standard operation. Then after
doing this I joined again to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;catalog_product_flat&lt;/code&gt; table for the
appropriate store ID since it’s easier to pull product information from than
joining to the same varchar table 150 times. I ran into a small problem when it
came down to getting the category names.&lt;/p&gt;

&lt;p&gt;The categories in magento are stored as a comma separated list of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;entity_id&lt;/code&gt;s
in the cache tables, &lt;em&gt;not&lt;/em&gt; a comma separated list of category &lt;strong&gt;names&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I worked a bit on it until I ended up with a query that was capable of getting a
comma separated list of &lt;em&gt;names&lt;/em&gt; for a single row. It looked something like&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;catalog_category_flat_store_1&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entity_id&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;IN&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* example list of ids... */&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is where I thought, “wow MySQL makes it so easy to work with comma
separated lists”—&lt;strong&gt;&lt;span style=&quot;color: #ef2929&quot;&gt;WRONG&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While getting this list was simple, iterating over a result set with this query
was not a possibility because when the field returns the values it returns them
as a string. In other words:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;&quot;1, 2, 3&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I pulled the following query from &lt;a href=&quot;http://www.slickdev.com/2008/09/15/mysql-query-real-values-from-delimiter-separated-string-ids/&quot;&gt;slickdev&lt;/a&gt; after searching for a
number of hours:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;DELIMITER&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;DROP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FUNCTION&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;EXISTS&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`splitAndTranslate`&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FUNCTION&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;splitAndTranslate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;TEXT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;124&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RETURNS&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;TEXT&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;DETERMINISTIC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;BEGIN&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;DECLARE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;INT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;-- total number of delimiters&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;DECLARE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ctr&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;INT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;-- counter for the loop&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;DECLARE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;str_len&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;-- string length,self explanatory&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;DECLARE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;out_str&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;-- return string holder&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;DECLARE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp_str&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;-- temporary string holder&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;DECLARE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp_val&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;-- temporary string holder for query&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;-- get length&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;str_len&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;LENGTH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;LENGTH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;LENGTH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;LENGTH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;-- get total number delimeters and add 1&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;-- add 1 since total separated values are 1 more than the number of delimiters&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;-- start of while loop&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WHILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DO&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;-- add 1 to the counter, which will also be used to get the value of the string&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ctr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;-- get value separated by delimiter using ctr as the index&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp_str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SUBSTRING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SUBSTRING_INDEX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ctr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;LENGTH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SUBSTRING_INDEX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;-- query real value and insert into temporary value holder, temp_str contains the exploded ID&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;real_value_column&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp_val&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;my_table&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;table_id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;-- concat real value into output string separated by delimiter&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;out_str&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp_val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;,&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WHILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- end of while loop&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;-- trim delimiter from end of string&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;out_str&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;TRIM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;TRAILING&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delim&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;out_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;RETURN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;-- return&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;then adapted it for my needs and it worked. The query takes about 5 minutes to
run after all the modifications I made.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>/etc/hosts.ac? what the duck is that?</title>
   <link href="https://otaku-elite.com/vim/osx/2012/01/21/hosts-dot-ac-what-the-duck-is-that/"/>
   <updated>2012-01-21T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/vim/osx/2012/01/21/hosts-dot-ac-what-the-duck-is-that</id>
   <content type="html">&lt;p&gt;Recently at my job I’ve started doing some work on a mac (yay!) which means I
now get to use some of the fun extra mac tools that I don’t have available on
linux, but it also means having some things that are more difficult to
configure, strangely.&lt;/p&gt;

&lt;p&gt;The first anomaly I’ve encountered so far was in adding host entries for sites
that are not in our DNS. These are sites that are either not in DNS &lt;em&gt;yet&lt;/em&gt; but
are pending or sites that will never be added to DNS due to security reasons or
because they are not intended to be used by anyone but us programmers.&lt;/p&gt;

&lt;p&gt;##The Problem
The first thing I noticed when editing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts&lt;/code&gt; file on OS X Lion for
the first time is that when I rebooted the machine all changes I made would
disappear completely. Sometimes they would even change if I didn’t reboot. When
I opened up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc&lt;/code&gt; I noticed there was another file called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts.ac&lt;/code&gt; which
I had never seen before. Originally I thought this was some sort of system
change that Apple had made, but I later on discovered that this was actually the
work of Cisco’s AnyConnect VPN client. Cisco automatically replaces your
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts&lt;/code&gt; with its own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts.ac&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;##The Zinger
Here’s the zinger: OS X does not know about hosts.ac, nor does it care. So what
do we do in this situation? Well after having to edit both files for a long time
I decided it was time to do something about it. Here is my solution.&lt;/p&gt;

&lt;p&gt;Create a vim autocmd to save all changes made to /etc/hosts into /etc/hosts.ac
also. Throw the following snippet into your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-vim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;au&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;BufWritePost&lt;/span&gt; hosts &quot;clear &lt;span class=&quot;k&quot;&gt;all&lt;/span&gt; autocommands
&lt;span class=&quot;k&quot;&gt;au&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;BufWritePost&lt;/span&gt; hosts &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;!&lt;/span&gt; %&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;ac &lt;span class=&quot;s2&quot;&gt;&quot;save a copy of hosts as &quot;&lt;/span&gt;hosts&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;ac&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Don’t forget to source your vimrc again after. Now when you save your hosts file
it will automatically copy it to your hosts.ac, now Cisco and OS X can be happy
together!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;There is one downside to this approach, unfortunately. I couldn’t
figure out how to hone it specifically on the hosts file in /etc/ so this
autocmd will actually trigger on any file in any location named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hosts&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For more information about manipulating file names in vim check out&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:h filename-modifiers
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>otaku-elite meets jekyll</title>
   <link href="https://otaku-elite.com/blog/2012/01/21/otaku-elite-meets-jekyll/"/>
   <updated>2012-01-21T00:00:00-06:00</updated>
   <id>hhttps://otaku-elite.com/blog/2012/01/21/otaku-elite-meets-jekyll</id>
   <content type="html">&lt;p&gt;After not having the desire to post content to this site for a very long time I
decided it was time to take action. But how? And what was the problem in the
first place?&lt;/p&gt;

&lt;p&gt;##The Problem
I needed a way to log (blog?) my discoveries for all of the things I do, but
mostly work related stuff, since that’s where I spend most of my time (har har).
Even though being a PHP programmer may seem like a pretty normal thing in that
over time you sort of learn the ropes and acquire your sack of tricks to reuse
over and over I’ve found myself always craving for something a little extra. I
always push myself to find something new and &lt;em&gt;interesting&lt;/em&gt; at work that can help
me get my work done better and more effectively than before. Let’s face it, if I
always did everything the same way I’d just get bored all the time.&lt;/p&gt;

&lt;p&gt;What I really needed was an efficient way to log my findings.
I tried setting up a &lt;a href=&quot;http://drupal.org&quot;&gt;drupal&lt;/a&gt; blog at work. It took me quite some time to get
all the settings configured right and all the right plugins installed. Then to
customize the themes and all of that and then you have to deal with caching and
whatever else. After I took the time to go through all of that I realized more
and more how inconvenient it was for me to add content to the blog
itself—nothing against drupal itself, as I would always recommend drupal to
most people—but the part about drupal I did not like was having to log into an
admin section on the site and have to click around in a few places, then write
the post using HTML in a text field provided by the CMS. I’m also not a fan of
using wysiwyg &lt;em&gt;anything&lt;/em&gt;, either.&lt;/p&gt;

&lt;p&gt;As a temporary solution I was using the &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/its-all-text/&quot;&gt;it’s all text&lt;/a&gt; extension for
firefox, which helps when I have to do anything with drupal in that it allows me
to use my favorite editor (&lt;a href=&quot;http://vim.org&quot;&gt;vim&lt;/a&gt;). The down side to this is that it also
added another step. And after saving the buffer in vim I still had to click the
save button in drupal, and since there is no “save &amp;amp; continue editing” button by
default in drupal it became a nuisance in that testing slight changes
repeatedly became a cumbersome task.&lt;/p&gt;

&lt;p&gt;After switching to git and using github for a while I became very comfortable
with writing documentation using &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;markdown&lt;/a&gt;, and I decided to forget the
whole blog as a website thing all together and just store a bunch of markdown
text files on my hard drive which were generated for me by a shell script that I
wrote. The shell script accepts an article title as an argument and automatically
generates a markdown file in an organized directory structure that resembles
something like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y-m/d/post-title.md&lt;/code&gt;. I created another bash script which would
execute a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; on the directory as well so the articles were all searchable.
This worked fairly well for me for some time as it allowed me to just open up a
terminal and type, for example, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;createblog creating modules in magento&lt;/code&gt; and
just start typing away. I always thought that if I wanted to publish it or read
it nicely later on I could create some other script to generate PDFs or HTML and
link them together.&lt;/p&gt;

&lt;p&gt;##The Solution
Then I found out about &lt;a href=&quot;http://jekyllrb.com&quot;&gt;jekyll&lt;/a&gt;. Jekyll is &lt;em&gt;not&lt;/em&gt; a CMS, but rather a text
parsing engine which works similar to what I was just explaining, except all of
the complicated advanced features that I would ever think to implement myself
were already done for me (tagging and categorizing, just to name a few). So in
short, jekyll will take markdown or &lt;a href=&quot;http://textile.sitemonks.com/&quot;&gt;textile&lt;/a&gt; as input and throw a template
on over it to generate some nice HTML.&lt;/p&gt;

&lt;p&gt;##Jekyll Bootstrap
The initial setup for jekyll was a pain in the butt. Especially since it comes
with absolutely no templates or framework and the documentation is a bit hairy
since it doesn’t say too much right out and the github pages are a little bit
tricky to navigate since they seem to have absolutely no ordering to them at
all. After searching around some more for information on jekyll (which for some
reason appears to be rather scarce) I came across &lt;a href=&quot;http://jekyllbootstrap.com/&quot;&gt;jekyll bootstrap&lt;/a&gt; which
is a framework geared for getting you started out on jekyll using twitter’s own
&lt;a href=&quot;http://twitter.github.com/bootstrap/&quot;&gt;bootstrap&lt;/a&gt; css framework. Which got me to where I am now, a &lt;em&gt;decent&lt;/em&gt;
looking site using jekyll which provided the least amount of effort possible and
now I can focus on my content :)&lt;/p&gt;

&lt;p&gt;There will probably be more (concise) blog posts to come that focus in on hot
topics that the rest of the world may actually care about.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Sometimes I Rage</title>
   <link href="https://otaku-elite.com/videos/2011/08/06/sometimes-i-rage/"/>
   <updated>2011-08-06T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2011/08/06/sometimes-i-rage</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/RR90WNxO1SM&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Here’s an original song I wrote and performed for a League of Legends song competition. I did not win :(&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Teenage Dirtbag Guitar Cover</title>
   <link href="https://otaku-elite.com/videos/2011/06/26/teenage-dirtbag-guitar-cover/"/>
   <updated>2011-06-26T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2011/06/26/teenage-dirtbag-guitar-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/FUtPhxKX3fc&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;This is me performing &lt;a href=&quot;http://www.youtube.com/watch?v=FC3y9llDXuM&quot;&gt;Teenage Dirtbag&lt;/a&gt; by Wheatus.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>California Gurls Drum Cover</title>
   <link href="https://otaku-elite.com/videos/2011/04/24/california-gurls-drum-cover/"/>
   <updated>2011-04-24T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2011/04/24/california-gurls-drum-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/GxFLkgP4Qa8&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;My first time trying to record a drum cover of a pop song. The original song is &lt;a href=&quot;http://www.youtube.com/watch?v=F57P9C4SAW4&quot;&gt;California Gurls&lt;/a&gt; by Katy Perry.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Story of My Life - Guitar Cover</title>
   <link href="https://otaku-elite.com/videos/2011/04/03/story-of-my-life-guitar-cover/"/>
   <updated>2011-04-03T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2011/04/03/story-of-my-life-guitar-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/fzXB9AhEeds&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Me performing &lt;a href=&quot;http://www.youtube.com/watch?v=oh8zcbC_Dcw&quot;&gt;Story of My Life&lt;/a&gt; by Social Distortion.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Follow Me - Guitar Cover</title>
   <link href="https://otaku-elite.com/videos/2011/03/19/follow-me-guitar-cover/"/>
   <updated>2011-03-19T00:00:00-05:00</updated>
   <id>hhttps://otaku-elite.com/videos/2011/03/19/follow-me-guitar-cover</id>
   <content type="html">&lt;div class=&quot;youtube video&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/d3KaSCxc2ws&quot; frameborder=&quot;0&quot;&gt;&amp;nbsp;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;This is the first music video I’ve ever made. It’s a cover the Uncle Kracker song &lt;a href=&quot;http://www.youtube.com/watch?v=0Gjx-ZQuQ_Y&quot;&gt;Follow Me&lt;/a&gt;.&lt;/p&gt;

</content>
 </entry>
 
 
</feed>
