Search Results

Search found 89549 results on 3582 pages for 'large file support'.

Page 66/3582 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • Delete a line from a file in java

    - by dalton conley
    Ok, so I'm trying to delete lines from a text file with java. Currently the way I'm doing this, is I'm keep track of a line number and inputting an index. The index is the line I want deleted. So each time I read a new line of data I increment the line count. Now when I reach the line count that is the same index, I dont write the data to the temporary file. Now this works, but what if for example I'm working with huge files and I have to worry about memory restraints. How can I do this with.. file markers? For example.. place the file marker on the line I want to do delete. Then delete that line? Or is that just too much work?

    Read the article

  • Integrating application ad-support - best practice

    - by Jarede
    Considering the review that came out in March: Researchers from Purdue University in collaboration with Microsoft claim that third-party advertising in free smartphone apps can be responsible for as much as 65 percent to 75 percent of an app's energy consumption. Is there a best practice for integrating advert support into mobile applications, so as to not drain user battery too much. When you fire up Angry Birds on your Android phone, the researchers found that the core gaming component only consumes about 18 percent of total app energy. The biggest battery suck comes from the software powering third-party ads and analytics accounting for 45 percent of total app energy, according to the study. Has anyone invoked better ways of keeping away from the "3G Tail", as the report puts it. Is it better/possible to download a large set of adverts that are cached for a few hours, and using them to populate your ad space, to avoid constant use of the wifi/3g radios. Are there any best practices for the inclusion of adverts in mobile apps?

    Read the article

  • Enable File sharing in Windows Vista

    - by LiveEn
    There seems to be a problem in my Windows Vista.. In the network and sharing centre only the network discovery is visible. I cant find a option for file sharing as mentions in other websites. There is no folder sharing option on any folder. Can someone please tell me how to enable file sharing in my Windows Visa? i cant share any of my file in the network.

    Read the article

  • Reading from a file, atoi() returns zero only on first element

    - by Nazgulled
    Hi, I don't understand why atoi() is working for every entry but the first one. I have the following code to parse a simple .csv file: void ioReadSampleDataUsers(SocialNetwork *social, char *file) { FILE *fp = fopen(file, "r"); if(!fp) { perror("fopen"); exit(EXIT_FAILURE); } char line[BUFSIZ], *word, *buffer, name[30], address[35]; int ssn = 0, arg; while(fgets(line, BUFSIZ, fp)) { line[strlen(line) - 2] = '\0'; buffer = line; arg = 1; do { word = strsep(&buffer, ";"); if(word) { switch(arg) { case 1: printf("[%s] - (%d)\n", word, atoi(word)); ssn = atoi(word); break; case 2: strcpy(name, word); break; case 3: strcpy(address, word); break; } arg++; } } while(word); userInsert(social, name, address, ssn); } fclose(fp); } And the .csv sample file is this: 900011000;Jon Yang;3761 N. 14th St 900011001;Eugene Huang;2243 W St. 900011002;Ruben Torres;5844 Linden Land 900011003;Christy Zhu;1825 Village Pl. 900011004;Elizabeth Johnson;7553 Harness Circle But this is the output: [900011000] - (0) [900011001] - (900011001) [900011002] - (900011002) [900011003] - (900011003) [900011004] - (900011004) What am I doing wrong?

    Read the article

  • ASP.NET Hosting :: ASP.NET File Upload Control

    - by mbridge
    The asp.net FileUpload control allows a user to browse and upload files to the web server. From developers perspective, it is as simple as dragging and dropping the FileUpload control to the aspx page. An extra control, like a Button control, or some other control is needed, to actually save the file. <asp:FileUploadID="FileUpload1"runat="server"/> <asp:ButtonID="B1"runat="server"Text="Save"OnClick="B1_Click"/> By default, the FileUpload control allows a maximum of 4MB file to be uploaded and the execution timeout is 110 seconds. These properties can be changed from within the web.config file’s httpRuntime section. The maxRequestLength property determines the maximum file size that can be uploaded. The executionTimeout property determines the maximum time for execution. <httpRuntimemaxRequestLength="8192"executionTimeout="220"/> From code behind, the mime type, size of the file, file name and the extension of the file can be obtained. The maximum file size that can be uploaded can be obtained and modified using the System.Web.Configuration.HttpRuntimeSection class. Files can be alternatively saved using the System.IO.HttpFileCollection class. This collection class can be populated using the Request.Files property. The collection contains HttpPostedFile class which contains a reference to the class. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Configuration; using System.Web.Configuration;   namespace WebApplication1 {     public partial class WebControls : System.Web.UI.Page     {         protected void Page_Load(object sender, EventArgs e)         {         }           //Using FileUpload control to upload and save files         protected void B1_Click(object sender, EventArgs e)         {             if (FileUpload1.HasFile && FileUpload1.PostedFile.ContentLength > 0)             {                 //mime type of the uploaded file                 string mimeType = FileUpload1.PostedFile.ContentType;                   //size of the uploaded file                 int size = FileUpload1.PostedFile.ContentLength; // bytes                   //extension of the uploaded file                 string extension = System.IO.Path.GetExtension(FileUpload1.FileName);                                  //save file                 string path = Server.MapPath("path");                                 FileUpload1.SaveAs(path + FileUpload1.FileName);                              }             //maximum file size allowed             HttpRuntimeSection rt = new HttpRuntimeSection();             rt.MaxRequestLength = rt.MaxRequestLength * 2;             int length = rt.MaxRequestLength;                     //execution timeout             TimeSpan ts = rt.ExecutionTimeout;             double secomds = ts.TotalSeconds;           }           //Using Request.Files to save files         private void AltSaveFile()         {             HttpFileCollection coll = Request.Files;             for (int i = 0; i < coll.Count; i++)             {                 HttpPostedFile file = coll[i];                   if (file.ContentLength > 0)                     ;//do something             }         }     } }

    Read the article

  • reading binary datafile and writing into decimal no file

    - by swaroop b banerjee
    exp data is generated by my mc scaler card as a binary file with first 511 bytes as header and then 24 bit data followed by four bit roi data. i am not a expert in programming. i do understand a little. I would like to convert this file into a file (without header) decimal nos with first col as channel no (1 to 8191) then the data (24 bit) then the Roi data (4 bit). I am looking for source code in c or qbasic. thanks

    Read the article

  • Can one .PHP file edit another?

    - by Ole Jak
    So I have a file for constants. I want to let user define them and then edit my .php filr with that global constants (not xml - real PHP file ) With such code for example <?php // Database Constants define("DB_SERVER", "localhost"); define("DB_USER", "root"); define("DB_PASS", "000000"); define("DB_NAME", "cms"); ?> How to edit this .php file from another PHP file? Is it possible? Btw in future I want to implement not only constants redefining but some smart code that will be able to modify itself.

    Read the article

  • Memory Efficient file append

    - by lboregard
    i have several files whose content need to be merged into a single file. i have the following code that does this ... but it seems rather inefficient in terms of memory usage ... would you suggest a better way to do it ? the Util.MoveFile function simply accounts for moving files across volumes private void Compose(string[] files) { string inFile = ""; string outFile = "c:\final.txt"; using (FileStream fsOut = new FileStream(outFile + ".tmp", FileMode.Create)) { foreach (string inFile in files) { if (!File.Exists(inFile)) { continue; } byte[] bytes; using (FileStream fsIn = new FileStream(inFile, FileMode.Open)) { bytes = new byte[fsIn.Length]; fsIn.Read(bytes, 0, bytes.Length); } //using (StreamReader sr = new StreamReader(inFile)) //{ // text = sr.ReadToEnd(); //} // write the segment to final file fsOut.Write(bytes, 0, bytes.Length); File.Delete(inFile); } } Util.MoveFile(outFile + ".tmp", outFile); }

    Read the article

  • Build file generated by android broken?

    - by Eno
    I generated a build file for an Android project using the android tool (Im using the build file in Hudson to automate builds). However, in Eclipse the build.xml file is flagged as having an error so my project no longer builds in Eclipse - it says that the default target ("help") doesn't exist (its in one of the Android build files referenced in build.xml and copmmand-line builds work just fine). So what do I need to do to keep Eclipse quiet?

    Read the article

  • saving multiple files through xcopy in a batch file

    - by sushant
    for %f in (D:\flexcube1,D:\flexcube2,D:\flexcube3) do xcopy %f D:\o\ /e when i use the following code in command prompt, it works fine. but when i use the same code in a batch file, nothing happens. my batch file simply consists of: for %f in (D:\flexcube1,D:\flexcube2,D:\flexcube3) do xcopy %f D:\o\ /e but it does not work. i dont understand it and i have to use a batch file to copy multiple files. any help is really appreciated

    Read the article

  • Using Jquery.Form Plugin + MultiFile to automatically upload a single file

    - by Alan Neal
    I wanted to find a way to upload a single file*, in the background, have it start automatically after file selection, and not require a flash uploader, so I am trying to use two great mechanisms (jQuery.Form and JQuery MultiFile) together. I haven't succeeded, but I'm pretty sure it's because I'm missing something fundamental. Just using MultiFile, I define the form as follows... <form id="photoForm" action="image.php" method="post" enctype="multipart/form-data"> The file input button is defined as... <input id="photoButton" "name="sourceFile" class="photoButton max-1 accept-jpg" type="file"> And the Javascript is... $('#photoButton').MultiFile({ afterFileSelect: function(){ document.getElementById("photoForm").submit(); } }); This works perfectly. As soon as the user selects a single file, MultiFile submits the form to the server. If instead of using MultiFile, as shown above, let's say I include a Submit button along with the JQuery Form plugin defined as follows... var options = { success: respondToUpload }; $('#photoForm').ajaxForm(options); ... this also works perfectly. When the Submit button is clicked, the form is uploaded in the background. What I don't know how to do is get these two to work together. If I use Javascript to submit the form (as shown in the MultiFile example above), the form is submitted but the JQuery.Form function is not called, so the form does not get submitted in the background. I thought that maybe I needed to change the form registration as follows... $('#photoForm').submit(function() { $('#photoForm').ajaxForm(options); }); ...but that didn't solve the problem. The same is true when I tried .ajaxSubmit instead of .ajaxForm. What am I missing? BTW: I know it might sound strange to use MultiFile for single-file uploads, but the idea is that the number of files will be dynamic based on the user's account. So, I'm starting with one but the number changes depending on conditions.

    Read the article

  • Get last n lines of a file with Python, similar to tail

    - by Armin Ronacher
    I'm writing a log file viewer for a web application and for that I want to paginate through the lines of the log file. The items in the file are line based with the newest item on the bottom. So I need a tail() method that can read n lines from the bottom and supports an offset. What I came up with looks like this: def tail(f, n, offset=0): """Reads a n lines from f with an offset of offset lines.""" avg_line_length = 74 to_read = n + offset while 1: try: f.seek(-(avg_line_length * to_read), 2) except IOError: # woops. apparently file is smaller than what we want # to step back, go to the beginning instead f.seek(0) pos = f.tell() lines = f.read().splitlines() if len(lines) >= to_read or pos == 0: return lines[-to_read:offset and -offset or None] avg_line_length *= 1.3 Is this a reasonable approach? What is the recommended way to tail log files with offsets?

    Read the article

  • Is there a free web file manager like Plesk or cPanel in ASP.Net

    - by Ron Klein
    I'm looking for a free, open-sourced web application written in C#/VB.Net on top of ASP.Net, which functions like Plesk or cPanel when it comes to (remote) file management. Something that simulates a regular FTP client, but actually displays web pages over HTTP, with the following functions: Create Folder Rename File/Folder Delete File/Folder Change Timestamp ("Touch") Move Archive etc. I saw a few commercial tools, but nothing when it comes to OSS. Any ideas? links?

    Read the article

  • Problem with reading file line-by-line

    - by Maulrus
    I'm trying to complete an exercise to write a program that takes the following command line arguments: an input file, an output file, and an unspecified number of words. The program is to read the contents of the input file line by line, find for each word given which lines contain the word, and print the lines with their line number to the output file. Here's my code: #include <iostream> #include <fstream> #include <string> #include <sstream> using namespace std; int main(int argc, char* argv[]) { if (argc < 4) { cerr << "Error #1: not enough arguments provided\n"; return 1; } ifstream in(argv[1]); if (!in.is_open()) { cerr << "Error #2: input file could not be opened\n"; return 2; } ofstream out(argv[2]); if (!out.is_open()) { cerr << "Error #3: output file could not be opened\n"; return 3; } ostringstream oss; for (int i = 3; i < argc; ++i) { int k = 0; string temp; oss << argv[i] << ":\n\n"; while (getline(in, temp)) { ++k; unsigned x = temp.find(argv[i]); if (x != string::npos) oss << "Line #" << k << ": " << temp << endl; } } string copy = oss.str(); out << copy; in.close(); out.close(); return 0; } If I try to run that, I get the predicted output for the first word given, but any words following it aren't found. For example, for the source code above will give the following output: in: Line #1: #include <iostream> Line #2: #include <fstream> Line #3: #include <string> Line #4: #include <sstream> Line #5: using namespace std; Line #7: int main(int argc, char* argv[]) { Line #12: ifstream in(argv[1]); Line #13: if (!in.is_open()) { Line #14: cerr << "Error #2: input file could not be opened\n"; Line #22: ostringstream oss; Line #23: string temp; Line #24: for (int i = 3; i < argc; ++i) { Line #26: int k = 0; Line #28: while (getline(in, temp)) { Line #30: unsigned x = temp.find(argv[i]); Line #31: if (x != string::npos) Line #32: oss << "Line #" << k << ": " << temp << endl; Line #35: string copy = oss.str(); Line #37: in.close(); out: That is, it'll find all the instances of the first word given but not any following. What am I doing wrong here?

    Read the article

  • ASP.NET- using System.IO.File.Delete() to delete file(s) from directory inside wwwroot?

    - by Jim S
    Hello, I have a ASP.NET SOAP web service whose web method creates a PDF file, writes it to the "Download" directory of the applicaton, and returns the URL to the user. Code: //Create the map images (MapPrinter) and insert them on the PDF (PagePrinter). MemoryStream mstream = null; FileStream fs = null; try { //Create the memorystream storing the pdf created. mstream = pgPrinter.GenerateMapImage(); //Convert the memorystream to an array of bytes. byte[] byteArray = mstream.ToArray(); //return byteArray; //Save PDF file to site's Download folder with a unique name. System.Text.StringBuilder sb = new System.Text.StringBuilder(Global.PhysicalDownloadPath); sb.Append("\\"); string fileName = Guid.NewGuid().ToString() + ".pdf"; sb.Append(fileName); string filePath = sb.ToString(); fs = new FileStream(filePath, FileMode.CreateNew); fs.Write(byteArray, 0, byteArray.Length); string requestURI = this.Context.Request.Url.AbsoluteUri; string virtPath = requestURI.Remove(requestURI.IndexOf("Service.asmx")) + "Download/" + fileName; return virtPath; } catch (Exception ex) { throw new Exception("An error has occurred creating the map pdf.", ex); } finally { if (mstream != null) mstream.Close(); if (fs != null) fs.Close(); //Clean up resources if (pgPrinter != null) pgPrinter.Dispose(); } Then in the Global.asax file of the web service, I set up a Timer in the Application_Start event listener. In the Timer's ElapsedEvent listener I look for any files in the Download directory that are older than the Timer interval (for testing = 1 min., for deployment ~20 min.) and delete them. Code: //Interval to check for old files (milliseconds), also set to delete files older than now minus this interval. private static double deleteTimeInterval; private static System.Timers.Timer timer; //Physical path to Download folder. Everything in this folder will be checked for deletion. public static string PhysicalDownloadPath; void Application_Start(object sender, EventArgs e) { // Code that runs on application startup deleteTimeInterval = Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["FileDeleteInterval"]); //Create timer with interval (milliseconds) whose elapse event will trigger the delete of old files //in the Download directory. timer = new System.Timers.Timer(deleteTimeInterval); timer.Enabled = true; timer.AutoReset = true; timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent); PhysicalDownloadPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "Download"; } private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e) { //Delete the files older than the time interval in the Download folder. var folder = new System.IO.DirectoryInfo(PhysicalDownloadPath); System.IO.FileInfo[] files = folder.GetFiles(); foreach (var file in files) { if (file.CreationTime < DateTime.Now.AddMilliseconds(-deleteTimeInterval)) { string path = PhysicalDownloadPath + "\\" + file.Name; System.IO.File.Delete(path); } } } This works perfectly, with one exception. When I publish the web service application to inetpub\wwwroot (Windows 7, IIS7) it does not delete the old files in the Download directory. The app works perfect when I publish to IIS from a physical directory not in wwwroot. Obviously, it seems IIS places some sort of lock on files in the web root. I have tested impersonating an admin user to run the app and it still does not work. Any tips on how to circumvent the lock programmatically when in wwwroot? The client will probably want the app published to the root directory. Thank you very much.

    Read the article

  • Want to show file association icon and skype like progress bar c#

    - by Thomas
    whenever user drag any file onto skype chat textbox then skype show right icon for that file and one custom progress bar rounded corner. i have 4 questions 1) i am working with win application not WPF. i like to know how to develop skype like corner progressbar. i search lot google to find out skype like progressbar. so if anyone knows how to develop that kind of progress bar then please share that knowledge or give me any url from where i can download similar look progressbar. 2) when i drag any file onto my richtextbox then how could i show right icon for that file on my richtextbox. anyone can give me idea. 3) what kind of richtextbox skype use? is there any advance richtextbox library which i can use for showing picture or button etc. 4) skype shows button on chat textbox called Cancel......is it button or any image. when user click on that button then button respond accordingly. so just tell me how could place any button on my rich textbox and when i will click on that button then a event should fire at my end. any idea. here i attach a picture from where you can see the image of progressbar that i am looking for. how i want to show the progress button and file associated icon on richtextbox. the object behind attaching the image is other person can understand what is my requirement and what i want to know. please anyone give me the idea for my above 4 points. thanks

    Read the article

  • Netbeans 7.01 in 12.04 repository, no javascript support

    - by Danielinux
    Hi I've installed Netbeans 7.0.1 from ubuntu 12.04 repository, i'm having many issues, The most important is that I cannot have help in writing javascript. Each .js file appear as a usual text file and even javascript sintax in jsp pages appear as normal text. I've already checked in tools -- options -- misc-- files and i cannot find there the .js association and the text/javascript mime-type. Another issue, really awfull, is that I cannot access CVS server if i do not run Netbeans as a root user. Someone had the same troubles i listed above? Have you some tips for solving them avoiding to install a newer version from Netbeans website? thanks in advance

    Read the article

  • How to download .txt file from a url?

    - by Colin Roe
    I produced a text file and is saved to a location in the project folder. How do I redirect them to the url that contains that text file, so they can download the text file. CreateCSVFile creates the csv file to a file path based on a datatable. Calling: string pth = ("C:\\Work\\PG\\AI Handheld Website\\AI Handheld Website\\Reports\\Files\\report.txt"); CreateCSVFile(data, pth); And the function: public void CreateCSVFile(DataTable dt, string strFilePath) { StreamWriter sw = new StreamWriter(strFilePath, false); int iColCount = dt.Columns.Count; for (int i = 0; i < iColCount; i++) { sw.Write(dt.Columns[i]); if (i < iColCount - 1) { sw.Write(","); } } sw.Write(sw.NewLine); // Now write all the rows. foreach (DataRow dr in dt.Rows) { for (int i = 0; i < iColCount; i++) { if (!Convert.IsDBNull(dr[i])) { sw.Write(dr[i].ToString()); } if (i < iColCount - 1) { sw.Write(","); } } sw.Write(sw.NewLine); } sw.Close(); Response.WriteFile(strFilePath); FileInfo fileInfo = new FileInfo(strFilePath); if (fileInfo.Exists) { //Response.Clear(); //Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name); //Response.AddHeader("Content-Length", fileInfo.Length.ToString()); //Response.ContentType = "application/octet-stream"; //Response.Flush(); //Response.TransmitFile(fileInfo.FullName); } }

    Read the article

  • Detect a file is closed

    - by User1
    Is there a simple way to detect when a file for writing is closed? I have a process that kicks out a new file every 5 seconds. I can not change the code for that process. I am writing another process to analyze the contents of each file immediately when it is created. Is there a simple way to watch a certain directory to see when a file is no longer opened for writing? I'm hoping for some sort of Linux command.

    Read the article

  • MS-Access nested DIR - check if a file exists elsewhere whilst looping through a folder

    - by David Carle
    I have used the DIR() command in Microsoft Access 2003 to loop through the files in folder A. This works fine, but I need to check if each file also exists in another location (folder B), and only process the file if it doesn't exist in folder B. The problem is that checking for the file existing in folder B also uses the DIR() function and this then resets or confuses the original one, with the result that no further files are found in folder A. Is there a way to check if a file exists without using DIR? Or, is there a way to have a separate instance of DIR? I suppose I could build a list of the files in folder A into an array and then process the entries in the array, but this seems rather 'clunky' Any suggestions for a better solution? Thanks

    Read the article

  • change extension obfuscate XML file contents

    - by FFish
    I have SlideShowPro, a Flash photo app that loads an XML file with the paths to the images. Now I don't want people to go sniff in the XML file to get to the images. I tried changing the file images.xml to spacer.gif and it seems to work fine. But I would like to know if I would run into any problems changing the extension. btw already used a few techniques to make the images not so accessible, I know there is no bulletproof solution. Obfuscating the XML file is just another trick..

    Read the article

  • Send file by webservice

    - by phenevo
    Hi, I have webservice, wwith method: [WebMethod] public byte[] GetFile(string FName) { System.IO.FileStream fs1 = null; fs1 = System.IO.File.Open(FName, FileMode.Open, FileAccess.Read); byte[] b1 = new byte[fs1.Length]; fs1.Read(b1, 0, (int)fs1.Length); fs1.Close(); return b1; } and it works with small file like 1mb, but when it comes to photoshop's file (about 1,5gb) I get: System.OutOfMemoryException The idea is I have winforms application which get this file and saving it on local disc.

    Read the article

  • Trouble getting Flash socket policy file to work.

    - by Alex
    Basically I'm using Flash to connect to a Java server. Despite my Java application replying to the , in the Flash debug log it lists (not sure about the order as there are lots): * Security Sandbox Violation * Connection to 192.168.1.86:4049 halted - not permitted from http://127.0.0.1:8888/Current/wander.swf Warning: Timeout on xmlsocket://192.168.1.86:4049 (at 3 seconds) while waiting for socket policy file. This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation. Error: Request for resource at xmlsocket://192.168.1.86:4049 by requestor from http://127.0.0.1:8888/Current/wander.swf is denied due to lack of policy file permissions. What I don't understand is, the server (port 4049) receives the request, outputs the policy file and then closes the connection, surely it shouldn't time out? The policy file I'm using is: <?xml version="1.0"?> <cross-domain-policy><allow-access-from domain="*" to-ports="*" /> </cross-domain-policy>

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >