Search Results

Search found 27946 results on 1118 pages for 'output buffer empty'.

Page 107/1118 | < Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >

  • Permuting output of a tree of closures

    - by yan
    This a conceptual question on how one would implement the following in Lisp (assuming Common Lisp in my case, but any dialect would work). Assume you have a function that creates closures that sequentially iterate over an arbitrary collection (or otherwise return different values) of data and returns nil when exhausted, i.e. (defun make-counter (up-to) (let ((cnt 0)) (lambda () (if (< cnt up-to) (incf cnt) nil)))) CL-USER> (defvar gen (make-counter 3)) GEN CL-USER> (funcall gen) 1 CL-USER> (funcall gen) 2 CL-USER> (funcall gen) 3 CL-USER> (funcall gen) NIL CL-USER> (funcall gen) NIL Now, assume you are trying to permute a combinations of one or more of these closures. How would you implement a function that returns a new closure that subsequently creates a permutation of all closures contained within it? i.e.: (defun permute-closures (counters) ......) such that the following holds true: CL-USER> (defvar collection (permute-closures (list (make-counter 3) (make-counter 3)))) CL-USER> (funcall collection) (1 1) CL-USER> (funcall collection) (1 2) CL-USER> (funcall collection) (1 3) CL-USER> (funcall collection) (2 1) ... and so on. The way I had it designed originally was to add a 'pause' parameter to the initial counting lambda such that when iterating you can still call it and receive the old cached value if passed ":pause t", in hopes of making the permutation slightly cleaner. Also, while the example above is a simple list of two identical closures, the list can be an arbitrarily-complicated tree (which can be permuted in depth-first order, and the resulting permutation set would have the shape of the tree.). I had this implemented, but my solution wasn't very clean and am trying to poll how others would approach the problem. Thanks in advance.

    Read the article

  • Array Intersect giving wrong output

    - by Pankaj Khurana
    Hi, I need to find common elements between two arrays. My code is: $sql="SELECT DISTINCT fk_paytbl_discounts_discountid as discountid from paytbl_discounts_students WHERE fk_vtiger_cf_601='".$categoryid."'"; $discountstudentinfo=$objdb->customQuery($sql,false); $sql1="SELECT DISTINCT fk_paytbl_discounts_discountid as discountid from paytbl_discounts_variants WHERE fk_vtiger_products_productid='".$variantid."'"; $discountvariantinfo=$objdb->customQuery($sql1,false); $commondiscount=array_intersect($discountvariantinfo,$discountstudentinfo); First array Array ( [0] => Array ( [discountid] => 2 ) [1] => Array ( [discountid] => 8 ) [2] => Array ( [discountid] => 5 ) [3] => Array ( [discountid] => 4 ) ) Second array Array ( [0] => Array ( [discountid] => 1 ) [1] => Array ( [discountid] => 5 ) ) Common array Array ( [0] => Array ( [discountid] => 1 ) [1] => Array ( [discountid] => 5 ) ) Common array should have only discountid 5 but its showing 1 also. Please help me on this Thanks

    Read the article

  • Output error in comparing characters from two strings

    - by Andrew Martin
    I'm stuck with my a piece of code I'm creating. My IDE is Eclipse and when I use its debugging feature, to trace what's happening on each line, it outputs perfectly. However, when I click the "run" project, it just outputs a blank screen: public static void compareInterests(Client[] clientDetails) { int interests = 0; for (int p = 0; p < numberOfClients; p++) { for (int q = 0; q < numberOfClients; q++) { String a = clientDetails[p].getClientInterests(); String b = clientDetails[q].getClientInterests(); int count = 0; while (count < a.length()) { if (a.charAt(count) == b.charAt(count)) interests++; count++; } if ((interests >= 3) && (clientDetails[p].getClientName() != clientDetails[q].getClientName())) System.out.print (clientDetails[p].getClientName() + " is compatible with " + clientDetails[q].getClientName()); interests = 0; } } } The code is designed to import an object array which contains information on a client's name and a client's interests. The client's interests are stored in the format "01010", where each 1 means they are interested in that activity, each 0 means they are not. My code compares each character of every client's string with every other client's string and outputs the results for all client's that don't have the same name and have three or more interests in common. When I run this code through Java's debugger, it outputs fine - but when I click run project or compile, I just get a blank screen. Any ideas?

    Read the article

  • Trace output not getting logged in output file at times.

    - by Mini
    I'm using TextWriterTraceListener to log error messages to a text file.The TraceOutputFile has been mentioned in the web.config file as "trace.log.txt". The error messages are getting logged to the trace.log.txt. But at times I notice that some files are getting generated randomly under root folder with the exception details instead of logging to the trace.log.txt. This is not happening in any particular page and hence I am unable to detect the reason as to why these files are getting generated.Ex:14dbc20a-9eb8-4fec-b6bd-54400db2ceatrace.log.txt . Can u suggest me any circumstances when this might happen?

    Read the article

  • cygwin g++ produces no output

    - by fred basset
    I just installed g++ from cygwin, when I try to compile a C++ file I am not getting any executable produced by the compiler, see example below. What's going wrong? Directory of C:\helloworld 01/02/2011 04:50 PM . 01/02/2011 04:50 PM .. 01/02/2011 04:48 PM 94 helloworld.cpp 1 File(s) 94 bytes 2 Dir(s) 24,658,272,256 bytes free C:\helloworldg++-4 helloworld.cpp C:\helloworlddir Volume in drive C is OS Volume Serial Number is C47B-942D Directory of C:\helloworld 01/02/2011 04:50 PM . 01/02/2011 04:50 PM .. 01/02/2011 04:48 PM 94 helloworld.cpp 1 File(s) 94 bytes 2 Dir(s) 24,657,747,968 bytes free C:\helloworld

    Read the article

  • How to achieve to following C++ output formatting?

    - by Yan Cheng CHEOK
    I wish to print out double as the following rules : 1) No scietific notation 2) Maximum decimal point is 3 3) No trailing 0. For example : 0.01 formated to "0.01" 2.123411 formatted to "2.123" 2.11 formatted to "2.11" 2.1 formatted to "2.1" 0 formatted to "0" By using .precision(3) and std::fixed, I can only achieve rule 1) and rule 2), but not rule 3) 0.01 formated to "0.010" 2.123411 formatted to "2.123" 2.11 formatted to "2.110" 2.1 formatted to "2.100" 0 formatted to "0" Code example is as bellow : #include <iostream> int main() { std::cout.precision(3); std::cout << std::fixed << 0.01 << std::endl; std::cout << std::fixed << 2.123411 << std::endl; std::cout << std::fixed << 2.11 << std::endl; std::cout << std::fixed << 2.1 << std::endl; std::cout << std::fixed << 0 << std::endl; getchar(); } any idea?

    Read the article

  • Trouble recording unique regex output to array in perl

    - by Structure
    The goal of the following code sample is to read the contents of $target and assign all unique regex search results to an array. I have confirmed my regex statement works so I am simplifying that so as not to focus on it. When I execute the script I get a list of all the regex results, however, the results are not unique which leads me to believe that my manipulation of the array or my if (grep{$_ eq $1} @array) { check is causing a problem(s). #!/usr/bin/env perl $target = "string to search"; $inc = 0; $once = 1; while ($target =~ m/(regex)/g) { #While a regex result is returned if ($once) { #If $once is not equal to zero @array[$inc] = $1; #Set the first regex result equal to @array[0] $once = 0; #Set $once equal to zero so this is not executed more than once } else { if (grep{$_ eq $1 } @array ) { #From the second regex result, check to see if the result is already in the array #If so, do nothing } else { @array[$inc] = $1; #If it is not, then assign the regex search result to the next unused position in the array in any position. $inc++; #Increment to next unused array position. } } } print @array; exit 0;

    Read the article

  • submit button on html to output result on same page

    - by amateur
    Hi, Although this seems like something very basic, but no matter what I tried I couldn't get my head around it. Basically I want a html form where a user types in their ID number in an input text box and when they hit the submit button it displays their email address which is their company ID number @ company.com, such as below <form action=""> ID Number: <input type="text" name="idnumber" /><br/> <input type="submit" value="Whats my email address" /> </form> <p>Your email address is 'idnumber'@email.com</p> Can this even be done using html or would I need to use Javascript or PHP for it? Thanks

    Read the article

  • Perl parsing ps fwaux output

    - by Magic Hat
    I am trying to figure out children processes of a given parent from ps fwaux (there may very well be a better way to do this). Basically, I have daemons running that may or may not have a child process running at any given time. In another script I want to check if there are any child processes, and if so do something. If not, error out. ps fwaux|grep will show me the tree, but I'm not exactly sure what to do with it. Any suggestions would be great.

    Read the article

  • Rails3 - will_paginate plugin strange output

    - by Sam
    I have the will_paginate plugin working in an application, but when I paginate a resource it just spits out the HTML as text, doesn't provide links to the next pages and such. And when I manually type in the URL the plugin is working it just doesn't make <%= will_paginate @products %> into links such as next 1 2 3 ... last Ideas?

    Read the article

  • Loop through Array with conditional output based on key/value pair

    - by Daniel C
    I have an array with the following columns: Task Status I would like to print out a table that shows a list of the Tasks, but not the Status column. Instead, for Tasks where the Status = 0, I want to add a tag <del> to make the completed task be crossed out. Here's my current code: foreach ($row as $key => $val){ if ($key != 'Status') print "<td>$val</td>"; else if ($val == '0') print "<td><del>$val</del></td>"; } This seems to be correct, but when I print it out, it prints all the tasks with the <del> tag. So basically the "else" clause is being run every time. Here is the var_dump($row): array 'Task' => string 'Task A' (length=6) 'Status' => string '3' (length=1) array 'Task' => string 'Task B' (length=6) 'Status' => string '0' (length=1)

    Read the article

  • Maven exec bash script and save output as property

    - by djechlin
    I'm wondering if there exists a Maven plugin that runs a bash script and saves the results of it into a property. My actual use case is to get the git source version. I found one plugin available online but it didn't look well tested, and it occurred to me that a plugin as simple as the one in the title of this post is all I need. Plugin would look something like: <plugin>maven-run-script-plugin> <phase>process-resources</phase> <!-- not sure where most intelligent --> <configuration> <script>"git rev-parse HEAD"</script> <!-- must run from build directory --> <targetProperty>"properties.gitVersion"</targetProperty> </configuration> </plugin> Of course necessary to make sure this happens before the property will be needed, and in my case I want to use this property to process a source file.

    Read the article

  • can list be converted into string

    - by PARIJAT
    Actually i have extracted some data from the file and want to write it in the file 2 but the program says 'sequence item 1: expected string, list found', I want to know how i can convert buffer[] ie string into sequence, so that it could be saved in file 2...I am new to the python please help* file = open('/ddfs/user/data/k/ktrip_01/hmm.txt','r') file2 = open('/ddfs/user/data/k/ktrip_01/hmm_write.txt','w') buffer = [] rec = file.readlines() for line in rec : field = line.split() print '>',field[0] term = field[0] buffer.append(term) print field[1], field[2], field[6], field[12] term1 = field [1] buffer.append(term1) term2 = field[2] buffer.append[term2] term3 = field[6] buffer.append[term3] term4 = field[12] buffer.append[term4] file2.write(buffer) file.close() file2.close()

    Read the article

  • formatting fgetcsv output

    - by Patrick
    Im trying to figure out how to take the data returned by fgetcsv, and format it into a readable/editable table, and then use fputcsv to save that table so far i have this <?php $row = 1; $handle = fopen("csv.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "\n"; } } fclose($handle); ?>

    Read the article

  • Output of Iterable.sliding as Tuple

    - by ziggystar
    The method sliding on collections returns a sliding window of given size in the form of X[Iterable[A]] with X being the type of the collection and A the element type. Often I need two or three elements and I prefer to have them named. One ugly workaround for sliding(2) is the following: points.sliding(2).foreach{ twoPoints => val (p1,p2) = (twoPoints.head,twoPoints.last) //do something } This sucks and only works for two elements. Also note that (a,b) = (twoPoints(0),twoPoints(1)) doesn't work. Help me!

    Read the article

  • Parsing html output and executing javascript

    - by user1841964
    I have this function: function parseScript(_source) { var source = _source; var scripts = new Array(); while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) { var s = source.indexOf("<script"); var s_e = source.indexOf(">", s); var e = source.indexOf("</script", s); var e_e = source.indexOf(">", e); scripts.push(source.substring(s_e+1, e)); source = source.substring(0, s) + source.substring(e_e+1); } for(var i=0; i<scripts.length; i++) { try { eval(scripts[i]); } catch(ex) { } } return source; } It parses and execute Javascript wonderfully except the when in <script type='text/javascript' src='scripts/gen_validatorv31.js'></script> the src file never gets executed.

    Read the article

  • What does this java output mean?!

    - by Phil
    public class Arrys { private int[] nums; //Step 3 public Arrys (int arrySize) { nums = new int[arrySize]; } public int [] getNums (){ return nums; } } Test class: public class TestArrys { public static void main(String args[]) { //Step 4 Arrys arry = new Arrys(10); System.out.println("\nStep4 "); for(int index = 0; index < arry.getNums().length; index++) { System.out.print(arry.getNums()); } } } It's incredibly simple, that is why I think I'm doing something fundamentally wrong. All I want is to display the value of the array. This is what I get back. I am totally lost, there is nothing in my book that explains this nor does googling it help. Step4 [I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440

    Read the article

  • CVS Diff to output only modified files?

    - by Somebody still uses you MS-DOS
    Is it possible? Run a cvs diff in terminal at the project root that outputs only modified files (like local files that aren't in source control and local modified files). I'm running cvs diff --brief but I still have too many results since my project is large, and with a lot of subdirectories - it shows the whole hierarchy and I just want to know which files are different from HEAD revision. I'm using Linux.

    Read the article

  • Strange output produced by program

    - by Boom_mooB
    I think that my code works. However, it outputs 01111E5, or 17B879DD, or something like that. Can someone please tell me why. I am aware that I set the limit of P instead of 10,001. My code is like that because I start with 3, skipping the prime number 2. #include <iostream> bool prime (int i) { bool result = true; int isitprime = i; for(int j = 2; j < isitprime; j++) ///prime number tester { if(isitprime%j == 0) result = false; } return result; } int main (void) { using namespace std; int PrimeNumbers = 1; int x = 0; for (int i = 3 ; PrimeNumbers <=10000; i++) { if(prime(i)) { int prime = i; PrimeNumbers +=1; } } cout<<prime<<endl; system ("pause"); return 0; }

    Read the article

  • How to log SQL output to text file on client from C#

    - by Rob Packwood
    I have a large auditing stored procedure that prints values and runs some SELECT statements. When running within SQL Management Studio we have the use select to display "Results to Text" so all of the SQL results and print statement display in one place. Now I need to have some C# code also call this auditing procedure at the end of the process and basically store all data that would be in the "Results to Text" window into a .txt file. How can this be done?

    Read the article

  • One input file to multiple output files

    - by user1265669
    I found some helpful stuff on this site but my input file is different from the examples already posted and I cannot make the leap in an efficient manner. My input file looks like this: sample_dude data1 data2 data3 data4 sample_lady data5 data6 data7 data8 sample_dude data9 data10 data11 data12 sample_child data13 data14 data15 data16 I want to create a separate file for each sample with all the data columns. For example, one file would be called sample_dude.txt and look like this: data1 data2 data3 data4 data9 data10 data11 data12 There is an unknown number of samples but always just four data columns. Any help greatly appreciated. Thank you. PS: I'm trying to do this in python.

    Read the article

< Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >