Search Results

Search found 40999 results on 1640 pages for 'duplicate files'.

Page 17/1640 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Sending files from server to client in Java

    - by Lee Jacobson
    Hi, I'm trying to find a way to send files of different file types from a server to a client. I have this code on the server to put the file into a byte array: File file = new File(resourceLocation); byte[] b = new byte[(int) file.length()]; FileInputStream fileInputStream; try { fileInputStream = new FileInputStream(file); try { fileInputStream.read(b); } catch (IOException ex) { System.out.println("Error, Can't read from file"); } for (int i = 0; i < b.length; i++) { fileData += (char)b[i]; } } catch (FileNotFoundException e) { System.out.println("Error, File Not Found."); } I then send fileData as a string to the client. This works fine for txt files but when it comes to images I find that although it creates the file fine with the data in, the image won't open. I'm not sure if I'm even going about this the right way. Thanks for the help.

    Read the article

  • Splitting Code into Headers/Source files

    - by cam
    I took the following code from the examples page on Asio class tcp_connection : public boost::enable_shared_from_this<tcp_connection> { public: typedef boost::shared_ptr<tcp_connection> pointer; static pointer create(boost::asio::io_service& io_service) { return pointer(new tcp_connection(io_service)); } tcp::socket& socket() { return socket_; } void start() { message_ = make_daytime_string(); boost::asio::async_write(socket_, boost::asio::buffer(message_), boost::bind(&tcp_connection::handle_write, shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } private: tcp_connection(boost::asio::io_service& io_service) : socket_(io_service) { } void handle_write(const boost::system::error_code& /*error*/, size_t /*bytes_transferred*/) { } tcp::socket socket_; std::string message_; }; I'm relatively new to C++ (from a C# background), and from what I understand, most people would split this into header and source files (declaration/implementation, respectively). Is there any reason I can't just leave it in the header file if I'm going to use it across many source files? If so, are there any tools that will automatically convert it to declaration/implementation for me? Can someone show me what this would look like split into header/source file for an example (or just part of it, anyway)? I get confused around weird stuff like thistypedef boost::shared_ptr<tcp_connection> pointer; Do I include this in the header or the source? Same with tcp::socket& socket() I've read many tutorials, but this has always been something that has confused me about C++.

    Read the article

  • API for parse/update UNIX configuration files

    - by Chen Levy
    Unix configuration files come in all shapes and forms. I know that Webmin has a Perl API that makes it easy to parse and modify most common configuration pro grammatically, while preserving changes that might have been made by hand. Are there any other libraries that has similar functionality, perhaps for other languages (Python, Ruby, C, C++, etc)?

    Read the article

  • Splitting jQuery into multiple files (for iPhone caching)

    - by Marko Ivanovski
    Hi, I was wondering if there is a way to split jQuery into multiple files, i.e. jQuery-1.4.2_part1.js jQuery-1.4.2_part2.js jQuery-1.4.2_part3.js ...and so on. The reason I want to do this is because the iPhone doesn't cache assets larger than 25kb and I really need jQuery to only be downloaded once. If you think there are other workarounds for this I am considering all options right now. Thanks, Marko

    Read the article

  • Multiple IDE project files

    - by TomWij
    We are currently working in a team where we use both Visual Studio and Code::Blocks, is there a way to replicate changes between those project files? So if one adds a file to the project file it will also get adjusted in the project file of the other IDE? Please note: We want our project to work on multiple IDE's, platforms and compilers. Thus a general solution is welcome too.

    Read the article

  • Scala script to copy files

    - by kulkarni
    I want to copy file a.txt to newDir/ from within a scala script. In java this would be done by creating 2 file streams for the 2 files, reading into buffer from a.txt and writing it to the FileOutputStream of the new file. Is there a better way to achieve this in scala? May be something in scala.tools.nsc.io._. I searched around but could not find much.

    Read the article

  • Memory Mapped Files .NET

    - by CSharpAtl
    I have a project and it needs to access a large amount of proprietary data in ASP.NET. This was done on the Linux/PHP by loading the data in shared memory. I was wondering if trying to use Memory Mapped Files would be the way to go, or if there is a better way with better .NET support. I was thinking of using the Data Cache but not sure of all the pitfalls of size of data being saved in the Cache.

    Read the article

  • Again, user config files C#

    - by George
    Hey guys. I have a large config file (user) that i needed to go to the right location and have some default values. Since i have a installer class, i added some parameter setting to the config file in it, but created the config files in the installers folder. What is the best way to ensure these default parameters will be written only once, and in the right location?

    Read the article

  • communicating swf files.

    - by Addis Abebayehu
    I have two swf files I would like communicate. I have a videoplaylist.swf and a player.swf. I would like to select a video from videoplaylist.swf and have it played in the player.swf. How do I do that? How am I going to dispatch the click event with the video url to the player.swf? from the videoplaylist.swf. Please help.

    Read the article

  • Where are the .framework files?

    - by thyrgle
    Hi, I am wondering where the .framework files are located. I am using Mac OS 10.6. If this is more of a Superuser question just tell me because I was having trouble determining whether to put it here or Superuser or here but it seemed like it should go here.

    Read the article

  • Filling own template files

    - by Azat
    What is the best way to fill a template file with variables, which are collected from a Windows Form or Web Page. I want to create a wizard program that collects some data from user, for instance, reportname, reporttype, etc. and I need to create then some xml files (templates) with these variables inserted.

    Read the article

  • required files to distribute a c# .net application

    - by Jeff
    I'm trying to figure out what files are needed when I distribute an application that I have written. In the release folder after I have built the application I have the following: app.exe (obviously needed) app.exe.config (obviously needed for my config settings) app.pdb app.vshost.exe app.vshost.exe.config app.vshost.exe.manifest

    Read the article

  • Getting the names of all files in a directory with PHP

    - by Greelmo
    For some reason, I keep getting a '1' for the file names with this code: if (is_dir($log_directory)) { if ($handle = opendir($log_directory)) { while($file = readdir($handle) !== FALSE) { $results_array[] = $file; } closedir($handle); } } When I echo each element in $results_array, I get a bunch of '1's, not the name of the file. How do I get the name of the files?

    Read the article

  • Append or modify keys in conf files using sed/bash one-liner

    - by Jeff
    I often have to modify files such as sysctl.conf, and I'm familiar with using sed to replace existing values. Is there a way to append the new key/value pair to the file if sed wasn't able to replace it? For instance, using this example: modify config file using bash script sed -c -i "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE How could I add the $TARGET_KEY = $REPLACEMENT_VALUE new line to $CONFIG_FILE using the same sed expression with slight changes? And on a related topic, how can I force creation of $CONFIG_FILE if it didn't exist?

    Read the article

  • Viewing large XML files in eclipse?

    - by Paul Wicks
    I'm working on a project involving some large XML files (from 50MB to over 1GB) and it would be nice if I could view them in eclipse (simple text view is fine) without Java running out of heap space. I've tried tweaking the amount of memory available to the jvm in eclipse.ini but haven't had much success. Any ideas?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >