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/
We're funding a new Acquisitions Incorporated series on Kickstarter right now! Check it out at https://www.kickstarter.com/projects/pennyarcade/acquisitions-incorporated-the-series-2

[Programming] djmitchella travelling through snow to rfind duplicate dates for singletons

11819212324100

Posts

  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    schuss wrote: »
    Question for developers:
    Is it reasonable for me to rely on my developers to identify technology change risks (ex. iOS 7-8 transition), or should that be on the business team to identify and prioritize?

    Honest question.

    Developers should know and business should ask.

    Specifics depend a lot on the company and what developers are charged with.

    That being said, the transition from 7 to 8 is quite mild. Most of the painful iOS transition stuff has to do with apps made on 5 and 6 transitioning to 7-8

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    bowen wrote: »
    Phyphor wrote: »
    Ethea wrote: »
    Phyphor wrote: »
    Ethea wrote: »
    bowen wrote: »
    Is it harder though? I dunno, first thing I do is work on an admin interface to simplify that stuff. In a place like iOS where memory is at a premium, seems like you'd not want to cache in an entire set of things. I guess you could get around that by having tons of files. Then you get into the position where you don't want tons of files so you find a way to package them...

    And then we're back at square one.

    But yeah, json seems like it'd be just fine!

    You are a true programmer.

    Step 1 to making a game: lets write an admin interface to add elements to a flat file db.

    Pfft, I wrote a filesystem

    Do tell me more, that does sound fun.

    Well, we needed a way to access lots of resource files - models, textures, shaders, configuration, etc, and we had level editing built right into the game, so we needed to potentially save a bunch of files with the levels and so needed some way to pack them, not just the baked assets file to be shipped

    The classic choice is a store-only zip file, used by things like Quake 3. Another choice is Blizzard's MPQ (which they finally dropped for something more like what I built actually!). The problem with those is they are static, if you change something you have to re-write the entire file to disk. You can see this with older WoW updates, where they download the update and then have to write the entire massive merged file to disk

    So, I wrote a filesystem. Extents-based with inodes, noting special really, and since it was designed to be file-based, only 8kB of metadata (4 for the superblock and 4 for the root freelist) and insufficient space writes would try to extend the file

    And then I tied it in with the rest of the I/O system. To load a map that was on someone else's machine, we "opened" a file that routed requests to the target machine and copied it locally. But because it was just another file, we could run the level setup at the same time and the requests (cached locally) would be mixed in. I/O requests would be split across extents as needed, I'd made sure the entire I/O backend was asynchronous anyway

    You should throw that shit up on github, bro.

    Didn't think anyone would be interested. I'll see if I can find it

    bowenLD50EtheaDedwrekka
  • EchoEcho ski-bap ba-dapModerator mod
    So this is a neat thing in Ruby:
    ("12:00".."12:15").cover?("12:14")  # => true
    

    Of course, it doesn't care about time, so this is also true:
    ("11:59".."12:00").cover?("11:99")
    

  • bowenbowen How you doin'? Registered User regular
    I'm pretty sure that's witchcraft.

    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
    Echo
  • LD50LD50 Registered User regular
    I think the best part is that you can make ranges of anything as long as it implements the spaceship operator.

    Echo
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    Echo wrote: »
    So this is a neat thing in Ruby:
    ("12:00".."12:15").cover?("12:14")  # => true
    

    Of course, it doesn't care about time, so this is also true:
    ("11:59".."12:00").cover?("11:99")
    

    that is.. extremely handy

  • bowenbowen How you doin'? Registered User regular
    WITCH BURN HIM AT THE STAKE

    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
  • LD50LD50 Registered User regular
    Witch one of us?

    ecco the dolphin
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited October 2014
    I shared this in the Destiny thread, but figured some of you may enjoy it as well.

    https://github.com/brainling/parf
    https://github.com/brainling/parf-api

    Those are the front end and back end for the raid/group finding tool I'm building us for Destiny. The front end is an AngularJS SPA which runs a simple Express server that simply hosts the index.html, main.css and main.js (which are the entire application after compilation). The back end is a HapiJS JSON API which uses Boom to signal errors (so status codes + standardized JSON packet with error message).

    If you've ever wondered what it really looks like when you're entire stack is written in JavaScript, have a peek. It's not perfect code, and I still need to write most of my tests, but it's mostly clean and there is a lot of plumbing you won't see in most basic projects.

    e: I forgot to point out the back end data store is MongoDB using Mongoose for data access.

    GnomeTank on
    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
    LD50ironsizide
  • EchoEcho ski-bap ba-dapModerator mod
    LD50 wrote: »
    I think the best part is that you can make ranges of anything as long as it implements the spaceship operator.

    Yeah, just include the Comparable module and implement the spaceship.

    Mmm, Ruby. 8->

  • bowenbowen How you doin'? Registered User regular
    Has anyone here worked with large XML files?

    I had a text file but the export engine was giving me garbled data in it for some fields. The text file was fine when it was ~1-2 gigs worth of data because I didn't read the whole thing in.

    I'm using c#, and I need to read roughly the same amount of data via XML, which actually has the real data in it this time instead of garbled (XML is the only one that works from a foxpro export for some reason with the memo fields he has).

    Can I just use the in built XML stuff and set it and forget it or is there anything I need to consider because of their large size?

    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
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    As long as you can process the elements sequentially and you don't need the DOM, use XmlReader. That will work fine on a large XML file.

    bowenEvigilant
  • bowenbowen How you doin'? Registered User regular
    Yeah just one <row> element at a time. Thanks kako.

    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
  • DrezDrez Registered User regular
    Don't get me started on SAP. I could build a better software suite in Excel.

    Which is hyperbole and I shouldn't get too specific but I deal with some of their products as a business analyst with an extensive technology background and they nearly gave me an aneurism multiple times.

    Switch: SW-7690-2320-9238Steam/PSN/Xbox: Drezdar
    urahonky
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    I have, and yes, you use XmlReader for that. We actually ended up writing a fragment reader which can search and find a fragment of XML using XmlReader, then return that fragment as a constituted DOM object (Linq to XML in our case, so XElement) for more robust searching. Basically the idea is you never want to constitute more of the document than you need to. The other nice thing about using an XmlReader is that it's stream agnostic, allowing you to stream very large documents from disk or over the network.

    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
    bowen
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Drez wrote: »
    Don't get me started on SAP. I could build a better software suite in Excel.

    Which is hyperbole and I shouldn't get too specific but I deal with some of their products as a business analyst with an extensive technology background and they nearly gave me an aneurism multiple times.

    First time I watched an ABAP developer load up their built-in code editor, with no syntax highlighting, no auto-complete, no intellisense, and no easy access to documentation, in 2010, I almost fainted. Ignoring completely that the language is basically a showcase of The Worst of Cobol.

    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
    urahonky
  • TofystedethTofystedeth Registered User regular
    I mean, I appreciate that I can drag and drop fields from a category view into the thing and it will handle figuring out how to join shit from the 1300+ tables so I don't have to, but why is it impossible to do any kind of aggregate function on the query side instead of the report side.

    steam_sig.png
    Drez
  • gavindelgavindel The reason all your software is brokenRegistered User regular
    I'm building a subset of a data mining engine for our class project. Naturally, that means the need for efficient joins to handle the massive files involved. Wrestle with Python a little, learn some about the finer details of Pythonian I/O, but its going well. Until I notice that my sort-merge join is reporting that userID 80 has 300 job apps out, and user 9934 has over ten thousand!

    I check the logic on my merge for the two sorted files:
    #set up the while loop up here
    if ID1 == ID2:
      result.write(line1 + '\t' + line2)
      file1.next()
      file2.next()
    elif ID1 < ID2:
      file2.next()
    elif ID1 > ID2:
      file1.next()
    #loop ends
    

    I can't find any errors in the join. Its as efficient as I'm going to get when I have to do reads by the line. Tear out some of my ever-receding hair, gnash teeth, and finally start tracing individual comparisons. Everything works fine for the first users, but as we get higher up the issue becomes more common...Wait a second.
    >>>"80" > "520"
    True
    

    Sonnova. String comparison instead of integer! I'd forgotten that many languages do their string comparison one char at a time.

    I may be a senior, but you can never graduate your own bouts of blind stupidity.

    Angels, innovations, and the hubris of tiny things: my book now free on Royal Road! Seraphim
  • NaphtaliNaphtali Hazy + Flow SeaRegistered User regular
    Jasconius wrote: »
    Echo wrote: »
    So this is a neat thing in Ruby:
    ("12:00".."12:15").cover?("12:14")  # => true
    

    Of course, it doesn't care about time, so this is also true:
    ("11:59".."12:00").cover?("11:99")
    

    that is.. extremely handy

    I am incredibly upset I can't use this in all the miserable embedded vb app crap I have to deal with

    so slick

    Steam | Nintendo ID: Naphtali | Wish List
  • LD50LD50 Registered User regular
    Naphtali wrote: »
    Jasconius wrote: »
    Echo wrote: »
    So this is a neat thing in Ruby:
    ("12:00".."12:15").cover?("12:14")  # => true
    

    Of course, it doesn't care about time, so this is also true:
    ("11:59".."12:00").cover?("11:99")
    

    that is.. extremely handy

    I am incredibly upset I can't use this in all the miserable embedded vb app crap I have to deal with

    so slick

    All of ruby is slick. Almost all of it anyway.

  • urahonkyurahonky Registered User regular
    Embarrassing story for the day that I don't mind sharing.

    Was trying to figure out why my for loop wasn't getting called. I thought it was that filterArray wasn't actually an array but rather a String (I'm dealing with just Objects... Don't ask). So multiple deployments, a dozen lines of debug statements, and a year or so off my life I actually looked at the code I was dealing with:
    for(var i:int = 0; i > filterArray.length; i++){
    

    Yeah. Sometimes I am not a smart man. But hopefully I'll check that FIRST next time.

    bowen
  • bowenbowen How you doin'? Registered User regular
    That's something I totally would pass over 20 dozen times and end up throwing debug statements into my code (if I didn't have a debugger) to find out what the fuck is going on with the loop.

    Then after wasting 5 hours, sigh loudly and walk away and stab someone.

    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
    LD50mightyjongyoa5ehrenVegemyte
  • urahonkyurahonky Registered User regular
    bowen wrote: »
    That's something I totally would pass over 20 dozen times and end up throwing debug statements into my code (if I didn't have a debugger) to find out what the fuck is going on with the loop.

    Then after wasting 5 hours, sigh loudly and walk away and stab someone.

    That's exactly what happened and exactly how I feel.

    bowen
  • LD50LD50 Registered User regular
    We all make those kinds of mistakes. I knew what to look for and still had to read it twice.

    And since I've been plugging ruby so much: ruby doesn't even have for loops for you to mix up your signs in.

    bowen
  • bowenbowen How you doin'? Registered User regular
    I find for loops evil, foreach for lyfe.

    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
    LD50EchoEvigilant
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited October 2014
    I probably write one for/while loop for every 10-20 foreachs.

    That said, the last while loop I wrote was just a few days ago, because SharePoint's JavaScript library implements getEnumerator, moveNext, and get_current (you read that right) on its collections, but doesn't implement .forEach.

    Because SharePoint.

    admanb on
    bowenSpawnbrokerCampy
  • urahonkyurahonky Registered User regular
    Normally I do foreach loops, but I thought that I might have to remove something off the array so I kept it the old fashioned way.

  • SpawnbrokerSpawnbroker Registered User regular
    admanb wrote: »
    I probably write one for/while loop for every 10-20 foreachs.

    That said, the last while loop I wrote was just a few days ago, because SharePoint's JavaScript library implements getEnumerator, moveNext, and get_current (you read that right) on its collections, but doesn't implement .forEach.

    Because SharePoint.

    I avoid the SharePoint JS libraries as much as I can. I'm a back-end programmer at heart, but god damn if they seem to be pushing the "web dev" side of things lately.

    I am going to have to buckle down and start using the REST api instead of the CSOM for my apps eventually, but they'll have to drag me kicking and screaming. I avoid Javascript and use server-side when I can.

    Steam: Spawnbroker
  • RendRend Registered User regular
    Hey guys, need some git assistance here.

    Let's say I have a remote called Remote, and a branch called Branch. I've branched locally so that there is a local Branch and also a Remote/Branch, and I am currently checked out to my local Branch, though that should probably be irrelevant.

    I want to force pull Remote/Branch, set it immediately to the state of the remote repo, regardless of the current state of my branch. I THOUGHT that the way to do this was:

    git fetch Remote/Branch
    git reset --hard Remote/Branch

    ...but after the second command I get: fatal: ambiguous argument 'Remote/Branch': unknown revision or path not in working tree.

    Am I doing something silly?

  • a5ehrena5ehren AtlantaRegistered User regular
    I wish I could go beat anyone that used a setsockopt() call in our application code with a newspaper.

    A 35KB buffer will be enough forever! Never mind that it fits 2 whole jumbo frame packets, you didn't know that was a thing when you wrote the code 20 years ago. Just let the OS do it! We have 8MB of memory just hanging out, waiting to be used for this stuff!

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    I have to do so much old browser JavaScript at work that I end up writing a lot of for loops (as Array.forEach is only standard in modern-ish browsers).

    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
  • EtheaEthea Registered User regular
    Rend wrote: »
    Hey guys, need some git assistance here.

    Let's say I have a remote called Remote, and a branch called Branch. I've branched locally so that there is a local Branch and also a Remote/Branch, and I am currently checked out to my local Branch, though that should probably be irrelevant.

    I want to force pull Remote/Branch, set it immediately to the state of the remote repo, regardless of the current state of my branch. I THOUGHT that the way to do this was:

    git fetch Remote/Branch
    git reset --hard Remote/Branch

    ...but after the second command I get: fatal: ambiguous argument 'Remote/Branch': unknown revision or path not in working tree.

    Am I doing something silly?

    The following should work.
    git fetch Remote
    git checkout Branch
    git reset --hard Remote/Branch
    

    I think the following should also work
    git fetch Remote Branch:Branch
    

  • RendRend Registered User regular
    edited October 2014
    Ethea wrote: »
    Rend wrote: »
    Hey guys, need some git assistance here.

    Let's say I have a remote called Remote, and a branch called Branch. I've branched locally so that there is a local Branch and also a Remote/Branch, and I am currently checked out to my local Branch, though that should probably be irrelevant.

    I want to force pull Remote/Branch, set it immediately to the state of the remote repo, regardless of the current state of my branch. I THOUGHT that the way to do this was:

    git fetch Remote/Branch
    git reset --hard Remote/Branch

    ...but after the second command I get: fatal: ambiguous argument 'Remote/Branch': unknown revision or path not in working tree.

    Am I doing something silly?

    The following should work.
    git fetch Remote
    git checkout Branch
    git reset --hard Remote/Branch
    

    I think the following should also work
    git fetch Remote Branch:Branch
    

    It turns out this is what I needed:
    git fetch Remote
    git checkout Remote/Branch
    git checkout -b Branch
    
    ...because it was fine for me to obliterate my local Branch since this was my initial pull.

    That being said, your line:
    git reset --hard Remote/Branch
    
    ...was giving me issues. (I was already checked out to Branch when I ran the fetch and reset commands, and my reset command looks to me like it's identical to yours) In the interest of knowing this for the future, any clue why that might have been?

    [EDIT] Is it because the fetch line was fetch Remote/Branch instead of fetch Remote?

    Rend on
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    admanb wrote: »
    I probably write one for/while loop for every 10-20 foreachs.

    That said, the last while loop I wrote was just a few days ago, because SharePoint's JavaScript library implements getEnumerator, moveNext, and get_current (you read that right) on its collections, but doesn't implement .forEach.

    Because SharePoint.

    I avoid the SharePoint JS libraries as much as I can. I'm a back-end programmer at heart, but god damn if they seem to be pushing the "web dev" side of things lately.

    I am going to have to buckle down and start using the REST api instead of the CSOM for my apps eventually, but they'll have to drag me kicking and screaming. I avoid Javascript and use server-side when I can.

    I really like JS, in general. Maybe it's because my original back-end background (backbackback) is in Ruby rather then C#, but I tend to feel like I'm smart enough not to hang myself so I prefer that languages give me all the rope I need.

    But the SP JS library is just godawful.

  • EtheaEthea Registered User regular
    @Rend yes your fetch line was wrong.

    Rend
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    following the wisdom of http://blog.codinghorror.com/the-first-rule-of-programming-its-always-your-fault/

    i never go so far as to declare some critical component of a computer system as "broken" when my code fails

    but, I do declare things as "fucked up wizard shit going on"

    todays wizard shit was I had two different sets of JSON data somehow getting merged together into one permanent soufflé of data and I had no idea how. and when you see a variable that appears to be sourced straight from a file and you open that file and see it definitely doesn't contain the data the browser is reporting, you need someone to blame

    after brief head-scratching i remember that I wrote a routine that merges the two data sets, but it was supposed to be a temporary merge and a bug was causing it to be permanent

    wizard shit resolved

  • SpawnbrokerSpawnbroker Registered User regular
    admanb wrote: »
    admanb wrote: »
    I probably write one for/while loop for every 10-20 foreachs.

    That said, the last while loop I wrote was just a few days ago, because SharePoint's JavaScript library implements getEnumerator, moveNext, and get_current (you read that right) on its collections, but doesn't implement .forEach.

    Because SharePoint.

    I avoid the SharePoint JS libraries as much as I can. I'm a back-end programmer at heart, but god damn if they seem to be pushing the "web dev" side of things lately.

    I am going to have to buckle down and start using the REST api instead of the CSOM for my apps eventually, but they'll have to drag me kicking and screaming. I avoid Javascript and use server-side when I can.

    I really like JS, in general. Maybe it's because my original back-end background (backbackback) is in Ruby rather then C#, but I tend to feel like I'm smart enough not to hang myself so I prefer that languages give me all the rope I need.

    But the SP JS library is just godawful.

    A good compiler is like a good dominatrix.

    I need it to yell at me and tell me I'm a bad programmer.

    Steam: Spawnbroker
    RendironsizidePolaritiean_alt
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited October 2014
    That's what tools like jshint/jslint are for. They yell at me and tell me when I'm doing stupid shit, like using undeclared variables, or falling in to parse traps.

    GnomeTank on
    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
  • EchoEcho ski-bap ba-dapModerator mod
    I'm having the weirdest .htaccess issue.

    I redirect to index.php/$1 for files that don't exist.

    http://foo.com/composer.json shows the JSON file that happens to be lying around for whatever reason.

    Other files just don't work and incorrectly redirect to index.php.

    I have no goddamn idea what is going on. My .htaccess is pretty simple:
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
    
      # Allow any files or directories that exist to be displayed directly
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
    
      # Rewrite all other URLs to index.php/URL
      RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
      ErrorDocument 404 index.php
    </IfModule>
    

  • bowenbowen How you doin'? Registered User regular
    lol regex :rotate:

    RewriteCond needs to be broken out of once it runs into it, doesn't it? It's always going to process that RewriteRule I think?

    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
Sign In or Register to comment.