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

<channel>
	<title>josh is gross &#187; Coding</title>
	<atom:link href="http://www.joshisgross.com/blog/category/coding/feed" rel="self" type="application/rss+xml" />
	<link>http://www.joshisgross.com/blog</link>
	<description>there is no tagline</description>
	<lastBuildDate>Sun, 05 Feb 2012 11:45:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Remove MySQL from Mac OS X, Snow Leopard</title>
		<link>http://www.joshisgross.com/blog/remove-mysql-from-mac-os-x-snow-leopard</link>
		<comments>http://www.joshisgross.com/blog/remove-mysql-from-mac-os-x-snow-leopard#comments</comments>
		<pubDate>Wed, 12 Jan 2011 21:52:40 +0000</pubDate>
		<dc:creator>Joshua Gross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1273</guid>
		<description><![CDATA[If your system has a mishmash of MySQL installs like mine did earlier today, it makes sense to start with a clean slate. I had the default that comes with xcode, the version that comes with MAMP, and then one &#8230; <a href="http://www.joshisgross.com/blog/remove-mysql-from-mac-os-x-snow-leopard">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If your system has a mishmash of MySQL installs like mine did earlier today, it makes sense to start with a clean slate. I had the default that comes with xcode, the version that comes with MAMP, and then one I had tried to install from source. After running Oracle&#8217;s GUI installer, none of them would run. At this point, a fresh start made sense &#8211; I wiped all traces of MySQL from my system and started from scratch with the GUI installer. <a href="http://akrabat.com/computing/uninstalling-mysql-on-mac-os-x-leopard/">Here are the details from Rob Allen</a>.</p>
<p>If you&#8217;re running MAMP, it might help to nuke that too. </p>
<p>Additionally, I recommend getting rid of old config files:<br />
  <tt>rm /etc/my.cnf</tt><br />
  <tt>rm /etc/mysql/my.cnf</tt><br />
  <tt>rm /usr/local/mysql/etc/my.cnf</tt><br />
  <tt>rm ~/.my.cnf</tt></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/remove-mysql-from-mac-os-x-snow-leopard/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preliminary hierarchy of programming languages</title>
		<link>http://www.joshisgross.com/blog/preliminary-hierarchy-of-programming-languages</link>
		<comments>http://www.joshisgross.com/blog/preliminary-hierarchy-of-programming-languages#comments</comments>
		<pubDate>Fri, 31 Dec 2010 03:14:09 +0000</pubDate>
		<dc:creator>Joshua Gross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1263</guid>
		<description><![CDATA[A preliminary hierarchy of programming languages. Incomplete but I got most significant languages (for me, anyway). Comments very appreciated. I made this with GraphViz on my MacBook in a day. Programming Language Hierarchy v1 (1.2 MB PNG)]]></description>
			<content:encoded><![CDATA[<p>A preliminary hierarchy of programming languages. Incomplete but I got most significant languages (for me, anyway).
<p>Comments very appreciated. I made this with GraphViz on my MacBook in a day.</p>
<p><a href="http://www.joshisgross.com/downloads/pl_hierarchy_v1.png">Programming Language Hierarchy v1</a> (1.2 MB PNG)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/preliminary-hierarchy-of-programming-languages/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TwitterTranslate 2.0 available</title>
		<link>http://www.joshisgross.com/blog/twittertranslate-2-0-available</link>
		<comments>http://www.joshisgross.com/blog/twittertranslate-2-0-available#comments</comments>
		<pubDate>Wed, 06 Oct 2010 18:06:04 +0000</pubDate>
		<dc:creator>Joshua Gross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Social Networking]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1244</guid>
		<description><![CDATA[New version of TwitterTranslate out today: it works with the new Twitter web interface shows you the original text if you click on the translation indicator below a tweet automatically translates any new tweets that show up on a tweet &#8230; <a href="http://www.joshisgross.com/blog/twittertranslate-2-0-available">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>New version of TwitterTranslate out today: it</p>
<ol>
<li>works with the new Twitter web interface</li>
<li>shows you the original text if you click on the translation indicator below a tweet</li>
<li>automatically translates any new tweets that show up on a tweet &#8211; when scrolling the page, etc</li>
</ol>
<p><a href="http://www.joshisgross.com/blog/projects/twittertranslate">Get it get it!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/twittertranslate-2-0-available/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My latest project: TwitterTranslate</title>
		<link>http://www.joshisgross.com/blog/my-latest-project-twittertranslate</link>
		<comments>http://www.joshisgross.com/blog/my-latest-project-twittertranslate#comments</comments>
		<pubDate>Tue, 24 Aug 2010 07:37:50 +0000</pubDate>
		<dc:creator>Joshua Gross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1224</guid>
		<description><![CDATA[Tonight I made this little Safari 5 extension: TwitterTranslate Pretty simple &#8211; it finds any foreign tweets on your Twitter feed and translates them to English, or Spanish, or Japanese, or whatever your native language is. Enjoy!]]></description>
			<content:encoded><![CDATA[<p>Tonight I made this little Safari 5 extension: <a href='http://www.joshisgross.com/blog/TwitterTranslate' >TwitterTranslate</a></p>
<p>Pretty simple &#8211; it finds any foreign tweets on your Twitter feed and translates them to English, or Spanish, or Japanese, or whatever your native language is. Enjoy! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/my-latest-project-twittertranslate/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP best practices #1: duplication is evil</title>
		<link>http://www.joshisgross.com/blog/php-best-practices-1-duplication-is-evil</link>
		<comments>http://www.joshisgross.com/blog/php-best-practices-1-duplication-is-evil#comments</comments>
		<pubDate>Mon, 05 Jul 2010 06:15:24 +0000</pubDate>
		<dc:creator>JoshuaGross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[coding php]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1080</guid>
		<description><![CDATA[I am very opinionated about my code.  The source of most of my opinions is the DRY/DIE principal: Don&#8217;t Repeat Yourself / Duplication Is Evil.   Take, for instance, a Human Resources application I worked on recently. It is a &#8230; <a href="http://www.joshisgross.com/blog/php-best-practices-1-duplication-is-evil">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div>
<p>I am very opinionated about my code.  The source of most of my opinions is the DRY/DIE principal: Don&#8217;t Repeat Yourself / Duplication Is Evil.</p>
<p> </p>
<p>Take, for instance, a Human Resources application I worked on recently. It is a collection of web forms to get information to and from the HR department at work.  I inherited the system and had to make several improvements: form field validation had to be more robust, submitted form data had to be formatted in a prettier way, fields had to be removed/added, etc.</p>
<p>This was a pain. This application was simple &#8211; two forms, less than 50 fields total across each. Total lines of PHP code: 1000 maximum, including comments and HTML. That&#8217;s tiny! And yet, within this tiny code base, information was duplicated <em>at least </em>six times. And it was inconsistent &#8211; each duplicated piece of information told a different, contradictory story about the web form.</p>
<p>This is why I have internalized the DRY/DIE principal. If you stick with this principal from the get-go, applications are much more robust and easier to maintain. Luckily, my story has a happy ending: I ported 90% of it to <a href="http://github.com/JoshuaGross/php-frame">PHP-Frame</a> and modified the forms with time to spare, and even got a few nice cosmetic extras in.</p>
<p>tl;dr for this post: next project you&#8217;re working on, count how many places you duplicate similar information. Try to minimize that number. I reduced it from 6 to 2 in my application (all the form field validation requirements laid out in the application&#8217;s Model; and all the form fields laid out in HTML).  Many methods can be used to avoid (or eliminate, when refactoring) duplicated code and information, including solid framework design (which I have focused on thus far) and using generated code (which I haven&#8217;t delved into very much). Regardless of which path you take: don&#8217;t duplicate <strong>code</strong>, and don&#8217;t duplicate <strong>information</strong>.  Duplication is evil.</p>
<p> </p>
<p>Further reading:</p>
<p><a href="http://en.wikipedia.org/wiki/Rule_of_three_(programming)">Rule three [wikipedia]</a></p>
<p><a href="http://en.wikipedia.org/wiki/Single_Source_of_Truth">Single source of truth [wikipedia]</a></p>
<p><a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">Don&#8217;t Repeat Yourself [wikipedia]</a></p>
<p><a href="http://en.wikipedia.org/wiki/Separation_of_concerns">Separation of concerns [wikipedia]</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/php-best-practices-1-duplication-is-evil/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Best Practices: Introduction</title>
		<link>http://www.joshisgross.com/blog/php-best-practices-introduction</link>
		<comments>http://www.joshisgross.com/blog/php-best-practices-introduction#comments</comments>
		<pubDate>Fri, 02 Jul 2010 06:22:51 +0000</pubDate>
		<dc:creator>JoshuaGross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1076</guid>
		<description><![CDATA[  I started programming when I was about 12, did so continuously until I was 18, took a couple years off to be a kid again, and recently started programming again seriously (in professional, production, multiple-developer environments). I have a &#8230; <a href="http://www.joshisgross.com/blog/php-best-practices-introduction">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p> </p>
<div id="_mcePaste">I started programming when I was about 12, did so continuously until I was 18, took a couple years off to be a kid again, and recently started programming again seriously (in professional, production, multiple-developer environments).</div>
<p>I have a lot of standards and ideals with programming, but there are also a lot of gaps. This &#8220;best practices&#8221; series will be my attempt to explain every facet of my programming philosophy, and hopefully start a conversation.</p>
<p>I think this conversation is necessary because most code we see on a daily basis is bad &#8211; real bad. It&#8217;s bloated and slow when it works at all. It&#8217;s brittle and doesn&#8217;t like to change. It probably took forever to get the initial product, but it probably needs a LOT of work &#8211; and that&#8217;s unfortunate since it&#8217;s so difficult to change.</p>
<p>I will probably talk a lot about unit testing and MVC. The reason you should read more is because I don&#8217;t like the way those are done now, at all; I think we can do better. The reason I want you to read more is because I know you, as a programmer, are uncomfortable with a lot of what you do. There should be a better way to do things, and I intend to discover it &#8211; with your help.</p>
<p> </p>
<p>So, before I write my next post, a note : any methods I come up with should be general enough to port to other languages. PHP is what I&#8217;m most familiar with, but I don&#8217;t intend to be exclusive.</p>
<p> </p>
<p>Thanks for reading.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/php-best-practices-introduction/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fancy command-line alarm for Mac OS X</title>
		<link>http://www.joshisgross.com/blog/fancy-command-line-alarm-for-mac-os-x</link>
		<comments>http://www.joshisgross.com/blog/fancy-command-line-alarm-for-mac-os-x#comments</comments>
		<pubDate>Thu, 01 Jul 2010 05:41:09 +0000</pubDate>
		<dc:creator>JoshuaGross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1077</guid>
		<description><![CDATA[I have a Calc exam in the morning. Instead of studying for it, I decided to program a command-line alarm for myself so I don&#8217;t sleep through the exam. It doesn&#8217;t help that my phone is MIA and I&#8217;ve never &#8230; <a href="http://www.joshisgross.com/blog/fancy-command-line-alarm-for-mac-os-x">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have a Calc exam in the morning. Instead of studying for it, I decided to program a command-line alarm for myself so I don&#8217;t sleep through the exam. It doesn&#8217;t help that my phone is MIA and I&#8217;ve never owned a regular alarm clock.</p>
<p>Here:</p>
<p><code><br />
#!/bin/bash<br />
osascript -e 'tell app "iTunes" to pause' > /dev/null<br />
osascript -e "set Volume 3"<br />
say "Wake up, Josh. Time to get out of bed. You have an exam to take."<br />
sleep 5<br />
osascript -e "set Volume 0.5"<br />
osascript -e 'tell app "iTunes" to play playlist "morning music"' > /dev/null<br />
sleep 5<br />
osascript -e "set Volume 1"<br />
sleep 5<br />
osascript -e "set Volume 1.5"<br />
sleep 5<br />
osascript -e "set Volume 2"<br />
sleep 5<br />
osascript -e "set Volume 2.5"<br />
sleep 5<br />
osascript -e "set Volume 3"<br />
</code></p>
<p>Save it in your ~/bin folder, reference it from your crontab, set up a &#8220;Morning music&#8221; playlist in iTunes and customize the wakeup message. Also, the tiered volume is fun but really janky. </p>
<p>And my crontab, IN CASE YOU WONDERED: </p>
<p></code><br />
0 8 * * mon,tue,wed,thu,fri ~/bin/alarm.sh > /dev/null<br />
30 8 * * mon,tue,wed,thu,fri ~/bin/alarm.sh > /dev/null<br />
0 9 * * sat,sun ~/bin/alarm.sh > /dev/null<br />
30 9 * * sat,sun ~/bin/alarm.sh > /dev/null<br />
</code></p>
<p>A snooze feature would be nice, but that can wait. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/fancy-command-line-alarm-for-mac-os-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC or just pretending?</title>
		<link>http://www.joshisgross.com/blog/mvc-or-just-pretending-2</link>
		<comments>http://www.joshisgross.com/blog/mvc-or-just-pretending-2#comments</comments>
		<pubDate>Tue, 15 Jun 2010 16:55:17 +0000</pubDate>
		<dc:creator>JoshuaGross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1049</guid>
		<description><![CDATA[I used to think I hated MVC. I realized in the past few months that MVC is great, but not many programmers actually adhere to it in the PHP world. A lot of PHP frameworks pay lip service to MVC &#8230; <a href="http://www.joshisgross.com/blog/mvc-or-just-pretending-2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I used to think I hated MVC. I realized in the past few months that MVC is great, but not many programmers actually adhere to it in the PHP world. </p>
<p>A lot of PHP frameworks pay lip service to MVC without actually adhering to any strict standards.  I see this resulting in (1) duplicated code, (2) duplicated information, and (3) a messy hodge-podge of PHP+HTML, almost every day.</p>
<p>The first symptom (duplicated code) happens because of sloppy programming more than not sticking to MVC. However, the problem is much worse because functional code is placed in the controller, the model, AND the view. Functional code should be placed only in the controller (or &#8220;helpers&#8221; or &#8220;libraries&#8221; called from the controller, as the case may be depending on your framework).</p>
<p>The second symptom (duplicated information) occurs because information is placed in the controller and the view. It should only be in the model. For example, form validation: the controller should validate form data, but all validation information should be in the model. </p>
<p>The third symptom occurs because functional code and information is placed in the view. Only the layout and UI design should go into the view. Form validation, sending emails, saving to the database &#8211; that&#8217;s outside the boundaries of the view, or it should be. </p>
<p>I&#8217;m still trying to flesh all these details out. One thing I know for sure that will improve a project by leaps and bounds &#8211; don&#8217;t allow PHP code in the view! At all. Ever. Some programming philosophies state that, because PHP is a templating language itself, HTML and PHP should be mixed together. I think that&#8217;s wrong. It leads to messy, hard to manage, and even dangerous code. My solution is the <a href="http://github.com/JoshuaGross/php-frame">template engine in PHP-Frame</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/mvc-or-just-pretending-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP links of the day</title>
		<link>http://www.joshisgross.com/blog/php-links-of-the-day</link>
		<comments>http://www.joshisgross.com/blog/php-links-of-the-day#comments</comments>
		<pubDate>Fri, 04 Jun 2010 20:22:50 +0000</pubDate>
		<dc:creator>JoshuaGross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/php-links-of-the-day</guid>
		<description><![CDATA[Here are two helpful pages I discovered working today: RFC 822 compliant email validator for PHP: http://www.iamcal.com/publish/articles/php/parsing_email/ A bunch of handy regular expressions: http://www.roscripts.com/PHP_regular_expressions_examples-136.html (I&#8217;m using the currency regular expressions, but they all look handy)]]></description>
			<content:encoded><![CDATA[<p>Here are two helpful pages I discovered working today:</p>
<p>RFC 822 compliant email validator for PHP: http://www.iamcal.com/publish/articles/php/parsing_email/</p>
<p>A bunch of handy regular expressions: http://www.roscripts.com/PHP_regular_expressions_examples-136.html<br />
(I&#8217;m using the currency regular expressions, but they all look handy)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/php-links-of-the-day/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Journal system with list and theme features</title>
		<link>http://www.joshisgross.com/blog/journal-system-with-list-and-theme-features</link>
		<comments>http://www.joshisgross.com/blog/journal-system-with-list-and-theme-features#comments</comments>
		<pubDate>Thu, 27 May 2010 07:06:18 +0000</pubDate>
		<dc:creator>JoshuaGross</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[journal]]></category>

		<guid isPermaLink="false">http://www.joshisgross.com/blog/?p=1022</guid>
		<description><![CDATA[I really like journaling. It&#8217;s how I process my thoughts. Often, it&#8217;s helpful for me to go back and review past thoughts I&#8217;ve had or ideas I&#8217;ve jotted down. This tends to become difficult if content isn&#8217;t marked up, but &#8230; <a href="http://www.joshisgross.com/blog/journal-system-with-list-and-theme-features">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I really like journaling. It&#8217;s how I process my thoughts. Often, it&#8217;s helpful for me to go back and review past thoughts I&#8217;ve had or ideas I&#8217;ve jotted down. This tends to become difficult if content isn&#8217;t marked up, but I don&#8217;t want to dissect my journal files so much that they can&#8217;t be read linearly.</p>
<p>I don&#8217;t have a complete solution yet, but I have a work-in-progress journaling system. If I run a script called &#8220;journal-today&#8221;, it will open a text file named YYYY.MM.DD (for example, 2010.05.27 for today). It will then insert the time and open the file in VIM for me.</p>
<p>Next, I need a LIST and a THEME feature. The list feature is already working. If I wrap a block of text in &lt;List=&#8221;name&#8221;&gt;&lt;/List&gt; tags, my system will display the latest list of that name. If I want to edit the list, it copies the latest version of a list to a new file and then appends the updated list to today&#8217;s journal file. Lists are useful for, among other things: todo lists, reading lists, prayer lists, etc. That&#8217;s just what I&#8217;ve been doing for the past few days.</p>
<p>Next is a THEME feature for related content that doesn&#8217;t necessarily need updating.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshisgross.com/blog/journal-system-with-list-and-theme-features/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

