buffers

What makes this the fastest JavaScript for printing 1 to 1,000,000 (separated by spaces) in a web browser?

I was reading about output buffering in JavaScript here, and was trying to get my head around the script the author says was the fastest at printing 1 to 1,000,000 to a web page. (Scroll down to the header "The winning one million number script".) After studying it a bit, I have a few questions: What makes this script so efficient com...

How do you prefer to switch between buffers in Vim?

I've tried MiniBufExplorer, but I usually end up with several windows showing it or close it altogether. What I'd like is something like LustyJuggler with incremental search, the way I switch between buffers in Emacs. Surely there is a script like this? ...

Inherited Stream; buffering in Read()

Hello, I have inherited Stream class, in which I don't know how to implement Read() function properly, so I won't end up with a lot of nested ifs and hard to debug code. The point is that reading from source of this stream returns constant sized buffer (e.g. not changeable), but Read() function accepts different buffer sizes. I though of...

Editing multiple buffers in vim: "((1) of 3)" in status line

When I switch between buffers in vim with ":bn" and ":bp", my status line shows the following handy information: "foo.txt" 43 lines --88%-- ((1) of 3) 38,1 All (I think it's "set showmode" that enables that.) But that "(1)" is always literally "(1)" -- it doesn't change as I change buffers. (The parens a...

Unable to limit Ctrl-O to open only current buffers in Vim

I get the old buffers to be opened when I press Ctrl-O I want only to browse buffers which I have opened in the current Vim session. How can you browse fast between current buffers in Vim with Ctrl-O? ...

Unable to have the reverse of Ctrl-O in Vim

I want to have the reverse of Ctrl-O to be Shift-Ctrl-O The original reverse is Ctrl-i How can you remap the reverse of Ctrl-O in Vim to be Shift-Ctrl-O? ...

Reading and writing to a buffer

Hi, I have 2 classes, one that writes multiple 96bit objects to a buffer (32bits at a time - 3x int32), and one that i want to read from the same buffer. The first class (Writer) reserves and area of memory and creates a pointer to the first 32bit area. 1) How do I write to the buffer safely (ignoring buffer overflow for now)... I nee...

Diff two tabs in Vim

Scenario: I have opened Vim and pasted some text. I open a second tab with :tabe and paste some other text in there. Goal: I would like a third tab with a output equivalent to writing both texts to files and opening them with vimdiff. Currently I the close I can find is "diff the current buffer against a file", but not diffing two open...

Too many split screens opening in Emacs!

Ever since I installed emacs on a new machine I have seen an ugly behaviour. Unfortunately, my old .emacs files are rather fragmented and I can't determine whether I used to have elisp that took care of this. The problem is this: it used to be that when I performed a command that would open a new buffer such as grep'ing, or clicking a f...

Array of buffers in C programming?

I am trying to create an array of buffers. I need to store an integer into each buffer. I'm not quite sure how this should be done. int BUFFER_LENGTH = 50; //the size of each buffer int numberOfBuffers = 10; //number of buffers int *pBuffers; //array of buffers pBuffers = (int *) calloc (numberOfBuffers, sizeof(int)); /...

Creating accessing shared memory in C.

So I have a problem that I don't really know how to go about. I was hoping maybe you could let me know how to deal with it. I need to allocate N number of buffers in shared memory. Each buffer should be initialized to 0. Then I must fork N/2 number of child processes. Each child(i) then writes value (i) into buffer (i), sleeps for one...

Buffer size in C

When provided with a buffer size in C, how do I know how much is left and when do I need to stop using the memory? For example, if the function I am writing is this: void ascii_morse (lookuptable *table, char* morse, char* ascii, int morse_size) { } In this application I will be passed a string (ascii) and I will convert it to morse...

How to survive the transition from tabbed-based to buffer-based coding (Vim).

I recently changed from notepad++ to Vim. In notepad++ I used to be aware of my open files by seeing them as tabs, so when I wanted to close or change them I just pressed Shit-Tab or Ctrl-W. In Vim there are also tabs, but when I use them I feel like I'm just going back to my notepad++ way of managing my files. Is there a good way of lis...

Possible to calculate MD5 (or other) hash with buffered reads ?

I need to calculate checksums of quite large files (gigabytes). This can be accomplished using the following method: private byte[] calcHash(string file) { System.Security.Cryptography.HashAlgorithm ha = System.Security.Cryptography.MD5.Create(); FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Rea...

Can I use Google's Protocol buffers for processing LDAP requests in my LDAP server?

Hi, I need to process the incoming predefined ASN format data(coming from verity of clients that uses BER library to build it) in my application server. This is typically an LDAP server where every request will be in a predefined ASN format. Can i use Google's protocol buffers to process the requests in the server side? Will it help an...

Unloading vertex buffers in OpenGL

I have an Android live wallpaper that I suspect is leaking memory, probably either textures or vertex arrays. I'm calling glDeleteTextures on my texture IDs, but don't see any sort of equivalent for my vertex buffers. I'd like to be able to be sure both my textures and buffers are getting unloaded by OpenGL, am i missing something? Th...

Protocol buffers logging

Hi, In our business, we require to log every request/response which coming to our server. At this time being, we are using xml as standard implementation. Log files are used if we need to debug/trace some error. I am kind of curious if we switch to protocol buffers, since it is binary, what will be the best way to log request/response ...

What should I use as a buffer in C++ for receiving data from network sockets?

I'm using sockets with C++. The program simply requests an HTTP page, reads it into a buffer buf[512], and then displays the buffer. However pages can contain more data than the buffer, so it will cut off if there is no more space left. I can make the buffer size bigger, but that doesn't seem like a good solution. This is the code that I...

Deallocating Direct Buffer Native Memory in Java for JOGL

Hello there, I am using direct buffers (java.nio) to store vertex information for JOGL. These buffers are large, and they are replaced several times during the application life. The memory is not deallocated in time and I am running out of memory after a few replacements. It seems that there is not good way to deallocate using java.n...

emacs can invoke shell and execute commands-- can they act on Emacs buffers?

I use Alt-! (Alt-Bang) a lot in Emacs. One of the big things I use it for is Alt-! cat $logfile | grep 'this' # show me one kind of event or sometimes Alt-! cat $logfile | grep 'this' | wc -l # count that one event's occurrences Two things: 1) No tab-completion from this prompt: why not? 2) What if instead of $logfile, I want to ...