<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-475044182734234812</id><updated>2024-08-26T22:12:38.736-07:00</updated><title type='text'>Try Or Else</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06827024087778615976</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-475044182734234812.post-3294169333381390574</id><published>2012-11-24T15:29:00.000-08:00</published><updated>2012-11-24T15:29:29.191-08:00</updated><title type='text'>How to Get Your Code into your Computer - Choosing a Text Editor</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/5/58/CTR_census_machine.JPG/800px-CTR_census_machine.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/5/58/CTR_census_machine.JPG/800px-CTR_census_machine.JPG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
One of the first challenges I ran into when learning to program was figuring out how to get my program into my computer. Based on the examples I was reading in my Perl book, I was pretty sure punchcards were no longer in use, and that I would need to use a text editor of some sort. I don&#39;t think I knew it was called a text editor at the time, though. So, I did what any good business school student would do and opened Microsoft Word. Wrong. I found that Word is good for writing essays, bad for writing code. So, I went to the opposite end of the spectrum of Microsoft text editors, and opened Notepad. Also wrong, but I didn&#39;t realize this for a very long time. I wrote a lot of Perl scripts in Notepad, and it really hurt my eyes.&amp;nbsp;I didn&#39;t realize I had options, and I didn&#39;t know what I was missing. I will first discuss what I was missing out on by using Notepad, then I will go through some of the best options.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
What is essential in a text editor&lt;/h2&gt;
&lt;div&gt;
Remember that, although your code is intended to be executed by a computer, it should be easily readable by humans. Well organized, well documented code is the most important aspect of readability, but a good text editor can make a huge difference, too.&lt;/div&gt;
&lt;h3&gt;
Monospace font&lt;/h3&gt;
&lt;div&gt;
You may have accidentally set the font of one of your Word documents to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Courier&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, and thought &quot;Why would anyone ever want a font so ugly?&quot; Hold your tongue. Beauty is in the eye of the beholder, and for a software developer there is not much more beautiful than properly formatted code. See the difference for your self.&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Code in Monospace&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if (this.fontType === &#39;monospace&#39;) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; enjoy();&lt;br /&gt;} else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; gougeEyes();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;h4&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Code in Times&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;if (this.fontType === &#39;monospace&#39;) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&amp;nbsp; enjoy();&lt;br /&gt;} else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&amp;nbsp; gougeEyes();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;
Syntax Highlighting&lt;/h3&gt;
&lt;div&gt;
Any text editor worth its salt will provide syntax highlighting for all major programming languages, as well as the ability to add highlighting for other languages (see extensibility below). The first time I wrote a PHP file in &lt;a href=&quot;http://en.wikipedia.org/wiki/Gedit&quot; target=&quot;_blank&quot;&gt;gedit&lt;/a&gt;, I got really excited because of the extremely basic syntax highlighting I saw.&lt;br /&gt;
&lt;br /&gt;
Note, the computer can understand your code without syntax highlighting (and with any font type you choose, including wingdings), but syntax highlighting is essential for the developer&#39;s sanity. Try finding the syntax error below with and without syntax highlighting.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
Without Highlighting&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;function sendMessage() {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; var message = &#39;I love syntax highlighting, don&#39;t you?&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; alert(message);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;
With Highlighting&lt;/h4&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt;&lt;/b&gt; &lt;span style=&quot;color: orange;&quot;&gt;sendMessage&lt;/span&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;var&lt;/span&gt;&lt;/b&gt; &lt;span style=&quot;color: orange;&quot;&gt;message&lt;/span&gt; = &lt;span style=&quot;color: lime;&quot;&gt;&#39;I love syntax highlighting, don&#39;&lt;/span&gt;t you?&lt;span style=&quot;color: lime;&quot;&gt;&#39;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: lime; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; alert(message);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: lime; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
This particular color scheme may be a bit ugly, but Blogger didn&#39;t give me a lot to work with. And I think the point is clear. Syntax highlighting makes coding much easier.&lt;br /&gt;
&lt;h2&gt;
What is really nice to have in a text editor&lt;/h2&gt;
&lt;div&gt;
In my opinion, you can go very far with a text editor that offers only the two features mentioned above. However, I have added a short, non-comprehensive list of other features that can really improve your experience.&lt;/div&gt;
&lt;h3&gt;
Extensibility&lt;/h3&gt;
&lt;div&gt;
At LinkedIn, we &lt;a href=&quot;http://engineering.linkedin.com/frontend/leaving-jsps-dust-moving-linkedin-dustjs-client-side-templates&quot; target=&quot;_blank&quot;&gt;switched&lt;/a&gt; from using JSPs (Java based templates) to &lt;a href=&quot;https://github.com/linkedin/dustjs&quot; target=&quot;_blank&quot;&gt;Dust&lt;/a&gt;, a new JavaScript-based templating language. Because Dust is new, syntax highlighting was not available in most text editors (it is now for &lt;a href=&quot;https://github.com/jimmyhchan/dustjs.vim&quot; target=&quot;_blank&quot;&gt;Vim&lt;/a&gt; and &lt;a href=&quot;https://github.com/jimmyhchan/Dustjs.tmbundle&quot; target=&quot;_blank&quot;&gt;Textmate&lt;/a&gt;). Extensible text editors allow plugins, which can add many features the core text editor doesn&#39;t already offer. Not necessary, but really useful.&lt;/div&gt;
&lt;h3&gt;
Autocompletion&lt;/h3&gt;
&lt;div&gt;
When you are writing code, you end up writing the same words over and over again. Variables, function names, class names, etc. are repeated several times throughout your code. If you misspell a single instance of one of these words, you will run into trouble. Many text editors offer some form of autocompletion, from simple implementations (like Vim&#39;s ctrl+n, which just looks for matches of other words in the file that start with the same characters) to smarter, more complex versions (like Visual Studio&#39;s &lt;a href=&quot;http://en.wikipedia.org/wiki/IntelliSense&quot; target=&quot;_blank&quot;&gt;IntelliSense&lt;/a&gt;, which makes intelligent guesses for autocompletion based on context as well as characters typed).&lt;/div&gt;
&lt;h3&gt;
Keyboard Shortcuts&lt;/h3&gt;
&lt;div&gt;
I love keyboard shortcuts. So much that I almost called this feature essential. I rarely use the mouse when I use a computer, and I really hate user interfaces that absolutely require you to use a mouse (like Mac OS X&#39;s modal popups - why doesn&#39;t tab work in those things?). In a text editor, keyboard shortcuts should make it easy to navigate, rearrange, and modify your code.&lt;/div&gt;
&lt;h3&gt;
Debugging Tools&lt;/h3&gt;
&lt;div&gt;
We&#39;ll get to this in more detail below, but it&#39;s worth mentioning here. Some text editors only a part of a larger system - an integrated development environment, or IDE. Debugging tools are a large part of what (from my perspective) make IDEs useful. Debugging tools of some sort are essential to software development, but they can exist outside of the text editor (web developers use web browsers like Chrome and Firefox for this purpose), so I have classified them as nice-to-have. Debugging is a huge part of software development, and deserves an entire post (or an entire blog) of its own, so I&#39;ll leave it at that for now.&lt;/div&gt;
&lt;h2&gt;
What are your options&lt;/h2&gt;
&lt;h3&gt;
Vim&lt;/h3&gt;
&lt;div&gt;
I&#39;ll start with Vim because it is the editor I use every day. &lt;a href=&quot;http://en.wikipedia.org/wiki/Vim_(text_editor)&quot; target=&quot;_blank&quot;&gt;Vim&lt;/a&gt; was publicly released in 1991 - I wasn&#39;t using it then, but I would guess it looks about the same today as it did then. Vim is based on &lt;a href=&quot;http://en.wikipedia.org/wiki/Vi&quot; target=&quot;_blank&quot;&gt;vi&lt;/a&gt;&amp;nbsp;(Vim = &lt;b&gt;V&lt;/b&gt;i &lt;b&gt;Im&lt;/b&gt;proved), which was written by &lt;a href=&quot;http://en.wikipedia.org/wiki/Bill_Joy&quot; target=&quot;_blank&quot;&gt;Bill Joy&lt;/a&gt; in 1976. I wasn&#39;t even alive then, but I&#39;m guessing Vim today looks a lot like Vi did then. This is because Vim is a terminal-based editor (though it does have a GUI version).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0r1I_UjyO8OaaBALhl7V6zorvXWFO3nG3p9Yp-gXclogxzS3zCOtlATcW2gzkzVfu95pkV6438C62AJKECH0MFaMXqIN6uV-FEN-apRu6_gbPgwr3XTH_en0_hmbphUWRV9zfEDGT50gu/s1600/Screen+Shot+2012-11-24+at+1.44.34+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;286&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0r1I_UjyO8OaaBALhl7V6zorvXWFO3nG3p9Yp-gXclogxzS3zCOtlATcW2gzkzVfu95pkV6438C62AJKECH0MFaMXqIN6uV-FEN-apRu6_gbPgwr3XTH_en0_hmbphUWRV9zfEDGT50gu/s320/Screen+Shot+2012-11-24+at+1.44.34+PM.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Vim is lightweight, and is available on perhaps every operating system you will ever see. At first, Vim seems very confusing, because there is more than one mode, and standard OS keyboard shortcuts like copy and paste are a bit different (e.g. you paste by typing &quot;p&quot;, not &quot;ctrl+v&quot;). The first time you use Vim, you will get frustrated, because it&#39;s a text editor (should be simple) and you don&#39;t know how to edit any text.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
However, this confusion is short-lived, and the power of Vim&#39;s keyboard shortcuts and other native features, as well as the incredible plugins that are freely available make it worth it. If you are familiar with Gmail&#39;s keyboard shortcuts, you are already on your way to becoming a Vim user. If you want to learn vim, open a terminal (more on this in a future post), and type &quot;vimtutor&quot;.&lt;/div&gt;
&lt;h3&gt;
Emacs (not iMacs)&lt;/h3&gt;
&lt;div&gt;
Emacs was written around the same time as Vi, and it also lives inside the terminal (with an optional GUI version). &lt;a href=&quot;http://en.wikipedia.org/wiki/Emacs&quot; target=&quot;_blank&quot;&gt;Emacs&lt;/a&gt; is built to be extremely extensible (I&#39;ve heard it said that &quot;Emacs is a great operating system. The only thing missing is a good text editor.&quot;), and keyboard shortcuts are a major part of the Emacs philosophy. Emacs is short for &lt;b&gt;E&lt;/b&gt;ditor &lt;b&gt;Mac&lt;/b&gt;ro&lt;b&gt;s&lt;/b&gt;, because users can string sets of keyboard shortcuts into macros, sometimes to the point where it gets a bit silly (see XKCD comic below). Vi/Vim and Emacs are sort of rivals. They are very similar in a lot of ways, and they are both very confusing to new users. Emacs ended up being more confusing for me, so I am (firmly) in the Vim camp.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://imgs.xkcd.com/comics/real_programmers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;348&quot; src=&quot;http://imgs.xkcd.com/comics/real_programmers.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Notepad++&lt;/h3&gt;
&lt;div&gt;
When I only owned Windows computers, &lt;a href=&quot;http://notepad-plus-plus.org/&quot; target=&quot;_blank&quot;&gt;Notepadd++&lt;/a&gt; was my editor of choice (though I now realize I could have been using Vim). As a quick sidenote, Notepad++ is a play on the name of C++, the programming language. The &quot;++&quot; is a increment operator - it means one greater than. So, C++ is one greater than C, and Notepad++ is one greater than Notepad. I haven&#39;t used Notepad++ for quite a while, and I never thoroughly explored it&#39;s features, but it does have the essentials, and I can say that it is at least &quot;one greater than&quot; Notepad. It is a GUI editor, and all of your standard OS keyboard shortcuts will work as expected. You already know how to use Notepad++.&lt;/div&gt;
&lt;h3&gt;
gedit&lt;/h3&gt;
&lt;div&gt;
After my first few months of programming Perl scripts in Notepad (and a brief stint with C# in Visual Studio), I moved on to a Linux (Ubuntu) development environment. The default GUI editor in Ubuntu is&amp;nbsp;&lt;a href=&quot;http://projects.gnome.org/gedit/&quot; target=&quot;_blank&quot;&gt;gedit&lt;/a&gt;&amp;nbsp;(it&#39;s also available for Mac OS and Windows). Gedit has all the essential features, and is at least moderately extensible. Like Notepad++, you already know how to use it. I learned how to write PHP/HTML, CSS, and JavaScript in gedit, and it will always hold a special place in my heart. Apparently it&#39;s pronounced &quot;gee - edit&quot;, but I always though it was pronounced with a hard g (almost like &quot;get it&quot;). Deciding the correct pronunciation of open source software can be very tricky.&lt;/div&gt;
&lt;h3&gt;
Sublime Text/Textmate&lt;/h3&gt;
&lt;div&gt;
I&#39;m grouping &lt;a href=&quot;http://www.sublimetext.com/&quot; target=&quot;_blank&quot;&gt;Sublime Text&lt;/a&gt; and &lt;a href=&quot;http://macromates.com/&quot; target=&quot;_blank&quot;&gt;Textmate&lt;/a&gt; together because (a) I haven&#39;t used either extensively, (b) I understand that they are very compatible, and (c) they seem to be the cool kids&#39; editors (if we can really say that cool kids &lt;i&gt;have&lt;/i&gt;&amp;nbsp;editors). These are GUI editors that you (mostly) already know how to use. They are extensible, and they include some really cool features. You can set up &quot;projects&quot;, and that seems to make code searches a bit easier (though I can&#39;t imagine they are any faster than &lt;a href=&quot;http://betterthangrep.com/&quot; target=&quot;_blank&quot;&gt;ack&lt;/a&gt;). One feature that I am very jealous of is Multiple Selections. Sublime Text will let you select all instances of a word, and edit all of them at the same time (kind of like find and replace, except with live editing). You can try both Sublime Text and Textmate for free, but if you decide to make one of them your primary text editor, you will need to pay.&lt;/div&gt;
&lt;h3&gt;
Eclipse/Visual Studio&lt;/h3&gt;
&lt;div&gt;
None of the editors mentioned so far are IDEs. I spend spend most of my time writing JavaScript, so my IDE is a browser. If you are working in languages like Java or Scala, you will probably want to use a full blown IDE, like &lt;a href=&quot;http://www.eclipse.org/&quot; target=&quot;_blank&quot;&gt;Eclipse&lt;/a&gt;. Eclipse and Visual Studio have all of the essentials and all the nice to haves. They are also much heavier pieces of software, and they are more difficult to learn to use. Eclipse is good for most open source programming languages, and is probably the favorite editor of Java developers. Visual Studio is built for .NET programming.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Choosing the best one&lt;/h2&gt;
&lt;div&gt;
I love Vim, and I recommend Vim, but I recognize that Vim is not the right editor for everyone. If you don&#39;t want to spend a few hours learning how to use your text editor, Vim and Emacs (replace hours with weeks for Emacs) are not for you, and Eclipse and Visual Studio are probably out as well. If you are not comfortable using the command line, Vim and Emacs are probably not for you. So, while my first recommendation is Vim, if you are just learning to program, I would go for one of the GUI editors. Notepad++ if you are on Windows, gedit if you are on Linux (and you&#39;re cheap), and Sublime Text if you are on Mac (or you&#39;re not cheap). I acknowledge that choosing a text editor is not an easy decision. I hope this has helped you. Good luck!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/3294169333381390574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tryorelse.blogspot.com/2012/11/how-to-get-your-code-into-your-computer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/3294169333381390574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/3294169333381390574'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/2012/11/how-to-get-your-code-into-your-computer.html' title='How to Get Your Code into your Computer - Choosing a Text Editor'/><author><name>Steven Foote</name><uri>http://www.blogger.com/profile/14962545993541438145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_MSD2vrZ4o2AM7NmA_naUG6QQgfzeKf_EpyI5cjdhZUrDNvcjuX39ukbjoOoL5dVkrc1o5aUnL72KvgRiNdgMjSPxoPxThq4mMiXFodXJW6eLa1ctAuyAD698CaFotw/s220/1401269_10101721392891819_7124411858859722369_o+%281%29.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0r1I_UjyO8OaaBALhl7V6zorvXWFO3nG3p9Yp-gXclogxzS3zCOtlATcW2gzkzVfu95pkV6438C62AJKECH0MFaMXqIN6uV-FEN-apRu6_gbPgwr3XTH_en0_hmbphUWRV9zfEDGT50gu/s72-c/Screen+Shot+2012-11-24+at+1.44.34+PM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-475044182734234812.post-1030557850929364290</id><published>2012-11-13T08:32:00.002-08:00</published><updated>2012-11-13T08:32:33.432-08:00</updated><title type='text'>How websites work</title><content type='html'>I used to think that computers were magic. Do a search on Google for a place to buy custom alligator skin cowboy boots, and magic happens. Search for an old colleague on LinkedIn and magic happens. The more you learn about computers and programming, the less magic some parts seem. On the flip side, the more magic other parts seem (how does Google do that?)&lt;br /&gt;
&lt;br /&gt;
Today I want to take a bit of the magic out of the way the web works. I&#39;ll throw in a bit of history as well.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Web Browsers
&lt;/h2&gt;
A web browser is a piece of software on your computer (&lt;a href=&quot;http://www.whatbrowser.org/&quot; target=&quot;_blank&quot;&gt;click here for more info&lt;/a&gt;). It&#39;s there to help you access web pages. The first web browser, WorldWideWeb, was created by &lt;a href=&quot;http://en.wikipedia.org/wiki/Tim_Berners-Lee&quot; target=&quot;_blank&quot;&gt;Sir Tim Berners-Lee&lt;/a&gt; in 1990. This is the same guy who invented the actual World Wide Web (as in &lt;i&gt;the&lt;/i&gt; web. Yeah, it wasn&#39;t Al Gore). The first popular web browser, Mosaic, was launched in 1993 by a college student named &lt;a href=&quot;http://www.blogger.com/www.linkedin.com/in/pmarca/&quot; target=&quot;_blank&quot;&gt;Marc Andreessen&lt;/a&gt;. Unlike &lt;a href=&quot;http://en.wikipedia.org/wiki/Bill_gates&quot; target=&quot;_blank&quot;&gt;other&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Mark_Zuckerberg&quot;&gt;notable&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Steve_Wozniak&quot;&gt;computer scientists&lt;/a&gt;, Andreessen graduated from college. He went on to cofound Netscape, which later created a project that was called the &quot;Mosiac Killer&quot;, or Mozilla. Sound familiar?&lt;br /&gt;
&lt;br /&gt;
Web browsers can also be called &quot;clients&quot;. They make requests to and receive responses from servers. These requests are made using the Hypertext Transfer Protocol (HTTP). HTTP is a set of rules for how information gets passed between clients and servers.&amp;nbsp;The two most common types of HTTP requests are &quot;GET&quot; (generally used for requesting data from the server) and &quot;POST&quot; (generally used for sending data to the server). One of the most common ways to make a GET request is by typing a URL into the browser&#39;s address bar, and hitting enter.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
URLs and DNS&lt;/h2&gt;
A Uniform Resource Locator (or URL) is the website&#39;s address that you type into the address bar. A URL is made of several parts, but we will focus on just one for now: the domain name. The domain name of this blog is &quot;blogspot.com&quot;. The domain name is the name of the server to which you would like your request to be sent. Computers on a network are identified by a number (an IP address), and not by names. So, the name needs to be translated into a number. This happens through a Domain Name System (DNS), very similar to the way that the Contacts app on your phone translates your friends&#39; names into phone numbers.&lt;br /&gt;
&lt;h2&gt;
Servers&lt;/h2&gt;
A server is a computer. Pretty much any computer can work as a server (including, most likely, the computer you&#39;re using to read this). A server has server software that is capable of receiving requests and responding to those requests. In the most simple case, a server receives a request for an HTML document, and sends that HTML document as it&#39;s response. The client web browser who requested the HTML document would then translate the HTML and display it as a web page.&lt;br /&gt;
&lt;br /&gt;
There is a lot more to how websites work, but these are the most important parts. &amp;nbsp;In future posts, I will be talking about what HTML is (and is not), how to make websites look good with CSS, how HTML and CSS are not programming languages, and how JavaScript is a programming language, and what it is used for.</content><link rel='replies' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/1030557850929364290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tryorelse.blogspot.com/2012/11/how-websites-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/1030557850929364290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/1030557850929364290'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/2012/11/how-websites-work.html' title='How websites work'/><author><name>Steven Foote</name><uri>http://www.blogger.com/profile/14962545993541438145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_MSD2vrZ4o2AM7NmA_naUG6QQgfzeKf_EpyI5cjdhZUrDNvcjuX39ukbjoOoL5dVkrc1o5aUnL72KvgRiNdgMjSPxoPxThq4mMiXFodXJW6eLa1ctAuyAD698CaFotw/s220/1401269_10101721392891819_7124411858859722369_o+%281%29.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-475044182734234812.post-5633635599957900388</id><published>2012-11-04T14:10:00.000-08:00</published><updated>2012-11-04T14:10:32.930-08:00</updated><title type='text'>Breaking Down Barriers</title><content type='html'>The past 10 months have been an amazing journey. I interviewed with LinkedIn about a year ago. I have, since that time, learned a lot about software development. I am amazed at the quality of developers that I am privileged to work with every day, and perhaps more amazed by the diversity of their educational backgrounds. From masters in computer science from Stanford to high school graduates to masters in accounting from BYU (that last one is me).&lt;br /&gt;
&lt;br /&gt;
But I can&#39;t help but wonder, how did all these non-computer science folks get into programming? I have written &lt;a href=&quot;http://stevenfoote.posterous.com/barriers-to-entry-0&quot; target=&quot;_blank&quot;&gt;before&lt;/a&gt;&amp;nbsp;that getting into programming is hard. There are mental, social, and cultural barriers to entry. It requires great patience and a willingness to be confused a lot. But, clearly it can be done.&lt;br /&gt;
&lt;br /&gt;
The original purpose of this blog was for my brother and I to share the things we learn as we tread in the deep waters through which all outsiders and newcomers must pass. By the length and frequency of our posts, it can be assumed that we haven&#39;t learned much. On the contrary. We have just spent so much time learning that we haven&#39;t had time to write about it all.&lt;br /&gt;
&lt;br /&gt;
Starting this week, I would like to change that. My (ambitious) plan is to write one or more posts per week. The subject of these posts will be based around breaking down the barriers that most people face when they start programming. I have found that most self-taught programmers operate under a just-get-it-to-work mentality, and concepts like scalability, readability, security, and performance are rarely considered. Once you have learned to program this way, it&#39;s hard to change (I would know). Accordingly, I will do my utmost to make all code samples and explanations of high quality. If it&#39;s worth learning, it&#39;s worth learning right.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/5633635599957900388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tryorelse.blogspot.com/2012/11/breaking-down-barriers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/5633635599957900388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/5633635599957900388'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/2012/11/breaking-down-barriers.html' title='Breaking Down Barriers'/><author><name>Steven Foote</name><uri>http://www.blogger.com/profile/14962545993541438145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_MSD2vrZ4o2AM7NmA_naUG6QQgfzeKf_EpyI5cjdhZUrDNvcjuX39ukbjoOoL5dVkrc1o5aUnL72KvgRiNdgMjSPxoPxThq4mMiXFodXJW6eLa1ctAuyAD698CaFotw/s220/1401269_10101721392891819_7124411858859722369_o+%281%29.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-475044182734234812.post-3446883936813689069</id><published>2012-01-07T22:10:00.000-08:00</published><updated>2012-01-07T22:10:23.637-08:00</updated><title type='text'>Looping through arrays vs. objects in JavaScript</title><content type='html'>I learned to program in Python, and that&#39;s still where I&#39;m most comfortable.&lt;br /&gt;
&lt;br /&gt;
In Python, lists and dictionaries can both be effectively looped through using: For... In loops. Both of the following work:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
list1 = [&quot;a&quot;,&quot;b&quot;] 
for x in list1:
    print x

OR

dict1 = {&quot;a&quot;:1,&quot;b&quot;:2}
for key in dict1:
    print dict1[key]

&lt;/code&gt;&lt;/pre&gt;
When I started playing around in JavaScript, I naturally tried the same thing, i.e.:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
var array1 = [&quot;a&quot;,&quot;b&quot;];
for (x in array1){
    alert(array[x]);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
I thought that this was just fine, but when I went through the JavaScript tutorial at &lt;a href=&quot;http://www.w3schools.com/js/&quot;&gt;W3schools&lt;/a&gt;, I saw that they just use a for loop.&lt;br /&gt;
&lt;br /&gt;
Apparently, using &quot;for... in&quot; works most of the time, but it can cause some &lt;a href=&quot;http://stackoverflow.com/questions/500504/javascript-for-in-with-arrays&quot;&gt;big problems&lt;/a&gt;. It actually iterates through all of the properties of the array object, instead of just the array itself.&lt;br /&gt;
&lt;br /&gt;
I found out that the filtering on my &lt;a href=&quot;http://www.werelate.org/wiki/Special:ListPages/Jdfoote1&quot;&gt;WeRelate project &lt;/a&gt;was broken in IE because I used &quot;for...in&quot; on an array.&lt;br /&gt;
&lt;br /&gt;
So, the moral of the story is, &quot;for... in&quot; loops are fine for JavaScript objects, but when you want to loop through an array, do it like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;var array1 = [&quot;a&quot;,&quot;b&quot;];&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;var arrayLength = array1.length;
for (i=0; i&amp;lt; in arrayLength; i++){
    alert(array[i]);
} &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
It&#39;s a little more complicated and harder to read, but it won&#39;t cause you grief.</content><link rel='replies' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/3446883936813689069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tryorelse.blogspot.com/2012/01/looping-through-arrays-vs-objects-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/3446883936813689069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/3446883936813689069'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/2012/01/looping-through-arrays-vs-objects-in.html' title='Looping through arrays vs. objects in JavaScript'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06827024087778615976</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-475044182734234812.post-122805948619540980</id><published>2012-01-03T11:40:00.000-08:00</published><updated>2012-01-03T11:53:50.103-08:00</updated><title type='text'>Getting a Perl script to run.</title><content type='html'>The first programming language I learned was Perl (if you don&#39;t include the few lines of Visual Basic for Applications I had already learned. And you shouldn&#39;t because that&#39;s not much of a programming language, and I hadn&#39;t learned much of it). I learned in 2007 from a book that was published in the early 90&#39;s. The book&#39;s instructions for installing Perl on one&#39;s computer were to send a self-addressed stamped envelope and wait for a floppy disk to be mailed back.&lt;br /&gt;
&lt;br /&gt;
Fortunately, with the wonders of modern technology, you can install Perl in seconds. If you are hesitant about the merits of Perl, the following comic should help. Then, let&#39;s continue.
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://xkcd.com/208/&quot;&gt;&lt;img src=&quot;http://imgs.xkcd.com/comics/regular_expressions.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I&#39;ll do a post on Regular Expressions (RegEx) later. But now, how to install Perl and run a script:&lt;br /&gt;
&lt;br /&gt;
1. Download Perl &lt;a href=&quot;http://www.activestate.com/activeperl/downloads&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;(this is the Active Perl distribution of Perl - you can use another if you choose).&lt;br /&gt;
&lt;br /&gt;
2. Follow the instructions to install. Accept the defaults&lt;br /&gt;
&lt;br /&gt;
3. Create a text file (anywhere on your computer).&lt;br /&gt;
&lt;br /&gt;
3a. Name the file &lt;code&gt;tryorelse.pl&lt;/code&gt;, then open it with a text editor (&lt;a href=&quot;http://notepad-plus-plus.org/&quot; target=&quot;_blank&quot;&gt;here&#39;s a good one for Windows&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilDkFRYvorpsk6ElGQ4BC86Kr2k_f6pGXlgKrj213U5ZSIqpvorDspcxzzz04IUcOG8jHUQCwoQ5UUw8iz_RuF2sSByh8itL9dbA9aiPyz9CSnyOo_v7KrTM3n-6wagvPju5z35NAYPnK5/s1600/img1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;147&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilDkFRYvorpsk6ElGQ4BC86Kr2k_f6pGXlgKrj213U5ZSIqpvorDspcxzzz04IUcOG8jHUQCwoQ5UUw8iz_RuF2sSByh8itL9dbA9aiPyz9CSnyOo_v7KrTM3n-6wagvPju5z35NAYPnK5/s640/img1.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Copy and paste the following code:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;print &quot;Try Or Else.&quot;;  # Print message.&lt;br /&gt;
&amp;lt;stdin&amp;gt;;      # Prevent console from closing.&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
5. Save and close. Then double click on the file you created.&lt;br /&gt;
&lt;br /&gt;
6. You should see something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMKFW_mncm3VUXoXkMuPexOKQBd4N0q92rU4kJnWnf7dyftg3U3hpuOm2lQFBYf-UiIug1jklw3xrC_KekMipYCAQUfwsthoD0-zUjZdfo9e-NabvGSVZBhUy3Mp_h-EMfK_HzXPpmkQ7O/s1600/img2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMKFW_mncm3VUXoXkMuPexOKQBd4N0q92rU4kJnWnf7dyftg3U3hpuOm2lQFBYf-UiIug1jklw3xrC_KekMipYCAQUfwsthoD0-zUjZdfo9e-NabvGSVZBhUy3Mp_h-EMfK_HzXPpmkQ7O/s640/img2.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
If that worked, Perl is correctly installed on your computer. Now, go find yourself a massive text file and parse it.</content><link rel='replies' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/122805948619540980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tryorelse.blogspot.com/2012/01/getting-perl-script-to-run.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/122805948619540980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/122805948619540980'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/2012/01/getting-perl-script-to-run.html' title='Getting a Perl script to run.'/><author><name>Steven Foote</name><uri>http://www.blogger.com/profile/14962545993541438145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_MSD2vrZ4o2AM7NmA_naUG6QQgfzeKf_EpyI5cjdhZUrDNvcjuX39ukbjoOoL5dVkrc1o5aUnL72KvgRiNdgMjSPxoPxThq4mMiXFodXJW6eLa1ctAuyAD698CaFotw/s220/1401269_10101721392891819_7124411858859722369_o+%281%29.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilDkFRYvorpsk6ElGQ4BC86Kr2k_f6pGXlgKrj213U5ZSIqpvorDspcxzzz04IUcOG8jHUQCwoQ5UUw8iz_RuF2sSByh8itL9dbA9aiPyz9CSnyOo_v7KrTM3n-6wagvPju5z35NAYPnK5/s72-c/img1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-475044182734234812.post-3357289415315828713</id><published>2012-01-03T10:10:00.000-08:00</published><updated>2012-01-03T10:10:31.621-08:00</updated><title type='text'>JSON and AppEngine</title><content type='html'>I spent far too long figuring out how to post JSON from our &lt;a href=&quot;https://chrome.google.com/webstore/detail/amjceojlfjidckejljbldjnmiebjmpab?hc=search&amp;amp;hcp=ext&quot;&gt;time tracking extension &lt;/a&gt;to Google App Engine. I was using &lt;a href=&quot;http://api.jquery.com/jQuery.post/&quot;&gt;jQuery.post&lt;/a&gt;, and no matter what I did, my Python code wouldn&#39;t see the incoming post as JSON. It kept telling me that I was receiving an object, instead of a string.&lt;br /&gt;
&lt;br /&gt;
I messed with the way I formatted my JSON string, and messed with the parameters of the jQuery.post call, before I finally figured out that the problem was in my Python code. Instead of accessing the actual string that was sent, I was accessing the whole request object.&lt;br /&gt;
&lt;br /&gt;
My original code looked something like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;activities = json.loads(self.request.POST) &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
So, I guess App Engine uses Django, and I learned from &lt;a href=&quot;https://docs.djangoproject.com/en/dev/ref/request-response/&quot;&gt;here&lt;/a&gt; that I needed to change my code to:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;activities = json.loads(self.request.body) &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
That grabbed the actual JSON string, which I was then able to convert and use in my Python code.</content><link rel='replies' type='application/atom+xml' href='http://tryorelse.blogspot.com/feeds/3357289415315828713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tryorelse.blogspot.com/2012/01/json-and-appengine.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/3357289415315828713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/475044182734234812/posts/default/3357289415315828713'/><link rel='alternate' type='text/html' href='http://tryorelse.blogspot.com/2012/01/json-and-appengine.html' title='JSON and AppEngine'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06827024087778615976</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>