file

Optimize read/write speed of a single file via caching (Mac OSX 10.4)

My bookmarks.html file is 40 MB in size. Anytime I edit a bookmark in Bookmark Manager (Firefox), I find myself waiting 10-20 seconds for the operation to complete. (Looking at the Activity Monitor, I can see there is a lot of disk activity). Q: How can I tell my OS to specifically cache the file "bookmarks.html" (so that read/write o...

File Path appearing in the Zipped File.

I have a java program as below for zipping a folder as a whole. public static void zipDir(String dir2zip, ZipOutputStream zos) { try { File zipDir= new File(dir2zip); String[] dirList = zipDir.list(); byte[] readBuffer = new byte[2156]; int bytesIn = 0; for(int i=0; i<dir...

rename files with python - regex

hello, I am wanting to rename 1k files using python. they are all in the format somejunkDATE.doc basically, I would like to delete all the junk, and only leave the date. I am unsure how to match this for all files in a directory. thanks ...

Is it possible to store a FILE * in a user defined struct?

Hi all, first post here so be nice ;) Is it possible to store a FILE * in a struct, i see no reason why not but the following code wont compile, i can't seem to store a reference to file pointer either. typedef struct fileType { FILE * file; char fileName[MAX_FILENAME_LEN]; unsigned linesRead; unsigned nextBufLine; ...

how is a file represented on a disk

Hello, so I want to ask, and forgive me if this is obvious, or newbie question: if I create a file, say a text file - save it, (I'm using Ubuntu), so this file I have created, has some extra information associated with it, such as, the place on my hard drive where it has been saved. How to examine this information? Where does this inform...

Mercurial: How do I find the creator of a file?

ATM I do it this way which is far slow and incorrect: for i in `find -type f`; do echo $i`LANG=C hg log -v $i | grep user | tail -1 | awk '{print " "; print $2}'`; done When someone has moved a file to a new name, yes he is the creator of that new file, but not of the code which he moved. I could extract the revision number out of t...

Is this usage of python tempfile.NamedTemporaryFile secure?

Is this usage of Python tempfile.NamedTemporaryFile secure (i.e. devoid security issues of deprecated tempfile.mktemp)? def mktemp2(): """Create and close an empty temporary file. Return the temporary filename""" tf = tempfile.NamedTemporaryFile(delete=False) tfilename = tf.name tf.close() return tfilename outfi...

Sitemap file location

Hello, I have developed a sitemap index and other sitemaps in cakephp on my website. Currently the sitemap index is called using the URL http://mysitename/sitemap and not http://mysitename/sitemap.xml Would it be possible for the search engines to understand the sitemap index location? ...

Silverlight and skydrive/dropbox

Hi, Can You read/write a file in your Skydrive with Silverlight? Or if that isn't possible, can you dot it with Dropbox? thanks, Filip ...

Email notification on file change in particular directory with Python

Hello everyone, I would like to script a function wich is looking in a particular directory for files, if there are new files, it should send out an notification email. I already prepared a script which is looking for new files in a directory, it write the notification about a new file into the console. But now I would like to notified...

Searching for multiple strings in multiple files

I have a text file containing 21000 strings (one line each) and 500 MB of other text files (maily source codes). For each string I need to determine if it is contained in any of those files. I wrote program that does the job but its performance is terrible (it would do that in couple of days, I need to have the job done in 5-6 hours max)...

File upload using attachement_fu in rails

Hi, I want to know how to upload files(other than images) using attachement_fu plugin in rails. I successfully uploaded images using attachement_fu, but wasn't able to upload other kinds of files. ...

What are the return values for apr_file_open()?

I want to be able to differentiate between "file not exist" and "other" errors when opening a file using apr_file_open(). It seems like the official documentation at apr_file_open doesn't list expected return values or even file permission enums. Anyone can point me to more documentation on it? ...

Ruby won't read /proc/mounts IFF in a thread and on RHEL 5.5

I've been successfully reading the Linux file '/proc/self/mounts' from within a Ruby thread using stock Ruby in Ubuntu Lucid (ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]). Now I'm trying to do the same on Red Hat 5.5 (ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]), but the thread won't complete. I wrote a testing script...

How does linux file descriptor limits work?

I was told that my server refused to accept client network connections at a specific port could be due to the lack of file descriptors. I looked up what this is all about and read about it here: http://www.netadmintools.com/art295.html So I tested my system and I got this: cat /proc/sys/fs/file-nr 1088 0 331287 What does this m...

Clean up my makefile fragment?

I'm using GNU Make to run scientific data analysis, where we have a bunch of Matlab scripts that ponder some input data and then spit out several files. It does this in a fairly complex way, so I've had to do some nasty Makefile tricks when trying to describe its function to Make. Here's an example: seg_cams_nozero := cam1 cam2 cam3 s...

Hints and tips for a Windows service I am creating in C# and Quartz.NET

Hi all, I have a project ongoing at the moment which is create a Windows Service that essentially moves files around multiple paths. A job may be to, every 60 seconds, get all files matching a regular expression from an FTP server and transfer them to a Network Path, and so on. These jobs are stored in an SQL database. Currently, the se...

redirect or pipe file to standard out

How do u redirect a small(<20k) file to be piped to another program, so that it is never written to disc. You could use cfront and gcc as an example. Any example will do as long as you are redirecting something that normally outputs a file to something that usually accepts a file. You could could use any script or shell, but I would pr...

Display file content in browser using ASP.Net

Hi, I want to display a file content (HTML file) inside a web page using ASP. I'm trying to display 2 files and show the differences. So i need to color different rows. I tried with TextBox but i can not color a single row. Something like this but inside a browser. I should be able to easily navigate through rows. (like SetRowColor(row...

AS2 fileReference.download not downloading?

I am trying to force the download of a file (image) vie fileReference. It works great when tested in the flash publish preview, but not when its posted online. Im publishing to AS2 from CS3, by browser has flash player 10 installed. When i click my download link, i couldn't get the save file dialog box. How this can be solved? ...