Hi,
I am reading in a text file using FileInputStream that puts the file contents into a byte array. I then convert the byte array into a String using new String(byte). Once I have the string I'm using String.split("\n") to split the file into a String array and then taking that string array and parsing it by doing a String.split(",...
I have created a plain file which does not have execute permission but when I create a Java File object using this file's path/name and then call File.canExecute() I get true as the result, whereas I would expect this method call to return false. Can someone explain what I'm missing here?
Solaris:
$ touch /tmp/nonexecutable
$ ls -l /t...
In my Java application I am renaming files to a file name provided in a String parameter. There is a method
boolean OKtoRename(String oldName, String newName)
which basically checks whether the newName isn't already taken by some other file, as I wouldn't want to bury existing ones.
It now occurred to me that perhaps the newName Stri...
Hello, could i get:
Name of the file from where code is running
Name of the class from where code is running
Name of the method (attribute of the class) where code is running
Thanks.
...
I have found numerous examples on uploading a file to a web server via C++ on Windows.
However I am struggling after a lot of searching (and I thought I was good with Google!) to find any examples to help me achieve the same on a Mac.
Can anyone point me towards some help on how to upload a file to a web server on a Mac OS using either...
I have some .csv files which I'm using as part of a test bench. I can open them and read them without any problems unless I've already got the file open in Excel in which case I get an IOException:
System.IO.IOException : The process cannot access the file 'TestData.csv' because it is being used by another process.
This is a snippe...
I'm building an application for the iPhone/iPod Touch using a UIWebView object. Manifest files seem like an excellent way to do this, and I have gotten our app to load successfully offline in Safari using this technique.
My problem is that once I move into my application, I can't get the manifest files to work offline in my UIWebView o...
Hi,
I would like to create a text file for export/download, like a *.csv, from an ASP.NET application. I know about Response.TransmitFile, but I want to do this without creating and saving a file physically on the server. Is that possible?
Has anyone done something like that?
...
Hi all,
I have a TXT file that i need to import via an application, but for some reason i need to open it in wordpad first and then save it before importing it. I'm guessing it has to do with Line Breaks. Cause if i open it in notepad first, there are no line breaks, but if i open it with wordpad the lines are seperated.
Does anyone kn...
Given a FILE*, is it possible to determine the underlying type? That is, is there a function that will tell me if the FILE* is a pipe or a socket or a regular on-disk file?
...
The command tries to sum up the sizes:
find . -iname "*.dmg" -exec du -sh '{}' \; 3&> /dev/null |
awk '{print $1}' | summming_up_program???
Can you find a simpler solution?
Ubuntu Solution. Thanks for the Awk-end to Ayman.
find . -iname "*.dmg" -printf '%b\n' |
awk 'BEGIN { s = 0 } {s += $1 } END { print "%dMB", s / 2^20 }'
...
I am fairly new to C++ and I have seen a bunch of code that has method definitions in the header files and they do not declare the header file as a class. Can someone explain to me why and when you would do something like this. Is this a bad practice?
Thanks in advance!
...
I have a form where user fills up (jsp page). One of the input is of type "file". There is a preview button which will pop up a new window and using javascript to layout the filled up form for display. The "file" input will be display as a hyperlink and when the user clicked on the hyperlink, it is supposed to open the attachment. So if ...
Hello All,
I have a bit of Javascript code that creates a "save friendly" version of a webpage.
child = window.open("","child");
child.document.write(htmlPage);
"htmlPage" is the basic html of the page with all the javascript references taken out, a different set of header images references, etc.
Everything displays perfect...
As part of the development phase of my iPhone app it would be really useful to load a file from my local machine, i.e. not from the application bundle. Is that possible?
The purpose of this is so that I can build a version of our game, and then give it to one of our designers and they can edit a settings file locally on their machine an...
I have a a directory with zip archives
the zip archives contain .jpg, .png, .gif images
I want to unzip each archive taking the images only and putting them in a folder with the name of the archive
so
files/archive1.zip
files/archive2.zip
files/archive3.zip
files/archive4.zip
open archive1.zip - take sunflower.jpg, rose_sun.gif...
On most UNIX systems passing an open file between processes can be easily done for child/parent processes by fork(); however I need to share a fd "after" the child was already forked.
I've found some webpages telling me that sendmsg() may work for arbitary processes; but that seems very OS dependent and complex. The portlisten seems lik...
I would like to implement a socket-like object in user space. There's an important requirement that it should be pollable (i.e. it's state should be queryable via select or poll call).
Is there a platform neutral way of implementing such an object?
I'm aware that on Linux there's eventfd which kind of suits the needs except that there'...
Hi,
We are using a third part library to render 3d. In this library there is a "memory tracker" functionality that keeps track of all memory the library has allocated and freed during execution. This is a nice feature, since it helps by determining e.g. memory leaks.
By calling a certain function in this library a log file is generated...
In C, which is the better practice when it comes to freeing memory returned from functions:
Provide a "destructor" function that encapsulates the call to free().
Require users to free() the returned pointer themselves.
For example, to open and close a file we do:
FILE* f = fopen("blah", "w");
fclose(f);
Is this preferable to:
FIL...