file

output in two rows for multiple columns in python

I'm working with an output list that contains the following information: [start position, stop position, chromosome, [('sample name', 'sample value'), ('sample name','sample value')...]] [[59000, 59500, chr1, [('cn_04', '1.362352462'), ('cn_01', '1.802001235')]], [100000, 110000, chr1, [('cn_03', '1.88726...

Redirect specific file request (at any location) to specific location

I have a specific file, let's call it 'myfile.abc', that I need to have redirected to a specific location, no matter what location it's requested from. For instance: /folder1/myfile.abc /folder2/myfile.abc /folder3/myfile.abc I need all the above to be redirected to (as an example): /myfolder/myfile.abc How do I achieve that within...

Java Web Start: How to write files to windows UNC Path?

I have an Java application for copying large amounts of data from users' workstations to a server. The java.io.File class is supposed to work with UNC paths very well and in fact it does but only when I run the app in standard execution model. When the application is launched via Web Start I get a FileNotFoundException when trying to op...

Efficient way of handling file pointers in Java? (Using BufferedReader with file pointer)

I have a log file which gets updated every second. I need to read the log file periodically, and once I do a read, I need to store the file pointer position at the end of the last line I read and in the next periodic read I should start from that point. Currently, I am using a random access file in Java and using the getFilePointer() m...

How to prevent access to a single file based on IP using .htaccess?

Hi, All the resources I've read explains how to prevent access to an entire directory based on IP but doesn't explain how to do this for a single file. This is what is used to protect a directory: <Limit GET POST PUT> order deny,allow deny from all allow from 123.456.78.910 </Limit> ^ here only the IP 123.456.78.910 will have acc...

How to delete empty subfolders with PowerShell

I have a share that is a "junk drawer" for end-users. They are able to create folders and subfolders as they see fit. I need to implement a script to delete files created more than 31 days old. I have that started with Powershell. I need to follow up the file deletion script by deleting subfolders that are now empty. Because of the ...

How to map file path from different folder location easily?

how to map the path to the file easily? public_html/api/function.php <?php function writetologfile($content) { $filename = 'logfile/testing_randomstring.txt'; if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } fclose($handle); } ?> the actual path of the text file i...

Check for files (robots.txt, favicon.ico) to a website php

I would like to check to a remote website if it contains some files. Eg. robots.txt, or favicon.ico. Of course the files should be accessible (read mode). So if the website is: http://www.example.com/ I would like to check if http://www.example.com/robots.txt. I tried fetching the URL like http://www.example.com/robots.txt. And sometim...

Deleting files on a remote machine

Is it possible to connect to a remote machine and delete files from it? If not, are there any other approaches that can achieve this task? Quick and dirty suggestions as well as 'proper' approaches are both welcome! One thought is that I could create a service that runs on each machine, implement a method that deletes local files, and ...

attach file to email using php

I have an input on my form to allow a user to browse to a file location. the idea being that they can attach a resume to to the application they are getting ready to submit. <label class="description" for="element_5">Upload a File </label> <div> <input id="element_5" name="element_5" class="element file" type="file"/> For ...

Why does bash sometime not flush output of a python program to a file

I have a crontab job calling a python script and outputting to a file: python run.py &> current_date.log now sometimes when I do tail -f current_date.log I see the file filling up with the output, but other times the log file exists, but stays empty for a long time. I am sure that the python script is printing stuff right after it...

file name with special characters like "é" NOT FOUND

I have a folder on my website just for random files. I used php opendir to list all the files so i can style the page a bit. But the files that I uploaded with special characters in them don't work. when i click on them it says the files are not found. but when i check the directory, the files are there. seems like the links are wrong. a...

Key compare using dictionary

Hi all, I have a file with the following structure: system.action.webMessage=An error has happened during web access. system.action.okMessage=Everything is ok. core.alert.inform=Error number 5512. I need a script to compare the keys in 2 files with this structure. I was working in a script to convert the file into a dictionary and use...

differences between ruby file access mode r+ and w+

hi all, when using files in the ruby language, what is the difference between r+ and w+ mode? and a+? great thanks. ...

JQuery File upload dialog not returning back to dialog from MVC Controller action

I have an ASP.NET MVC app which uses a jquery ui dialog for file upload. Everything is working fine with loading the dialog with the correct content and displaying the dialog on my click event however my issue is that after I process the action in my controller action method I don't return back to my dialog as I would expect an ajax like...

C#: Archiving a File into Parts of 100MB

In my application, the user selects a big file (>100 mb) on their drive. I wish for the program to then take the file that was selected and chop it up into archived parts that are 100 mb or less. How can this be done? What libraries and file format should I use? Could you give me some sample code? After the first 100mb archived part is c...

Hook into the Windows File Copy API from C#

Is there a way to hook into the Windows File Copy API from C#? I'm aware this would require unmanaged code, but a code sample or starter would be helpful. I've already seen the C++ code, but it's all greek. UPDATE: I apologize, I should have been more clear about my intentions. I wish to actually change the copy feature of Windows to...

accessing local file from php

I'm trying to gain access to a file on a client computer so that i can then later attach it to an outgoing email (resume.pdf) Ive found a few clips of code but I'm having trouble getting it to work for me. the code below seems to demonstrate all the things ill need to gather about my file but i can't quiet seem to get it to work yet. ...

C++ writing string to file = extra bytes

Hello, I am using c++ to look through 256 counts and write the ASCII representative to a file. If i use the method of generating a 256 character string then write that string to the file, the file weighs 258bytes. string fileString = ""; //using the counter to attach the ASCII count to the string. for(int i = 0; i <= 256; i++) { file...

using linq to select last written file

I wish to get the lastest written files from a directory and their extentions. An example of what file that could exist in the directory (with their creation dates): 2009-10-20T07:00:00.000 filename1.mp4 2009-10-20T07:00:01.000 filename1_0.mp4 2009-10-20T07:00:02.000 filename1_1.mp4 2009-10-20T07:00:00.000 filename1.wmv 2009-10-20T07:1...