file

Java Applet - Convert File to String

How can convert a certain file into in a String? And then from that String to get the original file? This needs to realize it using Java. It would be greate an example of code or a link to a tutorial. Have to converted an entire File (not thecontent) in the String and then the String to the File. Thanks. ...

REST API in PHP output to JSON file extension

So I want to write a REST API in PHP for JSON for consumption on the iPhone, but also a lot of websites and devices. I have the below code, when accessed via a GET statement, returns a file like: 1mdi2o3.part How do I return something like: users.json $db->setQuery( "SELECT * FROM users"); $db->query() or die($queryError); $numRows ...

What's the best way to read a huge CSV file using Perl?

Requirements: a) I have a very large CSV file to read (about 3Gb). b) I won't need all records, I mean, there are some conditionals that we can use, for example, if the 3rd CSV column content has 'XXXX' and 4th column has '999'. Can I use these conditionals to improve the read process? If so, how can I do that using Perl? Please you s...

what's the differences between r and rb in fopen

Hi, i tried fopen in C, the second parameter is open mode. two modes "r" and "rb" tricks me a lot...it seems they r the same...sometimes it better to use "rb", so, why does "r" exist?? can expain it to me, more detailed or examples thanx ...

c# , checking is file correct

Hello, I have c# program , and one file from where it read-write some info. I need that user can not change that file's content, I need some way to chek is that file correct(not changed by user). Please if you have any ideas write, will discuss together. Many Thanks ...

How to save a byte array to a file from silverlight

Hello Everybody, I have a SL 3 application connected to a WCF service. This service retrieves an array of bytes. I'd like to save that array as a pdf file using FileStream. The problem is that when the byte array is retrived, I get an exception when trying to show the SaveFileDialog because that action is initiated by the callback metho...

Class exists in an external file.

How do I check an external file for a class? I am trying to setup a install feature for my modules, so I am trying to get it to load a list of directories and then check if the module file has a method called install. So only the modules with this method will be shown in the list. Here is my code so far: $output .= '<div id="module-di...

Ml file reading limits

I want to read from file but, when I use inputAll or inputLine, it read only 70 character from each line. how can I read from file without limitation ? ...

ubercart file download setting problem

Hi I am using drupal 6.x and ubercart 2.x. I trie dto create a product,but when it comes to add the file download feature I am getting some issue. I put a folder called downloads in the drupal folder and one file inside the download folder.then I gave the path as "drupal/downloads but it is telling that drupal/downloads is not a valid fi...

PHP Get File Name Without File Extension

I have this code: function ShowFileExtension($filepath) { preg_match('/[^?]*/', $filepath, $matches); $string = $matches[0]; $pattern = preg_split('/\./', $string, -1, PREG_SPLIT_OFFSET_CAPTURE); if(count($pattern) > 1) { $filenamepart = $pattern[count($pattern)-1][0]; preg_match('/[^?]*/', $fil...

Design pattern for file based communication?

Hi all! I have to extend an existing program (Java-based, but this shouldn't count). This program should communicate with another program X. This program X is .. uhm.. a little bit older and supports only file based communication. This means I have to put my file into some specific folder. The "answer" is placed in another folder where...

Searching for a regular expression in Eclipse (finding all links without an onclick attribute)

Hi! I am trying to create a proper regular expression to find all anchors in my project with Eclipse File Search. What I'm looking for: <a href="some.url" onclick="some onclickHandler"> What I want to accomplish is finding all anchors without an onclick and add it when needed. Thanks for your help! ...

Resumable Upload in Ruby on Rails

Hi, I have been searching for a way for resumable file upload in RoR. In conclusion, I found out other than Java Applet no client-side-and-cross-platform agent can access the file system in such a way that to request the file from the position where the upload got terminated (due to any reason) with some exceptions like http://github.co...

Changing .bin file's data in C

Hello, I have a lot of data stored in bin format as a sequence of structs. I want to be able to read randomly any of the structs and modify it in C. I am trying with the following code but it doesn't work. Can someone fix it for me please? Also, would it be possible to delete an intermediate struct from the file in between? The code i...

C/C++: How to store data in a file in B tree

Hello, It appears to me that one way of storing data in a B-tree as a file can be done efficiently with C using binary file with a sequence (array) of structs, with each struct representing a node. One can thus connect the individual nodes with approach that will be similar to creating linked lists using arrays. But then the problem that...

Reading a text file or XML file in Android java

Hello all, I am currently working on a group project to build an Android game. I have been delegated the task of building a PC based level editor (which is all done). All I have to do now is decide on the file format for the map that is outputted. At the moment it is just a standard text file with different numbers to represent differe...

XCode 3.1.2, header file not found

Hi All: I have been trying to build a code that has dependencies with other header files that are not in the project directory. I added the paths to these header files in both HEADER_PATH and USER_PATH. However, I still see error while building. It says that the file is not found. I verified that the file exist in the path added t...

C: searching for a string in a file

If I have: const char *mystr = "cheesecakes"; FILE *myfile = fopen("path/to/file.exe","r"); I need to write a function to determine whether myfile contains any occurrences of mystr. Could anyone help me? Thanks! UPDATE: So it turns out the platform I need to deploy to doesn't have memstr. Does anyone know of a free implementation I c...

How to get file name when user select a file via <input type="file" />?

I've seen similar questions before,which ends up with no solution,because of security reasons. But today I see hostmonster has successfully implemented this,when I open a ticket and attach a file in their backend. It works both with firefox and IE(version 8 to be exact). I've verified it's exactly client side scripting,no request is s...

Implementing basic file system

As a college project I need to implement a basic file system from within a file. So how do I go about this? What are the things that I would need to know? The requirements include having a daemon process in the background. Also the applications that use this system need to connect to the server using a Unix domain socket The file system...