file

php pathinfo problem

I have this snippet and there are 3 images and 3 folders in the directory. It echos the images just fine but it also gives me this error for each of the folders. Notice: Undefined index: extension in D:\Data\Websites\wamp\www\StephsSite\PHP\manage.php on line 119 What i want to do is have it so if it finds a file with no extension(a ...

Python: File formatting

I have a for loop which references a dictionary and prints out the value associated with the key. Code is below: for i in data: if i in dict: print dict[i], How would i format the output so a new line is created every 60 characters? and with the character count along the side for example: 0001 MRQLLLISDLDNTWVGDQQALEH...

Ruby File.size? seems to cache file sizes.

I'm working on an app that will transcode videos that are sent into a drop box. Because videos could take anywhere from a few minutes to a few hours to be sent to the dropbox, I want to be sure the file is done being written before my app begins processing it. I thought the easiest way to do this would be to check the size of the file ...

Memory error due to the huge input file size

When I using the following code to read file: lines=file("data.txt").read().split("\n") I have the following error MemoryError the file size is ls -l -rw-r--r-- 1 charlie charlie 1258467201 Sep 26 12:57 data.txt ...

Storing and loading program data, C# WPF

I'm writing a utility program with C# in WPF that allows users to create role-playing scenarios, including monsters, items, characters, etc. The user will create or import the elements (monsters, etc) and then use the imported elements to create scenarios. Everything used by the program is created within the program, so I don't have an...

PHP: Check if file is loaded directly instead of including?

Hello Is there a way to prevent user viewing an file but still use it as included to another file in php? Hope you understood! Martti ...

How to obtain position in file (byte-position) from java scanner?

How to obtain a position in file (byte-position) from the java scanner? Scanner scanner = new Scanner(new File("file")); scanner.useDelimiter("abc"); scanner.hasNext(); String result = scanner.next(); and now: how to get the position of result in file (in bytes)? Using scanner.match().start() is not the answer, because it gives the ...

D (Tango) can read and write ANSI files ?

With D and Tango library can I read and write in the ANSI encoding ? ...

C# .dcm(dicom) file converter

Hi, I would like to know if there's some library or API to convert a .dcm file to something more common? we are using c#, so the library or API needs to support this language. please... ...

how to create thumbnail system for MP4 files

Hi everyone! I know I know, why am I using MP4 still?? It's because I have like 100 files already in this format and I need to upload to a website, I have the mp4 file embeded in the site already and the file played changes according to php. but what I really need is a way to dynamically create a thumbnail or take a snapshot of the vid...

Recursively ZIP a directory containing any number of files and subdirectories in Java?

Is there an easy way to recursively ZIP a directory that may or may not contain any number of files and any number of levels of subdirectories? ...

Does filehandle get closed automatically in Python after it goes out of scope?

If I do the following, does filehandle get closed automatically as it goes out of scope in Python: def read_contents(file_path): return file(file_path).read() If it doesn't, how can I write this function to close the scope automatically? ...

php - efficent way to get and remove first line in file

Hello, I have a script that each time is called gets the 1st line of a file. Each line is known to be exactly of the same length (32 alphanumerci chars) and terminates with a "\r\n". After getting the 1st line, the script removes it. Now I do in this way: $contents = file_get_contents($file)); $first_line = substr($contents, 0, 32); f...

Jumbled byte array after using TcpClient and TcpListener

I want to use the TcpClient and TcpListener to send an mp3 file over a network. I implemented a solution of this using sockets, but there were some issues so I am investigating a new/better way to send a file. I create a byte array which looks like this: length_of_filename|filename|file This should then be transmitted using the above m...

When does the PE file format IAT function addresses get set

I google'd a bit and read http://en.wikipedia.org/wiki/Portable_Executable but i can't seem to find when the Import adress table addresses are written. Does it happen on compilation? Or when the executable is ran? ...

upload multiple images from local drive into site

Hi, friends i want to provide facility to my users to upload multiple images into my website using asp.net 2.0, using single file uploader i.e. want to upload all the image file from a folder. Or suggest me any alternate way. Help me. Thanks in advance. ...

C .pc file warning

I have a RefTables.pc file. when i type make command. This is my warning. RefTables.c:109: warning: type defaults to `int' in declaration of `sqlcxt' RefTables.c:111: warning: type defaults to `int' in declaration of `sqlcx2t' RefTables.c:113: warning: type defaults to `int' in declaration of `sqlbuft' RefTables.c:114: warning: type d...

Stream data into a file in a linux device driver

I am rather new to Linux device driver programmring, but for debugging purposes, I would like to write a stream of data directly to a file. Or maybe I should aks the question differently: I have a system-on-chip, where one module provides a data stream. The module has to be initlized with a write address. Instead of writing the data int...

C++: Best text accumulator

Text gets accumulates piecemeal before being sent to client. Now we use own class that allocates memory for each piece as char massive. (Anyway, works like char[][] + std::list<char*>). Then we build the whole string, convert it into std::sting and then create boost::asio::streambuf using it. That's slow enough, I assume. Correct me if...

Python - file contents to nested list

Hi All, I have a file in tab delimited format with trailing newline characters, e.g., 123 abc 456 def 789 ghi I wish to write function to convert the contents of the file into a nested list. To date I have tried: def ls_platform_ann(): keyword = [] for line in open( "file", "r" ).readlines(): for value in line....