buffering

What is the fastest way to find the center of an irregularly shaped polygon?

I need to find a point that is a visual center of an irregularly shaped polygon. By visual center, I mean a point that appears to be in the center of a large area of the polygon visually. The application is to put a label inside the polygon. Here is a solution that uses inside buffering: http://proceedings.esri.com/library/userconf/pro...

Rails -- How to save HTML output of a HAML partial as a string to send to an external service?

Hey guys, first post here, hope you can help me out. We're generating a newsletter automatically every 24 hours using a rake task. There's a section at the top of the newsletter where an admin can put a customized message. The screen that the admin uses has a live preview of the newsletter (they were insistent on this), rendered using...

C# - readin from serial port buffer

Hi, I am trying to read data from an RS-232 port. Does anyone have an example of how I get the date from the port/buffer and make sure that I have all the data as it can be multiline data. Do I simply read it as follows ? string Rxstring = port.ReadLine(); Console.WriteLine(Rxstring); Any help would be most appreciated, as usual. Th...

Does Output Buffering help in performance?

I've heard that writing out the entire ASP.NET page in one go helps performance. Like having the following as the first line on Page_Load: Response.BufferOutput = true; And using Response.Flush at the end of all processing. Does this help? If yes, are there any the disadvantages in using it? ...

Help me implement a rewindable buffer

This is where I'm so far: I have the following the following use case (as impartial jUnit test) to show what I want to achieve: buffer.add(o1); assertEquals(1, buffer.size()); buffer.mark(); buffer.add(o2); assertEquals(2, buffer.size()); buffer.add(o3); assertEquals(3, buffer.size()); assertSame(o1, buffer.get()); assertSame(o2, buffe...

YouTube style throttling in Flash

I may be completely insane on this one, but it seems like the download/buffer rate of YouTube videos is faster at the beginning and the further the buffer point gets from the currently playing mark, the slower buffering goes. Am I crazy, or does it work this way for everyone else? Assuming the latter, any theories on how they do it? Is...

Output buffering and large MySQL result sets in PHP 5

Hey guys I'm trying to build an XML feed from a database with a ginormous table, almost 4k records. I want to use output buffering to get it to spit out the XML but the script still keeps on timing out. ob_start(); $what = 'j.*, (select description from tb_job_type as jt WHERE jt.jobtype_id = j.job_type_id) as job_type,'; $what .= '(s...

buffered I/O vs unbuffered IO

Hi, I learnt that by default I/O in programs is buffered, i.e they are served from a temporary storage to the requesting program. I understand that buffering improves IO performance (may be by reducing system calls). An explanation on this will also help. Also I have seen functions say in C setvbuf to enable/disable buffering. I wanted ...

buffering when passing input from standard input to a function

I asked about this yesterday, but I'm still having problems. I wrote a program in C which has a function that processes files which can be passed to it by a file pointer. void process_my_file(FILE *fptr, ...) { /* do work */ } I asked how to read input from standard input and pass it to my function, and it was recommended to me th...

Remove empty table rows output buffering?

I have a large static table which is generated by a cgi script from a tmp file to a php file. If it outputs <td> </td> Can I remove these with output buffering. ...

Silverlight MediaElement and UI Virtualization

I have an application that contains many controls on a panel, each with its own MediaElement playing video. I have been looking into the new UI Virtualization features of Silverlight 3 to improve performance when scrolling through many of these controls in a smaller view port. From my experience, it is my understanding that any time a M...

Java-Sockets: InputStream.read() vs BufferedReader.read()

Hello I'm reading from a Socket's InputStream. Because I'm parsing the incoming data on the fly, I'm required to read character by character. Does BufferedReader.read() the same thing as InputStream.read() does ? (assuming that BufferedReader has been constructed with the InputStream as base) Is it more efficient to use InputStream.re...

handling central data buffer for many processes in C++

I ran into the following problem and cannot decide how to proceed: I have a class, Reader, getting a chunk of data every 1/T seconds (actually the data is from video frames, 30 frames per second). The chunks are to be passed to several objects, Detectors that process the chunks and output a decision. However, the number of chunks that ...

What is a suitable buffer for Python's struct module

In Python I'm accessing a binary file by reading it into a string and then using struct.unpack(...). Now I want to write to that string using struct.pack_into(...), but I get the error "Cannot use string as modifiable buffer". What would be a suitable buffer for use with the struct module? ...

How to read exact number of bytes from a stream (tcp) socket?

In winsock, both the sync recv and the async WSARecv complete as soon as there is data available in a stream socket, regardless of the size specified (which is only the upper limit). This means that in order to read a fixed number of bytes from the stream, there should be applied some custom buffering. And unless each read is buffered se...

How can I tell if there is data in an input filehandle's buffer in Perl?

I'm working on a program that uses an epoll-based event loop to handle multiple simultaneous socket connections. When the app detects that there is data to be read, it calls a process_request() sub, which uses buffered IO. For example: sub process_request { my ( $fh ) = @_; if ( my $line = <$fh> ) { # Do something inte...

Flex video player buffering

am new to flex.. am creating one video player.. I need set the preloader for this component when ever the video is buffering... Please post the answers or related links.. Thanks Aswath ...

How to detect when video is buffering?

Hi guys, my question today deals with Flash AS3 video buffering. (Streaming or Progressive) I want to be able to detect when the video is being buffered, so I can display some sort of animation letting the user know to wait just a little longer. Currently my video will start up, hold on frame 1 for 3-4 secs then play. Kinda giving the...

Networking Method

Hey guys, Iv'e noticed that when I send a complete packet (collect it's data in a buffer and send) it is much slower than sending the packet byte by byte. Will it be okay if I make an online game using this method? ...

Streaming with Android MediaPlayer - catching errors and buffering

I'm having trouble getting MediaPlayer to be resiliant when streaming from a HTTP URL. If I start playing the file, but then drop the connection (e.g. airplane mode), MediaPlayer#OnErrorListener generates what=1, extra=-17; and then shortly afterwards what=-38, extra=0. There's no documentation I can see in the APIs of what this denotes...