Impossible recruitment problem



  • So I'm taking tests for a recruitment agency and they want me to write code that reads and writes to a files one folder from the C: drive, using JavaScript. I have told them that it is not possible due to the nature and security of web browsers, but they have told me to try it anyway. Any method that might have allowed this in the past no longer works due to security updates in browsers and specs. I need to put something in this test questions, and they won't let me use another language, any suggestions?



  • @zeblian said:

    So I'm taking tests for a recruitment agency and they want me to write code that reads and writes to a files one folder from the C: drive, using JavaScript. I have told them that it is not possible due to the nature and security of web browsers, but they have told me to try it anyway. Any method that might have allowed this in the past no longer works due to security updates in browsers and specs. I need to put something in this test questions, and they won't let me use another language, any suggestions?

    Simple - use node.js or some other non-sandboxed JavaScript implementation.



  •  var fileContents = prompt("Please open c:\TheGoddamnFileIWant.txt and paste the contents into the textbox below");

    document.write(fileContents);



  • Maybe you're approaching this wrong? It is possible to read/write files with JavaScript.

     

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wsh_runfromwindowsbasedhost.mspx?mfr=true

    http://msdn.microsoft.com/en-us/library/ie/7sw4ddf8%28v=vs.94%29.aspx

     http://www.winscripter.com/WSH/FileIO/74.aspx

     

     These ActiveX objects work whether you're using vbs or js.



  • @Lorne Kates said:

     var fileContents = prompt("Please open c:\TheGoddamnFileIWant.txt and paste the contents into the textbox below");

    document.write(fileContents);

    document.write('<input type="file">')



  • @movzx said:

    Maybe you're approaching this wrong? It is possible to read/write files with JavaScript.

     

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wsh_runfromwindowsbasedhost.mspx?mfr=true

    http://msdn.microsoft.com/en-us/library/ie/7sw4ddf8%28v=vs.94%29.aspx

     http://www.winscripter.com/WSH/FileIO/74.aspx

     

     These ActiveX objects work whether you're using vbs or js.

    That's JScript, not JavaScript.



  •  I ended up sending node.js javascript in after doing some tutorials on the system. I hope it's what they wanted, since they didn't bother to specify anything more than the language and what task they wanted it to do.



  • @Ben L. said:

    @movzx said:

    Maybe you're approaching this wrong? It is possible to read/write files with JavaScript.

     

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wsh_runfromwindowsbasedhost.mspx?mfr=true

    http://msdn.microsoft.com/en-us/library/ie/7sw4ddf8%28v=vs.94%29.aspx

     http://www.winscripter.com/WSH/FileIO/74.aspx

     

     These ActiveX objects work whether you're using vbs or js.

    That's JScript, not JavaScript.

    Sigh. JScript is JavaScript.



  • @zeblian said:

     I ended up sending node.js javascript in after doing some tutorials on the system. I hope it's what they wanted, since they didn't bother to specify anything more than the language and what task they wanted it to do.

    Think of it this way: if it's not what they want, then they are crazy and inept, and you wouldn't want to work there.



  • This thread is now the unicode monkey appreciation thread.

    🙈🙉🙊



  • TODO: Remember this post when brainstorming on the next OMGWTF programming contest.



  • @Mark Bowytz said:

    TODO: Remember this post when brainstorming on the next OMGWTF programming contest.

    Can the next one be a forum? Or a desktop search engine? Basically, something that takes more than one line of INSERT_LANGUAGE. Ooh, I know! A desktop forum engine! Complete with markov-based morbiuswiltersbot!



  • @Mark Bowytz said:

    TODO: Remember this post when brainstorming on the next OMGWTF programming contest.
    Also bring back MFD.



  •  I would suggest something along this line:

    if browser.version != "IE3.0" then
    alert("You need IE 3.0 for this application")
    else {
    f=file.open("C:\windows....
    }

    This pattern is seen even on some web interface of banks today (well, not sure with requiered version, but some webs "need" IE) so it must be legitimate answer to their problem :D

     



  • @Ben L. said:

    This thread is now the unicode monkey appreciation thread.

    🙈🙉🙊

    I want whatever font you're using. All the fonts I used to go to for obscure Unicode characters are too old to cover much outside the BMP.



  • Oh come on.



  • @Ben L. said:

    This thread is now the unicode monkey appreciation thread.

    🙈🙉🙊

     

    http://www.unicode.org/~scherer/emoji4unicode/snapshot/emojidata.html#e-354 for those wondering what he's on about

     



  • @zeblian said:

    So I'm taking tests for a recruitment agency and they want me to write code that reads and writes to a files one folder from the C: drive, using JavaScript. I have told them that it is not possible due to the nature and security of web browsers,

    You're applying for an IT job and have never heard of JScript? ... sigh.



  • Maybe the recruiters are actually geniuses and the point of the test is to remove Miff-like assumptions about what languages are used for. So they can tell the potential employer, "hey this guy, when he hears 'JavaScript', doesn't automatically assume there's a web browser involved like those other idiots you're looking at!" Maybe.

    I'd also like to hear BenL's explanation as to why JScript "isn't JavaScript". I'm sure that's a howler.

    (Actually there is/was one difference between JScript and JavaScript: in JScript this extremely handy construct works: "var gebi = document.getElementById; gebi('test');" wheras in JavaScript it does not alas. Gebi has to be its own function, it can't just point to a native function.)



  •  I tried to run some JS in the WSH on Vista a while ago... but nothing happened.



  • @blakeyrat said:

    I'd also like to hear BenL's explanation as to why JScript "isn't JavaScript". I'm sure that's a howler.
     

    They're spelled differently.

    .

    .

    .

    I was going to say that as a joke, but [url="http://en.wikipedia.org/wiki/Jscript#Comparison_to_JavaScript"]it isn't.[/url].



  • @blakeyrat said:

    (Actually there is/was one difference between JScript and JavaScript: in JScript this extremely handy construct works: "var gebi = document.getElementById; gebi('test');" wheras in JavaScript it does not alas. Gebi has to be its own function, it can't just point to a native function.)
    Yeah, you need to bind the function to the document object:

    var gebi = document.getElementById.bind(document);

     

    More verbose, but it works.

    (I didn't post this to help you, obviously, because you didn't ask for it. It's just for other people who may be reading this.)



  • I remember seeing this problem "solved" in a piece of commercial software my company bought once. It was some kind of data analysis for logs produced by some data-collection hardware (think remote weather station.) It did involve sneakernet - files were transferred from the field to the office on SD card.

    I forget the exact reason for it but there was some step like "upload your data file" that worked great when the salesman demoed it but completely failed to work once the software was installed on our internal web server. We called the company and they got the developer on the line with the "works on my end" typical result.

    The problem was eventually found - the developer was running the web server on their local PC. Yes, really, when you picked a directory\file on the client side, the file.open() step was done server side. Off the SD card.

    Once we discovered this, we got the software off our systems as quickly as possible. There was no telling what other security problems had been built into it by the clueless developer.



  • @zeblian said:

    So I'm taking tests for a recruitment agency...any suggestions?

    Yeah. Don't waste your time with agencies. Most technical recruiters are assclowns of exceeding uselessness.



  • Use WScript with the CScript engine?  This is pure javascript without a browser and it runs using the security settings of the user running it ...

     

    cscript myscript.js

     

    If you have IE installed, you should have CScript installed and ready to go.  I forget which IE version started including CScript when installed, maybe 5.5 sp2 or something...and not positive it is still included..  On Windows 7, regular install w/o much extras (just IIS and the like for development), CScript is installed...open a command prompt and type cscript and then press Enter to see if it's installed :)

     



  • @blakeyrat said:

    Maybe the recruiters are actually geniuses and the point of the test is to remove Miff-like assumptions about what languages are used for. So they can tell the potential employer, "hey this guy, when he hears 'JavaScript', doesn't automatically assume there's a web browser involved like those other idiots you're looking at!" Maybe.

    I'd also like to hear BenL's explanation as to why JScript "isn't JavaScript". I'm sure that's a howler.

    (Actually there is/was one difference between JScript and JavaScript: in JScript this extremely handy construct works: "var gebi = document.getElementById; gebi('test');" wheras in JavaScript it does not alas. Gebi has to be its own function, it can't just point to a native function.)

     

    The main differences I distinctly remember used to be attaching events (but that is part of the browsers Windows object not JavaScript) but since jQuery does all that shit for you these day, you might as well use that.

     



  • @MiffTheFox said:

    @Ben L. said:
    This thread is now the unicode monkey appreciation thread.

    🙈🙉🙊

    I want whatever font you're using. All the fonts I used to go to for obscure Unicode characters are too old to cover much outside the BMP.

    Whatever font it is works for me on Solaris 11.1...

     



  • @drurowin said:

    @MiffTheFox said:

    @Ben L. said:
    This thread is now the unicode monkey appreciation thread.

    🙈🙉🙊

    I want whatever font you're using. All the fonts I used to go to for obscure Unicode characters are too old to cover much outside the BMP.

    Whatever font it is works for me on Solaris 11.1...

     

    I use Symbola.



  • @spacecadet said:

    @zeblian said:

    So I'm taking tests for a recruitment agency...any suggestions?

    Yeah. Don't waste your time with agencies. Most technical recruiters are assclowns of exceeding uselessness.

    Some suck, but there are really good ones, too.



  • @morbiuswilters said:

    @spacecadet said:
    @zeblian said:

    So I'm taking tests for a recruitment agency...any suggestions?

    Yeah. Don't waste your time with agencies. Most technical recruiters are assclowns of exceeding uselessness.

    Some suck, but there are really good ones, too.

    True. But my experiences with them have ranged from benignly unhelpful (apart from time wasted) to the downright psychotic.

    Your mileage may have varied.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.