yysun's space

Archive for January 2008

Refers to an operation that produces the same results no matter how many times it is performed. For example, if a request to delete a file is successfully completed for one program, all subsequent requests to delete that file from other programs would return the same success confirmation message if the delete function were idempotent. In a function that is not idempotent, an error would be returned for the second and subsequent requests indicating that the file was not there, and that error condition might cause the program to halt. If all that were desired was to ensure a certain file was deleted, an idempotent delete function would return the same success result no matter how many times it was executed for the same file.

Advertisements

Story began when I was customizing some wordpress templates on my vista powered PC. I was curious what kind of PHP source code is behind the “the_content” tag, so that I tried to type word “the_content” in the windows explorer’s search box. This search did not appear to work. No file found.

This triggered a long journey digging into how to search the text in php files.

Method 1: Use Visual Studio, Edit | Find in files … (27 files found)

Method 2: Use FINDSTR in command prompt.
>findstr /si the_content *.php

Method 3: Use PowerShell
> dir . *.php -r | select-string the_content  | group-object Path | select-object Name, @{Expression={$_.Group | foreach {$_.LineNumber} }; Name=”Line Numbers”}, Count | format-list (c.f. this post)

Had so much fun learning PowerShell. :)  Spent a lot time on this. 

However, why Vista cannot search? The answer is the php files’ index options was “Indexing Properies”, but should be ”Indexing Properties and File Contents” in Control Panel – Classic View – Indexing Options – Advanced – File Types.

Finally also learnt that Vista search is word based, not character based. And maybe Vista search tokenized “the_content” same as “the content”, because the files have “the content” showed up, when searching “the_content”.

What a weekend, just like the comedy channel said, Time Well Wasted 🙂



  • None
  • Pk: The horizontal view is a pleasure to use! Good thinking
  • randyburden: A valiant and commendable effort. Your use of Tuple is a little weird but it offers a feature that most other microORMs don't. Your use of a static Gu
  • reav: great work done on Rabbit Framework. just started to learning it, and by now i think it will solve all my problems and questions, that i had in webpag

Categories