Search Results

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

Page 207/556 | < Previous Page | 203 204 205 206 207 208 209 210 211 212 213 214  | Next Page >

  • Proper way to return an array

    - by Ward
    Hey there, I never seem to get this right. I've got a method that returns a mutable array. What is the proper way to return the array and avoid potential memory leaks? If I plan to store the results locally inside another view controller, does that affect the way the array should be returned? Lastly, what if it's just an non-mutable array? Does that require a different technique? thanks, Howie

    Read the article

  • spoj: runlength

    - by user285825
    For RLM problem of SPOJ: This is the problem: "Run-length encoding of a number replaces a run of digits (that is, a sequence of consecutive equivalent digits) with the number of digits followed by the digit itself. For example, 44455 would become 3425 (three fours, two fives). Note that run-length encoding does not necessarily shorten the length of the data: 11 becomes 21, and 42 becomes 1412. If a number has more than nine consecutive digits of the same type, the encoding is done greedily: each run grabs as many digits as it can, so 111111111111111 is encoded as 9161. Implement an integer arithmetic calculator that takes operands and gives results in run-length format. You should support addition, subtraction, multiplication, and division. You won't have to divide by zero or deal with negative numbers. Input/Output The input will consist of several test cases, one per line. For each test case, compute the run-length mathematics expression and output the original expression and the result, as shown in the examples. The (decimal) representation of all operands and results will fit in signed 64-bit integers." These are my testcases: input: 11 + 11 988726 - 978625 12 * 41 1124 / 1112 13 * 33 15 / 16 19222317121013161815142715181017 + 10 10 + 19222317121013161815142715181017 19222317121013161815142715181017 / 19222317121013161815142715181017 19222317121013161815142715181017 / 11 11 / 19222317121013161815142715181017 19222317121013161815142715181017 / 12 12 / 19222317121013161815142715181017 19222317121013161815142715181017 / 141621161816101118141217131817191014 141621161816101118141217131817191014 / 19222317121013161815142715181017 19222317121013161815142715181017 / 141621161816101118141217131817191013 141621161816101118141217131817191013 / 19222317121013161815142715181017 19222317121013161815142715181017 * 11 11 * 19222317121013161815142715181017 19222317121013161815142715181017 * 10 10 * 19222317121013161815142715181017 19222317121013161815142715181017 - 10 19222317121013161815142715181017 - 19222317121013161815142715181017 19222317121013161815142715181017 - 141621161816101118141217131817191014 19222317121013161815142715181017 - 141621161816101118141217131817191013 141621161816101118141217131817191013 + 141621161816101118141217131817191013 141621161816101118141217131817191013 + 141621161816101118141217131817191014 141621161816101118141217131817191014 + 141621161816101118141217131817191013 141621161816101118141217131817191014 + 10 10 + 141621161816101118141217131817191013 141621161816101118141217131817191013 + 11 11 + 141621161816101118141217131817191013 141621161816101118141217131817191013 * 12 12 * 141621161816101118141217131817191013 141621161816101118141217131817191014 - 141621161816101118141217131817191014 141621161816101118141217131817191013 - 141621161816101118141217131817191013 141621161816101118141217131817191013 - 10 141621161816101118141217131817191014 - 11 141621161816101118141217131817191014 - 141621161816101118141217131817191013 141621161816101118141217131817191014 / 141621161816101118141217131817191014 141621161816101118141217131817191014 / 141621161816101118141217131817191013 141621161816101118141217131817191013 / 141621161816101118141217131817191014 141621161816101118141217131817191013 / 141621161816101118141217131817191013 141621161816101118141217131817191014 * 11 11 * 141621161816101118141217131817191014 141621161816101118141217131817191014 / 11 11 / 141621161816101118141217131817191014 10 + 10 10 + 11 10 + 15 15 + 10 11 + 10 11 + 10 10 - 10 15 - 10 10 * 10 10 * 15 15 * 10 10 / 111213 output: 11 + 11 = 12 988726 - 978625 = 919111 12 * 41 = 42 1124 / 1112 = 1112 13 * 33 = 39 15 / 16 = 10 19222317121013161815142715181017 + 10 = 19222317121013161815142715181017 10 + 19222317121013161815142715181017 = 19222317121013161815142715181017 19222317121013161815142715181017 / 19222317121013161815142715181017 = 11 19222317121013161815142715181017 / 11 = 19222317121013161815142715181017 11 / 19222317121013161815142715181017 = 10 19222317121013161815142715181017 / 12 = 141621161816101118141217131817191013 12 / 19222317121013161815142715181017 = 10 19222317121013161815142715181017 / 141621161816101118141217131817191014 = 11 141621161816101118141217131817191014 / 19222317121013161815142715181017 = 10 19222317121013161815142715181017 / 141621161816101118141217131817191013 = 12 141621161816101118141217131817191013 / 19222317121013161815142715181017 = 10 19222317121013161815142715181017 * 11 = 19222317121013161815142715181017 11 * 19222317121013161815142715181017 = 19222317121013161815142715181017 19222317121013161815142715181017 * 10 = 10 10 * 19222317121013161815142715181017 = 10 19222317121013161815142715181017 - 10 = 19222317121013161815142715181017 19222317121013161815142715181017 - 19222317121013161815142715181017 = 10 19222317121013161815142715181017 - 141621161816101118141217131817191014 = 141621161816101118141217131817191013 19222317121013161815142715181017 - 141621161816101118141217131817191013 = 141621161816101118141217131817191014 141621161816101118141217131817191013 + 141621161816101118141217131817191013 = 19222317121013161815142715181016 141621161816101118141217131817191013 + 141621161816101118141217131817191014 = 19222317121013161815142715181017 141621161816101118141217131817191014 + 141621161816101118141217131817191013 = 19222317121013161815142715181017 141621161816101118141217131817191014 + 10 = 141621161816101118141217131817191014 10 + 141621161816101118141217131817191013 = 141621161816101118141217131817191013 141621161816101118141217131817191013 + 11 = 141621161816101118141217131817191014 11 + 141621161816101118141217131817191013 = 141621161816101118141217131817191014 141621161816101118141217131817191013 * 12 = 19222317121013161815142715181016 12 * 141621161816101118141217131817191013 = 19222317121013161815142715181016 141621161816101118141217131817191014 - 141621161816101118141217131817191014 = 10 141621161816101118141217131817191013 - 141621161816101118141217131817191013 = 10 141621161816101118141217131817191013 - 10 = 141621161816101118141217131817191013 141621161816101118141217131817191014 - 11 = 141621161816101118141217131817191013 141621161816101118141217131817191014 - 141621161816101118141217131817191013 = 11 141621161816101118141217131817191014 / 141621161816101118141217131817191014 = 11 141621161816101118141217131817191014 / 141621161816101118141217131817191013 = 11 141621161816101118141217131817191013 / 141621161816101118141217131817191014 = 10 141621161816101118141217131817191013 / 141621161816101118141217131817191013 = 11 141621161816101118141217131817191014 * 11 = 141621161816101118141217131817191014 11 * 141621161816101118141217131817191014 = 141621161816101118141217131817191014 141621161816101118141217131817191014 / 11 = 141621161816101118141217131817191014 11 / 141621161816101118141217131817191014 = 10 10 + 10 = 10 10 + 11 = 11 10 + 15 = 15 15 + 10 = 15 11 + 10 = 11 11 + 10 = 11 10 - 10 = 10 15 - 10 = 15 10 * 10 = 10 10 * 15 = 10 15 * 10 = 10 10 / 111213 = 10 I am getting consistently wrong answer. I generated the above testcases trying to make them as representative as possible (boundary conditions, etc). I am not sure how to test it further. Some guidline would be really appreciated.

    Read the article

  • Passing a ManagedObjectContext to a second view

    - by amo
    I'm writing my first iPhone/Cocoa app. It has two table views inside a navigation view. When you touch a row in the first table view, you are taken to the second table view. I would like the second view to display records from the CoreData entities related to the row you touched in the first view. I have the CoreData data showing up fine in the first table view. You can touch a row and go to the second table view. I'm able to pass info from the selected object from the first to the second view. But I cannot get the second view to do its own CoreData fetching. For the life of me I cannot get the managedObjectContext object to pass to the second view controller. I don't want to do the lookups in the first view and pass a dictionary because I want to be able to use a search field to refine results in the second view, as well as insert new entries to the CoreData data from there. Here's the function that transitions from the first to the second view. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here -- for example, create and push another view controller. NSManagedObject *selectedObject = [[self fetchedResultsController] objectAtIndexPath:indexPath]; SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil]; secondViewController.tName = [[selectedObject valueForKey:@"name"] description]; secondViewController.managedObjectContext = [self managedObjectContext]; [self.navigationController pushViewController:secondViewController animated:YES]; [secondViewController release]; } And this is the function inside SecondViewController that crashes: - (void)viewDidLoad { [super viewDidLoad]; self.title = tName; NSError *error; if (![[self fetchedResultsController] performFetch:&error]) { // <-- crashes here // Handle the error... } } - (NSFetchedResultsController *)fetchedResultsController { if (fetchedResultsController != nil) { return fetchedResultsController; } /* Set up the fetched results controller. */ // Create the fetch request for the entity. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate. // **** crashes on the next line because managedObjectContext == 0x0 NSEntityDescription *entity = [NSEntityDescription entityForName:@"SecondEntity" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; // <snip> ... more code here from Apple template, never gets executed because of the crashing return fetchedResultsController; } Any ideas on what I am doing wrong here? managedObjectContext is a retained property. UPDATE: I inserted a NSLog([[managedObjectContext registeredObjects] description]); in viewDidLoad and it appears managedObjectContext is being passed just fine. Still crashing, though. Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'SecondEntity''

    Read the article

  • Zend Router Route Regex with Search params

    - by balan-mahadevan
    Hi , Trying to grab the params after ?. I need them to add to the Zend_Paginator. ex: http://www.example.com/test/show?name=xxx&age=20&sex=m Building a paginator for search results. Is there any solution for that ? $router = new Zend_Controller_Router_Route_Regex( 'test/show\?(.*)', array( 'controller' = 'test', 'action' = 'show', 'module' = 'user' ), array( 1 = 'q' ), 'test/show%s' ); $router_prev->addRoute('view',$router);

    Read the article

  • xslt (table) by matching the attribute value.

    - by Magesh
    i need to generate an xsl table for the xml below , for atrributes fname and lname.. i have done something worng in xpath i guess.could someone help me out writing an xsl table for the xml below.. <sparql> - <head> <variable name="s"/> <variable name="fname"/> <variable name="lname"/> </head> - <results> - <result> - <binding name="s"> <uri>http://tn.gov.in/Person/41</uri> </binding> - <binding name="fname"> <literal>Gayathri</literal> </binding> - <binding name="lname"> <literal>Vasudevan</literal> </binding> </result> - <result> - <binding name="s"> <uri>http://tn.gov.in/Person/43</uri> </binding> - <binding name="fname"> <literal>Vivek</literal> </binding> - <binding name="lname"> <literal>Vasudevan</literal> </binding> </result> - <result> - <binding name="s"> <uri>http://tn.gov.in/Person/37</uri> </binding> - <binding name="fname"> <literal>Magesh</literal> </binding> - <binding name="lname"> <literal>Vasudevan</literal> </binding> </result> - <result> - <binding name="s"> <uri>http://tn.gov.in/Person/39</uri> </binding> - <binding name="fname"> <literal>Vasudevan </literal> </binding> - <binding name="lname"> <literal>Srinivasan</literal> </binding> </result> </results>

    Read the article

  • PHP Submit form to SugarCRM

    - by Brian
    I have a form that currently uses PHP to insert the form entries into a MySQL database. Is it possible to insert the results directly into a SugarCRM contact table instead of a MySQL db?

    Read the article

  • JSON array deserialization is crashing the Dalvik VM

    - by Sam
    I have some code grabbing a JSON array from my server and initially storing it as a string. This all works fine until I try and deserialize it using google's gson fromJson method. LogCat spits out the error: 04-08 17:46:35.163: ERROR/dalvikvm(401): Can't shrink stack: curFrame is in reserved area (0x41049000 0x410491c4) My code that causes the error is: String[] results = gson.fromJson(returnString, String[].class); Can anyone shed some light on what I am doing wrong? Cheers, Sam

    Read the article

  • Algorithm putting point into square with maximal minimum distance

    - by Mikulas Dite
    I'm stuck on this: Have a square. Put n points into this square so the minimal distance (not necessary the average distance) is the highest possible. I'm looking for an algorithm which would be able to generate the coordinates of all points given the count of them. Example results for n=4;5;6: Please don't mention computing-power based stuff such as trying a lot of combination and then nitpicking the right one and similar ideas.

    Read the article

  • python generic exception handling and return arg on exception

    - by rikAtee
    I am trying to create generic exception handler - for where I can set an arg to return in case of exception, inspired from this answer. import contextlib @contextlib.contextmanager def handler(default): try: yield except Exception as e: yield default def main(): with handler(0): return 1 / 0 with handler(0): return 100 / 0 with handler(0): return 'helllo + 'cheese' But this results in RuntimeError: generator didn't stop after throw()

    Read the article

  • Paramiko and Pseudo-tty Allocation

    - by Jon
    I'm trying to use Paramiko to connect to a remote host and execute a number of text file substitutions. i, o, e = client.exec_command("perl -p -i -e 's/" + initial + "/" + replaced + "/g'" + conf); Some of these commands need to be run as sudo, which results in: sudo: sorry, you must have a tty to run sudo I can force pseudo-tty allocation with the -t switch and ssh. Is it possible to do the same thing using paramiko?

    Read the article

  • Fulltext search for django : Mysql not so bad ? (vs sphinx, xapian)

    - by Eric
    I am studying fulltext search engines for django. It must be simple to install, fast indexing, fast index update, not blocking while indexing, fast search. After reading many web pages, I put in short list : Mysql MYISAM fulltext, djapian/python-xapian, and django-sphinx I did not choose lucene because it seems complex, nor haystack as it has less features than djapian/django-sphinx (like fields weighting). Then I made some benchmarks, to do so, I collected many free books on the net to generate a database table with 1 485 000 records (id,title,body), each record is about 600 bytes long. From the database, I also generated a list of 100 000 existing words and shuffled them to create a search list. For the tests, I made 2 runs on my laptop (4Go RAM, Dual core 2.0Ghz): the first one, just after a server reboot to clear all caches, the second is done juste after in order to test how good are cached results. Here are the "home made" benchmark results : 1485000 records with Title (150 bytes) and body (450 bytes) Mysql 5.0.75/Ubuntu 9.04 Fulltext : ========================================================================== Full indexing : 7m14.146s 1 thread, 1000 searchs with single word randomly taken from database : First run : 0:01:11.553524 next run : 0:00:00.168508 Mysql 5.5.4 m3/Ubuntu 9.04 Fulltext : ========================================================================== Full indexing : 6m08.154s 1 thread, 1000 searchs with single word randomly taken from database : First run : 0:01:11.553524 next run : 0:00:00.168508 1 thread, 100000 searchs with single word randomly taken from database : First run : 9m09s next run : 5m38s 1 thread, 10000 random strings (random strings should not be found in database) : just after the 100000 search test : 0:00:15.007353 1 thread, boolean search : 1000 x (+word1 +word2) First run : 0:00:21.205404 next run : 0:00:00.145098 Djapian Fulltext : ========================================================================== Full indexing : 84m7.601s 1 thread, 1000 searchs with single word randomly taken from database with prefetch : First run : 0:02:28.085680 next run : 0:00:14.300236 python-xapian Fulltext : ========================================================================== 1 thread, 1000 searchs with single word randomly taken from database : First run : 0:01:26.402084 next run : 0:00:00.695092 django-sphinx Fulltext : ========================================================================== Full indexing : 1m25.957s 1 thread, 1000 searchs with single word randomly taken from database : First run : 0:01:30.073001 next run : 0:00:05.203294 1 thread, 100000 searchs with single word randomly taken from database : First run : 12m48s next run : 9m45s 1 thread, 10000 random strings (random strings should not be found in database) : just after the 100000 search test : 0:00:23.535319 1 thread, boolean search : 1000 x (word1 word2) First run : 0:00:20.856486 next run : 0:00:03.005416 As you can see, Mysql is not so bad at all for fulltext search. In addition, its query cache is very efficient. Mysql seems to me a good choice as there is nothing to install (I need just to write a small script to synchronize an Innodb production table to a MyISAM search table) and as I do not really need advanced search feature like stemming etc... Here is the question : What do you think about Mysql fulltext search engine vs sphinx and xapian ?

    Read the article

  • Trie VS Suffix Tree VS Suffix Array

    - by ukrania
    Hello everyone, Which one is the structure that provides best performance results? Trie, Suffix Tree or Suffix Array? There are other equivalent structures? What are good Java implementations of these structures? Thanks for your answers. Best Regards, ukrania

    Read the article

  • Searching phpbb's 'topic_title' via MYSQL php, but exact match doesn't work

    - by Mint
    $sql = sprintf("SELECT topic_title FROM `phpbb_topics` WHERE `topic_title` LIKE '%%%s%%' LIMIT 20", mysql_real_escape_string('match this title')); Which I run this query in phpMyAdmin the results are: (correct) match this title match this title 002 But when I run that same MYSQL query in PHP I get: (incorrect) match this title 002 I have also tried MATCH AGAINST with the same result with both php and phpMyAdmin: $sql = "SELECT topic_title FROM phpbb_topics WHERE MATCH (topic_title) AGAINST('match this title' IN BOOLEAN MODE)"; Whats going on? I'v been searching all over the place and have found next to no help :(

    Read the article

  • Lazy Evaluation in Bash

    - by User1
    Is there more elegant way of doing lazy evaluation than the following: pattern='$x and $y' x=1 y=2 eval "echo $pattern" results: 1 and 2 It works but eval "echo ..." just feels sloppy and may be insecure in some way. Is there a better way to do this in Bash?

    Read the article

  • Regex not operator

    - by Erik Goens
    I need to use a regex to pull a value out a url domain that will exclude everything but the host (ex: wordpress) and domain type (ex .com). The urls are dynamic and contain 2-3 values for each result (www.example.com or example.org). I am trying to use this expression, but I am only getting back the first letter of every item I am attempting to exclude: Expresssion (?!wordpress|com|www)(\w+|\d+) String example.wordpress.com Results example ordpress om Desired Result example Any assistance would be greatly appreciated

    Read the article

  • SharePoint Search Center issue

    - by George2
    Hello everyone, I am using SharePoint Server 2007 with collaboration portal template on Windows Server 2008. The default search address for a site is pointed to /SearchCenter/Pages/Results.aspx. Any ideas how to change the address to some other address? Either programming solution or easy config solution is fine. thanks in advance, George

    Read the article

  • Parsing a string using a delimiter to a TStringList, seems to also parse on spaces (Delphi)

    - by Daisetsu
    I have a simple string which is delimited by some character, let's say a comma. I should be able to create a TStringList and set it's delimiter to a comma then set the DelimitedText to the text I want to parse and it should be automaticlly parsed. The problem is when I look at the output it also includes spaces as delimiters and chops up my results. How can I avoid this, or is there a better way to do this.

    Read the article

  • Boost::binary<>

    - by atch
    Hi, Is there anything in boost libraries like binary? For example I would like to write: binary<10101> a; I'm ashamed to admit that I've tried to find it (Google, Boost) but no results. They're mention something about binary_int< but I couldn't find neither if it is available nor what header file shall I include; Thanks for help.

    Read the article

< Previous Page | 203 204 205 206 207 208 209 210 211 212 213 214  | Next Page >