Excel: Average() and rank

My high-school batch has a football league going on the official Fantasy Football website. This year, the organizers proposed assigning points to teams representing our respective sports houses with bragging rights at the end of the season. Now, while the official league does a pretty good job at keeping track of individual scores, it doesn’t have a way to group teams into “groups” so I came up with this Excel spreadsheet.

We decided to assign 10/7/5/3 points to 1st, 2nd, 3rd and 4th placed houses each game week, with each house’s score each week being the average score of the top 3 performers in that house. At the end of the season, the house with the most points wins!

My initial thought process led me to think that the solution to this problem would be a combination of average() and rank(). The deliverable being, “return the average score of the top 3 teams in house X”. Turns out, rank() isn’t required at all! The solution was as follows, and must be entered using Shift+Control+Enter as it is an array formula:

If you’d like to toy around with the formulas, the excel spreadsheet is here: week1.xlsx

[How-to] Remote Torrenting using Dropbox

Have you ever wished you could use Bittorrent on-the-go? Here’s a short guide how utilizing the magic of Dropbox!

What is Dropbox?

Dropbox is a free service that grants you 2GB of online storage space. You can upgrade your account for more space if you wish, but in my experience, 2GB is more than enough. It’s just like having an online USB disk.

Who is this guide for?

People who have computers running at home while they’re out in the office.

What do you need?

  1. An internet connection (duh).
  2. A computer running at home with your favourite Bittorrent program running in the background. I use uTorrent for the Mac.
  3. The ability to download .torrent files with the ability to save .torrent files to Dropbox (Sorry, this won’t work on iPhones!).

Typically, this process would involve installing the Dropbox application on both your home computer and your remote computer. However, if you do not have permission to do so, you can always use the Dropbox web interface to upload your torrent files.

Here’s how!

  1. Sign up for Dropbox. If you use this link, both you and I get an additional 250MB free!
  2. Install Dropbox on your computer.
  3. Create a dedicated Torrent folder in Dropbox on your computer.
  4. In your favourite Torrent application, set it so that it monitors the Torrent folder setup in step 2 above.  Here is what it looks like in uTorrent on my Mac:

My settings above are such that whenever uTorrent starts a new download, it deletes the original .torrent file. This gives me an indication that the Home computer has successfully picked up the .torrent file and has begun downloading.

And you’re done!

How it works

When you download a .torrent file and save it into the Dropbox/Torrent folder, it gets automatically synced your other Dropbox installed locations. So what happens is that your Home computer that runs uTorrent in this case automatically picks up the .torrent file and begins the download process.

Uploading the torrent file via the web interface isn’t that difficult either. Just go to www.dropbox.com and sign in. From there, just navigate to your Torrents folder and click upload.


Have fun!

Install MAMP and WordPress on a Mac

I recently installed WordPress 3 RC1 on my local test server a.k.a. my MBP which really wasn’t too difficult to setup. This reminded me of the days when I brewed up a readme on how to install Apache, MySQL and PHP + WordPress on WinXP!

In any case, running a MAMP (Mac-Apache-MySQL-PHP) test server and WordPress is really easy:

  1. Download MAMP. I use the “free” one.
  2. Install MAMP by dragging the icon to the Applications folder
  3. When MAMP completes its installation, go to the phpMyAdmin page from the menu at the top.
  4. Create a database. I called mine wp-database
  5. Download WordPress. In this example, I downloaded WordPress 3.0 RC1
  6. I unzipped the contents of WordPress into my users/myusername/wordpress folder
  7. In the MAMP menu, go to Preferences > Apache and select the Document Root per Step 6.
  8. Assuming you didn’t change any other settings, go to http://localhost:8888/wordpress and you’ll be prompted to fill in a few details to install WordPress.
  9. A couple of clicks later and you’re done!





Here are a few other guides in case the instructions above weren’t clear enough:

  1. Sawyer McFarlane Media: Installing MAMP
  2. Lullbot: Install a Local Web Server on Mac OS
  3. Blog-Nyo Mangoeni: Menginstall WordPress menggunakan MAMP

[How-to] Solved! ‘iPhone XXX cannot be synced. The required file cannot be found’ error.

I encountered the “iPhone XXX cannot be synced. The required file cannot be found” error when I tried to sync some iPhoto albums with my iPhone. The error was album specific as some albums could be synced, while some couldn’t. Apparently, you just need to clear your iPhoto cache. Here is the solution as provided by Apple which I followed to the letter.

***

I own an 8GB iPhone 3G synchronizing selected iPhoto albums on my MacBook Pro using iTunes.

[How-to] Make a series of weekdays in Excel

Making a long series of dates in Excel without manually typing each day out is quite simple. The easiest way is to type out the first 2 dates that you want in the series, highlight both of them, then drag the small box-handler at the bottom-right down. Excel will automatically fill the subsequent cells below the first 2 cells until the point where you release the mouse button.

But what if you want to fill up the series with only workdays?

Method 1: Fill


Select the first 2 workdates and drag the box-handler down. In the small box that appears, click it and choose: Fill Weekdays.

Method 2: WORKDAY() Formula


Input =workday(A1,1) as a formula and Excel will add +1 workday to the day specified in cell A1. If you change the digit in the 2nd argument to 2, then Excel will add +2 workdays etc. Issue with this method is that you could in theory, get the same day listed twice in the series, per the example above.

Method 3: IF() Formula


Using a slightly more complex formula, construct an =IF() statement to compute the day of the week. In this case, the formula =IF(WEEKDAY(K2)=5,K2+3,K2+1) determines if the date above is a Friday, or weekday=6, and adds 3 to the date. Else, it will add 1 day.

Method 4: SUM()


This is perhaps the coolest method I’ve seen yet! It’s a lot more flexible than Method 3 above, as you can add/subtract various days to the series depending on what day of the week it is. To break it down:

=WEEKDAY(A2) will first determine what day of the week it is. Excel will return a number 1-7 with Monday=1 and Sunday=7.

=CHOOSE(WEEKDAY(A2),1,1,1,1,3) will then return the numbers 1 or 3 depending on the day of the week. Notice that we do not provide more than 5 choices for =CHOOSE(). We don’t need to because for our weekday only series, we never get to Saturday (weekday=6) or Sunday (weekday=7). It is only a Friday when we need to add 3 days to get the series back to Monday i.e. weekday=1.

=SUM(A2,1 or 3) just adds the variable from the above bits to the date in A2.

Note: =weekday(a,b) actually has 2 arguments: b is optional. Argument b can be used to determine the starting day of the week whereby Monday can then hold the values 0, 1 or 2.

***

PS: This how-to was done on Excel 2007 with default Malaysia regional settings where Monday = 1st day of the week.

[How-to] Streaming video from your Mac to a PS3

On my recent house-hunting trip in Singapore, finally bit the bullet and bought a PS3. Oh, plus bonus was out too :)

Got the 120GB Sg unit from ERA Gaming in Plaza Singapura for SGD495 plus a free HDMI cable. Paid an additional SGD70 for another controller, SGD30 for LBP (what a steal) and SGD68 for NFS:Shift (what a dud). I really thought it was going to be as good as Forza on the XBox was, but I was quite disappointed. Kudos > “Style Points”.

Upon coming back to KL, I hooked the PS3 up to the router without any problems, and installed PS3 Media Server on both Macbooks. Turned the PS3 on, made sure it was connected to the network and PMS on either Macbook did not have any trouble detecting the PS3.

PMS: On the Navigation/Share settings tab, I added my /Movies folder.

PS3: It auto-detected the Media Server share (as XXXX.local) and loaded up the contents of the folder pretty quickly. There were significant lags though on accessing Roz’s Movies folder share due to the sheer number of files in it. I presume this is because of the thumbnailing process for each file.

Sleek (yes, that’s the PS3′s name) loaded up both DivX and XVid files with no issues. Tested Pan’s Labyrinth and the .srt subtitles loaded up beautifully too.

What a fantastic machine. No regrets on the purchase. The wife and I now have an excuse to watch TV shows outside in the lounge :)

Now if only FFXIII and GOWIII could come any faster…

Yet another iMovie quickie

Completed yet another iMovie quickie slideshow for the department, this time for Kak Isma. Did it in record time, just 3 hours including encoding.

I need more templates though! The standard ones are starting to get boring. Will post up resourceful links as I come across them.

Here was my workflow this time around:

  1. Cull photos from available stash.
  2. Drag-drop photos into iMovie with auto-transitions.
  3. Drag-drop start and endbits from the templates.
  4. Import video clips.
  5. Trim video.
  6. Add music. Delete photos and transitions as necessary. [Got the final OK]
  7. Export .avi using QT.

PS: Made a fatal mistake on configuring the right settings for the export. The 10 minute 225mb file took 30 mins to encode, and the quality was horrible! Luckily the drop in resolution of the video wasn’t so apparent on the LCD TV. Will post up the “correct” settings for the show so that I don’t forget.

PPS: I discovered that iPhoto and iMovie cannot import MPEG-2 files. As a result, I quickly converted them into smaller .m4v files using Handbrake‘s default settings. Imported via drag-drop into iPhoto into the designated Event folder and they imported into iMovie with no problems.

Update 28 Dec 09: Here are the settings for the re-exported movie, this time as an .mp4 file. Took 15 mins to encode. Results were satisfactory!

My Default mp4 iMovie export settings

[How-to] Bluetooth Teethering on HTC with MBP running Snow Leopard

Ingredients:

  1. HTC Touch HD
  2. MBP Oct ’07 running Snow Leopard 10.6.1

Method:

On the HTC:

  1. Run Internet Sharing using Bluetooth PAN.
  2. Click Connect.

For the MBP:

  1. Turn on Bluetooth.
  2. Select “Setup Bluetooth device”. After it searches and finds your device, select your device and click Continue. Remember that your device must be discoverable for this to occur.
  3. Key in the number obtained on the MBP into your device to successfully pair the two together.

Once the device has been paired, click on Bluetooth on the MBP > Device > Connect to Network.

DONE.