FORFILES to find and delete files older than n days

Here is a quick tip for finding and deleting files that are older than some number of days.  I had been using a .bat file to purge a directory of log files that tended to fill up a drive quickly on a weekly basis when I ran accross the handy FORFILES command.  Using this command I can choose to only delete files older than n days (in this example, 10).

Here is the code:

FORFILES -p “C:\logfiles” -s -m *.* -d -10 /C “cmd /c del @PATH”

A good idea is to use an echo command to debug your .bat file first to make sure you are picking up the right set of files like this:

FORFILES -p “C:\logfiles” -s -m *.* -d -10 /C “cmd /c echo @PATH”

Obviously deleting files is not the only useful thing you can accomplish with FORFILES, so it’s up to your imagination on what you can do with the /C parameter.  Check out FORFILES /? for a listing of all the params available for the command.

The command was installed on the Server 2008 machine I was using, but not on the XP install I had on my laptop, but you can grab the .exe here ftp://ftp.microsoft.com/ResKit/y2kfix/x86/ and throw it in your system32 dir for use anywhere.

C# Path of dll vs. Application path vs. EntryAssembly path vs. Form path

OK, I have stumbled on this one a few times so I thought I would blog it up so that I had a place to come and find the answer. The problem most recently was an application I wrote that I use as a command line tool, but other times as a class that hits a constructor. Either way a property file is needed, and depending on the way I call it I had trouble finding the path to the config…

The problem is, when you use Microsoft Visual Studio to launch the debugger, the Application.StartupPath can’t be relied upon, as it points to the Studio directory. At run time it might work, but not for the case I had in mind where I needed to know where the DLL itself was.

So you can use this:

System.Windows.Forms.Application.StartupPath

But that is for a windows form startup path – useful, but not for me.

This will give you the directory the app started in (but again, it may be a Visual Studio directory if debugging):

Application.StartupPath

And this will give you the process executable in the default application domain, or the first executable that was executed by AppDomain.ExecuteAssembly – again, not what I needed:

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)

Finally, the winner is (and look closely – GetExecutingAssembly vs. GetEntryAssembly)

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)

This snip allowed me to find the directory where the DLL was currently executing, and thus the config that sits next to it. So many ways to get at run-time information! Hope that helps you!!

Google Android Market VS. Amazon Appstore

There are plenty of 2nd party App-Store wanna-be’s out there like SlideMe.org, AndroLib, AndAppStore and others that have tried hard to crack the Google Android Market gold mine, but have had only mild success. While Google rested on their “we own it” laurels, and did little to bring the Android Market to the public in bigger ways, monsters like Amazon now loom in the background – threatening t o bring real web development and internet sales skills to the table.

Google may have the lions share of the app sales game at the moment in the Android space, but are they moving too slow to lead?  Recently the search giant introduced a new web presence for the Android Store that allowed online browsing, and push to phone – something sorely missing from the Android experience, but possibly too little too late.Google needs to step up their game here I think, or the doors might be open exposing the castle keep here.

The thing with smart-phones and app stores is that they need to be sexy! You have 10 minutes to kill, so you turn on your phone, hoping to be amused, informed, amazed. Google’s less is more search interface, while perfect for the desktop experience, doesn’t fly here.  The current Android Market web experience is like it came from the same department – sans sex. Google needs to bring in some designers and marketers that know how to make me A) open their app store when I have 10 minutes, and B) be excited to be there and get new stuff.

Amazon has recently moved into Google’s space with their Appstore.  Having looked at it from the beginning, months prior to the release, I can say that they have really come a long way.  In fact, I think maybe they have even one-upped the big G’s gold standard. They have editors (that are used to selling stuff!!) writing content for app descriptions, and have an app submission process that is getting pretty sweet. Their one click purchase system makes it a breeze to get that new app, and their Appstore is fresh and feels right.

Look for more competition in this space, as there is plenty of money to be made here.  For now, these two behemoths have the dance floor and while it may not yet be even money, look for Amazon to do everything in it’s power to be in mobile as a formidable leader.

Motorola Xoom Standard Dock Review

Along with the Motorola Xoom Wifi, I picked up the standard dock for it as well.  The dock itself is a heavy little thing, which gives it plenty of stability when you are touching your tablet while docked.  The Motorola Standard Dock comes with an adapter for gel case users, and a power supply. The power supply is the same proprietary adapter that the Xoom uses (no surprises there I guess) but still made me disappointed once again that the device is not powered by mini-usb.   The tablet light sensor lines up nicely with a dot on the dock so you can easily get it into position. Also included is a standard jack to route your audio into a better sound system without fuss when docked.

 

I like the dock overall, but here is the list:

Good:

  • Sturdy, heavy duty feel
  • Sound routed to external system works great
  • Charges unit
  • Stays “dim-lit” so you can see your desktop/apps when not in use
  • Makes for a great living room end table slide show dock

Bad:

  • If you are a developer and think this thing will have a mini-usb pass through so you can develop and debug while docked, think again.
  • The viewing angle while docked, to me, seems a bit steep
  • MSRP is $50 – are you kidding me?  You can find it cheaper, but still…

So there you go, aside from a few complaints this thing is a solid addition to the Xoom.  I’m guessing a nice Bluetooth keyboard would make this thing a pretty handy travelling PC. You can pic the dock up at Amazon over here: Motorola Standard Dock and Power for MOTOROLA XOOM (Motorola Retail Packaging)

 

Motorola Xoom Wi-Fi Review

The day finally came where the price point and no need for a data plan device stars aligned and I found myself down at the local Costco picking up the Motorola Xoom – Wifi version.

The device was on the shelves 3/27/2011 (and not 3/26 – I stopped in and checked, just in case.)   As a bonus for using Costco, they throw in a free gel case, and dropped the MSRP from $599 to $589.  I got there pretty early, but from what I could tell only one other had been sold at that point.

 

The Good:

  • The build quality is amazing – super sturdy
  • The battery life is great (and it was even charged out of the box)
  • Honeycomb (Android 3.0) is polished and ready to contend with any tablet OS
  • The speed is great, makes my Nexus S seem slow (and it’s not…)
  • WiFi is great, even picked up my shoddy WiFi at work all day
  • Micro-SD slot!!  Stereo Speakers!! Decent Camera!  Flash!! Camera Flash!!
  • The Honeycomb built apps (like Gmail etc. are all so much better than the phone versions, with preview and all kinds of extras.
  • Mini-HDMI and USB
  • Tethering to my Nexus S was seamless

The Bad:

  • This thing is heavy – I thought the same of the original iPad – build quality/battery showing their head?
  • Apps – tablet specific apps are in the 50’s as I write this, not thousands like the iPad.  Also, a few apps simply don’t like the layout and hung.
  • Probably a setting, but new apps stick icons on your desktop
  • I find the power button on the back side to be in a weird spot
  • It has a proprietary charger, not the mini USB, so car charging is out for now

With the 90 day return policy I felt confident to pull the trigger on this Moto-offering, and I can tell you I haven’t been anything but pleased in the outcome.  I even ponied up and ordered the dock which comes tomorrow. All I can say is you have to get one of these.  If you have been waiting for the right moment to get in on the tablet bandwagon, now is the time, get yourself a Xoom.

 

Android: Google Please Fix Emulator

O.K., so it’s not completely broken, but the Android emulator is about the worst thing the whole Android development platform has going for it. Sure, I get it that it is hard to write code that is emulating a completely different hardware architecture. I know that a lot of things have to be considered – I mean the phone is running a Linux variant underneath the covers and it takes some tricks to pretend to have file systems, keyboards, speakers, and microphones – not to mention the radios, orientation sensors, NFC chips, and other gizmos.

What I just don’t get though is why my 6 core, 16 GB dev box with dedicated video can’t emulate what my poor little G1 (and all of it’s Nexii brethren on my desk) does without a twitch. (OK, I’ll give it to you, the G1 kinda twitches….)

I told an interested Dev who has no device the other day to forget it. Go elsewhere until you get one: it’s just an exercise in frustration. It will start out great, and deteriorate into a mess on everything but the most simple of apps. The platform has so much going for it, the emulator is like the dirty little secret nobody talks about. Locked in the back closet, we all sweat just thinking of the use case our handset debugging will fail us like complex database issues.

But really. Someone at Google has to put this at the top of the old //TODO list. Hammer out a new emulator and make it start without lag, respond like it’s a real device. Until this is done, I will be sitting with iOS devs hoping they don’t bring this ugly reality up. And then I will laugh at them, and their toy OS. And then I will launch the emulator. And then I will go see if something in the garage needs to be bolted or riveted or something.

Album Review: Radiohead – The King of Limbs

8 Songs, Raidiohead’s shortest album lineup ever, released this weekend as the latest from a constantly changing band that continues to evolve in directions unexpected. “The King of Limbs” was announced on Radiohead.com for download as 320 bps MP3’s ($9), lossless WAV ($14), or as a vinyl/mp3/CD combo($48) or on Amazon: The King Of Limbs. The band’s last release, “In Rainbows”, was offered as a “pay us what you think it is worth” but Radiohead took a more traditional approach with this one. The announcement came as a simple “Thank you for waiting” on the website home page, void of the fanfare and lead-up that accompanies most band’s efforts.

A first pass of “The King of Limbs” leaves occasional listeners scratching their head, questioning the electronic sounds, the trance-like Thom York falsetto, the complex layers and bizarre wanderings in tracks like “feral”. The truth is, if you haven’t been on the Radiohead bus for the last 3 releases, you may just not get this at all. If you didn’t buy into the turns that were taken in “OK Computer” or “Kid A” then you won’t find much to hold onto here. This album is spacey and has moved so far from “Pablo Honey” and it’s generational theme “Creep” that you can barely make it out as the same band.

This album is not a single listen win, and will take some time to digest and understand. The track “Locust” is about as close to mainstream as it gets, and was released with a video of York writhing (dancing?) and doing what you might typically see him perform on stage – lost in his own performance. That said, when I say mainstream, most will look at you wondering what is wrong with you if you tried to make that case for “The King of Limbs”.

Several listens will find pieces like the simple and haunting “Codex” growing on you as you understand their structure and how well they all lead to each other. “Give up the Ghost” is a beautiful song that has Thom musing on about “I think I have had my fill”, again simple but hiding in layers of fear and thought. The closing work, “Separator” teases the listener with a “If you think this is over, you are wrong” and “wake me up, wake me up” and leaves you feeling like you have just shared some magical dream of happiness and pain, love and fear during the short listen.

In the end, and after several listens, I’m not sure this will be my fondest Radiohead release but I appreciate it for what it is: another interesting direction to reveal another beautiful, but so different painting of music by a favorite artist. Much of what you discover here will need to be appreciated for itself, not for what you expect of it based on the past. “The King of Limbs” will leave you wondering though, if something is missing. Did they leave Radiohead’s identity completely behind on this album? Possibly.

ToMarket HandyShopper Converter tool available

Over on my App website for ToMarket I have a utility that can help HandyShopper users convert their PDB files to ToMarket CSV files so that they can import them into their shiny Android phones, finally ridding themselves of the Palm legacy. (Hey, I loved it at the time too 😉 ) So go check it out if you have Handy Shopper roots and want to move into the 10’s with ToMarket Grocery Shopping:

http://www.tomarketweb.com/dnn/GettingStarted/ConvertingFromHandyShopper.aspx