Search Results

Search found 19539 results on 782 pages for 'pretty print'.

Page 103/782 | < Previous Page | 99 100 101 102 103 104 105 106 107 108 109 110  | Next Page >

  • Naming Suggestions For A Function Providing Method Chaining In A Different Way

    - by sid3k
    I've coded an experimental function which makes passed objects chainable by using high order functions. It's name is "chain" for now, and here is a usage example; chain("Hello World") (print) // evaluates print function by passing "Hello World" object. (console.log,"Optional","Parameters") (returnfrom) // returns "Hello World" It looks lispy but behaves very different since it's coded in a C based language, I don't know if there is a name for this idiom and I couldn't any name more suitable than "chain". Any ideas, suggestions?

    Read the article

  • How to wrap Java String.format()?

    - by BlinK_
    Hey everyone, I would like to wrap the String.format() method with in my own Logger class. I can't figure a way how to pass arguments from my method to String.format(). public class Logger { public static void format(String format, Object... args) { print(String.format(format, args)); // <-- this gives an error obviously. } public static void print(String s) { System.out.println(s); } }

    Read the article

  • document.write buggy?

    - by proyb2
    Something wrong with the code? I could print Hello on HTML but when I add to getPlayerVersion, the whole string doesn't print. What could be problem be? Leaving me feeling frustrated. <script type="text/javascript"> document.write("Hello"+deconcept.SWFObjectUtil.getPlayerVersion().major); </script>

    Read the article

  • Finding the nth number of primes

    - by Braxton Smith
    I can not figure out why this won't work. Please help me from math import sqrt pN = 0 numPrimes = 0 num = 1 def checkPrime(x): '''Check\'s whether a number is a prime or not''' prime = True if(x==2): prime = True elif(x%2==0): prime=False else: root=int(sqrt(x)) for i in range(3,root,2): if(x%i==0): prime=False break return prime n = int(input("Find n number of primes. N being:")) while( numPrimes != n ): if( checkPrime( num ) == True ): numPrimes += 1 pN = num print("{0}: {1}".format(numPrimes,pN)) num += 1 print("Prime {0} is: {1}".format(n,pN))

    Read the article

  • Simple 2-color differential image compression

    - by Groo
    Is there an efficient, quick and simple example of doing differential b/w image compression? Or even better, some simple (but lossless) streaming technique which could accept a number of frames as input? I have a simple b/w image (320x200) stream, displaying something similar to a LED display, which is updated about once a second using AJAX. Images are pretty similar most of the time, so if I subtracted them, result would compress pretty well (even with simple RLE). Is something like this available?

    Read the article

  • Get gtk widget name

    - by mw88
    Hello, I'm writing a GTK-Theme that is pretty dark. It works with most programs but some toolbars look pretty strange (in Bluefish and NetBeans for example). Now I need to get the name of the toolbar widget to write a workaround.

    Read the article

  • Is this a valid quine?

    - by fsm
    def start(fileName): fileReader = open(fileName) for row in fileReader: print row, if __name__ == "__main__": import sys if len(sys.argv) <= 1: print "usage quine /path/to/file" sys.exit(-1) fileName = sys.argv[0] start(fileName) python quine.py foo

    Read the article

  • Python: finding lowest integer

    - by sarah
    I have the following code: l = ['-1.2', '0.0', '1'] x = 100.0 for i in l: if i < x: x = i print x The code should find the lowest value in my list (-1.2) but instead when i print 'x' it finds the value is still 100.0 Where is my code going wrong?

    Read the article

  • Regex optional match in python fails

    - by AaronG
    tickettypepat = (r'MIS Notes:.**(//p//)?.**') retype = re.search(tickettypepat,line) if retype: print retype.group(0) print retype.group(1) Given the input. MIS Notes: //p// Can anyone tell me why group(0) is MIS Notes: //p// and group(1) is returning as None?

    Read the article

  • scoping problem in recursive closure

    - by wiso
    why this work: def function1(): a = 10 def function2(): print a function2() but this not: def function1(): a = 10 def function2(): print a a -= 1 if a>0: function2() function2() error: UnboundLocalError: local variable 'a' referenced before assignment

    Read the article

  • how to use @ in python..

    - by zjm1126
    this is my code: def a(): print 'sss' @a() def b(): print 'aaa' b() and the Traceback is: sss Traceback (most recent call last): File "D:\zjm_code\a.py", line 8, in <module> @a() TypeError: 'NoneType' object is not callable so how to use the '@' thanks

    Read the article

  • Naming Suggestions For A Function Providing Chaining In A Different Way

    - by sid3k
    I've coded an experimental function which makes passed objects chainable by using high order functions. It's name is "chain" for now, and here is a usage example; chain("Hello World") (print) // evaluates print function by passing "Hello World" object. (console.log,"Optional","Parameters") (returnfrom) // returns "Hello World" It looks lispy but behaves very different since it's coded in a C based language, I don't know if there is a name for this idiom and I couldn't any name more suitable than "chain". Any ideas, suggestions?

    Read the article

  • Plotter: What is fixed - the height or the width

    - by Jayan
    I am fixing some printing (plotter) problems in our java code(windows 32). The paper is 50 meter roll , loaded on to plotter. The paper It 36 inch "wide". I am printing image 36inch by 108 inch. When I print what is with height and width I can use? [ FYI. The testing is done using print to file, No paper is wasted :) ] Thanks, Jayan

    Read the article

  • Printing contents of a div

    - by Hulk
    The contents of the following div re derived dynamically. i.e, A table is added dynamically to this div with some button .My question is how to print the content of this div(window.print) and not other things in the page <div id="newdiv" name="newdiv"></div> Thanks..............

    Read the article

  • Matplotlib: plotting discrete values

    - by Arkapravo
    I am trying to plot the following ! from numpy import * from pylab import * import random for x in range(1,500): y = random.randint(1,25000) print(x,y) plot(x,y) show() However, I keep getting a blank graph (?). Just to make sure that the program logic is correct I added the code print(x,y), just the confirm that (x,y) pairs are being generated. (x,y) pairs are being generated, but there is no plot, I keep getting a blank graph. Any help ?

    Read the article

  • read ArrayList elements

    - by Jessy
    Why it print the wrong output? ArrayList<String> loc = new ArrayList<String>(); This arraylist stored the value of: [topLeft, topLeft, topLeft, bottomLeft, topLeft, bottomLeft, topLeft, topLeft, Left, topLeft] the firs index 0 is = topLeft if(loc.get(1)=="topLeft") System.out.println("same") else { System.out.println("not same") } This program print the wrong output not same instead of same

    Read the article

  • Python Script to backup a directory

    - by rgolwalkar
    Filename:backup_ver1 import os import time 1 Using list to specify the files and directory to be backed up source = r'C:\Documents and Settings\rgolwalkar\Desktop\Desktop\Dr Py\Final_Py' 2 define backup directory destination = r'C:\Documents and Settings\rgolwalkar\Desktop\Desktop\PyDevResourse' 3 Setting the backup name targetBackup = destination + time.strftime('%Y%m%d%H%M%S') + '.rar' rar_command = "rar.exe a -ag '%s' %s" % (targetBackup, ''.join(source)) i am sure i am doing something wrong here - rar command please let me know if os.system(rar_command) == 0: print 'Successful backup to', targetBackup else: print 'Backup FAILED' O/P:- Backup FAILED winrar is added to Path and CLASSPATH under Environment variables as well - anyone else with a suggestion for backing up the directory is most welcome

    Read the article

< Previous Page | 99 100 101 102 103 104 105 106 107 108 109 110  | Next Page >