Search Results

Search found 2229 results on 90 pages for 'conditions'.

Page 59/90 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • SQL query sample

    - by qods
    Hi, my table is look like this order.. I would like count the TermID's with these conditions; If it's possible also want to get resultset with these headers - TermID must have close or open status - TermID Status must turn to Open (close to open) - Status Date (open status) must be bigger date than close status date with my regards, ID TermID Status Date 103990107 103641 Close 28/05/2010 104000600 103641 Open 31/05/2010 103980976 106458 Close 26/05/2010 103990045 106458 Open 27/05/2010 103939537 106475 Open 18/05/2010 103908130 117220 Open 13/05/2010 103929653 117220 Open 13/05/2010 103999017 117360 Open 31/05/2010 103834814 117402 Open 05/05/2010 103993973 117420 Open 28/05/2010 103849795 119377 Close 05/05/2010 103955266 119377 Close 21/05/2010 103995229 119377 Close 29/05/2010 103979873 119704 Open 25/05/2010 103832225 119767 Open 04/05/2010 103925429 123229 Close 15/05/2010 103986986 123932 Open 27/05/2010

    Read the article

  • How to use TestAndSet() for solving the critical section problem?

    - by Dan Mantyla
    I'm studying for an exam and I'm having difficulty with a concept. This is the pseudo code I am given: int mutex = 0; do { while (TestAndSet(&mutex)); // critical section mutiex = 0; // remainder section } while (TRUE); My instructor says that only two of the three necessary conditions (mutual exclusion, progress, and bounded waiting) are met with this code, but I don't understand which one isn't being met...?? How should the code be modified to support the missing condition to solve the critical region problem? Thanks in advance for any insight!

    Read the article

  • applying a var to an if statement jquery

    - by Dirty Bird Design
    Need to apply a var to a statement if its conditions are met, this syntax isn't throwing errors but its not working. <script type="text/javascript"> $(document).ready(function(){ var action_is_post = false; //stuff here $(this).ready(function () { if ($("#stepDesc0").is(".current")) { action_is_post = true; } }); //stuff here </script> should I use something other than .ready? Do I even need the $(this).ready(function ()... part? I need it to apply the var when #stepDesc0 has the class current.

    Read the article

  • Activate thread synchronically

    - by mayap
    Hi All, I'm using .Net 4.0 parallel library. The tasks I execute, ask to run some other task, sometimes synchronically and somethimes asynchronically, dependending on some conditions which are not known in advanced. For async call, i simply create new tasks and that's it. I don't know how to handly sync call: how to run it from the same thread, maybe that sync tasks will also ask to execute sync tasks recursively. all this issue is pretty new to me. thanks in advance.

    Read the article

  • Quick-sort doesn't work with middle pivot element

    - by Bobby
    I am trying to sort an array of elements using quick-sort algorithm.But I am not sure where am I going wrong.I choose the middle element as pivot every time and then I am checking the conditions.Here is my code below. void quicksort(int *temp,int p,int r) { if(r>p+1) { int mid=(p+r)/2; int piv=temp[mid]; int left=p+1; int right=r; while(left < right) { if(temp[left]<=piv) left++; else swap(&temp[left],&temp[--right]); } swap(&temp[--left],&temp[p]); quicksort(temp,p,left); quicksort(temp,right,r); } }

    Read the article

  • OpenGL "out of memory" on glReadPixels()

    - by spurserh
    Hello, I am running into an "out of memory" error from OpenGL on glReadPixels() under low-memory conditions. I am writing a plug-in to a program that has a robust heap mechanism for such situations, but I have no idea whether or how OpenGL could be made to use it for application memory management. The notion that this is even possible came to my attention through this [albeit dated] thread on a similar issue under Mac OS X: http://lists.apple.com/archives/Mac-opengl/2001/Sep/msg00042.html I am using Windows XP, and have seen it on multiple NVidia cards. I am also interested in any work-arounds I might be able to relay to users (the thread mentions "increasing virtual memory"). Thanks, Sean

    Read the article

  • Global variables in hadoop.

    - by Deepak Konidena
    Hi, My program follows a iterative map/reduce approach. And it needs to stop if certain conditions are met. Is there anyway i can set a global variable that can be distributed across all map/reduce tasks and check if the global variable reaches the condition for completion. Something like this. While(Condition != true){ Configuration conf = getConf(); Job job = new Job(conf, "Dijkstra Graph Search"); job.setJarByClass(GraphSearch.class); job.setMapperClass(DijkstraMap.class); job.setReducerClass(DijkstraReduce.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(Text.class); } Where condition is a global variable that is modified during/after each map/reduce execution.

    Read the article

  • Faking a Single Address Space

    - by dsimcha
    I have a large scientific computing task that parallelizes very well with SMP, but at too fine grained a level to be easily parallelized via explicit message passing. I'd like to parallelize it across address spaces and physical machines. Is it feasible to create a scheduler that would parallelize already multithreaded code across multiple physical computers under the following conditions: The code is already multithreaded and can scale pretty well on SMP configurations. The fact that not all of the threads are running in the same address space or on the same physical machine must be transparent to the program, even if this comes at a significant performance penalty in some use cases. You may assume that all of the physical machines involved are running operating systems and CPU architectures that are binary compatible. Things like locks and atomic operations may be slow (having network latency to deal with and all) but must "just work".

    Read the article

  • How to get the url of the page which is currently loading i the iframe

    - by Gayathri
    Hi, I have an requirement that, in my application on clicking an button i have to laod one more application with the same template which i was using for my application. So, on clicking the button in my application i have used one intermediate page in that using iframe i passed that URL of an external application. Its working fine. But the problem is in the external applicatio which is not in my control on clicking an button it is moving to next page. In that page i want to hide an button. I did that also using div tag color as white and set the positions. But the problem is in all the pages in the same position that is affecting. So i want to get the url of the page which is loading in the iframe on the second or third click of an external application, so that i can using some conditions i can hide the control. So please any one help me to get the solution for this problem

    Read the article

  • Stringification of a macro value

    - by SF.
    I faced a problem - I need to use a macro value both as string and as integer. #define RECORDS_PER_PAGE 10 /*... */ #define REQUEST_RECORDS \ "SELECT Fields FROM Table WHERE Conditions" \ " OFFSET %d * " #RECORDS_PER_PAGE \ " LIMIT " #RECORDS_PER_PAGE ";" char result_buffer[RECORDS_PER_PAGE][MAX_RECORD_LEN]; /* ...and some more uses of RECORDS_PER_PAGE, elsewhere... */ This fails with a message about "stray #", and even if it worked, I guess I'd get the macro names stringified, not the values. Of course I can feed the values to the final method ( "LIMIT %d ", page*RECORDS_PER_PAGE ) but it's neither pretty nor efficient. It's times like this when I wish the preprocessor didn't treat strings in a special way and would process their content just like normal code. For now, I cludged it with #define RECORDS_PER_PAGE_TXT "10" but understandably, I'm not happy about it. How to get it right?

    Read the article

  • identify the input that is multiple of 11 and odd or even java

    - by Bolor Ch
    i am trying to write code to determine the nature of input using if statement only. The nature of input could be following: a multiple of 11 even or odd. For the code below, when I enter my input, it does not display the result as "input:NOT:ODD". Also how can I check multiple conditions with if statement? (else is not considered) import java.util.Scanner; public class test { public static void main( String args[] ) { Scanner input = new Scanner( System.in ); int x; int EO; int Mult; System.out.print ( "Enter value: " ); x = input.nextInt(); EO = x % 2; Mult = x % 11; if (EO > 0 && Mult > 0) { System.out.printf ("%d:NOT:ODD"); } } }

    Read the article

  • Shell script exiting the loop after calling another script

    - by Johnyy
    Hi Guys, I have a shell script s1 calling another script s2 in a loop. However s1 can not seem to continue the loop after s2 returns. Commenting out the line that calls s2 will enable the loop to continue. s2 does copy of one file, s1 checks conditions and copy several files using s2. Can anyone give a pointer what is going on here? ... while read line s2 param1 param2 param3 echo "copy done" done < $tempfile echo "out of loop" ... "copy done" is printed, so is "out of loop"

    Read the article

  • Is there a way to determine gaps in try/catch coverage?

    - by Mike Pateras
    I'm debugging a service that's experiencing some problems on start-up. To aid me in this, I'm wrapping pretty much everything in a try/catch block, and writing any errors to a file. I don't want to put them in every method, I just want to put them in the highest level methods so that they catch exceptions from other methods. Something is getting through, though, as the service does stop under some conditions. Is there a way to determine where the gaps in my try/catch coverage are, other than by sight?

    Read the article

  • Is there a way to launch an aggressive and complete garbage collection in Java?

    - by Gnoupi
    For memory optimization reasons, I'm launching myself the garbage collector during profiling, to check if objects are correctly cleaned after disposing of them. The call to garbage collector is not enough, though, and it seems that there is no guarantee of what it will clean. Is there a way to call it, to be sure it will recover as much as it can, in profiling conditions (this would have no point in production, of course)? Or is "calling it several times" the only way to be "almost sure"? Or did I simply misunderstand something about the Garbage Collector?

    Read the article

  • Advanced find in Rails

    - by jriff
    Hi all I really suck at Rails' finders besides the most obvious. I always resort to SQL when things get more advanced than Model.find(:all, :conditions => ['field>? and field<? and id in (select id from table)', 1,2]) I have this method: def self.get_first_validation_answer(id) a=find_by_sql(" select answers.*, answers_registrations.answer_text from answers_registrations left join answers on answers_registrations.answer_id=answers.id where (answers_registrations.question_id in (select id from questions where validation_question=true)) and (sale_registration_id=#{id}) limit 1 ").first a.answer_text || a.text if a end Can someone create a find method that gets me what I want? Regards, Jacob

    Read the article

  • Return from parent sub in Perl

    - by JS Bangs
    I want to write a subroutine which causes the caller to return under certain conditions. This is meant to be used as a shortcut for validating input to a function. What I have so far is: sub needs($$) { my ($condition, $message) = @_; if (not $condition) { print "$message\n"; # would like to return from the *parent* here } return $condition; } sub run_find { my $arg = shift @_; needs $arg, "arg required" or return; needs exists $lang{$arg}, "No such language: $arg" or return; # etc. } The advantage of returning from the caller in needs would then be to avoid having to write the repetitive or return inside run_find and similar functions.

    Read the article

  • Ternary Operators in JavaScript Without an "Else"

    - by Oscar Godson
    I've been using them forever, and I love them. To me they see cleaner and i can scan faster, but ever since I've been using them i've always had to put null in the else conditions that don't have anything. Is there anyway around it? E.g. condition ? x=true : null ; basically, is there a way to do: condition ? x=true; Now it shows up as a syntax error...

    Read the article

  • C semaphores: sem_wait throwing inexplicable error

    - by tocapa
    I'm working on a problem which we have to use semaphores to solve. I have an array which contains two semaphores, gsem, and given certain conditions call sem_wait(&(gsem[me])), which is supposed to waiting until that particular process is woken up. However, for some reason it gives me the error Bad file descriptor. I looked up sem_wait and the Open Group spec says this is not an error sem_wait can cause. This is making my whole program crazy and I have no idea why this is failing.

    Read the article

  • Left outer joins that don't return all the rows from T1

    - by Summer
    Left outer joins should return at least one row from the T1 table if it matches the conditions. But what if the left outer join performs a join successfully, then finds that another criterion is not satisfied? Is there a way to get the query to return a row with T1 values and T2 values set to NULL? Here's the specific query, in which I'm trying to return a list of candidates, and the user's support for those candidates IF such support exists. SELECT c.id, c.name, s.support FROM candidates c LEFT JOIN support s on s.candidate_id = c.id WHERE c.office_id = 5059 AND c.election_id = 92 AND (s.user_id = 2 OR s.user_id IS NULL) --This line seems like the problem ORDER BY c.last_name, c.name The query joins the candidates and support table, but finds that it's a different user who supported this candidate (user_id=3, say). Then the candidate disappears entirely from the result set.

    Read the article

  • Are these 2 sql queries equivalent in all respects (e.g. estimated and actual execution plan)?

    - by Xerion
    Are query 1) == 2) in terms of estimated query plan AND actual plan? (can statistics affect the actual plan here, ever?) declare @cat int -- input param from prc ... 1) select * from A as a join B as b on b.id = a.id on b.cat = @cat join C as c on c.fid = b.fid on c.cat = @cat where a.cat = @cat 2) select * from A as a join B as b on b.id = a.id on b.cat = a.cat join C as c on c.fid = b.fid on c.cat = b.cat where a.cat = @cat It seems to me that these should logically be equivalent and the execution plan should always be the same regardless of actual difference in tables. And adding more conditions either in join, or where, or add more tables to join shouldn't change this. Are there cases this is not true?

    Read the article

  • Rails find by *all* associated tags.id in

    - by mark
    Hi Say I have a model Taggable has_many tags, how may I find all taggables by their associated tag's taggable_id field? Taggable.find(:all, :joins => :tags, :conditions => {:tags => {:taggable_id => [1,2,3]}}) results in this: SELECT `taggables`.* FROM `taggables` INNER JOIN `tags` ON tags.taggable_id = taggables.id WHERE (`tag`.`taggable_id` IN (1,2,3)) The syntax is incredible but does not fit my needs in that the resulting sql returns any taggable that has any, some or all of the tags. How can I find taggables with related tags of field taggable_id valued 1, 2 and 3? Thanks for any advice. :)

    Read the article

  • Subsonic: Select on a View, locks the table update?

    - by Jay
    Hi, I have a Web site live and running now. I am using the Subsonic to handle the database connections etc. I am getting time out expired error while updating a table (say Employee). When I check sp_who2, I see the suspended connection for the PID which is updating with a block by anothor pid, so I run the profiler and found out when ever this suspended connection occur, the blocked pid is a select statement on the view (say ActiveEmployees, which is the same as the table but with some where conditions). Anyone know why a Select statement on the view could cause failure in update. If it is other (like select fails due to update) may be reasonable. Is there any way for me to make select on a view without locking the table? PS: I am using the Sql server 2005 and subsonic 2.2. Thanks

    Read the article

  • Select from multiple tables in Rails - Has Many "articles" through [table_1, table_2]?

    - by viatropos
    I'm in a situation where I need to get all articles that are tied to a User through 2 tables: article_access: gives users privilege to see an article article_favorites: of public articles, users have favorited these So in ActiveRecord you might have this: class User < ActiveRecord::Base has_many :article_access_tokens has_many :article_favorites def articles unless @articles ids = article_access_tokens.all(:select => "article_id").map(&:article_id) + article_favorites.all(:select => "article_id").map(&:article_id) @articles = Article.send(:scoped, :conditions => {:id => ids.uniq}) end @articles end end That gives me basically an articles association which reads from two separate tables. Question is though, what's the right way to do this? Can I somehow make 1 SQL SELECT call to do this?

    Read the article

  • When can we mock an object and its methods?

    - by Shailendra
    I am novice to the Moq and unit testing. I have to write unit tests to a lot of classes which has the objects of other classes. can i mock the methods of the class objects. Here is the exact scenerio- I have a class two classes A and B and A has a private object of B and in a method of A i am internally calling the method of B and then doing some calculation and returning the result. Can i mock the method of B in this scenerio? Please try to give me full detail about the conditions where i can mock the methods and functions of the class. Thanx

    Read the article

  • Using pthread condition variable with rwlock

    - by Doomsday
    Hello, I'm looking for a way to use pthread rwlock structure with conditions routines in C++. I have two questions: First: How is it possible and if we can't, why ? Second: Why current POSIX pthread have not implemented this behaviour ? To understand my purpose, I explain what will be my use: I've a producer-consumer model dealing with one shared array. The consumer will cond_wait when the array is empty, but rdlock when reading some elems. The producer will wrlock when adding(+signal) or removing elems from the array. The benefit of using rdlock instead of mutex_lock is to improve performance: when using mutex_lock, several readers would block, whereas using rdlock several readers would not block.

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >