file-io

Accessing input type=“file” full path from a Java applet

我怕爱的太早我们不能终老 提交于 2020-01-04 02:55:14
问题 It is possible to access HTML DOM from an applet using netscape.javascript JSObject API. However, if I query a value of a input type="file", on some browsers (Opera) I get a full path to a selected file, but on other browsers (Firefox, Chrome) just a file name without path . Is it possible, having an HTML input type="file", to figure out the full path to the file selected in it from a Java applet? The reason why I bother: signed applets can access file system, and browsers' file selectors are

open local files in AS3

╄→гoц情女王★ 提交于 2020-01-04 02:35:10
问题 How do i open file and get its content as a ByteArray in AS3. I saw examples, using FileStream & File classes from flex.filesystem, but the doc says it's for AIR only. Thanks, Nava 回答1: You can try either URLLoader with content set for binary, or use URLStream. What do you need to load ? 回答2: You can use a FileReference object to browse for a file and then access the raw bytes via the "data" property on the FileReference when the "complete" event is dispatched. 回答3: Flex security prevents

Printwriter destination issue

不想你离开。 提交于 2020-01-04 01:29:07
问题 I am successfully writing strings to a text file with the PrintWriter, and by default the output text file is written to the directory of the Eclipse project I'm working on. But my Eclipse project has a specific folder called Resources that I want the text file to be written to: My code is: protected void saveCommandsToFile() throws FileNotFoundException, IOException { PrintWriter out = new PrintWriter("commands.txt"); int listsize = list.getModel().getSize(); for (int i=0; i<listsize; i++){

Replacing or recreating a file in Windows 8 RT keeps the old DateCreated value

时光怂恿深爱的人放手 提交于 2020-01-03 19:06:17
问题 I'm attempting to cache data in a file for a Windows Store app, and using the DateCreated value to determine if it is out of date. I first tried doing this: var file = await rootFolder.CreateFileAsync(filename, Windows.Storage.CreationCollisionOption.ReplaceExisting); FileIO.WriteTextAsync(file, contents); but when it saves the file only the DateModified value is changed, even though the comments for the ReplaceExisting option clearly state that it recreates the file and replaces an existing

Delete all files within a directory vb6

廉价感情. 提交于 2020-01-03 18:43:13
问题 I was wondering if anyone could help me with a vb6 function that would delete all files within a directory (excluding subdirectories). 回答1: One line, using the VB6 statement Kill Kill "c:\doomed_dir\*.*" The help topic says "In Microsoft Windows, Kill supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files". As an aside - I prefer to avoid the Microsoft Scripting Runtime (including FileSystemObject). In my experience it's occasionally broken on

Non-linear performance of Java function in parallel MATLAB

拜拜、爱过 提交于 2020-01-03 17:34:52
问题 Recently, I implemented parallelisation in my MATLAB program, much to the suggestions offered in Slow xlsread in MATLAB . However, implementing the parallelism has cropped up another problem - non-linearly increasing processing time with increasing scale . The culprit seems to be the java.util.concurrent.LinkedBlockingQueue method as can be seen from the attached images of profiler and the corresponding condensed graphs. Problem: How do I remove this non-linearity as my work involves

Is it possible to check if a file exists on disk using Javascript (not running in a browser)?

落花浮王杯 提交于 2020-01-03 17:12:46
问题 I am using an app that uses only JavaScript as its scripting language. I have a .ini file and I need to see if it exists. Is this possible? Also, if it doesn't exist, how can I halt the execution? 回答1: "Yes", assuming ActiveX can be used. See FileSystemObject aka "FSO" (the FileExists method in particular). FSO is part of Windows Scripting. It is also possible to use the MSXML load method to access a "file://" and catch the appropriate error. (I don't know if a vanilla XmlHttpRequest request

Parallel File Processing: What are recommended ways?

妖精的绣舞 提交于 2020-01-03 16:55:36
问题 This is by large combination of design and code problem. Use Case - Given many log files in range (2MB - 2GB), I need to parse each of these logs and apply some processing, generate Java POJO . - For this problem, lets assume that we have just 1 log file - Also, the idea is to making best use of System. Multiple cores are available. Alternative 1 - Open file (synchronous), read each line, generate POJO s FileActor -> read each line -> List<POJO> Pros : simple to understand Cons : Serial

Is it possible to fake a file stream, such as stdin, in C?

家住魔仙堡 提交于 2020-01-03 15:37:17
问题 I am working on an embedded system with no filesystem and I need to execute programs that take input data from files specified via command like arguments or directly from stdin. I know it is possible to bake-in the file data with the binary using the method from this answer: C/C++ with GCC: Statically add resource files to executable/library but currently I would need to rewrite all the programs to access the data in a new way. Is it possible to bake-in a text file, for example, and access it

How to split a huge file into words?

不想你离开。 提交于 2020-01-03 13:34:25
问题 How can I read a very long string from text file, and then process it (split into words)? I tried the StreamReader.ReadLine() method, but I get an OutOfMemory exception. Apparently, my lines are extremely long. This is my code for reading file: using (var streamReader = File.OpenText(_filePath)) { int lineNumber = 1; string currentString = String.Empty; while ((currentString = streamReader.ReadLine()) != null) { ProcessString(currentString, lineNumber); Console.WriteLine("Line {0}",