Search Results

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

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

  • Save or output WebBrowser object context to .pdf file in VB.NET

    - by Matt
    I am loading an html page into a WebBrowser object in a VB.NET Windows Forms application. The user may make changes to textboxes, dropdowns, etc. on the HTML page displayed in the browser. I want the ability to save the current context to a .pdf file on the local HD. I am able to print using WebBrowser.Print(), which shows the current context, but what ways are possible to get this saved as a PDF file locally?

    Read the article

  • Python regex compile (with re.VERBOSE) not working

    - by bfloriang
    I'm trying to put comments in when compiling a regex but when using the re.VERBOSE flag I get no matchresult anymore. (using Python 3.3.0) Before: regex = re.compile(r"Duke wann", re.IGNORECASE) print(regex.search("He is called: Duke WAnn.").group()) Output: Duke WAnn After: regex = re.compile(r''' Duke # First name Wann #Last Name ''', re.VERBOSE | re.IGNORECASE) print(regex.search("He is called: Duke WAnn.").group())` Output: AttributeError: 'NoneType' object has no attribute 'group'

    Read the article

  • Checkers board structure

    - by Ockonal
    Hello guys, I'm implement checkers (game) board with python. Here is how I switch it to the need structure [8][8] array: _matrix = [] for i in xrange(8): _matrix.append( [' '] * 8 ) for row in xrange(0, 8): for col in xrange(0, 8): if _darkQuad(row, col) == True: _matrix[row][col] = '#' else: _matrix[row][col] = '-' def _darkQuad(row, col): return ((row%2) == (col%2)) def _printDebugBoard(): for row in xrange(0, 8): for col in xrange(0, 8): print _matrix[row][col] print '' This should do my board like: # - # - # - # - - # - # - # - # ... But the result is: - - - - - - - - # # # # # # # # - - - - - - - - # # # # # # # # - - - - - - - - # # # # # # # # - - - - - - - - # # # # # # # # What's wrong?

    Read the article

  • How to avoid this PDO exception: Cannot execute queries while other unbuffered queries are active

    - by Vittorio Vittori
    Hi, I'd like to print a simple table in my page with 3 columns, building name, tags and architecture style. If I try to retrieve the list of building names and arch. styles there is no problem: SELECT buildings.name, arch_styles.style_name FROM buildings INNER JOIN buildings_arch_styles ON buildings.id = buildings_arch_styles.building_id INNER JOIN arch_styles ON arch_styles.id = buildings_arch_styles.arch_style_id LIMIT 0, 10 My problem starts on retreaving the first 5 tags for every building of the query I've just wrote. SELECT DISTINCT name FROM tags INNER JOIN buildings_tags ON buildings_tags.tag_id = tags.id AND buildings_tags.building_id = 123 LIMIT 0, 5 The query itself works perfectly, but not where I thought to use it: <?php // pdo connection allready active, i'm using mysql $pdo_conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); $sql = "SELECT buildings.name, buildings.id, arch_styles.style_name FROM buildings INNER JOIN buildings_arch_styles ON buildings.id = buildings_arch_styles.building_id INNER JOIN arch_styles ON arch_styles.id = buildings_arch_styles.arch_style_id LIMIT 0, 10"; $buildings_stmt = $pdo_conn->prepare ($sql); $buildings_stmt->execute (); $buildings = $buildings_stmt->fetchAll (PDO::FETCH_ASSOC); $sql = "SELECT DISTINCT name FROM tags INNER JOIN buildings_tags ON buildings_tags.tag_id = tags.id AND buildings_tags.building_id = :building_id LIMIT 0, 5"; $tags_stmt = $pdo_conn->prepare ($sql); $html = "<table>"; // i'll use it to print my table foreach ($buildings as $building) { $name = $building["name"]; $style = $building["style_name"]; $id = $building["id"]; $tags_stmt->bindParam (":building_id", $id, PDO::PARAM_INT); $tags_stmt->execute (); // the problem is HERE $tags = $tags_stmt->fetchAll (PDO::FETCH_ASSOC); $html .= "... $name ... $style"; foreach ($tags as $current_tag) { $tag = $current_tag["name"]; $html .= "... $tag ..."; // let's suppose this is an area of the table where I print the first 5 tags per building } } $html .= "...</table>"; print $html; I'm not experienced on queries, so i though something like this, but it throws the error: PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. What can I do to avoid this? Should I change all and search a different way to get this kind of queries?

    Read the article

  • How to get HTTP status message in (py)curl?

    - by mykhal
    spending some time studying pycurl and libcurl documentation, i still can't find a (simple) way, how to get HTTP status message (reason-phrase) in pycurl. status code is easy: import pycurl import cStringIO curl = pycurl.Curl() buff = cStringIO.StringIO() curl.setopt(pycurl.URL, 'http://example.org') curl.setopt(pycurl.WRITEFUNCTION, buff.write) curl.perform() print "status code: %s" % curl.getinfo(pycurl.HTTP_CODE) # -> 200 # print "status message: %s" % ??? # -> "OK"

    Read the article

  • Extracting value in Beautifulsoup

    - by Seth
    I have the following code: f = open(path, 'r') html = f.read() # no parameters => reads to eof and returns string soup = BeautifulSoup(html) schoolname = soup.findAll(attrs={'id':'ctl00_ContentPlaceHolder1_SchoolProfileUserControl_SchoolHeaderLabel'}) print schoolname which gives: [<span id="ctl00_ContentPlaceHolder1_SchoolProfileUserControl_SchoolHeaderLabel">A B Paterson College, Arundel, QLD</span>] when I try and access the value (i.e. 'A B Paterson College, Arundel, QLD) by using schoolname['value'] I get the following error: print schoolname['value'] TypeError: list indices must be integers, not str What am I doing wrong to get that value?

    Read the article

  • [Python]Xml add a node from another xml document

    - by michele
    Hi, I have two xml file: 1)model.xml 2)projectionParametersTemplate.xml I want to extract from 1) Algorithm Node with his child and put it in 2) I have wrote this code but it doesn't function. from xml.dom.minidom import Document from xml.dom import minidom xmlmodel=minidom.parse("/home/michele/Scrivania/d/model.xml") xmltemplate=minidom.parse("/home/michele/Scrivania/d/projectionParametersTemplate.xml") for Node in xmlmodel.getElementsByTagName("Algorithm"): print "\nNode: "+str(Node) for Node2 in xmltemplate.getElementsByTagName("ProjectionParameters"): print "\nNode2: "+str(Node2) Node2.appendChild(Node) This is model.xml link text This is projectionParametersTemplate.xml link text Thanks a lot.

    Read the article

  • Making a lightbox support printing on web page

    - by bobo
    I know the idea is to use a separate stylesheet for printing that hides everything other than the lightbox when the user clicks the print button on the lightbox. It sounds easy but there are always some obstacles. So I would like to know if there is any working example that supports all major browsers. I searched in google and found many lightbox but none of them has a print button built-in.

    Read the article

  • Good Name for a Music Player (like Spotify)

    - by LnDCobra
    I can't think of anywhere else to ask therefore I thought asking here would be the ideal place. Reason I'm asking is because for my Dissertation in my report I pretty much got told my name sucks. I ain't going to argue as its just "My Music Player" so any suggestions would be highly appreciated! I know it's pretty subjective but ANY help would be appreciated! I am not of the creative types of people :(

    Read the article

  • Python double underscore mangling

    - by gnr
    I am a bit confused by this behavior (using python 3.2): class Bar: pass class Foo: def __init__(self): self.__cache = None bar = Bar() bar.__cache = None foo = Foo() print(vars(bar)) #returns {'__cache': None} print(vars(foo)) #returns {'_Foo__cache': None} I've read up a bit on how double-underscores cause attribute names to be "mangled", but I would have expected the same name-mangling in both cases above. The meaning of a single- and a double-underscore before an object name in Python Any ideas what's going on here?

    Read the article

  • Is this the correct way to convert a UTC datetime string into localtime?

    - by Steve
    Is this the correct way to convert a UTC string into local time allowing for daylight savings? It looks ok to me but you never know :) import time UTC_STRING = "2010-03-25 02:00:00" stamp = time.mktime(time.strptime(UTC_STRING,"%Y-%m-%d %H:%M:%S")) stamp -= time.timezone now = time.localtime() if now[8] == 1: stamp += 60*60 elif now[8] == -1: stamp -= 60*60 print 'UTC: ', time.gmtime(stamp) print 'Local: ', time.localtime(stamp) --- Results from New Zealand (GMT+12 dst=1) --- UTC: (2010, 3, 25, 2, 0, 0, 3, 84, 0) Local: (2010, 3, 25, 15, 0, 0, 3, 84, 1)

    Read the article

  • QTreeWidget activate item signals

    - by serge
    Hi everyone, I need to do some actions when item in QTreeWidget activates, but following code doestn't gives me expected result: class MyWidget(QTreeWidget): def __init__(self, parent=None): super(MyWidget, self).__init__(parent) self.connect(self, SIGNAL("activated(QModelIndex)"), self.editCell) def editCell(self, index): print index or class MyWidget(QTreeWidget): def __init__(self, parent=None): super(MyWidget, self).__init__(parent) self.connect(self, SIGNAL("itemActivated(QTreeWidgetItem, int)"), self.editCell) def editCell(self, item, column=0): print item What am i doing wrong or how to hadnle item activation in the right way? Thanks in advance, Serge

    Read the article

  • CSS to show all textarea Content in HTML for Printing?

    - by viatropos
    What settings do I need to make it so when a user presses "print" in the browser, using a print.css stylesheet, the textareas display all their content (dynamic height) in the printed version, without using javascript? I have tried this: textarea { overflow: visible; float: none !important; height: auto !important; } ... but it doesn't work. Any ideas?

    Read the article

  • Problem with urllib

    - by Eva
    I wrote this code: import urllib proxies = {'http': 'http://112.65.135.54:8080/'} opener = urllib.FancyURLopener(proxies) r = opener.open("http://www.python.org/") print r.read() and when I execute it this program works fine, and send for me source code of python.org But when i use this: import urllib proxies = {'http': 'http://80.176.245.196:1080/'} opener = urllib.FancyURLopener(proxies) r = opener.open("http://www.python.org/") print r.read() this program does not send me the source code of python.org What am I going to do?

    Read the article

  • printing invoices

    - by stuarty
    Hi I have invoice data stored in SQL now I want to print those invoices, It would probably take me less than an hour to print them manually but that is not the point I want to do it programmatically using c# What is the quickest simplest way? Excel? Links to some examples? TIA Stuart

    Read the article

  • How to bind set of reports to report viwer ?

    - by prasad
    Hi all , I want to print a set of invoice for my application. So I need to display all invoices in report viewer before they print. are there any methods to bind multiple reports to same report viewer using crystal reports or rdlc. I try rdlc but I couldn't find any way to do that. please any one can provide code sample or instruction in C#.net it's worth for me. thank you.......

    Read the article

  • Perl, array referencing

    - by Mike
    Consider this Perl code my @a=[[1]]; print $a[0][0] . "\n"; **output** ARRAY(0x229e8) Why does it print an Array instead of 1? I would have expected @a to create an array of size 1 with a reference to a second array containing only one element, 1

    Read the article

  • Exit to command line in Python

    - by fuenfundachtzig
    I have a script that I want to exit early under some condition: if not "id" in dir(): print "id not set, cannot continue" # exit here! # otherwise continue with the rest of the script... print "alright..." [ more code ] I run this script using execfile("foo.py") from the Python interactive prompt and I would like the script to exit going back to the command line. How do I do this? If I use sys.exit(), the Python interpreter exits completely.

    Read the article

  • how to insert new line in bash shell for variable??

    - by puspa
    I have two variables var1 and var2. The contents of each variables come from bash shell grep command. echo $var1 prints 123 465 326 8080 echo $var2 prints sila kiran hinal juku Now I want to print the above into following formats in Linux bash shell 123 sila 465 kiran 326 hinal 8080 juku So how can I print this way in bash shell??

    Read the article

  • Grep and Awk in Windows Invalid Char in Expression Error

    - by Nathan
    I am new to grep and awk - using Windows 7 (I downloaded grep and awk for windows from GnuWin). I am have having trouble running this script: grep -Fwf dictionary.txt frequency.txt | awk '{print $2 "," $1}' I get the error: awk: '{print awk: ^ invalid char ''' in expression I believe it might have something to do with having to use double quotes in Windows, but I tried all the combinations I can think of and still it doesn't work. Can anyone help? Thanks

    Read the article

  • Optimizing Haskell code

    - by Masse
    I'm trying to learn Haskell and after an article in reddit about Markov text chains, I decided to implement Markov text generation first in Python and now in Haskell. However I noticed that my python implementation is way faster than the Haskell version, even Haskell is compiled to native code. I am wondering what I should do to make the Haskell code run faster and for now I believe it's so much slower because of using Data.Map instead of hashmaps, but I'm not sure I'll post the Python code and Haskell as well. With the same data, Python takes around 3 seconds and Haskell is closer to 16 seconds. It comes without saying that I'll take any constructive criticism :). import random import re import cPickle class Markov: def __init__(self, filenames): self.filenames = filenames self.cache = self.train(self.readfiles()) picklefd = open("dump", "w") cPickle.dump(self.cache, picklefd) picklefd.close() def train(self, text): splitted = re.findall(r"(\w+|[.!?',])", text) print "Total of %d splitted words" % (len(splitted)) cache = {} for i in xrange(len(splitted)-2): pair = (splitted[i], splitted[i+1]) followup = splitted[i+2] if pair in cache: if followup not in cache[pair]: cache[pair][followup] = 1 else: cache[pair][followup] += 1 else: cache[pair] = {followup: 1} return cache def readfiles(self): data = "" for filename in self.filenames: fd = open(filename) data += fd.read() fd.close() return data def concat(self, words): sentence = "" for word in words: if word in "'\",?!:;.": sentence = sentence[0:-1] + word + " " else: sentence += word + " " return sentence def pickword(self, words): temp = [(k, words[k]) for k in words] results = [] for (word, n) in temp: results.append(word) if n > 1: for i in xrange(n-1): results.append(word) return random.choice(results) def gentext(self, words): allwords = [k for k in self.cache] (first, second) = random.choice(filter(lambda (a,b): a.istitle(), [k for k in self.cache])) sentence = [first, second] while len(sentence) < words or sentence[-1] is not ".": current = (sentence[-2], sentence[-1]) if current in self.cache: followup = self.pickword(self.cache[current]) sentence.append(followup) else: print "Wasn't able to. Breaking" break print self.concat(sentence) Markov(["76.txt"]) -- module Markov ( train , fox ) where import Debug.Trace import qualified Data.Map as M import qualified System.Random as R import qualified Data.ByteString.Char8 as B type Database = M.Map (B.ByteString, B.ByteString) (M.Map B.ByteString Int) train :: [B.ByteString] -> Database train (x:y:[]) = M.empty train (x:y:z:xs) = let l = train (y:z:xs) in M.insertWith' (\new old -> M.insertWith' (+) z 1 old) (x, y) (M.singleton z 1) `seq` l main = do contents <- B.readFile "76.txt" print $ train $ B.words contents fox="The quick brown fox jumps over the brown fox who is slow jumps over the brown fox who is dead."

    Read the article

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