Archive for April, 2010

Automatically Scraping Jobs from LinkedIn Using Ruby

Friday, April 16th, 2010

There are a number of job postings on LinkedIn that are of no interest to me; many times I have to go through page after page of jobs to look for the few that are appropriate. To make it less tedious, I have shortened the process by automating this task and filtering out the jobs I do not want. I've done so using Ruby and shell scripting. I run the script every night through cron and mail the results to me.

This process has a few hurdles to jump:

  1. automation of the login and paging of the search results
  2. collecting the interesting job information
  3. html email output
  4. running an interactive browsing session in a cron process

I have tackled these issues with the following tools:

  1. Firefox on Linux (Fedora)
  2. Ruby & Gems: Nokogiri (or Hpricot), FireWatir
  3. sendmail
  4. Xvfb

This process is dependent on Firefox and Linux (Fedora) but can be modified without much difficulty to utilize other platforms. The scripts perform no error checking to keep the size small for the purpose of this blog entry. Read on for the code.

(more…)

Approximate Monthly Net Income for an Independent Contractor

Thursday, April 15th, 2010

Building on the calculation of the Federal Income Tax, the determination of other taxes is relatively easy. In this continuation, I try to approximate the monthly net income a self-employed contractor would take home, allowing for self-employment and other federal, state and local taxes.

The final spreadsheet can be found as a share in my Google Docs.

As an independent contractor, the self-employment taxes paid can be used as a deduction and thus a value of 92.35% of the actual can be used for tax purposes; this is explained in better detail on MoneyChimp.

I also use a rough estimation for other deductions to determine the taxable income.

This spreadsheet factors in a Social Security Earnings cap in calculation of the SS tax. It also accounts for state and local taxes, and a city wage tax if you are so lucky to live or work in a city (like Philadelphia) that has one.

This calculation only assumes you are working for the specified number of months in the given tax year and takes into account no other forms of income. A copy of the spreadsheet can and should be modified for your personal needs.

Using an Array Formula in Google Spreadsheets to Calculate Federal Income Tax

Thursday, April 15th, 2010

I was pleasantly surprised to see that Google Docs permitted Control-Enter on a cell to enter that formula as an Array Formula. It can also be done by wrapping the entire formula in a call to ArrayFormula (as that is how it is noted in the Spreadsheet program).

If you are unfamiliar with Array Formulas, they can be used to encompass a range of cells using a singleton formula. I find them very powerful, although it may take  while to completely understand its use.

In this example I am using an Array Formula to calculate the Federal Income Tax using a specific rate table; this can be expanded to allow more flexibility when choosing the rate tables. I am using one for the tax year 2010 as married, filing jointly.

To calculate the tax, for each bracket that is less than the total income, the amount range for that bracket is multiplied by the tax for that bracket; the remainder of the income is subtracted from the start of the last bracket and multiplied by its tax rate. MoneyChimp.com has a nice overview of how this works, with examples.

This is easily translated into a formula that determines the net value for each bracket and multiplies that by the rate and sums that result with each bracket whose high end is less than or equal to the income. Where the array formula becomes useful is the summing of each of the brackets.

Tax Bracket Lookup

     $16,750           10%
     $68,000           15%
     $137,300          25%
     $209,250          28%
     $373,650          33%
     $1,000,000,000    35%

For example, to determine the net value for a bracket, assuming a list similar to the one above, you would subtract the cell above from the value of the current bracket, if the high end was less than or equal to the income. I’ve added a high number to the last bracket to (hopefully) ensure the monthly income figure would be less than it. I have also intentionally left a blank cell at the top of the table to equate to zero so the first bracket he a zero for the min value.

Assuming this table is in F3:G8, the following formula accomplishes the goal for a single tax bracket (first one):

=IF(C$7>$F$3, ($F$3-$F$2)*$G$3, IF(C$7>$F$2, (C$7-$F$2)*$G$3, 0)

Note this formula could be used on any row in that table from F3 through F8. To begin to use it as an array formula, we need to take the singleton formula (IF) and apply it across the range of cells. This is done by expanding on the references that iterate through F3:G8, as in:

=IF(C$7>$F$3:$F$8, ($F$3:$F$8-$F$2:$F$7)*$G$3:$G$8, IF(C$7>$F$2:$F$7, (C$7-$F$2:$F$7)*$G$3:$G$8, 0)

It is much easier to do it for a single row than expand the formula to the range of values.

Now that we have a range of values, we sum them up with the SUM formula, that takes an array of numbers:

=SUM(IF(C$7>$F$3:$F$8, ($F$3:$F$8-$F$2:$F$7)*$G$3:$G$8, IF(C$7>$F$2:$F$7, (C$7-$F$2:$F$7)*$G$3:$G$8, 0))

When entering this formula in the formula editor, press Control-Enter to accept the formula; this will convert it into an Array Formula. Similarly, you can wrap the entire formula in the ArrayFormula() call to create the same meaning.

The next post will expand on this calculation to Approximate the Monthly Net Income for an Independent Contractor.

The final spreadsheet is shared on my Google Docs for review.

Secure Your Windows Computer When Using Adobe Reader

Thursday, April 15th, 2010

Turns out there are some nasty security holes in Adobe Reader that are not bugs, just intended features. Unfortunately, these “features” should not be enabled by default, but they are.

1. JavaScript - there really is no reason to have JavaScript enabled in most PDF documents unless it is a form-based document that requires input with validation. So, unless you use this type of document all the time, please disable JavaScript in the Preferences dialog (located under the Edit menu, or just press Ctrl-K). Click on the JavaScript category and uncheck Enable Acrobat JavaScript.

2. External Application Launching - Believe it or not, Reader can launch other application and have them display their content within the PDF viewer. This is enabled by default! Turns out there is a hack to change the contents of the warning dialog to use social engineering to deceive the user into allowing the application to launch and even launch arbitrary code to take over your computer. This is easily avoidable by disabling it – if you ever do need it, Adobe Reader will tell you that it is disabled and you can have the opportunity to re-enable it. To do so,go to the Preferences dialog and click on the Trust Manager category. Uncheck “Allow opening of non-PDF file attachments with external applications.” Please.

No Sound when Using Remote Desktop Connection on the Mac and Connected to a Windows 7 or Server 2008 R2 Machine

Friday, April 9th, 2010

It appears as though the sound is configured correctly on the host machines, but no sound comes from the client when a sound is made. This works when using a Windows Remote Desktop Client but not on the Mac.  It turns out that the audio redirection feature of RDC does not work; you will need a hotfix to resolve the issue. After installing the hotfix and rebooting the server computer, sound now plays on the client!

To obtain the hotfix, navigate to http://support.microsoft.com/kb/973062 and click on View and request hotfix downloads. Click through the license agreement and select the hotfix that corresponds to your operating system. Fill out your email address and submit. Soon you will receive a zipped install executable that will install the fix for this issue. Upon rebooting and reconnecting to the host machine, you will hear sound!

stop spam with honeypot!