Click here to Skip to main content
15,908,264 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: It Only Lasted 11 Minutes Pin
W Balboos, GHB3-Nov-17 0:52
W Balboos, GHB3-Nov-17 0:52 
GeneralRe: It Only Lasted 11 Minutes Pin
W Balboos, GHB3-Nov-17 0:48
W Balboos, GHB3-Nov-17 0:48 
GeneralRe: It Only Lasted 11 Minutes Pin
Sander Rossel3-Nov-17 1:27
professionalSander Rossel3-Nov-17 1:27 
GeneralRe: It Only Lasted 11 Minutes Pin
ZurdoDev3-Nov-17 2:05
professionalZurdoDev3-Nov-17 2:05 
GeneralRe: It Only Lasted 11 Minutes Pin
PeejayAdams3-Nov-17 2:06
PeejayAdams3-Nov-17 2:06 
GeneralRe: It Only Lasted 11 Minutes Pin
Foothill3-Nov-17 4:02
professionalFoothill3-Nov-17 4:02 
GeneralRe: It Only Lasted 11 Minutes Pin
jschell3-Nov-17 6:57
jschell3-Nov-17 6:57 
GeneralOne of those "CP is great" moments PinPopular
Marc Clifton2-Nov-17 14:37
mvaMarc Clifton2-Nov-17 14:37 
So I was looking for an algorithm to "best fit" rectangles on a limited area surface (the screen, in other words, and the rectangles are forms/dialog boxes that are dynamically generated as needed), turns out this is called "Rectangle Packing" or "Bin Packing" or "Binary Tree Bin Packing" and it turns out to be a complicated problem to determine an optimal solution, something they call "NP complete" meaning there is no fixed solution, as in "nondeterministic polynomial time". Yeah, whatever, I just needed something that did a decent job, didn't have to be perfect. Once I figured out the right keywords to search on, Google led me to Fast Optimizing Rectangle Packing Algorithm for Building CSS Sprites

Very cool. The core algorithm can be stripped down to two files, and I tweaked it so I can select whether I want horizontal or vertical precedence, and unlike many of the other algorithms I found out there (mostly in one of those "J" languages) this one doesn't require that all your rectangles are known ahead of time, which was one of my requirements.

Thank you Code Project! (And the author, of course) Jig | [Dance]
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages

Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny

Artificial intelligence is the only remedy for natural stupidity. - CDP1802

JokeRe: One of those "CP is great" moments Pin
Peter_in_27802-Nov-17 14:59
professionalPeter_in_27802-Nov-17 14:59 
GeneralRe: One of those "CP is great" moments Pin
CPallini2-Nov-17 22:01
mveCPallini2-Nov-17 22:01 
GeneralRe: One of those "CP is great" moments Pin
KarstenK2-Nov-17 22:42
mveKarstenK2-Nov-17 22:42 
GeneralRe: One of those "CP is great" moments Pin
David Crow3-Nov-17 4:12
David Crow3-Nov-17 4:12 
GeneralRe: One of those "CP is great" moments Pin
Rick York3-Nov-17 4:31
mveRick York3-Nov-17 4:31 
GeneralChrome RD Quirk/Feature PinPopular
kmoorevs2-Nov-17 7:28
kmoorevs2-Nov-17 7:28 
GeneralRe: Chrome RD Quirk/Feature Pin
raddevus2-Nov-17 7:31
mvaraddevus2-Nov-17 7:31 
GeneralRe: Chrome RD Quirk/Feature Pin
kmoorevs2-Nov-17 7:37
kmoorevs2-Nov-17 7:37 
GeneralRe: Chrome RD Quirk/Feature Pin
raddevus2-Nov-17 7:41
mvaraddevus2-Nov-17 7:41 
GeneralRe: Chrome RD Quirk/Feature Pin
Kevin Marois2-Nov-17 9:42
professionalKevin Marois2-Nov-17 9:42 
GeneralRe: Chrome RD Quirk/Feature Pin
kmoorevs2-Nov-17 10:22
kmoorevs2-Nov-17 10:22 
GeneralRe: Chrome RD Quirk/Feature Pin
Rick York2-Nov-17 9:47
mveRick York2-Nov-17 9:47 
GeneralRe: Chrome RD Quirk/Feature Pin
kmoorevs2-Nov-17 10:24
kmoorevs2-Nov-17 10:24 
GeneralRe: Chrome RD Quirk/Feature Pin
dandy722-Nov-17 10:31
dandy722-Nov-17 10:31 
GeneralRe: Chrome RD Quirk/Feature Pin
kmoorevs2-Nov-17 10:35
kmoorevs2-Nov-17 10:35 
GeneralWHOOOOHOOOO!!!! :D Pin
Sander Rossel2-Nov-17 7:20
professionalSander Rossel2-Nov-17 7:20 
GeneralRe: WHOOOOHOOOO!!!! :D Pin
Mike Hankey2-Nov-17 7:28
mveMike Hankey2-Nov-17 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.