Search Results

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

Page 42/782 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • C# string equality operator returns false, but I'm pretty sure it should be true... What?!

    - by Daniel Schaffer
    I'm trying to write a unit test for a piece of code that generates a large amount of text. I've run into an issue where the "expected" and "actual" strings appear to be equal, but Assert.AreEqual throws, and both the equality operator and Equals() return false. The result of GetHashCode() is different for both values as well. However, putting both strings into text files and comparing with DiffMerge tells me they're the same. Additionally, using Encoding.ASCII.GetBytes() on both values and then using SequenceEquals to compare the resulting byte arrays returns true. The values are 34KB each, so I'll hold off putting them here for now. Any ideas? I'm completely stumped.

    Read the article

  • how to print the linenumber of incorrectwords located in a txt file ?

    - by jad
    i have this piece of code which only prints the line number of the incorrect words. i want it to print the linenumbers of the incorrect words from the txt file. Am i able to modify this code to do that? # text1 is my incorrect words # words is my text file where my incorrect word are in from collections import defaultdict d = defaultdict(list) for lineno, word in enumerate(text1): d[word].append(lineno) print(d)

    Read the article

  • Do you bother to write a pretty error page?

    - by Chacha102
    So, everyone is really used to the errors that PHP gives you. They look kind of like this: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2 bytes) in /path/to/file(437) on line 21 My question is, do you put in the time to make your error pages more useful? I find that I am able to debug a lot faster using my own error page: I find this to be a lot better than the PHP errors because it gives me a stack trace, the usual error message, along with the actual location of the error, and more. Also, are there any downsides from creating your own development error pages. Obviously you wouldn't want to have a user see this page, but what about during development?

    Read the article

  • How to print all possibilities of a number that occur interchanging the digits in a number?

    - by RADHA KRISHNA LOLLA
    I want to print that the all possibilities of a number that occurs interchanging the digits in a number? I want to print that the all possibilities of a number that occurs interchanging the digits in a number? Suppose a number 1234 it have 24 possibilities 4!=24 123 have 6 possibilities 3!=6 123 132 213 231 312 321 i want these numbers as output please tell me the structure of this program in the python

    Read the article

  • Anyone recommend a program to print multiple HTML files at once for end users?

    - by Keith Bentrup
    I have some clients with multiple html files in folders that are occasionally updated & printed. They would like to be able to print them all at once without having to open each one. I typically do this with a quick command for myself, but I'm unaware of any freeware to do this. After a google search, I'm not finding one, so I'm hoping someone can help. I'd rather not use a script to do this for various security/ease of use/familiarity reasons, I'd rather be able to just point to a simple program they can download and use on their windows desktops. Anyone know of one or some other easy solution to do this? Maybe I'm overlooking the obvious. If anyone's curious, this is what I do for myself (not for my clients): for %h in (*.html) do type "%h" >> all.htm then open all.htm & print. If I need a page break on each doc, I just search and replace in all.htm </body> with <p style="page-break-after:always">&nbsp;</p></body>. It's quick & simple, but too unfamiliar for them. Thanks!

    Read the article

  • How to use python and beautfulsoup to print timestamp/last updated time (from HTML:) for each row ?

    - by cesalo
    How to use python and beautfulsoup to print timestamp/last updated time (from HTML:) for each row ? thanks a lot ! A) 1) can i add the print a)date/time and b)last updated time after row ? a) date/time - display the time when execute the python code b) last updated time from HTML: HTML structure: td x 1 including two tables each table have few "tr" and within "tr" have few "td" data inside HTML: <td> <table width="100%" border="4" cellspacing="0" bordercolor="white" align="center"> <tbody> <tr> <td colspan="2" class="verd_black11">Last Updated: 18/08/2014 10:19</td> </tr> <tr> <td colspan="3" class="verd_black11">All data delayed at least 15 minutes</td> </tr> </tbody> </table> <table width="100%" border="4" cellspacing="0" bordercolor="white" align="center"> <tbody id="tbody"> <tr id="tr0" class="tableHdrB1" align="center"> <td align="centre">C Aug-14 - 15000</td> <td align="right"> - </td> <td align="right">5</td> <td align="right">9,904</td> </tr> </tbody> </table> </td> Code: import urllib2 from bs4 import BeautifulSoup contenturl = "HTML:" soup = BeautifulSoup(urllib2.urlopen(contenturl).read()) table = soup.find('tbody', attrs={'id': 'tbody'}) rows = table.findAll('tr') for tr in rows: cols = tr.findAll('td') for td in cols: t = td.find(text=True) if t: text = t + ';' print text, print Output from above code C Aug-14 - 15000 ; - ; 5 ; 9,904 Expected output: C Aug-14 - 15000 ; - ; 5 ; 9,904 ; 18/08/2014 ; 13:48:00 ; 18/08/2014 ; 10:19 (execute python code) (last updated time)

    Read the article

  • User Lockout & WLST

    - by Bala Kothandaraman
    WebLogic server provides an option to lockout users to protect accounts password guessing attack. It is implemented with a realm-wide Lockout Manager. This feature can be used with custom authentication provider also. But if you implement your own authentication provider and wish to implement your own lockout manager that is possible too. If your domain is configured to use the user lockout manager the following WLST script will help you to: - check whether a user is locked using a WLST script - find out the number of locked users in the realm #Define constants url='t3://localhost:7001' username='weblogic' password='weblogic' checkuser='test-deployer' #Connect connect(username,password,url) #Get Lockout Manager Runtime serverRuntime() dr = cmo.getServerSecurityRuntime().getDefaultRealmRuntime() ulmr = dr.getUserLockoutManagerRuntime() print '-------------------------------------------' #Check whether a user is locked if (ulmr.isLockedOut(checkuser) == 0): islocked = 'NOT locked' else: islocked = 'locked' print 'User ' + checkuser + ' is ' + islocked #Print number of locked users print 'No. of locked user - ', Integer(ulmr.getUserLockoutTotalCount()) print '-------------------------------------------' print '' #Disconnect & Exit disconnect() exit()

    Read the article

  • SQL SERVER – Check If Column Exists in SQL Server Table

    - by Pinal Dave
    A very frequent task among SQL developers is to check if any specific column exists in the database table or not. Based on the output developers perform various tasks. Here are couple of simple tricks which you can use to check if column exists in your database table or not. Method 1 IF EXISTS(SELECT * FROM sys.columns WHERE Name = N'columnName' AND OBJECT_ID = OBJECT_ID(N'tableName')) BEGIN PRINT 'Your Column Exists' END   For AdventureWorks sample database IF EXISTS(SELECT * FROM sys.columns WHERE Name = N'Name' AND OBJECT_ID = OBJECT_ID(N'[HumanResources].[Department]')) BEGIN PRINT 'Your Column Exists' END   Method 2 IF COL_LENGTH('table_name','column_name') IS NOT NULL BEGIN PRINT 'Your Column Exists' END For AdventureWorks sample database IF COL_LENGTH('[HumanResources].[Department]','Name') IS NOT NULL BEGIN PRINT 'Your Column Exists' END Method 3 IF EXISTS( SELECT TOP 1 * FROM INFORMATION_SCHEMA.COLUMNS WHERE [TABLE_NAME] = 'TableName' AND [COLUMN_NAME] = 'ColumnName' AND [TABLE_SCHEMA] = 'SchemaName') BEGIN PRINT 'Your Column Exists' END For AdventureWorks sample database IF EXISTS( SELECT TOP 1 * FROM INFORMATION_SCHEMA.COLUMNS WHERE [TABLE_NAME] = 'Department' AND [COLUMN_NAME] = 'Name' AND [TABLE_SCHEMA] = 'HumanResources') BEGIN PRINT 'Your Column Exists' END Let me know if you know any other method to find if Column Exists in SQL Server Table. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • HTG Explains: Why Does Photo Paper Improve Print Quality?

    - by Eric Z Goodnight
    So you’ve shelled out the money for a fancy inkjet photo printer, only you’re not impressed with the images you’re getting out of your standard office paper. Have you ever wondered why that photo paper works so much better? Surely, paper is paper, right? What can be so special about it? In this article, we’ll explore the differences between regular typing paper, why these differences are good for printing, and how to take advantage of them for superior photographic printing Latest Features How-To Geek ETC The 50 Best Registry Hacks that Make Windows Better The How-To Geek Holiday Gift Guide (Geeky Stuff We Like) LCD? LED? Plasma? The How-To Geek Guide to HDTV Technology The How-To Geek Guide to Learning Photoshop, Part 8: Filters Improve Digital Photography by Calibrating Your Monitor Our Favorite Tech: What We’re Thankful For at How-To Geek Settle into Orbit with the Voyage Theme for Chrome and Iron Awesome Safari Compass Icons Set Escape from the Exploding Planet Wallpaper Move Your Tumblr Blog to WordPress Pytask is an Easy to Use To-Do List Manager for Your Ubuntu System Snowy Christmas House Personas Theme for Firefox

    Read the article

  • How do I print values of an array in Three Rows?

    - by Ramkumar
    I need this output.. 1 3 5 2 4 6 I want to use array function like array(1,2,3,4,5,6). If I edit this array like array(1,2,3), it means the output need to show like 1 2 3 The concept is maximum 3 column only. If we give array(1,2,3,4,5), it means the output should be 1 3 5 2 4 Suppose we will give array(1,2,3,4,5,6,7,8,9), then it means output is 1 4 7 2 5 8 3 6 9 that is, maximum 3 column only. Depends upon the the given input, the rows will be created with 3 columns. Is this possible with PHP? I am doing small Research & Development in array functions. I think this is possible. Will you help me? For more info: * input: array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) * output: 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15

    Read the article

  • JS closures - Passing a function to a child, how should the shared object be accessed

    - by slicedtoad
    I have a design and am wondering what the appropriate way to access variables is. I'll demonstrate with this example since I can't seem to describe it better than the title. Term is an object representing a bunch of time data (a repeating duration of time defined by a bunch of attributes) Term has some print functionality but does not implement the print functions itself, rather they are passed in as anonymous functions by the parent. This would be similar to how shaders can be passed to a renderer rather than defined by the renderer. A container (let's call it Box) has a Schedule object that can understand and use Term objects. Box creates Term objects and passes them to Schedule as required. Box also defines the print functions stored in Term. A print function usually takes an argument and uses it to return a string based on that argument and Term's internal data. Sometime the print function could also use data stored in Schedule, though. I'm calling this data shared. So, the question is, what is the best way to access this shared data. I have a lot of options since JS has closures and I'm not familiar enough to know if I should be using them or avoiding them in this case. Options: Create a local "reference" (term used lightly) to the shared data (data is not a primitive) when defining the print function by accessing the shared data through Schedule from Box. Example: var schedule = function(){ var sched = Schedule(); var t1 = Term( function(x){ // Term.print() return (x + sched.data).format(); }); }; Bind it to Term explicitly. (Pass it in Term's constructor or something). Or bind it in Sched after Box passes it. And then access it as an attribute of Term. Pass it in at the same time x is passed to the print function, (from sched). This is the most familiar way for my but it doesn't feel right given JS's closure ability. Do something weird like bind some context and arguments to print. I'm hoping the correct answer isn't purely subjective. If it is, then I guess the answer is just "do whatever works". But I feel like there are some significant differences between the approaches that could have a large impact when stretched beyond my small example.

    Read the article

  • Reliable method for google analytics tracking for print advertising campaign?

    - by chrisjlee
    A client is looking to track advertising clicks through a newspaper ad to measure success. They have rigid business requirements that it will be a unique domain... e.g. foowidgetsnews.net instead of foodwidgets.com/contact-form-page.php What is the most reliable method of building redirected url to a landing page so it will be tracked in google analytics as a direct hit from the newspaper? Finally, we would like to track the foowidgetsnews.net as the main url in google analytics because 301 redirect isn't tracked in google analytics like the way we would like it to.

    Read the article

  • Phone-book Database Help - Python

    - by IDOntWantThat
    I'm new to programming and have an assignment I've been working at for awhile. I understand defining functions and a lot of the basics but I'm kind of running into a brick wall at this point. I'm trying to figure this one out and don't really understand how the 'class' feature works yet. I'd appreciate any help with this one; also any help with some python resources that have can dummy down how/why classes are used. You've been going to work on a database project at work for sometime now. Your boss encourages you to program the database in Python. You disagree, arguing that Python is not a database language but your boss persists by providing the source code below for a sample telephone database. He asks you to do two things: Evaluate the existing source code and extend it to make it useful for managers in the firm. (You do not need a GUI interface, just work on the database aspects: data entry and retrieval - of course you must get the program to run or properly work He wants you to critically evaluate Python as a database tool. Import the sample code below into the Python IDLE and enhance it, run it and debug it. Add features to make this a more realistic database tool by providing for easy data entry and retrieval. import shelve import string UNKNOWN = 0 HOME = 1 WORK = 2 FAX = 3 CELL = 4 class phoneentry: def __init__(self, name = 'Unknown', number = 'Unknown', type = UNKNOWN): self.name = name self.number = number self.type = type # create string representation def __repr__(self): return('%s:%d' % ( self.name, self.type )) # fuzzy compare or two items def __cmp__(self, that): this = string.lower(str(self)) that = string.lower(that) if string.find(this, that) >= 0: return(0) return(cmp(this, that)) def showtype(self): if self.type == UNKNOWN: return('Unknown') if self.type == HOME: return('Home') if self.type == WORK: return('Work') if self.type == FAX: return('Fax') if self.type == CELL: return('Cellular') class phonedb: def __init__(self, dbname = 'phonedata'): self.dbname = dbname; self.shelve = shelve.open(self.dbname); def __del__(self): self.shelve.close() self.shelve = None def add(self, name, number, type = HOME): e = phoneentry(name, number, type) self.shelve[str(e)] = e def lookup(self, string): list = [] for key in self.shelve.keys(): e = self.shelve[key] if cmp(e, string) == 0: list.append(e) return(list) # if not being loaded as a module, run a small test if __name__ == '__main__': foo = phonedb() foo.add('Sean Reifschneider', '970-555-1111', HOME) foo.add('Sean Reifschneider', '970-555-2222', CELL) foo.add('Evelyn Mitchell', '970-555-1111', HOME) print 'First lookup:' for entry in foo.lookup('reifsch'): print '%-40s %s (%s)' % ( entry.name, entry.number, entry.showtype() ) print print 'Second lookup:' for entry in foo.lookup('e'): print '%-40s %s (%s)' % ( entry.name, entry.number, entry.showtype() ) I'm not sure if I'm on the right track but here is what I have so far: def openPB(): foo = phonedb() print 'Please select an option:' print '1 - Lookup' print '2 - Add' print '3 - Delete' print '4 - Quit' entry=int(raw_input('>> ')) if entry==1: namelookup=raw_input('Please enter a name: ') for entry in foo.lookup(namelookup): print '%-40s %s (%s)' % (entry.name, entry.number, entry.showtype() ) elif entry==2: name=raw_input('Name: ') number=raw_input('Number: ') showtype=input('Type (UNKNOWN, HOME, WORK, FAX, CELL): \n>> ') for entry in foo.add(name, number, showtype): #Trying to figure out this part print '%-40s %s (%s)'% (entry.name, entry.number, entry.showtype() ) elif entry==3: delname=raw_input('Please enter a name to delete: ') # #Trying to figure out this part print "Contact '%s' has been deleted" (delname) elif entry==4: print "Phone book is now closed" quit else: print "Your entry was not recognized." openPB() openPB()

    Read the article

  • How do I convert Data::Dumper output back into a Perl data structure?

    - by newbee_me
    Hi all! I was wondering if you could shed some lights regarding the code I've been doing for a couple of days. I've been trying to convert a Perl-parsed hash back to XML using the XMLout() and XMLin() method and it has been quite successful with this format. #!/usr/bin/perl -w use strict; # use module use IO::File; use XML::Simple; use XML::Dumper; use Data::Dumper; my $dump = new XML::Dumper; my ( $data, $VAR1 ); Topology:$VAR1 = { 'device' => { 'FOC1047Z2SZ' => { 'ChassisID' => '2009-09', 'Error' => undef, 'Group' => { 'ID' => 'A1', 'Type' => 'Base' }, 'Model' => 'CATALYST', 'Name' => 'CISCO-SW1', 'Neighbor' => {}, 'ProbedIP' => 'TEST', 'isDerived' => 0 } }, 'issues' => [ 'TEST' ] }; # create object my $xml = new XML::Simple (NoAttr=>1, RootName=>'data', SuppressEmpty => 'true'); # convert Perl array ref into XML document $data = $xml->XMLout($VAR1); #reads an XML file my $X_out = $xml->XMLin($data); # access XML data print Dumper($data); print "STATUS: $X_out->{issues}\n"; print "CHASSIS ID: $X_out->{device}{ChassisID}\n"; print "GROUP ID: $X_out->{device}{Group}{ID}\n"; print "DEVICE NAME: $X_out->{device}{Name}\n"; print "DEVICE NAME: $X_out->{device}{name}\n"; print "ERROR: $X_out->{device}{error}\n"; I can access all the element in the XML with no problem. But when I try to create a file that will house the parsed hash, problem arises because I can't seem to access all the XML elements. I guess, I wasn't able to unparse the file with the following code. #!/usr/bin/perl -w use strict; #!/usr/bin/perl # use module use IO::File; use XML::Simple; use XML::Dumper; use Data::Dumper; my $dump = new XML::Dumper; my ( $data, $VAR1, $line_Holder ); #this is the file that contains the parsed hash my $saveOut = "C:/parsed_hash.txt"; my $result_Holder = IO::File->new($saveOut, 'r'); while ($line_Holder = $result_Holder->getline){ print $line_Holder; } # create object my $xml = new XML::Simple (NoAttr=>1, RootName=>'data', SuppressEmpty => 'true'); # convert Perl array ref into XML document $data = $xml->XMLout($line_Holder); #reads an XML file my $X_out = $xml->XMLin($data); # access XML data print Dumper($data); print "STATUS: $X_out->{issues}\n"; print "CHASSIS ID: $X_out->{device}{ChassisID}\n"; print "GROUP ID: $X_out->{device}{Group}{ID}\n"; print "DEVICE NAME: $X_out->{device}{Name}\n"; print "DEVICE NAME: $X_out->{device}{name}\n"; print "ERROR: $X_out->{device}{error}\n"; Do you have any idea how I could access the $VAR1 inside the text file? Regards, newbee_me

    Read the article

  • How to print Linux command output to a file?

    - by vijay.shad
    Hi, I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this. Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >