In Laurel, we have Pho 54 and Pho 88. Lisa and I both prefer Pho 54. There's apparently one in Burtonsville called Pho Real. Many folks seem to think that Pho Nam in Catonsville/Ellicott City is good. All of this from the following foodblogger's post:
http://howchow.blogspot.com/2010/02/pho-89-in-laurel-and-plan-to-visit-pho.html
Sunday, February 24, 2013
Friday, February 22, 2013
Extracting one value from logged ascii packet data
Here is my personal trending tool for work, producing three columns space delimited file that can be imported into Excel
find . -name "*.log" -exec grep Keyword -H {} \; | sed -e 's/: 10/:10/' | awk '{print $1 " " $2 " " $68}' | sed -e 's/.l
og:2/.log: 2/' > ~/output.txt
Thursday, February 21, 2013
Using gnuwin32 find and grep
My issue is that I've just been too lazy to set up my $PATH correctly on my windows system, so I have to call out the full executable path thusly:
"C:\Program Files\GnuWin32\bin\find" . -name "filename.txt" -exec "C:\Program Files\GnuWin32\bin\grep" -H Keyword {} ;
Friday, February 8, 2013
Get UTC in python 2.5
This turns out to be quite native. Corresponding to functions like now() there is a utcnow(), etc. There is a function called strftime to convert a time value to a string with all the usual formatting. Sadly, for whatever version of python 2.5 that I have, the formatting option %f for milliseconds doesn't seem to work, even though if I just print() the time value it prints the milliseconds.
Here is a link that talks about utcnow(). It's in the question, but the rest of this thread is garbage:
http://stackoverflow.com/questions/1599060/how-can-i-get-an-accurate-utc-time-with-python
Here's a great review of the many possible ways to get the current time:
http://stackoverflow.com/questions/415511/how-to-get-current-time-in-python
Among my favorites are:
or:
or:
or apparently now can just be called on its own?
So, here's some info about no %f:
This link for strftime doesn't show %f as a formatting option:
http://www.tutorialspoint.com/python/time_strftime.htm
This link clears things up a bit, apparently time.strftime doesn't support milli-or-miro seconds, but other functions do. Also if the system doesn't support milliseconds, that is a cause of grief:
http://stackoverflow.com/questions/6677332/using-f-with-strftime-in-python-to-get-microseconds
Whenever I tried %f on my system, no result would be produced at all (silent failure). I got around that by using str() which does a conversion including milliseconds but doesn't seem to accept formatting and then just substituting out the characters I didn't want:
This forum thread's commenters repeatedly urged the use of the funtion "translate", I'm not sure why I used replace instead:
http://stackoverflow.com/questions/10017147/python-replace-characters-in-string
Here is a link that talks about utcnow(). It's in the question, but the rest of this thread is garbage:
http://stackoverflow.com/questions/1599060/how-can-i-get-an-accurate-utc-time-with-python
Here's a great review of the many possible ways to get the current time:
http://stackoverflow.com/questions/415511/how-to-get-current-time-in-python
Among my favorites are:
import datetime
datetime.now()
-or-
datetime.utcnow()
or:
import gmtime,strftime
strftime("%Y%m%d_%H%M%S.%f", gmtime())
or:
import datetime
datetime.datetime.now.().strftime("%Y%m%d_%H%M%S.%f")
see:
http://pleac.sourceforge.net/pleac_python/datesandtimes.html
or apparently now can just be called on its own?
import datetime
now.strftime("%Y%m%d_%H%M%S.%f")
(not quite. See: http://effbot.org/librarybook/datetime.htm
So, here's some info about no %f:
This link for strftime doesn't show %f as a formatting option:
http://www.tutorialspoint.com/python/time_strftime.htm
This link clears things up a bit, apparently time.strftime doesn't support milli-or-miro seconds, but other functions do. Also if the system doesn't support milliseconds, that is a cause of grief:
http://stackoverflow.com/questions/6677332/using-f-with-strftime-in-python-to-get-microseconds
Whenever I tried %f on my system, no result would be produced at all (silent failure). I got around that by using str() which does a conversion including milliseconds but doesn't seem to accept formatting and then just substituting out the characters I didn't want:
timeformatted= str(datetime.datetime.utcnow())
timeformatted = timeformatted.replace("-","")
timeformatted = timeformatted.replace(":","")
timeformatted = timeformatted.replace(" ","_")
This forum thread's commenters repeatedly urged the use of the funtion "translate", I'm not sure why I used replace instead:
http://stackoverflow.com/questions/10017147/python-replace-characters-in-string
Python spit array into equal parts
My need was to take some C code that read in n-byte chunks from a file, and instead take those chunks from an array instead. The problem was helped by the fact that the size of the source array was always fixed to the same size; it was a simple matter of setting up a loop of array size/chunk size and then setting a chunk-sized array to each chunk repeatedly and processing it. Here is the final code:
The little bit at the end is important; to subset arrays, the final element in [n:m] needs to be one larger than you would use in C, which would be [chunk-1].
Here's a really thorough discussion, using an unfamiliar keyword "yield" for several suggestions:
http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python/312644
for row in range (0,[size/chunk]):
a = data[row*[chunk]:(row*[chunk])+[chunk]]
The little bit at the end is important; to subset arrays, the final element in [n:m] needs to be one larger than you would use in C, which would be [chunk-1].
Here's a really thorough discussion, using an unfamiliar keyword "yield" for several suggestions:
http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python/312644
Thursday, January 31, 2013
unix copy file and create directory if it doesn't exist
My goal was to re-create a directory tree of files under a new root by copying them, creating all the same directory levels. I found a convoluted command line for doing this using xargs and split and stuff, but it turns out that cp has the most wonderful argument, --parents. Here was the solution:
find . -name "regex" -exec cp -p --parents {} /newroot \;
Wednesday, January 23, 2013
My favorite LED light bulbs
I've pretty much decided that I want old-bulb shaped LED light bulbs to avoid seeing individual points of light, for 360 degree illumination, and to prevent aesthetic horrors that require a bulb to be hidden by a shade. This rules out the inexplicable "golf ball on a tee" styles, and definitely the "pancake on a tee" style. It also rules out the otherwise practical "corn" lights, although not if they're inside frosted glass.
Since I am replacing incandescents, I wish the replacement to have the same yellow light color. The jargon for this is "Warm White"; I definitely have no interest in "Cool White" or "Stark White". This is a little funny since the "warm" color has a lower "temperature" value. The colors are rated by an incandescence rating, on a temperature scale. The color that most closely resembles old light bulbs is "2700K". You'd think that "3000K" would also be close, but it's pretty white. The most hideous bulbs are "5000K" and "8000K".
Unfortunately, it's pretty hard to find high brightness LED bulbs at 2700K. I am pretty pleased with these Utilitek 25W equivalents. They have just 3 LED's in the base, under a transparent plastic diffuser in a clear glass bulb. It's compact and aesthetic, but also just good for "night light" applications like at the bottom of my basement stairs.
The brightest bulb-shaped ones are these "MiracleLED" "UnEdison" ones:
http://www.sears.com/miracleled-miracle-led-lamp-bulb-frosted-soft-white-60-watt-equivalent-led-light-bulb/p-SPM6492361702
https://www.gogreenledbulbs.com/p/215/frosted-soft-white-led-light-bulb-60-watt-equivalent-uses-5-watts
Here it is in "Warm". "Soft" might not be so Warm after all. None of these product descriptions use the temperature scale, except that the gogreen site lists temps. Interestingly, both the "Soft" and "Warm" are both specified as being 3000K:
http://www.sears.com/miracle-led-605061-unedison-warm-bulb-white/p-SPM6292462108?prdNo=4&blockNo=4&blockType=G4
https://www.gogreenledbulbs.com/p/220/un-edison-frosted-warm-white-led-light-bulb
Here's a nice storefront for this brand of bulb:
https://www.gogreenledbulbs.com/
Here's another one similar to the UnEdison bulb, this one is branded "LED Shine 360". Maybe it's a knockoff. I was pretty sad that it was 3000K, but then I saw that the UnEdison ones are 3000K also. From 1000bulbs.com:
40W:
http://1000bulbs.com/product/65624/LED-3606WWW.html
60W:
http://1000bulbs.com/product/65218/LED-3608WWW.html
I was also sad that these say "Indoor use only". However, it seems that the UnEdison ones have that fine print also.
Here's a relvant product category page inside 1000bulbs.com:
http://1000bulbs.com/category/traditional-style-led-light-bulbs/
Since I am replacing incandescents, I wish the replacement to have the same yellow light color. The jargon for this is "Warm White"; I definitely have no interest in "Cool White" or "Stark White". This is a little funny since the "warm" color has a lower "temperature" value. The colors are rated by an incandescence rating, on a temperature scale. The color that most closely resembles old light bulbs is "2700K". You'd think that "3000K" would also be close, but it's pretty white. The most hideous bulbs are "5000K" and "8000K".
Unfortunately, it's pretty hard to find high brightness LED bulbs at 2700K. I am pretty pleased with these Utilitek 25W equivalents. They have just 3 LED's in the base, under a transparent plastic diffuser in a clear glass bulb. It's compact and aesthetic, but also just good for "night light" applications like at the bottom of my basement stairs.
The brightest bulb-shaped ones are these "MiracleLED" "UnEdison" ones:
http://www.sears.com/miracleled-miracle-led-lamp-bulb-frosted-soft-white-60-watt-equivalent-led-light-bulb/p-SPM6492361702
https://www.gogreenledbulbs.com/p/215/frosted-soft-white-led-light-bulb-60-watt-equivalent-uses-5-watts
Here it is in "Warm". "Soft" might not be so Warm after all. None of these product descriptions use the temperature scale, except that the gogreen site lists temps. Interestingly, both the "Soft" and "Warm" are both specified as being 3000K:
http://www.sears.com/miracle-led-605061-unedison-warm-bulb-white/p-SPM6292462108?prdNo=4&blockNo=4&blockType=G4
https://www.gogreenledbulbs.com/p/220/un-edison-frosted-warm-white-led-light-bulb
Here's a nice storefront for this brand of bulb:
https://www.gogreenledbulbs.com/
Here's another one similar to the UnEdison bulb, this one is branded "LED Shine 360". Maybe it's a knockoff. I was pretty sad that it was 3000K, but then I saw that the UnEdison ones are 3000K also. From 1000bulbs.com:
40W:
http://1000bulbs.com/product/65624/LED-3606WWW.html
60W:
http://1000bulbs.com/product/65218/LED-3608WWW.html
I was also sad that these say "Indoor use only". However, it seems that the UnEdison ones have that fine print also.
Here's a relvant product category page inside 1000bulbs.com:
http://1000bulbs.com/category/traditional-style-led-light-bulbs/
Subscribe to:
Posts (Atom)