file

Best Practices for working with files via c#

Application I work on generates several hundreds of files (csv) in a 15 minutes period of times. and the back end of the application takes these files and process them (updates database with those values). One problem is database locks. What are the best practices on working with several thousands of files to avoid locking and efficient...

Apache FileUtils listFiles

Hey everyone I'm trying to get a List of directories. I'm using FileUtils listFiles(). I want to do something like this: listFiles(File,IOFileFilter,false). My real questions is how I can implement the accept() from the IOFileFilter so I can check if current File is a directory? Thank you in advance. ...

taking a character input in python from a file?

in python , suppose i have file data.txt . which has 6 lines of data . I want to calculate the no of lines which i am planning to do by going through each character and finding out the number of '\n' in the file . How to take one character input from the file ? Readline takes the whole line . ...

How to execute Vim commands in a file, like .vimrc?

I need to create a file with a list of commands (in particular key mappings) that I may sometimes need, like a .vimrc that I can execute inside Vim when I need them. ...

how can i randomly print an element from a list in python

So far i have this, which prints out every word in my list, but i am trying to print only one word at random. Any suggestions? def main(): # open a file wordsf = open('words.txt', 'r') word=random.choice('wordsf') words_count=0 for line in wordsf: word= line.rstrip('\n') print(word) words_coun...

how to display a dialog if user can't download file

hi. dealing with php/html/javascript. i'm trying to figure out a good/best approach to allowing a user to download a file. i can have the traditional href link, that interfaces with the back end php app to download the file. however, i want to have the app display some sort of dialog/alert if the user isn't able (basedon acl/permissio...

How do I use Python to prevent a file from being copied?

I have a file that I need to "protect" so that it cannot be copied! I am using Python on Windows XP. I think it may just be changing file permissions?? ...

Write pointer to file in C

I have a stucture: typedef structure student { char *name; char *surname; int age; } Student; I need to write it to binary file. Student *s = malloc(sizeof(*s)); I fill my structure with data and then i write in to the file: fwrite(s, sizeof(*s), 1, fp); In my file doesnt exist a name and surname, it have an adresses of c...

Sharepoint: Is it possible to automate the deployment of a custom CAS policy?

Hi all, I'm looking for a way to automate the deployment of a custom CAS policy in SharePoint. What i would like to achieve is the following: All assemblies that have been built and signed by our build server (with a secret key) should run in SharePoint under the 'higher than normal' trust level. Now I can manually edit the cas poli...

Why does Java automatically decode %2F in URI encoded filenames?

I have a java servlet that needs to write out files that have a user-configurable name. I am trying to use URI encoding to properly escape special characters, but the JRE appears to automatically convert encoded forward slashes %2F into path separators. Example: File dir = new File("C:\Documents and Setting\username\temp"); String f...

Adobe AIR - Options to open folder in Windows Explorer

Hello StackOverflow community, Is there any way to open a folder in Windows Explorer from Adobe AIR? It looks like these APIs won't be added until AIR 2.0, but until then are there any workarounds that can be used to enable this feature? Thanks, Mauricio ...

Problem reading subdirectories using FileUtils.listfiles...

I'm trying to get all subdirectories doing this: File repositoryDir = new File(_props.getProperty("files.repository.path")); IOFileFilter filter = new IOFileFilter() { public boolean accept(File file) { //return file.isDirectory(); return true; } @Override public boolean accept(File arg0_, String ...

download binary file from database

I have a binary file in database. How i can make a download of this file in header of page when a button is clicked Any ideas?? ...

Reading file and populating struct

Hi, I have a structure with the following definition: typedef struct myStruct{ int a; char* c; int f; } OBJECT; I am able to populate this object and write it to a file. However I am not able to read the char* c value in it...while trying to read it, it gives me a segmentation fault error. Is there anything wrong with my ...

JavaScript file changes deployment

Hi, we are having MVC web application. some of the code is in javascript. when we deploy any changes to the javascript the changes are not reflected on the client side. We have to ask clients to do CTRL+F5 to get the changes. Is there a standard way of pushing javascript changes to the clientside? ...

Form with file filed in CakePHP

How get name of field type file in beforeSave()? I have form with many file filed, and i must get names of each... ...

How to Return A File and a strongly Typed data at the same time?

Hi I am using asp.net mvc 1.0 and I want to return a XML file but I also want to return a strongly typed data back so I can update some fields. Like the XML file will contain users who failed to be inserted into the database. So I want that to appear as a dialog save box what asp.net mvc return file() would do. However I also want to ...

Import and Export for CSV are both broken in Mathematica

Consider the following 2 by 2 array: x = {{"a b c", "1,2,3"}, {"i \"comma-heart\" you", "i \",heart\" u, too"}} If we Export that to CSV and then Import it again we don't get the same thing back: Import[Export["tmp.csv", d]] Looking at tmp.csv it's clear that the Export didn't work, since the quotes are not escaped properly. Accor...

Missing archetype.xml in new archetype created from project.

Hi, I am using Maven 2.2.1. and am new to Maven. I am trying to create an archetype based on an existing project. I have been using this blog post as a guide: http://blog.inflinx.com/category/m2eclipse/ Step 7 says "The next step is to verify that the generated archetype.xml (located under srcmainresourcesMETA-INFmaven (sic)) has all...

How to use C to write to flash drive bootsector despite error 'Failed to open file to write.:Permission Denied' ?

My goal is to manipulate the boot-sector in my flashdrive (volume E:) I am using XP. I am able to read the boot-sector FILE *fp_read = fopen("\\\\.\\E:", "rb"); /* Able to proceed to read boot sector */ however i am not able to open the file to write using fopen in 'wb' mode. FILE *fp_read = fopen("\\\\.\\E:", "wb"); /* Unable t...