Search Results

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

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

  • How to determine if the variable is a function in Python?

    - by bodacydo
    Since functions are values in Python, how do I determine if the variable is a function? For example: boda = len # boda is the length function now if ?is_var_function(boda)?: print "Boda is a function!" else: print "Boda is not a function!" Here hypothetical ?is_var_function(x)? should return true if x is a callable function, and false if it is not. Please advise! Thanks, Boda Cydo.

    Read the article

  • How to access memory location in Java?

    - by Abhishek Jain
    Is it possible that we can access memory location in Java directly or indirectly? If we tries to print a object, it will print hashcode. Does hashcode signify indirectly to memory location? For two object at different memory location but still their hashcode can varies. -Abhishek

    Read the article

  • Perl glob one liner

    - by user260826
    Im working in a perl one liner to invert the contents of my file contents or perform operations, I was able to generate the script and one liner, but this one liner only works by entering file by file. perl -i -ne '$a=reverse $_;print "$a\n"' <filename> I want to change my one liner to get input from a range of files but when i do: perl -i -ne '$a=reverse $_;print "$a\n"' | ls -al I just get screen output of ls -al Not sure how to proceed. Thanks

    Read the article

  • High level macro not recognized - Beginner MASM

    - by Francisco P.
    main proc finit .while ang < 91 invoke func, ang fstp res print real8$(ang), 13, 10 print real8$(res), 13, 10 fld ang fld1 fadd fstp ang .endw ret main endp What's wrong with this piece of MASM code? I get an error on .endw. I have ran some tests to ensure myself of that. Assembler tells me invalid instruction operands. Thank you for your time!

    Read the article

  • OSX, G/AWK, Bash - "illegal statement, unterminated string" and no file output.

    - by S1syphus
    I have a script that somebody from SO kindly provided to solve an issue I was having, However, I'm having some issues getting it to work on OSX. gawk --version GNU Awk 3.1.6 awk --version awk version 20100208 The original source is: awk -F, -vOFS=, -vc=1 ' NR == 1 { for (i=1; i<NF; i++) { if ($i != "") { g[c]=i; f[c++]=$i } } } NR>2 { for (i=1; i < c; i++) { print $1,$2, $g[i] > "output_"f[i]".csv } }' data.csv When I run the script it gives the following error: awk: syntax error at source line 12 context is print $1,$2, $g[i] > >>> "output_"f <<< [i]".csv awk: illegal statement at source line 13 From the look of it the variable of [i] isn't been amended to the output file, but I don't know why. If I change AWK to GAWK and run the original script here is the output: gawk: cmd. line:11: print $1,$2, $g[i] > "output_"f[i]".csv gawk: cmd. line:11: ^ unterminated string So I edit the relevant line to fix the unterminated string print $1,$2, $g[i] > "output_"f[i]".csv" Then it runs through fine produces no errors, but there is no output files. Any ideas? I spent the majority of last night and this morning pouring over this. A sample input file: ,,L1,,,L2,,,L3,,,L4,,,L5,,,L6,,,L7,,,L8,,,L9,,,L10,,,L11, Title,r/t,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,neede d,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst EXAMPLEfoo,60,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 EXAMPLEbar,30,6,6,12,6,7,14,6,6,12,6,6,12,6,8,16,6,7,14,6,7.5,15,6,6,12,6,8,16,6,0,0,6,7,14 EXAMPLE1,60,3,3,3,3,5,5,3,4,4,3,3,3,3,6,6,3,4,4,3,3,3,3,4,4,3,8,8,3,0,0,3,4,4 EXAMPLE2,120,6,6,3,0,0,0,6,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 EXAMPLE3,60,6,6,6,6,8,8,6,6,6,6,6,6,0,0,0,0,0,0,6,8,8,6,6,6,0,0,0,0,0,0,0,10,10 EXAMPLE4,30,6,6,12,6,7,14,6,6,12,6,6,12,3,5.5,11,6,7.5,15,6,6,12,6,0,0,6,9,18,6,0,0,6,6.5,13 And the example out put should be So for L1 an example out put would look like: EXAMPLEfoo,60,6 EXAMPLEbar,30,6 EXAMPLE1,60,3 EXAMPLE2,120,6 EXAMPLE3,60,6 EXAMPLE4,30,6 And for L2: EXAMPLEfoo,60,0 EXAMPLEbar,30,6 EXAMPLE1,60,3 EXAMPLE2,120,0 EXAMPLE3,60,6 EXAMPLE4,30,6

    Read the article

  • sort associative array in awk - help?

    - by Richard
    Hi all, I have an associative array in awk that gets populated like this... chr_count[$3]++ When I try to print my chr_counts I use this: for (i in chr_count) { print i,":",chr_count[i]; } But not surprisingly, the order of i is not sorted in any way. Is there an easy way to iterate over the sorted "keys" of chr_count?

    Read the article

  • Multi-Page invoice printing on one page

    - by ryan
    I have an invoice that contains over 100 lines of product that I am trying to print. This single invoice should take over 3 pages, but when printed, the content flows off the footer and the next page is the following invoice. I am using divs instead of tables, and I can't understand why the long invoices will not print on multiple pages. Any ideas?

    Read the article

  • How to accss memory location in Java?

    - by Abhishek Jain
    Is it possible that we can access memory location in Java directly or indirectly? If we tries to print a object, it will print hashcode. Does hashcode signify indirectly to memory location? For two object at different memory location but still their hashcode can varies. -Abhishek

    Read the article

  • Problem with recursivity in rebol

    - by Rebol Tutorial
    I have a block on which I want to iterate recursively folders: [ Chrome [ content [ preferences prefpages ] ] icons [ default ] locale [ en-EN [ csbar ] ] skin ] with this function: iterate-folder: func [folders [block!]][ foreach folder folders [ either not block? folder [ probe folder temp: folder input ] [ print "folder" probe folder print "folders" probe folders probe select folders folder type-folder: type? select folders folder probe type-folder input iterate-folder select folders folder ] ] ] but for stupid reason I can't see, probe folder returns none above so it doesn't work.

    Read the article

  • using graphviz with qt

    - by radi
    hi , i have a compiler project and i want to print the ast after the compile complete so can i print this ast to qt (on c++) panel using graphviz ? note : i dont know if there is a binding between qt or c++ and graphviz , so if it doesnt work please help me to find the alternative . thanks .

    Read the article

  • Git for Websites / post-receive / Separation of Test and Production Sites

    - by Walt W
    Hi all, I'm using Git to manage my website's source code and deployment, and currently have the test and live sites running on the same box. Following this resource http://toroid.org/ams/git-website-howto originally, I came up with the following post-receive hook script to differentiate between pushes to my live site and pushes to my test site: while read ref do #echo "Ref updated:" #echo $ref -- would print something like example at top of file result=`echo $ref | gawk -F' ' '{ print $3 }'` if [ $result != "" ]; then echo "Branch found: " echo $result case $result in refs/heads/master ) git --work-tree=c:/temp/BLAH checkout -f master echo "Updated master" ;; refs/heads/testbranch ) git --work-tree=c:/temp/BLAH2 checkout -f testbranch echo "Updated testbranch" ;; * ) echo "No update known for $result" ;; esac fi done echo "Post-receive updates complete" However, I have doubts that this is actually safe :) I'm by no means a Git expert, but I am guessing that Git probably keeps track of the current checked-out branch head, and this approach probably has the potential to confuse it to no end. So a few questions: IS this safe? Would a better approach be to have my base repository be the test site repository (with corresponding working directory), and then have that repository push changes to a new live site repository, which has a corresponding working directory to the live site base? This would also allow me to move the production to a different server and keep the deployment chain intact. Is there something I'm missing? Is there a different, clean way to differentiate between test and production deployments when using Git for managing websites? As an additional note in light of Vi's answer, is there a good way to do this that would handle deletions without mucking with the file system much? Thank you, -Walt PS - The script I came up with for the multiple repos (and am using unless I hear better) is as follows: sitename=`basename \`pwd\`` while read ref do #echo "Ref updated:" #echo $ref -- would print something like example at top of file result=`echo $ref | gawk -F' ' '{ print $3 }'` if [ $result != "" ]; then echo "Branch found: " echo $result case $result in refs/heads/master ) git checkout -q -f master if [ $? -eq 0 ]; then echo "Test Site checked out properly" else echo "Failed to checkout test site!" fi ;; refs/heads/live-site ) git push -q ../Live/$sitename live-site:master if [ $? -eq 0 ]; then echo "Live Site received updates properly" else echo "Failed to push updates to Live Site" fi ;; * ) echo "No update known for $result" ;; esac fi done echo "Post-receive updates complete" And then the repo in ../Live/$sitename (these are "bare" repos with working trees added after init) has the basic post-receive: git checkout -f if [ $? -eq 0 ]; then echo "Live site `basename \`pwd\`` checked out successfully" else echo "Live site failed to checkout" fi

    Read the article

  • how to get ipaddress of my computer

    - by astha goyal
    hello i want to knw the ipaddress of my computer. /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' this command gives the ipaddress of my computer and print result on console but i want it in a varible sothat i can use it in my C program. How can i do that.

    Read the article

  • NSLog(@"%@",super) crashing

    - by Chandan Shetty SP
    I used NSLog(@"%@",super) in a method(any method) and it is crashing.... Why? How to print the super contents? Updated : currentclassname : superClassName { } and also if i use NSLog(@"%@", [super description]); It is printing "<currentclassname: 0x3db7230>" instead of superClassName... It is expected to print superClassName right. Thanks in advance,

    Read the article

  • SVN post-commit hook not executing file

    - by Oded
    I have created an exe file that will print to console the first and second arguments that it receives. In the SVN post-commit hook I wrote: PATH_TO_FILE\print.exe "%1" "%2" when I make a check-in, it gets stuck. %1 is the PATH %2 is revision number

    Read the article

  • class, dict, self, init, args ?

    - by kame
    class attrdict(dict): def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.__dict__ = self a = attrdict(x=1, y=2) print a.x, a.y b = attrdict() b.x, b.y = 1, 2 print b.x, b.y Could somebody explain the first four lines in words? I read about classes and methods. But here it seems very confusing.

    Read the article

  • Get Element value with minidom, Python

    - by Eef
    Hi Guys, I am creating a GUI frontend for the Eve Online API in Python. I have successfully pulled the XML data from their server. I am trying to grab the value from a node called "name" from xml.dom.minidom import parse dom = parse("C:\\eve.xml") name = dom.getElementsByTagName('name') print name This seems to find the node ok but the output is below: [<DOM Element: name at 0x11e6d28>] How could I get it to print the value of the node? Cheers

    Read the article

  • Why isn't django-nose running the doctests in my models?

    - by Conley Owens
    I'm trying to use doctests with django-nose. All my doctests are running, except not any doctests within a model (unless it is abstract). class TestModel1(models.Model): """ >>> print 'pass' pass """ pass class TestModel2(models.Model): """ >>> print 'pass' pass """ class Meta: abstract = True pass The first doctest does not run and the second does. Why is this?

    Read the article

  • Creating meaningful routes in wizard style ASP.NET MVC form

    - by R0MANARMY
    I apologize in advance for a long question, figured better have a bit more information than not enough. I'm working on an application with a fairly complex form (~100 fields on it). In order to make the UI a little more presentable the fields are organized into regions and split across multiple (~10) tabs (not unlike this, but each tab does a submit/redirect to next tab). This large input form can also be in one of 3 views (read only, editable, print friendly). The form represents a large domain object (let's call it Foo). I have a controller for said domain object (FooController). It makes sense to me to have the controller be responsible for all the CRUD related operations. Here are the problems I'm having trouble figuring out. Goals: I'd like to keep to conventions so that Foo/Create creates a new record Foo/Delete deletes a record Foo/Edit/{foo_id} takes you to the first tab of the form ...etc I'd like to be able to not repeat the data access code such that I can have Foo/Edit/{foo_id}/tab1 Foo/View/{foo_id}/tab1 Foo/Print/{foo_id}tab1 ...etc use the same data access code to get the data and just specify which view to use to render it. My current implementation has a massive FooController with Create, Delete, Tab1, Tab2, etc actions. Tab actions are split out into separate files for organization (using partial classes, which may or may not be abuse of partial classes). Problem I'm running into is how to organize my controller(s) and routes to make that happen. I have the default route {controller}/{action}/{id} Which handles goal 1 properly but doesn't quite play nice with goal 2. I tried to address goal 2 by defining extra routes like so: routes.MapRoute( "FooEdit", "Foo/Edit/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "Edit", id = (string)null } ); routes.MapRoute( "FooView", "Foo/View/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "View", id = (string)null } ); routes.MapRoute( "FooPrint", "Foo/Print/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "Print", id = (string)null } ); However defining these extra routes causes the Url.Action to generate routs like Foo/Edit/Create instead of Foo/Create. That leads me to believe I designed something very very wrong, but this is my first attempt an asp.net mvc project and I don't know any better. Any advice with this particular situation would be awesome, but feedback on design in similar projects is welcome.

    Read the article

  • str is not callable error in python .

    - by mekasperasky
    import sys import md5 from TOSSIM import * from RadioCountMsg import * t = Tossim([]) #The Tossim object is defined here m = t.mac()#The mac layer is defined here , in which the communication takes place r = t.radio()#The radio communication link object is defined here , as the communication needs Rf frequency to transfer t.addChannel("RadioCountToLedsC", sys.stdout)# The various channels through which communication will take place t.addChannel("LedsC", sys.stdout) #The no of nodes that would be required in the simulation has to be entered here print("enter the no of nodes you want ") n=input() for i in range(0, n): m = t.getNode(i) m.bootAtTime((31 + t.ticksPerSecond() / 10) * i + 1) #The booting time is defined so that the time at which the node would be booted is given f = open("topo.txt", "r") #The topography is defined in topo.txt so that the RF frequencies of the transmission between nodes are are set lines = f.readlines() for line in lines: s = line.split() if (len(s) > 0): if (s[0] == "gain"): r.add(int(s[1]), int(s[2]), float(s[3])) #The topogrography is added to the radio object noise = open("meyer-heavy.txt", "r") #The noise model is defined for the nodes lines = noise.readlines() for line in lines: str = line.strip() if (str != ""): val = int(str) for i in range(0, 4): t.getNode(i).addNoiseTraceReading(val) for i in range (0, n): t.getNode(i).createNoiseModel() #The noise model is created for each node for i in range(0,n): t.runNextEvent() fk=open("key.txt","w") for i in range(0,n): if i ==0 : key=raw_input() fk.write(key) ak=key key=md5.new() key.update(str(ak)) ak=key.digest() fk.write(ak) fk.close() fk=open("key.txt","w") plaint=open("pt.txt") for i in range(0,n): msg = RadioCountMsg() msg.set_counter(7) pkt = t.newPacket()#A packet is defined according to a certain format print("enter message to be transported") ms=raw_input()#The message to be transported is taken as input #The RC5 encryption has to be done here plaint.write(ms) pkt.setData(msg.data) pkt.setType(msg.get_amType()) pkt.setDestination(i+1)#The destination to which the packet will be sent is set print "Delivering " + " to" ,i+1 pkt.deliver(i+1, t.time() + 3) fk.close() print "the key to be displayed" ki=raw_input() fk=open("key.txt") for i in range(0,n): if i==ki: ms=fk.readline() for i in range(0,n): msg=RadioCountMsg() msg.set_counter(7) pkt=t.newPacket() msg.data=ms pkt.setData(msg.data) pkt.setType(msg.get_amType()) pkt.setDestination(i+1) pkt.deliver(i+1,t.time()+3) #The key has to be broadcasted here so that the decryption can take place for i in range(0, n): t.runNextEvent(); this code gives me error here key.update(str(ak)) . when i run a similar code on the python terminal there is no such error but this code pops up an error . why so?

    Read the article

  • Perl Test::More, get stdout

    - by Mike
    Is there a way inside a Perl test case using Test::More to get the program's stdout For instance, if I do use Test::More; ok(foo()); #in the code I am testing sub foo() { print "hello" } "hello" will not be visible. I would like to see it. edit I know I can use diag(), however this would not work if the print is inside the code I am testing

    Read the article

  • R: Removing object from parent environment using rm()

    - by user151410
    Hi, I am trying to remove an object from the parent environment. rm_obj <- function(obj){ a <-deparse(substitute(obj)) print (a) print(ls(envir=sys.frame(-1))) rm(a,envir=sys.frame(-1)) } > x<-c(1,2,3) > rm_obj(x) [1] "x" [1] "rm_obj" "x" Warning message: In rm(a, envir = sys.frame(-1)) : object 'a' not found This will help clarify my misunderstanding regarding frames. Thanks in advance, Russ

    Read the article

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