|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
OK, so yesterday I got my first pay cheque for an entire month of
employment. (Last month was only for 3 weeks, not 4.) With Christmas
just around the corner, I'm really loving the 50% pay rise right about
now. ;-)
It may be too early to say, but the WTF quotient of my new employer
appears to be significantly lower than my previous one. I mean, there's
still some minor brokenness there. But it's not like the last bunch of
losers I worked for, where the company was run by deranged howler monkeys.
I've learned a couple of things so far. First, in almost two months,
I've yet to write a single line of C# code. I have, however, written
more Bash scripts than can possibly be healthy for my sanity. On Friday
I discovered that "sudo" and "su -c" do not, in fact, do the same thing.
(!!) I could have saved myself a lot of time if I'd known that sooner...
I have also learned enough about Vi that I can use it successfully
approximately 80% of the time. (The other 20% of the time I open a file,
start typing, and end up putting Vi into some weird mode that there's no
way out of. Or I press escape when I'm already *in* command mode, which
does something very odd.)
I have also learned that there's a thing called "Spotify", who's purpose
appears to be to allow my boss to quickly locate terrible music with
which to troll us all with. (Or just to replay Gangnam Style for the
twenty-ninth time today...) Supposedly this is somehow legal. Also, I
now know the words to The Troll Song.
Last week I brought in a lemon Victoria sponge. One senior member of
staff remarked that it was worth hiring me for the cake alone. I hear
rumours that my contract has been amended, making cake a condition of my
continued employment.
(Some statistics: At my last place, I brought a cake, and with 23 people
in the building, the cake lasted 3 days. A brought a similar cake to my
current place of work, and it vanished in UNDER THREE HOURS. Less than
10 people work here.)
Of course, The Real WTF is hiring. With unemployment at historic record
levels, we literally cannot find *anybody* with the skill-set we need.
Personally I find this baffling. The market must be /flooded/ with
experienced programmers, and yet we keep interviewing people who can't
program their way out of a paper bag.
Here's a challenge - write me a C# function (or even just some
psuedocode) which will take a string containing space-delimited positive
integers, and return them in ascending order.
We have yet to interview anybody who can actually accomplish this
Herculean task. My personal favourite is the guy who, 25 minutes into
the task (??!), decided to add a comment explaining what the function
does. Because, hey, if you can't work out how to write the code, at
least look like you know how to type, amIright?
(The best attempt featured a guy who managed to write a bubble-sort
implementation but couldn't work out how to do the actual string splitting.)
We're using an online site where we can watch people type while we're on
the phone to them, so save wasting our time with face-to-face
interviews. Apparently the last guy we interviewed, the guys could hear
typing but not see anything on the screen, and then suddenly big chunks
of text would appear... It's /almost/ as if the guy was desperately
Googling the code while he was on the phone.
It seems employment agents aren't just useless for employees; they seem
to be pretty worthless for employers too. We suspect they're not sending
us the good candidates because we're not paying enough. (Small company,
small budgets. You know the drill.) One guy submitted a CV written in
Comic Sans. My boss immediately refused to read it, and emailed the
agent explaining that such a CV cannot possibly be taken seriously. He
even helpfully included this little flowchart:
http://catbird.tumblr.com/image/216293561
The agent replied by taking the CV, changing the font, and emailing it
back saying "there, I fixed the problem; hope that helps".
For real.
A professional job agent actually did this.
Of course, I've seen first-hand that there are *a lot* of people who
can't program, and never will. But I would have thought that with an
ocean of people looking for work, it shouldn't be too hard to find the
minority who can. I WAS WRONG! >_<
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid Win7 v1 <voi### [at] devnull> wrote:
> Here's a challenge - write me a C# function (or even just some
> psuedocode) which will take a string containing space-delimited positive
> integers, and return them in ascending order.
If it were C++, I could write a few lines of code that does that, although
with the caveat that I would first have to ask what the return type should
be and whether there should be any kind of error-checking or not (and if
yes, how errors should be notified to the calling code.) Space-delimited
integers in a string happens to be one of the easiest things to parse in C++.
(It would be much more complicated if the syntax were more complex.)
I assume there's an at least as easy way of doing it in C#, but since
I don't know the language I would fail the test.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 02/12/2012 03:06 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] devnull> wrote:
>> Here's a challenge - write me a C# function (or even just some
>> psuedocode) which will take a string containing space-delimited positive
>> integers, and return them in ascending order.
>
> If it were C++, I could write a few lines of code that does that,
Or, indeed, any half-sane programming language you care to use, really...
> although
> with the caveat that I would first have to ask what the return type should
> be
This is unspecified. Another space-delimited string would be fine, a
list or array of integers would be fine, really any "appropriate"
container is fine. What we're really looking for is
1) You can figure out how to split a string and parse it into integers.
2) You can sort the result.
3) You can return it to the caller.
Not forgetting item 0 ("you realise that this is what you need to do to
solve the overall problem"). For example, sorting the ASCII substrings
won't give the correct answer, because the integers may have different
numbers of digits. So you actually have to parse them. (I /suppose/
padding the substrings with zeros would achieve the same thing... but
parsing an integer isn't exactly hard.)
> and whether there should be any kind of error-checking or not (and if
> yes, how errors should be notified to the calling code.)
That would certainly add bonus points. But then, about the only error I
can think of is if the string contains characters other than spaces and
digits. Returning null would probably be fine.
> Space-delimited
> integers in a string happens to be one of the easiest things to parse in C++.
> (It would be much more complicated if the syntax were more complex.)
The matter is similar in C# - a standard library function performs this
exact task. Which, presumably, is why it was chosen.
> I assume there's an at least as easy way of doing it in C#, but since
> I don't know the language I would fail the test.
At this point, we're not even asking for correct class or method names.
Just something that looks like vaguely valid C# syntax and has logic
which isn't obviously gibberish.
This is how easy we're making it, and nobody has yet managed to pull it off.
I weep.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 02/12/2012 03:06 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] devnull> wrote:
>> Here's a challenge - write me a C# function (or even just some
>> psuedocode) which will take a string containing space-delimited positive
>> integers, and return them in ascending order.
>
> If it were C++, I could write a few lines of code that does that
Haskell:
foobar :: String -> [Int]
foobar = sort . map read . words
C#:
public List<Int> foobar(String s)
{
string[] words = s.Split(' ');
List<Int> list = new List<Int>();
foreach (String word in words) {list.add(int.Parse(word));}
list.Sort();
return list;
}
Not exactly taxing, eh?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid Win7 v1 <voi### [at] devnull> wrote:
> 1) You can figure out how to split a string and parse it into integers.
In this particular case I wouldn't split it at all, but parse the ints
directly from the string (which is quite easy to do since they are
whitespace-separated.)
Incidentally, there aren't any "string splitting" functions in C++ per se
(unless you count strtok() as being one.) If you literally need to create
a bunch of substrings from a given strings, there's no easier way than to
simply write the loop explicitly. (As much as it pains me to admit it,
parsing is not the forte of the C++ standard library, and it sometimes can
be a burden.)
In this case, however, it's just easier to parse the ints directly from the
input string, with no splitting or tokenization. (Basically there would be
two ways of doing that: Either use a stringstream, or use std::strtol() in
a loop. With a stringstream you could get fancy and use an input iterator
and call a standard algorithm to read the ints, thus eliding having to write
an explicit loop. If you want efficienty, though, std::strtol() is the
better choice, but it's more low-level.)
> 2) You can sort the result.
I can't imagine a programming language that doesn't offer sorting directly.
Even standard C offers such a function, and that's saying quite a lot.
In most languages it should be a one-liner (except in C, of course.)
If using the standard sorting function is disallowed for the purpose of
the exercise, then it becomes quite an academic question in itself. It
becomes a question of whether it needs to be efficient or short. A simple
insertion sort is a four-liner (I count each main element of the algorithm
as one line of code), but it's slow with large amounts of data. Faster
algorithms are harder to implement.
> > I assume there's an at least as easy way of doing it in C#, but since
> > I don't know the language I would fail the test.
> At this point, we're not even asking for correct class or method names.
> Just something that looks like vaguely valid C# syntax and has logic
> which isn't obviously gibberish.
I don't know enough C# to make it even look like it were. Unless C#
resembles a lot C++ (which it probably does.) :)
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid Win7 v1 <voi### [at] devnull> wrote:
> Haskell:
> foobar :: String -> [Int]
> foobar = sort . map read . words
> C#:
> public List<Int> foobar(String s)
> {
> string[] words = s.Split(' ');
> List<Int> list = new List<Int>();
> foreach (String word in words) {list.add(int.Parse(word));}
> list.Sort();
> return list;
> }
In C++ I would probably write it like:
std::vector<int> foobar(const std::string& s)
{
std::istringstream is(s);
std::vector<int> result;
int value;
while(is >> value) result.push_back(value);
std::sort(result.begin(), result.end());
return result;
}
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 02/12/2012 04:21 PM, Warp wrote:
> In C++ I would probably write it like:
>
> std::vector<int> foobar(const std::string& s)
> {
> std::istringstream is(s);
> std::vector<int> result;
> int value;
> while(is>> value) result.push_back(value);
> std::sort(result.begin(), result.end());
> return result;
> }
...and in much less than 25 minutes. Clearly you're better than any of
the people we've interviewed. (But we knew that.)
It's also conspicuous that, unlike any of the people we interviewed,
you're currently employed. :-P
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 02/12/2012 04:11 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] devnull> wrote:
>> 1) You can figure out how to split a string and parse it into integers.
>
> In this particular case I wouldn't split it at all, but parse the ints
> directly from the string (which is quite easy to do since they are
> whitespace-separated.)
Two months of Bash scripting. That means we do this kind of thing all
the time. It makes me twitch slightly when I think about it too much.
>> 2) You can sort the result.
>
> I can't imagine a programming language that doesn't offer sorting directly.
> Even standard C offers such a function, and that's saying quite a lot.
Like I say, one guy did start trying to write a bubble-sort by hand. (Of
course, nobody else I work with sees anything wrong with that.) It does
amuse me that somebody could know what a bubble-sort is, but /not/ know
how to split a string, parse some integers and sort the result...
Of course, any sane person would use the built-in sorting facilities.
Off the top of my head, the only languages I can think of that lack such
a thing are PostScript, Tcl and BASIC. And who the hell would be using
any of those? (OK, PostScript is used quite a lot - but *not* as a
general-purpose programming language!)
>> At this point, we're not even asking for correct class or method names.
>> Just something that looks like vaguely valid C# syntax and has logic
>> which isn't obviously gibberish.
>
> I don't know enough C# to make it even look like it were. Unless C#
> resembles a lot C++ (which it probably does.) :)
Well, yeah, like Java it bears a strong superficial resemblance.
It's weird... I'm in a room full of programmers, and I seem to be the
only person who knows anything at all about computer science. One day my
boss says to me "I can't believe you don't know who J-Lo is". I replied
"I can't believe you don't know the difference between a binary search
tree and a binary heap tree". Every single human in the room stopped
what they were doing, turned around and stared at me as if I'd just gone
stark, raving mad. "What the *hell* are you talking about?" was my boss'
reply.
Sometimes I weep.
Then again, in all honesty, how often do you need to implement a BST by
yourself? Not very often...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Sun, 02 Dec 2012 12:30:30 +0000, Orchid Win7 v1 wrote:
> It may be too early to say, but the WTF quotient of my new employer
> appears to be significantly lower than my previous one. I mean, there's
> still some minor brokenness there. But it's not like the last bunch of
> losers I worked for, where the company was run by deranged howler
> monkeys.
It's good that you are seeing that what many of us told you for so long
is in fact true - not all employers are as odd as the one you just
left. :)
> I have also learned that there's a thing called "Spotify", who's purpose
> appears to be to allow my boss to quickly locate terrible music with
> which to troll us all with. (Or just to replay Gangnam Style for the
> twenty-ninth time today...) Supposedly this is somehow legal. Also, I
> now know the words to The Troll Song.
Spotify is great, subscribed recently myself - very large catalog of
music, not all of it is as annoying as Gangnam Style or "other terrible
music."
And yes, it is legal - you pay a monthly fee and get access to what's in
their catalog. Think Netflix or Lovefilm for music.
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> It may be too early to say, but the WTF quotient of my new employer
>> appears to be significantly lower than my previous one. I mean, there's
>> still some minor brokenness there. But it's not like the last bunch of
>> losers I worked for, where the company was run by deranged howler
>> monkeys.
>
> It's good that you are seeing that what many of us told you for so long
> is in fact true - not all employers are as odd as the one you just
> left. :)
Or rather, I had assumed that I was working for *the only* broken
company. But now it appears that each company is broken, it's just a
question of how seriously or trivially.
> Spotify is great, subscribed recently myself - very large catalog of
> music, not all of it is as annoying as Gangnam Style or "other terrible
> music."
I think my boss just likes trolling people, BTH. ;-)
> And yes, it is legal - you pay a monthly fee and get access to what's in
> their catalog.
But not Pink Floyd or The Beatles, apparently... And yet, at the same
time, unknown bands like The Senti-Mentals are there. Very odd.
> Think Netflix or Lovefilm for music.
Ah yes - two other services that I don't yet understand...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|