file

Event handler for when a user has added an image.

I have a form that lets users upload a image of them self. I need an jQuery event handler for when the input in uploaded. As always muchas gracias to any help. <script> $('#imageFile').someeventhander(function(){do some work son!}); </script> <input id="imageFile" type="file"> ...

counting the number of lines in a text file.

hey there, I'm reading lines off of text file and I'm wondering if this is a good way to go?. I had to write the function numberoflines to decrease the number_of_lines variable by one because within the while loop, for every line it read it adds 2 to the number_of_lines variable. #include <iostream> #include <fstream> using namespace st...

How to efficiently identify a binary file

What's the most efficient way to identify a binary file? I would like to extract some kind of signature from a binary file and use it to compare it with others. The brute-force approach would be to use the whole file as a signature, which would take too long and too much memory. I'm looking for a smarter approach to this problem, and I'...

Should I be comparing bytes using struct?

I'm trying to compare the data within two files, and retrieve a list of offsets of where the differences are. I tried it on some text files and it worked quite well.. However on non-text files (that still contain ascii text), I call them binary data files. (executables, so on..) It seems to think some bytes are the same, even though whe...

How to create a custom post type with file input in wordpress 3.0?

I'm pretty new to wordpress and haven't found a post on this but how do you create a wordpress custom post type that includes a file input? Also, I'm creating a portfolio page that will have 3 large images and a thumbnail. is using a custom post type with file input the correct route? or should i be uploading my images some other way and...

What would cause this code to produce a file lock error?

The code below writes to a text file in a while loop and sometimes it will produce an error saying that the "The process cannot access the file because its being used by another process" etc..." The error usually happens on "using (FileStream fs = File.OpenRead(filePath)) " Is there a way to check the file is no longer being used or a wa...

How can I detect when someone opens the slave side of a pty (pseudo-terminal) in Linux?

Having more than one process read from a serial device (/dev/ttyXX) makes it so that both processes can't get all of the data -- the data will be split between them in some way. I'd like to write a program that reads from a serial device, creates several master/slave pty pairs, and then allows programs that were made to read from the se...

"Fingerprinting" files?

I'm working on a solution where I need to associate metadata with files. In order to be able to associate the right file with the right metadata if the file is moved for instance I need to be able create a "fingerprint" of sorts to identify the file. The obvious solution would be simply to calculate a hash from the file contents, howev...

Writing a list of data values to a .dat file to plot in GNUplot (in C)

Hiya, I have written two different methods to numerically differentiate a function and I am looking for a way to compare them. I have installed GNUPlot and would like to make a file (e.g. approximations.dat) for it to plot. At the moment my programn prints a series of columns with x-coordinate, approximation 1, approximation 2 and actu...

Batch file to read ini

I am trying to automate editing the boot.ini depending on the partition XP loads from. This is a snippet of the batch I am working on. One minute it works and the next it fails. It doesn't always correctly read from the boot.ini Any suggestions ? @echo off find "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" boot.ini | sort /r | date ...

Reading files using Python

I have a file of the following format. "08-10-2010 13:29:31 1 APs were seen " "08-10-2010 13:29:31 MAC Address SSID RSSI" "08-10-2010 13:29:31 00:1e:79:d7:d5:b0 -80" "08-10-2010 13:30:32 2 APs were seen " "08-10-2010 13:30:32 MAC Address S...

Visual studio 2010 locking issue when developing user controls

I researched quite a lot on this but finally seemed to pin down on this issue. Visual Studio some times randomly locks the build dll/exe file if you have custom controls in your project. Steps to replicate: Create a winforms app/dll project Add a new class, say CustomButton that inherits from Button Build Create a form. Look in the too...

Working Offline with Javascript, how to get full file path?

Here's my problem, i want to make an ID-Card generator site that needs users photo, but i don't want any file to be uploaded to the server so i decided to working offline with javascript, here's some part of my code <html> <head> <title>Try</title> <script language="javascript"> function getFile() { document...

How do you find the filename that you pass to open()?

I'm trying to open a file with Python, but I'm unsure how to find the correct filename to use. ...

I'm having trouble opening a Python file :(

I saved a file as DictionaryE.txt in a Modules folder I created within Python. Then I type: fh = open("DictionaryE.txt") I get this error message: Traceback (most recent call last): File "<pyshell#17>", line 1, in <module> fh = open("DictionaryE.txt") IOError: [Errno 2] No such file or directory: 'DictionaryE.txt' What am I d...

looking for a web based file mgr, workflow (open source) app

hey guys. working on a project, that will involve 100s of files that go through a development/review/test workflow process. (knowledgetree is too large/bloated..) the developer checks the file out/in, where the reviewer then reviews (accepts/denies) the file which passes it to the next phase where it's tested and again (accept/deny). i...

PHP move_uploaded_file() error ?

I using following code and it is successfully uploading files on my local machine. It is showing "Successfully uploaded" on my local machine. // Upload file $moved = move_uploaded_file($_FILES["file"]["tmp_name"], "images/" . "myFile.txt" ); if( $moved ) { echo "Successfully uploaded"; } else { echo "Not uploaded"; } But...

AttributeError: 'file' object has no attribute 'open' in Django while assigning a local file to the FileField

Possible Duplicate: How to assign a local file to the FileField in Django? I was trying to assign a file from my disk to the FileField, but I have this error: AttributeError: 'file' object has no attribute 'open' My python code: pdfImage = FileSaver() myPdfFile = open('mytest.pdf') pdfImage.myfile.save('new', myPdfFile) a...

How to upload a file via ftp in PHP?

I have a form with html browse type and a submit button. I chose a file using browse button and submit the form. On form submission following code is called. $conn_id="myid"; $conn_id = ftp_connect ( 'server' ); $ftp_user_name="username"; $ftp_user_pass="password"; // login with username and password $login_result = ftp_login ( $conn_i...

'System.Nullable<bool>' does not contain a definition for 'OK'

I'm trying a basic file dialog example from, here, and I get an error on 'OK', and I don't know why. Error 1 'System.Nullable' does not contain a definition for 'OK' and no extension method 'OK' accepting a first argument of type 'System.Nullable' could be found (are you missing a using directive or an assembly reference?) privat...