Search Results

Search found 68301 results on 2733 pages for 'file shredding'.

Page 59/2733 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • Python: Parsing a colon delimited file with various counts of fields

    - by Mark
    I'm trying to parse a a few files with the following format in 'clientname'.txt hostname:comp1 time: Fri Jan 28 20:00:02 GMT 2011 ip:xxx.xxx.xx.xx fs:good:45 memory:bad:78 swap:good:34 Mail:good Each section is delimited by a : but where lines 0,2,6 have 2 fields... lines 1,3-5 have 3 or more fields. (A big issue I've had trouble with is the time: line, since 20:00:02 is really a time and not 3 separate fields. I have several files like this that I need to parse. There are many more lines in some of these files with multiple fields. ... for i in clients: if os.path.isfile(rpt_path + i + rpt_ext): # if the rpt exists then do this rpt = rpt_path + i + rpt_ext l_count = 0 for line in open(rpt, "r"): s_line = line.rstrip() part = s_line.split(':') print part l_count = l_count + 1 else: # else break break First I'm checking if the file exists first, if it does then open the file and parse it (eventually) As of now I'm just printing the output (print part) to make sure it's parsing right. Honestly, the only trouble I'm having at this point is the time: field. How can I treat that line specifically different than all the others? The time field is ALWAYS the 2nd line in all of my report files.

    Read the article

  • Where will the image be saved? [closed]

    - by Dummy Derp
    import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.File; ... public void captureScreen(String fileName) throws Exception { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle screenRectangle = new Rectangle(screenSize); Robot robot = new Robot(); BufferedImage image = robot.createScreenCapture(screenRectangle); ImageIO.write(image, "png", new File(fileName)); } ... Going over this code I found on the internet. I got everything except the part where file is created. In what format file name should be? Should it be C:/myFolder/myImage.png" or just myImage.png and where will it be saved? Here is what docs say: File public File(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname. If the given string is the empty string, then the result is the empty abstract pathname. Parameters: pathname - A pathname string Throws: NullPointerException - If the pathname argument is null

    Read the article

  • Programmatically convert *.odt file to MS Word *.doc file using an OpenOffice.org basic macro

    - by Chen Levy
    I am trying to build a reStructuredText to MS Word document tool-chain, so I will be able to save only the rst sources in version control. So far I -- Have rst2odt.py to convert reStructuredText to OpenOffice.org Writer format. Next I want to use the most recent OpenOffice.org (currently 3.1) that do a pretty decent work of generating a Word 97/2000/XP document, so I wrote the macro: sub ConvertToWord(file as string) rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim odf(1) as new com.sun.star.beans.PropertyValue odf(0).Name = "URL" odf(0).Value = "file://" + file + ".odt" odf(1).Name = "FilterName" odf(1).Value = "MS Word 97" dispatcher.executeDispatch(document, ".uno:Open", "", 0, odf()) rem ---------------------------------------------------------------------- dim doc(1) as new com.sun.star.beans.PropertyValue doc(0).Name = "URL" doc(0).Value = "file://" + file + ".doc" doc(1).Name = "FilterName" doc(1).Value = "MS Word 97" dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, doc()) end sub But when I executing it: soffice "macro:///Standard.Module1.ConvertToWord(/path/to/odt_file_wo_ext)" I get a: "BASIC runtime error. Property or method not found." message On the line: document = ThisComponent.CurrentController.Frame And when I comment that line, the above invocation complete without error, but do nothing. I guess I need to somehow set the value of document to a newly created instance, but I don't know how to do it. Or am I going at it at a completely backward way? P.S. I will consider JODConverter as a fallback, because I try to minimize my dependencies.

    Read the article

  • allow file download to all types of files

    - by Avinash
    hi i have given my user to upload nay types of files. But my problem is that how can i force user top just download any type of files? Since pdf, jpg and text files are directly viewable to browser. So i want that any type of file should be downloaded to view. Running on php Thanks Avinash

    Read the article

  • How to quickly determine whether a file is an image file using iPhone/iPad SDK

    - by Josh Bleecher Snyder
    If I have a (potentially largish) file on disk, and I want to determine quickly whether UIImage will be able to load it. I don't necessarily trust the file extension to be reliable; I need to look at the actual data. I can (of course) load it into a UIImage, but that's relatively slow and rather memory intensive. I'd rather just peek at the first chunk of the file and make a decision. What's the fastest, most efficient way to go about this that is still fairly reliable? (Ideally, it'd be an Apple-provided API, but I didn't turn one up in my searches.) A 99.9% solution is good enough; I'm willing to have false positives in rare cases, such as when an image file has been truncated.

    Read the article

  • Send MIME-encoded file as e-mail in C#

    - by Matthias
    Hi folks, I've got the problem that I have a MIME-encoded file with all relevant mail information (subject, from, to, ...) and want to send it over a defined SMTP server via C#. I've looked at the MailMessage class and searched for a solution, but I couldn't find something fitting. Are you able to help me? Thanks, Matthias

    Read the article

  • Java FileInputStream ObjectInputStream reaches end of file EOF

    - by user69514
    I am trying to read the number of line in a binary file using readObject, but I get IOException EOF. Am I doing this the right way? FileInputStream istream = new FileInputStream(fileName); ObjectInputStream ois = new ObjectInputStream(istream); /** calculate number of items **/ int line_count = 0; while( (String)ois.readObject() != null){ line_count++; }

    Read the article

  • Android : uploaded .apk file to server but cant download that .apk file

    - by rahul
    hiiiiiiii, I have uploaded my application's .apk file to server. When i try to download tht .apk file to my android HTC HERO phone then it gives error saying "file size cannot be determined". I also enabled settings to "allow install of non-Market applications" in my HTC HERO. plz help me if i am missing somthing . and is there any signing we have to do in android like symbian signing in Symbian Devices???

    Read the article

  • Script output to file when using SQL-Developer

    - by Laurent K
    I have a select query producing a big output and I want to execute it in sqldeveloper, and get all the results into a file. Sql-developer does not allow a result bigger than 5000 lines, and I have 100 000 lines to fetch... I know i could use SQL+, but let's assume I want to do this in sqldeveloper.

    Read the article

  • read a binary file (python)

    - by beratch
    Hi, I cant read a file, and I dont understand why: f = open("test/test.pdf", "r") data = list(f.read()) print data Returns : [] I would like to open a PDF, and extract every bytes, and put it in a List. What's wrong with my code ? :( Thanks,

    Read the article

  • SSIS For Each File Loop and File System Task to copy Files

    - by Marlon
    I'm using a files system task inside a for each loop container, just as described here: link text However, when I execute the package I get this error: [File System Task] Error: An error occurred with the following error message: "The process cannot access the file 'C:\Book1.xlsx' because it is being used by another process.". I do not have the file open, and I assume no one else does, as I am able to copy, and open, and overwrite the file. Any suggestions would be appreciated. If you want an example package plz let me know.

    Read the article

  • Batch File - REN command's ErrorLevel returns 0 even on failure

    - by FMFF
    This is related to my earlier question. ren "C:\Temp\%%A" "C:\Temp\%%A" if errorlevel 0 ( "C:\Program Files\7-Zip\cmdline\7za.exe" a -tzip -mx9 "C:\temp\Zip\%%A.zip" "C:\temp\%%A" Move "C:\temp\%%A" "C:\Temp\Archive" ) In the above, the IF evaluates to true always, even if REN command fails. The idea is to check if a file is not locked by any other application, if not then Archive it and move it elsewhere. How best to do this? Thank you.

    Read the article

  • How to read values from file. tokenizer

    - by user69514
    I have a file in which each line contains two numbers. The problem is that the two number are separated by a space, but the space can be any number of blank spaces. either one, two, or more. I want to read the line and store each of the numbers in a variable, but I'm not sure how to tokenize it. i.e 1 5 3 2 5 6 3 4 83 54 23 23 32 88 8 203

    Read the article

  • Application configuration save to file or object serialization

    - by Venno
    Hi, I am working on a project and I need to save user configuration. The configuration is a set of Jchechboxes I need to store their state (true, false). Which do you think is the better way of saving it, in a file and if yes in what (ini, cfg, txt), or it is better to serialize the object with the states?? Or if there is another way, please tell me :) Cheers

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >