Search Results

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

Page 39/556 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • python multiprocessing.Process.Manager not producing consistent results?

    - by COpython
    I've written the following code to illustrate the problem I'm seeing. I'm trying to use a Process.Manager.list() to keep track of a list and increment random indices of that list. Each time there are 100 processes spawned, and each process increments a random index of the list by 1. Therefore, one would expect the SUM of the resulting list to be the same each time, correct? I get something between 203 and 205. from multiprocessing import Process, Manager import random class MyProc(Process): def __init__(self, A): Process.__init__(self) self.A = A def run(self): i = random.randint(0, len(self.A)-1) self.A[i] = self.A[i] + 1 if __name__ == '__main__': procs = [] M = Manager() a = M.list(range(15)) print('A: {0}'.format(a)) print('sum(A) = {0}'.format(sum(a))) for i in range(100): procs.append(MyProc(a)) map(lambda x: x.start(), procs) map(lambda x: x.join(), procs) print('A: {0}'.format(a)) print('sum(A) = {0}'.format(sum(a)))

    Read the article

  • mySQL query not returning correct results!

    - by Pete Herbert Penito
    Hi! This query that I have is returning therapists whose 'therapistTable.activated' is equal to false as well as those set to true! so it's basically selecting all of the db, any advice would be appreciated! ` $query = "SELECT therapistTable.* FROM therapistTable WHERE therapistTable.activated = 'true' ORDER BY therapistTable.distance "; `

    Read the article

  • C# sqlite query results to list<string>

    - by jakesankey
    Guys, I'm struggling. I have query against my db that returns a single column of data and I need to set it as List. Here is what I am working with and I am getting an error about converting void to string. public static void GetImportedFileList() { using (SQLiteConnection connect = new SQLiteConnection(@"Data Source=C:\Documents and Settings\js91162\Desktop\CMMData.db3")) { connect.Open(); using (SQLiteCommand fmd = connect.CreateCommand()) { SQLiteCommand sqlComm = new SQLiteCommand(@"SELECT DISTINCT FileName FROM Import"); SQLiteDataReader r = sqlComm.ExecuteReader(); while (r.Read()) { string FileNames = (string)r["FileName"]; List<string> ImportedFiles = new List<string>(); } connect.Close(); } } } THEN LATER IN THE APPLICATION List<string> ImportedFiles = GetImportedFileList() // Method that gets the list of files from the db foreach (string file in files.Where(fl => !ImportedFiles.Contains(fl)))

    Read the article

  • Further filter SQL results

    - by eric
    I've got a query that returns a proper result set, using SQL 2005. It is as follows: select case when convert(varchar(4),datepart(yyyy,bug.datecreated),101)+ ' Q' +convert(varchar(2),datepart(qq,bug.datecreated),101) = '1969 Q4' then '2009 Q2' else convert(varchar(4),datepart(yyyy,bug.datecreated),101)+ ' Q' +convert(varchar(2),datepart(qq,bug.datecreated),101) end as [Quarter], bugtypes.bugtypename, count(bug.bugid) as [Total] from bug left outer join bugtypes on bug.crntbugtypeid = bugtypes.bugtypeid and bug.projectid = bugtypes.projectid where (bug.projectid = 44 and bug.currentowner in (-1000000031,-1000000045) and bug.crntplatformid in (42,37,25,14)) or (bug.projectid = 44 and bug.currentowner in (select memberid from groupmembers where projectid = 44 and groupid in (87,88)) and bug.crntplatformid in (42,37,25,14)) group by case when convert(varchar(4),datepart(yyyy,bug.datecreated),101)+ ' Q' +convert(varchar(2),datepart(qq,bug.datecreated),101) = '1969 Q4' then '2009 Q2' else convert(varchar(4),datepart(yyyy,bug.datecreated),101)+ ' Q' +convert(varchar(2),datepart(qq,bug.datecreated),101) end, bugtypes.bugtypename order by 1,3 desc It produces a nicely grouped list of years and quarters, an associated descriptor, and a count of incidents in descending count order. What I'd like to do is further filter this so it shows only the 10 most submitted incidents per quarter. What I'm struggling with is how to take this result set and achieve that.

    Read the article

  • jQuery: use Use filter(), but work with both results

    - by Tomalak
    In jQuery, filter() reduces your result to those elements that fulfill a certain condition. This splits the list in two parts. Working with the "good half" of the elements is easy: $("some selector").filter(function() { // determine result... return result; }).each( /* do something */ ); But how can I work with the "other half" of my elements, too - but without doing the equivalent of this: $("some selector").filter(function() { // determine result... return !result; }).each( /* do something else */ ); Basically, I'd like to feed two separate /* do something */ parts to a single filter. One for those that match, and one for the others - without having to filter twice. Am I missing a jQuery function that does this? P.S.: I guess I could do: $("some selector").each(function() { // determine result... if (result) /* do something */ else /* do something else */ }); But I was hoping for something nicer.

    Read the article

  • PHP resizing PNGs results in corrupted files

    - by Robert
    I have a PHP script that resizes .jpg, .gif, and .png files to a bounding box. $max_width = 500; $max_height = 600; $filetype = $_FILES["file"]["type"]; $source_pic = "img/" . $idnum; if($filetype == "image/jpeg") { $src = imagecreatefromjpeg($source_pic); } else if($filetype == "image/png") { $src = imagecreatefrompng($source_pic); } else if($filetype == "image/gif") { $src = imagecreatefromgif($source_pic); } list($width,$height)=getimagesize($source_pic); $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if( ($width <= $max_width) && ($height <= $max_height) ) { $tn_width = $width; $tn_height = $height; } else if (($x_ratio * $height) < $max_height) { $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; } else { $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $tmp = imagecreatetruecolor($tn_width,$tn_height); imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height); $destination_pic = "img/thumbs/" . $idnum . "thumb"; if($filetype == "image/jpeg") { imagejpeg($tmp,$destination_pic,80); } else if($filetype == "image/png") { imagepng($tmp,$destination_pic,80); } else if($filetype == "image/gif") { imagegif($tmp,$destination_pic,80); } imagedestroy($src); imagedestroy($tmp); The script works fine with jpeg and gif but when running on a png the file will be corrupted. Is there anything special I need to use when working with a png? I have never worked with this sort of thing in PHP so I'm not very familiar with it.

    Read the article

  • design function: underlying structure to store list of results for print to file

    - by forest.peterson
    is this a good approach to print a list of items to csv file with a sublist attached to each item. The gist of the function is when an item is found that does not exactly macth then a list of close matches is generated - this works now writing out one list at a time to a command window. For export to a csv file I think all the lists must be generated, stored and then written at once. Right now I use a struct to store the attributes printed, each struct is an item on the list - these structs are then added to a sorted stack and when printed they pop off into write out. Is a stack of stacks of structs a good design?

    Read the article

  • Creating a new Intent results in a error

    - by yoavstr
    when i do the fallowing i get screamed on : Button newGameButton = (Button) this.findViewById(R.id.newGameButton); newGameButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { startActivity(new Intent(this,gameScreen.class)); } }); apparently my this is not the one needed how can i fix this err?

    Read the article

  • Fulltext search not returning expected results

    - by Puneet
    I am experimenting with SQL Server full text search. I have a simple Categories table with Id as the primary key: CREATE TABLE [dbo].[Category]( [Id] [int] IDENTITY(1,1) NOT NULL, [CategoryName] [varchar](100) NOT NULL, ) My Query is: SELECT * FROM FREETEXTTABLE (Category, CategoryName, 'music') AS F INNER JOIN Category C ON F.[Key] = C.Id ORDER BY F.Rank DESC This returns me several records with the word music in them, but it does NOT return any record with word ‘musical’. Although, it can be said that the string being searched is not very big and using the LIKE operator will resolve it. I would like to use fulltext search because this simple example is going to be extended to include other tables and fileds.

    Read the article

  • Inconsistent Routing Results in MVC

    - by HapiDjus
    Seems I'm still missing something to the MVC routing concept. I have a route that follows nearly the same pattern as another route in an area but for what ever reason I get a 404 every time I attempt to run it. I've tried to use Phil Haack's Route Tester DLL and according to that it hits the correct route (matched route comes out to common/itemhistory/{contentid}). When I try to run it for real, it blows up. I'm trying to map a call to a JsonResult by passing a Guid. I've had success with other routes working fine (common is an area in my site). What could I be doing wrong? context.MapRoute( "ItemHistory", "common/itemhistory/{contentid}", new { controller = "common", action = "GetItemHistory" }, new { contentid = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$" } ); context.MapRoute( "Common_default", "common/{action}", new { controller="common", action = "Index" } );

    Read the article

  • FULLTEXT Irrelevant results

    - by Imran Omar Bukhsh
    Just came across this issue using the fulltext search of mysql. I have like 250 records ( long articles like stuff ) and am using the fulltext MATCH AGAINST IN BOOLEAN MODE. Now if I search for a keyword e.g. 'Samsung' and if this keyword is present in ALL the records then it returns all the 250 records which it should ( of course without `IN BOOLEAN MODE it would return nothing as the keyword is present in more than 50% of the records ). Now the problem is that in some articles the keyword 'Samsung' occurs once and in others a couple of times, but MYSQL is giving a score of 1 to all the records returned, even those which have 'Samsung' like 15 times in them.

    Read the article

  • Join two results in Powershell

    - by Hinek
    I've got two CMDlets that return lists of objects. One returns objects of the type SPSolution, which contains the property Id, the other returns objects of the type SPFeature with a property SolutionId. Now I want to join/merge this data something like this: $f = Get-Feature $s = Get-Solution $result = <JOIN> $f $s <ON> $f.SolutionId = $s.Id <SELECT> FeatureName = $f.DisplayName, SolutionName = $s.Name

    Read the article

  • How to use PHP to POST to a web page then get the results back, locally

    - by Patrick Gates
    I have a page on my web server that is PHP that is set to do this if ($_POST['post'] == true) { echo: 'hello, world'; } I want to create a page that calls to that page, posts "post" equal to "true" and then returns the value "hello, world". I have a script that works, but only if the pages are on different servers. Unfortunately, both of these pages are on the same server, so, heres my code, and I'm hoping you guys can help me, Thank you :) function post($site, $post) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$site); curl_setopt($ch, CURLOPT_FAILONERROR,1); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $retValue = curl_exec($ch); curl_close($ch); return $retValue; } echo post('data.php', 'post=true');

    Read the article

  • An array of MySQL results...

    - by Michael Falk
    What am I doing wrong here? I am attempting to return a json object and I can't seem to get past the array... I've built hundreds of regular array and returned them as a json object but I am having a hard time wrapping my head around this one. $rows = array(); $post_array = array(); $i = 0; $result = mysql_query(" SELECT * FROM forum_posts WHERE permalink = '$permalink' AND LOWER(raw_text) LIKE '%$str%' " ); while($row = mysql_fetch_assoc($result)) { $post_array[$i] = $rows[ "id" => htmlentities($row["id"]), "post_content" => htmlentities($row["content"]), "author" => $row["author"], "last_updated" => $row["last_updated"], "author_id" => $row["author_id"], "editing_author" => $row["editing_author"], "date" => $outputQuoteDate ]; $i++; }

    Read the article

  • How to select a subset of results from a select statement

    - by Ankur
    I have a table that stores RDF triples: triples(triple_id, sub_id, pre_id, obj_id) The method (I need to write) will receive an array of numbers which correspond to pre_id values. I want to select all sub_id values that have a corresponding pre_id for all the pre_ids in the array that is passed in. E.g. if I had a single pre_id values passed in... lets call the value passed in preId, I would do: select sub_id from triples where pre_id=preId; However since I have mutliple pre_id values I want to keep iterating through the pre_id values and only keep the sub_id values corresponding to the "triples" records that have both. E.g. image there are five records: triples(1, 34,65,23) triples(2, 31,35,28) triples(3, 32,32,19) triples(4, 12,65,28) triples(5, 76,32,34) If I pass in an array of pre_id values [65,32] then I want to select the first, third, fourth and fifth records. What would I do for that?

    Read the article

  • mysql_fetch_array() not displaying all results

    - by user1666995
    I have a database with a calendar table (each row represents one day) with 4 years of rows (2012, 2013, 2014, 2015). I use the column name calyear for the year. I use the following code to find values for distinct years then display it: $year = mysql_query("SELECT DISTINCT calyear FROM calendar"); while($yeararray = mysql_fetch_array($year)) { echo($yeararray['calyear']."<br />"); } The problem is it only displays the years 2013, 2014, 2015 even though when I use echo(mysql_num_rows($year); it displays the value 4 which I take to mean all 4 years are there. I'm not quite sure where I'm going wrong with this.

    Read the article

  • why tempspace results here??

    - by SubPortal
    if we supposed that "A.B." is a value for an xml element called given-names the following code converts this value to "A.tempspacetempspaceB." instead of "A. B." foreach (XElement initial in doc.XPathSelectElements("//given-names")) { string v = initial.Value.Replace(".", ". ").TrimEnd(' '); initial.SetValue(v); } So why tempspace comes here instead of literal space?? thank you for any help.

    Read the article

  • iPhone producing strange results on 'if' statement

    - by Rob
    I have a UIPicker where the user inputs a specified time (i.e. 13:00, 13:01, 13:02, etc.) - which determines their score. Once they hit the button an alert comes up with the score that is determined through this 'if-else' statement. Everything seems to work great MOST of the time - but I am getting some erratic behavior. This is the code: //Gets my value from the UIPicker and then converts it into a format that can be used in the 'if' statement. NSInteger runRow = [runTimePicker selectedRowInComponent:2]; NSString *runSelected = [runTimePickerData objectAtIndex:runRow]; NSString *runSelectedFixed = [runSelected stringByReplacingOccurrencesOfString:@":" withString:@"."]; //The actual 'if' statment. if ([runSelectedFixed floatValue] <= 13.00) { runScore = 100; } else if ([runSelectedFixed floatValue] <= 13.06) { runScore = 99; } else if ([runSelectedFixed floatValue] <= 13.12) { runScore = 97; } else if ([runSelectedFixed floatValue] <= 13.18) { runScore = 96; } else if ([runSelectedFixed floatValue] <= 13.24) { runScore = 94; } else if ([runSelectedFixed floatValue] <= 13.30) { runScore = 93; } else if ([runSelectedFixed floatValue] <= 13.36) { runScore = 92; } else if ([runSelectedFixed floatValue] <= 13.42) { runScore = 90; } else if ([runSelectedFixed floatValue] <= 13.48) { runScore = 89; } else if ([runSelectedFixed floatValue] <= 13.54) { runScore = 88; } Now, when I test the program, I will get the expected result when I choose '13:00' which is '100'. I also get the expected result of '99' when I choose all of the times between '13:01 and 13:05'. BUT, when I choose '13:06' it gives me a score of '97'. I also get a score of '97' on '13:07 through 13:12' - which is the desired result. Why would I get a '97' right on '13:12' but not get a '99' right on '13:06'???? Could this be a memory leak or something???

    Read the article

  • .NET Results Class

    - by pm_2
    I have a C# function that does some processing and needs to return figures about what it has processed, success, failure, etc. Can anyone tell me if there are any standard framework classes that will handle this (for example, number of records processed, number successful, failed, etc) ? Alternatively, can anyone say how they usually handle this? Is the best way to create a class, or to use out parameters?

    Read the article

  • Passing CMD Results to Variable in a Batch File

    - by TripleNad
    I am trying to install an application and a group of services using PSTools, but I want to take into account that the computer I am trying to connect to may be turned off or on a different network, which is not reachable from the internal network. Basically if the machine is not able to be accessed through the admin share, this is the message that I am getting: Couldn't access MachineName: The network path was not found. Make sure that the default admin$ share is enabled on MachineName. This is the syntax I am using to try to capture the "Error Message" and then report back that if installation was successful or not (depending on if it can contact the machine) @echo off set /p name=What is the machine name?: psexec.exe \\\%name% -u *useraccount* -p *password* \\\ServerName\installation.bat FOR /F "tokens=*" %%A IN ('COMMAND ^| FIND "Couldn't access"') DO SET Error=%%A If "%Error%"=="Couldn't access" ECHO Installation Failed. Else ECHO Installtion complete. Pause exit Currently it hangs right at the point it's defining the Error Variable. Can't quite figure out what I am going wrong here.

    Read the article

  • How to get search results in XML format

    - by Shibin Moideen
    Hi, I am planning to make an iPhone search app. the user types in the search string. the string will be searched by some search engines like Google, Live, Yahoo ... I need to get the search result in the XML format. Is there any way to do this. Help needed. Please. Thanks and regards, Shibin

    Read the article

  • Question about Benchmark function in Mysql ( Incredible results ).

    - by xRobot
    I have 2 tables: author with 3 millions of rows. book with 20 miles rows. . So I have benchmarked this query with a join: SELECT BENCHMARK(100000000, 'SELECT book.title, author.name FROM `book` , `author` WHERE book.id = author.book_id ') And this is the result: Query took 0.7438 sec ONLY 0.7438 seconds for 100 millions of query with a join ??? Do I make some mistakes or this is the right result ?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >