data-conversion

Converting arraybuffer to string : Maximum call stack size exceeded

你离开我真会死。 提交于 2019-12-30 17:39:23
问题 This is my line of code. var xhr = new XMLHttpRequest(); xhr.open('GET',window.location.href, true); xhr.responseType = "arraybuffer"; xhr.onload = function(event) { debugger; console.log(" coverting array buffer to string "); alert(String.fromCharCode.apply(null, new Uint8Array(this.response))); }; xhr.send(); That request is making to a pdf url which is around 3 MB in size. Read few thread with same error, telling that there must be some recursive call but I do not see any recursive call

Excel to various JSON objects

让人想犯罪 __ 提交于 2019-12-30 12:04:19
问题 I have this Excel table: country year 1 2 3 4 Netherlands 1970 3603 4330 5080 5820 Netherlands 1971 3436 4165 4929 5693 Netherlands 1972 3384 4122 4899 5683 Sweden 1970 1479 1963 2520 3132 Sweden 1971 1497 1985 2547 3163 Sweden 1972 1419 1894 2445 3055 I would like to experiment with two JSON formats. Either: data = [ Netherlands : { 1970 : [3603, 4330, 5080, 5820], 1971 : [...], }, Sweden : { 1970 : [...] }, ] Or using the headers 1,2,3,4 as x-values: data = [ Netherlands : { 1970 : [{x: 1,

Excel to various JSON objects

余生颓废 提交于 2019-12-30 12:04:05
问题 I have this Excel table: country year 1 2 3 4 Netherlands 1970 3603 4330 5080 5820 Netherlands 1971 3436 4165 4929 5693 Netherlands 1972 3384 4122 4899 5683 Sweden 1970 1479 1963 2520 3132 Sweden 1971 1497 1985 2547 3163 Sweden 1972 1419 1894 2445 3055 I would like to experiment with two JSON formats. Either: data = [ Netherlands : { 1970 : [3603, 4330, 5080, 5820], 1971 : [...], }, Sweden : { 1970 : [...] }, ] Or using the headers 1,2,3,4 as x-values: data = [ Netherlands : { 1970 : [{x: 1,

Get date representation in seconds?

南楼画角 提交于 2019-12-29 05:51:06
问题 I am using an API which requires a date parameter as a number of seconds, an int . My problem is that I currently store this time in java.util.date and I was wondering if there is some way to convert the java.util.date variable to seconds so that I can fit it into the int parameter which the API requires? 回答1: import java.util.Date; ... long secs = (new Date().getTime())/1000; ... Please see - http://docs.oracle.com/javase/6/docs/api/java/util/Date.html#getTime() 回答2: java.util.Date.getTime()

Data Conversion Issue in SSIS package - Text to GUID

孤街浪徒 提交于 2019-12-29 01:47:09
问题 I am developing a SSIS package that will open an Excel spreadsheet and import the data into a database table in SQL Server 2008. When I try to convert the Excel column data type: Unicode String [DT_WSTR] to a unique identifier data type: unique identifier [DT_GUID] , I get the following error: "Invalid character value for cast specification" What do I need to do to resolve the conversion error? 回答1: I used a Derived Column Transformation Editor and to wrap the excel column value in squrly

How to convert result table to JSON array in MySQL

泪湿孤枕 提交于 2019-12-28 03:33:07
问题 I'd like to convert result table to JSON array in MySQL using preferably only plain MySQL commands. For example with query SELECT name, phone FROM person; | name | phone | | Jack | 12345 | | John | 23455 | the expected JSON output would be [ { "name": "Jack", "phone": 12345 }, { "name": "John", "phone": 23455 } ] Is there way to do that in plain MySQL? EDIT: There are some answers how to do this with e.g. MySQL and PHP, but I couldn't find pure MySQL solution. 回答1: New solution: Built using

Converting Character\Factor to Numeric without NA Coercion in R

烂漫一生 提交于 2019-12-24 15:53:44
问题 I am new to R and hope you can help as there seems to be great difficulties with the data mode in R. I have a csv with reviews and among my columns there is one expressing the data\time of the review. Unfortunately the format is in the form os "x years/months/days ago" and thus I had to convert the column into a date by 1-converting the time into a total amount of days and 2-subtracting the total amount of days from the date I crawled the data. That's about it. It should be a problem at all

ByteString representation of a Double conversion

偶尔善良 提交于 2019-12-24 09:12:35
问题 I'm writing my own WAVE parser that uses Conduit so I can stream values, one by one, through a pipeline. I get a sample from a .wav file via hGet (n is the number of bytes per sample for that wav file): bytes <- hGet h n This gives me a ByteString with a representation of the Double value of the sample. E.g.: "\131\237\242" represents -0.10212671756744385 "g\238\242" represents -0.10209953784942627 "\215\238\242" represents -0.10208618640899658 . The possible values are between -1 and +1. Is

how to convert persian number to int

女生的网名这么多〃 提交于 2019-12-24 08:31:08
问题 There is a nvarchar(100) column named value , when users insert into this column I need to check this code below in a trigger: if exists ( select * from inserted i where isnumeric(value)=0 ) begin rollback transaction raiserror('when productType is numeric, You have to insert numeric character',18,1) return end but in application interface numbers inserted in persian, so always isnumeric(value)=0 . For example I need to if user insert ۴۵ in interface in my trigger value shown as 45 . So far I

Read Values from .csv file and convert them to float arrays

若如初见. 提交于 2019-12-24 05:18:11
问题 I stumbled upon a little coding problem. I have to basically read data from a .csv file which looks a lot like this: 2011-06-19 17:29:00.000,72,44,56,0.4772,0.3286,0.8497,31.3587,0.3235,0.9147,28.5751,0.3872,0.2803,0,0.2601,0.2073,0.1172,0,0.0,0,5.8922,1,0,0,0,1.2759 Now, I need to basically an entire file consisting of rows like this and parse them into numpy arrays. Till now, I have been able to get them into a big string type object using code similar to this: order_hist = np.loadtxt