I have a custom class with a serialize method, and I want to be able to write this class directly to files and have the return value of the serialize method get written, in Python 2.6. (I'm not trying to pickle my objects, this is something totally different.) For example:
class Foo(object):
def serialize(self):
return "Hel...
I tried to implement Open GLs Vertex Buffer Objects the first time, and all i get is a black screen.
I tried it with glOrtho instead of glPerspective, but it didnt work as well.
thanks for helping
Heres my code:
public class VBufferTest {
public static final int WIN_WIDTH = 640;
public static final int WIN_HEIGHT = 480;
public in...
Hello,
In Linux, one can specify the system's default receive buffer size for network packets, say UDP, using the following commands:
sysctl -w net.core.rmem_max=<value>
sysctl -w net.core.rmem_default=<value>
But I wonder, is it possible for an application (say, in c) to override system's defaults by specifying the receive buffer si...
Hello all
Im trying to write an ascii game for an assignment. The program must be written entirely in c, no c++.
How can i get the program to open a window capable of rendering ascii art? I want to create a window of a certain size, that is capable of printing in multiple colors. A simple console window is insufficient.
Also, on a rela...
I've been researching a number of networking libraries and frameworks lately such as libevent, libev, Facebook Tornado, and Concurrence (Python).
One thing I notice in their implementations is the use of application-level per-client read/write buffers (e.g. IOStream in Tornado) -- even HAProxy has such buffers.
In addition to these a...
What's the maximum data size one should expect in a receive operation? The data that has to be sent is very large, but at some point there will be packet fragmentation I guess?
...
First of all, I've never worked with C before (mostly Java which is the reason you'll find me write some naive C code). I am writing a simple command interpreter in C. I have something like this:
//Initialization code
if (select(fdmax+1, &read_fds, NULL, NULL, NULL) == -1) {
perror("Select dead");
exit(EXIT_FAILURE);
}
....
.....
I have been coding Java for a while, but I have to admit that I don't get streams, buffers, etc. 100%
I have tried to find a good tutorial on the subject that explains the reasoning behind them and their patterns of usage, but I couldn't find any. Only short, isolated snippets that don't help.
Is there something out there?
...
I know 'clear' command clears current screen, but the cleared contents just scrolled up.
Is there a way to clear all cleared buffer contents? I'm figuring this to prevent scrolling up on Terminal.
---(edit)---
I'm finding a way which can be used in shell script. Or program.
...
hi.
I would like to implement automatic collapse of compilation buffer to small size (but not close at a delete windows), such that upon successful compilation to window is shrunk to minimum size.
get-buffer-create returns a buffer. how can I shrink-window on window associated with that buffer? also, is there a way to store previous w...
hey guys
I have tried to search Google and look in the manual, but still cannot find how to get major mode of a buffer object. Can you help me with an example or a reference. Thanks
only solution I could find was to query major-mode after changing the buffer and then changing back to original buffer. Is there a better way to do it?
...
How do you clear the string buffer in Java after a loop so the next iteration uses a clear string buffer?
...
Hello, everyone!
I need to be able to convert byte arrays to/from other primitive type arrays, but instead of casting, I need type punning. Correct term for raw copy without casting?
I thought it would be possible to do the following:
// idea: byte[12] -> int[3], and int[3] -> byte[12]
int[] ints;
ByteBuffer bb = ByteBuffer.wrap(
...
I need an open-source (preferably MIT-licensed) light-weight growable buffer implemented in plain C (preferably also compileable as C++).
I need API equivalent to following (pseudo-code):
void set_allocator(buffer * buf, allocator_Fn fn);
void push_bytes(buffer * buf, const char * bytes, size_t len);
size_t get_length(buffer * buf);
v...
I'm wondering if this code ...
StringBuilder sb = new StringBuilder("Please read the following messages.");
... initializes sb with a buffer exactly as large as the string passed to the constructor. On the one hand, this would seem the most logical thing. On the other hand, it seems to kind of defeat the purpose of the StringBuilder c...
I'm writing a small proof-of-concept console program with Visual Studio 2008 and I wanted it to output colored text for readability. For ease of coding I also wanted to make a quick printf-replacement, something where I could write like this:
MyPrintf(L"Some text \1[bright red]goes here\1[default]. %d", 21);
This will be useful becaus...
I have a generic growing buffer indended to accumulate "random" string pieces and then fetch the result. Code to handle that buffer is written in plain C.
Pseudocode API:
void write(buffer_t * buf, const unsigned char * bytes, size_t len);/* appends */
const unsigned char * buffer(buffer_t * buf);/* returns accumulated data */
I'm th...
I need to save the contents of a pixel editor application into a .png file but I am having trouble finding the best way to accomplish this. The pixel data is stored in a 32 bit RGBA buffer. Can anyone suggest any good tools I could use to accomplish this?
EDIT:
Unfortunately, CGImage and representationUsingType: are not supported by...
Say there is a buggy program that contains a sprintf() and i want to change it to a snprintf so it doesn't have a buffer overflow.. how do I do that in IDA??
...
A friend and I are working on a project where we're required to build a reliable UDPclient/server using VB.Net. We have things working well, but one thing that still eludes us is how to dynamically allocate a (byte) buffer for the incoming data. Right now we have to hard code a maximum value/MTU (or use a really large buffer size and r...