converter

I have a column of dates in varchar and i need to convert to date

旧城冷巷雨未停 提交于 2019-12-13 18:41:40
问题 The dates are currently displayed as: ddmmmyyyy (12DEC2013) I've been playing around with this formula: DECLARE @Date char(8) set @Date='12312009' SELECT CONVERT(datetime,RIGHT(@Date,4)+LEFT(@Date,2)+SUBSTRING(@Date,3,2)) but I didn't have any success, can someone help me out with this. Additionally all my dates are in a column called TERMDT and I'd like to put all the new date values in a new column formatted as such. 回答1: Just give convert() an appropriate 3rd argument (the format): SELECT

Binary Converter to Decimal with .NET

╄→гoц情女王★ 提交于 2019-12-13 16:14:17
问题 I'm started to get the hang of some programming basics but I'm still very new and inexperienced. I am having trouble with a new program I am coding. I want to have a program in which an 8-bit binary number is put in a textbox, a button is pressed, and the decimal value of the binary number is shown. Below is the code i have tried: Public Class Form1 Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click Dim N As Integer N = Convert.ToDouble(tbxBin.Text) N = N

Using “await” in a converter (IValueConverter) not working?

血红的双手。 提交于 2019-12-13 15:51:28
问题 I have a converter in my Windows Phone application but it seems you cannot use "await" methods in it? public object Convert(object value, Type targetType, object parameter, string language) { _IDataService = ServiceLocator.Current.GetInstance<IDataService>(); string imageUrlId = (string)value; byte[] imageByte = await iDataService.GetImage(imageUrlId); return LoadImageAsync(imageByte); } If I make the method async Task it says IValueConverter has no method Task async. This converter returns

file.shortpath for vb.net

混江龙づ霸主 提交于 2019-12-13 14:41:20
问题 ho i'm converting a my project from vb6 to vb.net Is there an analog method in vb.net of shortpath? Dim DestinationFile As Scripting.File ... DestinationFile.ShortPath Thanks 回答1: No, modern languages are not built to use short paths, but you can use the GetShortPathName method from the kernel: Declare Auto Function GetShortPathName Lib "kernel32.dll" _ (ByVal lpszLongPath As String, ByVal lpszShortPath As StringBuilder, _ ByVal cchBuffer As Integer) As Integer Call using: Dim name As String

convert mp3 to wav using xuggle getting exception

自古美人都是妖i 提交于 2019-12-13 14:25:48
问题 I am trying to convert mp3 to wav and the code is here: String mp3 = "F:\\work\\pic2talk38512.mp3"; String wav = "F:\\work\\pic2talk38512.wav"; TranscodeAudioAndVideo.transcodeTest(mp3, wav); public static void transcode(String sourceUrl, String destinationUrl) { IMediaReader reader = ToolFactory.makeReader(sourceUrl); reader.addListener(ToolFactory.makeWriter(destinationUrl, reader)); while (reader.readPacket() == null) do { } while (false); } I got this exception: java.lang

numpy genfromtxt converters unknown number of columns

陌路散爱 提交于 2019-12-13 14:22:50
问题 I have several data numeric files in which the decimal separator is a comma. So I use a lambda function to do a conversion: import numpy as np def decimal_converter(num_cols): conv = dict((col, lambda valstr: \ float(valstr.decode('utf-8').replace(',', '.'))) for col in range(nb_cols)) return conv data = np.genfromtxt("file.csv", converters = decimal_converter(3)) the data in the file is like this: 0; 0,28321815; 0,5819178 1; 0,56868281; 0,85621369 2; 0,24022026; 0,53490058 3; 0,63641921; 0

How to convert string to a DateTime in C#?

夙愿已清 提交于 2019-12-13 13:27:59
问题 is it possible to convert a string (date stored as varchar in database) to datetime in c#? eg. i'm having a table which stores dates as varchar and it stores values as example 01/21/14 11:42:36 PM i want to get the result in the format yyyy-mm-dd i tried, CultureInfo enUS = new CultureInfo("en-US"); DateTime d; DateTime.TryParseExact("01/21/14 11:42:36 PM", "yyyy-mm-dd", enUS, DateTimeStyles.None, out d); also tried below steps: CultureInfo enUS = new CultureInfo("en-US"); DateTime d =

Converting a number in English to its digital value (ignore decimals)

泪湿孤枕 提交于 2019-12-13 13:22:36
问题 I want to convert these types of values, '3 million', '24 thousand', '350 thousand', etc. to a number. In either JavaScript(so i can do it client side) or PHP(server side). is there a function for this? like PHPs strtotime() function? input output 3 million 3000000 24 thousand 24000 350 thousand 350000 回答1: do you want to combine them as well? function convert(num) { function mapGroups(str) { if (/million/.test(str)) { return str.match(/\d+/)[0] * 1000000; } if (/thousand/.test(str)) { return

Converting MIDI file to raw audio using a software synth

岁酱吖の 提交于 2019-12-13 11:41:41
问题 I'm trying to dynamically generate a small MP4 audio+video file directly from my Android app. My original plan of attack: The user enters some basic song data (a chord progression, etc) and the app builds a MIDI file. The system builds chord diagrams for each chord, and using a MIDI reader it generates the animations frames array that is timed to the MIDI Convert the MIDI into a raw PCM audio data <-- this S.O. question is specific to this point Apply the raw audio to the animation frames -

How to count the number of characters in a line in a csv file

 ̄綄美尐妖づ 提交于 2019-12-13 11:28:03
问题 I have a Justice_League.csv file that has four lines with commas between them. I want to count the number of characters there are in each line and convert that number to hex. Below is the contents of Justice_League.csv: Bruce Wayne,Batman,None,Gotham City,Robin,The Joker 43 2B Oliver Queen,Green Arrow,None,Star City,Speedy,Deathstroke 50 32 Clark Kent,Superman,Flight,Metropolis,None,Lex Luthor 46 2E Bart Allen,The Flash,Speed,Central City,Kid Flash,Professor Zoom 52 34 As you can see I have