Search Results

Search found 2199 results on 88 pages for 'printing'.

Page 68/88 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • Is it faster to count down than it is to count up?

    - by Bob
    Our computer science teacher once said that for some reason it is more efficient to count down that count up. For example if you need to use a FOR loop and the loop index is not used somewhere (like printing a line of N * to the screen) I mean that code like this : for (i=N; i>=0; i--) putchar('*'); is better than: for (i=0; i<N; i++) putchar('*'); Is it really true? and if so does anyone know why?

    Read the article

  • Examples of both beautiful and ugly java code?

    - by tputkonen
    I would like to demonstrate how difficult it is for a layman to identify high quality code from flawed code. I'm thinking of doing this with the help of two java methods. Both of the methods should look like they do the same, pretty simple thing. However one of them should have several kind of flaws, for example: iteration with array off by one error string concatenations causing lots of objects to be created (as opposed to StringBuffer in the "good" code, which looks more complicated) possibly null pointer exception (but it should not be trivial to spot) Those are just some examples, all kinds of other issues including bugs and performance related structures are highly appreciated. Methods should be around 10-20 lines of length, and the task they do should be something simple - preferably printing something in an iteration.

    Read the article

  • parsing Two-dimensional array in c

    - by gitter78
    I'm trying to parse an array that looks like the one below: char *arr[][2] = { { "1", "Purple" }, { "2", "Blue" }, { "22", "Red" }, ... }; I was thinking having a loop as: char *func(char *a){ for(i = 0; i<sizeof(arr)/sizeof(arr[0]);i++){ if(strstr(a,arr[i][0])!=NULL) return arr[i][1]; } } char *out; const char *hello = "this is my 2 string"; out = func(hello); In this case, I'm trying to get the second value based on the first one: Purple, Blue Red, etc.. The question is how would go in parsing this and instead of printing out the value, return the value. UPDATE/FIXED: It has been fixed above. Thanks

    Read the article

  • jquery-ui - position of a list item when starting drag and drop?

    - by user246114
    Hi, I am using the jquery-ui library. I have two sortables. I want to know the index of the dragged source item. I have something like this: $(function() { $("#sortable1, #sortable2").sortable({ connectWith: '.connectedSortable' }).disableSelection(); $("#sortable1").sortable({ start: function(event, ui) { alert(ui.position); } }); }); if I'm reading the docs correctly, then ui.position should be what I want?: ui.position - current position of the helper but when I jsut try printing it: alert(ui.position) it seems to be empty. I am doing all of this in an attempt to emulate cloning. docs: http://jqueryui.com/demos/sortable/#event-activate Thanks

    Read the article

  • can the keyword 'this' be used in an abstract class in java

    - by Reddy
    I tried with below example, it is working fine. I expected it to pick sub-class's value since object won't be created for super class (as it is abstract). But it is picking up super class's field value only. Please help me understand what is the concepts behind this? abstract class SuperAbstract { private int a=2; public void funA() { System.out.println("In SuperAbstract: this.a "+a); } } class SubClass extends SuperAbstract { private int a=34; } I am calling new SubClass.funA(); I am expecting it to print 34, but it is printing 2.

    Read the article

  • variable=@value@ in Makefiles

    - by user1447110
    I understand that @ suppresses printing of a command in a Makefile... http://www.gnu.org/software/make/manual/make.html#Echoing ... and I understand that $@ is the target name... http://www.gnu.org/software/make/manual/make.html#Automatic-Variables ... but I can't find any information on what a line like this might mean: variable=@value@ I'm not trying to fix anything here, just trying to better understand Makefiles. Update: The "Makefile Subsitutions" section of the GNU autoconf manual explains that it's a value that is substituted by autoconf.

    Read the article

  • Why do i get segfault at the end of the application after everything's beed done properly ?

    - by VaioIsBorn
    #include <string.h> #include <stdlib.h> #include <stdio.h> int main(void) { unsigned char *stole; unsigned char pass[] = "m4ak47"; printf("Vnesi password: \t"); scanf("%s", stole); if(strncmp(stole, pass, sizeof(pass)) != 0) { printf("wrong password!\n"); exit(0); } else printf("Password correct\n"); printf("some stuf here...\n\n"); return 0; } This program is working nice, but with one problem - if the password is correct then it DOES do the printing of 'some stuf here...' but it also shows me segmentation fault error at the end. Why ?

    Read the article

  • Selenium selected option in dropdown not displayed correctly

    - by luckyfool
    I have the following issue with Selenium Webdriver. There are two dropdown menus on a page i am testing "brand" and "items". The options of "items" depend on which brand you choose. I am trying to iterate through all possible choices and print brand-item pairs. I use two possible ways to pick an option from each dropdown menu Using Select(): def retryingSelectOption(name,n): result=False attempts=0 while attempts<5: try: element=Select(driver.find_element_by_name(name)) element.select_by_index(n) print element.all_selected_options[0].text result=True break except StaleElementReferenceException: pass attempts+=1 return result And using .click(): def retryingClickOption(name,n): result=False attempts=0 while attempts<5: try: driver.find_element_by_name(name).find_elements_by_tag_name("option")[n].click() result=True break except StaleElementReferenceException: pass attempts+=1 return result My problem is that at ,what seem to me as random moments (sometimes it works sometimes it does not), even though the above functions return True and printing out the selected option shows me the correct answer, the browser still displays the previous option. So basically Selenium tells me i have picked the right option but the browser displays the previous one.No idea what is wrong.

    Read the article

  • Django naturaltime Localization error

    - by Edwin Lunando
    My language ID is 'id'. I used localized humanize library for my Django template tags and use the naturaltime, but the translation is partially wrong. The now translated to sekarang is right. second to detik. minute to menit, but when it comes to date, week, or months, the word is not translated to my language. It keeps printing date, week, and months. Here are my Django configuration TIME_ZONE = 'Asia/Jakarta' LANGUAGE_CODE = 'id' SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = True Here how I used the naturaltime template tags. <time class="discussion__info__item">{{ object.created|naturaltime }}</time> Do I forgot something? Thank you.

    Read the article

  • How to Split a Big Postscript file (3000 pages) into one individual file per page (using Windows 7)?

    - by Pablo
    Hi, I'm having trouble doing the following: I have a big PDF file that I converted to postscript (for commercial printing). The resulting file is too big to be processed by the printer (machine). I've been trying to find a way to either: Convert from the original (many pages) PDF file to many Postscript file (one postcript file per PDF page in original PDF file(. Convert from PDF to PS (or even EPS). - I managed to do this Then split the PS file into a collection of smaller files. I've tried using Ghostscript, but it is all gibberish to me. Thanks. PS. If you have a good GS tutorial (for dummies?), please share the link.

    Read the article

  • How to create unique user key

    - by Grayson Mitchell
    Scenario: I have a fairly generic table (Data), that has an identity column. The data in this table is grouped (lets say by city). The users need an identifier in order for printing on paper forms, etc. The users can only access their cites data, so if they use the identity column for this purpose they will see odd numbers (e.g. a 'New York' user might see 1,37,2028... as the listed keys. Idealy they would see 1,2,3... (or something similar) The problem of course is concurrency, this being a web application you can't just have something like: UserId = Select Count(*)+1 from Data Where City='New York' Has anyone come up with any cunning ways around this problem?

    Read the article

  • .net printdialog

    - by user311166
    i am building a button that allows a user to browse to a file. i want to get the location of the file and send it to printdialog. can this be done and if so how? i know how to create the browse funcitonality and how to get the location... my question is how to send the location of the file to the printdialog for printing...without opening the file my goal is to print to pdf... so if i can convert the .doc to pdf without printdialog that would be the best a user will browse to a file and convert it to pdf to a static destination

    Read the article

  • Pretty-print HTML via PHP without validation?

    - by brianjcohen
    I'd like to automatically pretty-print (indentation, mostly) the HTML output that my PHP scripts generate. I've been messing with Tidy, but have found that in its efforts to validate and clean my code, Tidy is changing way too much. I know Tidy's intentions are good but I'm really just looking for an HTML beautifier. Is there a simpler library out there that can run in PHP and just do the pretty-printing? Or, is there a way to configure Tidy to skip all the validation stuff and just beautify?

    Read the article

  • Clearcase and java process : changing view does not apply

    - by user1432310
    i have a simple application, which receives input from a user for a CC stream name, and is suppose to return the content of a specific file from this stream repository. I have tried doing this using a simple shell script: user enters stream name, java receives stream name, runs a process which runs a script "myccscript.sh" which contains "myinput=$1; cleartool setview $myinput" (or something like that). then i try reading the file and printing it's content in the java side. BUT, after the process is finished - the view is not the view from the user input - that environment was probably only valid for the process Ive created. how do i change the clearcase view to the main java process? Thanks!

    Read the article

  • Should I 'delete' this CDC?

    - by Binary Worrier
    Folks, I'm trying to track down an intermittant bug that's showing up on site. I've a feeling it's in some GDI code I'd to cobble together to get a tally printer working. I'm connfused over how to delete this CDC, my code looks OK to me, but is this correct. // Create a device context for printing CDC* dc = new CDC(); if(! dc->CreateDC(safeDriverName.AsBSTR(), safePrinterName.AsBSTR(), NULL, NULL)) { throw . . . } // as I finish with the CDC dc->DeleteDC(); delete dc; Do I need delete dc after dc->DeleteDC();? Thanks

    Read the article

  • How can I debug a Perl program that suddenly exits?

    - by taw
    I have Perl program based on IO::Async, and it sometimes just exits after a few hours/days without printing any error message whatsoever. There's nothing in dmesg or /var/log either. STDOUT/STDERR are both autoflush(1) so data shouldn't be lost in buffers. It doesn't actually exit from IO::Async::Loop->loop_forever - print I put there just to make sure of that never gets triggered. Now one way would be to keep peppering the program with more and more prints and hope one of them gives me some clue. Is there better way to get information what was going on in a program that made it exit/silently crash?

    Read the article

  • How to export javascript generated report to pdf?

    - by Parhs
    Hello... I made a reporting engine with javascript for my project... The problem is with printing.. Although with page-break and css i can produce a good looking report, i want to export that report to a pdf in order to be printed better without ,the url,page title and other stuff that browsers add. Note in Chrome there isnt page setup!!! I am using java for server side. i think sending via ajax the Html of the report somehow and return a url for the pdf report maybe... i am looking for a good tool for this thank you

    Read the article

  • Is there an automatic way to remove debugging methods for a release build?

    - by Lewis
    Note: This is an extension of an earlier question I asked here: Do additional function/method definitions increase a program's memory footprint? When I write a class, I usually end up writing several testing/debugging methods, used to make sure the class works as it should, or for printing data to help with debugging, or for unit testing, etc. Is there an easy/automatic way to make a release without these methods, or do I need to manually delete the extra code any time I want to compile a release version? I ask this question both from a C++ and a Java perspective. I'm using Code::Blocks and Eclipse as IDEs, if that plays into the answer somehow.

    Read the article

  • typeid() returns extra characters in g++

    - by Appu
    class foo { public: void say_type_name() { std::cout << typeid(this).name() << std::endl; } }; int main() { foo f;; f.say_type_name(); } Above code prints P3foo on my ubuntu machine with g++. I am not getting why it is printing P3foo instead of just foo. If I change the code like std::cout << typeid(*this).name() << std::endl; it prints 3foo. Any thoughts?

    Read the article

  • how should i echo the data

    - by Syom
    for example i want to generate html code, using some data from database. here is two ways of printing data <? echo '<li><img src="'.$row['image'].'" /></li>';?> or <? echo "<li><img src='$row[image]' /></li>";?> both of them are working. and if so, why people use the first method, if without spliting the row by . it works fine too.

    Read the article

  • Is there a way to force JUnit to fail on ANY unchecked exception, even if swallowed

    - by Uri
    I am using JUnit to write some higher level tests for legacy code that does not have unit tests. Much of this code "swallows" a variety of unchecked exceptions like NullPointerExceptions (e.g., by just printing stack trace and returning null). Therefore the unit test can pass even through there is a cascade of disasters at various points in the lower level code. Is there any way to have a test fail on the first unchecked exception even if they are swallowed? The only alternative I can think of is to write a custom JUnit wrapper that redirects System.err and then analyzes the output for exceptions.

    Read the article

  • A strange issue... No code changes getting reflected.

    - by sachin
    I am using netbeans to develop an applet, i have a piece of code which looked like this: ipAddresss = DEFAULT_IP; System.out.println("portlet.services.hostname:" + ipAddresss); Now I changed it to something like this: ipAddresss = DEFAULT_IP; System.out.println("portlet.services.hostname using default IP Address:" + ipAddresss); But no matter what I do, it sill keep on printing: portlet.services.hostname:null I have tried deleting all .netbeans folder from documents and settings, tried creating new project, but now i am completely baffled by this issue... So, the problem is, no matter what I do, no change is getting reflected when I run the program. Can there be a java applet cache, netbeans cache, i am not sure why...

    Read the article

  • UIImage for UIImageView is nil

    - by yeesterbunny
    I'm having problem displaying UIImage in UIImageView. I looked all over stackoverflow for similar questions, but none of the fixes helped me. The image is indeed in my bundle File Inspector - Target Membership is checked for the image IBOutlet is connected (I have tried both using IBOutlet and doing it programmatically) Both png nor jpg works Here's the code for using Interface Builder - //@property and @synthesize set for IBOutlet UIImageView *imageView - (void)viewDidLoad { [super viewDidLoad]; NSAssert(self.imageView, @"self.imageView is nil. Check your IBOutlet connection"); UIImage *image = [UIImage imageNamed:@"banner.jpg"]; NSAssert(image, @"image is nil"); self.imageView.image = image; } This code will terminate with NSAssert, printing in the console that 'image is nil'. I also tried selecting the Image directly from the attributes inspector: However it still doesn't show the image (still terminates with NSAssert - 'image is nil'). Any help or suggestions will be greatly appreciated. Thanks

    Read the article

  • How do I log the raw HTTP headers with a PHP script?

    - by php
    I'm using a cURL script to send POST data through a proxy to a script and I want to see what raw HTTP headers the cURL script is sending. List of things I've tried: echo curl_getinfo($ch, CURLINFO_HEADER_OUT) gives no output. file_get_contents('php://input') gets some HTTP headers but not all. print_r($_SERVER) also gets some HTTP headers but not all (I know this because there should be a X-Forwarded-For header and there isn't) Printing all superglobals ($_POST, $_GET, $_REQUEST, $_FILES etc) still doesn't show the raw HTTP headers. http_get_request_headers(), apache_request_headers(), $http_response_header, $HTTP_RAW_POST_DATA aren't outputting everything. Help?

    Read the article

  • How is `toString` in `scala.Enumeration$Value` implemented?

    - by Red Hyena
    I have an enum Fruit defined as: object Fruit extends Enumeration { val Apple, Banana, Cherry = Value } Now printing values of this enum, on Scala 2.7.x gives: scala> Fruit foreach println line1$object$$iw$$iw$Fruit(0) line1$object$$iw$$iw$Fruit(1) line1$object$$iw$$iw$Fruit(2) However the same operation on Scala 2.8 gives: scala> Fruit foreach println warning: there were deprecation warnings; re-run with -deprecation for details Apple Banana Cherry My question is: How is the method toString in Enumeration in Scala 2.8 is implemented? I tried looking into the source of Enumeration but couldn't understand anything.

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >