file

Java Can't Open a File with Surrogate Unicode Values in the Filename?

I'm dealing with code that does various IO operations with files, and I want to make it able to deal with international filenames. I'm working on a Mac with Java 1.5, and if a filename contains Unicode characters that require surrogates, the JVM can't seem to locate the file. For example, my test file is: "草鷗外.gif" which gets broken int...

Ideas to manage IP and Ports in Key/Value format?

I'm looking for a good and fast way to manage IP addresses and ports in a file. Sort of a DB Table that has 2 columns: IP and Port, but in a file, without using a DB. It has to support adding, deleting and updating. I don't care from concurrency. Thanks. ...

Single unix command to correctly transfer a large file?

I am trying to transfer a large (~3GB) file between two unix machines. I can use scp or rsync, but sometimes the transfer is corrupted. (I have to check manually.) I can split the file into pieces and transfer them and then checksum and then recombine, but this is tedious. Is there a single command to correctly transfer a large file be...

ftp file sharing

Hi friends, I want to write a client server program in linux which works like ftp, but I am unable to get or put the files from and to the server. Please suggest any ideas to do it... ...

How to get the HTML's input element of "file" type to only accept pdf files?

is there any way that html element file <input name="file1" type="file" style="width:300px"> only accept PDF files and when we browse its only show PDF files... Thanks ...

Ruby - Working with Mechanize::File response without saving to disk

Hi all, I'm working on my first ORM project and am using Mechanize. Here's the situation: I'm downloading a zip file from my website into a Mechanize::File object. Inside the zip is a file buried three folders deep (folder_1/folder_2/file.txt). I'd like to pull file.txt out of the zip file and return that instead of the zip file itse...

Problem about python writing files

I've got a weird problem with python programming. I used the statement'writelines()' to write a series of lists into a new file.During the process I could see the context in the file icon via preview, however once after the program finished running the output file comes out to be a blank file. In short, my problem is that the program do...

Copying live sites to local

Recently I've been getting more and more into web development and as such have a few questions. I have a few websites that are on a production LAMP server and I've been trying to copy them to my local computer running xampp 1.7.1 on XP Pro. The problem I've been having is mostly path issues. I mainly develop for wordpress, joomla, magent...

html file upload form

I have a web application with a simple file upload requirement (max 1 mb). The web application is an externally exposed web site that must be (as much as possible) compatible with all browsers and versions. We are using C# .net 3.5 ASP .Net (IIS 7) technology. We are having trouble implementing the file upload control: <input type="f...

Java file construction - why am I getting different results?

I've just stumbled on a weird scenario and am wondering if anyone can explain this behaviour. Case 1: File base = new File(""); System.out.println(base.getAbsolutePath()); System.out.println(base.isDirectory()); System.out.println(base.canRead()); Result: C:\workspace-sss\Commons false false Case 2: File base = new File("C:/works...

Can I include a custom XML file in my application for default content?

I want to load content into my application from a web server, but if the internet is not available, I would like the user to have access to either default or old, downloaded content. It will be XML formatted. I know how to download XML from the web server into my app and I can store the XML-as-string and reload. But, how do I "ship" t...

Quaqua problem with JFileChooser save file dialog

Hi all! I just started using Quaqua 6.1.1 with Snow Leopard - and it is SOOOOO!!! much better than the regular JFileChooser (with Apple's Aqua) or awt.FileDialog. However I noticed a couple of minor glitches when I tried to present a JFileChooser.showSaveDialog(). One or both of these effects happen: - even though I had set "fc.setFileSe...

copy file from one folder to other

I want to move all files from one folder to other. my code is following in this i made a folder in which i want to copy all file from templats folder $doit = str_replace (" ", "", $slt['user_compeny_name']); mkdir("$doit"); $source="templat/"; $target=$doit."/"; $dir =...

php and file storage on windows servers

My question is related to using a difference drive on a windows server to store files. The partition of the server is too small to handle a large amount of data files, and I want to use the D: drive as the file storage space. My problem is, how do I access the files when they're stored on the D: drive using php? I've tried a multitude o...

Switch from file contents to STDIN in piped command? (Linux Shell)

I have a program (that I did not write) which is not designed to read in commands from a file. Entering commands on STDIN is pretty tedious, so I'd like to be able to automate it by writing the commands in a file for re-use. Trouble is, if the program hits EOF, it loops infinitely trying to read in the next command dropping an endless to...

Creating a download link for .jpg file using PHP

This one should be easy, I think. I have a paginated image gallery, and under each image is a small link that says "Download Comp". This should allow people to quickly download the .jpg file (with a PHP generated watermark) to their computer. Now, I know I can just link straight to the .jpg file, but that requires the user to have the i...

Are there any Unforseen Difficulties with Offloading Image Storage to Amazon CloudFront using C#?

I'm contemplating the use of Amazon's CloudFront service to offload my web applications image/file storage from my web host. Users of my app can upload images, the image is named and the path is stored in a database. I'm thinking of just having the app upload the image to CloudFront and then change the path to use the CloudFront service...

How to use deleteFile() with argument that contains path separator?

Hi, In the application there is deleteFile(String path) method implemented which has to delete the file located at the given path. If the path contains pah separator (char '/') the method throws an exception but to delete a specific file a full path has to be used and it contains a separator sign. Due to conflicting condition I haven't...

How to get File within' package, in an Android application

I'm am creating an Android application, but in order to have one of the functionalities working I need to read a predefined xml file whilst only knowing its name, not the R.id.. In normal Java I know I can use getClass().getClassLoader().getResource(xmlName) but using the limited Android SDK thats not working, any knows how to solve ...

In Python, how do I transform a string into a file?

There is a read-only library function that takes a file as an argument. But I have a string. How do I convert a string to a file, that if you read the file it will return this string? I don't want to write to disk. ...