The site I am developing in php makes many MySQL database requests per page viewed. Albeit many are small requests with properly designed index's. I do not know if it will be worth while to develop a cache script for these pages.
1) Are file I/O generally faster than database requests? Does this depend on the server? Is there a way to ...
What is the best way to figure out the size of a file using MATLAB? The first thought that comes to mind is size(fread(fid)).
...
I have a dictionary. I want to take only the words containing a simple word pattern (i.e. "cow") and write them to another file. Each line starts with a word and then the definition. I'm still extremely new at python so I don't have a good grasp of the syntax, but the pseudocode in my head looks something like:
infile = open('C:/infile....
from shutil import copy
f = open(r'C:\temp.txt', 'r')
for i in f.readlines():
print i
copy(i,r"C:\opencascade")
f.close()
I am reading path from temp.txt file which has 500 lines each line is a path for specific file to be copied to location "C:\opencascade"
How to convert 'i' in above code to be raw string to make the ...
I have a windows service set to copy files from a local directory to a samba share.
The service connects via a UNC path to the server (i.e. \remoteserver\shareddir).
I have logged in as the user under which the service is running, and was able to both copy files and create files on the samba share, using the UNC path.
However, when ru...
I have a text file that is being written to as part of a very large data extract. The first line of the text file is the number of "accounts" extracted.
Because of the nature of this extract, that number is not known until the very end of the process, but the file can be large (a few hundred megs).
What is the BEST way in C# / .NET to ...
What is the best way to convert a java.io.File to a byte[]?
...
Which operation is more time consuming - reading from a disk or writing to a disk for the same amount of data and the same memory location?
...
Hi
I'm trying to access a USB Storage device, however the device although appearing in the commputer / Drives section, is not allocated a Drive letter, thus when I itterate through the attached drives link text it does not appear, I've taken the "Location" from a file on the drive (properties) and it comes up as COMPUTER/Q1/Datacasts bu...
Let me rephrase. My example probably wasn't good.
A lot of things can go wrong when deleting a directory. A file has a readonly attribute set, the directory is opened by the windows explorer.
I guess all of them can be handled - however I don't want to do it on my own - is there a wrapper that takes care of that with a simple api?
I fin...
I need to write a series of matrices out to a plain text file from python. All my matricies are in float format so the simple
file.write() and file.writelines()
do not work. Is there a conversion method I can employ that doesn't have me looping through all the lists (matrix = list of lists in my case) converting the individual values...
File files[] = rootDir.listFiles(new FileFilter() {
public boolean accept(File file) {
if (file.isDirectory())
return true;
String name = file.getName().toLowerCase();
if (name.endsWith(".zip") || name.endsWith(".jar")
|| name.endsWith(".z") || name.endsWith(".gz")
|| name.endsWith(".tar") || n...
In an answer there was an interesting statement: "It's almost always a bad idea to use the fscanf() function as it can leave your file pointer in an unknown location on failure. I prefer to use fgets() to get each line in and then sscanf() that."
Could you expand upon when/why it might be better to use fgets() and sscanf() to read some ...
Kind of the opposite of this question.
Is there a way to tell Python "Do not write to disk until I tell you to." (by closing or flushing the file)? I'm writing to a file on the network, and would rather write the entire file at once.
In the meantime, I'm writing to a StringIO buffer, and then writing that to the disk at the end.
...
This is some code to unblock any website from listview, but now I want to unblock a website which has previously been blocked. How can I do this?
String path = @"C:\Windows\System32\drivers\etc\hosts";
StreamWriter sw = new StreamWriter(path, true);
String sitetoblock = "\n 127.0.0.1 http://"+listView1.SelectedItems[0].Text+"";
sw.Write...
Hi,
This webservice expects this xml file:
request.FeedContent = File.Open("test.xml", FileMode.Open, FileAccess.Read);
I already have the file in a stream, but this statement hangs:
stream.Position = 0;
request.FeedContent = stream;
the stream is a standard .net MemoryStream
what operation do I do on the stream to make it the sa...
Can someone point me to an article/algorithm on how can a read a long file at a certain rate? Say i do not want to pass 10 kb/sec while issuing reads.
...
I'm looking for a simple solution using Python to store data as a flat file, such that each line is a string representation of an array that can be easily parsed.
I'm sure python has library for doing such a task easily but so far all the approaches I have found seemed like it would have been sloppy to get it to work and I'm sure there ...
Hi there,
I am facing a problem,
I have created XML file,but I can't view it/output it.I know there is no way to output created XML file.
Can anyone please suggest what is better way of creating xml files?
1) create xml with DocumentBuilderFactory and then parse it Or
2) manually create hardcoded xml and save it on sd card and then acce...
How can I read inputs (letters, numbers) from my file.txt wherein it reads infinitely but only stops when it encounters special symbols? At the same time when it is numbers i.e
123,345,abc
it should translate the ascii code and add the 2 values that results as 123 + 345 = 468
EDITED QUESTION
Here's my code; I really had a problem wi...