concat

MySQL: Fill a table within a Stored Procedure efficiently

大城市里の小女人 提交于 2019-11-26 23:18:40
问题 I am testing performance in a MySQL Server and filling a table with more than 200 million of records. The Stored Procedure is very slow generating the big SQL string. Any help or comment is really welcome. System Info: Database: MySQL 5.6.10 InnoDB database (test). Processor: AMD Phenom II 1090T X6 core, 3910Mhz each core. RAM: 16GB DDR3 1600Mhz CL8. HD: Windows 7 64bits SP1 in SSD, mySQL installed in SSD, logs written in mechanical hard disk. The Stored Procedure creates a INSERT sql query

JavaScript NodeList

萝らか妹 提交于 2019-11-26 22:31:57
is there a way to join 2 NodeLists returned by 2 calls of document.getElementsByTagName? Say, I have the following code var inputs = documentElement.getElementsByTagName('input'); var selects = document.getElementsByTagName('select'); I want to loop through the results. Is it possible in one loop? Thank you in advance! Simon Seems like you can use the same Array.prototype.slice.call that makes the args array-like object become an array. ( See here ) var inputs = document.getElementsByTagName('input'); var selects = document.getElementsByTagName('select'); inputs = Array.prototype.slice.call

Interlacing two vectors [duplicate]

坚强是说给别人听的谎言 提交于 2019-11-26 22:05:48
问题 This question already has answers here : Alternate, interweave or interlace two vectors (2 answers) Closed last year . Suppose I have two vectors defined as follows: a <- c("a1", "a2", "a3") b <- c("b1", "b2", "b3") Now I want to end up with a string vector like this one: c("a1","b1", "a2", "b2", "a3", "b3") Is this possible? 回答1: You can rbind them, then coerce back to a vector. a <- c("a1", "a2", "a3") b <- c("b1", "b2", "b3") c(rbind(a,b)) # [1] "a1" "b1" "a2" "b2" "a3" "b3" As @Moody

Inner Join Two Table, aggregating varchar fields

帅比萌擦擦* 提交于 2019-11-26 22:02:17
问题 Sorry I change my question a bit . I have two table and I want to merge them TERMS_TABLE ID | TERMS 309 | 'hardware' 309 | 'software' TFIDF_TABLE ID | TERMS 309 |'computer,phone,mp3....' Now I want to add TERMS column of TERMS_TABLE to terms column of TFIDF_TABLE like that result should be: NEW_TFIDF_TABLE ID | TERMS 309 |'computer,phone,mp3....,hardware,software' I try this code: Insert into NEW_TFIDF_TABLE SELECT T.ID, T.TERMS ||', '|| TT.TERMS FROM TFIDF_TABLE T INNER JOIN TERMS_TABLE TT

How do I concatenate strings in Swift?

 ̄綄美尐妖づ 提交于 2019-11-26 21:32:06
How to concatenate string in Swift? In Objective-C we do like NSString *string = @"Swift"; NSString *resultStr = [string stringByAppendingString:@" is a new Programming Language"]; or NSString *resultStr=[NSString stringWithFormat:@"%@ is a new Programming Language",string]; But I want to do this in Swift-language. Fogmeister You can concatenate strings a number of ways: let a = "Hello" let b = "World" let first = a + ", " + b let second = "\(a), \(b)" You could also do: var c = "Hello" c += ", World" I'm sure there are more ways too. Bit of description let creates a constant. (sort of like an

Adding two Java 8 streams, or an extra element to a stream

…衆ロ難τιáo~ 提交于 2019-11-26 18:49:49
问题 I can add streams or extra elements, like this: Stream stream = Stream.concat(stream1, Stream.concat(stream2, Stream.of(element)); And I can add new stuff as I go, like this: Stream stream = Stream.concat( Stream.concat( stream1.filter(x -> x!=0), stream2) .filter(x -> x!=1), Stream.of(element)) .filter(x -> x!=2); But this is ugly, because concat is static. If concat were an instance method, the above examples would be much easier to read: Stream stream = stream1.concat(stream2).concat

Pandas concat yields ValueError: Plan shapes are not aligned

☆樱花仙子☆ 提交于 2019-11-26 18:17:00
问题 I am quite new to pandas, I am attempting to concatenate a set of dataframes and I am getting this error: ValueError: Plan shapes are not aligned My understanding of .concat() is that it will join where columns are the same, but for those that it can't find it will fill with NA. This doesn't seem to be the case here. Heres the concat statement: dfs = [npo_jun_df, npo_jul_df,npo_may_df,npo_apr_df,npo_feb_df] alpha = pd.concat(dfs) 回答1: In case it helps, I have also hit this error when I tried

Prepend text to beginning of string

不想你离开。 提交于 2019-11-26 17:39:35
问题 What is the fastest method, to add a new value at the beginning of a string? 回答1: var mystr = "Doe"; mystr = "John " + mystr; Wouldn't this work for you? 回答2: You could do it this way .. var mystr = 'is my name.'; mystr = mystr.replace (/^/,'John '); console.log(mystr); disclaimer: http://xkcd.com/208/ 回答3: ES6: let after = 'something after'; let text = `before text ${after}`; 回答4: Since the question is about what is the fastest method, I thought I'd throw up add some perf metrics. TL;DR The

Merge two dataframes by index

天涯浪子 提交于 2019-11-26 15:43:34
Hi I have the following dataframes: > df1 id begin conditional confidence discoveryTechnique 0 278 56 false 0.0 1 1 421 18 false 0.0 1 > df2 concept 0 A 1 B How do I merge on the indices to get: id begin conditional confidence discoveryTechnique concept 0 278 56 false 0.0 1 A 1 421 18 false 0.0 1 B I ask because it is my understanding that merge() i.e. df1.merge(df2) uses columns to do the matching. In fact, doing this I get: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 4618, in merge copy=copy,

Using pandas .append within for loop

隐身守侯 提交于 2019-11-26 15:25:29
I am appending rows to a pandas DataFrame within a for loop, but at the end the dataframe is always empty. I don't want to add the rows to an array and then call the DataFrame constructer, because my actual for loop handles lots of data. I also tried pd.concat without success. Could anyone highlight what I am missing to make the append statement work? Here's a dummy example: import pandas as pd import numpy as np data = pd.DataFrame([]) for i in np.arange(0, 4): if i % 2 == 0: data.append(pd.DataFrame({'A': i, 'B': i + 1}, index=[0]), ignore_index=True) else: data.append(pd.DataFrame({'A': i},