Sunday, August 28, 2011

City of Wonder Tips

I tried out the Google+ games on Friday. Boy is it a lot easier to pop pigs in Angry Birds at 40 frames per second with fine aiming control than it was on my phone at about 3 frames per second with the precision of finger painting. I also tried out City of Wonder (CoW). It's basically a Civilization copy-cat, but with lots of bonuses for getting your friends to play with you. I was addicted to Civilization and now I'm a bit hooked on CoW. What's a bit interesting about CoW is that everything is wall-clock based. Unlike Civ, you don't have to have the game running to make progress. But, every time you produce something, you have to claim it. The rates of production are very aware of this. You can produce more money from a goods facility by choosing the 5 minute option every time. But, to make that work, you have to check-in and click on the facility every 5-10 minutes. Even if you're at the computer all day, you can't do that while you're sleeping! There are longer options, including 24 hours, but the rate of production drops off quite a bit the longer period you choose. Another trade-off in the game is space. You start with 81 squares and don't automatically get more space as your population grows. You have to pay for more space, either in coin or by accumulating allies.

Anyway, what have I learned after two days of playing? Here you go.

  • Population: you are required to have one unit of happiness for each unit of population; if your population count exceeds your happiness count, you can't increase your population. So, make sure to place enough cultural and/or decoration facilities to support your population. Since you can't be at your computer all the time, it's better to buy residential facilities with longer waiting times between generation (especially since the rates don't differ that much).
  • Density: After a few levels and a few thousand people, you'll find that your space is a bit tight, especially if you buy the cheaper facilities. It's worth to pay a bit more to get more compact production/happiness even if the benefit per coin is lower.
  • Storing/Moving: One bit of flexibility you may not be accustomed to is that saving and moving facilities is free. If you bought some cheap facilities that you don't have space for, you can save them ("Put Away"). When you expand your boundaries, you can bring them back for no charge. Also, moving facilities from one location to another is free, so don't worry to much about optimizing placement.
  • Roads: As far as I can tell, roads are useless and merely waste space. I've read that other versions of CoW give you production benefits for placing facilities adjacent to roads, but I don't see any such benefit in the Google+ version.
  • Research: Always make sure you are researching something. This is how you unlock advanced facilities. Never spend all of your coin if you will need it to research the next item. Be very aware of how long until your next research item is complete. If you are close to completing some research which will open a more advanced facility, it may be better to wait instead of investing in a less advanced facility.
  • Goods: Unlike other production facilities, you get to choose the waiting time for each production batch. When I can check the computer regularly, I've found that a waiting time around half-an-hour is best. When you're away from the computer for longer, choose the waiting time that corresponds to the amount of time you expect to be away. Why? (1) Production rates are structured to be higher for shorter waiting times, and (2) a percentage of the final payout must be paid up-front to initiate production and will be lost if the production is cancelled. So, selecting too long of a production reduces flexibility and often leads to less overall production. But, if you pick a time that's too short, the produced goods may "expire", leaving you with nothing for your investment.

Saturday, August 27, 2011

No Hurricane, Just a Heck of a Lot of Rain

By the time Irene makes it to the Boston area, it will no longer be a Hurricane, but we're guaranteed to receive a ton of rain as a result of Irene. The first wave started about 1:30pm and it only took two hours to accumulate 1.5 inches. I'm a bit scared to see how much rain we'll get when the center passes west of us Sunday afternoon. The NWS only predicted 4-5 inches total for the western suburbs of Boston. But, if we get anywhere near 1/2 inch per hour for much of the 36 hours that Irene is affecting the area, we could easily exceed the 13.2 inches we got in the March 2010 floods. Before this storm started, we had already accumulated 5 inches of rain in August.

Update 8/29/11: We ended-up with only 3.77 inches of rain for the storm. Apparently that thunderstorm that hit early afternoon Saturday was unusual for even Irene.

Tuesday, August 23, 2011

My First Earthquake

No, no, no. I didn't cause an earthquake. :-)   I felt an earthquake for the first time---a few minutes ago, I felt the building moving. A short bit later, everyone on the floor was talking about how they felt the building moving too. Well, it turns out there was an earthquake at about the time we felt the building move, but it was near D.C. What?!?! Is that possible? My wife said she didn't feel anything. But, I'm sitting on the 10th story of a 10 story building. I didn't feel any shaking, only minor swaying. One of my colleagues says it's very possible since the waves are magnified the higher-up you are. Another colleague found a link to local seismic readings. The readings are off-the-charts (relative to what we normally feel here in Boston which is appx. nothing). Note that the earthquake occurred at 1:51pm and local readings spiked about 2.5 minutes later (red blob on right side below). I've included the image below since it may disappear after today.

Here's the wikipedia link.

Update (8/24/11): I discovered how to access a specific date in the archive and updated the above link to the seismogram

Monday, August 22, 2011

Producing Good PDF Presentations via LaTeX

I'm in the process of creating slides from LaTeX. Though LaTeX isn't as fancy as other presentation software, it seems to be the only decent solution for which runs easily on Linux. Below is a collection of tips:

  • Beamer seems to be the best LaTeX package for presentations. For example, Beamer makes it downright trivial to display a list one bullet at-a-time.
  • \pause before a list item will reveal later items after earlier items. If you want to reveal list items one-at-a-time, use
    \begin{itemize}[<+->]
    to start the list.
  • To put two items side-by-side, use a minipage. For example, here is a template to display a list on the left and an image on the right:
    \begin{minipage}{2in}
    \begin{itemize}
    \item one
    \item two
    \end{itemize}
    \end{minipage}
    \begin{minipage}{2in}
    \includegraphics[width=2in]{somegrapic}
    \end{minipage}
  • Use pdflatex to generate PDF. One advantage is automatic usage of Type 1 scalable fonts (as opposed to bloated, ugly Type 3 bitmapped fonts which you may get if you convert from DVI or EPS to PDF). Note that you can check fonts in a PDF file by selecting File->Properties->Fonts in evince.
  • If you can't or don't want to use pdflatex, include \usepackage{pslatex} in your document preamble and use the -Ppdf option when running dvips.
  • If you use the AUCTeX Emacs package, you can run the pdflatex command easily from Emacs by configuring a pdflatex command via your .emacs file:
    (eval-after-load "tex"
      '(add-to-list 'TeX-command-list
    		'("pdflatex" "pdflatex %s" TeX-run-command t t :help "Run pdflatex") t))
    
    Note that you can reload a file in evince with Ctrl-R.

Here is a template:

\documentclass{beamer}
\usepackage{beamerthemesplit}

\title{}
\author{}
\institute{}
\date{\today}

\begin{document}

\frame{\titlepage}

\section*{Outline}

\frame{\tableofcontents}

\section{Introduction}

\begin{frame}{Introduction}
\begin{itemize}[<+->]
\item First Topic
\item Second Topic
\item Third Topic
\end{itemize}
\end{frame}

\end{document}

Thursday, August 18, 2011

Stocks Are Cheap

Don't believe me? Consider Dell which currently has a market cap of approximately $25.9 billion (stock price of $13.70 8/18/11 10am). This is effectively the price for Dell; if you buy a share now, you pay a small fraction of this price and gain ownership of an equally small portion of the company. Now, what does this $25.9 billion price tag get you? Well, a lot of cash, for starters. Dell has $14.5 billion in cash and short-term investments. These are assets that are highly liquid and not needed for day-to-day operation of the company. On the other hand, Dell has debt, $7.6 billion of it. Subtract net cash from that price tag and you arrive at an approximate enterprise value of $19 billion. This is the effective value of the business itself. How much money does this business generate? Current trailing-twelve-month income is $3.2 billion after tax. That works out to a yield of 16.8%. If Dell were to simply maintain and pay-out earnings, you'd double your investment in less than five years! (assuming you could reinvest pay-outs at the same yield) Dell will not do this; instead, Dell is likely to use some earnings to grow the company and other earnings to buy back stock. But, these actions aren't all that different from simply paying-out earnings. Buying back stock is roughly equivalent to paying a dividend---it reduces the pool of shares, making your shares worth more. And, though there are no guarantees and earnings/revenue have been flat for a few years, reinvesting earnings is likely to grow the company at a modest clip, increasing the earnings to compare against that enterprise value.

What I don't understand is why bond and stock prices are so out-of-sorts. Dell effectively pays a yield of 16.8%, yet, bond investors are willing to accept a yield of 3.57% on 30-year U.S. treasuries. Of course, the U.S. is guaranteed to pay interest on the bond (worst case they can print more dollars), whereas there is risk that Dell will reinvest earnings unwisely or be bested by other companies. But, 13.2 percentage points is quite a large margin considering the track-record of the U.S. economy and what a strong, prosperous company Dell has proven to be.

P.S. Net mutual fund flows help to explain why stocks are so cheap. $30 billion moved out of equity funds for the week ended 8/10/11. While this is a small fraction of the tens-of-trillions of equity in global stock markets, it is also the largest such negative move since the last major crash. Investors are scared. It's a great time to buy :-)

Wednesday, August 17, 2011

How to Install Debian Backports

I'm stuck on Debian oldstable (lenny) for the moment. I needed to upgrade to Firefox 3.5 which is available in lenny-backports. After a bit of searching and fiddling, it turned-out to be very easy. There is basically just one thing you have to do---add the following lines to /etc/apt/sources.list:

deb http://backports.debian.org/debian-backports lenny-backports main contrib non-free
Of course, you'll need to change lenny to the stable verison you're using if you're not on lenny. After that update, do the usual apt-get magic:
apt-get update
apt-get install the-package-you-want-to-upgrade
Assuming it is in backports, it should "just work".

Note that the standard instructions tell you to add preferences so that only the package you want to upgrade is allowed from backports. But, if that package depends on later versions of anything, you'll need to add preferences for those packages, and if those packages depend on later versions, you'll need to add more preferences, etc. Seriously? I think the author is just being too darned careful. :-) Maybe it's better to comment-out that sources.list backports line after you've installed what you wanted...

Tuesday, August 16, 2011

Beware Google Chrome 13

I can't run Google Chrome on my work machine any more. Why, you ask? A few days ago, I noticed that a new Chrome stable was available. I had already updated at home so I downloaded the 64-bit deb and ran dpkg -i to install. To my surprise, it barfed-up a list of failed dependencies. No problem. I'll just go back to using Chrome 12, right? Wrong! dpkg overwrote my Chrome 12 install before it checked dependencies. Does anyone else see anything wrong with this?

Off I went in search of a Chrome 12 .deb package. After searching for a while and only managing to find an old Chrome 12 Windows package, I threw in the towel and switched to Firefox/Iceweasel. Boy do I miss Chrome. Why doesn't Google allow you to download old versions? I couldn't find a link anywhere. If anyone knows where I can find a 64-bit Debian Chrome 12 package, please let me know. It probably will only be a few more months before I can upgrade my machine to Debian stable (I'm currently stuck on oldstable which was current as of 6 months ago), but these will be a few months of painful web browsing.

Monday, August 15, 2011

Teaching Your Children to Read

My daughter recently turned four. While she enjoys it when I or my wife read to her, it is clear that she is just beginning to gain the skills necessary to read. We've taught her the alphabet and numbers. With a little help, she can even count to sixty. When I read to her a book she knows, she can "read" it pretty well, telling me most of the words. But, when we read a book that she doesn't know so well, it's clear that her skill is memorization, not reading.

Recently, a discussion at work pointed to Starfall.com, an educational reading web site. I sat down with my daughter one day and started on the learn to read section which focuses on letter combinations. She had a lot more trouble than I expected. What I hadn't realized is that she knew the names of the letters, but not the sounds they make. Today, I took a step back to the ABCs section. Perfect! She clearly didn't know the sounds, but quickly picked-up most of them with ease. There are still a number of letter sounds she doesn't know (especially vowels), but she enjoyed the Starfall lessons and games and was even able to do a few entire letter lessons by herself (moving & clicking the mouse) by the end.

I'm glad I found Starfall. Before, I didn't have a clear idea of the steps necessary to take my daughter from following along while I read to reading on her own. Now, the path is much clearer. Also, I'd like to compliment the authors of Starfall on the level of quality they were able to create without relying on ads/sponsorships/etc. Being a software engineer myself, I know how difficult it can be to put together the skills necessary to create the interaction they've created. Thank you!

Saturday, August 13, 2011

What's Wrong with this Monetary Policy?

Currently, the Fed is holding short term rates at historic lows; it has declared that it will keep rates extraordinarily low through mid-2013. Consider the context of this action:

  • Retail sales up 8.5% versus a year ago (July 2011)
  • Producer prices up 7.0% versus a year ago (June 2011)
  • Consumer borrowing up 1.7% versus a year ago (June 2011)
  • Jobs up 1.3 million versus a year ago (July 2011)
  • Durable goods orders up 7.9% versus a year ago (June 2011)
  • Personal income up 5.0% versus a year ago (June 2011)
  • Industrial production up 3.4% versus a year ago (June 2011)
  • Consumer price index up 3.6% versus a year ago (June 2011)
These look like classic signs of expansion to me.

The media seems to be upset that GDP growth has been "low" in 2011 (0.4% in Q1 and 1.3% in Q2), but those that whine about GDP growth don't seem to recognize the increased personal saving rate---it dropped from 12% to 2% between 1981 and 2007, but is now hovering around 5%. The rates of growth we're used to (80s, 90s, 2000s) are artificially high because they relied on a decrease in the savings rate. Now that the savings rate has increased, there just isn't as much money available for spending/growth. So, average GDP growth of 2% might be normal for the foreseeable future. Note that GDP is stated in "real" terms, i.e. inflation adjusted, so inflation can hurt just as much as a lack of economic activity.

Based on the above numbers, it seems to me that the Fed should be at least as concerned about inflation as it is about economic activity. Consumer prices are up 3.6% and producer prices are up a whopping 7.0%. Most national banks try to keep inflation around 2%. It was one thing to keep rates near zero when prices were flat-to-negative, but keeping interest rates so low while prices are moving up strongly is dangerous. It appears to me that this inflation is what is hurting GDP growth now. Though personal income has risen 5.0% in the past year, real income growth has only risen appx. 1.4% (due to the 3.6% increase in consumer prices). A year ago, GDP growth was much stronger because personal income was still around 5% but consumer prices were increasing at a rate of about 1%.

I doubt the Fed is listening, but if they are, consider this a plea: please raise the federal funds rate. If the above argument doesn't convince you, consider that you can't go below 0%. If the federal funds rate isn't increased and there is another shock to the U.S. economy in the next year or two, the Fed won't be able to help.

Sunday, August 7, 2011

How to Wire Cat5 Ethernet Cable for 100Base-TX

I'll answer your first question first: why not 1000Base-T? Well, the simple answer is that 100Base-TX requires 4 wires whereas 1000Base-T requires 8. While 4 more wires may not sound like much, I've found it exponentially more difficult. With 4 wires, I feel that I have good individual control. With 8, there always seem to be one or two wires with a mind of their own. And, how often do you need more than 10 megabyte transfer speeds?

Next, your second question: why would you want to create your own Ethernet wire? Why can't you just buy pre-made? This answer comes in two parts: (1) it's fun, and (2) I never seem to have the right length on-hand. When 14 feet is required, 10 feet doesn't cut it and 25 feet seems like overkill. Sure, in some cases, the right size can be ordered, but I'd rather make it on-the-spot than wait for delivery. And, some sizes simply aren't sold.

Do I have your attention now? Good. To make your own cable, you'll need 2-3 tools (in addition to some raw cable):

  1. RJ45 crimper (appx. $20)
  2. RJ45 connectors/jacks (appx. $10 for 100)
  3. wire cutters (appx. $20) (optional)
The crimper has blades to cut your wires, but I prefer a pair of good wire cutters like the linked ones. Once you have your tools, you'll need a good diagram of how to align the wires. I like the diagram in this How to Wire Ethernet Cables page. Hold the connector with gold pins up, opening close to you and release lever on bottom. Pin 1 is on your left, pin 8 is on your right. You only have to connect four wires (T568A):
  • pin 1: white/green
  • pin 2: green
  • pin 3: white/orange
  • pin 6: orange
You can cut off the four brown and blue wires---you don't need them for 100Base-TX. Once you've managed to align the wires into the correct pins, make sure the casing is in the connector far enough that it will be clamped inside the connector when crimped. Also, make sure the small wire extend all the way to the end of the connector---I check this by looking on the bottom of the connector (release lever side). If everything looks good, insert the connector with wires into the 8 pin socket of the crimper and press down hard. Be careful of the blades on the crimper. Do this on both ends and you should have successfully made your own 100Base-TX. Of course, it's quite possible (likely?) your first attempt will fail, so start with a short wire and test it. In my experience, it's easy after you've made one or two wires.