Search Results

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

Page 90/782 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • 50 sequences in one line

    - by user343934
    I have Muttiple sequence alignment (clustal) file and i want to read this file and arrange sequences in a such a way that in looks more clear and precise in order. I am doing this from biopython using AlignIO object. My codes like this alignment = AlignIO.read("opuntia.aln", "clustal") print "Number of rows: %i" % len(align) for record in alignment: print "%s - %s" % (record.id, record.seq) My Output-- http://i48.tinypic.com/ae48ew.jpg , it looks messy and long scrolling. What i want to do is print only 50 sequences in each line and continue till the end of alignment file. I wish to have output like this---http://i45.tinypic.com/4vh5rc.jpg from --http://www.ebi.ac.uk/Tools/clustalw2/, sorry two links are just a text due to my reputation. Any suggestions, algorithm and sample code is appreciated Thanks in advance Br,

    Read the article

  • Help calling class from a class above.

    - by wtzolt
    Hello, How to call from class oneThread: back to class fun:? As in, address a class written below. Is it possible? class oneThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.start() def run(self): print "1" time.sleep(1) print "2" time.sleep(1) print "3" self.wTree.get_widget("entryResult").set_text("Done with One.") # How to call from here back to class fun, which of course is below...? class fun: wTree = None def __init__( self ): self.wTree = gtk.glade.XML( "main.glade" ) self.wTree.signal_autoconnect( {"on_buttonOne" : self.one} ) gtk.main() def one(self, widget): oneThread(); gtk.gdk.threads_init() do=fun()

    Read the article

  • T-SQL: How Do I Create A "Private" Function Inside A Stored Procedure

    - by RPM1984
    Okay so im writing a SQL Server 2008 Stored Procedure (maintenance script). In doing so, being a good boy i've done plenty of error handling, checking rowcounts, printing output messages, etc But in doing this, ive found myself writing over and over again something like this: SELECT @RowsAffected = @@ROWCOUNT IF @RowsAffected > 0 BEGIN PRINT CAST(@RowsAffected, NVARCHAR(2)) + 'rows updated.' END Or debug messages like this: PRINT 'User ' + CAST(@UserId AS NVARCHAR(5)) + ' modified successfully' Is there a way i can create a kind of 'subroutine' inside the stored procedure (like a private method) that can accept something as a parameter (doesnt have to though) and do some logic? I want to be able to do something like this: CheckRowCounts Or this: PrintUserUpatedMessage(@UserId) Which would then perform the above logic (check rowcount, print message, etc) And yes obviously i can create a UDF, but then i would need to create/drop it etc as this logic is only required for the life of the execution of this stored procedure. Getting sick and tired of writing the same code over and over again, and changing all the different areas ive used it when i get an error =) Can anyone help?

    Read the article

  • Recompilation problem with groovlets (Groovy)

    - by BasB
    I'm new to Groovy, really like it, but found a compilation problem. I'm using Jetty as a webserver, which is serving .groovy files (groovlets) Consider two files: Test1.groovy which contains:    println new Test2().property Test2.groovy which contains:   public class Test2 {    String property = "print this"  } When calling /Test1.groovy in a browser it prints "print this". But when I change the property in something else, it still prints "print this", it won't recompile. The only thing I can do is restart jetty. Note that when all the code is in one file, recompilation does work. Is there a workaround for this..? Thanks, Bas.

    Read the article

  • Scrapy Not Returning Additonal Info from Scraped Link in Item via Request Callback

    - by zoonosis
    Basically the code below scrapes the first 5 items of a table. One of the fields is another href and clicking on that href provides more info which I want to collect and add to the original item. So parse is supposed to pass the semi populated item to parse_next_page which then scrapes the next bit and should return the completed item back to parse Running the code below only returns the info collected in parse If I change the return items to return request I get a completed item with all 3 "things" but I only get 1 of the rows, not all 5. Im sure its something simple, I just can't see it. class ThingSpider(BaseSpider): name = "thing" allowed_domains = ["somepage.com"] start_urls = [ "http://www.somepage.com" ] def parse(self, response): hxs = HtmlXPathSelector(response) items = [] for x in range (1,6): item = ScrapyItem() str_selector = '//tr[@name="row{0}"]'.format(x) item['thing1'] = hxs.select(str_selector")]/a/text()').extract() item['thing2'] = hxs.select(str_selector")]/a/@href').extract() print 'hello' request = Request("www.nextpage.com", callback=self.parse_next_page,meta={'item':item}) print 'hello2' request.meta['item'] = item items.append(item) return items def parse_next_page(self, response): print 'stuff' hxs = HtmlXPathSelector(response) item = response.meta['item'] item['thing3'] = hxs.select('//div/ul/li[1]/span[2]/text()').extract() return item

    Read the article

  • An simple Python extension in C

    - by celil
    I am trying to create a simple python extension module. I compiled the following code into a transit.so dynamic module #include <python2.6/Python.h> static PyObject* _print(PyObject* self, PyObject* args) { return Py_BuildValue("i", 10); } static PyMethodDef TransitMethods[] = { {"print", _print, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC inittransit(void) { Py_InitModule("transit", TransitMethods); } However, trying to call this from python import transit transit.print() I obtain an error message File "test.py", line 2 transit.print() ^ SyntaxError: invalid syntax What's wrong with my code?

    Read the article

  • Configuring IoC container from modules/plug-ins ?

    - by rouen
    Hi guys, i am in big dilema.. I am working on highly modular web app in ASP.NET MVC 2 (in fact, core will be super lightweight, all work on modules/plugins). I found MEF pretty useful for modules discovery, but i dont want to us it as IoC container. There is pretty good chance that I will need advanced features of "true" IoC container, so I would like to use Unity. And here is the problem : how to allow modules to configure container (programatically) = register their own types (mvc controllers, custom implementations of services...) at application start without making hard dependency on Unity in all modules ? I know about Common Service Locator project, and it seems pretty good, but this interface co container only allows resolving types, not registering them (afaik). I really hope you can understand my point, I know my english is terrible (I am from non english speaking country :) Thanks a lot !

    Read the article

  • Lua: Why changing value on one variable changes value on an other one too?

    - by user474563
    I think that running this code you will get excactly what I mean. I want to register 5 names to a register(people). I loop 5 times and in each loop I have a variable newPerson which is supposed to save all information about a person and then be added to the people register. In this example only the names of the people are being registered for simplicity. The problem is that in the end all people turn to have the same name: "Petra". I playied a bit with this but can't get a reasonable reason for this behaviour. Help appreciated! local people={} local person={ name="Johan", lastName="Seferidis", class="B" } local names={"Markus", "Eva", "Nikol", "Adam", "Petra"} --people to register for i=1, 5 do --register 5 people local newPerson=person local name=names[i] for field=1, 3 do --for each field(name, lastname, class) if field==1 then newPerson["name"]=name end --register name end people[i]=newPerson end print("First person name: " ..people[1]["name"]) print("Second person name: "..people[2]["name"]) print("Third person name: " ..people[3]["name"])

    Read the article

  • Algorithm to split an array into N groups based on item index (should be something simple)

    - by serg
    I feel that it should be something very simple and obvious but just stuck on this for the last half an hour and can't move on. All I need is to split an array of elements into N groups based on element index. For example we have an array of 30 elements [e1,e2,...e30], that has to be divided into N=3 groups like this: group1: [e1, ..., e10] group2: [e11, ..., e20] group3: [e21, ..., e30] I came up with nasty mess like this for N=3 (pseudo language, I left multiplication on 0 and 1 just for clarification): for(i=0;i<array_size;i++) { if(i>=0*(array_size/3) && i<1*(array_size/3) { print "group1"; } else if(i>=1*(array_size/3) && i<2*(array_size/3) { print "group2"; } else if(i>=2*(array_size/3) && i<3*(array_size/3) print "group3"; } } But what would be the proper general solution? Thanks.

    Read the article

  • Python command line UI

    - by hdx
    Hey guys/gals I'm writing a python script that fixes some duplicate issues on my database. I would like to display some progress status to the users, currently I just print it like this: print "Merged " + str(idx) + " out of " + str(totalCount); The problem is that it prints that in a new line for every record and that does not look so good :) I'd like to either always print the string above on the same line on the screen or use some smart widget that displays it in some sort of progress bar. I intent to run this on the command line, any suggestions will be much appreciated.

    Read the article

  • AppEngine dev_appserver.py not showing any outputs

    - by shin
    I installed Python2.6 and Google App Engine (GAE). I realized that GAE does not run on 2.6, so I installed 2.5 as well. Now I have a very basic code as follows and it does not show on the localhost:8080 I typed the following in cmd.exe under my dir testapps. c:\Users\myname\testapps"\Program Files\Google\google_appengine\dev_appserver.py" helloworld I am hoping someone lead me to the right direction. helloworld/helloworld.py print 'Content-Type: text/plain' print '' print 'Hello, world!' helloworld/app.yaml application: helloworld version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py

    Read the article

  • Smack API - How to display loop jxTaskpane for expand and collapse roster list

    - by MYE
    Hello everybody ! i have problem to display Taskpane for loop. i have a code to get the groups of roster (Groups : Friends - Business - Company, so on) my code is : Roster rost = xmppcon.getRoster(); Collection<RosterGroup> groups = rost.getGroups(); for(RosterGroup group : groups){ DefaultListModel model = new DefaultListModel(); model.addElement(group.getEntries()); String GroupNameCount = group.getName() + "("+group.getEntryCount()+")"; jXTaskPane1.setTitle(GroupNameCount); jXList1.setModel(model); } but jxTaskpane not loop, but when i print group name it print 2 line (because in database user A have two group is Friends and NIIT) sample print System.out.println(group.getName()); result: Friends NIIT

    Read the article

  • A simple Python extension in C

    - by celil
    I am trying to create a simple python extension module. I compiled the following code into a transit.so dynamic module #include <python2.6/Python.h> static PyObject* _print(PyObject* self, PyObject* args) { return Py_BuildValue("i", 10); } static PyMethodDef TransitMethods[] = { {"print", _print, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC inittransit(void) { Py_InitModule("transit", TransitMethods); } However, trying to call this from python import transit transit.print() I obtain an error message File "test.py", line 2 transit.print() ^ SyntaxError: invalid syntax What's wrong with my code?

    Read the article

  • String concatenation produces incorrect output in Python?

    - by Brian
    I have this code: filenames=["file1","FILE2","file3","fiLe4"] def alignfilenames(): #build a string that can be used to add labels to the R variables. #format goal: suffixes=c(".fileA",".fileB") filestring='suffixes=c(".' for filename in filenames: filestring=filestring+str(filename)+'",".' print filestring[:-3] #now delete the extra characters filestring=filestring[-1:-4] filestring=filestring+')' print "New String" print str(filestring) alignfilenames() I'm trying to get the string variable to look like this format: suffixes=c(".fileA",".fileB".....) but adding on the final parenthesis is not working. When I run this code as is, I get: suffixes=c(".file1",".FILE2",".file3",".fiLe4" New String ) Any idea what's going on or how to fix it?

    Read the article

  • How to loop over nodes with xmlfeed using scrapy python

    - by Kour ipm
    Hi i working on scrapy and trying xml feeds first time, below is my code class TestxmlItemSpider(XMLFeedSpider): name = "TestxmlItem" allowed_domains = {"http://www.nasinteractive.com"} start_urls = [ "http://www.nasinteractive.com/jobexport/advance/hcantexasexport.xml" ] iterator = 'iternodes' itertag = 'job' def parse_node(self, response, node): title = node.select('title/text()').extract() job_code = node.select('job-code/text()').extract() detail_url = node.select('detail-url/text()').extract() category = node.select('job-category/text()').extract() print title,";;;;;;;;;;;;;;;;;;;;;" print job_code,";;;;;;;;;;;;;;;;;;;;;" item = TestxmlItem() item['title'] = node.select('title/text()').extract() ....... return item result: File "/usr/lib/python2.7/site-packages/Scrapy-0.14.3-py2.7.egg/scrapy/item.py", line 56, in __setitem__ (self.__class__.__name__, key)) exceptions.KeyError: 'TestxmlItem does not support field: title' Totally there are 200+ items so i need to loop over and assign the node text to item but here all the results are displaying at once when we print, actually how can we loop over on nodes in scraping xml files with xmlfeedspider

    Read the article

  • SSI not producing output, not giving error either.

    - by bstullkid
    in the html file: <!--#exec cgi="/cgi-bin/test.pl"--> the perl script: #!/usr/bin/perl print "Content-Type: text/html\n\n"; print "<input type=\"hidden\" name=\"aname\" value=\"avalue\">\n"; print "<img src=\"/cgi-bin/script.pl\" />"; This does not give me an 'error processing directive' error, nor does it output my HTML inplace of the tag. I'll also add that the ssi tag gets replaced with nothing.

    Read the article

  • Printing JTables without formatting of the original component

    - by EricR
    I'm writing an application which utilises tables which can be printed if the user so desires and I wish to print a JTable filled with data, except I haven't been able to find an option to remove the formatting; the printed tables looks like it does in the GUI (based on the system theme) which is making the table less readable and using excess ink. I wish to print the same data with clear formatting. Is there a way to do this straight from a JTable or is my best option simply to print to a file and have the use printer from there. Currently it functions through a viewer which gives the user some options for printing, and then it goes to the system's printer.

    Read the article

  • Printings using CUPS, when can my app quit?

    - by KPexEA
    I have an linux app that uses cups for printing, but I've noticed that if I print and then quit my app right away my printout never appears. So I assume that my app has to wait for it to actually come out of the printer before quitting, so does anyone know how to tell when it's finished printing?? I'm using libcups to print a postscript file that my app generates. So I use the command to print the file and it then returns back to my app. So my app thinks that the document is off to the printer queue when I guess it has not made it there yet. So rather than have all my users have to look on the screen for the printer icon in the system tray I would rather have a solution in code, so if they try and quit before it has really been sent off I can alert them to the fact. Also the file I generate is a temporary file so it would be nice to know when it is finished with so I can delete it.

    Read the article

  • How to retrieve all errors and messages from a query using ADO

    - by Johan Levin
    When a SQL batch returns more than one message from e.g. print statements, then I can only retrieve the first one using the ADO connection's Errors collection. How do I get the rest of the messages? If I run this script: Option Explicit Dim conn Set conn = CreateObject("ADODB.Connection") conn.Provider = "SQLOLEDB" conn.ConnectionString = "Data Source=(local);Integrated Security=SSPI;Initial Catalog=Master" conn.Open conn.Execute("print 'Foo'" & vbCrLf & "print 'Bar'" & vbCrLf & "raiserror ('xyz', 10, 127)") Dim error For Each error in conn.Errors MsgBox error.Description Next Then I only get "Foo" back, never "Bar" or "xyz". Is there a way to get the remaining messages?

    Read the article

  • Printing out series of numbers in java

    - by Jay
    hi guys i am just doing some reading for myself to learn java and came across this problem and is currently stuck. i need to print out series of number based on the input given by the user. for example, if input = 5, the output should be as follows @1@22@333@4444@55555 import java.util.*; public class ex5{ public static void main(String[] args){ Scanner kb = new Scanner(System.in); System.out.println("Please type a #: "); int input = kb.nextInt(); for(int i=0;i<input;i++){ if(input==1){ System.out.print("@1"); } if(input==2){ System.out.print("@1@22"); } } } } this doesnt seem to be working because this is the output i get Please type a #: 2 @1@22@1@22 im not sure what to put inside the for loop right now and i dont think i am using the for loop here very well either... any help guys?

    Read the article

  • How do I send telnet option codes?

    - by Matt
    I've written a socket listener in Java that just sends some data to the client. If I connect to the server using telnet, I want the server to send some telnet option codes. Do I just send these like normal messages? Like, if I wanted the client to print "hello", I would do this: PrintWriter out = new PrintWriter(clientSocket.getOutputStream()); out.print("hello"); out.flush(); But when I try to send option codes, the client just prints them. Eg, the IAC char (0xff) just gets printed as a strange y character when I do this: PrintWriter out = new PrintWriter(clientSocket.getOutputStream()); out.print((char)0xff); out.flush();

    Read the article

  • How to convert string "0671" or "0x45" into integer form with 0 and 0x in the beginning.

    - by Harshit Sharma
    I wanted to make my own encryption algorithm and decryption algorithm , encryption algorithm works fine and converts ascii value of the characters into alternate hexadecimal and octal representations. But when I tried decryption, problem occured as it return int('0671') = 671, as 0671 is string type in the following code. Is there a method to convert "ox56" into integer form?????? NOTE: Following string is alternate octal and hexa of ascii value of char. ///////////////DECRYPTION/////// l="01630x7401620x6901560x67" f=len(l) k=0 d=0 x=[] for i in range(0,f,4): g=l[i:i+4] print g k=k+1 if(k%2==0): p=g print p else: p=int(g) print p

    Read the article

  • Why do all module run together?

    - by gunbuster363
    I just made a fresh copy of eclipse and installed pydev. In my first trial to use pydev with eclipse, I created 2 module under the src package(the default one) FirstModule.py: ''' Created on 18.06.2009 @author: Lars Vogel ''' def add(a,b): return a+b def addFixedValue(a): y = 5 return y +a print "123" run.py: ''' Created on Jun 20, 2011 @author: Raymond.Yeung ''' from FirstModule import add print add(1,2) print "Helloword" When I pull out the pull down menu of the run button, and click "ProjectName run.py", here is the result: 123 3 Helloword Apparantly both module ran, why? Is this the default setting?

    Read the article

  • Breaking the loop in Jython

    - by kdev
    Hi everyone, I have a written a loop for and if condition and I want to break to loop completely when if gets satisfied. while count: i=0 for line in read_record: #print str.strip(count[1:28]) #print str.strip(read_record[i]) if string.find(str.strip(read_record[i]),str.strip(count[1:28]))>0: code=str.strip(read_record[i+19])+str.strip(read_record[i+20]) print code[25:] break i=i+1 So here if the if string.find condition gets satisfied I want to go to while loop flow. Please tell me what will be the best place to break and how should I modify the program so that once the if condition is satisfied I am out of the loop and start again with while loop.

    Read the article

  • Recursion Interview Questions [closed]

    - by halivingston
    Given a string, "ABC", print all permutations Given a dollar bill, fill out possible ways it can summed up using .25, .10, .5, etc. Given a phone number (123-456), print out all it's word counter parters like (ADG-XYZ) A B C D E F G H I J K L M N O P In the above 2D matrix, print all possible words (just literally all words, and sure we could check if it's exists in a dictionary). The base case is I think here is that reaching the same i, j positions. Any others you can think of?

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >