convert

How can I convert split function to inline table valued udf in SQL server?

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Assuming I have this query ( pseudo) : Select T.a, T.b, (select top 1 element from fn_split(c,',') where element=T.element) From largeTable T Where fn_split runs for each row , I would like to use inline table valued udf so , that performance will be better. NB : fn_split just create a table via splitting via , : But looking at inline table valued udf structure : create FUNCTION [dbo].[fn_...] ( ... ) RETURNS table AS RETURN SELECT ...(!!!) It should return the select right away as the first statement ! But what if my UDF looks like : CREATE

How to convert 12-Jan-2016 like date string in javascript to 2016-01-12 00:00:00

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to convert 12-Jan-2016 like date string in javascript to 2016-01-12 00:00:00, I am looking at moment js but there seems no options like and also I tried js date function but is is returning invalid date. Any idea what i am missing here ? 回答1: If you are just trying to reformat the string, then don't bother with dates: function reformatDateString(ds) { var months = {jan:'01',feb:'02',mar:'03',apr:'04',may:'05',jun:'06', jul:'07',aug:'08',sep:'09',oct:'10',nov:'11',dec:'12'}; var b = ds.split('-'); return b[2] + '-' + months[b[1]

Convert timestamps with offset to datetime obj using strptime

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to convert time-stamps of the format "2012-07-24T23:14:29-07:00" to datetime objects in python using strptime method. The problem is with the time offset at the end(-07:00). Without the offset i can successfully do time_str = "2012-07-24T23:14:29" time_obj=datetime.datetime.strptime(time_str,'%Y-%m-%dT%H:%M:%S') But with the offset i tried time_str = "2012-07-24T23:14:29-07:00" time_obj=datetime.datetime.strptime(time_str,'%Y-%m-%dT%H:%M:%S-%z'). But it gives a Value error saying "z" is a bad directive. Any ideas for a work

Convert JSON String to Pretty Print JSON output using Jackson

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is the JSON string I have- {"attributes":[{"nm":"ACCOUNT","lv":[{"v":{"Id":null,"State":null},"vt":"java.util.Map","cn":1}],"vt":"java.util.Map","status":"SUCCESS","lmd":13585},{"nm":"PROFILE","lv":[{"v":{"Party":null,"Ads":null},"vt":"java.util.Map","cn":2}],"vt":"java.util.Map","status":"SUCCESS","lmd":41962}]} I need to convert the above JSON string into Pretty Print JSON Output(using Jackson) like below- { "attributes": [ { "nm": "ACCOUNT", "lv": [ { "v": { "Id": null, "State": null }, "vt": "java.util.Map", "cn": 1 } ], "vt": "java

Convert csv to Newick tree

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I have a csv file where each line represents hierarchical data in the form: 'Phylum','Class','Order','Family','Genus','Species','Subspecies','unique_gi' I would like to convert this to the classic Newick tree format sans distances. Either a novel method or a python package would be amazing. Thank you! 回答1: You could use some simple Python to build out a tree from the CSV, and then write it out to a Newick tree. Not sure if this is what you're trying to do or not. import csv from collections import defaultdict from pprint import pprint def

Three.js: Convert face normal from local space to world space

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a THREE.PlaneGeometry , with ComputeFaceNormals() . I create two meshes using this geometry, with different rotations applied to them. I want to compute the two angles between the camera and the two meshes central face normal. It should be : vLocalCamera = vCamera.position - mesh1.position; mesh1.normal() . vLocalCamera = cos(angle); The problem is that I don't know how to get the mesh normal in world coordinate (from geometry and mesh rotation) with three.js API 回答1: If you want to convert a face normal, normal , from local space to

Convert RegEx from JavaScript to Java

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: OK, so I am trying to split a String by ", " which are not inside '[' or ']'. I have a working RegEx for JavaScript but have been unable to convert it to Java syntax. JS RegEX: /,(?![^[]*])/g Example sentence: ex1 , [ex2 , ex3 ] , ex 4 , ex 4, [ex , ex ] It works fine on http://refiddle.com but when I try and use the RegEx in Java (under Eclipse) I get an error saying: Unclosed character class near index 10 ,(?![^[]*]) All I did was remove the '/' at the beginning and the "/g" at the end and I have been unable to translate the Syntax. What

vc++ - How to convert a CString into LPCWSTR

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I tried to do this , but I didn't find any method for this. I am asking this due to the fact that I am new to windows. I tried stl-strings, but visual studio 2008- accumulates bugs in stl-wstring-handling. I will say a lot about that thing later, in other question. Now Can anybody shed light on this issue? 回答1: Use the conversion class CT2CW like this FuncTakingLPCWSTR(CT2CW(cstring_var)) . This is guaranteed to work in either Unicode or MBCS builds. Also, keep in mind that the string passed to the function may be a temporary, so don't store

Convert datetime string with this format: (yyyy-MM-dd'T'hh:mm:ss-zzz)

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am receiving a JSON string that contains a date that looks like this: 2015-07-09T08:38:49-07:00 where the last part is the timezone. Is there a standard way to convert this to a DateTimeOffset ? Here is what I have so far: var olu = JsonConvert.DeserializeObject<OneLoginUser>(jToken.ToString(), new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd'T'HH:mm:sszzz" }); This doesn't deserialize any of the dates. I've tried using -Z and hh:mm for the timezone data, but I can't seem to deserialize any of the dates. For reference, this is from

Cannot implicitly convert type System.Collections.Generic.IEnumerable&lt;&gt; to bool

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm developing an ASP.NET MVC 4 Application and I'm trying to run this Lambda expression in Entity Framework 5. var customer = db.GNL_Customer.Where(d => d.GNL_City.FKProvinceID == advancedProvinceID || advancedProvinceID == null) .Where(d => d.FKCityID == advancedCityID || advancedCityID == null) .Where(d => d.FKDepartmentStoreID == advancedDepartmentStoreID || advancedDepartmentStoreID == null) .Where(d => d.GNL_CustomerLaptopProduct.Where(r => String.Compare(r.BrandName, brandID) == 0 || brandID == null)); I get this error : Cannot