How to trick TaxAct into supporting Nebraska form K-1N

This probably affects only me, and no one else in the world, but if you are a owner of a Nebraska based LLC partnership, and you live in another state, then you get form K-1N from your LLC describing Nebraska tax withheld. As far as I can find, there is no tax software anywhere that supports this form, and you have to create a Nebraska non-resident tax return on paper by hand.  I figured out a hack to get my tax return to come out correctly.

First, complete your tax return up to the point where you are ready to file.

Then add a W-2 for your LLC. Fill in NE in box 15, fill in your withholding from the K-1N in box 17. Then close the W-2. TaxAct will complain about this being a mistake, ignore this.

Click on Deductions -> Itemized deduction – Taxes you paid -> Other state and local income taxes paid. If you filled in your K-1N withholding here earlier, remove it.

Then print your Nebraska return.

Then come back and delete the W-2 you added (since it is bogus, and the software won’t let you file your federal return with it there), and go back to the Other state and local income taxes paid and fill in the K-1N withholding.

Now go e-file your federal and resident state returns. When you print them, double check to make sure nothing changed and the NE return matches the federal return, it should since the fake W-2 and the “Other state income taxes” balance each other out.

Things I hate about Java – The C programmer’s identity crisis

Here is an anti-pattern that I see all the time and I remove it from the codebase whenever I find it:

public void outerFunction() {
  // do some stuff
  if (!writtenByAFormerCProgrammer()) {
    throw new SomethingFailedException("The function writtenByAFormerCProgrammer returned false");
  }
}

public boolean writtenByAFormerCProgrammer() {
  try {
    // make some library calls that might throw execptions
    return true;
  } catch (Exception e) {
    return false;
  }
}

Now, there was just a problem in production, and something went wrong.  I deal with files from partner systems all the time, so let’s say I am trying to find out why some file didn’t get processed.  I go to the logs and what do I find: “The function writtenByAFormerCProgrammer returned false.” AAAAAAAAARRRRRRGGGGGGGG!  The real problem is probably something easy like trying to create a file in a directory that doesn’t exist or maybe a permission denied error because of a filesystem error, but where is that message? It’s lost because some moron converted it into the value false.

Next step: Find said moron and confront them about their horribleness.

“But I logged the message, why are you whining to me?”

So in real life the situation is never as nice as this little sample.  In the real world that carefully logged message is on the other side of an RPC call, or it was logged at FINE and you are only logging WARNINGs, or it was logged by a different thread and so it shows up in the log but out of context.  It’s so easy to do the right thing, there is no excuse for this kind of identity crisis.

Things I hate about Java – Exception handling

It’s not really something I hate about Java, more about books about Java and people who program in Java.  Every book and introduction to Java covers how to use checked exceptions, and the IDE tools all auto generate catch blocks that look like this:

try {
  // some code
} catch (IOException e) {
  e.printStackTrace();
}

 

I have noticed that new Java programmers typically just write their methods to throw Exception so that they don’t have to deal with these checked exceptions, and then someone tells them to do this instead, and then I have to beat it out of them later when they work with me.

Logging an exception is not the same as handling an exception!

I would rather have methods just throw an exception instead of handling it badly.  So here are my rules for exception handling:

1) Don’t catch exceptions, just let them escape your method.

2) If you are implementing an interface and you can’t throw the exception that you need to, or if your method would need to throw 3 or more different checked exceptions, it is ok to wrap an exception in some other exception type, but you must include the original exception as the cause.

try {
  // some code
} catch (SpecificException e) {
  throw new GenericException(e);
}

 3) When rethrowing an exception don’t log it.  Let the receiver log it if they want.  They might have a perfectly good way to recover from that exception.  Can you imaging how annoying it would be if File.open() threw a FileNotFoundException and also logged it?  

4) If you are implementing the top level Runnable of a thread or an executor task, you must catch and handle all exceptions.  This is the one place where logging the exception might be the right answer. If you let it escape you will terminate your thread, or in a ScheduledTaskExecutor, you will stop the future tasks from running if you let an exception escape.

I survived my first week at Google

I feel like I should write something here about working for Google, but I really don’t have that much to say.  So I work for Google, in Boulder CO, though I have not actually seen my office yet, since I am in training in Mountain View, CA.  Training, at least, is just like being in college!  There is a huge campus, 1000′s of people milling about, and you go to classes and then do homework on your laptop. There is even hazing of newbies. (sort of, it’s just silly hats) The difference is, everything is secret and I can’t tell you about it, and the food is free.

If you would also like to work for Google, they are still hiring (smart) people like crazy.  If I know you, and you don’t currently work for 21CSI (I have a 1 year no-recruit contract there) send me your resume, and I’ll get it to a recruiter.  My office (Boulder) in particular is trying to hire people, so you might even work with me if you apply there.

I have been pleasantly surprised at how friendly and helpful everyone has been.  Total strangers will walk up and say, “Hey Noogler, we’re going to get some lunch, wanna come?”

I’m a bit overwhelmed by the sheer amount of things I need to learn though, Google has so many internal tools and systems to learn.  I suppose, when you have 23,000 employees and millions of customers, off the shelf tools just don’t cut it.

 

Reporting bugs gets stuff fixed…eventually

I reported a bug in the Objective-C runtime in gcc.  Alright, it was a while ago, actually it was 5 years ago.  I thought it was hopeless and would never be fixed, even though I submitted a test case and a patch that would fix it along with the bug report.  But miracles do happen and it was just fixed!  Sadly for me, I stopped programming in Objective-C with gcc about 4 years ago.  So go report some bugs in something!  They might just get fixed.

Redirecting a blogger (or blogspot) site to wordpress

So you decided to move from blogger to your own hosted wordpress with your own domain. Great! But now we need to send your visitors to your new site without breaking all you’re page links. There are lots of instructions for this on the internet but they don’t work.

Here is what worked for me:

  • Import the site into wordpress: http://www.mrgarylee.com/converting-a-blogger-to-a-real-blog/
  • Fix the page slugs to match your old blogger site: http://justinsomnia.org/2006/10/maintain-permalinks-moving-from-blogger-to-wordpress/
  • Redirect your feed to the new site, in blogger Settings->Site Feed->Post Feed Redirect URL: http://www.YOURNEWSITE.COM/feed/
  • Redirect your old site to the new one.
    • Log into blogger
    • Revert to classic template
    • Paste in this template (and fix the urls). This template is an utter hack, but since blogger doesn’t give very many options for template tags that actually work, this is what we have. It is very important to use the meta redirect with a timeout of 0 since the search engines should treat this as a permanent redirect and update the urls in the search results.  That is also why javascript based redirects are no good.

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="<$BlogLanguageDirection$>">
      <head>
      <title>Moved to http://www.YOURNEWSITE.COM</title>
      <MainPage>
      <meta content="0;url=http://www.YOURNEWSITE.COM" http-equiv='refresh'/>
      </MainPage>
      <ArchivePage>
      <meta content="0;url=http://www.YOURNEWSITE.COM/archive/<$BlogPageTitle$>" http-equiv='refresh'/>
      </ArchivePage>
      <Blogger>
      <ItemPage>
      <meta content="0;url=http://www.YOURNEWSITE.COM/<$BlogItemPermalinkURL$>" http-equiv='refresh'/>
      </ItemPage>
      </Blogger>
      <meta content='NOINDEX, NOFOLLOW' name='ROBOTS'/>

      <$BlogMetaData$>
      </head>
      <body>
      This blog has moved to <a href="http://www.YOURNEWSITE.COM">http://www.YOURNEWSITE.COM</a>
      </body>
      </html>

    • That will send visitors to your new site, but it will send them to some odd pages, which will not be found on your new site. So add these rules to your .htaccess file to get them to the right place:

      <IfModule mod_rewrite.c>
      RewriteEngine On
      #For my funny redirect rule
      RewriteBase /
      RewriteRule ^archive/(.*)January ([0-9]{4})$ $2/01/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)February ([0-9]{4})$ $2/02/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)March ([0-9]{4})$ $2/03/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)April ([0-9]{4})$ $2/04/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)May ([0-9]{4})$ $2/05/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)June ([0-9]{4})$ $2/06/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)July ([0-9]{4})$ $2/07/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)August ([0-9]{4})$ $2/08/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)September ([0-9]{4})$ $2/09/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)October ([0-9]{4})$ $2/10/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)November ([0-9]{4})$ $2/11/ [QSA,R=301,L]
      RewriteRule ^archive/(.*)December ([0-9]{4})$ $2/12/ [QSA,R=301,L]
      RewriteRule ^http:/.*.blogspot.com/(.*)(.html)$ $1 [QSA,R=301,L]
      RewriteRule ^http:/.*.blogger.com/(.*)(.html)$ $1 [QSA,R=301,L]
      RewriteRule ^([0-9]{4}/[0-9]{2}/.*)(.html)$ $1 [QSA,R=301,L]
      </IfModule>

Thoughts on software & money.