Questions tagged [packing]

Use this tag for questions related to packing, which can extend from struct packing to grouping elements together.

Filter by
Sorted by
Tagged with
0 votes
0 answers
55 views

Circle Packing in Rectangle

have been doing some reearch on circle packing in a rectangle and have found some useful codes and examples. Also understand that their is no one established packing method and have found several ...
0 votes
0 answers
24 views

Packing problem with alignment condition and maximization of the number of squares in a random geometric shape

Python: What is an efficient algorithm to pack squares of the same size into an arbitrary geometric shape with all squares aligned? I have the dimensions of the shape to fill from a DXF file. For more ...
-1 votes
1 answer
41 views

Find the closest combination of items to the requirements

So my problem is a little bit like knapsnack problem but with a bit of difference. Let's say I went to shopping and I am obliged to buy things that meet the requirements or the closest I can get (over ...
0 votes
0 answers
45 views

import.meta.url breaking after packing

My workspace looks like this: ├─dist │ └─index.mjs └─src └─utils └─index.ts I use import.meta.url in /src/utils/index.ts like this: const __path_src_root = path.resolve( path.dirname(...
0 votes
1 answer
27 views

Extend an user definded table in SAP

I am trying to change a selection table within our packing list menu in our SAP system, but I do not know how to do this. My colleague, who is out indefinitely, has created a table of packing ...
0 votes
0 answers
39 views

Generating annotated text description of structs with size/offset of fields for a given architecture during compilation?

Basically, I would like to obtain the information about packing of structs on a given architecture during the compilation process, formatted as a text file with the struct description (code stripped ...
  • 3,878
2 votes
2 answers
61 views

Can C add padding between struct members, even if they are ordered in decreasing alignment?

struct Foo { int a; char b; } Will it be guaranteed in this case that b will have an offset of sizeof(int) in the struct? Will it be guaranteed that members will be packed together as long as ...
  • 2,160
0 votes
0 answers
14 views

Woocommerce customized pdf invoice template not reflecting in WCFM

I have customized the invoice and packing slip with simple premium template in WooCommerce PDF Invoices plugin with product photo, HSN code etc. When I look at the Woocommerce order dashboard, the ...
1 vote
0 answers
153 views

How to solve multiple knapsacks problem with genetic algorithm using PyGAD?

I'm trying to solve the multiple knapsacks problem (MKP), in which I want to fit n items into m containers (knapsacks). Items have their weights and knapsacks capacity that they can hold. I decided to ...
  • 31
0 votes
0 answers
27 views

Variety of knapsack problem python: Need to iterate among the list and compose boxes with products according to Weight and Volume

Currently I don't try to solve optimization problem - I try to understand how many boxes are needed to ship all products if I have the following amount of products with weight and volume, and add each ...
0 votes
1 answer
61 views

How can I pack 16 bytes in python with struct?

How can i pack 16 bytes by using struct.pack ? I don't see in the man format for that. res = struct.pack(">???", 1234123412341234)
0 votes
0 answers
37 views

An algorithm to find a polygon fitted to farthest points

I have multiple circles with various diameters which are packed together. I have the diameter and centre coordinates of each circles. The objective is to find the perimeter of a polygon which is ...
0 votes
0 answers
31 views

Irregular grid of rectangles inside a rectangle

I have n rectangles of set dimensions. 4x4, 4x8, 8x8, 8x16, 16x16, 10x20, 12x24. They need to fit in a 48x64 rectangle and don’t leave any empty spaces. The algorithm should use the most amount of ...
  • 1
2 votes
2 answers
159 views

Are packed identical structs guaranteed to have the same memory layout?

Say I have two structs: object and widget: struct object { int field; void *pointer; }; struct widget { int field; void *pointer; }; And a function: void consume(struct object *obj) {...
  • 1,900
0 votes
0 answers
34 views

How to pack selenium webdrivers along with the source code?

I'm currently writing a web-scrapper and I want to pack the webdrivers along with the source code and it's dependencies for distribution to a few users, so they don't have to deal with the hassle of ...
1 vote
1 answer
463 views

Make a Nest.JS project executable but without the source code exposed

If we want to deploy our NEST.js sever on the customer's environment, how can we hide our source code preventing from the plagiarism?
  • 434
0 votes
0 answers
36 views

what is the eigen matrix block packing data structure?

Basically I'm seeking for the data structure of eigen packing of matrix. on eigen convolution eigen packed matrix and after that it perform multiplication. Other optimizer like blas,dnn eigen also ...
0 votes
1 answer
103 views

Complex bin packing 2d in python

im having some trouble with 2d bin packing and cant seem to get the code to work. In this case im using the input: 200x200x10 100x100x2 50x50x1 When starting the last piece in the sorted list of ...
0 votes
0 answers
17 views

Convert a set of overlapping cuiboids to a minumum set of non-overlapping cuiboids

I am trying to decompose an overlapping set of cuboids to non-overlapping ones, the fewer non-overlapping cuboids used the better. For example, in the case below: There are three overlapping cuboids, ...
  • 287
2 votes
2 answers
156 views

Cut a large cuboid into random small cuboids whose dimensions are within a certain range

I am trying to cut a large cuboid of dimension (L, W, H) into N (N can be an arbitrary number and doesn't need to be specified) small cuboids where length and width of the small cuboids are 20% to 50% ...
  • 287
0 votes
2 answers
260 views

PHP variable packing and unpacking

I have a function that is used in Stripe PHP that requires PHP 5.6. I am running it on a server that has PHP 5.5.9 and giving me some trouble. The function is: protected function buildPath($basePath, ....
  • 41
0 votes
1 answer
82 views

Why does data packing 4 integers into a 32 bit integer have different results in Nextion and Teensy(Arduino compatible)

I'm controlling a Teensy 3.5 with a Nextion touchscreen. On the Nextion the following code packs 4 8 bit integers into a 32 bit integer: sys0=vaShift_24.val<<8|vaShift_16.val<<8|vaShift_8....
  • 1
1 vote
0 answers
208 views

Packing rectangles inside a rectangle

I was trying to find some algorithm that would pack a bunch of different rectangles inside a rectangle with fixed width and unlimited length. Unfortunately, I couldn't find anything relevant. I ...
0 votes
2 answers
66 views

Is it possible to pack a struct in C to size defined by bits

I have the following struct struct header { unsigned int op:16; unsigned int A:1; unsigned int B:1; unsigned int C:1; unsigned int pad:1; } int main() { struct header a; ...
0 votes
0 answers
23 views

What is happening struct padding or packing in 64 bit computer [duplicate]

Code 1 #include <stdio.h> //structure var struct var{ char a; }; int main() { struct var r; printf("%ld\n", sizeof(r)); return 0; } Output: 1 I know the concept of padding and ...
  • 161
0 votes
0 answers
173 views

How to reflect hlsl struct member real size in directx11?

trying to finish variable locations parser for hlsl, but can't find a way to get structure member size, in this question How to reflect information about hlsl struct members? it was recommended to use ...
  • 303
0 votes
0 answers
33 views

Is there a compiler attribute which reorders a struct's content for more efficient packing whilst keeping optimal alignment? [duplicate]

Take the following structs, compiled with gcc 64bit struct A { char a; // size 1 // 7 bytes padding long long int i; // size 8 char b; // size 1 // 7 bytes padding }; // ...
  • 161
0 votes
1 answer
160 views

How exactly structure packing and padding work?

How exactly structs are packed and padded in c++? The standard does not says anything about how it should be done (as far as I know) and compilers can do whatever they want. But there are tutorials ...
  • 61
0 votes
0 answers
76 views

Bin repacking algorithm with limited 'temp' space

Basic bin packing algorithms and implementations can be found all over the internet. However, I am looking for an algorithm that will repack a bin using a limited amount of temporary space. The idea ...
  • 150
0 votes
1 answer
90 views

Why is this struct not the size I expect?

I am taking binary input from a file to a buffer vector then casting the pointer of that buffer to be my struct type. The goal is for the data to populate the struct perfectly. I know the size of all ...
  • 15
1 vote
0 answers
82 views

Algorithm to pack N rectangles into a larger one

I am writing a (JavaScript) thumbnail generator and this bit of the project involves placing the N thumbnails in regular rows and columns within a larger target space, including a border around the ...
1 vote
1 answer
184 views

Justified Packing of Rectangles in Javascript

I have an algorithm that packs a set of rectangles. My problem is that all of the rectangles end up perfectly aligned on the let side of the canvas (outlined in red), but not on the right side of the ...
  • 2,235
3 votes
2 answers
660 views

How do you pack three 4 bit signed integers (so 5 bits) into a single 16 bit integer?

I want to pack 3 signed 4 bit integers (4 bits data, 1 bit sign bit) into one 16 bit integer, but I have no idea how to do it or where to start :( I need this to represent a position in a 3D grid in ...
1 vote
2 answers
400 views

java.io.UTFDataFormatException while reading file entry name

Im trying to "pack" several files (previously inside a jar archive) in another single non-jar file by using DataInputStream / DataOutputStream. The idea was: First int = number of ...
0 votes
1 answer
562 views

How can I pack files inside Assets in Unity to reduce the quantity?

I work with unity game projects with thousands of models and other resources inside the Assets folder. After a while, this becomes too slow and inconvenient, due to the constant refresh and meta files....
3 votes
2 answers
616 views

How to fill a fixed rectangle with square pieces entirely?

Is this knapsack algorithm or bin packing? I couldn't find an exact solution but basically I have a fixed rectangle area that I want to fill with perfect squares that represents my items where each ...
  • 310k
0 votes
1 answer
753 views

how to unpack/decompress raw grpc data?

i intercepted grpc http2 request yet i cant make much sense of the data mitmproxy is printing it as hex this is some of the headers te: trailers content-type: application/grpc grpc-accept-encoding: ...
0 votes
1 answer
1k views

Generating random points in a box

I want to generate random points in a box (a=0.2m, b=0.2m, c=1m). This points should have random distance between each other but minimum distance between two points is should be 0.03m, for this I used ...
  • 25
0 votes
1 answer
151 views

Generating rows of combinations

I don't know how I should formulate this question but I hope I can explain what I want to achive. So I got a set of characters [A, B, C]. I want to generate the minimal amount of rows with length of N ...
  • 119
2 votes
1 answer
208 views

Advantage of using MPI_PACK()

I know that MPI_PACK() is used to bundle the non-contiguous data together and send them, but what is the use of it, rather then sending data using MPI_Send() one after the other?
user avatar
-1 votes
2 answers
66 views

Unexpected value after type casting in c

I was implementing the code for sending data through a raw socket. As part of that, I have to construct an IP packet. But I am facing the problem as explained below using a sample program. #include &...
  • 1,459
0 votes
1 answer
165 views

How to extract non-function code from module?

I'm trying to extract all the "runnable" code given a function in a module. Right now I'm only able to extract the functions in any imported module that are called inside the starting ...
0 votes
1 answer
130 views

C++ Struct packing order

I have a union that looks similar to the following: typedef union _thing { struct thing_indiv { uint16_t one:5; uint16_t two:4; uint16_t three:5; uint16_t four:5; ...
0 votes
0 answers
99 views

Fit rectangles in a larger rectangle in JavaScript/React

I am creating a function that is able to calculate how many small rectangles can be fit into a container one. The problem that I'm stuck with - not quite sure how to proceed with the calculations. The ...
  • 39
1 vote
1 answer
294 views

Algorithm for 3D Bin Packing Problem on pallet

I am looking for algorithm for 3D Bin Packing Problem. My task is: I have a conveyor on which I am receiving boxes of 4 sizes (300x200x160, 400x300x220, 600x400x340, 700x510x340). These boxes have to ...
0 votes
2 answers
121 views

How to make it one-liner? Convert list to a bunch of parameters

I have the following code: from datetime import datetime ds = "2020.10.10.12.30.59" y, M, d, h, m, s = [int(x) for x in ds.split('.')] dt = datetime(y, M, d, h, m, s) print(dt) I would ...
  • 339
1 vote
3 answers
125 views

Is there a reason for unpacking a list then putting it back into a list?

I'm trying to understand the following Python line: result = {'key_A': [*dict_A.keys()], 'key_B': "dummy_string"} Result is dictionary that holds a list in Result['key_A'] and string in ...
  • 31
0 votes
1 answer
122 views

C/C++ How Nested Structures Are Packed?

If a word is 4 bytes on my architecture, I would expect the following structure to be padded in order to be at least a word (4 bytes) in size. // 4 bytes struct { uint8_t High : 4; uint8_t Low : 4;...
  • 115
2 votes
1 answer
471 views

Converting float list to byte-like object results in a corrupted image

I am trying to convert data from a Keysight scope to .png Image. When I looked how to do it online, I stumbled the following code: # Download the screen image. # ---------------------------------------...
  • 152
0 votes
1 answer
99 views

How to get rid of installing OpenCV in Ubuntu which is needed by SikuliX API

I have bundled the SikuliX 2.0.3 Jar in my java application. At run-time, this jar file needs access to the OpenCV library from java.library.path. So, I need to install OpenCV on the library path (/...

1
2 3 4 5
7