Wednesday, November 16, 2016

Digest for comp.lang.c++@googlegroups.com - 25 updates in 5 topics

"Christopher J. Pisz" <cpisz@austin.rr.com>: Nov 15 05:47PM -0600

On 11/15/2016 5:34 PM, Stefan Ram wrote:
> "Christopher J. Pisz" <cpisz@austin.rr.com> writes:
>> I uploaded Visual Studio projects and a text file with the questions here.
 
> I do not like to open web pages.
 
I think you can trust github....
but meh. If you don't want to help, you don't have to, it's help after all.
JiiPee <no@notvalid.com>: Nov 15 11:49PM

On 15/11/2016 23:03, Christopher J. Pisz wrote:
>> any applicant who did that - but maybe that's just me.
 
> They made the node, not me. I had to use the node. :P
> I only got to write the optimize function, given their stub.
 
they made an error themselves and then "accuse" you of doing errors? :)
"Christopher J. Pisz" <cpisz@austin.rr.com>: Nov 15 05:54PM -0600

On 11/15/2016 5:49 PM, JiiPee wrote:
 
>> They made the node, not me. I had to use the node. :P
>> I only got to write the optimize function, given their stub.
 
> they made an error themselves and then "accuse" you of doing errors? :)
 
I also pointed out to them that in question 7, they pass a
std::vector<string> by value and it would be better to be passed by
reference.
 
I dunno, didn't want to come off too arrogant.
 
I wanted to at least get in the door and then get a feel for their
competence. Now I am worried about my own. Not getting many callbacks.
I might just be paranoid, it is 4th quarter after all.
JiiPee <no@notvalid.com>: Nov 15 11:58PM

So all those 6-8 tasks are done by you?
 
 
On 15/11/2016 23:54, Christopher J. Pisz wrote:
> std::vector<string> by value and it would be better to be passed by
> reference.
 
> I dunno, didn't want to come off too arrogant.
 
if i was an employer that would just be a positive comment
 
"Christopher J. Pisz" <cpisz@austin.rr.com>: Nov 15 06:03PM -0600

On 11/15/2016 5:58 PM, JiiPee wrote:
 
>> I wanted to at least get in the door and then get a feel for their
>> competence. Now I am worried about my own. Not getting many callbacks.
>> I might just be paranoid, it is 4th quarter after all.
 
Yea, I did 6-8 over a weekend. Made a project for each question. I had
to use their stubs and the code they gave for things things like the
LinkedListNode. It was originally an online timed test they wanted me to
do in 1.5 hours. I copied the questions into the text file. I told them
there was no way I'd get it done in 1.5 hours, but I'd be happy to do it
over a weekend. They agreed.
 
There were also 5 multiple choice questions in the form of "will the
following code compile?", but they were pretty trivial.
JiiPee <no@notvalid.com>: Nov 16 12:13AM

On 15/11/2016 20:05, Christopher J. Pisz wrote:
 
> Any feedback?
 
7)
const std::string opens = "([{";
************
 
I would do: const std::string opens{"([{"};
not big issue though...
 
7)
// Iterate through each string
 
for(auto itString = values.begin(); itString != values.end(); ++itString)
**********
Why you did not use the new for loop:
for(const auto& value : values)
?
JiiPee <no@notvalid.com>: Nov 16 12:18AM

On 15/11/2016 20:05, Christopher J. Pisz wrote:
 
> Any feedback?
 
7)
if (*itResultString == "NO")
***********
 
You are using that NO in several places. I would create at least a
constant at the top of the function, something like:
static const string NO{"NO"};
 
the same for YES.
 
7)
for (auto itResultString = nextFrameResults.begin(); itResultString !=
nextFrameResults.end(); ++itResultString)
***********
for(const auto& nextResult : nextFrameResults)
JiiPee <no@notvalid.com>: Nov 16 12:41AM

On 15/11/2016 20:05, Christopher J. Pisz wrote:
 
> Any feedback?
 
8)
newStrings.push_back(std::shared_ptr<std::string>(new
std::string(currentString + 'e')));
###########
 
Cant you do this using make_shared? more safe
woodbrian77@gmail.com: Nov 15 05:52PM -0800

On Tuesday, November 15, 2016 at 6:03:34 PM UTC-6, Christopher J. Pisz wrote:
> do in 1.5 hours. I copied the questions into the text file. I told them
> there was no way I'd get it done in 1.5 hours, but I'd be happy to do it
> over a weekend. They agreed.
 
Their willingness to grant you that much is a good sign.
In my opinion you don't want to have to keep taking these
tests though over and over. Instead you could have a blog
and/or some open source code that demonstrate your abilities
when given years and decades. I should work on blogging
myself, but am happy to have worked on the latter idea
extensively. It represents my best work.
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
JiiPee <no@notvalid.com>: Nov 16 07:04AM

> when given years and decades. I should work on blogging
> myself, but am happy to have worked on the latter idea
> extensively. It represents my best work.
 
It is also true that in pressure people are not in their best. I
remember doing an interview test coding (create a simple card game) in
one interview. I think I got it working right (it seemed to run
correctly), but later on I found out that I did not use proper C++ ways
to do it in couple of things. At home I would do the same game much
differently and better :). So yes, they did not get my best performance
there. wrong or right? i donno but I surely can do better than that.
Also |I remember another simple interview test: "create a function which
calculates an average". Also there I forgot at least one thing which I
would definitely not forget if working at home.
"Christopher J. Pisz" <cpisz@austin.rr.com>: Nov 16 01:54AM -0600

On 11/16/2016 1:04 AM, JiiPee wrote:
> Also |I remember another simple interview test: "create a function which
> calculates an average". Also there I forgot at least one thing which I
> would definitely not forget if working at home.
 
Certain books on interviewing point out that, that pressure is accounted
for, and some companies are actively looking for how you do under
pressure and highly stressed, because it supposedly relates to deadlines
and office pressure.
 
I disagree with that whole heartily, but people seem to think it.
 
Deadlines never effect my performance at all. I simply shrug and look at
them as what a manager wants, rather than something that impacts me at
all. Of course, I will prioritize features, or ask them to select them,
maybe point out that this or that has to suffer testing in the worst
case, but it never gets me stressed. Times tests on the other hand
stress me out out like crazy.
JiiPee <no@notvalid.com>: Nov 16 08:09AM

On 16/11/2016 07:54, Christopher J. Pisz wrote:
> accounted for, and some companies are actively looking for how you do
> under pressure and highly stressed, because it supposedly relates to
> deadlines and office pressure.
 
I dont think couple of hours deadline is the same as one weeks (or one
months) deadline for example.
I would say that this kind of test gives some direction of what the
canditate can do... but not sure if it should be take literally.
 
But what else can the employer do? Surely its better than asking: "How
good are you? So you are excellent in creating classes.. thats good,
then we take you in!!".
 
But maybe best would be if they can see his long term work and/or work
done in one week/month.
 
Louis Krupp <lkrupp@nospam.pssw.com.invalid>: Nov 16 01:16AM -0700

On Tue, 15 Nov 2016 21:57:31 +0100, "Alf P. Steinbach"
>company doesn't want employee to use looooong time on premature
>optimization, unless it's contract work for Donald Trump.
 
>Finally, I think maybe you're supposed to delete the nodes at the end.
 
Deleting the redundant nodes (if that's what you meant) would make
sense if, instead of creating a new linked list, the program just used
the original list and linked around the redundancies. The argument to
optimal() isn't const, so why not?
 
One thing to notice is that the data values are guaranteed to be in
the range 0 <= d <= 1000. The program could use a boolean array
indexed from 0 to 1000 to keep track of which data values have been
seen. That would give you an O(n) solution.
 
In the balanced braces question, it doesn't say that the input string
must consist of only braces, although that is true of their examples.
 
There are probably some strange but clever ways to solve that problem,
given that the strings are apparently guaranteed to be no more than
100 characters long. That sort of thing might or might not have been
what they were looking for.
 
One possibility is that the people doing the testing get a lot of
competently written solutions, and they're looking for the few that
really stand out. Are they missing some productive programmers (and
future managers) that way? My guess is that they are.
 
Louis
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 16 09:23AM +0100

On 16.11.2016 09:16, Louis Krupp wrote:
> 0 <= d <= 1000
 
Where did you see that? I l00ked for it.
 
 
Cheers!,
 
- Alf (denying all rumors that I'm really Julian Assange!)
Popping mad <rainbow@colition.gov>: Nov 16 03:32AM

On Wed, 16 Nov 2016 00:15:06 +0100, Christian Gollwitzer wrote:
 
> https://github.com/lvandeve/lodepng
 
 
 
ah, that is good. Thank you.
Juha Nieminen <nospam@thanks.invalid>: Nov 16 08:01AM

> Sean Barret has very impressive (compact) C code to write PNG files in
> stb_image_write.h:
 
> https://github.com/nothings/stb
 
I appreciate simple projects being as minimal as possible in terms of source
files (ie. rather than have a million tiny source files, often requiring
configure scripts, makefiles and whatnot, just a few, preferably one or two,
source files that Just Work(TM), as they are. Just add them to your project
or compile command, and that's it. No fuss, no hassle. I like that.)
 
However, a header-only implementation using an enormous amount of very
large static functions (because C doesn't support inline)? Come on.
That goes a bit too far. If you ever include the header file in more
than one place, you'll be duplicating all the code in your executable.
(I don't think linkers will check if two static functions are
completely identical in content and merge them. If some do, great,
but AFAIK they usually don't.)
Andreas <nospam@invalid.invalid>: Nov 16 12:54AM +0100

Hi all,
 
I wonder how to use logging in inline functions without violating ODR.
To make clear what I mean, please consider the following example:
 
<f.hh>
#ifndef F_INCLUDED_
#define F_INCLUDED_ 1
 
#if ! defined(FOOBAR)
#define FOOBAR "foobar"

No comments: