From a colleague:
In case you ever have to do an f.seek():
When calculating record offsets, python only does a consistent
and correct len() value if your file is opened in binary.
Mostly Linux & Python syntax notes and hyperlinks.
From a colleague:
In case you ever have to do an f.seek():
When calculating record offsets, python only does a consistent
and correct len() value if your file is opened in binary.
We often copy a few fake records to create a large input file with which to test how the code handles it.
It's a useful test; but don't use it to gauge performance.
Data from repeated records can be cached and reused. If your production data will vary, then it won't get the same use out of caching. Caching could even hurt performance.
More complex solutions at https://stackoverflow.com/questions/28700043/thousands-separator-of-an-integer-value
-->C:\Users\mharrison>echo %CD%
C:\Users\mharrison
C:\Users\mharrison>dir %CD%\..\..
Volume in drive C is Windows
Volume Serial Number is E431-FA9F
Directory of C:\
03/03/2017 11:02 AM <DIR> DRIVERS
04/11/2018 07:38 PM <DIR> PerfLogs
05/31/2019 02:25 PM <DIR> Program Files
05/15/2019 09:04 AM <DIR> Program Files (x86)
03/25/2019 05:33 PM <DIR> test
05/13/2019 10:56 AM <DIR> Tools
04/09/2019 09:21 AM <DIR> Users
08/08/2019 06:02 PM <DIR> Windows
0 File(s) 0 bytes
8 Dir(s) 61,991,501,824 bytes free
C:\Users\mharrison>dir %CD%/..
Invalid switch - "..".
yum -y install firstboot
chkconfig firstboot on yum -y update kernel panic not able to mount root fs on unknown block(0,0)
rem Test Timing
rem You might need to set this in later versions and also use !time setlocal enabledelayedexpansion
set start_time=%time%
echo start_time is %start_time%
pause
rem Replace above 'pause' with activity to be timed (approx).
set end_time=%time%
rem Now calculate time difference
echo started %start_time%
echo ended %end_time%
rem To get a substring, do this:
rem %variable:~num_chars_to_skip,num_chars_to_keep%
rem Here we also prepend "1" to 2-digits and then subtract 100
rem to avoid numbers like "02"
rem which can cause errors in the windows batch interpreter.
set sh=1%start_time:~0,2%
set eh=1%end_time:~0,2%
set sm=1%start_time:~3,2%
set em=1%end_time:~3,2%
set ss=1%start_time:~6,2%
set es=1%end_time:~6,2%
set sms=1%start_time:~9,2%
set ems=1%end_time:~9,2%
echo sh %sh%, eh %eh%, sm %sm%, em %em% and sms %sms%, ems %ems%
pause
set /A start_secs=(%sh%-100)*3600 + (%sm%-100)*60 + (%ss%-100)
set /A end_secs=(%eh%-100)*3600 + (%em%-100)*60 + (%es% - 100)
set /A start_ms=(%start_secs%)*100 + (%sms% - 100)
set /A end_ms=(%end_secs%)*100 + (%ems% - 100)
set /A diff=%end_ms% - %start_ms%
echo %start_ms% to %end_ms% is %diff% milliseconds pause