Search Results

Search found 68301 results on 2733 pages for 'file shredding'.

Page 77/2733 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • How to compare filename of uploaded file and string

    - by user225269
    I use this code to upload image files in xammp server: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 100000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file, File must be less than 100Kb in size with .jpg, .jpeg, or .gif file extension"; } ?> What do I do to compare the file name of the uploaded files with the text inputted by the user? My goal is to be able to compare the user input(ID number) and the file name of the image file which should also be an ID number. So that I will be able to display the image that corresponds with the ID Number provided. What do I need to do?Please give me an idea on how can I achieve this. Thanks

    Read the article

  • Program crashes after trying to use a recently created file. C#

    - by Jason T.
    So here is my code if (!File.Exists(pathName)) { File.Create(pathName); } StreamWriter outputFile = new StreamWriter(pathName,true); But whenever I run the program the first time the path with file gets created. However once I get to the StreamWriter line my program crashes because it says my fie is in use by another process. Is there something I'm missing between the File.Create and the StreamWriter statements?

    Read the article

  • Develop a custom file sync provider over file transfer WCF service

    - by user336622
    Hi All I'm trying to develop a custom sync provider to sync files over the internet using WCF service. We already have a file transfer service and it's working in production but I need to implement a custom sync provider on top of it. I've checked the solution in Braynt Likes blog here but this doesn't fulfill my needs. Any advices, guidance, or sample code to help is really appreciated?

    Read the article

  • Extract a portion of a Qt .ui file into its own .ui file

    - by Grant Limberg
    We have a designer creating a user interface for an application. The main window has several QStackedWidgets used for in place panel switching. What I'd like to be able to do is extract each individual panel that makes up each page of the QStackedWidget into it its own .ui file. Is there an easy way to accomplish this from within Qt Designer, or are there any other tools to help accomplish this task short of redesigning all of the panels in their own .ui files?

    Read the article

  • Writing Strings to files in python

    - by Leif Andersen
    I'm getting the following error when trying to write a string to a file in pythion: Traceback (most recent call last): File "export_off.py", line 264, in execute save_off(self.properties.path, context) File "export_off.py", line 244, in save_off primary.write(file) File "export_off.py", line 181, in write variable.write(file) File "export_off.py", line 118, in write file.write(self.value) TypeError: must be bytes or buffer, not str I basically have a string class, which contains a string: class _off_str(object): __slots__ = 'value' def __init__(self, val=""): self.value=val def get_size(self): return SZ_SHORT def write(self,file): file.write(self.value) def __str__(self): return str(self.value) Furthermore, I'm calling that class like this: def write(self, file): for variable in self.variables: variable.write(file) I have no idea what is going on. I've seen other python programs writing strings to files, so why can't this one? Thank you very much for your help.

    Read the article

  • SSIS Technique to Remove/Skip Trailer and/or Bad Data Row in a Flat File

    - by Compudicted
    I noticed that the question on how to skip or bypass a trailer record or a badly formatted/empty row in a SSIS package keeps coming back on the MSDN SSIS Forum. I tried to figure out the reason why and after an extensive search inside the forum and outside it on the entire Web (using several search engines) I indeed found that it seems even thought there is a number of posts and articles on the topic none of them are employing the simplest and the most efficient technique. When I say efficient I mean the shortest time to solution for the fellow developers. OK, enough talk. Let’s face the problem: Typically a flat file (e.g. a comma delimited/CSV) needs to be processed (loaded into a database in most cases really). Oftentimes, such an input file is produced by some sort of an out of control, 3-rd party solution and would come in with some garbage characters and/or even malformed/miss-formatted rows. One such example could be this imaginary file: As you can see several rows have no data and there is an occasional garbage character (1, in this example on row #7). Our task is to produce a clean file that will only capture the meaningful data rows. As an aside, our output/target may be a database table, but for the purpose of this exercise we will simply re-format the source. Let’s outline our course of action to start off: Will use SSIS 2005 to create a DFT; The DFT will use a Flat File Source to our input [bad] flat file; We will use a Conditional Split to process the bad input file; and finally Dump the resulting data to a new [clean] file. Well, only four steps, let’s see if it is too much of work. 1: Start the BIDS and add a DFT to the Control Flow designer (I named it Process Dirty File DFT): 2, and 3: I had added the data viewer to just see what I am getting, alas, surprisingly the data issues were not seen it:   What really is the key in the approach it is to properly set the Conditional Split Transformation. Visually it is: and specifically its SSIS Expression LEN([After CS Column 0]) > 1 The point is to employ the right Boolean expression (yes, the Conditional Split accepts only Boolean conditions). For the sake of this post I re-named the Output Name “No Empty Rows”, but by default it will be named Case 1 (remember to drag your first column into the expression area)! You can close your Conditional Split now. The next part will be crucial – consuming the output of our Conditional Split. Last step - #4: Add a Flat File Destination or any other one you need. Click on the Conditional Split and choose the green arrow to drop onto the target. When you do so make sure you choose the No Empty Rows output and NOT the Conditional Split Default Output. Make the necessary mappings. At this point your package must look like: As the last step will run our package to examine the produced output file. F5: and… it looks great!

    Read the article

  • sort surname in alphabet from file to file JAVA

    - by user577939
    hello all. I need some help. I have wrote this code and dont now how to sort surnames in alphabet from my file to other file. import java.io.; import java.util.; class Asmuo { String pavarde; String vardas; long buvLaikas; int atv1; int atv2; int atv3; } class Irasas { Asmuo duom; Irasas kitas; } class Sarasas { private Irasas p; Sarasas() { p = null; } Irasas itrauktiElementa(String pv, String v, long laikas, int d0, int d1, int d2) { String pvrd, vrd; int data0; int data1; int data2; long lks; lks = laikas; pvrd = pv; vrd = v; data0 = d0; data1 = d1; data2 = d2; Irasas r = new Irasas(); r.duom = new Asmuo(); uzpildymasDuomenimis(r, pvrd, vrd, lks, d0, d1, d2); r.kitas = p; p = r; return r; } void uzpildymasDuomenimis(Irasas r, String pv, String v, long laik, int d0, int d1, int d2) { r.duom.pavarde = pv; r.duom.vardas = v; r.duom.atv1 = d0; r.duom.buvLaikas = laik; r.duom.atv2 = d1; r.duom.atv3 = d2; } void spausdinti() { Irasas d = p; int i = 0; try { FileWriter fstream = new FileWriter("rez.txt"); BufferedWriter rez = new BufferedWriter(fstream); while (d != null) { System.out.println(d.duom.pavarde + " " + d.duom.vardas + " " + d.duom.buvLaikas + " " + d.duom.atv1 + " " + d.duom.atv2 + " " + d.duom.atv3); rez.write(d.duom.pavarde + " " + d.duom.vardas + " " + d.duom.buvLaikas + " " + d.duom.atv1 + " " + d.duom.atv2 + " " + d.duom.atv3 + "\n"); d = d.kitas; i++; } rez.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } } public class Gyventojai { public static void main(String args[]) { Sarasas sar = new Sarasas(); Calendar atv = Calendar.getInstance(); Calendar isv = Calendar.getInstance(); try { FileInputStream fstream = new FileInputStream("duom.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String eil; while ((eil = br.readLine()) != null) { String[] cells = eil.split(" "); String pvrd = cells[0]; String vrd = cells[1]; atv.set(Integer.parseInt(cells[2]), Integer.parseInt(cells[3]), Integer.parseInt(cells[4])); isv.set(Integer.parseInt(cells[5]), Integer.parseInt(cells[6]), Integer.parseInt(cells[7])); long laik = (isv.getTimeInMillis() - atv.getTimeInMillis()) / (24 * 60 * 60 * 1000); int d0 = Integer.parseInt(cells[2]); int d1 = Integer.parseInt(cells[3]); int d2 = Integer.parseInt(cells[4]); sar.itrauktiElementa(pvrd, vrd, laik, d0, d1, d2); } in.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } sar.spausdinti(); } }

    Read the article

  • File Segmentation when trying to write in a file

    - by user1286390
    I am trying in C language to use the method of bisection to find the roots of some equation, however when I try to write every step of this process in a file I get the problem "Segmentation fault". This might be an idiot fault that I did, however I have been trying to solve this for a long time. I am compiling using gcc and that is the code: #include <stdio.h> #include <stdlib.h> #include <math.h> #define R 1.0 #define h 1.0 double function(double a); void attractor(double *a1, double *a2, double *epsilon); void attractor(double *a1, double *a2, double *epsilon) { FILE* bisection; double a2_copia, a3, fa1, fa2; bisection = fopen("bisection-part1.txt", "w"); fa1 = function(*a1); fa2 = function(*a2); if(function(*a1) - function(*a2) > 0.0) *epsilon = function(*a1) - function(*a2); else *epsilon = function(*a2) - function(*a1); fprintf(bisection, "a1 a2 fa1 fa2 epsilon\n"); a2_copia = 0.0; if(function(*a1) * function(*a2) < 0.0 && *epsilon >= 0.00001) { a3 = *a2 - (*a2 - *a1); a2_copia = *a2; *a2 = a3; if(function(*a1) - function(*a2) > 0.0) *epsilon = function(*a1) - function(*a2); else *epsilon = function(*a2) - function(*a1); if(function(*a1) * function(*a2) < 0.0 && *epsilon >= 0.00001) { fprintf(bisection, "%.4f %.4f %.4f %.4f %.4f\n", *a1, *a2, function(*a1), function(*a1), *epsilon); attractor(a1, a2, epsilon); } else { *a2 = a2_copia; *a1 = a3; if(function(*a1) - function(*a2) > 0) *epsilon = function(*a1) - function(*a2); else *epsilon = function(*a2) - function(*a1); if(function(*a1) * function(*a2) < 0.0 && *epsilon >= 0.00001) { fprintf(bisection, "%.4f %.4f %.4f %.4f %.4f\n", *a1, *a2, function(*a1), function(*a1), *epsilon); attractor(a1, a2, epsilon); } } } fa1 = function(*a1); fa2 = function(*a2); if(function(*a1) - function(*a2) > 0.0) *epsilon = function(*a1) - function(*a2); else *epsilon = function(*a2) - function(*a1); fprintf(bisection, "%.4f %.4f %.4f %.4f %.4f\n", a1, a2, fa1, fa2, epsilon); } double function(double a) { double fa; fa = (a * cosh(h / (2 * a))) - R; return fa; } int main() { double a1, a2, fa1, fa2, epsilon; a1 = 0.1; a2 = 0.5; fa1 = function(a1); fa2 = function(a2); if(fa1 - fa2 > 0.0) epsilon = fa1 - fa2; else epsilon = fa2 - fa1; if(epsilon >= 0.00001) { fa1 = function(a1); fa2 = function(a2); attractor(&a1, &a2, &epsilon); fa1 = function(a1); fa2 = function(a2); if(fa1 - fa2 > 0.0) epsilon = fa1 - fa2; else epsilon = fa2 - fa1; } if(epsilon < 0.0001) printf("Vanish at %f", a2); else printf("ERROR"); return 0; } Thanks anyway and sorry if this question is not suitable.

    Read the article

  • Fixing corrupt files or corrupt file table on a USB drive?

    - by Kelsey
    I was doing a virus scan on an external USB drive while copying data over to it. While AVG was scanning my system got locked up I think due to the USB drive running out of space and it required a reboot. Since that time all data on the external drive is no longer accessible. I can see all the files in the root and directories but I cannot browse into any of them as Windows 7 gives an error stating they are corrupt. I think the file table or whatever it uses to store the index of what exists on the drive has been corrupted since it still shows the the drive as being almost full but everything I do a properties check on says it is 0 bytes. Does anyone know how to 'unlock' or recover this data? Is there a way to rebuild the file table somehow? Luckily I can recover this data from other sources as a last resort but I would like to fix this if possible. Any help would be appreciated. Thanks.

    Read the article

  • Is there a POSIX pathname that can't name a file?

    - by Charles Stewart
    Are there any legal paths in POSIX that cannot be associated with a file, regular or irregular? That is, for which test -e "$LEGITIMATEPOSIXPATHNAME" cannot succeed? Clarification #1: pathnames By "legal paths in POSIX", I mean ones that POSIX says are allowed, not ones that POSIX doesn't explicitly forbid. I've looked this up, and the are POSIX specification calls them character strings that: Use only characters from the portable filename character set [a-zA-Z0-9._-] (cf. http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_276); Do not begin with -; and Have length between 1 and NAME_MAX, a number unspecified for POSIX that is not less than 14. POSIX also allows that filesystems will probably be more relaxed than this, but it forbids the characters NUL and / from appearing in filenames. Note that such a paradigmatically UNIX filename as lost+found isn't FPF, according to this def. There's another constant PATH_MAX, whose use needs no further explanation. The ideal answer will use FPFs, but I'm interested in any example with filenames that POSIX doesn't expressly forbid. Clarification #2: impossibility Obviously, pathnames normally could be bound to a file. But UNIX semantics will tell you that there are special places that couldn't normally have arbitrary files created, like in the /dev directory. Are any such special places stipulated in POSIX? That is what the question is getting after.

    Read the article

  • Why Does DreamWeaver CS5 Discriminate between File Extensions, Even After Modding Mime Types!?

    - by Sam
    Hi folks, Even After I forced DreamWeaver CS5 to allow opening of .ast extensions as a MIME type of php5, which DreamWeaver now opens and colors correctly as described here, I still have trouble figuring out why it still discriminates between the two file extensions! Symptoms: External Files & Design View I have a file foo.php which php includes other files (e.g. the php-combined css.php and js.php). Now, when opening foo.php all functions work perfectly: the external (included) php files are all recognised correctly. However, when I change foo.php foo.ast, and open it again, It does not recognise the files extensions anymore in the top bar. Also, I lose the Design / Live View functionality.** When I change foo.ast to foo.php, all works again! Anyone any clues of why there remains a a difference between one and other extension? Note1: I have added the .ast extension to these four files, next to .php: 1 C:\Users\Sam\AppData\Local\VirtualStore\Program Files (x86)\Adobe\Adobe Dreamweaver CS5\configuration\DocumentTypes\MMDocumentTypes.xml 2 C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5\configuration\DocumentTypes\MMDocumentTypes.xml 3 C:\Users\Sam\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\Extensions.txt 4 C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5\configuration\Extensions.txt Note2: sometimes, even .php files do not want to show in design view or live view. Could this be caused by a corrupted installation?

    Read the article

  • Everyone can access my Windows 7 Homegroup file shares - Even Windows XP computers.

    - by adriangrigore
    Hi, I have 3 computers in my network, two running Windows 7 and one running Windows XP. I've set up a homegroup on both Windows 7 computers. Also, all computers are in the same Workgroup. The problem is that one of the Windows 7 computers makes all shares accessible to the entire Workgroup instead of just sharing to the Homegroup as it should be. I created the file share in Windows 7 via right-click in the explorer, then click on "Share For" - "Homegroup (Read/Write)" (translated from German, so the actual wording may be different). Also, when I look at the file sharing properties of that folder, Windows Explorer informs me that Users must have a valid account and password for this Computer to access drive shares. Unfortunately this is not true. Being in the same Workgroup is enough to get access. Homegroup restrictions work as expected on my other Windows 7 computer. When trying to browse those shares from the XP computer, I get a dialog asking for a login and password. What might cause homegroup restrictions to fail and how can I fix this?

    Read the article

  • What's a good solution for file-tagging in linux?

    - by julien
    I've been looking for a way to tag my files and search/filter them based on those tags. Here are my (updated) requirements : any file readable by the user can be tagged freely a user can search for files matching one or several tags files can be moved around without losing the previously associated tags the system could be backed up easily no dependencies on any desktop environment if any gui is involved, there must be a cli fallback I've been hoping for some basic filesystem & coreutils hackery to handle this, but I haven' thought about this hard enough yet. Meanwhile I'll review beagle and metatracker, which have been mentionned here, and see how they perform. Ok so beagle has huge gnome dependencies, and tracker is okish, but still has some dependencies I don't like... Been doing some more research, and the way to go could very well be extended file attributes. That's a native solution for most recent filesystems, but they aren't very well supported yet (most coreutils destroys them by default, cp for example needs the -a flag to preserve them). Would like to hear some thoughts on using them while I try my hand at some hacks myself, eventhough this might warrant a new question.

    Read the article

  • which is best smart automatic file replication solution for cloud storage based systems.

    - by TORr0t
    I am looking for a solution for a project i am working on. We are developing a websystem where people can upload their files and other people can download it. (similar to rapidshare.com model) Problem is, some files can be demanded much more than other files. The scenerio is like: I have uploaded my birthday video and shared it with all of my friend, I have uploaded it to myproject.com and it was stored in one of the cluster which has 100mbit connection. Problem is, once all of my friends want to download the file, they cant download it since the bottleneck here is 100mbit which is 15MB per second, but i got 1000 friends and they can only download 15KB per second. I am not taking into account that the hdd is serving same files. My network infrastrucre is as follows: 1 gbit server(client) and connected to 4 Nodes of storage servers that have 100mbit connection. 1gbit server can handle the 1000 users traffic if one of storage node can stream more than 15MB per second to my 1gbit (client) server and visitor will stream directly from client server instead of storage nodes. I can do it by replicating the file into 2 nodes. But i dont want to replicate all files uploadded to my network since it is costing much more. So i need a cloud based system, which will push the files into replicated nodes automatically when demanded to those files are high, and when the demand is low, they will delete from other nodes and it will stay in only 1 node. I have looked to gluster and asked in their irc channel that, gluster cant do such a thing. It is only able to replicate all the files or none of the files. But i need it the cluster software to do it automatically. Any solutions ? (instead of recommending me amazon s3) S

    Read the article

  • Does anybody know of existing code to read a mork file (Thunderbird Address Book)?

    - by bruceatk
    I have the need to read the Thunderbird address book on the fly. It is stored in a file format called Mork. Not a pleasant file format to read. I found a 1999 article explaining the file format. I would love to know if someone already has gone through this process and could make the code available. I found mork.pl by Jamie Zawinski (he worked on Netscape Navigator), but I was hoping for a .NET solution. I'm hoping StackOverflow will come to the rescue, because this just seems like a waste of my time to write something to read this file format when it should be so simple. I love the comments that Jamie put in his perl script. Here is my favorite part: # Let me make it clear that McCusker is a complete barking lunatic. # This is just about the stupidest file format I've ever seen.

    Read the article

  • replace file with hardlink to another file atomically

    - by Ben Clifford
    I have two directory entries, a and b. Before, a and b point to different inodes. Afterwards, I want b to point to the same inode as a does. I want this to be safe - by which I mean if I fail somewhere, b either points to its original inode or the a inode. most especially I don't want to end up with b disappearing. mv is atomic when overwriting. ln appears to not work when the destination already exists. so it looks like i can say: ln a tmp mv tmp b which in case of failure will leave a 'tmp' file around, which is undesirable but not a disaster. Is there a better way to do this? (what I'm actually trying to do is replace files that have identical content with a single inode containing that content, shared between all directory entries)

    Read the article

  • Regex to match the first file in a rar archive file set in Python

    - by mridang
    I need to uncompress all the files in a directory and for this I need to find the first file in the set. I'm currently doing this using a bunch of if statements and loops. Can i do this this using regex? Here's a list of files that i need to match: yes.rar yes.part1.rar yes.part01.rar yes.part001.rar yes.r01 yes.r001 These should NOT be matched: no.part2.rar no.part02.rar no.part002.rar no.part011.rar no.r002 no.r02 I found a similar regex on this thread but it seems that Python doesn't support varible length lookarounds. A single line regex would be complicated but I'll document it well and it's not a problem. It's just one of those problems you beat your heap up, over. Thanks in advance guys. :)

    Read the article

  • Parse HTML file to grab all ID and Classes for a CSS file

    - by iamfriendly
    Hey all, A short while ago, I'm fairly certain I came across an application (or perhaps a plugin for Coda - the IDE I use) which quickly parses a html document and then spits out all of the elements with IDs and Classes for me to use in a CSS file. Having fully 'got into' zen coding - using the wonderful TEA plugin for Coda, I'm now hot on the heels of this app/plugin again. I've tried and failed miserably at hunting through Google, but have come up completely empty handed. Does anyone know of anything which can do this? Happy New Year everyone!

    Read the article

  • How get file names using OpenFileDialog in .NET (1000+ file multiselect)

    - by Cole
    Maybe some of you have come across this before.... I am opening files for parsing. I'm using OpenFileDialog, of course, but i'm limited to a buffer of 2048 on the .FileNames string. Thus, I can only select a few hundred files. This is OK for most cases. However, fore example, I have in one case 1400 files to open. Do you know a way to do this with the open file dialog. I just want the string array of .FileNames, I pass that to parser class. I was also thinking of offering a FolderBrowserDialog option and then I'd use some other method to just loop through all the files in a directory, like the DirectoryInfo class. I'd do this as a last resort if I can't have an all in one solution.

    Read the article

  • Replace string in one file with contents of a second file

    - by jag7720
    I have two files: fileA: date >> /root/kvno.out kvno serverXXX\$ >> /root/kvno.out fileB: foobar I need to create a new file, fileC, with the same contents as fileA, except with the string XXX being replaced with the contents of fileB: date >> /root/kvno.out kvno serverfoobar\$ >> /root/kvno.out I'd like to do this using sed. I tried some of the examples I found but I only get the contents of fileB in fileC.

    Read the article

  • create and modify xml file using javascript (want to save xml file on client side)

    - by user201478
    Hi , How to save xml file on client side using javascript...? if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else // Internet Explorer 5/6 { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET", "User.xml", false); xhttp.send(""); xmlDoc = xhttp.responseXML; xmlDoc.getElementsByTagName("Username")[0].childNodes[0].nodeValue = 'asdasf'; xmlDoc.getElementsByTagName("password")[0].childNodes[0].nodeValue = 'asdAS'; xmlDoc.getElementsByTagName("UserId")[0].childNodes[0].nodeValue = '12'; xmlDoc.save("User.xml"); this is not working.. showing error as save is not a function. Thanks Suneetha.

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >