As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

[Programming] Thread: Fixed last bug in 5 month thread

1454648505199

Posts

  • Options
    SporkAndrewSporkAndrew Registered User, ClubPA regular
    Starfuck wrote: »
    So yeah, I'm in a new job where I get to work with tons of smart people and bounce ideas around. My old job was only me and one other guy really.

    I went through the same thing last year. Went from working either alone or with one other person to being on a team of ten in a company with thirty developers.

    It took a while to get used to the idea of bouncing an idea off someone else instead of just hitting Google, but my code output had improved considerably

    The one about the fucking space hairdresser and the cowboy. He's got a tinfoil pal and a pedal bin
  • Options
    PolaritiePolaritie Sleepy Registered User regular
    Starfuck wrote: »
    So yeah, I'm in a new job where I get to work with tons of smart people and bounce ideas around. My old job was only me and one other guy really.

    I went through the same thing last year. Went from working either alone or with one other person to being on a team of ten in a company with thirty developers.

    It took a while to get used to the idea of bouncing an idea off someone else instead of just hitting Google, but my code output had improved considerably

    Google is for "How do I...?", coworkers for "Should I...?"

    Steam: Polaritie
    3DS: 0473-8507-2652
    Switch: SW-5185-4991-5118
    PSN: AbEntropy
  • Options
    LuvTheMonkeyLuvTheMonkey High Sierra Serenade Registered User regular
    So I decided to mess around with Angular this weekend - pretty cool framework! Easy to get validation etc off the ground. I have run into a bug in my little demo
    1. Click the load SO button
    2. Add 2 more groups of inputs with the plus button, and enter whatever you want in the text boxes but leave 1 on each line empty to show the validations
    3. Remove the middle group of inputs, observe the validations for last group disappear
    4. Add another group of inputs, observe the validations for the now middle group reappear, but linked to the new last group of inputs instead

    All of the dynamic name attributes seem to be changing properly. If I had to guess, it'd be due to my use of the array.splice() method to remove the deleted element, but I'm not sure.

    Molten variables hiss and roar. On my mind-forge, I hammer them into the greatsword Epistemology. Many are my foes this night.
    STEAM | GW2: Thalys
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    Hahaha

    Tadpole operators
    Unary operators hoooooooo!

    Penny Arcade Developers at PADev.net.
  • Options
    InfidelInfidel Heretic Registered User regular
    Hahaha

    Tadpole operators
    Unary operators hoooooooo!

    Hah!
    Man, people not familiar with bit ops and 2s complement aren't going to get this.

    OrokosPA.png
  • Options
    SaerisSaeris Borb Enthusiast flapflapflapflapRegistered User regular
    Raymond Chen is my hero.

    borb_sig.png
  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited May 2015
    Infidel wrote: »
    Hahaha

    Tadpole operators
    Unary operators hoooooooo!

    Hah!
    Man, people not familiar with bit ops and 2s complement aren't going to get this.
    I'd not seen this used anywhere before so I had to go read about it a bit. That's a pretty nifty little trick!

    I think my favorite thing about Chen's TONT blog is that some of the neckbeards that it has attracted have noooooooooooo clue what a "joke" is or even what a clever little trick is. It is an entirely foreign concept to some of these folks. Meet David, everyone...
    David wrote:
    I rarely comment on these forums, but this just made me scream...well maybe not verbally, but in my head I am. This is atrocious. Readability is to be admired as well as convenience. I neither find this experimental syntax readable nor convenient nor obvious. Parenthesis do clarify intent, and it is readable, obvious, and not a burden on the compiler or developer. If you have to explain your new operators away in a manner that isn't obvious at first glance, it is likely a bad choice. If this is a c++ proposal, I would veto it. (x+1) and (x-1) aren't too hard to write. It only 'helps' in cases of x+1 or x-1. What about x+2 or x-3? Whoops, still need those parens again. This seems like a solution to a problem nobody thinks exists. Are there people out there actually asking for this syntax? really?
    RC wrote:
    [By the same logic, we are missing a ++ operator that increments by 2. At least this operator can be stacked: -~-~x is (x+2). -Raymond]

    And since David still didn't get it, he dove in for a second try...
    David wrote:
    [By the same logic, we are missing a ++ operator that increments by 2. At least this operator can be stacked: -~-~x is (x+2). -Raymond]

    While there isn't a ++ operator that pre-increments by 2, we do have += . Your stacked example is another reason for not supporting this. It doesn't look well and isn't obvious. I would have to count the tadpoles to understand what is being done. I'd hate to see the tadpole syntax behind (x+1000). Granted I am using an absurd and extreme example, it begs the question: Would there be an upper limit to how many times the operator could be stacked? I haven't yet tried on the VS2015RC yet.
    RC wrote:
    [While there isn't a -~ operator that adds 2, we do have (x+2). So I don't see why the "doesn't generalize beyond 1" argument is so special about -~ when it also applies to ++. -Raymond]

    :lol:

    Then there are the people who do understand what Chen did, and they try to go the trolololol route...
    We've had this in C# for ages.
    foreach (int number in Enumerable.Range(1,10))
    {
      Debug.WriteLine(string.Format("Value: {0}  Tadpole Value: {1}", number, -~number));
    }
    

    You c++ folks need to get with the times.

    heeheehee

    iTunesIsEvil on
  • Options
    TofystedethTofystedeth Registered User regular
    I liked this comment.
    This is crazy. Not only because when these tadpoles grow up, your code will literally start JMPing all over the place, but they will also eat all your source flies.

    steam_sig.png
  • Options
    MNC DoverMNC Dover Full-time Voice Actor Kirkland, WARegistered User regular
    11011809_10152758301206780_7523031263093452575_n.jpg?oh=a58a2e0a51fa3607e91a3d2882ab8671&oe=560D8CDE

    Need a voice actor? Hire me at bengrayVO.com
    Legends of Runeterra: MNCdover #moc
    Switch ID: MNC Dover SW-1154-3107-1051
    Steam ID
    Twitch Page
  • Options
    TofystedethTofystedeth Registered User regular
    That is a lot of handwritten code.

    steam_sig.png
  • Options
    bowenbowen How you doin'? Registered User regular
    "wrote by hand"

    Fairly positive it was assembly and a little bit of something else.

    Those were probably mathematical equations and proof of concepts for the AGC's creation more than anything.

    I doubt they'd hand write assembly. If it's anything, it's the printed assembly.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Well it would be "writing by hand" the same way non-generated code is hand-written

    The source is actually released though and looks only to be a few thousand pages long each - I think that's the printouts of all of the missions together

  • Options
    bowenbowen How you doin'? Registered User regular
    Phyphor wrote: »
    Well it would be "writing by hand" the same way non-generated code is hand-written

    The source is actually released though and looks only to be a few thousand pages long each - I think that's the printouts of all of the missions together

    haha someone wrote a virtual AGC for interpreting the apollo code. That's cool.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    a5ehrena5ehren AtlantaRegistered User regular
    edited May 2015
    Convincing someone that I trust "ntpdc -c loopinfo" (or "ntpq -p" for modern form) for the time offset value more than their perl script that "simultaneously" runs "date" on the two systems took way longer than it should have.

    a5ehren on
  • Options
    GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    I would have never had the conversation. I would have said "atomic clock" and then walked away. If someone can't understand why an atomic clock is better than their perl script, than having the conversation is pointless, and it's better to just do the right thing and let them complain later.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • Options
    a5ehrena5ehren AtlantaRegistered User regular
    edited May 2015
    They were trying to convince me that ntpd was broken, which would obviously be kind of a big deal since we use the reference implementation from ntp.org.

    Then they told me what they did to "prove" it and I basically said lolnope because ntpd was telling me the offset was 30 microseconds and sync was good and his script was saying 5-30ms.

    I had to start talking about Linux kernel scheduler timeslices to get them to go away. I even got to use "non-deterministic" properly!

    a5ehren on
  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    I'm putting together a little learning group for beginner web devs and rails. I'd like to put together a portable Linux dev environment for them, since they are largely Windows users with moderate power user knowledge.

    Does anyone have any recommendations? I'm thinking some combination of Vagrant, Git and Atom, but I'm not sure whether I should have them develop in Windows in the Vagrant folder or do things actually in Linux, which would require them to learn something else on top of web dev. Any other configurations or suggestions are welcome!

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    urahonkyurahonky Registered User regular
    Well if it's beginner I'd say just stick with Windows at first and if they like the group enough then you can slowly migrate them to Linux. I'm doing web development in Windows and it's not that bad. I'm not actually sure why people give me shit about it all the time actually.

  • Options
    Jimmy KingJimmy King Registered User regular
    Is anyone here familiar with Browserify, and possibly specifically using gulp-browserify? I have two bundles... a.js and b.js. I want to specify a.js as an external for b.js, but when I do that, b.js still cannot actually use anything from a.js unless I a.js sets globals on the window object. I am clearly doing something wrong.

  • Options
    SpawnbrokerSpawnbroker Registered User regular
    I dual OS installed Ubuntu on my home desktop, and now whenever it boots up I just choose the Windows 7 loader. If I want to mess around with Rails, I boot into Linux and have fun. You could do something similar for them. Ubuntu isn't that hard to use.

    Steam: Spawnbroker
  • Options
    MahnmutMahnmut Registered User regular
    templewulf wrote: »
    I'm putting together a little learning group for beginner web devs and rails. I'd like to put together a portable Linux dev environment for them, since they are largely Windows users with moderate power user knowledge.

    Does anyone have any recommendations? I'm thinking some combination of Vagrant, Git and Atom, but I'm not sure whether I should have them develop in Windows in the Vagrant folder or do things actually in Linux, which would require them to learn something else on top of web dev. Any other configurations or suggestions are welcome!

    I text-edit and such in Windows in the Vagrant folder and use the Vagrant box to run command-line tools. Seems natural, and it's often easier to get web-dev utilities configured right in Linux.

    Steam/LoL: Jericho89
  • Options
    TofystedethTofystedeth Registered User regular
    If anybody has a spare IBM 1401 mainframe lying around and 400,000 billion years you can repurpose it for bitcoin mining.
    http://arstechnica.com/business/2015/05/how-to-mine-bitcoin-on-a-55-year-old-ibm-1401-mainframe/

    steam_sig.png
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    urahonky wrote: »
    Well if it's beginner I'd say just stick with Windows at first and if they like the group enough then you can slowly migrate them to Linux. I'm doing web development in Windows and it's not that bad. I'm not actually sure why people give me shit about it all the time actually.

    But how are you supposed to use vim or emacs and get your programmer cred up on Windoze?!?!?!

  • Options
    bowenbowen How you doin'? Registered User regular
    Ugh, getting invalid padding size when trying to unecrypt data from php while in C#.

    Why do you have to be different mcrypt?

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    bowenbowen How you doin'? Registered User regular
    If anybody has a spare IBM 1401 mainframe lying around and 400,000 billion years you can repurpose it for bitcoin mining.
    http://arstechnica.com/business/2015/05/how-to-mine-bitcoin-on-a-55-year-old-ibm-1401-mainframe/

    Real title:
    "How to mine bitcoins, but not actually mine bitcoins, I'm actually trying to implement SHA on a decimal based architecture."

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    The AnonymousThe Anonymous Uh, uh, uhhhhhh... Uh, uh.Registered User regular
    Phyphor wrote: »
    urahonky wrote: »
    Well if it's beginner I'd say just stick with Windows at first and if they like the group enough then you can slowly migrate them to Linux. I'm doing web development in Windows and it's not that bad. I'm not actually sure why people give me shit about it all the time actually.

    But how are you supposed to use vim or emacs and get your programmer cred up on Windoze?!?!?!
    Serious answer: MSYS2

  • Options
    urahonkyurahonky Registered User regular
    Jimmy King wrote: »
    Is anyone here familiar with Browserify, and possibly specifically using gulp-browserify? I have two bundles... a.js and b.js. I want to specify a.js as an external for b.js, but when I do that, b.js still cannot actually use anything from a.js unless I a.js sets globals on the window object. I am clearly doing something wrong.

    I don't know much but this is what I have in my gulpfile.js file:
    gulp.task('browserify', function() {
    	return browserify('./app/app.js')
    		.transform(babelify, { stage: 0 })
    		.bundle()
    		.pipe(plumber(plumberErrorHandler))
    		.pipe(envify())
    		.pipe(source('bundle.js'))
    		.pipe(buffer())
    		//.pipe(uglify())
    		.pipe(gulp.dest('./public/js'))
    });
    

  • Options
    IzzimachIzzimach Fighter/Mage/Chef Registered User regular
    Jimmy King wrote: »
    Is anyone here familiar with Browserify, and possibly specifically using gulp-browserify? I have two bundles... a.js and b.js. I want to specify a.js as an external for b.js, but when I do that, b.js still cannot actually use anything from a.js unless I a.js sets globals on the window object. I am clearly doing something wrong.

    I think nowadays you're supposed to just use browserify directly in gulp, like:
    var browserify = require('browserify');
    
    ... in your gulp task ...
    
    var bundler = browserify();
    bundler.require('this');
    bundler.add('that');
    return bundler.bundle().pipe(gulp.dest('blah'))
    

    As far as multiple bundles, I guess you're doing this?
    1. in the first bundle you .require('a') so that it can referenced externally
    2. in the second bundle you .require('b') and .external('a') so that it looks for 'a' externally

    I only use browserify via javascript so I can't comment on command-line or config file setup sorry.

  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
  • Options
    bowenbowen How you doin'? Registered User regular
    Okay am I crazy... I'm using two different services and coming up with 2 different hash values for a file.

    http://i-tools.org/hash/exec <- this one matches .NET's sha1/sha256 for file hashing
    http://onlinemd5.com/ <- this one matches what the instructor for certification is getting.

    What the fuck is going on.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    KambingKambing Registered User regular
    edited May 2015
    Hrm? Spot checking a small text file, I get the same hashes for both MD5 and SHA-1.

    Might be a subtle bug in the implementation of one of the tools if you have a file that is spitting out different hashes for each.

    Kambing on
    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
  • Options
    Jimmy KingJimmy King Registered User regular
    Izzimach wrote: »
    Jimmy King wrote: »
    Is anyone here familiar with Browserify, and possibly specifically using gulp-browserify? I have two bundles... a.js and b.js. I want to specify a.js as an external for b.js, but when I do that, b.js still cannot actually use anything from a.js unless I a.js sets globals on the window object. I am clearly doing something wrong.

    I think nowadays you're supposed to just use browserify directly in gulp, like:
    var browserify = require('browserify');
    
    ... in your gulp task ...
    
    var bundler = browserify();
    bundler.require('this');
    bundler.add('that');
    return bundler.bundle().pipe(gulp.dest('blah'))
    

    As far as multiple bundles, I guess you're doing this?
    1. in the first bundle you .require('a') so that it can referenced externally
    2. in the second bundle you .require('b') and .external('a') so that it looks for 'a' externally

    I only use browserify via javascript so I can't comment on command-line or config file setup sorry.

    Na, separate bundles being built so that page specific js can go in its own bundle but reference stuff from another bundle without literally duplicating all of the js as would normally happen.

    HOW THINGS CURRENTLY ARE WORKING BUT REALLY CAN'T BE CORRECT
    stripped down gulpfile.js as things are currently working, but hacky.
    var gulp = require('gulp');
    var browserify = require('browserify');
    var transform = require('vinyl-transform');
    var source = require('vinyl-source-stream');
    var buffer = require('vinyl-buffer');
    var watchify = require('watchify');
    var uglify = require('gulp-uglify');
    
    gulp.task('browserify', function() {
        
        // refer to https://github.com/greypants/gulp-starter/blob/master/gulp/tasks/browserify.js
        // to improve this further to handle shared dependencies and dev vs prod stuff
        var browserifyThis = function(config, plugins) {
            var b = browserify(config);
    
            var bundle = function () {
                console.log('bundling');
                return b
                    .bundle()
                    .pipe(source(config.outputName))
                    .pipe(buffer())
                    .pipe(uglify())
                    .pipe(gulp.dest(jsOutputDir));
            }
    
            /* this seems to force all bower components into each browserified module... oops
            b.plugin('browserify-bower', {
                require: ['medium-editor', ],
                //    external: {
                //exclude: ['modernizr','markdown']
                // exclude: ['comp1', 'comp2']
                //    }
            });
            */
    
            // this does the above, but allows for per bundle plugins
            if(plugins) {
                for(var i=0; i<plugins.length; i++) {
                    b.plugin(plugins[i].name, plugins[i].conf);
                }
            }
            if(config.external){ b.external(config.external) };
            if(config.require){ b.require(config.require) };
            b = watchify(b);
            b.on('update', bundle);
            bundle();
        };
        var editorConfig = {
            entries: [
                jsSourceDir + 'editor.js',
            ],
            cache: {},
            packageCache: {},
            fullPaths: true,
            outputName: './editor.js',
        }
        var editorPlugins = [
            {name: 'browserify-bower',
             conf: {
                 require: ['medium-editor', ]
             }
            },
        ];
        browserifyThis(editorConfig, editorPlugins);
    
        var createRecipeConfig = {
            entries: [
                jsSourceDir + 'create_recipe.js',
            ],
            cache: {},
            packageCache: {},
            fullPaths: true,
            outputName: 'create_recipe.js',
            external: ['./editor.js',],
        };
        browserifyThis(createRecipeConfig, null);
    });
    

    editor.js
    var markdown = require('markdown');
    var toMarkdown = require('to-markdown');
    var medium = require('medium-editor');
    
    /* hack to make these work.  Without them then I cannot access anything here even with editor.js specified as an external, with our without require()ing it */
    window.MediumEditor = medium;
    window.markdown = markdown.markdown;
    window.toMarkdown = toMarkdown;
    

    create_recipe.js
    //var editor = require('./editor.js');  // if I include this, then editor.js actually blows up in the require which browserify puts into it
    
    Modernizr.addTest('contenteditable', 'contentEditable' in document.documentElement);  // this line will end up in a cental js bundle
    
    var descriptionElement = document.getElementById('id_0-description_markdown');
    var descriptionEditor = document.getElementById('description-editor'),
        descriptionContainer = descriptionEditor.parentNode,
        descriptionPlaceholderText = 'Please add a description of the recipe';
    var directionsElement = document.getElementById('id_0-directions_markdown'),
        directionsEditor = document.getElementById('directions-editor'),
        directionsPlaceholderText = 'Cooking directions for this recipe';
    
    function initEditor(sourceEditable, targetInput, placeholderText) {
        // https://github.com/daviferreira/medium-editor
        var editor = new MediumEditor(sourceEditable, {
            buttons: ['bold', 'italic', 'underline', 'quote', 'unorderedlist', 'orderedlist', 'indent', 'outdent'],
            placeholder: {
                text: placeholderText,
            },
            updateOnEmptySelection: true,
            staticToolbar: true,
            toolbarAlign: 'right',
            //stickyToolbar: true,
        });
    
        // if the target input already has a value, copy it into the editor
        if(targetInput.value) {
            sourceEditable.innerHTML = markdown.toHTML(targetInput.value);
            $(sourceEditable).click();
        }
    };
    
    if(Modernizr.contenteditable) {
        initEditor(descriptionEditor, descriptionElement, 'Please add a description of the recipe');
        initEditor(directionsEditor, directionsElement, directionsPlaceholderText);
        $(descriptionElement).hide(); // add classes to these
        $(directionsElement).hide();
        $('.editor').show();
        $('.editor-container').show();
    
        $('#recipe-form').submit(function (e) {
            e.preventDefault();
            var descriptionText =  descriptionEditor.innerHTML; //article.textContent || article.innerText;
            var descriptionMarkdown = toMarkdown(descriptionText);
            var directionsText =  directionsEditor.innerHTML; //article.textContent || article.innerText;
            var directionsMarkdown = toMarkdown(directionsText);
    
            descriptionElement.value = descriptionMarkdown;
            directionsElement.value = directionsMarkdown;
            this.submit();
        });
    }
    

    HOW I FEEL LIKE THINGS SHOULD BE, BUT JUST DOES NOT WORK
    gulpfile.js unchanged, create_recipe.js also unchanged, except possibly adding that require('./editor.js') back in and accessing markdown, MediumEditor, etc. as editor.markdown, editor.MediumEditor, and so on.

    editor.js
    var markdown = require('markdown');
    var toMarkdown = require('to-markdown');
    var medium = require('medium-editor');
    
    // gone are the window.foo assignments.
    

  • Options
    InfidelInfidel Heretic Registered User regular
    bowen wrote: »
    Okay am I crazy... I'm using two different services and coming up with 2 different hash values for a file.

    http://i-tools.org/hash/exec <- this one matches .NET's sha1/sha256 for file hashing
    http://onlinemd5.com/ <- this one matches what the instructor for certification is getting.

    What the fuck is going on.

    I get the same hash using SHA 256 and a direct input test string for both?

    OrokosPA.png
  • Options
    bowenbowen How you doin'? Registered User regular
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    bowenbowen How you doin'? Registered User regular
    On one I'm getting:

    8A6B86B23F1F6DC49F8FFB2AD6825201E4F535E3 which matches .NET

    On the other I'm getting:

    22259F4F54C63D41A025B1A498BC6C28DADA42C5 which is apparently what the proctor is getting

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    I get the same results for both. Check for line ending conversion maybe?

  • Options
    bowenbowen How you doin'? Registered User regular
    Which are you getting, the 8a one?

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    bowenbowen How you doin'? Registered User regular
    byte[] fileBytes = File.ReadAllBytes(Thefile.FullName);
    SHA1 sha = SHA1.Create();
    string hex = BitConverter.ToString(Hash.ByteToHex(sha.ComputeHash(fileBytes)));
    return hex.Replace("-", "");
    

    That's all my code, it used to work.

    No idea what's changed.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    InfidelInfidel Heretic Registered User regular
    I downloaded that PDF and get b9d7023623779e4ab5421b9d16273ad4cbee711ffbbca82630935b1378d055ae from the first and CB87B533965ED4CE11FB1E2057B3D7BDE6E4A8EC85E58FFFB8945FAF5864E6EE from the second.

    So, uhhhhh. Is there something wrong with that file?

    I uploaded a random JPG from my computer and got the same hash from both sites.

    OrokosPA.png
  • Options
    bowenbowen How you doin'? Registered User regular
    Looks like HMACSHA fucks up with PDF files.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
This discussion has been closed.