Page 25 of 26 FirstFirst ... 1523242526 LastLast
Results 241 to 250 of 254

Thread: Programmer's Den

  1. #241
    know nothing pensive_pilgrim's Avatar
    Type
    INTP
    Join Date
    Dec 2013
    Posts
    4,722
    Quote Originally Posted by scarydoor View Post
    You just follow the pattern, and don't think too much about it.
    This is how my javascript class was taught. Node was used and then each assignment specified modules and things and we just used that stuff, plugged in code from the slides and built to the example. It was a joke really, easiest A in an upper division course I've ever gotten. The last assignment took the opposite approach and was basically "make a website with javascript. It needs to serve something from a database and be good". It was a pair assignment, I and the guy I worked with weren't able to get our website working because of some issue with mongodb, so we just found a module that would do everything we needed, obfuscated the code and wrote some CSS and didn't say anything. The professor said he was really impressed with our project and gave us an A.

  2. #242
    Senior Member
    Type
    intp
    Join Date
    Dec 2013
    Posts
    1,519
    Quote Originally Posted by pensive_pilgrim View Post
    This is how my javascript class was taught.
    Oh to teach all of javascript like that is terrible. It's just this one thing, I personally find to be really annoying. Actually I probably should just learn that thing properly. The rest of javascript though, I think it's actually a really cool language. Lots of weird stuff in there that the developer should familiarise themselves with.

  3. #243
    Now we know... Asteroids Champion ACow's Avatar
    Type
    INTP
    Join Date
    Dec 2013
    Location
    Melbourne, Australia
    Posts
    2,637


    On the one hand, it has a practical point. To get anything done practically, you've got to be able to find that stage where you stop wondering about investigating the interesting things and start doing.

    One the other hand, the lack of understanding or reasoning that often happens in modern software development and programming horrifies me. But maybe that's why i'm not a developer. And its always the people who did the opposite of "just don't worry about it" that push the field forward in any way...

  4. #244
    Senior Member
    Type
    intp
    Join Date
    Dec 2013
    Posts
    1,519
    Quote Originally Posted by ACow View Post
    On the one hand, it has a practical point. To get anything done practically, you've got to be able to find that stage where you stop wondering about investigating the interesting things and start doing.

    One the other hand, the lack of understanding or reasoning that often happens in modern software development and programming horrifies me. But maybe that's why i'm not a developer. And its always the people who did the opposite of "just don't worry about it" that push the field forward in any way...
    Oh I think that's a slight misconception. It's that you don't necessarily understand how it does it. You still should understand what it does, and the important abstracted implications of that. It's the nature of it that it is layers of abstracting away the detail of how things are done. It's also why there should be good senior developers around. Less experienced developers should be expected to make some bad decisions, because it's just not possible that they can learn enough of everything to get it right. If you have good senior developers, then I think it's alright if you just follow some patterns sometimes.

    I guess I see what you mean though. I mean, I think people often understand stuff, but probably, often, people are so busy that code reviews are not always that thorough. And... it seems that 'automated testing' is hyped as the saviour, but... I'm not sure how much of that actually happens...

    -----

    Today, used a nice technique that maybe I should have gotten into earlier. Some codebase we use is a massive pain in the arse. I can't set it up locally without lots of issues. Some js causing issues. I'm guessing at my fix, because I can't test locally. It's an abysmal state of affairs.

    You can use the program telerik fiddler, (essentially it sets a proxy on your machine for traffic to go through, so it can tell you about all the requests and responses going out) you find the request the site makes to grab its js, and tell it, in response, to return a local file. So, you modify that file, as you think the fix should be, and then can actually test it. omg. Life saver.

    fyi, my problem was me not thinking enough about the two stage process of javascript execution. Specifically, how the declaration (1) 'var f = function() { }' is different to (2) 'function f() { }'. I kind of like this about javascript, how you can reason about it like that. So, just fyi, the (1) expression, on first sweep through, just assigns memory to variables: 'var f = undefined'. On second sweep it'll execute. 'store into f the instructions for this function'. So if you try to call it before then, it's undefined. Whereas in (2), I think it'll just store that variable first time. I think. I'm a bit rusty on that...

  5. #245
    Senior Member
    Type
    intp
    Join Date
    Dec 2013
    Posts
    1,519

  6. #246
    Meae Musae Servus Hephaestus's Avatar
    Type
    INTP
    Join Date
    Dec 2013
    Location
    Ceti Alpha V
    Posts
    13,774
    I've put together a hacky little script/local page for my dad to allow him to open a window the size he likes for viewing movies, but I don't like what I worked out to do it. It's sort of kludgey, and the end result is missing functionality I was expecting and I'm not sure why.

    First, the problem:

    My father bought a larger monitor, but ultimately found it's too large for him to comfortably view movies at the distance he's at while sitting at his computer. It's an accessibility thing regarding eye and head movement and various vestibilar and vertebral issues.

    As a consequence he makes a window the size he wants, and positions it at the bottom center of his screen, just above the taskbar, but he isn't always watching movies, so that isn't always the window he wants to have, which means that pretty much every time he sits down to watch a show, he has to go through this process to get a comfortable viewing window.

    Obviously, this is a good target for automation, right?

    I thought I'd throw my JS wrench at the problem, but discovered that the major browsers protect their window size post creation. I get why--the internet has enough bullshit without webpages resizing all our shit when we navigate to them. It is a nuisance though.

    My solution was to make a new window of the desired size and in the desired location, and then close the window I was using to do that.

    For Chrome it works great, but Firefox blocks window.close(). Oh well.

    Here's the part that is the problem: the resulting window won't permit you to put a new address in the location bar. I made it open to netflix, and confirmed click navigation works, but I'd like to know why I'm getting browser windows with locked location fields.

    My fix for that issue was to make a text input box to input a URL, and then pass that input to my window.open(), which works, but I'd really like the opened window to be a fully functional browser window.
    Some days you're the bug; some days you're the feature.

    --Meditations on Uncertainty Vol ξ(x)

  7. #247
    Senior Member
    Type
    intp
    Join Date
    Dec 2013
    Posts
    1,519
    Quote Originally Posted by Hephaestus View Post
    ...
    Can you post the code? I'll fix it in a jiffy.

  8. #248
    Meae Musae Servus Hephaestus's Avatar
    Type
    INTP
    Join Date
    Dec 2013
    Location
    Ceti Alpha V
    Posts
    13,774
    Quote Originally Posted by scarydoor View Post
    Can you post the code? I'll fix it in a jiffy.
    It's crude, but functional.

    Code:
    <!DOCTYPE html>
    <html>
    <body>
    <div align="center">
    <input name="addy" placeholder="https://www.netflix.com/browse"/>
    
    <button onclick="openWin()">Create window</button>
    </div>
    
    <script>
    var myWindow;
    
    let form = document.getElementsByName('addy');
    let addy = form[0].placeholder;
    
    function openWin() {
      myWindow = window.open(addy, "", "width=1700, height=800, left=100, top=170");
      window.close();
    }
    </script>
    
    </body>
    </html>
    Some days you're the bug; some days you're the feature.

    --Meditations on Uncertainty Vol ξ(x)

  9. #249
    Senior Member
    Type
    intp
    Join Date
    Dec 2013
    Posts
    1,519
    Looks like it's specific to the Chrome browser. If you open that up in Internet Explorer it'll do it no worries (but that's not an acceptable solution). Oh also Firefox won't let you.

    The reason is a kind of security justification. They want to restrict what scripts can do when opening links. So it's opened in "locked down mode", as described by this fellow (read the responses):

    https://stackoverflow.com/questions/...-chrome-window

    I believe this feature will be insurmountable. They will have thought about it.

    Furthermore, it seems that chrome will not let you resize a window unless it's opened as a popup. So you're stuck between two places .

    Also, you cannot embed netflix into an iframe, as they've disabled that (makes sense).

    Your solution may be about as good as it gets. Maybe you could find a chrome extension that can add some functionality.

    How about this one: https://chrome.google.com/webstore/d...cgefonfh?hl=en

    After you add it to chrome, go to the options and delete all the presets. Add the size you want. You can also set screen position. Then, the shortcut is "alt + shift + down". Boom, your screen size is now optimal. "windows key + up" makes the screen full size again (or just press the button). Precede with ctrl+n.
    Last edited by scarydoor; 02-11-2019 at 09:16 AM.

  10. #250
    Meae Musae Servus Hephaestus's Avatar
    Type
    INTP
    Join Date
    Dec 2013
    Location
    Ceti Alpha V
    Posts
    13,774
    @scarydoor, not surprising. The whole reason I was at that solution was from browser created limitations in the first place. On the plus side, I did find a working solution, it's just not as elegant as I would like.

    It also looks like Firefox doesn't have command line options to specify window size, which rules out .bat files--though I'm hoping to find something that works with bash. It's just absurd not to be able to trigger the window to open to the size you want given that remembering the previous size and location is part of the feature set. There has to be a file somewhere with that information, and if I can find it I can probably alter it with a command-line script.

    That will be solution 2.0.

    Thank you very much for confirming I wasn't overlooking something obvious.
    Some days you're the bug; some days you're the feature.

    --Meditations on Uncertainty Vol ξ(x)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •