« first day (577 days earlier)      last day (4372 days later) » 

12:01 AM
Restarted browser and it works :D
 
 
1 hour later…
1:27 AM
is there a way i can save the object of a class (having just one member variable map<int,map<int,int>>) after exiting the main() and reload the object when main() runs again ?
 
In geometry, a superegg is a solid of revolution obtained by rotating an elongated super-ellipse with exponent greater than 2 around its longest axis. It is a special case of super-ellipsoid. Unlike an elongated ellipsoid, an elongated superegg can stand upright on a flat surface, or on top of another superegg. This is due to its curvature being zero at the tips. The shape was popularized by Danish poet and scientist Piet Hein (1905–1996). Supereggs of various materials, like the one shown, were sold as novelties or "executive toys" in the 1960s. A 1-ton superegg made of steel and ...
@Atif save it before main exits.
 
@Atif The concept is called "serialization".
Essentially, you have to convert the object to a format that can be persisted (i.e. stored in something that's less volatile than main memory, the disk, for instance).
In practice, it means you have to save to a file it before main() exists, and load it at the start of main().
 
1:45 AM
@EtiennedeMartel would something like this work
outputFile.Write(thisMap.size());
for (map<int,map<int,int>>::const_iterator iter1 = thisMap.begin(); iter1 != thisMap.end(); ++iter1)
{
outputFile.Write(i->first);
outputFile.Write(i->second);
}
 
Is this really C++?
 
2:01 AM
ohh i know the syntax is wrong ... i just wanted to get the basic idea .... anyways let me try and write in correct syntax and come back here
 
6
Q: Determine number of bits in integral type at compile time

ZeroNOTE: I added a similar but greatly simplified version of the problem at Ambiguous overload of functions like `msg(long)` with candidates `msg(int32_t)` and `msg(int64_t)`. That version has the advantage of a complete compilable example in a single file. Problem I have a C library with function...

^ Can anyone else make sense of that? I downvoted since I couldn't understand the proposed "solutions".
 
2:27 AM
Anyway, I just added the to me "natural" answer so as not to be only negative, but also a bit of constructive.
 
-1
Q: Developing a speech recognition system in c

Coder404I would like to know how to develop a speech recognition system in c/c++. Although I have no idea how they work so this is a 2-part question: How does a Speech Recognition system work? How could I make one in c/c++? Thanks!

really?
 
2:44 AM
lol
Can anyone help me out with this?
1
Q: WM_EX_TRANSPARENT doesn't repaint child windows

Seth CarnegieI am using the WM_EX_TRANSPARENT window style on some windows in an attempt to do double-buffering with transparency. However, I am having a problem because when I do InvalidateRect on the parent window, the child windows are not redrawn. Is it the parent window's responsibility to iterate the c...

I can iterate child windows and repaint them but I don't think that's the right way to do it
and WS_EX_COMPOSITED sucks
 
@JamesCuster That's like saying: "How do I write an operating system in x86 assembly? It needs to be better than Windows 7."
 
Easy. Write code to do everything, and then take out the part that doesn't do speech recognition. — stark 11 mins ago
2
So basically Im' thinking I have to, in the WM_PAINT handler for the parent window, iterate the child windows and have them paint into the parent's buffer, then BitBlt the parent's buffer into it's hdc
By the way I'll give a bounty to whomever answers my question that I linked above
But I don't know how to get only the child windows within the invalid region of the parent
@CheersandhthAlf you're the Windows person aren't you :)
 
@SethCarnegie I use Windows too, but it's been a long time since I've touched any WinAPI aside from basic handles.
 
@Mysticial yeah, I just cannot figure this out for the life of me
my proposed solution seems like brute force junk
Be back in a second, switching computers
 
3:01 AM
is there anyway to bump an old question that never got answered?
 
@NullPointerException Just edit it.
 
ohh ok thanks :)
I was just wondering if its possible.
 
If you are new here, please read the newbie hints and keep the acronym list under your pillow. Thank you.
17
 
Looks like I'm in a rollback war with the OP of this:
-2
Q: Tokenizer in Racket

user1391728Need help with a tokenizer for a Racket Program, psudeocode below 1 Input string 2 Variables: state = 'empty', chars = [], tokens = [], nextSate, nextChar (last two have no initial value) 3 while string is not empty: Set nextChar equal to the first character of string Set nextState equal t...

Should we just outright delete it instead?
 
3:07 AM
WWDC!
 
@SethCarnegie yeah, but i'd have to investigate that. btw., I think it's WS_, not WM_.
:-)
 
@CheersandhthAlf yeah, typo
@CheersandhthAlf my question includes a compilable example so you can see what I mean
SCMCE or whatever
 
ok, but i got sidetracked by shiny new badges
good answer, good answer
yea yea
anyway, found this
0
Q: Static control with WS_EX_TRANSPARENT style not repainted

Javier De PedroI am trying to create a control that implements the per-pixel alpha blend while painting a 32-bit bitmap. I extended a CWnd and use static control in the resource editor. I managed to paint the alpha channel correctly but still the static control keep painting the gray background. I overwrote t...

may be relevant
 
Yes, I saw that, but it doesn't help really
 
oh
"A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated."
 
3:14 AM
My windows never recieve a WM_PAINT
if I don't do WM_ERASEBAKGND then the drawings accumulate
if I do do it, then child controls disappear and never are drawn
if I do it and then repaint child controls, it flickers
 
wait a little
at least i have reproduced the/some problem
simply by compiling your code
:)
 
good lol
I am trying to do my own doublebuffering so that child controls can have transparency
w/o flickering and stuff
 
man, this chat system is awesomely feature packed :0
 
in short, the WS_EX_TRANSPARENT style seems mainly/only to have to do with sending mouse-clicks right through your window, to things underneath
so it's not primarily about transparency
 
3:22 AM
Was that what you were intending?
 
No, I mean visual transparency
that's what I'm trying to get
along with non-flicker drawing
so the parent has to draw itself and then all the child controls from the bottom to the top have to draw themselves
but the problem is that
whenever I call Invalidate on the parent window, non of the child windows recieve WM_PAINT messages
so do I have to iterate all the child windows and ask them to repaint themselves?
that seems hackish and it seems like this would be a common need and that there would be a better way of doing it
like the system would support it or something
 
i think solution is
WS_EX_LAYERED
0x00080000



The window is a layered window. This style cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.

Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.
 
What does it mean "the window is a layered window"?
 
I did some transparency stuff in 16-bit Windows but it flickered. It was to show students when I clicked on mouse buttons, so it was a thing that followed mouse cursor
I'm googling fast! :)
 
Let me switch computers and try it out
brb sec
@CheersandhthAlf ok, let me test it out
 
3:33 AM
13
Q: Is this a known pitfall of C++11 for loops?

ndkrempelLet's imagine we have a struct for holding 3 doubles with some member functions: struct Vector { double x, y, z; // ... Vector &negate() { x = -x; y = -y; z = -z; return *this; } Vector &normalize() { double s = 1./sqrt(x*x+y*y+z*z); x *= s; y *= s; z *= s; ...

Isn't this a dupe? Anyone know of the other question?
 
@Pubby I don't remember seeing one
@CheersandhthAlf how exactly should I use that style on the parent/child? Right now I have
HWND wnd = CreateWindowEx(NULL, "test_window", "test", WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW, 50, 50, 400, 400, NULL, NULL, hinst, NULL);

HWND btn = CreateWindowEx(WS_EX_LAYERED, "BUTTON", "button 1", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD, 50, 50, 100, 50, wnd, NULL, hinst, NULL);
 
That window gets transparent all over, including the controls
(link with user32.lib and comdlg32.lib if you're using visual c++)
 
Ah cool
but
the button isn't showing at all
 
you want the button to be a bit transparent?
 
No because the button doesn't have transparency built into its drawing routine
I just want to draw that line behind the button without flicker
and, for child controls that draw using non-opaque colours, have transparency
 
3:47 AM
ok i see the line
no button
let me bring it up in an editor
 
@SethCarnegie Curiously I loaded up your pastebin, saw no button, swapped out your WS_EX_LAYERED as I figured that would cause the flickering issue you are originally trying to solve
Iunno if I'm crazy or not, but I don't see any flickering
Unless you call this flickering
 
lol
can you paste the lines you changed
 
just this, all I did was swapped out WS_EX_LAYERED for NULL
HWND btn = CreateWindowEx(NULL, "BUTTON", "button 1", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD, 50, 50, 100, 50, wnd, NULL, hinst, NULL);
 
No, I still get flicker in the text of the button
 
i don't see it. windows 7
 
3:50 AM
Move your mouse faster then lol
 
Do you get the line drawing issue as well or just flicker? (Position the cursor far under the button)
 
Yes I got that weird line thing too
And remember though, I am doing manual double-buffering on the parent window
if that means anything
 
I'm moving my mouse in a frenzy, can't repro :D
I remember having this issue once before though, much much long ago
However I can't remember how I fixed it, thus now I'm interested
 
but maybe it disappears if you make main window layered and no transparency
 
^aye
 
3:52 AM
Let me give a sample of something that is transparent
See this
 
	HWND wnd = CreateWindowEx(WS_EX_LAYERED, "test_window", "test", WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW, 50, 50, 400, 400, NULL, NULL, hinst, NULL);
    SetLayeredWindowAttributes( wnd, 0, (255 * 100) / 100, LWA_ALPHA );
it has no effect on my system, so maybe it removes flicker on yours?
 
I'm seeing no flicker, but I don't think I'm seeing transparency either. The hello text label has a solid white background obstructing the line
 
@Allar yeah, the line doesn't draw through the text label thing
that's what I'm trying to solve
both flicker and transparency
 
3:58 AM
Gotcha
 
@CheersandhthAlf let me try that
@CheersandhthAlf has no effect
try my sample I just posted
Even if I handle WM_ERASEBKND and return 1 in it
 
Gotta get one of them keygen makers up in here, they do some crazy stuff with transparencies :D
 
and annoying music
 
You say annoying, I say single-serve-website worthy
 
hahaha
@CheersandhthAlf if I add WS_EX_TRANSPARENT to the text label control of that example I just posted, the label disappears and the line draws weirdly when you move it to the bottom right of the window
 
4:05 AM
yes
i don't know this stuff
 
i think you have to use UpdateLayeredWindow for the text
 
> Previous Windows versions support WS_EX_LAYERED only for top-level windows.
Doesn't help for child windows which is all I care about
 
well
after playing D3 for 4 and a half hours when I should have been sleeping
it's probably time to go to bed
 
Hmmm
I have the text label disappearing
 
4:12 AM
@Allar at least you can repro
 
not sure if fully transparent or just fubar
'tis happening with some code changes on my end
attempting something that I have no idea what im doing
 
@SethCarnegie i think maybe a good way to think here is a control that paints in its parent window's dc (or bitmap). the parent can be layered.
but then you're back to "manual" iteration over and updating of controls
i think there may be something i'm missing then, because when things get hard then it's a symptom of not going with the flow but going against the intended way
 
Q: why do you like C++?
 
Because it makes me feel like a MAN
 
@stdOrgnlDave Who's that targeted at? Nobody here honestly likes C++!
 
4:17 AM
If @R.MartinoFernandez had said that, it would have been a lot funnier
@Pubby why do you dislike it then?
 
Because it called me bad names
 
@Pubby loser!
 
:'(
Outside? I thought that was just a legend.
 
what's wrong @ScottW? I'm going to rename myself std::hardcoreprogrammer maybe I could help
@Pubby got anything interesting going on programming-wise?
@ScottW well I'm also studying to be a pastor, so maybe I can help you with that too
 
@stdOrgnlDave I think I want to try again at making a game in Haskell, haven't started yet though
 
4:21 AM
@ScottW the unfortunate news I have for you is that programming can follow you outside on a laptop like a lost puppy :-(
@Pubby why haskell?
 
I want to be Hip
 
@SethCarnegie if it helps any, I can see flickering on my system if I set the NULL dwExStyle flag of the parent window to WS_EX_COMPOSITED
which draws from bottom up
 
@Pubby www.youtube.com/watch?v=5GpOfwbFRcs
 
@Allar I have both being NULL atm
 
@Allar why would you draw into a framebuffer bottom up? are you asking for your cache to hate you?
 
4:24 AM
Holy fuck, they actually made this into a movie:
 
@stdOrgnlDave Don't reply without reading the above 500 messages first :)
 
I wouldn't, but now I'm just kind of throwing things at Seth's problem
:D
 
have you tried just painting the text in the main window's update, after drawing the line.
poor man's window-less control
 
@CheersandhthAlf that would defeat the purpose though
I want windowless-less structure
@CheersandhthAlf but that would be what you would do if you iterated the child windows and had them paint themselves, just give them the parent's HDC to use
 
yep
i think will sit down today and teach myself this stuff
it seems there are three kinds of transparent window:
* a color acts as transparent
* general transparency in percent applied all over
 
4:32 AM
@CheersandhthAlf if you figure this out and help me solve this problem I will totally give you a 250 bounty
 
* fine control by update-layered-window with bitmap with alpha channel
where the first incur some heavy memory overhead because system keeps bitmap
 
@CheersandhthAlf that third kind is the kind I want I think
 
that's UpdateLayeredWindow I think it was called
 
So I do need to iterate the child windows then?
and call that on all of them
 
right now i think so, but it seems so wrong
 
4:34 AM
I don't see why though when I could just get them to WM_PAINT with the doublebuffer bitmap I have for the parent window
 
@SethCarnegie what windowing system are you working with
 
instead of using UpdateLayeredWindow
@stdOrgnlDave Win32
 
@SethCarnegie expert is coming in
 
who's that
 
johnathon
 
4:35 AM
sweet
 
I don't know, @johnathon pumps out win32 code like it runs through his veins and he decided to commit suicide
 
lmfao
whats the win32 question?
 
@johnathon hey, what's up
 
sup seth
 
I am just trying to do something with doublebuffering here
 
4:36 AM
using ? GDI or Direct 2d?
 
I am trying to do my own doublebuffering on a parent window and then have child windows be able to draw transparently
GDI
However, either one of two things happens:
1, the child windows are erased when I try to use WM_EX_TRANSPARENT when the parent draws, and it draws over the children and they don't get WM_PAINT messages
or 2, the child windows aren't transparent
 
do you have the parent window set to clip children?
 
yes
I am thinking a solution to this problem is to iterate all the child windows that are in the invalid region in the parent's WM_PAINT and have them paint in the paren'ts doublebuffer
and then bitblt it into the parent's hdc when all of them are done
 
and when you do your double buffering, are you creating the bitmap, then passing the bitmap context to defwindowproc ? then bitlibting it to the screen?
 
@johnathon I'm not passing it to defwindowproc, I'm just drawing on it with the parent and then using it in the child windows wm_paint
 
4:38 AM
each window will have it's own device context
and if your child window is a layered window
do your painting like this in the parent
make your bitmap dc
pass it to defwindowproc
THEN do the drawing you want to do
then bitblit it to the screen
 
why do you pass it to dwp and then draw on it?
 
dont touch it untill windows gets a chance to do default processing on it . So windows will handle your child windows for you
and your child window has it's own DC
it's own HWND
 
But wouldn't that make all the children draw onto it, and then you draw over the children?
I have to tell you I don't know what defwindowproc does with a WM_PAINT message
 
if your clipping your child windows no, windows will handle that.
 
I'm kinda a noob at this
OH
 
4:41 AM
defwindowproc does the default thing that windows does with what ever the message is
 
yeah, because it has the clipchildren thing
@johnathon actually that won't work because I'm trying to do transparency right?
 
with double buffingering , always let windows do it's default thing then do your thing
 
if it's clipping children, then if I e.g. draw a line behind a child, it won't be visible through the child
 
depends on the transparancy of the child
layred windows are funny beasts
 
There seem to be many kinds of transparency with Windows, how should I let it know that
 
4:42 AM
even when hit testing them if the alpha is so much on them the hit test will go under the window
 
@johnathon how do I make a bitmap DC and pass it to defwindowproc?
and I'm really sorry I don't know this, I'm pretty new to Win32 GUI programming
I know how to make a bitmap DC, just not how to get dwp to use it
 
@SethCarnegie what are you using , straight win32 api or are you using something like WTL, or MFC ?
 
@johnathon yes, straight Win32
don't cringe
 
@SethCarnegie what you need to do is create a memmory dc, from the dc that you get from WPARAM , then pass it to the WPARAM of defwindowproc, casting it of course to a WPARAM
let windows do it's default processing
then after the call to defwindowproc do your paiting on the mem dc , then bitblit it to the main dc
 
@johnathon the WPARAM from what message? WM_PAINT doesn't use the WPARAM does it?
sorry if dumb question
 
4:48 AM
this->DefWindowProc(WM_PAINT,(WPARAM)dcMem.m_hDC,(LPARAM)0);
 
@johnathon so the docs are wrong and WM_PAINT really does use the WPARAM?
 
@SethCarnegie i use WTL , but the dcMem is just a memmory dc
@SethCarnegie yup, the docs on sockets are wrong too, cuz the WPARAM of a socket call is the socket that made the call to begin with
 
MS docs are the worst I've ever seen, they are both wrong and not helpful
OK let me try all this and I'll see what I can figure out
 
@SethCarnegie theay are most of the time correct, and helpfull , if you know how to use them
 
@johnathon if I can get it working then please post this stuff as an answer on my question and I will give you a 250 bounty
@johnathon I don't know how to use them then lol
 
4:50 AM
@SethCarnegie no problem
 
@johnathon oh one more thing, I should pass it to dwp on every WM_PAINT message right?
even though I'm saving it accross calls
the bitmap backbuffer
 
@SethCarnegie you can TECHNCALLy save a lil bit by not recreating the memdc on every paint, but you'll have to everytime the window is resized
 
@johnathon yeah, I do that and whenever the window is resized up I resize the bitmap and whenever it's resized down I leave it
 
@SethCarnegie get it working by creating it and releasing it in the paint first
 
Ok I'll see what I can do
 
4:52 AM
@SethCarnegie yea, it's a tad bit more efficent that way, but like i said for the time being , just get it working
 
some of the common controls do use WPARAM of WM_PAINT, IIRC; they pass a DC there.
 
@johnathon so should I be using any extended styles on the parent/children?
 
@SethCarnegie it wont matter , so long as the parent has clip children and the child windows are WS_CHILD all is good
 
I should get +50 bounty because I knew who could answer this
 
@johnathon sorry, I'm still getting the problem of the children controls not being repainted when their parent is invalidated
 
4:57 AM
@SethCarnegie get the dc that the children use to paint with from their WPARAM
@SethCarnegie and how exactly are you telling windows to repaint it's self?
 
InvalidateRect(hwnd, NULL, TRUE)
or whatever that function is called
I'm doing that in WM_MOUSEMOVE
to draw a line to where the mouse is
 
ok now that i know what your doing
@SethCarnegie you have teamviewer?
 

« first day (577 days earlier)      last day (4372 days later) »