|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
Canada16217 Posts
On March 05 2016 21:41 Manit0u wrote:Show nested quote +On March 05 2016 16:14 NovemberstOrm wrote: I'm creating an application in VB.net, I need to have a next record/prev record button, I'm using hashtables atm, any ideas? Can't you just call next() and previous() on a collection? Show nested quote +On March 05 2016 20:54 tofucake wrote:.align-go { transform: translateY(75%); -webkit-transform: translateY(75%); } ^ was written in Windows and works. Anything else I type in Arch goes to null. sendfile off worked though, thanks Really strange... In the meantime, I've found another cool article/FAQ on Nginx: https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
Thanks I figured it out!
|
So, I've just got out of a job interview. The test was harder than I thought, since it was a lot about the fundamentals and if you've been working with OOP and high level abstractions for the past 2 years you tend to forget some of the basics. Still, was nice to take it. Here's the PHP part for anyone interested (all of the questions were about the output):
1.
$t = ['one', 'two', 'three'];
echo $t[1][2];
2.
$a = 4; $b = &$a; $c = 5; $a = $c;
echo $b;
3.
function abc() { return func_get_arg(1); }
echo abc('a', 'b', 'c');
4.
function f() { }
var_dump(f());
5.
$a = 0; $b = [];
while (++$a <= 6) $b[] = $a++;
echo implode($a, $b);
+ Show Spoiler + The firs one is really evil. I completely forgot about this PHP quirk, where even if you supposedly try to call a multi-dimensinal array index, if element at next-to-last index is a string, it'll treat this string as a char array...
|
On March 08 2016 21:45 Manit0u wrote:So, I've just got out of a job interview. The test was harder than I thought, since it was a lot about the fundamentals and if you've been working with OOP and high level abstractions for the past 2 years you tend to forget some of the basics. Still, was nice to take it. Here's the PHP part for anyone interested (all of the questions were about the output): + Show Spoiler +1. $t = ['one', 'two', 'three'];
echo $t[1][2];
2. $a = 4; $b = &$a; $c = 5; $a = $c;
echo $b;
3. function abc() { return func_get_arg(1); }
echo abc('a', 'b', 'c');
4. function f() { }
var_dump(f());
5. $a = 0; $b = [];
while (++$a <= 6) $b[] = $a++;
echo implode($a, $b);
+ Show Spoiler + The firs one is really evil. I completely forgot about this PHP quirk, where even if you supposedly try to call a multi-dimensinal array index, if element at next-to-last index is a string, it'll treat this string as a char array...
I probably would have walked out. Those are terrible questions with no real world application. Well, #5 is sort of relevant since such algorithms can easily lead to bugs, but writing code like that is a sin anyways and if I ever see something like that in production, I will strangle the person responsible myself. I hate interview tests that ask for useless trivia instead of actually testing ability.
|
Hyrule18969 Posts
Yeah these are dumb questions :\
|
On March 08 2016 21:57 Morfildur wrote:Show nested quote +On March 08 2016 21:45 Manit0u wrote:So, I've just got out of a job interview. The test was harder than I thought, since it was a lot about the fundamentals and if you've been working with OOP and high level abstractions for the past 2 years you tend to forget some of the basics. Still, was nice to take it. Here's the PHP part for anyone interested (all of the questions were about the output): + Show Spoiler +1. $t = ['one', 'two', 'three'];
echo $t[1][2];
2. $a = 4; $b = &$a; $c = 5; $a = $c;
echo $b;
3. function abc() { return func_get_arg(1); }
echo abc('a', 'b', 'c');
4. function f() { }
var_dump(f());
5. $a = 0; $b = [];
while (++$a <= 6) $b[] = $a++;
echo implode($a, $b);
+ Show Spoiler + The firs one is really evil. I completely forgot about this PHP quirk, where even if you supposedly try to call a multi-dimensinal array index, if element at next-to-last index is a string, it'll treat this string as a char array...
I probably would have walked out. Those are terrible questions with no real world application. Well, #5 is sort of relevant since such algorithms can easily lead to bugs, but writing code like that is a sin anyways and if I ever see something like that in production, I will strangle the person responsible myself. I hate interview tests that ask for useless trivia instead of actually testing ability.
I thought more of it as "do you know the basics" like how pointers work, what's the default return value of a function, what's the difference between pre- and post- increment etc.
Still, was expecting something completely different since in their offer they stated that 2+ years of experience is a requirement. Came in expecting questions about hydration strategies, event listeners, RESTful service implementations and such. Instead I got this, had to construct a db query with some joins and iterate over DOM elements with jQuery. All very basic stuff.
|
What's roughly your skillset Manit0u ? I'm seeing a lot of job offers (small missions mostly) going by these days, usually web apps, so if you're into that..
|
On March 09 2016 00:45 Cynry wrote: What's roughly your skillset Manit0u ? I'm seeing a lot of job offers (small missions mostly) going by these days, usually web apps, so if you're into that..
I'm primarily a PHP developer. Used to do a bit of front-end work but for the past 1+ years I've been doing mostly back-end stuff (so it would be advanced PHP and intermediate JavaScript for the most part for me, I also know my way around CSS and HTML but have been a bit out of touch with those lately). If you need help with some smaller projects I believe I could help out, especially that I have a lot more leeway now that I've started my own one-man company and am mostly employed on a b2b basis 
I did take part in a multitude of projects. From simple webpage portfolios, Magento- and Sylius-based e-commerce to various ERP solutions (this past year I've been dealing almost exclusively in DMS, QMS, SaaS and the like).
|
So let's see if I can word my question properly, but when I'm sending data to something like a jsp page from a servlet should I be flattening out that data? For example, I have an object in java that I want to send over but rather than having the jsp page fetch its details through getters should I instead lay it out in a simplified json/xml format?
|
Aren't jsp pages parsed by jvm anyway? It doesn't matter what form your data takes there. It's just a matter of displaying it to the user. You should use json and xml as return data from your services to external resources (unless you somehow need them in that format in your view).
|
The firs one is really evil. I completely forgot about this PHP quirk, where even if you supposedly try to call a multi-dimensinal array index, if element at next-to-last index is a string, it'll treat this string as a char array...
I don't use PHP but that seems like something the compiler should warn you about, shitty interview question though, why should you need to know all of PHP's weird quirks? That could be a career unto itself
|
On March 11 2016 17:24 Chocolate wrote:Show nested quote +The firs one is really evil. I completely forgot about this PHP quirk, where even if you supposedly try to call a multi-dimensinal array index, if element at next-to-last index is a string, it'll treat this string as a char array... I don't use PHP but that seems like something the compiler should warn you about, shitty interview question though, why should you need to know all of PHP's weird quirks? That could be a career unto itself
Usually such interview questions are the result of "clever" programmers that created a code base based on such quirks, and now they look for someone who understands their "clever" code.
Either way, PHP doesn't warn you about a lot of things, especially if you don't enable all the warning and strict flags, so it's easy for messy code to end up working by random chance. JavaScript might have a reputation as a terrible language - in my opinion unfounded -, but I much rather develop Node.js applications than PHP. PHP has too many quirks that just annoy me all the time.
|
I don't think "strings are character arrays" qualifies as a quirk.
|
Hyrule18969 Posts
On March 11 2016 18:16 Morfildur wrote:Show nested quote +On March 11 2016 17:24 Chocolate wrote:The firs one is really evil. I completely forgot about this PHP quirk, where even if you supposedly try to call a multi-dimensinal array index, if element at next-to-last index is a string, it'll treat this string as a char array... I don't use PHP but that seems like something the compiler should warn you about, shitty interview question though, why should you need to know all of PHP's weird quirks? That could be a career unto itself Usually such interview questions are the result of "clever" programmers that created a code base based on such quirks, and now they look for someone who understands their "clever" code. Either way, PHP doesn't warn you about a lot of things, especially if you don't enable all the warning and strict flags, so it's easy for messy code to end up working by random chance. JavaScript might have a reputation as a terrible language - in my opinion unfounded -, but I much rather develop Node.js applications than PHP. PHP has too many quirks that just annoy me all the time. most of the quirks have been worked out of the language as of 7, and plenty of the remaining ones are going to be removed soon anyway.
|
On March 11 2016 22:18 iaretehnoob wrote: I don't think "strings are character arrays" qualifies as a quirk.
Well, it's all because most of the basic PHP functionality depends on the underlying C stuff (in which strings are character arrays). It's also why some of the functions behave differently on different platforms (and some of them simply don't work at all on Windows for example).
Usually, when you see something like that:
$arr = ['one', 'two', 'three'];
echo $arr[1][2];
You'd expect it to throw an undefined index, while in fact it'll return 'o'.
It's dumb, but it's there and some people even use those quirks to save a couple of lines of code here and there. It's really bad practice in my opinion and borders on code obfuscation.
As for me, I'm always trying to use Python's philosophy of explicit > implicit (including trying to avoid pre- and post- incrementation). Even if I often have to write more code because of that I'm usually glad I did when I come back to it after a couple of months.
On March 11 2016 22:44 tofucake wrote: most of the quirks have been worked out of the language as of 7, and plenty of the remaining ones are going to be removed soon anyway.
I think there'll still be plenty of wrong with PHP until Zend won't change their philosophy of "PHP is not for programmers" and finally decide to: 1. unify function names (2 vs to etc.) 2. reduce the number of built-in functions (there's too much, and plenty of useless stuff. I mean, just check this out) 3. enforce writing secure and stable apps (removing eval, getting rid of php config files etc.) 4. unify function argument sequence (they swap it around for seemingly very similar functions, I can never remember all the search function's needle and haystack arguments order).
|
Hyrule18969 Posts
There's a bunch of RFCs now about unifying function arguments. One I'm especially happy about is to allow negative offsets in all the string functions.
|
On March 11 2016 23:28 Manit0u wrote:Show nested quote +On March 11 2016 22:18 iaretehnoob wrote: I don't think "strings are character arrays" qualifies as a quirk. Usually, when you see something like that: $arr = ['one', 'two', 'three'];
echo $arr[1][2];
You'd expect it to throw an undefined index, while in fact it'll return 'o'.
I think what he's saying is that he *wouldn't* expect that to throw an undefined index, but instead to return the 3rd character of the 2nd string, which is what it does... I agree that treating strings as char arrays isn't weird at all, at least to me. (Not really trying to defend PHP here - just a comment )
|
On March 12 2016 01:13 Cyx. wrote:Show nested quote +On March 11 2016 23:28 Manit0u wrote:On March 11 2016 22:18 iaretehnoob wrote: I don't think "strings are character arrays" qualifies as a quirk. Usually, when you see something like that: $arr = ['one', 'two', 'three'];
echo $arr[1][2];
You'd expect it to throw an undefined index, while in fact it'll return 'o'. I think what he's saying is that he *wouldn't* expect that to throw an undefined index, but instead to return the 3rd character of the 2nd string, which is what it does...  I agree that treating strings as char arrays isn't weird at all, at least to me. (Not really trying to defend PHP here - just a comment  )
I'm not saying treating strings as char arrays is bad, but the fact that people do such things as in the example is preposterous in my eyes since it can lead to a metric ton of hard to find bugs.
|
On March 12 2016 02:50 Manit0u wrote:Show nested quote +On March 12 2016 01:13 Cyx. wrote:On March 11 2016 23:28 Manit0u wrote:On March 11 2016 22:18 iaretehnoob wrote: I don't think "strings are character arrays" qualifies as a quirk. Usually, when you see something like that: $arr = ['one', 'two', 'three'];
echo $arr[1][2];
You'd expect it to throw an undefined index, while in fact it'll return 'o'. I think what he's saying is that he *wouldn't* expect that to throw an undefined index, but instead to return the 3rd character of the 2nd string, which is what it does...  I agree that treating strings as char arrays isn't weird at all, at least to me. (Not really trying to defend PHP here - just a comment  ) I'm not saying treating strings as char arrays is bad, but the fact that people do such things as in the example is preposterous in my eyes since it can lead to a metric ton of hard to find bugs.
Treating strings as string arrays is fun:
<? $x = "abcd"; echo $x[0][0][0][0][0][0][0][0][0][0][0]; // a
|
On March 12 2016 03:04 Morfildur wrote:Show nested quote +On March 12 2016 02:50 Manit0u wrote:On March 12 2016 01:13 Cyx. wrote:On March 11 2016 23:28 Manit0u wrote:On March 11 2016 22:18 iaretehnoob wrote: I don't think "strings are character arrays" qualifies as a quirk. Usually, when you see something like that: $arr = ['one', 'two', 'three'];
echo $arr[1][2];
You'd expect it to throw an undefined index, while in fact it'll return 'o'. I think what he's saying is that he *wouldn't* expect that to throw an undefined index, but instead to return the 3rd character of the 2nd string, which is what it does...  I agree that treating strings as char arrays isn't weird at all, at least to me. (Not really trying to defend PHP here - just a comment  ) I'm not saying treating strings as char arrays is bad, but the fact that people do such things as in the example is preposterous in my eyes since it can lead to a metric ton of hard to find bugs. Treating strings as string arrays is fun: <? $x = "abcd"; echo $x[0][0][0][0][0][0][0][0][0][0][0]; // a
What?! I don't even...
|
Has anybody had any success here writing an SC:BW AI which doesn't just execute a few hard coded strategies? I've finished my courses in AI and machine learning and I'm thinking about writing a BW AI to compete in the CIG AI competition this year. I found a few papers where researchers tried to implement more sophisticated methods but those bots didn't fare too well against the other competitive bots.
|
|
|
|