Search Results

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

Page 54/556 | < Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >

  • What is the explanation of this results in Java ?

    - by M.H
    I have the following code : public class Main { private int i = j; //1 private int j = 10; public static void main(String[] args) { System.out.println((new Main()).i); } } and there is a compiler error in line 1 because an illegal forward reference. But when I am trying the following code : public class Main { int i = getJ(); //1 int getJ(){ return j; } int j=10; public static void main(String[] args) { System.out.println(new Main().i); } } it works fine and the result is 0.Why there is no illegal forward reference in line 1 here?.The two codes look similar to me.

    Read the article

  • pthread_create followed by pthread_detach still results in possibly lost error in Valgrind.

    - by alesplin
    I'm having a problem with Valgrind telling me I have some memory possible lost: ==23205== 544 bytes in 2 blocks are possibly lost in loss record 156 of 265 ==23205== at 0x6022879: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==23205== by 0x540E209: allocate_dtv (in /lib/ld-2.12.1.so) ==23205== by 0x540E91D: _dl_allocate_tls (in /lib/ld-2.12.1.so) ==23205== by 0x623068D: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread-2.12.1.so) ==23205== by 0x758D66: MTPCreateThreadPool (MTP.c:290) ==23205== by 0x405787: main (MServer.c:317) The code that creates these threads (MTPCreateThreadPool) basically gets an index into a block of waiting pthread_t slots, and creates a thread with that. TI becomes a pointer to a struct that has a thread index and a pthread_t. (simplified/sanitized): for (tindex = 0; tindex < NumThreads; tindex++) { int rc; TI = &TP->ThreadInfo[tindex]; TI->ThreadID = tindex; rc = pthread_create(&TI->ThreadHandle,NULL,MTPHandleRequestsLoop,TI); /* check for non-success that I've omitted */ pthread_detach(&TI->ThreadHandle); } Then we have a function MTPDestroyThreadPool that loops through all the threads we created and cancels them (since the MTPHandleRequestsLoop doesn't exit). for (tindex = 0; tindex < NumThreads; tindex++) { pthread_cancel(TP->ThreadInfo[tindex].ThreadHandle); } I've read elsewhere (including other questions here on SO) that detaching a thread explicitly would prevent this possibly lost error, but it clearly isn't. Any thoughts?

    Read the article

  • How can I optimize this loop?

    - by Moshe
    I've got a piece of code that returns a super-long string that represents "search results". Each result is represented by a double HTML break symbol. For example: Result1<br><br>Result 2<br><br>Result3 I've got the following loop that takes each result and puts it into an array, stripping out the break indicator, "kBreakIndicator" (<br><br>). The problem is that this lopp takes way too long to execute. With a few results it's fine, but once you hit a hundred results, it's about 20-30 seconds slower. It's unacceptable performance. What can I do to improve performance? Here's my code: content is the original NSString. NSMutableArray *results = [[NSMutableArray alloc] init]; //Loop through the string of results and take each result and put it into an array while(![content isEqualToString:@""]){ NSRange rangeOfResult = [content rangeOfString:kBreakIndicator]; NSString *temp = (rangeOfResult.location != NSNotFound) ? [content substringToIndex:rangeOfResult.location] : nil; if (temp) { [results addObject:temp]; content = [[[content stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@%@", temp, kBreakIndicator] withString:@""] mutableCopy] autorelease]; }else{ [results addObject:[content description]]; content = [[@"" mutableCopy] autorelease]; } } //Do something with the results array. [results release];

    Read the article

  • Append Results from two queries and output as a single table.

    - by tHeSiD
    I have two queries that I have to run, I cannon join them But their resultant tables have the same structrure. For example I have select * from products where producttype=magazine select * from products where producttype = book I have to combine the result of these two queries, and then output it as one single result. I have to do this inside a stored procedure. PS These are just examples I provided, i have a complex table structure. The main thing is I cannot join them.

    Read the article

  • Javascript help needed - which variable is return empty??

    - by mathew
    Hi I would like to know how do I add an error check to below mentioned code...I mean how do I check if this code return empty or not?? if this returns empty then I would give a message "Not Found".. How do I do That?? google.load('search', '1'); var blogSearch; function searchComplete() { // Check that we got results document.getElementById('content').innerHTML = ''; if (blogSearch.results && blogSearch.results.length > 0) { for (var i = 0; i < blogSearch.results.length; i++) { // Create HTML elements for search results var p = document.createElement('p'); var a = document.createElement('a'); a.href = blogSearch.results[i].postUrl; a.innerHTML = blogSearch.results[i].title; // Append search results to the HTML nodes p.appendChild(a); document.body.appendChild(p); } } } function onLoad() { // Create a BlogSearch instance. blogSearch = new google.search.BlogSearch(); // Set searchComplete as the callback function when a search is complete. The // blogSearch object will have results in it. blogSearch.setSearchCompleteCallback(this, searchComplete, null); // Set a site restriction blogSearch.setSiteRestriction('blogspot.com'); // Execute search query blogSearch.execute('1974 Chevrolet Caprice'); // Include the required Google branding google.search.Search.getBranding('branding'); } // Set a callback to call your code when the page loads google.setOnLoadCallback(onLoad);

    Read the article

  • Cam you insert the results of a dynamic sql call into a SQL Server 2005 table variable

    - by codingguy3000
    Is there anyway to do this in SQL Server 2005? declare @tv_tablelist table (recnum int identity(1,1) primary key, newvar varchar(500)) declare @mysql nvarchar(4000) set @mysql = 'insert into @tv_tablelist(newvar) values (''test test test'')' Exec sp_executesql @mysql, N'@tv_tablelist table (recnum int identity(1,1) primary key, newvar varchar(500)) OUTPUT', @tv_tablelist OUTPUT select * from @tv_tablelist

    Read the article

  • Why does this SELECT ... JOIN statement return no results?

    - by Stephen
    I have two tables: 1. tableA is a list of records with many columns. There is a timestamp column called "created" 2. tableB is used to track users in my application that have locked a record in tableA for review. It consists of four columns: id, user_id, record_id, and another timestamp collumn. I'm trying to select up to 10 records from tableA that have not been locked by for review by anyone in tableB (I'm also filtering in the WHERE clause by a few other columns from tableA like record status). Here's what I've come up with so far: SELECT tableA.* FROM tableA LEFT OUTER JOIN tableB ON tableA.id = tableB.record_id WHERE tableB.id = NULL AND tableA.status = 'new' AND tableA.project != 'someproject' AND tableA.created BETWEEN '1999-01-01 00:00:00' AND '2010-05-06 23:59:59' ORDER BY tableA.created ASC LIMIT 0, 10; There are currently a few thousand records in tableA and zero records in tableB. There are definitely records that fall between those timestamps, and I've verified this with a simple SELECT * FROM tableA WHERE created BETWEEN '1999-01-01 00:00:00' AND '2010-05-06 23:59:59' The first statement above returns zero rows, and the second one returns over 2,000 rows.

    Read the article

  • Can I force MySQL to output results before query is completed?

    - by Gordon Royle
    I have a large MySQL table (about 750 million rows) and I just want to extract a couple of columns. SELECT id, delid FROM tbl_name; No joins or selection criteria or anything. There is an index on both fields (separately). In principle, it could just start reading the table and spitting out the values immediately, but in practice the whole system just chews up memory and basically grinds to a halt. It seems like the entire query is being executed and the output stored somewhere before ANY output is produced... I've searched on unbuffering, turning off caches etc, but just cannot find the answer. (mysqldump is almost what I want except it dumps the whole table - but at least it just starts producing output immediately)

    Read the article

  • Ordering the results of a Hibernate Criteria query by using information of the child entities of the

    - by pkainulainen
    I have got two entities Person and Book. Only one instance of a specific book is stored to the system (When a book is added, application checks if that book is already found before adding a new row to the database). Relevant source code of the entities is can be found below: @Entity @Table(name="persons") @SequenceGenerator(name="id_sequence", sequenceName="hibernate_sequence") public class Person extends BaseModel { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_sequence") private Long id = null; @ManyToMany(targetEntity=Book.class) @JoinTable(name="persons_books", joinColumns = @JoinColumn( name="person_id"), inverseJoinColumns = @JoinColumn( name="book_id")) private List<Book> ownedBooks = new ArrayList<Book>(); } @Entity @Table(name="books") @SequenceGenerator(name="id_sequence", sequenceName="hibernate_sequence") public class Book extends BaseModel { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_sequence") private Long id = null; @Column(name="name") private String name = null; } My problem is that I want to find persons, which are owning some of the books owned by a specific persons. The returned list of persons should be ordered by using following logic: The person owning most of the same books should be at the first of the list, second person of the the list does not own as many books as the first person, but more than the third person. The code of the method performing this query is added below: @Override public List<Person> searchPersonsWithSimilarBooks(Long[] bookIds) { Criteria similarPersonCriteria = this.getSession().createCriteria(Person.class); similarPersonCriteria.add(Restrictions.in("ownedBooks.id", bookIds)); //How to set the ordering? similarPersonCriteria.addOrder(null); return similarPersonCriteria.list(); } My question is that can this be done by using Hibernate? And if so, how it can be done? I know I could implement a Comparator, but I would prefer using Hibernate to solve this problem.

    Read the article

  • How do you DELETE rows in a mysql table that have a field IN the results of another query?

    - by user354825
    here's what the statement looks like: DELETE FROM videoswatched vw2 WHERE vw2.userID IN ( SELECT vw.userID FROM videoswatched vw JOIN users u ON vw.userID=u.userID WHERE u.companyID = 1000 GROUP BY userID ) that looks decent to me, and the SELECT statement works on its own (producing rows with a single column 'userID'. basically, i want to delete entries in the 'videoswatched' table where the userID in the videoswatched entry, after joining to the users table, is found to have companyID=1000. how can i do this without getting the error in my sql syntax? it says the error is near: vw2 WHERE vw2.userID IN ( SELECT vw.userID FROM videoswatched vw JOIN users u and on line 1. thanks!

    Read the article

  • How to implement a search page which shows results on the same page?

    - by Andrew
    I'm using ASP.NET MVC 2 for the first time on a project at work and am feeling like a bit of a noob. I have a page with a customer search control/partial view. The control is a textbox and a button. You enter a customer id into the textbox and hit search. The page then "refreshes" and shows the customer details on the same page. In other words, the customer details appear below the customer search control. This is so that if the customer isn't the right one, the user can search again without hitting back in the browser. Or, perhaps they mistyped the customer id and need to try again. I want the URL to look like this: /Customer/Search/1 Obviously, this follows the default route in the project. Now, if I type the URL above directly into my browser, it works fine. However, when I then use the search control on that page to search for say customer 2, the page refreshes with the correct customer details but the URL does not change! It stays as /Customer/Search/1 When I want it to be /Customer/Search/2 How can I get it to change to the correct URL? I am only using the default route in Global.asax. My Search method looks like this: <AcceptVerbs(HttpVerbs.Get)> _ Function Search(ByVal id As String) As ActionResult Dim customer As Customer = New CustomerRepository().GetById(id) Return View("SearchResult", customer) End Function

    Read the article

  • Can php query the results from a previous query?

    - by eaolson
    In some languages (ColdFusion comes to mind), you can run a query on the result set from a previous query. Is it possible to do something like that in php (with MySQL as the database)? I sort of want to do: $rs1 = do_query( "SELECT * FROM animals WHERE type = 'fish'" ); $rs2 = do_query( "SELECT * FROM rs1 WHERE name = 'trout'" );

    Read the article

  • Trying to use tcl threads on windows 7 results in access violation.

    - by Juan
    I'm trying to get this simple program to work on windows, but it crashes: unsigned (__stdcall testfoo)(ClientData x) { return 0; } int main() { Tcl_ThreadId testid = 0; Tcl_CreateThread(&testid, testfoo, (ClientData) NULL, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS); } I am using a makefile generated by cmake and linking against a version of Tcl 8.5.7 I compiled myself using Visual C++ 2008 express. It was compiled using msvcrt,static,threads and the name of the resulting library is tcl85tsx.lib. The error is: Unhandled exception at 0x77448c39 in main.exe: 0xC0000005: Access violation writing location 0x00000014. The Tcl library works fine, and I can even run a threading script example by loading the Thread extension into it. My assumption is that there is something horribly wrong with a memory violation, but I have no idea what. Any help appreciated.

    Read the article

  • Why changing the images name on server results in calling the old ones?

    - by moderns
    I am running a slideshow on Ubuntu 12.04.1 that loads the images (slide1.jpg, slide2.jpg, slide3.jpg.., slide5.jpg) using the Javascript and styles as below: document.getElementById('slide_area').className='slide'+step; .slide1{background-image: url(../upload/slide1.jpg)} .slide2{background-image: url(../upload/slide2.jpg)} .slide3{background-image: url(../upload/slide3.jpg)} .slide4{background-image: url(../upload/slide4.jpg)} .slide5{background-image: url(../upload/slide5.jpg)} When I change the images names (show1.jpg, show2.jpg, show3.jpg.., show5.jpg) and also change the style as below: .slide1{background-image: url(../upload/show1.jpg)} .slide2{background-image: url(../upload/show2.jpg)} .slide3{background-image: url(../upload/show3.jpg)} .slide4{background-image: url(../upload/show4.jpg)} .slide5{background-image: url(../upload/show5.jpg)} And open the network section on Chrome, I see the server is calling the new name and old name for images! I added the header in the index.php: header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); Nothing worked out with me and the slideshow doesn't work properly when I change the name of images even when clearing the browser cache as I load images sequentially (one by one) depending on imageObject.complete property! But without changing the name everything is going perfect and the images are loaded smoothly! Thank you for your help!

    Read the article

  • How to get results efficiently out of an Octree/Quadtree?

    - by Reveazure
    I am working on a piece of 3D software that has sometimes has to perform intersections between massive numbers of curves (sometimes ~100,000). The most natural way to do this is to do an N^2 bounding box check, and then those curves whose bounding boxes overlap get intersected. I heard good things about octrees, so I decided to try implementing one to see if I would get improved performance. Here's my design: Each octree node is implemented as a class with a list of subnodes and an ordered list of object indices. When an object is being added, it's added to the lowest node that entirely contains the object, or some of that node's children if the object doesn't fill all of the children. Now, what I want to do is retrieve all objects that share a tree node with a given object. To do this, I traverse all tree nodes, and if they contain the given index, I add all of their other indices to an ordered list. This is efficient because the indices within each node are already ordered, so finding out if each index is already in the list is fast. However, the list ends up having to be resized, and this takes up most of the time in the algorithm. So what I need is some kind of tree-like data structure that will allow me to efficiently add ordered data, and also be efficient in memory. Any suggestions?

    Read the article

  • PHP, MySQL - would results-array shuffle be quicker than "select... order by rand()"?

    - by sombe
    I've been reading a lot about the disadvantages of using "order by rand" so I don't need update on that. I was thinking, since I only need a limited amount of rows retrieved from the db to be randomized, maybe I should do: $r = $db->query("select * from table limit 500"); for($i;$i<500;$i++) $arr[$i]=mysqli_fetch_assoc($r); shuffle($arr); (i know this only randomizes the 500 first rows, be it). would that be faster than $r = $db->("select * from table order by rand() limit 500"); let me just mention, say the db tables were packed with more than...10,000 rows. why don't you do it yourself?!? - well, i have, but i'm looking for your experienced opinion. thanks!

    Read the article

  • Is it possible to get a graphical representation of gprof results?

    - by Werner
    Hi, I am interested in getting the profiling of some number crunching program. I compiled it with -g and -pg options and linked it and got it gmon.out. After reading the info (plain text) it looks a bit ugly. I wonder if there are some open source tools for getting a graphical representation of the 10 functions where the program spends the most of the time as well as a flux diagram. Thanks

    Read the article

  • Will MySQL full-text-search return the results I need?

    - by mike
    I have a keyword field with a list of 5 keywords for each item. example below: 2008, Honda, Accord, Used, Car Will MySQL full text return the item above for the following search requests? 2008 Honda Accord Honda Accord Used Car If so, how well will this hold up when searching through fifty thousand plus records?

    Read the article

  • how to use the results of a method in another method in a different class initialization at vb.net

    - by singgih
    I have a class which has the following methods: Public Function rumusbuffer () As Decimal buffer = (ukuranblok - pntrblok) / (ukrnrecord + pntrblok) Return buffer End Function Public Function rumusW () As Decimal interblock = pntrblok + ((pntrblok + intrblok) / buffer) Return interblock End Function how can I make the buffer can be used on its function rumusw but different forms so that her class should be re-initialization .. but the calculation method can rumusbuffer rumusw d use in the method?

    Read the article

< Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >