2014-03-11T06:09:00Z Michael Chang,2014-03-11:/blog/2014/03/how-do-you-even-lose-data-when-using-git/ How do you even lose data when using git? 2014-03-11T06:09:00Z 2014-03-11T06:09:00Z <p><em>I originally wrote this article for Volume 124, Issue 5 of mathNEWS.</em></p> <p>It’s 18:00 on a Saturday night, and you see your friend Joseph force push to your git repo for compilers. Six minutes later, a commit is added to that repo: “Joseph is an idiot.” What on earth happened, and how can you prevent this catastrophe from afflicting your group?</p> <p>Root cause analysis determined the cause of this particular disaster to be “Untracked files”. How? <code>git status</code> lists files that haven’t been committed to the repository under the heading “Untracked files”. However, if having “Untracked files” is the normal state for your repository, then you’ll have to manually sift through the output of <code>git status</code> to realize you forget to commit a file you actually want to keep around for later. The chances of you doing that for each commit you make the night before the deadline? Nil. So you’ll lose the files once you <code>git checkout</code> another branch… and once you realize, it’s too late, and you’ll have to recreate the files from memory. The loss of precious minutes when you least have them to spare!</p> <p>How can you protect you code and your loved ones from this disaster? It’s easy! You simply need to make judicious use of <code>.gitignore</code>. Create a file named <code>.gitignore</code> in your repository and commit it; each line that doesn’t start with a <code>#</code> contains a pattern matching files that git shouldn’t track or add to the repository. Chances are, you won’t even have to write the file yourself – you can probably concatenate together the files for your two or three favourite programming languages and editors (say, Go.gitignore, Erlang.gitignore, and Global/Kate.gitignore) from the collection at</p> <p>“But I use LaTeX,” you might protest, “and I also need to commit <code>.log</code> files generated by my code!” I do agree, that <a href=""><code>TeX.gitignore</code></a> contains some rather sweeping patterns, such as <code>*.log</code> and <code>*.out</code>. There’s a simple pattern to handle this too: I create a directory named <code>latex</code> or <code>report</code> in the top of my repository, place my <code>.tex</code> files in it, as well as a copy of <code>TeX.gitignore</code> named <code>.gitignore</code>. Since the rules in <code>latex/.gitignore</code> only affect files stored under <code>latex/</code>, you’re free to add <code>.log</code> and <code>.out</code> files anywhere else in the tree.</p> <p>In fact, I’ve got a bit of a pattern going now with how I start my assignments:</p> <ul> <li>se465 (folder so I can tell each "a1" repo apart) <ul> <li>a1 (this is a git repo) <ul> <li>.gitignore</li> <li>latex <ul> <li>.gitignore</li> <li>Makefile</li> <li>a1_sub.tex</li> </ul> </li> <li>q1 <ul> <li></li> </ul> </li> <li>...</li> </ul> </li> </ul> </li> </ul> <p>Now if only I had figured this out in first year. But now that I have, you don’t have to!</p> <p>Just take a little bit of time when you start your next CS assignment, and make sure git tells you about only the Untracked files you care about!</p> <p>!able</p>,2014-02-12:/blog/2014/02/you-keep-me-up-at-night/ You Keep Me Up At Night 2014-02-12T01:41:00Z 2014-02-12T01:41:00Z <p><em>I originally wrote this article for Volume 124, Issue 3 of mathNEWS.</em></p> <p>A fortnight ago, I was transported to the far-off land of Oshawa to engage in a mimicry of our government’s system of discussing of questions of public interest. We spoke of drivers’ education, and of automatic transmissions.</p> <p>Ever since we got back, there’s only been one thing that’s kept me up at night:</p> <p>The way your glasses fall squarely on your nose,</p> <p>The way the gel holds your combed-over hair in place,</p> <p>The way your knuckles look when you hold a pen in just that way,</p> <p>The square shoulders of your suit,</p> <p>The crisp folds in your tie,</p> <p>The way you smiled.</p> <p>“The Member of the Opposition is putting up a smokescreen, instead of focusing on the issues at hand,” you would say, but all I can focus on is you.</p> <p>Dear Prime Minister, hailing from from the University of Toronto, congratulations on Second Place. You’ll always be first in my heart.</p> <p>Happy Valentine’s Day!</p> <p>!atraitoriswear</p>,2013-10-16:/blog/2013/10/9-dot-81-m-slash-s-2/ 9.81 m/s^2 2013-10-16T05:00:43Z 2013-10-16T05:00:43Z <p><strong>SPOILER WARNING</strong>: The following post contains spoilers. If you have a problem with spoilers, please just close the window and come back when I have written a new post (or you have watched <em>Gravity (2013)</em>, whichever comes first).</p> <p>I just came back from watching <em>Gravity (2013)</em>. As of the time of writing, the movie has done really well with critics (Metacritic score of 98/100).</p> <p>I think, from a literary standpoint, the movie did quite well. For example, there is effective use of “checkpoints” to indicate to the viewer progress in the storyline. The progression from Shuttle to ISS to Chinese Space Station to Earth feels structurally similar to <em>After Earth (2013)</em> and <em>Dora the Explorer</em>. (<em>Who do we go when we don’t know which way to go? The map! That’s right.</em>)</p> <p>But, still, I rage:</p> <ol> <li> <p>Why the hell was the chinese spacecraft so faulty? (The panel bursts into flame during landing.) In every Sci-Fi story where the Chinese are mentioned, the Chinese make a shitty product and it always bursts into flame. Like, I don’t even.</p> </li> <li> <p>Why didn’t the cockpit fire use all the oxygen in the capsule and/or kill the astronaut inside? (For example, there was a fire in the cockpit of <a href="">Apollo 1</a>.)</p> </li> <li> <p>How the hell did she land in water that was so shallow she could crawl to shore? Would the craft not have hit the bottom of the body of water if the water was that shallow?</p> </li> <li> <p>Why could she stand after exiting the craft and all those injuries? She did spend a week in space; what about muscle atrophy and all those things? Like, the whole “taking a first step from a really low camera angle” makes for a nice shot, but it is also really cliche.</p> </li> </ol> <p>That is all.</p>,2013-10-01:/blog/2013/10/come-to-se-hack-day-maybe/ Come to SE Hack Day, Maybe? 2013-10-01T15:50:00Z 2013-10-01T15:50:00Z <p><em>I originally wrote this article for Volume 123, Issue 2 of mathNEWS.</em></p> <pre><code>from datetime import datetime import random import students from uwaterloo softies = ( students.find(program='Software Engineering') .all() ) if ('hack' in me.likes and 'learn' in me.likes and 'build' in dir(me) and 'teach' in dir(me) and 'share' in dir(me) and 'create' in dir(me) and,10,26,17,00), end=datetime(2013,10,27,00,00)) and sum(1 if friend in softies else 0 for friend in me.friends) &gt; 0): if random.random() &gt; 0.5: # maybe me.addToCalendar('SE Hack Day #10') # Questions? Find a friend in Software Engineering # and ask them about it! Or visit </code></pre>,2013-09-17:/blog/2013/09/think-twice-before-taking-part-in-a-hackathon/ Think Twice Before Taking Part in a Hackathon 2013-09-17T21:32:00Z 2013-09-17T21:32:00Z <p><em>I originally wrote this article for Volume 123, Issue 1 of mathNEWS, after taking part in The Next 36 Wearable Computing Hackathon the previous weekend.</em></p> <p><strong>Use it for You</strong></p> <p>When I think of entrepreneurship, I don’t think about just start-ups. I think about the girl in Civil Engineering selling organic fruits and vegetables at small scale. I think about my dad, whose small “business” selling phone cards (in an era of Skype!) hasn’t made a profit in years. Most businesses fail. So, if you’re telling the average CS student that they should start a business, you’re either crazy or you’ve got externalities.</p> <p>Hackathon funding is almost completely driven by externalities. Big companies usually want to acquihire you. Venture Capitalists get to see tons of teams execute for the cost of pocket change, and possibly first right to invest. AngelHack is, if I recall correctly, for-profit. The average CS student’s master plan should never include “Win $HACKATHON” as a step; they’re just setting themselves up for failure. I’m not saying that you shouldn’t attend hackathons, but you need to use them correctly to achieve your goals. Use it as a chance to spend the weekend working yourself to near-death with your significant other. Use it as a ship deadline for your next prototype. Use it to get the attention of the Facebook recruiter if you really want to work there. Use it for you.</p> <p>Focus on finding your <a href="">“tennis ball”</a> – the thing that motivates you to get stuff done. You’re not too busy to do it. If you really want to watch Shingeki no Kyojin or Suits, you will find time to do it, midterms and assignments be damned. If you really want to spend time with your significant other, you’ll walk half an hour through two feet of snow to do it. If you really want to build a business to solve X, you’ll take that 10% hit to your GPA. If you don’t really want to do it, then go do something that you want. Dealing with regret sucks.</p> <p>Keep on iterating.</p>