Friday, October 09, 2015

Logging the Stack

I don't know, just thought I might need this again someday:

void LogStack()
StackTrace stackTrace = new StackTrace(true);
var thisMethod = stackTrace.GetFrames().Skip(1).First().GetMethod().Name;
var stack = stackTrace.GetFrames().Skip(2).Select(f => string.Format("{0}[{1}]", f.GetMethod().Name, f.GetFileLineNumber())).ToArray();
var result = string.Join(" < ", stack);
Log.Warn(logData, "{0} called from {1}", thisMethod, result);

Tuesday, October 01, 2013

App Icons Appearing on Droid Home

My wife just showed me her Droid 2 phone, and every open space on her screen was occupied by some icon.  At first I thought she just had too many apps, but when she said she had no idea what many of the icons were, I discovered that most of them were ads!

It turns out there's something called "AirPush" that allows some apps to push ads out to your homescreen.  Apparently there is some kind of financial feedback for them to do that, so that's why they keep putting them out there.

The trick to stopping them is to install a free app called AirPush Detector on your phone, and it will identify the culprits.  Then you can either uninstall the apps, or if you really must keep them, do an AirPush opt-out request.

All of this is detailed in this nice article from last year:

Saturday, March 10, 2012

Motherhood the Game

Just published my second Android application.  This one is a game, and will likely be the type of content I publish from now on.  The game is called "Motherhood the Game", and was written for my wife to present at the next Moms Club founders day.  The theme this year is "Motherhood:  there's an app for that!".  :-)
The game turned out to be more complicated than I thought it would be, and required a lot of graphics (all home-grown) and sound input.  The app is also a bit bulkier than I intended (6 MB) but that's largely because of the MP3's I used (from NoSoapRadio).

The game itself is 100% free:  no cost to download, no advertisements.  You can get it on the android market, and hopefully soon on the Amazon android market (free there too!).

More games on the way...

Friday, February 24, 2012

Paste Without Formatting in Word 2007

I don't know about you, but when I'm pasting something into a Word document (like from a web page), I find that more often than not, I want it to go in without any formatting. If you do this once or twice in a day, its easy enough to click on the "Paste" control, change the selection in the popup window to "Unformatted Text", and press ok. However, if you have to do this more frequently, this can quickly become a pain.

Today, I was working on a document where I was copying titles from our software bug tracking system over to a table in a word document. Because I was coming from an HTML document, Word was happily keeping the HTML format, and putting the titles in with a large blue-colored font. This is not what I wanted! Since I had to do this for 50 or so entries, I quickly got tired of the solution above, and went to Google and found this nice article:

  Paste text without the formatting into a Word document

Nice!  However, I quickly realized that my version of Word (2007) didn't mesh too well with the article's target version (2002).  If you've used the newer version, you'll know what I'm talking about.  Sure, the ribbon UI looks nice, but WHERE THE HELL DID EVERYTHING GO!  I remember how long it took me just to figure out how to PRINT my document for the first time!  Sheesh.

Well, time heals all wounds, and I've gotten much more adept at the latest Word layout, and even figured out how to apply the instructions from the article to my version.  In case you were interested (and so I don't forget how to do this), I'm reproducing the Word 2007-friendly instructions here:

STEP 1 - Create the Macro

  • Start Word 2007
  • On the View tab, click the Macros button
  • In the Macro name box, type PasteUnformattedText
  • Make sure that "All active templates and documents" is displayed in the "Macros in:" dropdown, and then click the Create button.
  • The Microsoft Visual Basic editor will open
  • Directly above the End Sub statement in the PasteUnformattedText subroutine, type or copy/paste the following line of code:
Selection.PasteSpecial DataType:=wdPasteText
  • On the file menu, select "Close and Return to Microsoft Word"

STEP 2 - Assign the Macro to CTRL-V

  • Open the main Word menu by clicking on the Microsoft Office icon in the upper-left corner (round button)
  • At the bottom of the popup window (not one of the menu choices), click the "Word Options" button.
  • Select "Customize" from the left panel.
  • Near the bottom of the panel, click on the "Customize..." button next to "Keyboard shortcuts:"
  • Make sure the "Save changes in:" dropdown shows "Normal.dotm"
  • In the Categories list, click Macros
  • In the Macros list, click PastUnformattedText
  • Click in the "Press new shortcut key" box (the cursor will appear there)
  • Press and hold the CTRL key, and then press "V".  You should now see "CTRL-V" in the box.
  • Click the "Assign" button, and then "Close", and then "Ok"
That's it!  Now anytime you copy (CTRL-C) from a web page, and then paste (CTRL-V) into your word document, you will get the unformatted text without any extra work.  If you decide you want the original default behavior back, switching is simple:

Restore Default Behavior to CTRL-V

  • Open the main Word menu by clicking on the Microsoft Office icon in the upper-left corner (round button)
  • At the bottom of the popup window (not one of the menu choices), click the "Word Options" button.
  • Select "Customize" from the left panel.
  • Near the bottom of the panel, click on the "Customize..." button next to "Keyboard shortcuts:"
  • Make sure the "Save changes in:" dropdown shows "Normal.dotm"
  • In the Categories list, click Macros
  • In the Macros list, click PastUnformattedText
  • In the "Current Keys" box, click on CTRL-V.
  • Click the "Remove" button, and then "Close", and then "Ok"
Back to normal!  Of course, that macro is still there if you ever want to use it again, so you never have to repeat STEP 1 above.

Well, back to work.

Friday, February 03, 2012

Grocery Ninja Aisle Sorting

I received a 1-star review on this app recently that read:
The main feature that I was looking for is the ability to sort by aisle number. It has the feature, but the feature doesn't work. It just won't sort. (yes I checked off sort by aisle.)

Since there is no way to really respond to a comment (except to submit a review), I figured I'd attempt to address it here.  First of all, it does work in my hands, and on all the devices I've tested.  I suspect this user is doing something I didn't expect when I designed this feature.  Rather than guess what might be wrong, I'll detail how this feature works in case this user ever looks here for more info:

  • Setup a store by adding a store, and adding a list of aisles (either manually or using the in-app generation feature)
  • Organize the aisle order by clicking and dragging items into place
  • Create your grocery list
  • Assign a location to each item that doesn't already have one by long-clicking, and choosing from the list of aisles
  • Verify that the "Sort by Aisle" option is checked under settings.
That's it! If you've done this, and it still isn't working, I'd love to hear from you. If there's a problem with this feature, the only way I can fix it is by hearing from you.

Thursday, January 26, 2012

Grocery Ninja Update v.

Just updated Grocery Ninja to fix a couple of bugs, and add more Ninja sounds. Also, there's a new feature to allow you to confirm your voice entry items before they are finalized to the list.

BTW: the new update may "expose" some empty list items at the bottom of your grocery list.  Don't worry:  they're harmless! These empty items were being created as a result of a bug that I just fixed, so they shouldn't happen anymore. Hopefully you don't have any, but IF YOU DO, just go ahead and delete them. I've been using the app for over a month now, and only had 5 of these blank entries, so it shouldn't be too big a deal to clean up. Sorry about that!

Sunday, December 18, 2011

Grocery Ninja

I just published my first ever Android app! It's called "Grocery Ninja" and was a perfect first app to write to teach me about all the different aspects of Android programming: Activities, ListViews, TouchEvents, and even some SQLite database work. :)

Granted, I've been programming in Java for something like 10 years, and programming in some form or another for the last 25 years, but writing for a mobile smart phone has got to be the most fun thing I've gotten to do so far.

Why a Grocery app? After all, there's got to be 1000's of these available in the Android market! Well, the truth is that I tried probably a dozen or so grocery apps when I first got my Droid X, and none of them really did what I wanted. So many of them are so full featured, I could barely use the things without hitting all kinds of unnecessary features! I considered writing my own, but then I never got around to it. Then one day, my youngest brother sent me an e-mail:
Hey Bro!

I have an app I’d like you to create. We’ve tried several grocery apps (about 10 so far), but have yet to find one we like.

I’d like to be able to add a store, setup my own aisles/depts for that store, and be able to sort them in the order I want.

Then, I’d like to add a grocery item and specify what store/aisle I want to get it from. It would also be nice to add quantity and approx price.

Once I’m done with my list, I want to be able to see the approximate total for all my items and check them off as I purchase them (maybe even update the price to actual purchase price).

The next time I go to create a list, it should remember my preferences (and prices) for previously added items. For example, apples would automatically fall under produce at Safeway.

Entry should be available via keyboard or voice command. I saw one where you could say “and” and add multiple items at once (i.e. “apples and pears and broccoli” would list as 3 separate items).

I was a little taken aback, because this is exactly the same thing I wanted in an app. I'm not sure if my brother thought I would actually take it on or not, but I decided it was time to get my feet wet in Android land.

Well, its been a long road (been working on this off and on since early November), but its finally published. If you have an Android device, and want to give a look-see, search for "Grocery Ninja" in the market, or visit the Android Market on the web.