file

Getting rid of \x## in strings (Python)

I need to extract a description from a file, which looks like this: "TES4!\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00HEDR\x0c\x00\xd7\xa3p?h\x03\x00\x00\x00\x08\x00\xffCNAM\t\x00Martigen\x00SNAM\xaf\x00Mart's Mutant Mod - RC4\n\nDiverse creatures & NPCs, new creatures & NPCs, dynamic size and stat scaling...

File upload with Yii

Please for your solution about file upload with Yii. Thanks! ...

xsl reference to external xsl file

Hi all, I have a question about xsl. I have 1 huge xsl file (+4000 lines :p) and I would like to split the file in different parts. I use the xsl file to map some schemas in BizTalk and it would be more performant if I split it in parts, so I can re-use the parts. Anyway, don't mind the BizTalk stuff, how can I reference from my main xs...

How to get a document in server - JAVA

I have HTML content from a HTML editor. It's just String and I need to send it as a RTF file to a web service. I think the web service may validate the MIME type and the header of the content that I will send. I tried to create a file on the server, put the HTML content there and then get the file to send, but I couldn’t find a way of do...

Reading from a file in C++ and sending to socket until eof

I am trying to read from a file and write the output to a socket in C++. However when trying to compile my code I get two errors. One is #include <cassert> #include <arpa/inet.h> #include <cstdlib> #include <iostream> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <errno.h> #include <...

How can I read file from classes directory in my WAR?

I need to read text file from the classpath in Java WAR application. How can I read it as InputStream. File is located in /WEB-INF/classes/ folder, but when I use following code, it just returns null. InputStream input = servletContext.getClass().getClassLoader().getResourceAsStream("my_filename.txt"); ...

How to tell if sqlite database file is valid or not

In the code below, pathToNonDatabase is the path to a simple text file, not a real sqlite database. I was hoping for sqlite3_open to detect that, but it doesn't (db is not NULL, and result is SQLITE_OK). So, how to detect that a file is not a valid sqlite database? sqlite3 *db = NULL; int result = sqlite3_open(pathToNonDatabase, &db);...

How to ensure that when my process is operating on a file, no other process tries to write to it or delete it?

If my process is trying to read from a file, then how do I ensure from my code (C Language) that no other process either writes to it or deletes it (include system commands for deleting the file)? Also, can this be achieved on all OS (Windows, Linux, Solaris, HP-UX, VxWorks etc)? ...

How can the block size of a file store be portably obtained in Java 7?

I believe the title says it all. I've looked at java.nio.file.attribute.Attributes and java.nio.file.FileStore, but couldn't find a way to discover the block-size of a disk-file. ...

change names of all files in a directory to random strings

Purpose: change names of all files in a directory to random strings of the same length list this files in another file (with a possibility to make from it sql query ) I think bash would be great for it, but I have no idea how to do this, can you help me? ...

How to Prevent SWF File from Loading Again After Button Click

Hi. I'm programing in ActionScript 3, and loading a swf file. I want to know how to prevent an already loaded swf file from loading again after clicking on a button. (ie. I click on the About button, which loads the swf file called "about". I click on the About button again, and the About swf file doesn't load, because its already loaded...

Unique file identifiers on NTFS and $Object_ID

From articles I have found online there appears to be two forms of unique identifiers for files on NTFS: Using Windows API GetFileInformationByHandle(), we can get access to the struct BY_HANDLE_FILE_INFORMATION, which contains a volume serial number and a low/high file index. http://msdn.microsoft.com/en-us/library/aa363788(VS.85).asp...

Java: Detecting modification to a file (file polling?)

What is the most efficient way to detect modification to a file in Java? I've read about file polling however, the polling approach has a number of drawbacks that become apparent as the number of watched files increases. I rather not use polling but a number of solutions online appear to point to file polling as the recommended method. ...

[Python] Open file into array, search for string and return value

Alright, I've been working on this for a while and cannot get it. I'm making a method that accepts a filename, and a pattern. E.g findPattern(fname, pat) Then the goal is to look for that pattern, say the string "apple" within the text file that is opened, and return it's location by [line, beginning character index] I'm new to python...

Opera multiple file upload sends files to $_POST instead of $_FILES - suggestions?

I tried googling this with little success. Can I make Opera upload files to $_FILES or will I have to start editing the PHP script? ...

Proper file reader used inside a swing Java.awt app?

Hello all- I'm trying to pull the contents of a file using only its filename (ex- file.txt). The catch is I'm doing it via a Java.awt swing applet, and the user has to input the file name into a text box. The idea is this: Client applet has a JTextField and JTextArea The User client side types in the name of a file hosted on the "serv...

Fast file copy with progress

Hello, I'm writing an SDL application for Linux, that works from the console (no X server). One function I have is a file copy mechanism, that copies specific files from HDD to USB Flash device, and showing progress of this copy in the UI. To do this, I'm using simple while loop and copying file by 8kB chunks to get copy progress. The p...

File searching in a directory using php

How i can list all the files in a folder and its sub folders using php ...

How do I make Opera upload files like other browsers?

When uploading one file using <input type="file" /> in Opera, it works as expected. That is, you find the expected file data in $_FILES in PHP server side. However, when I try to upload several files at once using Opera, by setting <input type="file" min="1" max="999" /> then all the files' contents are glued together in one long string...

BATCH FILE to remove duplicate strings containing Double Quotes; and keep blank lines

BATCH FILE to remove duplicate strings (containing Double Quotes); and keep blank lines Note: The Final Output must have original strings with Double Quotes and Blank lines. I have been working on this for a long time and I can not fine a solution, thanks in advance for your assistance. When I get the remove duplicates working somethin...