Currently I can display the local time text (clock overlay) on the video stream.
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! clockoverlay ! ximagesink
I am struggling to find out a way to display the current date (assuming local time zone).
I am sure I can do this by writing my own plugin. However, is there one in the stock or work arounds to avoid reinventing the wheel? Any ideas?
Check out gst-inspect-1.0 clockoverlay. If you do that you will notice the following option:
time-format : Format to use for time and date value, as in strftime.
flags: readable, writable
String. Default: "%H:%M:%S"
So as you see you can just set this to whatever you want following the strftime format. Check out http://www.cplusplus.com/reference/ctime/strftime/ for details.
So a simple way for you would be to use:
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! \
clockoverlay time-format="%D %H:%M:%S" ! ximagesink
And you will have the date in the overlay as well. Feel free to design the text-format string to your liking.
Related
Is there any command in cdo or nco (which I am not very familiar with) to add some timesteps at the beginning of a long time series? Let's say I have a long time series (1959-2021) within summer season (JJA) and I want to add from 24-30 August 2021 at the beginning of 1959 and from 1-8 June at the end of 2021. I was thinking to selec the days with cdo but then I am not sure how to do this with a cdo command (cdo mergetime I think will merge it at the end only), so I was wondering if there is any command in nco or even cdo that can do this?
Thanks in advance !!
add days at the beginning of a time series and at the end.
The question needs a little clarification, you mean that the 1-8 June is from 1959 and you want to post it to the end of the series? In other words you want to make the series cyclic? And what is the frequency of the data, daily? hourly? And also when you paste it to the start, you mean you want it pasted to 24-30 aug 1958, or the last days of May in 1959, in which case that will be your only May days? Please try to be specific and detailed when posting. Think of your question as a cake recipe you need to specify, we need to know the ingredients :-)
So, guessing what you want to do, and assuming hourly data frequency... I think you could do this by selecting the steps you want, resetting the time axis and then doing mergetime (here I just paste the end to the start, duplicate for the other direction):
cdo seldate,2021-08-24,2021-08-30 in.nc out1.nc
cdo settaxis,1958-08-24,00:00:00,1hour out1.nc out2.nc
cdo mergetime out2.nc in.nc merged.nc
An alternative, if you want to shift the end to 1958, same dates is to use shifttime, then the code is :
cdo seldate,2021-08-24,2021-08-30 in.nc out1.nc
cdo shifttime,-63years out1.nc out2.nc
cdo mergetime out2.nc in.nc merged.nc
It seems a strange thing to do though... I'm guessing from your date range that you are playing with ERA5 reanalysis. If you want to do this because you want to apply a running mean and don't want to get a shorter output, then it is more appropriate to pad the data at the start with the first x days repeated, same thing if you want to apply an FFT.
See the NCO documentation about selecting date ranges:
ncrcat -d time,2021-08-24,2021-08-30 in.nc august2021.nc
ncrcat -d time,1958-06-01,1958-06-08 in.nc june1958.nc
ncrcat august2021.nc in.nc june1958.nc out.nc
Can anyone think of some sort of preprocessing or something that could be put in place to reduce this horrible verbosity?
Typing $this-> constantly is driving me insane, why can't it just be achieved with a different symbol from $; $ for normal scoping £ for $this-> scoping.
Thank you.
Unfortunately this is not really possible. Unless you create your own version of PHP and change the interpreter (Which I strongly recommend against for numerous reasons).
Also changing $this-> to your own thing would hurt your code compatibility greatly. Especially if someone were to work on your code in the future.
If you really have a hard time dealing with this, I strongly recommend you install a IDE like PHPStorm or any other IDE with auto completion or setup your own macro to type it out for you.
Sed to the rescue! Here's my code for condensing some of the verbosity.
run.sh
#!/bin/bash
echo Running server
for f in ./src/*.php
do
sed -f ./preprocess.sed $f > ./live/`basename $f`
done
cd live
php ./server.php
preprocess.sed
s/£/$this->/g
Before / After
case TableState::INIT:
$this->gone->reset($this->tableSpot, $this->tableNote);
$this->state = TableState::WAITING;
break;
And after
case TableState::INIT:
£gone->reset(£tableSpot, £tableNote);
£state = TableState::WAITING;
break;
As everyone else has said, this makes your code not functional be default, so you need to do sufficient documentation around how preprocess. But I think sed -f ../preprocessor.sed ./* in the source directory will make it all normal code.
I can't figure out how to get apostrophes displaying correctly in my Perl documentation. For example, the text 'test' displays as âtestâ.
E<39> also renders as â
also I<'>
also S<'>
also E<apos>
C<'> renders as "'" (so apparently the terminal isn't the problem)
F<'> renders as underlined â
I've also tried running perldoc with -T, -n nroff and -n troff but none made a difference. Running with -t fixed the apostrophe problem but also kills all other text attributes.
I've been putting up with this for a while, but it's really starting to irritate me. How can I get them displayed correctly?
#hwnd's bug report led me to the LANG environment variable. By changing it from en_US.UTF-8 to en_US I can get the perldocs displaying correctly. Not sure if this will cause problems elsewhere but so far I haven't run into any.
Upgrade Pod::Perldoc and use the -o term backend.
can't say i know lots about this issue, but this has worked for me in the past when characters don't appear correctly:
binmode(STDOUT, "utf-8");
I have an infected website, and I am trying to clean it out using sed. Unfortunately I am unable to escape the question mark sign in the URL and I am really stuck here. I've searched over the web for a possible solution, but unfortunately I didn't found a proper way to do so.
Just an explanation:
The injected code is similar to this one:
< iframe src=http://test.com/index.html?i=23123>< /iframe>
Note that I am not a pro, and there is why I need your help!
so my way to clear the code is :
sed -i '/< iframe src=http:\/\/test.com\/index.html\?i=23123>/,/< \/iframe>/d' index.html
Unfortunately that didn't help as well as all others.
All help will be gratefully appreciated.
echo "< iframe src=http://test.com/index.html?i=23123>< /iframe>" \
| sed 's#< iframe src=http://test.com/index.html?i=23123>< /iframe>##'
Produces no output, which to me means this is successfully deleting your problem string.
Note that most seds will accept an alternate regex-replacement character, here I am using # because there are no #s in the search target. On some seds, you have to tell it 'hey I'm using an alternate, and escape the char, like s\#.....##.
I don't see why your attempt to quote the ? is failing. Did you try [?] and (worst case) [\?]. Are there 2nd level evaluations happening by the shell that you're not mentioning here? Does my simple example also fail?
As others will certainly tell you, your approach is strictly a bandaid, you need to figure out what the security hole is in your system and fix it. Your pages will get corrupted again. :-(
IHTH
I am looking for a mouse gtf to run with cufflinks that includes data on promoters, cds, and tss. So far, I have only been able to locate a gtf with data on genes and isoforms.
Thanks.
there is no a standard region for promoter. For tss you can just take the start position of the gene, and for promoter you can take, +-1000 nt around the tss, but it is up to you. There is some kind of standard to take 2000 nt around the tss.
Although if you want to run cufflink with that file, I don't see the point in tss. Maybe just in promoters. Or do a small region around de tss, but it would be inside the promoter region.
I think that you can easily do this with awk.
hope it give some help.
Maybe if you explain what do you want to do, other people know other options for your analysis.
yes, the Ensemble website has a gtf as such. you can also go to igenome: http://support.illumina.com/sequencing/sequencing_software/igenome.html
and select the version you want. let me know if this doesn't work. I can always send you my gtf file that i am using for mm10