format

Using batch code to mass xml formatting?

我只是一个虾纸丫 提交于 2019-12-31 03:24:07
问题 I have a folder that contains 50 subfolders each one of these contains 2 xml files O_DATA.xml S_DATA.xml Since they appear in one line in Notepad, I have to fix the formatting. I have found from a similar question here this code: @echo off setlocal EnableDelayedExpansion rem Create a variable with spaces set "spaces= " for /L %%i in (1,1,5) do set "spaces=!spaces!!spaces!" rem Read the line for /F "delims=" %%a in (input.txt) do set "line=%%a" set level=0 :nextTag rem Separate first tag from

custom long date format in moment js

我的未来我决定 提交于 2019-12-31 02:57:06
问题 Is there a way to add a custom format code to moment for long dates based on locale? for example: moment().format("L") is an existing format that will print the long date for the locale (including the year), but if I wanted to add my own that excluded the year like this: moment().format("LTY") that just printed the month and day in a given locale. How can I do this? 回答1: Read the section on long date formats. You'd replace the default long date format object using: moment.updateLocale('en', {

Format DateTime in C#

可紊 提交于 2019-12-31 01:56:07
问题 how can I format date to display in the following format 03-Feb-2011 I tried this statement but it did not work properly string.Format(visitDate.Value.ToShortDateString(), "dd-MMM-yyyy") 回答1: visitDate.Value.ToString("dd-MMM-yyyy"); Assuming visitDate is a DateTime. 回答2: you have to use: visitDate.Value.ToString("dd-MMM-yyyy"); 回答3: string.format is valid but the parameter order you use are invalid: DateTime? visitDate = null; System.Diagnostics.Debug.WriteLine(visitDate == null ? "" : String

DateTime::createFromFormat in PHP < 5.3.0

♀尐吖头ヾ 提交于 2019-12-31 01:48:16
问题 I'm looking for a function identical to DateTime::createFromFormat but I need it to work in an environment running a version of PHP which is older than v5.3. Basically I need to provide a format, like you'd use with the Date() function, and I then need to parse/validate a string against that format, and return a timestamp if the string is formatted correctly and a valid date. Anyone know where I can find something like that, or do I have to write it myself? Again, this has to work with a

Print Java arrays in columns

主宰稳场 提交于 2019-12-30 15:00:30
问题 I'm trying to format two arrays in Java to print something like this: Inventory Number Books Prices ------------------------------------------------------------------ 1 Intro to Java $45.99 2 Intro to C++ $89.34 3 Design Patterns $100.00 4 Perl $25.00 I am using the following code: for(int i = 0; i < 4; i++) { System.out.print(i+1); System.out.print(" " + books[i] + " "); System.out.print(" " + "$" + booksPrices[i] + " "); System.out.print("\n"); } But I am getting this poorly formatted

How to convert 'QVideoFrame' with YUV data to 'QVideoframe' with RGBA32 data in Qt?

眉间皱痕 提交于 2019-12-30 11:10:38
问题 I receive QVideoFrames from webcam, and they contain image data in YUV format ( QVideoFrame::Format_YUV420P ). How can I convert one such frame to one with QVideoFrame::Format_ARGB32 or QVideoFrame::Format_RGBA32 ? Can I do it without going low level, using just existing functionality in Qt5 ? Example: QVideoFrame convertFormat(const QVideoFrame &inputframe, QVideoFrame::PixelFormat outputFormat) { // What comes here? } //Usage QVideoFrame converted = convertFormat(mySourceFrame, QVideoFrame:

How can I control the formatting when saving a matrix to a file?

╄→尐↘猪︶ㄣ 提交于 2019-12-30 10:47:11
问题 I save a matrix to a file like this: save(filepath, 'mtrx', '-ascii'); Is there a way to tell MATLAB to write 0 instead of 0.0000000e+000 values? It would be nice because it would be faster and easier to see which values differ from zero. 回答1: I suggest using DLMWRITE instead of SAVE since you're dealing with ASCII files. It will give you more control over the formatting. For example, you could create an output file delimited by spaces with a field width of 10 and 6 digits after the decimal

Converting to Local Time in R - Vector of Timezones

霸气de小男生 提交于 2019-12-30 10:06:55
问题 I have a set of data from across the US that I am trying to convert into local time for each "subject". I have UTC timestamps on each event and have converted those into POSIXct format, but every time I try to include a vector of tz = DS$Factor or tz = as.character(DS$Factor) in any of the POSIXct/POSIXlt functions (including format() and strftime() ) I get an error that says: Error in as.POSIXlt.POSIXct(x, tz = tz) : invalid 'tz' value If I just enter tz = 'US/Eastern' it works fine, but of

finding yesterday's date using R

為{幸葍}努か 提交于 2019-12-30 08:59:06
问题 In one of my R scripts I need to find the date of yesterday, I can do that easily on my mac with this command. yesterday <- format(Sys.Date()-1,"%m/%d/%Y") yesterday [1] "03/17/2017" So essentially the Sys.Date()-1 gives me yesterday's date. However, when I run this command on my ubuntu 16.04 machine(AWS instance) it doesn't work. It returns today's date instead? Has anyone else experienced this? How could I get yesterday's date without using the Sys.Date()-1 command? UPDATE : Amazon AWS says

what is the printf in C# [duplicate]

牧云@^-^@ 提交于 2019-12-30 08:01:49
问题 This question already has answers here : sprintf in C#? (3 answers) Closed 4 years ago . I want to know what to use in C# to format my output in my console window I tried to use \t but it did not work I know there is printf in C to format my output check this image https://s15.postimg.cc/94fstpi2z/Console.png 回答1: There is no direct "printf" duplication in C#. You can use PInvoke to call it from a C library. However there is Console.WriteLine("args1: {0} args2: {1}", value1, value2); Or