Say I have this simple python script:
file = open('C:\\some_text.txt')
print file.readlines()
print file.readlines()
When it is run, the first print prints a list containing the text of the file, while the second print prints a blank list. Not completely unexpected I guess. But is there a way to 'wind back' the file so that I can read...
Can i also use file_put_contents($fileapp,$content,FILE_BINARY); to move uploaded files?
...
When I run in hosted mode, it able to get the result.
But when I deploy it to tomcat then I cant get the result at all.
Anyone can tell me what is the problem??
public class Customwidget implements EntryPoint {
private static final SystemConfig constants = (SystemConfig)GWT.create(SystemConfig.class);
public void onModuleLoad() {...
hi all. I'm trying to find the creation date (NOT modification date) of a file.
Creation date doesn't appear to be in the attributes of a file, though modified date is.
I'm using this code..
NSFileManager* fm = [NSFileManager defaultManager];
NSString* path = [PathHelpers pathInDocumentsFolderWithFilename:FILE_NAME];
NSDictionary* a...
I need to rename a whole heap of files on a Windows file server - I don't mind what language I use really as long it's quick and easy!
I know it's basic but just to clarify - in pseudo-code...
server = login (fileserver, creds)
foreach (file in server.navigateToDir(dir))
rename(file)
I know how to do this in Python/C# if I was a...
Hi,
Are there any ways to store a large binary file like 50 MB in the ten files with 5 MB?
thanks
are there any special classes for doing this?
...
Hi Stackoverflow,
What would be the best way in Python to determine whether a directory is writeable for the user executing the script? Since this will likely involve using the os module I should mention I'm running it under a *nix environment.
...
I've created a batch which automatically uploads some files to FTP server, if they're modified. And modification is detected by changed file's modification time and size.
But if the modification is made within the same minute, and file size did not change, modification stays undetected, and file is not uploaded. Is there a way to get exa...
How would I list the first 5 files or directories in directory sorted alphabetically with PHP?
...
hi,
How we can know type of file in asp.net ?
...
I do apologize for asking this stupid question but I am wondering if you can help me..
i want insert among file $cat1 or $cat2 to in page.php...
the code i was create e.g.
<? //config.php
$cat_all = ($cat2 or $cat1);
$cat1 = "cat.php" ;
$cat2 = "../back-up/cat.php"; //default anyway
if(file_exists($cat1)){
require_once $cat1;
}else...
Hello,
I've been handed a file which appears to me to be a Sybase database file from some older Sybase version. I have d-loaded the latest sybase package from sybase and tried using that to connect to the contents but failed. Can someone suggest to me how to determine which version of sybase (and perhaps even which sybase db product) my...
I am trying to stream a multiline textbox into a text file on an ftp server. Can someone tell me where I may be going wrong?
private void btnSave_Click(object sender, EventArgs e)
{
UriBuilder b = new UriBuilder();
b.Host = "ftp.myserver.com";
b.UserName = "user";
b.Password = "pass";
b.Port = 21;
b.Path = "/myse...
Using Python 2.5, I'd like to create a temporary file, but add (& modify) attributes of my own. I've tried the following:
class TempFileWithAttributes ( ) :
__slots__ = [ '_tempFile' , 'Value' ]
def __init__ ( self ) :
self._tempFile = tempfile.TemporaryFile()
object.__setattr__ ( self, '_tempFile', t...
ifstream::tellg() is returning -13 for a certain file.
Basically, I wrote a utility that analyzes some source code; I open all files alphabetically, I start with "Apple.cpp" and it works perfectly.. But when it gets to "Conversion.cpp", always on the same file, after reading one line successfully tellg() returns -13.
The code in questi...
For some reason I can't get open() to open a file. Here's my code.
static int context_ctor(X86Context *ctx)
{
char file[512];
memset(ctx, 0, sizeof(X86Context));
sprintf(file, "%s.%d", "test", getpid());
ctx->fp = open(file, O_RDWR);
if(ctx->fp < 0) {
printf("errno %d %s\n", errno, file);
return VI...
I need a method of paramiko based file transfer with a lightweight SSH2 server (dropbear) which has no support for SCP or SFTP. Is there a way of achieving a cat and redirect style file transfer, such as:
ssh server "cat remote_file" > local_file
with paramiko channels?
Can paramiko.Transport.open_channel() or Message() do the job? I...
i write and my page loads it find. When i click on the link instead of having the image show on screen it promps me to download it. Why? How can i make it display in the browser? gif and jpg both display in the browser.
-edit- i am using FireFox 3.5 there is no code that serves it, its just a link and the file exist in my folder. The l...
How would I put the lines of a text file into an array with PHP? Thanks.
...
In C++ how can I determine if the program has either read-only access or read-write access to a file? I searched the boost filesystem library but I have yet to find something to help me. Right now I thinking of opening the file, trying to write inside and check for error, but that doesn't seem a very appropriate way of doing this.
Any c...