file

Tricky file parsing. Inconsistent Delimeters

I need to parse a file with the following format. 0000000 ...ISBN.. ..Author.. ..Title.. ..Edit.. ..Year.. ..Pub.. ..Comments.. NrtlExt Nrtl Next Navg NQoH UrtlExt Urtl Uext Uavg UQoH ABS NEB MBS FOL ABE0001 0-679-73378-7 ABE WOMAN IN THE DUNES (INT'L ED) 1st 64 RANDOM 0.00 13.90 0.00 10.43 0 21.00 10.50 6.44 3.22 2 2.00 0.50 2.00 2.00...

Determining a Local File's Mime Type (Content-type) With PHP

I am trying to determine a file's mime type. I've tried a few methods, but haven't come up with anything that gives consistent output. I've tried $mime = mime_content_type($file) and $mime = exec('file -bi ' . $file). I am serving up images, CSS, and JavaScript. Example mime_content_type() output: jquery.min.js - text/plain editor....

How to parse the file name and rename in Matlab

I am reading a .xls file and then procesing it inside and rewriting it in the end of my program. I was wondering if someone can help me to parse the dates as my input file name is like file_1_2010_03_03.csv and i want my outputfile to be newfile_2010_03_03.xls is there a way to incorporate in matlab program so i do not have to m...

UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)

First, some background: I'm developing a web application using Python. All of my (text) files are currently stored in UTF-8 with the BOM. This includes all my HTML templates and CSS files. These resources are stored as binary data (BOM and all) in my DB. When I retrieve the templates from the DB, I decode them using template.decode('utf...

How do i get a .wav sound to play ? [Android]

Im making an app, and i want it to make a sound when a activity is opened , the sound file is in R.raw.sound_file , if someone could do some example code to make my app play a sound that would be great :) ...

Shell script to process files

I need to write a Shell Script to process a huge folder of nearly 20 levels.I have to process each and every file and check which files contain lines like select insert update When I mean line it should take the line till I find a semicolon in that file. I should get a result like this C:/test.java select * from dual C:/test.java ...

ASP.NET file transfer from local machine to another machine

I basically want to transfer a file from the client to the file storage server without actual login to the server so that the client cannot access the storage location on the server directly. I can do this only if i manually login to the storage server through windows login. I dont want to do that. This is a Web-Based Application. Using...

awk output to a file

I need help in moving the contents printed by awk to a text file. THis is a continuation of previous quesion I have to move all the contents into the same file so it is appending. To be specific nawk -v file="$FILE" 'BEGIN{RS=";"} /select/{ gsub(/.*select/,"select");gsub(/\n+/,"");print file,$0;} /update/{ gsub(/.*update/,"update")...

PHP CSV upload files

hi, I have asked a question regarding updating a csv file's contents to the db @Question Now I want to add this functionality, like my db will contain url to images that are stored on a prespecified folder on the server. The csv files will contain the urls as to where these images reside on the client side. Now when I click an upload ...

rails - Redirecting console output to a file

On a bash console, if I do this: cd mydir ls -l > mydir.txt The > operator captures the standard input and redirects it to a file; so I get the listing of files in mydir.txt instead of in the standard output. Is there any way to do something similar on the rails console? I've got a ruby statement that generates lots of prints (~8k l...

Borland StarTeam 2008 - How to Recover file + file History

Hi all I accidently delete a file from the Starteam repository, I am able to view the file content on different view/configuration, and I am able to copy it and recheck-in the file but its history is important. Is it possible to restore the file along with its history? Thank you Sharon whipple ...

Own data format for the iPhone

Hi, I would like to create my own data format for an iPhone app. The files should be similar structured as e.g. Apple's iWork files (.pages). That means, I have a folder with some files in it: The file 'Juicy.fruit' contains: Fruits ---> Apple.xml ---> Banana.xml ---> Pear.xml ---> PreviewPicture.png This folder "Fruit...

Include .STP file as feature to create .WSP file

I have to give the client a .wsp file Please give me an example of how to include the .stp inside the feature and include that feature along with other files to create a .wsp file. I have gone thru lots of site where they show the steps but I dont understand how to approach as I have got different files like .dlls files, custom event ...

Working with multiple input and output files in Python

I need to open multiple files (2 input and 2 output files), do complex manipulations on the lines from input files and then append results at the end of 2 output files. I am currently using the following approach: in_1 = open(input_1) in_2 = open(input_2) out_1 = open(output_1, "w") out_2 = open(output_2, "w") # Read one line from each...

PHP file download header

I have developed a small download system in PHP, where files are downloaded through a proxy file. When I had to do this before, I just redirected by changing the location header; which is not what I want to do now. So, obviously, the first issue that appeared is what kind of header must I set. First of all, Content-Disposition is set as...

File system query

Is there an easy way to query data in file system? We are storing data in File system (instead of database) Is there a way to query the content of the file system? The data in the file system is stored in xml format. since the data is growing day by day we are finding it difficult to query the content of the files in the file system. Can...

Access violations in strange places when using Windows file dialogs

A long time ago I found out that I was getting access violations in my code due to the use of the Delphi Open File and/or Save File dialogs, which encapsulate the Windows dialogs. I asked some questions on a few forums and I was told that it may have been due to the way some programs add hooks to the shell system that result in DLLs ge...

Parsing JPEG file format: Format of entropy-coded segments (ECS) ?

I'm having difficulty understanding the ITU-T T.81 spec for the JPEG file format. Hopefully someone else here has tried to parse JPEG files and/or knows about the details of this file format. The spec indiates that the ECS0 segment starts after the SOS segment but I can't find where in the spec it actually talks about the format of the ...

Memory efficient way to remove duplicate lines in a text file using C++

What is the most memory efficient way to remove duplicate lines in a large text file using C++? Let me clarify, I'm not asking for code, just the best method. The duplicate lines are not guaranteed to be adjacent. I realize that an approach optimized for minimal memory usage would result in slower speeds however this is my restriction...

c++ simple conditional logging

Disclaimer: I'm not a c++ developer, I can only do basic things. (I understand pointers, just my knowledge is so rusty, I haven't touch c/c++ for about 20 years :) ) The setup: I have an Outlook addin, written in C#/.Net 1.1. It uses a c++ shim to load. Usually, this works pretty well, and I use in my c# code nlog for logging purposes....