format

How do I save an Excel file without getting a format warning when opening, using C# and Excel 2010

可紊 提交于 2020-01-02 06:17:33
问题 I'm using Excel 2010. I'm trying so save my excel file, with this code. It does save a .xls file, but when I open the file I get this message: The file you are trying to open, 'tre.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a thrusted source before opening the file. Do you want to open the file now? If I press yes the file opens. But what do I need to get rid of this format-popup? My code: using System; using System

How to extract just the audio from an MP4 file and convert it to FLAC file in C#?

左心房为你撑大大i 提交于 2020-01-02 04:15:14
问题 My goal is to write C# that turns Microsoft LYNC meeting audio into text. Here is my project so far. Initially I was trying to record from microphone, save it to WAV then convert WAV to FLAC and using GoogleSpeechAPI, convert FLAC to text. But I got stuck recording microphone audio to WAV format. The problem is it needs to be in a very specific WAV format, i.e. int16 or int24 for the WAV to work with the WAV to FLAC convertion method. I kept recording 8 bits per sample instead of (16 or 24

format output from Unix “script” command: remove backspaces, linefeeds and deleted chars?

时光毁灭记忆、已成空白 提交于 2020-01-02 02:20:13
问题 I'm trying to use the script command to record an interactive shell session so that I can use it to prepare documentation. according to the man page: Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. I am the naive user (don't usually get a shout out in man pages, this is rather exciting!), and I'd like to process the output so that backspaces, linefeeds and deleted characters and so on are removed. example, I run a script

How can I use a dynamic format string with the format! macro?

陌路散爱 提交于 2020-01-02 00:57:18
问题 I just started learning Rust, and I'm making some small tools to help me understand the language. I have a problem formatting a String using the format! macro. As format! takes a literal, I am not able pass my string to it. I want to do this to dynamically add strings into the current string for use in a view engine. I'm open for suggestions if there might be a better way to do it. let test = String::from("Test: {}"); let test2 = String::from("Not working!"); println!(test, test2); What I

how to customize “TimeStamp” format of Boost.Log

邮差的信 提交于 2020-01-02 00:54:09
问题 I want to get year-month-day hour:minute:second.fraction(2 digits), if I use "%Y-%m-%d %H:%M:%S.%f", I got almost what I want exception for the fraction( last part ) of seconds, it's showing 6 digits on my Windows XP, I don't know how to get 2 digits only, any idea? 回答1: Boost.DateTime (upon which Boost.Log relies) doesn't seem to support specialized fractional seconds formatting, so the only way to do that would be to write your own custom attribute formatter, or (the easier, but less nice

Alternative to CString::Format?

感情迁移 提交于 2020-01-01 14:24:35
问题 Is there any better alternative for doing string formatting in VC6, with syntax checking before substitution? 回答1: CString offers the Format method for printf -style formatting, but this isn't type-safe. For type-safe string formatting you could either use std::stringstream / std::wstringstream or the Boost Format library, although these both work with the C++ std::basic_string class template, and not the MFC CString class. I've used both of these successfully in VC6. Boost Format is nice

DatePicker date input with custom format

瘦欲@ 提交于 2020-01-01 09:56:22
问题 I want to stote dates in my state using redux-form. I use react-datepicker. To make the datepicker compatible with my redux-form i write: import React, { PropTypes } from 'react'; import DatePicker from 'react-datepicker'; import moment from 'moment'; import 'react-datepicker/dist/react-datepicker.css'; const MyDatePicker = ({ input, meta: { touched, error } }) => ( <div> <DatePicker {...input} dateFormat="YYYY-MM-DD" selected={input.value ? moment(input.value) : null} /> { touched && error &

String separation in required format, Pythonic way? (with or w/o Regex)

北城余情 提交于 2020-01-01 05:15:10
问题 I have a string in the format: t='@abc @def Hello this part is text' I want to get this: l=["abc", "def"] s='Hello this part is text' I did this: a=t[t.find(' ',t.rfind('@')):].strip() s=t[:t.find(' ',t.rfind('@'))].strip() b=a.split('@') l=[i.strip() for i in b][1:] It works for the most part, but it fails when the text part has the '@'. Eg, when: t='@abc @def My email is red@hjk.com' it fails. The @names are there in the beginning and there can be text after @names, which may possibly

How to extract this string variable in android?

孤者浪人 提交于 2019-12-31 05:36:13
问题 String test= ["1","Low-level programming language",true], ["2","High level programming language",false], ["3","Machine language",false],["4","All of the above",false], ["5","None of these",false] I want to separate this file like [1","Low-level programming language",true] and others into 5 types of string variables. 回答1: You could split on a simple regex: String [] splitStrings = test.split("\\],\\["); You don't want to split on just comma because you only want the commas between the square

Converting date formats in pandas dataframe

筅森魡賤 提交于 2019-12-31 05:05:06
问题 I have a dataframe and the Date column has two different types of date formats going on. eg. 1983-11-10 00:00:00 and 10/11/1983 I want them all to be the same type, how can I iterate through the Date column of my dataframe and convert the dates to one format? 回答1: I believe you need parameter dayfirst=True in to_datetime: df = pd.DataFrame({'Date': {0: '1983-11-10 00:00:00', 1: '10/11/1983'}}) print (df) Date 0 1983-11-10 00:00:00 1 10/11/1983 df['Date'] = pd.to_datetime(df.Date, dayfirst