convert

How can I convert array to string in hive sql?

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to convert an array to string in hive. I want to collect_set array values to convert to string without [[""]] . select actor, collect_set(date) as grpdate from actor_table group by actor; so that [["2016-07-01", "2016-07-02"]] would become 2016-07-01, 2016-07-02 回答1: Use concat_ws(string delimiter, array<string>) function to concatenate array: select actor, concat_ws(',',collect_set(date)) as grpdate from actor_table group by actor; If the date field is not string, then convert it to string: concat_ws(',',collect_set(cast(date as

React-Native: Convert image url to base64 string

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm building a react native app that needs to store images at base64 string format for offline viewing capabilities. What library / function would give me the best result to store the image as base64 string? assuming my url is " http://www.example.com/image.png ". Also, do I need to make http request to get it before storing it as a string? my logic says yes, but in react native you can load images on the <Image> component without request them first from the server. What would be the best option to do this in react native? 回答1: I use react

Convert byte[] or object to GUID

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I assigned some value to object data type like, object objData =dc.GetDirectoryEntry().Properties["objectGUID"].Value; this object retun the value like {byte[16]} [0]: 145 [1]: 104 [2]: 117 [3]: 139 [4]: 124 [5]: 15 [6]: 255 [7]: 68 [8]: 142 [9]: 159 [10]: 208 [11]: 102 [12]: 148 [13]: 157 [14]: 179 [15]: 75 Then i casting this object to byte[], like byte[] binaryData = objData as byte[]; It will also return like, {byte[16]} [0]: 145 [1]: 104 [2]: 117 [3]: 139 [4]: 124 [5]: 15 [6]: 255 [7]: 68 [8]: 142 [9]: 159 [10]: 208 [11]: 102 [12]: 148

Convert HTML to plain text in JS without browser environment

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a CouchDB view map function that generates an abstract of a stored HTML document (first x characters of text). Unfortunately I have no browser environment to convert HTML to plain text. Currently I use this multi-stage regexp html.replace(/<style([\s\S]*?)<\/style>/gi, ' ') .replace(/<script([\s\S]*?)<\/script>/gi, ' ') .replace(/(<(?:.|\n)*?>)/gm, ' ') .replace(/\s+/gm, ' '); while it's a very good filter, it's obviously not a perfect one and some leftovers slip through sometimes. Is there a better way to convert to plain text

How to convert IEnumerable of KeyValuePair&lt;x, y&gt; to Dictionary?

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there streamlined to convert list/enumberable of KeyValuePair<T, U> to Dictionary<T, U> ? Linq transformation, .ToDictionary() extension did not work. 回答1: .ToDictionary(kvp=>kvp.Key,kvp=>kvp.Value); Isn't that much more work. 回答2: You can create your own extension method that would perform as you expect. public static class KeyValuePairEnumerableExtensions { public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source) { return source.ToDictionary(item => item.Key, item => item

Convert varchar to uniqueidentifier in SQL Server

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: A table I have no control of the schema for, contains a column defined as varchar(50) which stores uniqueidentifiers in the format 'a89b1acd95016ae6b9c8aabb07da2010' (no hyphens) I want to convert these to uniqueidentifiers in SQL for passing to a .Net Guid. However, the following query lines don't work for me: select cast('a89b1acd95016ae6b9c8aabb07da2010' as uniqueidentifier) select convert(uniqueidentifier, 'a89b1acd95016ae6b9c8aabb07da2010') and result in: Msg 8169, Level 16, State 2, Line 1 Conversion failed when converting from a

Query to convert from datetime to date mysql

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to get the date portion of a datetime field. I know I can get it with date_format, but that returns a string or "varchar" field. How can I convert the result to date and not as varchar? This is my query returning the varchar: (Select Date_Format(orders.date_purchased,'%m/%d/%Y')) As Date I tried several combinations from this question, but could not make it to work: mysql query - format date on output? Any help is appreciated. 回答1: Try to cast it as a DATE SELECT CAST(orders.date_purchased AS DATE) AS DATE_PURCHASED 回答2: Use the

Convert physical address to virtual in Linux and read its content

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have Linux and I have a physical address: (i.e. 0x60000000). I want to read this address from user-space Linux program. This address might be in kernel space. 回答1: You need a kernel driver to export the phyisical address to user-level. Have a look at this driver: https://github.com/claudioscordino/mmap_alloc/blob/master/mmap_alloc.c 回答2: Note that this is now possible via /proc/[pid]/pagemap 回答3: Is there an easy way I can do that? For accessing from user space, mmap() is a nice solution. Is it possible to convert it by using some function

Convert datetime into time ago [closed]

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to convert DateTime into the year, month, days, hours, minutes, seconds ago like as yahoo question asked 5week ago, or 1 year ago or 1 month ago, my date is saved in the database like this: 2011-11-30 05:25:50 . Now I want to show like year, month, days, hours, minutes and seconds in PHP like: how much year, how many months , days, hours, minutes, seconds ago, but need only one time unit show like it will be year or days or hours or minutes or seconds. I have searched about this but not understand how I can do this, I know there are

Batch file to convert all pdf to text (with xpdf)

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to run a batch conversion in a folder with full of pdf files. I have using xPDF and this is the command prompt for a single file: c:\Test\pdftotext -layout firstpdftoconvert.pdf firstpdfconverted.txt Could somebody help please to do it in one go (convert all the pdf files only) using a batch file? Thanks in advance! 回答1: Combining your question with this answer iterating over files of a directory : for /r %i in (*.pdf) do "c:\Test\pdftotext" -layout "%i" This will work on all pdf files in the current directory. Be sure to double