Saturday, January 27, 2018

Digest for comp.lang.c++@googlegroups.com - 22 updates in 3 topics

bitrex <bitrex@de.lete.earthlink.net>: Jan 27 07:44AM -0500

On 01/26/2018 03:29 PM, Mr Flibble wrote:
 
> https://www.youtube.com/watch?v=u9A5EGE5KYg&feature=youtu.be
 
> neoGFX .. the ultimate C++ GUI library .. coming soon!
 
> /Flibble
 
I'm looking forward to trying it because e.g. Qt is kind of a mess.
 
Only criticism is that the shading effect on the "Generate UUID" button
for example looks very harsh on my display, like almost instant
transition from light to dark. Can that be adjusted?
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 27 05:57PM

On 27/01/2018 12:44, bitrex wrote:
 
> Only criticism is that the shading effect on the "Generate UUID" button
> for example looks very harsh on my display, like almost instant
> transition from light to dark. Can that be adjusted?
 
Hi!
 
I have just changed the code for shiny 3D button rendering so the
transition is less harsh (it was old code using two separate gradients
for top half and bottom half but now it uses a single gradient):
 
http://neogfx.org/temp/new_button_3D_look.png
 
/Flibble
 
--
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 27 10:05AM -0800

On Friday, January 26, 2018 at 3:29:45 PM UTC-5, Mr Flibble wrote:
> that is not our fault. It's not right, it's utterly, utterly evil."
> "Why should I respect a capricious, mean-minded, stupid God who creates
> a world that is so full of injustice and pain. That's what I would say."
 
Leigh, I have to say again what fantastic work you've done on
this project. Multi-line button text in multiple languages or
with graphics, top and bottom sliders with color cues, hot track-
ing, menus with icons, intuitive display, nice color separation,
nice borders and frames.
 
I do agree with bitrex's comment:
> Only criticism is that the shading effect on the "Generate UUID" button
> for example looks very harsh on my display, like almost instant
> transition from light to dark. Can that be adjusted?
 
Also, some of your color algorithms need little tweaks so they're
not quite so contrasting relative to others, such as buttons C,I
at the bottom at 0:04. They're very strong, but buttons B,D are
softer, not so much contrast between top and bottom sections.
 
An algorithm adjusting that coloring based on baseline hue would
help out.
 
Truly excellent work overall. I am thoroughly impressed. And I
am completely serious about that. I showed my son your screen and
he liked it. He said he would use the blue theme. :-)
 
--
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 27 01:20PM -0500

On 1/26/2018 3:29 PM, Mr Flibble wrote:
> Video of neoGFX's automatic GUI theme palette colourisation:
> https://www.youtube.com/watch?v=u9A5EGE5KYg
> neoGFX .. the ultimate C++ GUI library .. coming soon!
 
How do you do render the text? Do you draw to an off-buffer bitmap
and then map it onto a polygon? And how do you do the kerning? Is
it a feature of the font generation engine, or do you draw each char
individually, and then determine geometry from the edges and overly
things where possible based on the indented parts?
 
--
Thank you! | Indianapolis, Indiana | God is love -- 1 John 4:7-9
Rick C. Hodgin | http://www.libsf.org/ | http://tinyurl.com/yaogvqhj
-------------------------------------------------------------------------
Software: LSA, LSC, Debi, RDC/CAlive, ES/1, ES/2, VJr, VFrP, Logician
Hardware: Arxoda Desktop CPU, Arxita Embedded CPU, Arlina Compute FPGA
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 27 06:38PM

On 27/01/2018 18:20, Rick C. Hodgin wrote:
> it a feature of the font generation engine, or do you draw each char
> individually, and then determine geometry from the edges and overly
> things where possible based on the indented parts?
 
If you want me to engage with you with on topic discussion then you must
first stop your off topic religious spam.
 
/Flibble
 
--
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 27 01:40PM -0500

On 1/27/2018 1:38 PM, Mr Flibble wrote:
>> things where possible based on the indented parts?
 
> If you want me to engage with you with on topic discussion then you must
> first stop your off topic religious spam.
 
Okay.
 
--
Thank you! | Indianapolis, Indiana | God is love -- 1 John 4:7-9
Rick C. Hodgin | http://www.libsf.org/ | http://tinyurl.com/yaogvqhj
-------------------------------------------------------------------------
Software: LSA, LSC, Debi, RDC/CAlive, ES/1, ES/2, VJr, VFrP, Logician
Hardware: Arxoda Desktop CPU, Arxita Embedded CPU, Arlina Compute FPGA
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 27 10:39PM

On 27/01/2018 12:44, bitrex wrote:
 
> Only criticism is that the shading effect on the "Generate UUID" button
> for example looks very harsh on my display, like almost instant
> transition from light to dark. Can that be adjusted?
 
Thanks to customer feedback the 3D shading effect used for rendering
push buttons is now more subtle (less shiny) in neoGFX's default widget
skin:
 
http://neogfx.org/temp/new_button_3D_look_v2.png
 
/Flibble
 
--
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 27 02:44PM -0800

On Saturday, January 27, 2018 at 5:39:44 PM UTC-5, Mr Flibble wrote:
> push buttons is now more subtle (less shiny) in neoGFX's default widget
> skin:
 
> http://neogfx.org/temp/new_button_3D_look_v2.png
 
I would like to see the edges more shiny, 67% left, 33% right,
and the middle like you have it. It's too much of a reduction
for the entire button IMO.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 27 11:15PM

On 27/01/2018 22:44, Rick C. Hodgin wrote:
 
> I would like to see the edges more shiny, 67% left, 33% right,
> and the middle like you have it. It's too much of a reduction
> for the entire button IMO.
 
For personal taste button appearance is entirely customizable by using,
among other methods, CSS3. I think what I have now will keep most
people happy.
 
/Flibble
 
--
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
JiiPee <no@notvalid.com>: Jan 27 04:07AM

Two processes are using the file to transfer data. So it needs to be
locked when one is using it. I need to first read its content and then
delete its content. But how to lock it during these 2 operations? I know
how to read file and then delete but in between there is no locking and
the other process could mess up there things.
 
Currently:
1. Read files content - is locked
2. After file closed the file is not locked (tiny time) until delete
starts, so the other process could do something.
3. Delete the files content - is locked
 
So I would need something like this:
 
LOCK FILE
1. Read files content
2. Delete the files content
UNLOCK FILE
 
Does anybody know how to do this? (I use Windows).
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 27 06:16AM

On Sat, 2018-01-27, JiiPee wrote:
> 2. Delete the files content
> UNLOCK FILE
 
> Does anybody know how to do this? (I use Windows).
 
How does the reader know that data becomes available? It sounds brittle.
 
IMHO you should consider using a real IPC mechanism, a pipe or
something: https://en.wikipedia.org/wiki/Inter-process_communication
 
But of course I don't know all your requirements (and I don't know Windows).
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
JiiPee <no@notvalid.com>: Jan 27 06:28AM

On 27/01/2018 06:16, Jorgen Grahn wrote:
> How does the reader know that data becomes available? It sounds brittle.
 
When the program opens the file, then other process cannot open it to
write (the opening fails). So it waits until its closed.
So its polling.
 
 
JiiPee <no@notvalid.com>: Jan 27 06:29AM

On 27/01/2018 06:16, Jorgen Grahn wrote:
 
> How does the reader know that data becomes available? It sounds brittle.
 
This javascript writing and C++ reading.
 
Robert Wessel <robertwessel2@yahoo.com>: Jan 27 01:03AM -0600

>2. Delete the files content
>UNLOCK FILE
 
>Does anybody know how to do this? (I use Windows).
 
 
While OT, in native Windows you can specify file sharing in the thrid
parameter of CreateFile(), and in .NET, in the fourth parameter of
File.Open().
 
The sharing modes allow you to control how other programs can open the
file while you have it open. So you might require exclusive access if
your writing a file, but allow other programs read access if you're
only opening it for read. Note that some of those will be defaulted
based on the type of access requested.
 
If you want to use the native handle with the normal C streams, you
can convert the system handle to a descriptor with _open_ofshandle(),
and convert the descriptor to a FILE * with _fdopen(). I think you
can do the same with a C++ fstream by passing the descriptor to
fstream::attach(), but I've not done it myself.
JiiPee <no@notvalid.com>: Jan 27 06:15PM

On 27/01/2018 07:03, Robert Wessel wrote:
> The sharing modes allow you to control how other programs can open the
> file while you have it open.
 
 
But my situation is that after closed the opened file I would like it
*remain locked* as I need to then also delete the file contend after I
read its content. Because there is a tiny break after I closed the file
and before I open it again to remove to content. So in this gap the
other process could do something which is a problem.
Robert Wessel <robertwessel2@yahoo.com>: Jan 27 12:37PM -0600

>read its content. Because there is a tiny break after I closed the file
>and before I open it again to remove to content. So in this gap the
>other process could do something which is a problem.
 
 
Consider having the reader delete the file when he's done.
 
Or consider the byte range locking mechanism to implement a series of
semaphore-like objects. Open the file with shared access, but reserve
a bit of the file for the locks. LockFile(Ex native, Filestream.Lock
for .Net. At least with LockFileEx you might be able to avoid
polling.
 
Or just open the file shared, and have a byte for both sides, and
update those bytes as status progresses on both side. Each side then
polls the other's status byte.
 
Put either of those last two in a separate control file if you need it
to persist past opens and closes of the main file.
 
To much logic like that with shared files has always been a problem,
though, and as has been suggested a proper IPC mechanism might be a
better idea. Or you might punt the data storage to a database.
JiiPee <no@notvalid.com>: Jan 27 07:01PM

On 27/01/2018 18:37, Robert Wessel wrote:
> Consider having the reader delete the file when he's done.
 
Yes I read about this and googled, but my understanding is that it is
not possible to read and delete the content at the same time. Is this
true? This would be best solution for now (as I dont have time to do
other solutions). Also, the other process is jacascript, so its not
going to be so easy to do other ways....
Robert Wessel <robertwessel2@yahoo.com>: Jan 27 01:31PM -0600

>true? This would be best solution for now (as I dont have time to do
>other solutions). Also, the other process is jacascript, so its not
>going to be so easy to do other ways....
 
 
Sorry, not sure where I got .Net from...
 
In Windows, the reader would have to close the file before issuing the
delete. But if the writer doesn't care about the file after he's
written it, and the reader knows not to process the file while he's
doing the delete process.
 
There's a problem if you have multiple readers. But since those are
native code, you can just use a global mutex (assuming all the readers
are on one machine) around some of the file management operations. For
example acquire the mutex before scanning the work directory looking
for a new file to read, release it when you've found and opened one
(for exclusive access). Acquire it again just before the close and
release it after the delete. That way all of the "meta" operations
are serialized. This becomes a bit more difficult if the readers are
spread over multiple machines, but then you could use a lock file to
implement the mutex.
JiiPee <no@notvalid.com>: Jan 27 08:54PM

On 27/01/2018 19:31, Robert Wessel wrote:
> There's a problem if you have multiple readers.
 
There is one reader and one writer
JiiPee <no@notvalid.com>: Jan 27 08:59PM

On 27/01/2018 19:31, Robert Wessel wrote:
> work directory looking
> for a new file to read, release it when you've found and opened one
> (for exclusive access).
 
its only one file they are using common. Also how can the
node.js/javascript check the mutex?
But the writer is not allowed to write when the file is opened or before
the file id deleted. So the release cannot happen after opening, but
should happen after the file has been read+deleted.
 
> Acquire it again just before the close and
 
but between this the writer ccould write new data which is not good.
 
Robert Wessel <robertwessel2@yahoo.com>: Jan 27 03:17PM -0600

>> (for exclusive access).
 
>its only one file they are using common. Also how can the
>node.js/javascript check the mutex?
 
 
By itself it can't. As far as I'm aware, there's not a standard way
to call native code from JS, but many implementations have an
extension that allows that. Those may have installation and security
issues that you might not care to deal with, and, of course, they're
all different.
 
 
>should happen after the file has been read+deleted.
 
>> Acquire it again just before the close and
 
>but between this the writer ccould write new data which is not good.
 
 
Never write to a file a second time. The writer creates a file,
writes to it, closes it. The reader scans the directory for matching
files, if it finds one, opens it and processes it and then deletes it.
When the writer has more to write, it creates another file (different
name), and the process repeats. If you need the reader to process the
data in the order the writer created it, include a timestamp or
counter in the filename and have the reader select the oldest.
Andrey Karpov <karpov2007@gmail.com>: Jan 27 04:44AM -0800

We would like to suggest reading the series of articles dedicated to the recommendations on writing code of high quality using the examples of errors found in the Chromium project. This is the second part, which will be devoted to the switch operator and, more precisely, to the problem of a forgotten break operator.
 
For many years I have been studying errors in programs and now I can say for sure that in C and C++ the switch operator is implemented incorrectly. I understand that the possibility not to write break, made to pass control further, allows writing elegant algorithms. But still a great number of errors convinced me that the wrong approach was chosen. Sure, it is too late now. I just wanted to say that the right decision would be to necessarily write the word break or a reverse keyword, for example, fallthrough. It would have saved so much effort, time and money. Of course, this shortcoming can not be compared with Null References: The Billion Dollar Mistake, but is still a big blooper.
 
Continue read: https://www.viva64.com/en/b/0554/
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: