1. I’ve written this trick every new job or position I miss out on the old standby, using batch script to capture command-line output to a dated log file.  This post is so I’ll never have to reproduce it again.

    C:\Users\YzOrg>echo %date:~10,4% %date:~4,2%
    2010 11
     
    C:\Users\YzOrg>echo hi >  %date:~10,4%%date:~4,2%.txt
     
    C:\Users\YzOrg>dir *.txt
    Volume in drive C has no label.
    Volume Serial Number is B8EE-D08D
     
    Directory of C:\Users\YzOrg
     
    11/24/2010  09:32 AM                 5 201011.txt
    10/01/2010  10:40 AM               210 SDK.txt
                   2 File(s)            215 bytes
                   0 Dir(s)  199,100,514,304 bytes free
     
    C:\Users\YzOrg>set line=0123456789 ABCD 0123456789 ABCD0123456789 ABCD0123456789 ABCD0123456789
     
    C:\Users\YzOrg>echo %line:~10,8%
    ABCD 01
     
    C:\Users\YzOrg>echo hi > demo%date:~10,4%%date:~4,2%%date:~7,2%.log & dir demo*.log
    Volume in drive C has no label.
    Volume Serial Number is B8EE-D08D
     
    Directory of C:\Users\YzOrg
     
    11/24/2010  09:50 AM                 6 demo20101124.log
                   1 File(s)              6 bytes
                   0 Dir(s)  199,100,379,136 bytes free
     
    C:\Users\YzOrg>set /?
    Displays, sets, or removes cmd.exe environment variables.
     
    SET [variable=[string]]
    ...<SNIP>
     
    Use %~dp0 to get the full path of the current batch file.  %0 is the scriptname argument, '~dp' are modifiers to get the drive and path of that argument, %~dp0. 
     
    Interesting FOR commands in cmd.exe :
    FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
    FOR /F ["options"] %variable IN ("string") DO command [command-parameters]
    FOR /F ["options"] %variable IN ('command') DO command [command-parameters]
     
    Rule: always turn off 'echo' in batch files using this first line:
    @if not defined _echo echo off
    Use 'set _echo=1' before calling the script to debug it (it will echo every command)
     
    References: set /?, call /?, for /?, setlocal /?

    2

    View comments

  2. iPod

    I recently bought a 4th gen iPod and man do I love it. Don't have to pay a data plan, and with a few bucks for good software can really make use of the GB of
    flash storage and the fat bandwidth over WiFi. Exactly what my old Windows Mobile 6.X phone sucked at. Great battery, great podcast playback (2x play, remembers where I left off, etc.).
    The only thing I was missing was Podcast subscription (on device, no iTunes on Windows please) and automatic WiFi sync for podcasts. There's an app ...

    iOS Apps

    DownCast: $0.99 app to sync podcasts over WiFi. My Features: Multitasking (background play), subscribe to podcasts, sync to iPod via WiFi, 2x speed, good jump buttons (back 30, back 15, forward 30, forward 2:00). Bonus features: can sort a playlist by podcast name instead of date, so can see the three 'good'
    weekly podcasts first (instead of listening to the daily podcasts first, which tend to be filler.  I also found out too late that it can import an OPML from a URL (I was adding them one at a time, good time saver.)

    Microsoft OneNote: free. My Features: (sync to Live/SkyDrive/OfficeLive, whatever they're calling it today). Love that it syncs my notes to all my devices + web.
    So I can start gathering notes and thoughts for a blog post on the laptop, research it on the desktop, and pull it up on my pocket device (iPod in my case) to solicit feedback from a co-worker.
    Leave it to Apple to help make OneNote useful enough to finally start using it instead of email.

    StackOverflow + Google

    The work Google is doing to reduce spammers and content farms seems to be working - SO rank has recently improved dramatically in my recent programming searches.

    For similar technology searches a few weeks ago I was getting spam/content farms of stackoverflow.com duplicated content for most of the results, with SO 3rd or 4th (obviously the content farms were gaming the SEO ranking).  Not scientific by any stretch, but getting better.
    0

    Add a comment

  3. JSON / Diagnostics

    Pretty Print JSON via JayRock
    New JSON library for .NET, JayRock

    WPF and INotifyPropertyChanged

    http://code.google.com/p/notifypropertyweaver/
    http://stackoverflow.com/questions/671968/retrieving-property-name-from-lambda-expression
    http://msdn.microsoft.com/en-us/library/ms229614.aspx
    http://caliburn.codeplex.com/wikipage?title=Asynchronous%20Actions
    http://stackoverflow.com/questions/834632/bind-any-xml-document-to-wpf-treeview

    IoC / Autofac

    Nicholas Blumhardt: AutoFac and object Lifetime (summary: mind your 'unit of work' pattern)
    0

    Add a comment

Blog Archive
Contributors
Contributors
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.