Search Results

Search found 11972 results on 479 pages for 'writing'.

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

  • Writing asynchronously on a stream in cocoa

    - by Richard Ibarra
    Hi folks I have been trying to find any way for writing asynchronously on a stream in Cocoa. I have a set of events in my applications which will try to send data through the socket but i can't be blocked during this transmission due to design terms. I have tried setting a delegate on the output stream and check the event NSStreamEventHasSpaceAvailable but I don't know how this can be combined with the events that put data into the stream. Is there anyway for doing that? I thought using NSThread but I guess there is a better option. Cheers

    Read the article

  • tidy/efficient function writing in R

    - by romunov
    Excuse my ignorance, as I'm not a computer engineer but with roots in biology. I have become a great fan of pre-allocating objects (kudos to SO and R inferno by Patrick Burns) and would like to improve my coding habits. In lieu of this fact, I've been thinking about writing more efficient functions and have the following question. Is there any benefits in removing variables that will be overwritten at the start of the next loop, or is this just a waste of time? For the sake of argument, let's assume that the size of old and new variables is very similar or identical.

    Read the article

  • Writing email sniffer

    - by Rampage
    Hello, I am interested in writing an email sniffer that saves all emails sent via web based clients to hd, but I can't work out how to do this. How can I catch HTTPS mail before it is encrypted? I would really appriciate some useful info. I cannot find anything information on the web. There's a program called HTTP Analyzer V5 that does the exact thing I want to make. How should I start? If I make a packet sniffer, it's useless because all data is encrypted. Is there any other option?

    Read the article

  • Php writing to file - empty ?

    - by The Devil
    Hey, I've been struggling with writing a single string into a file. I'm using just a simple code under Slackware 13: $fp = fopen('/my/absolute/path/data.txt', 'w'); fwrite($fp, 'just a testing string...'); fclose($fp); The file gets created (if it's not already created) but it's empty ?! The directory in which this file is written is owned by apache's user & group (daemon.daemon) and has 0777 permissions. This has never happened to me before. I'm curious what's the reason I'm not able to write inside the file ? Thanks in advance.

    Read the article

  • Writing the output of IEnumerable<XElement> to a XML File

    - by Googler
    HI folks , This is my code to read two xml files and merge their elemnts. I want to write the output to an xml file. This is my code. IEnumerable<XElement> list0 = doc.Descendants(node1).Concat(doc2.Descendants(node2)); foreach (XElement el in list0) Console.WriteLine(el); Instead of writing to the console i need to write it to a xml file. Output is also in the xml format.How to achieve this. Can anyone pls give me a code or method to achiev this.

    Read the article

  • Writing a new line to file in PHP

    - by James P
    My code: $i = 0; $file = fopen('ids.txt', 'w'); foreach ($gemList as $gem) { fwrite($file, $gem->getAttribute('id') . '\n'); $gemIDs[$i] = $gem->getAttribute('id'); $i++; } fclose($file); For some reason, it's writing \n as a string, so the file looks like this: 40119\n40122\n40120\n42155\n36925\n45881\n42145\n45880 From Google'ing it tells me to use \r\n, but \r is a carriage return which doesn't seem to be what I want to do. I just want the file to look like this: 40119 40122 40120 42155 36925 45881 42145 45880 Thanks.

    Read the article

  • Writing efficient open source product summary and promoting project

    - by galets
    I've been working on an open source project on sourceforge a few months ago. One thing I noticed is that a well written summary could make a huge difference for the product. I literally saw traffic going to almost nothing when I made a poor change to project summary. One more thing I noticed is that not only summary has to be appealing, but also take into consideration some technical aspects, such as (for example): contain all the necessary keywords for it to be searchable and produce the best match for a hypothetical search potential user will make in order to find it. Here comes the question now: can you share your tips and tricks for writing an efficient product summary, and otherwise promoting your project, whether it's on sourceforge or somewhere else?

    Read the article

  • Writing a telnet client

    - by MAC
    HI, I have a device that exposes a telnet interface which you can log into using a username and password and then manipulate the working of the device. I have to write a C program that hides the telnet aspect from the client and instead provides an interface for the user to control the device. What would be a good way to proceed. I tried writing a simple socket program but it stops at the login prompt. My guess is that i am not following the TCP protocol. Has anyone attempted this, is there an opensource library out there to do this? Thanks

    Read the article

  • SOS: AudioFormat when writing to file in FreeTTS

    - by user330793
    Very annoying problem. I have developed a freeTTS application of the freetts class that write captured audio to file however I am having some very annoying problems. When setting the audio player to singlefileaudio player I try to also set the audioformat with my own default values for sampleRate, sampleSizeInBits, channels, signed and bigEndian. Now I access AudioPlayer.get methods to show these values in runtime just to ensure they are set to what I set them and they match those values. However when file writing completes and I check the properties of the resulting wave file, they are set to the audioPlayer default settings. Normally this will be fine except I have to read the files into another application which has fixed audio property settings so I always get a resulting output that sounds like am fast forwarding the sound and listening to it at the same time. Obviously because of the different sampling rates. I need help please. Thanx, Henry

    Read the article

  • C++ ofstream cannot write to file....

    - by user69514
    Hey I am trying to write some numbers to a file, but when I open the file it is empty. Can you help me out here? Thanks. /** main function **/ int main(){ /** variables **/ RandGen* random_generator = new RandGen; int random_numbers; string file_name; /** ask user for quantity of random number to produce **/ cout << "How many random number would you like to create?" << endl; cin >> random_numbers; /** ask user for the name of the file to store the numbers **/ cout << "Enter name of file to store random number" << endl; cin >> file_name; /** now create array to store the number **/ int random_array [random_numbers]; /** file the array with random integers **/ for(int i=0; i<random_numbers; i++){ random_array[i] = random_generator -> randInt(-20, 20); cout << random_array[i] << endl; } /** open file and write contents of random array **/ const char* file = file_name.c_str(); ofstream File(file); /** write contents to the file **/ for(int i=0; i<random_numbers; i++){ File << random_array[i] << endl; } /** close the file **/ File.close(); return 0; /** END OF PROGRAM **/ }

    Read the article

  • Writing a C Macro

    - by shaharg
    Hi, I have to write a macro that get as parameter some variable, and for each two sequential bits with "1" value replace it with 0 bit. For example: 10110100 will become 10000100. And, 11110000-00000000 11100000-100000000 I'm having a troubles writing that macro. I've tried to write a macro that get wach bit and replace it if the next bit is the same (and they both 1), but it works only for 8 bits and it's very not friendly... P.S. I need a macro because I'm learning C and this is an exercise i found and i couldn't solve it myself. i know i can use function to make it easily... but i want to know how to do it with macros. Thanks!

    Read the article

  • iPhone 4.0 Screen Resolution and writing robust code...

    - by Magic Bullet Dave
    Does anyone know what will happen with existing apps when they run on the iPhone 4.0 in terms of the new screen resolution? I am assuming, just like developing for the iPad that there should be no hard coded screen resolutions in your code. I'd also like advice on the best way of writing robust code to work well on any device. For instance, detecting the screen resolution is not enough - on the iPad the screen is physically bigger so you can display more items on it. On the new iPhone the screen is the same physical size but higher resolution, so the likely thing is that you wont want to display more items, just higher resolution versions of them. Any help would be useful, Regards Dave EDIT: I have read the other similar posts, I guess what I really would like to know is what is the recommended way to write code for all App Store devices in a robust way so they a) all work b) make best use of the device.

    Read the article

  • Help writing getstring function

    - by volting
    Im having some trouble writing a getstring function, this is what I have so far. Regards, V const char* getstring() { char *buffer; int i = 255; buffer = (char *)malloc(i*sizeof(char)); *buffer = getchar(); while ( *buffer != '\n' ) { buffer++; *buffer = getchar(); } *buffer = '\0'; const char* _temp = buffer; return _temp; } int main() { char* temp = getstring(); for ( ;temp++ ; *temp != '\0') { printf("%c", *temp); } return 0; }

    Read the article

  • How do I get started writing a .Net-wrapper around C++ Omniorb-stubs

    - by Superfisi
    Hello there, my job is to access a CPRBA-server-application from .NET 3.5. After evaluating projets like IIOP.Net (undefined state) and products like VisiBroker (expensive) I'd like to do it "by myself" and write a .Net-Wrapper around C++-Stubs generated my Omniidl (the Omniorb IDL to C++ generator). This means writing some kind of layer of managed code (CLI) around the unmanaged C++ code. My question is: Has anyone experience in this topic? I honestly don't know how to do it the best way. Right now I plan to create a managed class for every unmanaged class, each managed class itself has a member to an instance of the unmanaged class, which is not garbage-collected. Is this the right way to do it or am I on the wrong path? Thanks in advance!

    Read the article

  • Writing to the middle of the file (without overwriting data)

    - by Andreas Bonini
    In windows is it possible through an API to write to the middle of a file without overwriting any data and without having to rewrite everything after that? If it's possible then I believe it will obviously fragment the file; how many times can I do it before it becomes a serious problem? If it's not possible what approach/workaround is usually taken? Re-writing everything after the insertion point becomes prohibitive really quickly with big (ie, gigabytes) files. Note: I can't avoid having to write to the middle. Think of the application as a text editor for huge files where the user types stuff and then saves. I also can't split the files in several smaller ones.

    Read the article

  • Writing shorter code/algorithms, is more efficient (performance)?

    - by Carlos
    After coming across the code golf trivia around the site it is obvious people try to find ways to write code and algorithms as short as the possibly can in terms of characters, lines and total size, even if that means writing something like: n=input() while n>1:n=(n/2,n*3+1)[n%2];print n So as a beginner I start to wonder whether size actually matters :D. It is obviously a very subjective question highly dependent on the actual code being used, but what is the rule of thumb in the real world. In the case that size wont matter, how come then we don't focus more on performance rather than size?

    Read the article

  • Reading and writing to SysV shared memory without synchronization (use of semaphores, C/C++, Linux)

    - by user363778
    Hi, I use SysV shared memory to let two processes communicate with each other. I do not want the code to become to complex so I wondered if I really had to use semaphores to synchronize the access to the shared memory. In my C/C++ program the parent process reads from the shared memory and the child process writes to the shared memory. I wrote two test applications to see if I could produce some kind of error like a segmentation fault, but I couldn't (Ubuntu 10.04 64bit). Even two processes writing non stop in a while loop to the same shared memory did not produce any error. I hope someone has experience concerning this matter and can tell me if I really must use semaphores to synchronize the access or if I am OK without synchronization. Thanks

    Read the article

  • Async stream writing in a thread

    - by blez
    I have a thread in which I write to 2 streams. The problem is that the thread is blocked until the first one finishes writing (until all data is transferred on the other side of the pipe), and I don't want that. Is there a way to make it asynchronous? chunkOutput is a Dictionary filled with data from multiple threads, so the faster checking for existing keys is, the faster the pipe will write. void ConsumerMethod(object totalChunks) { while(true) { if (chunkOutput.ContainsKey(curChunk)) { if (outputStream != null && chunkOutput[curChunk].Length > 0) { outputStream.Write(chunkOutput[curChunk]); // <-- here it stops } ChunkDownloader.AppendData("outfile.dat", chunkOutput[curChunk], chunkOutput[curChunk].Length); curChunk++; if (curChunk >= (int) totalChunks) return; } Thread.Sleep(10); } }

    Read the article

  • Java: file write on finalize method

    - by sowrov
    In my understanding a singleton object will destroy only when the application is about to terminate. So in C++ I write a Singleton class to log my application and in that Singleton logger's destructor I log the time when my application was terminated. Things worked perfectly in C++. Now I want to have that same logger in Java, as in java there is no destructor so I implemented the finalize method for that singleton logger. But it seem that finalize method actually never get called. So, I add that System.runFinalizersOnExit(true); line, somewhere in my code (though I know it is deprecated) and that finalize method get called every time before termination of the app. But still there is a problem! If I try to write anything on file in that finalize method, It does not work, though System.out work without any problem! :( Can you guys help me on this problem? Here is a sample code of what I am try to do: Singleton Logger Class: public class MyLogger { FileWriter writer; private MyLogger() { try { this.writer = new FileWriter("log.txt"); } catch (IOException ex) { } } public static MyLogger getInstance() { return MyLoggerHolder.INSTANCE; } private static class MyLoggerHolder { private static final MyLogger INSTANCE = new MyLogger(); } @Override protected void finalize () { try { super.finalize(); System.out.println("Here"); //worked correctly. this.writer.write(new Date().toString()+System.getProperty("line.separator")); this.writer.write("End"); this.writer.flush(); //does not work! this.writer.close(); } catch (Throwable ex) { } } public synchronized void log(String str) { try { this.writer.write(new Date().toString()+System.getProperty("line.separator")); this.writer.write(str+"\n"); this.writer.flush(); } catch (IOException ex) { } } } Main: public class Main { public static void main(String[] args) { System.runFinalizersOnExit(true); MyLogger logger = MyLogger.getInstance(); logger.log("test"); } }

    Read the article

  • Improve performance writing 10 million records to text file using windows service

    - by user1039583
    I'm fetching more than 10 millions of records from database and writing to a text file. It takes hours of time to complete this operation. Is there any option to use TPL features here? It would be great if someone could get me started implementing this with the TPL. using (FileStream fStream = new FileStream("d:\\file.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite)) { BufferedStream bStream = new BufferedStream(fStream); TextWriter writer = new StreamWriter(bStream); for (int i = 0; i < 100000000; i++) { writer.WriteLine(i); } bStream.Flush(); writer.Flush(); // empty buffer; fStream.Flush(); }

    Read the article

  • Security when writing a PHP webservice?

    - by chustar
    I am writing a web service in PHP for the first time and had ran into some security problems. 1) I am planning to hash passwords using md5() before I write them to the database (or to authenticate the user) but I realize that to do that, I would have to transmit the password in plaintext to the server and hash it there. Because of this I thought of md5()ing it with javascript client side and then rehashing on the server but then if javascript is disabled, then the user can't login, right? 2) I have heard that anything that when the action is readonly, you should use GET but if it modifies the database, you should use POST. Isn't post just as transparent as GET, just not in the address bar?

    Read the article

  • Writing .NET in dynamic language?

    - by tillda
    I'm confused by the possibility of writing .NET in dynamic languages, such as (Iron)Ruby. Particularly, I've seen code in IronRuby that used generics (...foo[String]), but I'm not aware of this feature in Ruby as it seems nonsense to me in dynamic languages. So, when I write .NET app in IronRuby, how is it with type safety and compilation? I thought that it is just as dynamic as Ruby everywhere else. I thought that if the Ruby syntax is OK all the type checking would be done at the runtime. Also, as far as I know, .NET itself is type-oriented - there are classes that heavily utilize the mentioned generics. How is this handled? And what about delegates? In dynamic languages I can have almost function-spaghetti and sometimes, its just fine (like hacking UI in javascript). Or do I have to care even about generic delegates?

    Read the article

  • Writing Ruby Libraries - hiding methods from outside the module

    - by JP
    Hi all, I'm writing a Ruby library which has a module with a bunch of classes inside it. Many of these classes need to be usable and modifiable by calling scripts, but I don't want (some of) the initializers to be visible/callable: module MyLib class Control def initialize # They can use this end def do_stuff Helper.new('things') end end class Helper # Shouldn't be visible def initialize(what) @what = what end def shout @what end end end c = MyLib::Control.new h = c.do_stuff p h.shout # => "things" # ^ All of this is desired # v This is undesirable p MyLib::Helper.new('!') # => <MyLib::Helper @what='!'> If it's a simple thing, then I'd also appreciate the generated RDoc not even include the .new method for the Helper class either. Any ideas? Thanks for reading!

    Read the article

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