Search Results

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

Page 73/782 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • How to test that variable is not equal to multiple things? Python

    - by M830078h
    This is the piece of code I have: choice = "" while choice != "1" and choice != "2" and choice != "3": choice = raw_input("pick 1, 2 or 3") if choice == "1": print "1 it is!" elif choice == "2": print "2 it is!" elif choice == "3": print "3 it is!" else: print "You should choose 1, 2 or 3" While it works, I feel that it's really clumsy, specifically the while clause. What if I have more acceptable choices? Is there a better way to make the clause?

    Read the article

  • Python Continue Loop

    - by Rob B.
    I am using the following code from this tutorial (http://jeriwieringa.com/blog/2012/11/04/beautiful-soup-tutorial-part-1/). from bs4 import BeautifulSoup soup = BeautifulSoup (open("43rd-congress.html")) final_link = soup.p.a final_link.decompose() trs = soup.find_all('tr') for tr in trs: for link in tr.find_all('a'): fulllink = link.get ('href') print fulllink #print in terminal to verify results tds = tr.find_all("td") try: #we are using "try" because the table is not well formatted. This allows the program to continue after encountering an error. names = str(tds[0].get_text()) # This structure isolate the item by its column in the table and converts it into a string. years = str(tds[1].get_text()) positions = str(tds[2].get_text()) parties = str(tds[3].get_text()) states = str(tds[4].get_text()) congress = tds[5].get_text() except: print "bad tr string" continue #This tells the computer to move on to the next item after it encounters an error print names, years, positions, parties, states, congress However, I get an error saying that 'continue' is not properly in the loop on line 27. I am using notepad++ and windows powershell. How do I make this code work?

    Read the article

  • How do I get the key of an item when doing a FOR loop through a dictionary or list in Python?

    - by Mike Hayes
    Hi I am new to Python. Say I have a list: list = ['A','B','C','D'] The key for each item respectively here is 0,1,2,3 - right? Now I am going to loop through it with a for loop... for item in list: print item That's great, I can print out my list. How do I get the key here? For example being able to do: print key print item on each loop? If this isn't possible with a list, where keys are not declared myself, is it possible with a Dictionary? Thanks

    Read the article

  • Why is the data I am printing not in a table format

    - by udaya
    Hi This is my program .when i submit the print button i can print the datas but they are not aligned in the table formatthe format in which i need the print to be...How can i print in the correct format <html> <head> <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> <script type="text/javascript"> function PrintElem(elem) { //alert('ddd'); Popup($(elem).text()); } function Popup(data) { var mywindow = window.open('', 'mydiv', 'height=400,width=600'); mywindow.document.write('<html><head><title>my div</title>'); /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.document.close(); mywindow.print(); return true; } </script> </head> <body> <div id="mydiv"> <table width="200" border="1"> <tr> <td>sss</td> <td>sssss;</td> <td>snssbsp;</td> </tr> <tr> <td>ssss;</td> <td>sssnbsp;</td> <td>snbsp;</td> </tr> <tr> <td>snbsp;</td> <td>snbsp;</td> <td>snbsp;</td> </tr> </table> </div> <input type="button" value="Print Div" onClick="PrintElem('#mydiv')" /> </body> </html>

    Read the article

  • Format a timestamp into text

    - by user1257114
    I want to get the Modify date of a file and then format it into a human readable date. I am running a C program that gets information on when a particular file was last modified. My C Code contains a sytem cmd which contains a number of egreps, awks, seds separated by pipes. Using sed or awk or something similar, how can I convert 06 to June (This can be any month so an array or something is required) What I am trying to achieve is to end up with a string similar to: My C code contains: char string1[100] = ""; #define MAXCHAR 100 FILE *fp; char str[MAXCHAR], str2[MAXCHAR]; char* filename = "newfile"; /* stat: run 'stat' on the dtlName file to display status information. egrep: search for the pattern 'Modify' and print the lines containing it. awk: Get columns 2 & 3 sed: replace the . with a space, leaving 3 columns of output awk: only print cols 1 & 2 to newfile sed: replace '-' with ' ' in newfile awk: format output in newfile */ sprintf(string1, "/bin/stat %s \ | egrep Modify \ | /bin/awk '{print $2, $3}' \ | /bin/sed 's/\\./ /g' \ | /bin/awk '{print $1, $2}' \ | /bin/sed 's/-/ /g' \ | /bin/awk '{print $3,$2\", \"$1,\"at\",$4}' > newfile" , dtlName); system(string1); fp = fopen(filename, "r"); while (fgets(str, MAXCHAR, fp) != NULL) sprintf(str2,"%s", str); /* Write information to file */ DisplayReportFile (report); ReportEntry (report,L"Source file: %s, Created: %s\n\n",dtlName,str2);

    Read the article

  • Python server open all ports

    - by user1670178
    I am trying to open all ports using this code, why can I not create a loop to perform this function? http://www.kellbot.com/2010/02/tutorial-writing-a-tcp-server-in-python/ #!/usr/bin/python # This is server.py file ##server.py from socket import * #import the socket library n=1025 while n<1050: ##let's set up some constants HOST = '' #we are the host PORT = n #arbitrary port not currently in use ADDR = (HOST,PORT) #we need a tuple for the address BUFSIZE = 4096 #reasonably sized buffer for data ## now we create a new socket object (serv) ## see the python docs for more information on the socket types/flags serv = socket( AF_INET,SOCK_STREAM) ##bind our socket to the address serv.bind((ADDR)) #the double parens are to create a tuple with one element serv.listen(5) #5 is the maximum number of queued connections we'll allow serv = socket( AF_INET,SOCK_STREAM) ##bind our socket to the address serv.bind((ADDR)) #the double parens are to create a tuple with one element serv.listen(5) #5 is the maximum number of queued connections we'll allow print 'listening...' n=n+1 conn,addr = serv.accept() #accept the connection print '...connected!' conn.send('TEST') conn.close() How do I make this work so that I can specify input range and have the server open all ports up to 65535? #!/usr/bin/python # This is server.py file from socket import * #import the socket library startingPort=input("\nPlease enter starting port: ") startingPort=int(startingPort) #print startingPort def connection(): ## let's set up some constants HOST = '' #we are the host PORT = startingPort #arbitrary port not currently in use ADDR = (HOST,PORT) #we need a tuple for the address BUFSIZE = 4096 #reasonably sized buffer for data def socketObject(): ## now we create a new socket object (serv) serv = socket( AF_INET,SOCK_STREAM) def bind(): ## bind our socket to the address serv = socket( AF_INET,SOCK_STREAM) serv.bind((ADDR)) #the double parens are to create a tuple with one element serv.listen(5) #5 is the maximum number of queued connections we'll allow serv = socket( AF_INET,SOCK_STREAM) print 'listening...' def accept(): conn,addr = serv.accept() #accept the connection print '...connected!' conn.send('TEST') def close(): conn.close() ## Main while startingPort<65535: connection() socketObject() bind() accept() startingPort=startingPort+1

    Read the article

  • Problems with sys.stdout.write() with time.sleep() in a function

    - by philipjkim
    What I wanted is printing out 5 dots that a dot printed per a second using time.sleep(), but the result was 5 dots were printed at once after 5 seconds delay. Tried both print and sys.stdout.write, same result. Thanks for any advices. import time import sys def wait_for(n): """Wait for {n} seconds. {n} should be an integer greater than 0.""" if not isinstance(n, int): print 'n in wait_for(n) should be an integer.' return elif n < 1: print 'n in wait_for(n) should be greater than 0.' return for i in range(0, n): sys.stdout.write('.') time.sleep(1) sys.stdout.write('\n') def main(): wait_for(5) # FIXME: doesn't work as expected if __name__ == '__main__': try: main() except KeyboardInterrupt: print '\nAborted.'

    Read the article

  • Manipulating values from database table with php

    - by charliecodex23
    I currently have 5 tables in MySQL database. Some of them share foreign keys and are interdependent of each other. I am displaying classes accordingly to their majors. Each class is taught during the fall, spring or all_year. In my database I have a table named semester which has an id, year, and semester fields. The semester field in particular is a tinyint that has three values 0, 1, 2. This signifies the fall, spring or all_year. When I display the query instead of having it show 0 or 1 or 2 can I have it show fall, spring etc? Extra: How can I add space to the end of each loop so the data doesn't look clustered? Key 0 Fall 1 Spring 2 All-year PHP <? try { $pdo = new PDO ("mysql:host=$hostname;dbname=$dbname","$username","$pw"); } catch (PDOException $e) { echo "Failed to get DB handle: " . $e->getMessage() . "\n"; exit; } $query = $pdo->prepare("SELECT course.name, course.code, course.description, course.hours, semester.semester, semester.year FROM course LEFT JOIN major_course_xref ON course.id = major_course_xref.course_id LEFT JOIN major ON major.id = major_course_xref.major_id LEFT JOIN course_semester_xref ON course.id = course_semester_xref.course_id LEFT JOIN semester ON course_semester_xref.semester_id = semester.id"); $query->execute(); if ($query->execute()){ while ($row = $query->fetch(PDO::FETCH_ASSOC)){ print $row['name'] . "<br>"; print $row['code'] . "<br>"; print $row['description'] . "<br>"; print $row['hours'] . " hrs.<br>"; print $row['semester'] . "<br>"; print $row['year'] . "<br>"; } } else echo 'Could not fetch results.'; unset($pdo); unset($query); ?> Current Display Computer Programming I CPSC1400 Introduction to disciplined, object-oriented program development. 4 hrs. 0 2013 Desire Display Computer Programming I CPSC1400 Introduction to disciplined, object-oriented program development. 4 hrs. Fall 2013

    Read the article

  • How is it possible my array is broken?

    - by user1812765
    I have this piece of code: public lot merge (lot otherlot){ wafer[] mWaferarray = new wafer[16]; byte[] bytearray = new byte[16]; wafer resultwafer = new wafer(bytearray); wafer w1; wafer w2; int i; int[][] assignmentmatrix = HungarianAlgorithm.computeAssignments(convertinttofloat (solutionmatrix(otherlot))); for (i=0; i != assignmentmatrix.length ;i++){ w1 = otherlot.getWaferarray()[assignmentmatrix[i][0]]; w2 = getWaferarray()[assignmentmatrix[i][1]]; resultwafer.setWafer(w1.wafercompare(w2)); mWaferarray[i] = resultwafer; mWaferarray[i].print(); } System.out.println("HERE\n"); mWaferarray[5].toString(); resultlot = new lot(mWaferarray); resultlot.print();// Problem occurs here. return resultlot; } As you can see I create an array of wafers (selfdefined class). Then I fill this up with new wafers. When I print this array (mWaferarray[i].print()) it gives me the wanted results. But when I go out of the "for"-loop the array is broken and it is as if the last item I add to mWaferarray fills it up (the entire array, 16 long, is filled with this wafer). So if run this program this is what I get: 1011110010111100 0011011111111110 0111110111101101 1010111001101111 0110110111101111 1010110101111010 1010110111011110 1011111010111100 1111110011101110 0111111111011011 1111111111011010 1101111011111010 1010110101011110 0101111011011010 1011111011011000 0101111011011010 HERE 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 As you can see it is as if the array is filled with the last wafer. I have been looking at this for some time now, I hope you guy can help me out. Thx in advance PS: my print functions are written like this: void print(){ int j; for (j=0; j != waferarray.length ;j++){ waferarray[j].print(); } } EDIT: added code for lot this is the beginning of the lot class public class lot { wafer[] waferarray = new wafer[16]; lot resultlot; public lot (wafer wafer1,wafer wafer2,wafer wafer3,wafer wafer4, wafer wafer5,wafer wafer6,wafer wafer7,wafer wafer8, wafer wafer9,wafer wafer10,wafer wafer11,wafer wafer12, wafer wafer13,wafer wafer14,wafer wafer15,wafer wafer16){ waferarray[0] = wafer1; waferarray[1] = wafer2; waferarray[2] = wafer3; waferarray[3] = wafer4; waferarray[4] = wafer5; waferarray[5] = wafer6; waferarray[6] = wafer7; waferarray[7] = wafer8; waferarray[8] = wafer9; waferarray[9] = wafer10; waferarray[10] = wafer11; waferarray[11] = wafer12; waferarray[12] = wafer13; waferarray[13] = wafer14; waferarray[14] = wafer15; waferarray[15] = wafer16; } public lot (wafer[] thiswaferarray){ waferarray = thiswaferarray; }

    Read the article

  • problem in extracting the data from text file

    - by parijat24
    hello , i am new to python , and I want to extract the data from this format FBpp0143497 5 151 5 157 PF00339.22 Arrestin_N Domain 1 135 149 83.4 1.1e-23 1 CL0135 FBpp0143497 183 323 183 324 PF02752.15 Arrestin_C Domain 1 137 138 58.5 6e-16 1 CL0135 FBpp0131987 60 280 51 280 PF00089.19 Trypsin Domain 14 219 219 127.7 3.7e-37 1 CL0124 to this format FBpp0143497 5 151 Arrestin_N 1.1e-23 FBpp0143497 183 323 Arrestin_C 6e-16 I have written code in hope that it works but it does not work , please help! file = open('/ddfs/user/data/k/ktrip_01/hmm.txt','r') rec = file.read() for line in rec : field = line.split("\t") print field print field[:] print '>',field[0] print field[1], field[2], field[6], field[12] the hmmtext file is FBpp0143497 5 151 5 157 PF00339.22 Arrestin_N Domain 1 135 149 83.4 1.1e-23 1 CL0135 FBpp0143497 183 323 183 324 PF02752.15 Arrestin_C Domain 1 137 138 58.5 6e-16 1 CL0135 FBpp0131987 60 280 51 280 PF00089.19 Trypsin Domain 14 219 219 127.7 3.7e-37 1 CL0124

    Read the article

  • Python: Problems finding string in website source code

    - by j00niner
    I open a website with urlopen. I then put the website sourcecode into a variable like so source = website.read() When I just print the source it comes out formatted correctly, however when I try to iterate through each line each character is it's own line. for example when I just print it looks like this <HTML> title</html> When I do this for line in source: print line it looks like this < H T M L ... etc I need to find a string that starts with "var" and then print that entire line.

    Read the article

  • Loop function works first time, not second time

    - by user1483101
    I'm creating a parsing program to look for certain strings in a a text file and count them. However, I'm having some trouble with one spot. def callbrowse(): filename = tkFileDialog.askopenfilename(filetypes = (("Text files", "*.txt"),("HTML files", ".html;*.htm"),("All files", "*.*"))) print filename try: global filex global writefile filex = open(filename, 'r') print "Success!!" print filename except: print "Failed to open file" ######This returns the correct count only the first time it is run. The next time it ######returns 0. If the browse button is clicked again, then this function returns the ######correct count again. def count_errors(error_name): count = 0 for line in filex: if error_name == "CPU > 79%": stringparse = "Utilization is above" elif error_name == "Stuck touchscreen": stringparse = "Stuck touchscreen" if re.match("(.*)" + "Utilization is above" + "(.*)",line): count = count + 1 return count Thanks for any help. I can't seem to get this to work right.

    Read the article

  • Iterating over key/value pairs in a dict sorted by keys

    - by Helper Method
    I have the following code, which just print the key/value pairs in a dict (the pairs are sorted by keys): for word, count in sorted(count_words(filename).items()): print word, count However, calling iteritems() instead of items() produces the same output for word, count in sorted(count_words(filename).iteritems()): print word, count Now, which one should I choose in this situation? I consulted the Python tutorial but it doesn't really answer my question.

    Read the article

  • wrap all lines that are longer than line length

    - by user1919840
    I am writing a program that limits each line to a certain length. this is what i got so far, i am almost done but i still need to cut each line, but i cant figure it out. def main(): filename = input("Please enter the name of the file to be used: ") openFile = open(filename, 'r+') file = openFile.read() lLength = int(input("enter a number between 10 & 20: ")) while (lLength < 10) or (lLength > 20) : print("Invalid input, please try again...") lLength = int(input("enter a number between 10 & 20: ")) wr = textwrap.TextWrapper() wraped = wr.wrap(file) print("Here is your output formated to a max of", lLength, "characters per line: ") wr.width = lLength wr.expand_tabs = True for lines in wraped: print(lines) an example of what the output SHOULD be is this. If the file specified contains this text: hgytuinghdt #here the length is 11 ughtnjuiknshfyth #here the length is 16 nmjhkaiolgytuhngjuin #here the length is 20 and the lLength is specified to 15 then this should print out: hgytuinghdt ughtnjuiknshfyt h nmjhkaiolgytuhng juin Thanks.

    Read the article

  • Pluralsight Meet the Author Podcast on HTML5 Canvas Programming

    - by dwahlin
      In the latest installment of Pluralsight’s Meet the Author podcast series, Fritz Onion and I talk about my new course, HTML5 Canvas Fundamentals.  In the interview I describe different canvas technologies covered throughout the course and a sample application at the end of the course that covers how to build a custom business chart from start to finish. Meet the Author:  Dan Wahlin on HTML5 Canvas Fundamentals   Transcript [Fritz] Hi. This is Fritz Onion. I’m here today with Dan Wahlin to talk about his new course HTML5 Canvas Fundamentals. Dan founded the Wahlin Group, which you can find at thewahlingroup.com, which specializes in ASP.NET, jQuery, Silverlight, and SharePoint consulting. He’s a Microsoft Regional Director and has been awarded Microsoft’s MVP for ASP.NET, Connected Systems, and Silverlight. Dan is on the INETA Bureau’s — Speaker’s Bureau, speaks at conferences and user groups around the world, and has written several books on .NET. Thanks for talking to me today, Dan. [Dan] Always good to talk with you, Fritz. [Fritz] So this new course of yours, HTML5 Canvas Fundamentals, I have to say that most of the really snazzy demos I’ve seen with HTML5 have involved Canvas, so I thought it would be a good starting point to chat with you about why we decided to create a course dedicated just to Canvas. If you want to kind of give us that perspective. [Dan] Sure. So, you know, there’s quite a bit of material out there on HTML5 in general, and as people that have done a lot with HTML5 are probably aware, a lot of HTML5 is actually JavaScript centric. You know, a lot of people when they first learn it, think it’s tags, but most of it’s actually JavaScript, and it just so happens that the HTML5 Canvas is one of those things. And so it’s not just, you know, a tag you add and it just magically draws all these things. You mentioned there’s a lot of cool things you can do from games to there’s some really cool multimedia applications out there where they integrate video and audio and all kinds of things into the Canvas, to more business scenarios such as charting and things along those lines. So the reason we made a course specifically on it is, a lot of the material out there touches on it but the Canvas is actually a pretty deep topic. You can do some pretty advanced stuff or easy stuff depending on what your application requirements are, and the API itself, you know, there’s over 30 functions just in the Canvas API and then a whole set of properties that actually go with that as well. So it’s a pretty big topic, and that’s why we created a course specifically tailored towards just the Canvas. [Fritz] Right. And let’s — let me just review the outline briefly here for everyone. So you start off with an introduction to getting started with Canvas, drawing with the HTML5 Canvas, then you talk about manipulating pixels, and you finish up with building a custom data chart. So I really like your example flow here. I think it will appeal to even business developers, right. Even if you’re not into HTML5 for the games or the media capabilities, there’s still something here for everyone I think working with the Canvas. Which leads me to another question, which is, where do you see the Canvas fitting in to kind of your day-to-day developer, people that are working business applications and maybe vanilla websites that aren’t doing kind of cutting edge stuff with interactivity with users? Is there a still a place for the Canvas in those scenarios? [Dan] Yeah, definitely. I think a lot of us — and I include myself here — over the last few years, the focus has generally been, especially if you’re, let’s say, a PHP or ASP.NET or Java type of developer, we’re kind of accustomed to working on the server side, and, you know, we kind of relied on Flash or Silverlight or these other plug-ins for the client side stuff when it was kind of fancy, like charts and graphs and things along those lines. With the what I call massive shift of applications, you know, mainly because of mobile, to more of client side, one of the big benefits I think from a maybe corporate standard way of thinking of things, since we do a lot of work with different corporations, is that, number one, rather than having to have the plug-in, which of course isn’t going to work on iPad and some of these other devices out there that are pretty popular, you can now use a built-in technology that all the modern browsers support, and that includes things like Safari on the iPad and iPhone and the Android tablets and things like that with their browsers, and actually render some really sophisticated charts. Whether you do it by scratch or from scratch or, you know, get a third party type of library involved, it’s just JavaScript. So it downloads fast so it’s good from a performance perspective; and when it comes to what you can render, it’s extremely robust. You can do everything from, you know, your basic circles to polygons or polylines to really advanced gradients as well and even provide some interactivity and animations, and that’s some of the stuff I touch upon in the class. In fact, you mentioned the last part of the outline there is building a custom data chart and that’s kind of gears towards more of the, what I’d call enterprise or corporate type developer. [Fritz] Yeah, that makes sense. And it’s, you know, a lot of the demos I’ve seen with HTML5 focus on more the interactivity and kind of game side of things, but the Canvas is such a diverse element within HTML5 that I can see it being applicable pretty much anywhere. So why don’t we talk a little bit about some of the specifics of what you cover? You talk about drawing and then manipulating pixels. You want to kind of give us the different ways of working with the Canvas and what some of those APIs provide for you? [Dan] Sure. So going all the way back to the start of the outline, we actually started off by showing different demonstrations of the Canvas in action, and we show some fun stuff — multimedia apps and games and things like that — and then also some more business scenarios; and then once you see that, hopefully it kinds of piques your interest and you go, oh, wow, this is actually pretty phenomenal what you can do. So then we start you off with, so how to you actually draw things. Now, there are some libraries out there that will draw things like graphs, but if you want to customize those or just build something you have from scratch, you need to know the basics, such as, you know, how do you draw circles and lines and arcs and Bezier curves and all those fancy types of shapes that a given chart may have on it or that a game may have in it for that matter. So we start off by covering what I call the core API functions; how do you, for instance, fill a rectangle or convert that to a square by setting the height and the width; how do you draw arcs or different types of curves and there’s different types supported such as I mentioned Bezier curves or quadratic curves; and then we also talk about how do you integrate text into it. You might have some images already that are just regular bitmap type images that you want to integrate, you can do that with a Canvas. And you can even sync video into the Canvas, which actually opens up some pretty interesting possibilities for both business and I think just general multimedia apps. Once you kind of get those core functions down for the basic shapes that you need to be able to draw on any type of Canvas, then we go a little deeper into what are the pixels that are there to manipulate. And that’s one of the important things to understand about the HTML5 Canvas, scalable vector graphics is another thing you can use now in the modern browsers; it’s vector based. Canvas is pixel based. And so we talk about how to do gradients, how can you do transforms, you know, how do you scale things or rotate things, which is extremely useful for charts ’cause you might have text that, you know, flips up on its side for a y-axis or something like that. And you can even do direct pixel manipulation. So it’s really, really powerful. If you want to get down to the RGBA level, you can do that, and I show how to do that in the course, and then kind of wrap that section up with some animation fundamentals. [Fritz] Great. Yeah, that’s really powerful stuff for programmatically rendering data to clients and responding to user inputs. Look forward to seeing what everyone’s going to come up with building this stuff. So great. That’s — that’s HTML5 Canvas Fundamentals with Dan Wahlin. Thanks very much, Dan. [Dan] Thanks again. I appreciate it.

    Read the article

  • Can spliting an access database cause printer and reporting issues?

    - by leeand00
    We have a setup in which our users log into an access database using MS Access 2003 over an RDP connection. The user's login to their own machines first using a roaming profile. They then click an rdp connection file on the desktop and login to the remote server, via RDP, where they use MS Access as the shell; they don't have any access to any of explorer.exe features such as the start menu. The database they are logging into is more of an application, and provides functionality for entering data, querying data, and running reports via form based menus. It all worked pretty well until we split the database as it was nearing 2GBs in size. We moved out the payroll data into a separate partition, a database with the same name in a different folder, both of them on the server. Only two tables were moved into this new database partition, and they were re-linked as external tables in the new partition. Now while everything appears to be working fine data-wise after the split, there's a new issue when our users login via RDP and attempt to run reports: often the report will not display and instead the user sees an error about the click event of the form. At first I didn't even know it was printer-related, as we didn't really change anything related to the printers as far as I knew. Confused about the error, I talked to the guy who previously worked here and who was in charge of splitting the database, and he told me to tell the users to set their default printers (on their local machines, not on the server) to the "printer" Microsoft XPS Document Writer which isn't a physical printer at all. This allowed the user's to display their reports, but if they want to print out reports, they are required to go to the File menu and select Print, clicking the print icon on the toolbar takes them to a Save As... dialog as would be expected when using the Microsoft XPS Document Writer as your default printer. It's easy to tell if the user is having a problem because a quick mouseover of the printer icon will yield a tooltip of (none) when they cannot access their reports, and a tooltip of Microsoft XPS Document Writer when they can view the reports. If the user's printer is set to anything other than Microsoft XPS Document Writer as the default on their local machine, then (none) is always displayed when they rdp to the database. The RDP settings are setup to transfer the local printer to the server. Telling the users to do this to print has been more of a band-aid on the whole situation until we find a better solution and an explanation as to why splitting a database would prevent users from printing or even viewing access database reports. Which is why I'm here asking this question. Also of note all the printers on the network now show up on the server so that when the users do click File->Print to print their reports on a physical printer, they have to look through a huge list of printers to find theirs in the dropdown. So the little band-aid fix we have is not ideal. Previously, only the printers on the user's local machine displayed here, and not all the printers on the network. My co-worker seems to think this has something to do with permissions, I personally think it has to do with roaming profiles, and Group Policies which is what I've been reading up on. I really don't know how to fix this or how it is related to splitting the database.

    Read the article

  • Creating A SharePoint Parent/Child List Relationship&ndash; SharePoint 2010 Edition

    - by Mark Rackley
    Hey blog readers… It has been almost 2 years since I posted my most read blog on creating a Parent/Child list relationship in SharePoint 2007: Creating a SharePoint List Parent / Child Relationship - Out of the Box And then a year ago I improved on my method and redid the blog post… still for SharePoint 2007: Creating a SharePoint List Parent/Child Relationship – VIDEO REMIX Since then many of you have been asking me how to get this to work in SharePoint 2010, and frankly I have just not had time to look into it. I wish I could have jumped into this sooner, but have just recently began to look at it. Well.. after all this time I have actually come up with two solutions that work, neither of them are as clean as I’d like them to be, but I wanted to get something in your hands that you can start using today. Hopefully in the coming weeks and months I’ll be able to improve upon this further and give you guys some better options. For the most part, the process is identical to the 2007 process, but you have probably found out that the list view web parts in 2010 behave differently, and getting the Parent ID to your new child form can be a pain in the rear (at least that’s what I’ve discovered). Anyway, like I said, I have found a couple of solutions that work. If you know of a better one, please let us know as it bugs me that this not as eloquent as my 2007 implementation. Getting on the same page First thing I’d recommend is recreating this blog: Creating a SharePoint List Parent/Child Relationship – VIDEO REMIX in SharePoint 2010… There are some vague differences, but it’s basically the same…  Here’s a quick video of me doing this in SP 2010: Creating Lists necessary for this blog post Now that you have the lists created, lets set up the New Time form to use a QueryString variable to populate the Parent ID field: Creating parameters in Child’s new item form to set parent ID Did I talk fast enough through both of those videos? Hopefully by now that stuff is old hat to you, but I wanted to make sure everyone could get on the same page.  Okay… let’s get started. Solution 1 – XSLTListView with Javascript This solution is the more elegant of the two, however it does require the use of a little javascript.  The other solution does not use javascript, but it also doesn’t use the pretty new SP 2010 pop-ups.  I’ll let you decide which you like better. The basic steps of this solution are: Inserted a Related Item View Insert a ContentEditorWebPart Insert script in ContentEditorWebPart that pulls the ID from the Query string and calls the method to insert a new item on the child entry form Hide the toolbar from data view to remove “add new item” link. Again, you don’t HAVE to use a CEWP, you could just put the javascript directly in the page using SPD.  Anyway, here is how I did it: Using Related Item View / JavaScript Here’s the JavaScript I used in my Content Editor Web Part: <script type="text/javascript"> function NewTime() { // Get the Query String values and split them out into the vals array var vals = new Object(); var qs = location.search.substring(1, location.search.length); var args = qs.split("&"); for (var i=0; i < args.length; i++) { var nameVal = args[i].split("="); var temp = unescape(nameVal[1]).split('+'); nameVal[1] = temp.join(' '); vals[nameVal[0]] = nameVal[1]; } var issueID = vals["ID"]; //use this to bring up the pretty pop up NewItem2(event,"http://sp2010dev:1234/Lists/Time/NewForm.aspx?IssueID=" + issueID); //use this to open a new window //window.location="http://sp2010dev:1234/Lists/Time/NewForm.aspx?IssueID=" + issueID; } </script> Solution 2 – DataFormWebPart and exact same 2007 Process This solution is a little more of a hack, but it also MUCH more close to the process we did in SP 2007. So, if you don’t mind not having the pretty pop-up and prefer the comforts of what you are used to, you can give this one a try.  The basics steps are: Insert a DataFormWebPart instead of the List Data View Create a Parameter on DataFormWebPart to store “ID” Query String Variable Filter DataFormWebPart using Parameter Insert a link at bottom of DataForm Web part that points to the Child’s new item form and passes in the Parent Id using the Parameter. See.. like I told you, exact same process as in 2007 (except using the DataFormWeb Part). The DataFormWebPart also requires a lot more work to make it look “pretty” but it’s just table rows and cells, and can be configured pretty painlessly.  Here is that video: Using DataForm Web Part One quick update… if you change the link in this solution from: <tr> <td><a href="http://sp2010dev:1234/Lists/Time/NewForm.aspx?IssueID={$IssueIDParam}">Click here to create new item...</a> </td> </tr> to: <tr> <td> <a href="javascript:NewItem2(event,'http://sp2010dev:1234/Lists/Time/NewForm.aspx?IssueID={$IssueIDParam}');">Click here to create new item...</a> </td> </tr> It will open up in the pretty pop up and act the same as solution one… So… both Solutions will now behave the same to the end user. Just depends on which you want to implement. That’s all for now… Remember in both solutions when you have them working, you can make the “IssueID” invisible to users by using the “ms-hidden” class (it’s my previous blog post on the subject up there). That’s basically all there is to it! No pithy or witty closing this time… I am sorry it took me so long to dive into this and I hope your questions are answered. As I become more polished myself I will try to come up with a cleaner solution that will make everyone happy… As always, thanks for taking the time to stop by.

    Read the article

  • Some date math fun

    - by drsql
    Note: This concept presented is pretty simple and I am not claiming that I am the first to do this… so if you were the one who came up with this, let me know and I will give you linkage Today I was needing to get the data for the current month for a query, and it hit me that I really didn’t have a good way to do this.  There were two common methods that people use: WHERE YEAR(MonthColumn) = YEAR(Getdate()) AND MONTH(MonthColumn) = MONTH(Getdate()) But this particular method is pretty horrible...(read more)

    Read the article

  • Some date math fun

    - by drsql
    Note: This concept presented is pretty simple and I am not claiming that I am the first to do this… so if you were the one who came up with this, let me know and I will give you linkage Today I was needing to get the data for the current month for a query, and it hit me that I really didn’t have a good way to do this.  There were two common methods that people use: WHERE YEAR(MonthColumn) = YEAR(Getdate()) AND MONTH(MonthColumn) = MONTH(Getdate()) But this particular method is pretty horrible...(read more)

    Read the article

  • Python PyBluez loses Bluetooth connection after a while

    - by Travis G.
    I am using Python to write a simple serial Bluetooth script that sends information about my computer stats periodically. The receiving device is a Sparkfun BlueSmirf Silver. The problem is that, after the script runs for a few minutes, it stops sending packets to the receiver and fails with the error: (11, 'Resource temporarily unavailable') Noticing that this inevitably happens, I added some code to automatically try to reopen the connection. However, then I get: Could not connect: (16, 'Device or resource busy') Am I doing something wrong with the connection? Do I need to occasionally reopen the socket? I'm not sure how to recover from this type of error. I understand that sometimes the port will be busy and a write operation is deferred to avoid blocking other processes, but I wouldn't expect the connection to fail so regularly. Any thoughts? Here is the script: import psutil import serial import string import time import bluetooth sampleTime = 1 numSamples = 5 lastTemp = 0 TEMP_CHAR = 't' USAGE_CHAR = 'u' SENSOR_NAME = 'TC0D' #gauges = serial.Serial() #gauges.port = '/dev/rfcomm0' #gauges.baudrate = 9600 #gauges.parity = 'N' #gauges.writeTimeout = 0 #gauges.open() filename = '/sys/bus/platform/devices/applesmc.768/temp2_input' def parseSensorsOutputLinux(output): return int(round(float(output) / 1000)) def connect(): while(True): try: gaugeSocket = bluetooth.BluetoothSocket(bluetooth.RFCOMM) gaugeSocket.connect(('00:06:66:42:22:96', 1)) break; except bluetooth.btcommon.BluetoothError as error: print "Could not connect: ", error, "; Retrying in 5s..." time.sleep(5) return gaugeSocket; gaugeSocket = connect() while(1): usage = psutil.cpu_percent(interval=sampleTime) sensorFile = open(filename) temp = parseSensorsOutputLinux(sensorFile.read()) try: #gauges.write(USAGE_CHAR) gaugeSocket.send(USAGE_CHAR) #gauges.write(chr(int(usage))) #write the first byte gaugeSocket.send(chr(int(usage))) #print("Wrote usage: " + str(int(usage))) #gauges.write(TEMP_CHAR) gaugeSocket.send(TEMP_CHAR) #gauges.write(chr(temp)) gaugeSocket.send(chr(temp)) #print("Wrote temp: " + str(temp)) except bluetooth.btcommon.BluetoothError as error: print "Caught BluetoothError: ", error time.sleep(5) gaugeSocket = connect() pass gaugeSocket.close() EDIT: I should add that this code connects fine after I power-cycle the receiver and start the script. However, it fails after the first exception until I restart the receiver. P.S. This is related to my recent question, Why is /dev/rfcomm0 giving PySerial problems?, but that was more about PySerial specifically with rfcomm0. Here I am asking about general rfcomm etiquette.

    Read the article

  • Problems sending and receiving data between php and perl?

    - by Chip Gà Con
    I have a problem in sending and receiving data between php and perl socket: -Problem: +php can not send all byte data to perl socket +Perl socket can not receiving all data from php . Here code php: function save(){ unset($_SESSION['info']); unset($_SESSION['data']); global $config,$ip; $start=$_POST['config']; $fp = fsockopen($_SESSION['ip'], $config['port'], $errno, $errstr, 30); if(!$fp) { $_SESSION['info']="Not connect "; transfer("Not connect".$ip, "index.php?com=server&act=info"); } else { $_SESSION['info']="Save config - ".$ip; fwrite($fp,$start); transfer("Sending data to ".$ip, "index.php?com=server&act=info"); } } Here code perl socket: #!/usr/bin/perl use strict; use warnings; use Carp; use POSIX qw( setsid ); use IO::Socket; $| = 1; my $socket = new IO::Socket::INET ( LocalHost => '192.168.150.3', LocalPort => '5000', Proto => 'tcp', Listen => 5, Reuse => 1 ); die "Coudn't open socket" unless $socket; print "\nTCPServer Waiting for client on port 5000"; my $client_socket = ""; while ($client_socket = $socket->accept()) { my $recieved_data =" "; my $send_data=" "; my $peer_address = $client_socket->peerhost(); my $peer_port = $client_socket->peerport(); print "\n I got a connection from ( $peer_address , $peer_port ) "; print "\n SEND( TYPE q or Q to Quit):"; $client_socket->recv($recieved_data,20000); #while (defined($recieved_data = <$client_socket>)) { if ( $recieved_data eq 'q' or $recieved_data eq 'Q' ) { close $client_socket; last; } elsif ($recieved_data eq 'start' or $recieved_data eq 'START' ) { $send_data = `/etc/init.d/squid start`; } elsif ($recieved_data eq 'restart' or $recieved_data eq 'RESTART' ) { $send_data = `/etc/init.d/squid restart`; } elsif ($recieved_data eq 'stop' or $recieved_data eq 'STOP' ) { $send_data = `/etc/init.d/squid stop`; } elsif ($recieved_data eq 'hostname' or $recieved_data eq 'HOSTNAME' ) { $send_data= `hostname`; } elsif ($recieved_data eq 'view-config' or $recieved_data eq 'VIEW-CONFIG' ) { $send_data = `cat /etc/squid/squid.conf` ; } else { # print $recieved_data; open OUTPUT_FILE, '> /root/data' or die("can not open file"); print OUTPUT_FILE $recieved_data; close OUTPUT_FILE } #} if ($send_data eq 'q' or $send_data eq 'Q') { $client_socket->send ($send_data); close $client_socket; last; } else { $client_socket->send($send_data); } }

    Read the article

  • How can I check if Python´s ConfigParser has a section or not?

    - by Voidcode
    How can I check if the ConfigParser mainfile has a section or not, And if it don´t then add a new section to it? I am trying with this code: import ConfigParser config = ConfigParser.ConfigParser() #if the config file don´t has the section 'globel', then add it to the config-file if not config.has_section("globel"): config.add_section("globel") config.set("globel", "settings", "someting") config.write(open("/tmp/myfile.conf", "w")) print "The new sestion globel is now added!!" #else just return the the value of globle->settings else: config.read("/tmp/myfile.conf") print "else... globle->settings == "+config.get("globel", "settings")

    Read the article

  • Cutting Paper through Visualization and Collaboration

    - by [email protected]
    It's hard not to hear about "Going Green" these days. Many are working to be more environmentally conscious in their personal lives, and this has extended to the corporate world as well. I know I'm always looking for new ways. Environmental responsibility is important at Oracle too, and we have an entire section of our website dedicated to our solutions around the Eco-Enterprise. You can check it out here: http://www.oracle.com/green/index.html Perhaps the biggest and most obvious challenge in the world of business is the fact that we use so much paper. There are many good reasons why we print today too. For example: Printing off a document, spreadsheet, or CAD design that will be reviewed and marked up while on a plane Having a printout of a facility when a field engineer performs on-site maintenance During a multi-party design review where a number of people will review a drawing in a meeting room, scribbling onto a large scale drawing print to provide their collaborative comments These are just a few potential use cases, and they're valid ones. However, there's a way in which you can turn these paper processes into digital ones. AutoVue allows you to view, mark-up, and collaborate on all the data you would print. Indeed, this is the core of what AutoVue does. So if we take the examples above, we could address each as follows: Allow you to view the document, spreadsheet, or CAD drawing in AutoVue on your laptop. Even if you originally had this data vaulted in some time of system of record (like an ECM solution) and view your data from there, AutoVue allows you to "Work Offline" and take the documents you need to review on your laptop. From there, the many annotation tools in AutoVue will give you what you need to comment upon the documents that you are reviewing. The challenge with the mobile workforce is always access to information. People who perform maintenance and repair operations often are in locations with little to no Internet connectivity. However, technology is coming to these people in the form of laptops, tablet PCs, and other portable devices too. AutoVue can address situations with limited bandwidth through our streaming technology for viewing, meaning that the most up to date information can be pulled up from the central server - without the need for large data transfer. When there is no connectivity at all, the "Work Offline" option will handle this. For a design review session, the Real-Time Collaboration capabilities of AutoVue will let all the participants view the same document in a synchronized view, allowing each person to be able to mark-up the document at the same time. Since this is done in a web-based manner, not only is it not necessary to print the document, but you benefit by reducing the travel needed for these sessions. Not only are trees spared, but jet fuel as well. There are many steps involved with "Going Green", but each step is a necessary one. What we do today will directly influence our future generations, and we're looking to help.

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >