Thursday, June 25, 2009

Fair Share is available!

Fair Share is now available in the iTunes App Store. It isn't showing up in searches yet but you can get to the page directly via this link.

Fair Share allows you to quickly figure out your tip and split your bill when dining out.

While providing a simple interface to allow for fast calculation of simple tips, Fair Share also can help you easily divide the bill and account for the different items your party has ordered.

Fair Share provides two entry modes to suit your personal preference.

In Subtractive mode, exception items (such as drinks or desserts) can be assigned to members of your party and the remainder of the bill is automatically split evenly.

In Summation mode, you input and assign all of the items in your bill and the subtotal is calculated for you.

The summary screen reports each person's appropriate share including tax and tip. Group your diners, and a total for each group is also provided.

Standard rounding functions are also available to round each person's share for ease of payment at the table.

Please check out the demo on YouTube to see its features!

Monday, June 15, 2009

Fair Share

Fair Share is my first iPhone app. It is currently undergoing review by Apple.
Fair Share is yet another tip calculator. In fact, the working name was yaTipCalc. But Fair Share also does bill splitting which not very many of the tip calculators out there bother to do.

Hopefully it will be approved in the next few days. In the meantime, here's a demonstration of how Fair Share works.




I already have a number of improvements in mind including Address Book integration. If you have any comments, feel free to contact me at yarbars@gmail.com.

Friday, September 5, 2008

More applescripts for Delicious Library 2

Some more applescripts for Delicious Library 2. Applescripts go into ~/Library/Scripts/Applications/Delicious Library 2/.

You can download an archive of these scripts here

1) A short hotkey script to allow you to toggle the played/read checkbox. The settings are to put it into the Edit menu. You can reassign the hotkey/menu choice to your liking.


-- Menu Title: [3] "Toggle Experienced Flag"
-- Menu Keyboard Shortcut: command-`
-- Menu Path: [3]

-- Copy and paste everything into Script Editor (use spotlight to find it).
-- Then save to home/Library/Scripts/Applications/Delicious Library 2
-- You can edit the menu keyboard shortcut to be whatever you want.

tell first document of application "Delicious Library 2"
set selectedItems to selected media
set itemsRef to a reference to selectedItems
repeat with mediaItem in itemsRef
set playedStatus to experienced of mediaItem
set experienced of mediaItem to not playedStatus
end repeat
end tell



2) Translate retrieved Amazon title to a Series. More comments at the bottom.


-- Menu Title: [0], "Translate Amazon Name to Series"
-- Menu Keyboard Shortcut: command-option-1
-- Menu Path: [3], "Series Scripts"
-- Maintain a sqlite3 db to track Amazon returned titles and the series they are translated to. Then for future additions, guess the desired series based on previous entries.

-- Attempt to put the database in the scripts directory. do shell script seems to start in user's home.
set databasedir to "'Library/Scripts/Applications/Delicious Library 2/'"
set database to "seriestranslate.db"
set sqlcmd to "cd " & databasedir & "; sqlite3 " & database & " "

-- Create tables if they don't exist
do shell script sqlcmd & "'create table if not exists translate( dl2id text primary key, series text, amazonname text); create index if not exists amazonname_index on translate(amazonname desc);'"


tell first document of application "Delicious Library 2"
set selectedItems to selected media
set selectedItemsRef to a reference to selectedItems
repeat with mediaItem in selectedItemsRef
set itemId to id of mediaItem
set itemSeries to series of mediaItem
set itemAmazonName to name of mediaItem
if itemSeries is missing value or itemSeries is "" then
-- itemSeries doesn't exist so find a new one
set query to "select series from translate where amazonname < \"" & my sql_escape(itemAmazonName) & "\" order by amazonname desc limit 1;"
set seriesName to do shell script sqlcmd & quoted form of query
set query to "replace into translate (dl2id, series, amazonname) values (\"" & my sql_escape(itemId) & "\",\"" & my sql_escape(seriesName) & "\",\"" & my sql_escape(itemAmazonName) & "\");"
do shell script sqlcmd & quoted form of query
set series of mediaItem to seriesName
else
-- series name already exists so update existing record
-- we don't update name because it may have changed since we retrieved it from Amazon.
set query to "update translate set series = \"" & my sql_escape(itemSeries) & "\" where dl2id == \"" & my sql_escape(itemId) & "\";"
do shell script sqlcmd & quoted form of query
end if
end repeat
end tell

on sql_escape(sqltext)
set AppleScript's text item delimiters to "\""
set the item_list to every text item of sqltext
set AppleScript's text item delimiters to the "\"\""
set sqltext to the item_list as string
set AppleScript's text item delimiters to ""
return sqltext
end sql_escape




Amazon does not populate (usually) the Series field in the information it sends back and it's not really DL2's place to guess from the other information what is appropriate to put there. On the other hand, Amazon's titles for volumes in a series and its formatting does not always agree with my preferences. They've gotten somewhat more consistent recently, but there's no guarantee that whatever Amazon sends back is what I would want to use as my title.

Thus the scripts in my earlier post which let me reset the title based on the Series and NumberInSeries fields.

This script fills in the last part which is to automatically set the Series field based on the title that Amazon returns.

The algorithm is as follows:
1) Maintain a sorted list sorted on the title/name that Amazon returns. In the second column of the list, associate what series the user has decided goes with this title.

2) When you get a new item, search to see where in the list it goes and then get the series information from the entry before it and copy it for this entry.

Example: Your list starts off like:
Eyeshield 21, Volume 1 | Eyeshield 21
Naruto, Volume 1 | Naruto

You then introduce Naruto, Volume 2. This inserts after Naruto, Volume 1 and we copy its series value, "Naruto," which happens to be correct in this case.

The first assumption is that Amazon is reasonably consistent. Volumes in a series will at minimum all have the series name at the front. For example, everything Naruto is "Naruto, xxxxxx". This is true for the majority of the manga I collect.

The second assumption is that I collect manga from earlier volumes to later volumes. So I'm going to get volume 1 before I get volume 10. Given how this algorithm works, it's not that critical that this is strictly followed, but it would be a worst case scenario if for some reason, you collected a series backwards.

This algorithm has an advantage that you don't have to make any assumption as to the precise formatting of the Amazon title. As long as Amazon is reasonably consistent across the volumes, it will work.

The other advantage is that you can arbitrarily rename a series based on your preference. For example, Monster by Naoki Urasawa is officially "Naoki Urasawa's Monster" in the US for whatever licensing reasons. I say screw that, I want the series to be called "Monster" in my library. And this algorithm has no problem with that. Or if you would prefer "Neon Genesis Evangelion" to be filed as "Evangelion." Again, no problem.




So now that the why is done, here's how to use the script.

First off, the script will create a sqlite3 database file in your Delicious Library 2 scripts directory. If you want to put this elsewhere, you can modify the appropriate variables at the top.

When you have new items, select them and run the script. If the series have never been seen before, they will either leave the series values blank or fill in incorrect information due to how the algorithm just uses blind sorting.

Correct the entries that are incorrect, select them again and rerun the script.

At this point, any new items in the series should automatically set with your preferred series name (subject to the assumptions listed above).

If you're satisfied with the series values, you can then run the other two scripts to set the series number and then rename the title.

Tuesday, June 3, 2008

Applescripts for Delicious Library 2

Here are a few applescripts I threw together for Delicious Library 2. Applescripts go into ~/Library/Scripts/Applications/Delicious Library 2/.

1) Mass import from a list of ISBNs.


-- Menu Path: [2], "Import", "Import Scripts"
-- Get a file name
tell application "Finder"
set isbnList to paragraphs of (read (choose file with prompt "Pick text file containing ISBNs to import"))
end tell

-- Statistic variables
set numIsbn to 0
set existingIsbn to 0
set lookedup to 0

tell first document of application "Delicious Library 2"
set isbnListRef to a reference to isbnList
repeat with isbnItem in isbnListRef
set numIsbn to numIsbn + 1
-- Check to see if book with this ISBN is already in the library
if (every book whose isbn is isbnItem) is {} then
set lookedup to lookedup + 1
-- DL2 call to look up ISBN on Amazon
look up isbnItem
-- Delay is to prevent flooding DL2s look up mechanism
delay 0.01
else
set existingIsbn to existingIsbn + 1
end if
end repeat
end tell

-- Report stats
display dialog "Done: " & numIsbn & " ISBN in list. " & lookedup & " ISBN looked up. " & existingIsbn & " ISBN already in DB."


I set this up to let me import my OpenDb list. In this case, the script will be located under the File|Import menu.
Use the "Export my Items" action in OpenDb. You will need to specify Books specifically to be able to export ISBNs.

2) Renaming titles based on series and number in series fields.


tell first document of application "Delicious Library 2"
set selectedItems to selected media
if selectedItems is {} then
display dialog "No entry is selected. Run on all entries in the library? (This may take a while.)"
set bookNames to every book whose series is not missing value and number in series > 0
else
set bookNames to selectedItems
end if
set bookNamesRef to a reference to bookNames
repeat with bookItem in bookNamesRef
set bookName to name of bookItem
set bookSeries to series of bookItem
set bookNumber to number in series of bookItem
if bookSeries is not missing value and bookNumber > 0 then
set name of bookItem to bookSeries & ": v. " & bookNumber
end if
end repeat
end tell


I collect lots of manga which tend to run multiple volumes. Unfortunately, sorting by title runs into problems when jumping from single digit volumes to multiple digit volumes (v.10 coming before v.2, for instance). Also, importing the information from Amazon can be wildly inconsistent with formatting.

This script will make use of the "series" and "number in series" fields to rewrite the "name" field.

An improvement would be if DL2 added an "on update" script that could automatically run this script when changes are made.

3) Pulling the volume number from a title.


tell first document of application "Delicious Library 2"
set selectedItems to selected media
if selectedItems is {} then
display dialog "No entry is selected. Run on all entries in the library? (This may take a while.)"
set bookNames to every book whose series is not missing value and number in series is 0
else
set bookNames to selectedItems
end if
set bookNamesRef to a reference to bookNames
repeat with bookItem in bookNamesRef
set bookName to name of bookItem
set bookSeries to series of bookItem
set bookNumber to number in series of bookItem
if bookSeries is not missing value and bookNumber = 0 then
set testlist to (a reference to characters of bookName)
set validChars to "0123456789"
set numberFound to false
set foundNums to ""
repeat with i from length of testlist to 1 by -1
if validChars contains item i of testlist then
set numberFound to true
set foundNums to item i of testlist & foundNums
else
if numberFound then
exit repeat
end if
end if
end repeat
if numberFound then
set foundNums to foundNums as number
set number in series of bookItem to foundNums
end if
end if
end repeat
end tell


Of course, filling the "series" and "number in series" fields is a bit of a pain itself. This script will assume that the last number in a title is the volume number and assign that to the "number in series" field.

It will only process items that have a "series" field set. It is fairly easy to batch set a group of items to the same series and then run this script to pull the volume numbers out. Afterwards, I run script 2 to format all of the titles.


These scripts are set to deal specifically with book items but they should work well enough for DVDs with a minor modification.

The last step for me is to figure out a way to reliably and automatically set the "series" field from the "name" field. This is much more difficult due to the inconsistency with how Amazon lists manga though it seems to be more consistent with recent titles.

Monday, November 12, 2007

Phase Review

Introduction
I'd like to think I'm well-versed in rhythm games having played my fair share of Guitar Hero, Karaoke Revolution, Ouendan, Band Brothers, Donkey Konga and DDR. I've even gone in with my share of Samba de Amigo, Taiko Drum Master, Parappa, Gitaroo-man and Amplitude. Shakka de Tambourine has eluded me sadly. Harmonix, the maker of Karaoke Revolution and Guitar Hero, has recently released an iPod rhythm game called Phase.

Phase is only available for the new iPod Nanos, Classic and 5th gen iPods (no iPod Touch or iPhone). Once it's installed (in iTunes 7.5), you'll have a Phase Playlist that you can drag your favorite tracks to. iTunes will spend a few seconds per track calculating game data from the music.

Gameplay
The game itself has a receding 3-d track reminiscent of Guitar Hero. Notes scroll towards you on 3 tracks corresponding to previous, select and next buttons (left, center, right). There is also a slider effect where you sweep your finger along the touch wheel to catch notes.

Each song starts with Easy, Middle, and Hard modes. Apparently more can be unlocked as you clear marathon mode - a series of 5 songs. I have yet to clear marathon mode so I'm just going off one of the random loading screen tips here. High scores are stored for each individual song.

The game is a decent rhythmer that makes good use of the platform. I don't find the side graphics (random 2d bitmaps) or sound effects (cheers and hit confirmations) particularly interesting and I've turned the sound effects off. As is with the case with most rhythm games, you'll probably be too busy concentrating on the notes to see the side graphics anyways.

On my own 5th gen iPod, the game eats the battery about as badly as video playback. My battery life was never good to begin with and I managed about an hour on a charge. The newer iPods should hopefully manage better. I also had an intermittent problem where loading my entire playlist of 150 songs caused the iPod to reboot. I wasn't able to reproduce this later so I'm unsure what the exact cause was.

Takeaways
Phase (or iTunes) does a good job of calculating the game data from the song. And this data generation makes Phase more compelling than it probably would be otherwise. A common weakness for most rhythm games is the song selection. Regardless of the game controllers or graphics quality, the "quality" of the song list tends to be a large factor as to whether or not people like a particular rhythm game. No matter how cool the controller, if a person (me) isn't that big a fan of rock music, he's probably not getting Guitar Hero (I played my sister's copy instead of getting my own).

Phase allows me to tap away to my favorite J-Pop or anime themes which are hard to come by in US rhythm game releases. The guaranteed ability to play to your favorite songs is a definite point (I would say strongest) in Phase's favor.

The creation of game data lends itself to some tantalizing home-brew possibilities. I haven't investigated how the game data is stored, but it could in principle lend itself to game clients on PC and Mac platforms. Given the availability of various game controllers for home computers, one could potentially unlock all of one's song collection for a larger and more immersing interface.

Thursday, August 9, 2007

Origami Starcraft figures

Saw this link over on boardgamegeek.com. I like the reaver that's off to the bottom.

Wednesday, June 13, 2007

Leopard's New Finder

I've been thinking about GUI design for a while and I came up with a few conclusions about file managers. I believe that the tasks a user performs in the file manager can be divided into three tasks.

  • The one I will focus on in this article is document management. What I place into this term is essentially the navigation or actions involved with finding, organizing and opening documents.
  • The second task is application launching. There's a little overlap with document management as media-related applications are usually launched by their associated documents instead of by the executable directly. Apple's Dock is a fairly underpowered, but effective handler of application launching. Various third party apps also give alternatives to more effective application launching.
  • The last is actual file/folder management. In this case, I mean moving, copying or deleting files and folders around on a system or to shared file systems.
Apple unveiled a new finder for Leopard at their WWDC based around iTunes. While not doing much for file management, I think using an iTunes model is a good idea towards providing a document management aspect in the finder. However, I'm disappointed because I feel that Apple didn't take the idea far enough and the result is mostly a lot of flash without that much substance.

The disclaimer for the entire article is that it is based on what has been publicly shown for Leopard. There's a possibility that Apple has elements that they haven't shown or have planned and not yet completed.



Originally and continuing into today, document management consists primarily of folders/subdirectories. A person might dump all of their school papers for 2005 into a 2005 folder. All of their history papers might further go into 2005/History. The purpose of this organization is to reduce clutter and to make it easier to find a document later. Thus, also, the traditional encapsulation of document management by file management.

There's been a minor shift recently towards using search to either replace or augment the need for this type of organization. Spotlight and other similar technologies on other OSs make it easier to find specific files without having to delve through trees of folders. I'm not that fond of this shift myself, but it appears to work well for some people as a few keystrokes gets them to their document.

However, search is direct. In the case of Spotlight, it's really to open documents as there are a few extra steps needed if you want to do file management on something it finds. Additionally, I think there's still a lot of benefit to being able to browse through documents. This is presumably the principle behind preview icons and Cover Flow which is about as flashy a browsing method as one can get. Browsing also is needed if you want to do file management. If you are looking to copy a bunch of files to a flash drive or onto an NFS.

I believe an iTunes-like interface makes the most sense for this kind of operation. And when I think iTunes, I'm thinking of meta-data management which unfortunately appears to not be something that's going to appear in Leopard. Meta-data is what people are really applying via their folder hierarchies and file naming schemes. Much like how an mp3 in iTunes could be named 01-dontdownloadthissong.mp3, but have artist, genre, album and other information associated in iTunes, any random file could have some set of meta-data that would help organize it.

OS X currently has minor support for this in the way of Spotlight comments that can be set on the information view for a file. But it doesn't appear that Apple is taking it any further at this time.



So what would extended meta-data handling in the finder give you? For starters, if it followed the iTunes interface, setting meta-data on mulitple files would become very easy. Just select a group of files and you would be able to change the information on all of them in one dialogue. Another benefit would be even more powerful smart folders/smart lists.

A killer feature I'm thinking of would be the ability to specify specific meta-data columns to use for a specific folder. Let's say you made an e-book folder to hold various pdfs or text files. Then in addition to whatever standard generic meta-data tags a file would have, you could define publisher, author, genre, rating. That folder would then turn into a mini-iTunes for ebooks.



I will cut Apple some slack as there's a big problem that would put a damper on all this meta-data tagging. That is namely that there is no good way to transfer meta-data around the internet. Locally, meta-data can be stored in the resource fork, but without a reliable and/or standardized way to transfer the resource fork, any meta-data on your system gets lost once it's off your system. But all the same, the ability to have it on the local system would still have a lot of utility.

Here's hoping for 10.5.x or 10.6 I guess.