Search Results

Search found 13889 results on 556 pages for 'results'.

Page 119/556 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • Caching result of SELECT statement for reuse in multiple queries

    - by Andrew
    I have a reasonably complex query to extract the Id field of the results I am interested in based on parameters entered by the user. After extracting the relevant Ids I am using the resulting set of Ids several times, in separate queries, to extract the actual output record sets I want (by joining to other tables, using aggregate functions, etc). I would like to avoid running the initial query separately for every set of results I want to return. I imagine my situation is a common pattern so I am interested in what the best approach is. The database is in MS SQL Server and I am using .NET 3.5.

    Read the article

  • PHP and MySQL - Printing rows matching a column value

    - by Michael
    Hello, I need to write a PHP script that will print out results from a MySQL database. For example, say I have 9 fields. Field 1 is an auto increasing number, field two is a three digit number. I need to be able to have a script read, find the matching number (it'll be from a POST), and then display all matching three digit results, and the 7 other fields as well. I am already logged in to the database in this script. I guess I'm really at a loss of where to begin. How would one start something like this? Thank you.

    Read the article

  • Converting output of sql query

    - by phenevo
    Hi, Let say I have table Payments Id int autoincement Status int and my query is : select id, status from payments but I wanna convert status to enum. 0 is unpaid 1 is paid. so result should look like: 1 paid 2 unpaid 3 paid ... I need this conversion because I use XmlReader reader = cmd.ExecuteXmlReader(); oc.LoadXml("<results></results>"); XmlNode newNode = doc.ReadNode(reader); while (newNode != null) { doc.DocumentElement.AppendChild(newNode); newNode = doc.ReadNode(reader); } and then I save this xml and opening it by excel, and statuses should be friendly for user.

    Read the article

  • Array "tree" creation from db table

    - by Tural Teyyuboglu
    Trying to create array tree for db driven navigation. Getting following errur: array_key_exists() expects exactly 2 parameters, 1 given on line if (!array_key_exists($tree[$parent]['children'][$id])) Function looks like that $tree = array(); $sql = "SELECT id, parent, name FROM menu WHERE parent ... etc.... "; $results = mysql_query($sql) or die(mysql_error()); while(list($id, $parent, $name) = mysql_fetch_assoc($results)) { $tree[$id] = array('name' => $name, 'children' => array(), 'parent' => $parent); if (!array_key_exists($tree[$parent]['children'][$id])) { $tree[$parent]['children'][$id] = $id; } } Db structure How can I fix that? Whats wrong in this function?

    Read the article

  • Android: implementing sliding cards in widget

    - by DroidIn.net
    I have a widget that periodically updates itself (hourly) to display top result of search query. I would like to extend it so it captures several top results and then loops through these. The best example would be Genie News and Weather widget for which I was unable to find a source code. QUESTIONS: What would be a good way to implement the animation? I'm thinking ViewAnimator + timer, but is there maybe a better way, say FrameLayout + alerts? I'm already using AlertManager to periodically pull search results for the widget How bad such arraignment would affect phone's battery life?

    Read the article

  • go up to 3 level dephth in hibernate criterion

    - by Satyajitsinh Raijada
    i am using hibernate criterion for fetching results. Here with i provided demo design of my persistence class. Class A{ private B b; } Class B{ private C c; } Class C{ private Long val; } assume these are the hibernate persistence classes i am not writing all annotations of mapping with database. now my problem is i want to retrieve results of Class A according to the value of Class C's val property. i tried to fetch it using, Criteria c = Restrictions.eq("b.c.val", value); List l = c.list; it shows could not resolve property. i searched and came to know criteria wont work up to this much depth. i don't want shift to HQL. any idea??

    Read the article

  • Filtering with joined tables

    - by viraptor
    I'm trying to get some query performance improved, but the generated query does not look the way I expect it to. The results are retrieved using: query = session.query(SomeModel). options(joinedload_all('foo.bar')). options(joinedload_all('foo.baz')). options(joinedload('quux.other')) What I want to do is filter on the table joined via 'first', but this way doesn't work: query = query.filter(FooModel.address == '1.2.3.4') It results in a clause like this attached to the query: WHERE foos.address = '1.2.3.4' Which doesn't do the filtering in a proper way, since the generated joins attach tables foos_1 and foos_2. If I try that query manually but change the filtering clause to: WHERE foos_1.address = '1.2.3.4' AND foos_2.address = '1.2.3.4' It works fine. The question is of course - how can I achieve this with sqlalchemy itself?

    Read the article

  • Trigger Event after values have been commited for validation purposes

    - by www.jefferyfernandez.id.au
    I have a Flex component with a form and on creationComplete, I load some data onto the form textInputs. After the Form TextInputs have got their values, I want to trigger an event so the Parent of the component can validate the values on the TextInputs and based on the validation results, I perform some enable/disable of other interfaces. I have the following dispatch code: this.dispatchEvent(new PersonalDetailsEvent(PersonalDetailsEvent.LOADED_DATA_EVENT)); The event is dispatched and is captured by the parent. But upon performing the validation, some TextInputs always fail the validation. I thought it could be because of a race condition and so I used callLater() with same results. So in the end I am now using a timer to dispatch the event which is not ideal. Does anyone have a solution to this problem. It is really annoying that a timer needs to be used for this scenario.

    Read the article

  • Python sqlite3 and concurrency

    - by RexE
    I have a Python program that uses the "threading" module. Once every second, my program starts a new thread that fetches some data from the web, and stores this data to my hard drive. I would like to use sqlite3 to store these results, but I can't get it to work. The issue seems to be about the following line: conn = sqlite3.connect("mydatabase.db") If I put this line of code inside each thread, I get an OperationalError telling me that the database file is locked. I guess this means that another thread has mydatabase.db open through a sqlite3 connection and has locked it. If I put this line of code in the main program and pass the connection object (conn) to each thread, I get a ProgrammingError, saying that SQLite objects created in a thread can only be used in that same thread. Previously I was storing all my results in CSV files, and did not have any of these file-locking issues. Hopefully this will be possible with sqlite. Any ideas?

    Read the article

  • linq .net with dynamically generated controls

    - by Stuart
    This is a very strange problem and i really dont have a clue whats causing it. What is supposed to happen is that a call to the BLL then DAL returns some data via a linq SPROC call. The retunred IMultipleResults object is processed and all results stored in a hashtable. The hashtable is stored in session and then the UI layer uses these results to dynamically generate some gridviews. Easy you would think. But if i run the code i dont get any gridviews. If i take out the call to the BLL and DAL the gridviews appear but with nothing in them? Why is it the page renders correctly when i take out the call to get the data? Thanks.

    Read the article

  • How does linq decide between inner & outer joins

    - by user287795
    Hi Usually linq is using an left outer join for its queries but on some cases it decides to use inner join instead. I have a situation where that decision results in wrong results since the second table doesn't always have suitable records and that removes the records from the first table. I'm using a linqdatasource over a dbml where the relevant tables are identical but one holds historical records removed from the first. both have the same primary key. and I'm using a dataloadoption to load both tables at once with out round trips. Would you explain why linq decided to use an inner join here? Thanks

    Read the article

  • SQL Server, fetching data from multiple joined tables. Why is slow?

    - by user562192
    I have problem with performance when retrieving data from SQL Server. My sql query looks something like this: SELECT table_1.id, table_1.value, table_2.id, table_2.value,..., table_20.id, table_20.value From table_1 INNER JOIN table_2 ON table_1.id = table_2.table_1_id INNER JOIN table_3 ON table_2.id = table_3.table_2_id... WHERE table_1.row_number BETWEEN 1 AND 20 So, I am fetching 20 results. This query takes about 5 seconds to execute. When I select only table_1.id, it returns results instantly. Because of that, I guess that problem is not in JOINs, it is in retrieving data from multiple tables. Any suggestions how I would speed up this query?

    Read the article

  • Django Template - Convert python list into a javascript object

    - by amcashcow
    I am working on a django / python website I have a page where I want to display a table of search results The list of results is passed in to the template as normal I also want to make this list of objects accessible to the javascript code My first solution was just create another view that returned json format. But each page load required calling the query twice. So then I tried only downloading the data using the json view and printing the table using javascript. but this is also not desirable as now the presentation layer is mixed into the javascript code. is there a way to create a javascript object from the python list as the page is rendered?

    Read the article

  • Does jQuery.on() work for elements that are added after the event handler is created?

    - by orokusaki
    I was under the impression all this time that .on() worked like .live() with regards to dynamically created elements (e.g. I use $('.foo').on('click', function(){alert('click')}); and then an element with the class foo is created due to some AJAX, now I'm expecting a click on that element to cause an alert). In practice, these weren't the results I got. I could be making a mistake, but could somebody help me understand the new way to achieve these results, in the wake of .on()? Thanks in advance.

    Read the article

  • How can I do a left outer join where both tables have a where clause?

    - by cdeszaq
    Here's the scenario: I have 2 tables: CREATE TABLE dbo.API_User ( id int NOT NULL, name nvarchar(255) NOT NULL, authorization_key varchar(255) NOT NULL, is_active bit NOT NULL ) ON [PRIMARY] CREATE TABLE dbo.Single_Sign_On_User ( id int NOT NULL IDENTITY (1, 1), API_User_id int NOT NULL, external_id varchar(255) NOT NULL, user_id int NULL ) ON [PRIMARY] What I am trying to return is the following: is_active for a given authorization_key The Single_Sign_On_User.id that matches the external_id/API_User_id pair if it exists or NULL if there is no such pair When I try this query: SELECT Single_Sign_On_User.id, API_User.is_active FROM API_User LEFT OUTER JOIN Single_Sign_On_User ON Single_Sign_On_User.API_User_id = API_User.id WHERE Single_Sign_On_User.external_id = 'test_ext_id' AND API_User.authorization_key = 'test' where the "test" API_User record exists but the "test_ext_id" record does not, and with no other values in either table, I get no records returned. When I use: SELECT Single_Sign_On_User.id, API_User.is_active FROM API_User LEFT OUTER JOIN Single_Sign_On_User ON Single_Sign_On_User.API_User_id = API_User.id WHERE API_User.authorization_key = 'test' I get the results I expect (NULL, 1), but that query doesn't allow me to find the "test_ext_id" record if it exists but would give me all records associated with the "test" API_User record. How can I get the results I am after?

    Read the article

  • Calling Google's Custom Search API via Python

    - by user353829
    I am writing in Python a module that will query Google's Custom Search API and return all listings of domain 'example.com' I Have been reading instructions at https://code.google.com/apis/customsearch/v1/getting_started.html and am a little stumped at the moment. Are my assumptions listed below correct? For example, to search for results that has 'example.com' in the URL, the query is: *'https://www.googleapis.com/customsearch/v1?key=my_key&cx=017576662512468239146:omuauf_lfve&q=site:example.com*' *key=my_key*: value of key given by google cx=017576662512468239146: name of the search engine (google)? *omuauf_lfve*: I have no idea what this is q=site:example.com: This should return all results with 'example.com'; e.g. www.a.example.com, b.example.com, example .com

    Read the article

  • UITableViewController executes delate functions before network request finishes

    - by user1543132
    I'm having trouble trying to populate a UITableView with the results of a network request. It seems that my code is alright as it works perfectly when my network is speedy, however, when it's not, the function - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath- still executes, which results in a bad access error. I presume that this is because the array that the aforesaid function attempts to utilize has not been populated. This brings me to my question: Is there anyway that I can have the UITableView delegate methods delayed to avoid this? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"AlbumsCell"; //UITableViewCell *basicCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; AlbumsCell *cell = (AlbumsCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (!cell) { **// Here is where the Thread 1: EXC_BAD_ACCESS (code=2 address=0x8)** cell = [[[AlbumsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } Album *album = [_albums objectAtIndex:[indexPath row]]; [cell setAlbum:album]; return cell; }

    Read the article

  • SQL JOIN with two or more tables as output - most efficient way?

    - by littlegreen
    I have an SQL query that executes a LEFT JOIN on another table, then outputs all results that could be coupled into a designated table. I then have a second SQL query that executes the LEFT JOIN again, then outputs the results that could not be coupled to a designated table. In code, this is something like: INSERT INTO coupledrecords SELECT b.col1, b.col2... s.col1, s.col2... FROM bigtable AS b LEFT JOIN smallertable AS s ON criterium WHERE s.col1 IS NOT NULL INSERT INTO notcoupledrecords SELECT b.col1, b.col2... bigtable AS b LEFT JOIN smallertable AS s ON criterium WHERE s.col1 IS NULL My question: I now have to execute the JOIN two times, in order to achieve what I want. I have a feeling that this is twice as slow as it could be. Is this true, and if yes, is there a way to do it more efficiently?

    Read the article

  • Jquery ajax get - how to output data based on condition?

    - by arunas_t
    Hello, there, I have a such piece of code: $("#choose").change(function(){ $.get("get_results.php", {name: $("#choose").val()}, function(data){ if(data !== ""){ $("#results").html(data); }else{ $("#results").html('<strong>Sorry, no records.</strong>'); } }); }); Now the problem is that the first condition ( if(data !== "") ) is always evaluated correctly and executed, but the else clause ('Sorry, no records') never shows up. Can anyone spot the error? Data passed for the else clause is specifically "". Thank You.

    Read the article

  • Neural network input data, cartesian plane x/y coordinates, correlate with Handwriting.

    - by Sam
    I very curious about making a handwriting recognition application in a web browser. Users draw a letter, ajax sends the data to the server, neural network finds the closest match, and returns results. So if you draw an a, the first result should be an a, then o, then e, something like that. I'm don't know much about neural networks. What kinda data would I need to pass to the NN. Could it be an array of the x/y coordinates where the user has drawn on a pad. Or what type of data is the neural network expecting or would produce the best results for handwriting?

    Read the article

  • Removing groups of similar records in MySQL query

    - by user1182155
    I'm trying to wrap my head around this... (it may be simple, been a long day!) I have a database with sometimes multiple similar records... ie. Apples 2008-09-03 Apples 2012-01-01 Apples 2013-10-24 Oranges 2012-01-04 What I need to do is do a query that will show only records that haven't been updated today... So in this case, since Apples has an entry that was updated today, none of the records for the Apples should appear in the results. Oranges should be the only record it returns. I have a query similar to this... SELECT fruit FROM fruitnames where date < CURDATE() Which works to remove the record that was updated today... But it keeps the other records for Apples (obviously)... How would I remove those results as well?

    Read the article

  • Strange behaviour of mb_detect_order() in PHP

    - by termopro
    I would like to detect encoding of some text (using PHP). For that purpose i use mb_detect_encoding() function. The problem is that the function returns different results if i change the order of possible encodings with mb_detect_order() function. Consider the following example $html = <<< STR ????????????????????????????????????????????????????????????????????????????????????????????????????????? STR; mb_detect_order(array('UTF-8','EUC-JP', 'SJIS', 'eucJP-win', 'SJIS-win', 'JIS', 'ISO-2022-JP','ISO-8859-1','ISO-8859-2')); $originalEncoding = mb_detect_encoding($str); die($originalEncoding); // $originalEncoding = 'UTF-8' However if you change the order of encodings in mb_detect_order() the results will be different: mb_detect_order(array('EUC-JP','UTF-8', 'SJIS', 'eucJP-win', 'SJIS-win', 'JIS', 'ISO-2022-JP','ISO-8859-1','ISO-8859-2')); die($originalEncoding); // $originalEncoding = 'EUC-JP' So my questions are: Why is that happening ? Is there a way in PHP to correctly and unambiguously detect encoding of text ?

    Read the article

  • Create multiple columns on one sheet from 1 column on another with logic

    - by user450252
    I am new to VBA and I am struggling trying to make this work. I am in need of a macro that will process each cell\column on Sheet1 and put the results on Sheet2. I'm sure this is pretty easy for those who are more advanced with VB code. It contains many columns.. Anytime we encounter a — or an empty cell, we populate the cell with -999 (see the example on Sheet2) on the first column, which contains "0-2". Then we create 2 new columns and populate them with 0 on the first column and 2 on second column (see example on Sheet2). If a value is found on only one side, we then populate both sides with the same number. As each column is being process in Sheet1 and Sheet1: A B Column1 Column2 Title Title2 0–2 0–4 3 — — 5 — — — 10–23 11—29 And the results should look like this on Sheet2 Sheet2 A B C D Column1 Column1 Column2 Column2 Title-A Title-B Title-A Title-B 0 2 0 4 3 3 -999 -999 -999 -999 5 5 -999 -999 -999 -999 —999 -999 -999 -999 10 23 11 29

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >