Club PA 2.0 has arrived! If you'd like to access some extra PA content and help support the forums, check it out at patreon.com/ClubPA
The image size limit has been raised to 1mb! Anything larger than that should be linked to. This is a HARD limit, please do not abuse it.
Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

My Little [Programming] Thread: Debugging is Magic

1457910100

Posts

  • urahonkyurahonky Registered User regular
    I'm starting to suspect that my team has my emails filtered to the Trash Bin.

  • GnomeTankGnomeTank Registered User regular
    Also triggers are evil, and should be avoided at all costs. Especially in large systems with multiple layers of interaction, triggers can and will bite you in the ass. They should be used incredibly sparingly, and approaching never for business logic.

    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
    bowenBigity
  • bowenbowen How you doin'? Registered User regular
    Yeah that kind of check gets thrown into my code rather than my database. I strictly use my DB as a storage mechanism, not a coding one. Just creates so much more work if you change systems or something like that.

    Ladies.
    Nightslyr
  • InfidelInfidel Heretic Registered User regular
    Yeah, I don't recommend putting business limits in your database like that.

    OrokosPA.png
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
    Nightslyr
  • KambingKambing Registered User regular
    bowen wrote: »
    You misspelled Haskell.

    Lambdas are the light.

    How does it feel to be the most terrible human being of the 21st century?

    You rang?
    import Euterpea
     
    song = play $ cycle 10 bars
      where
        cycle n   = foldl (:+:) (rest sfn) . take n . repeat
        bars      = foldl (:+:) (rest sfn) (bar fminor bflat ++ bar aflatsus dflat)
        bar c1 c2 = [c1 den, c1 sn, c1 qn, rest en, c2 en, c2 qn]
        triple (n1, n2, n3) l = n1 l :=: n2 l :=: n3 l
        fminor   = triple (f 4, c 4, aff 3)
        bflat    = triple (bff 4, f 4, d 4)
        aflatsus = triple (aff 4, eff 4, dff 4)
        dflat    = triple (dff 5, aff 4, f 4)
    

    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
    Kakodaimonos
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    can someone please help me understand what this shit from horse is where node developers create soft ports of established tools just for the sake of using Node

    wouldn't it be faster to learn a real language on a real runtime

    https://github.com/creationix/haml-js

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Javascript is the Future. But nobody seems to like the Future, so we just create dozens of javascript-generating languages

    Magic Box
    Academician Prokhor "Phyphor" Zakharov, Chief Scientist of China, Provost of the University of Planet - SE++ Megagame
    Infidelbowen
  • LD50LD50 Registered User regular
    Jasconius wrote: »
    can someone please help me understand what this shit from horse is where node developers create soft ports of established tools just for the sake of using Node

    wouldn't it be faster to learn a real language on a real runtime

    https://github.com/creationix/haml-js

    I love this note on their front page:
    Note that this works almost the same as ruby's haml, but doesn't pretty print the html. This would greatly slow down and complicate the code. If you really want pretty printed html, then I suggest writing one using the xml parser library and process the resulting html.

    Translation: We didn't actually recreate all of haml, and our version's performance sucks.

  • GnomeTankGnomeTank Registered User regular
    edited March 2014
    I'm not sure how Ruby is anymore of a "real" language or runtime than JS + Node? And this is coming from someone who is overall dubious of Node and loves Ruby.

    HAML is a nice markup syntax, and people in Node want to use it. I'm unsure of how this is strange. If you look around, you can find Jade engines for Rails, even though Jade is 100% JavaScript code.

    The bigger question is why these people would want to use HAML over Jade in the first place, but really, that's their call.

    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
  • bowenbowen How you doin'? Registered User regular
    Kambing wrote: »
    bowen wrote: »
    You misspelled Haskell.

    Lambdas are the light.

    How does it feel to be the most terrible human being of the 21st century?

    You rang?
    import Euterpea
     
    song = play $ cycle 10 bars
      where
        cycle n   = foldl (:+:) (rest sfn) . take n . repeat
        bars      = foldl (:+:) (rest sfn) (bar fminor bflat ++ bar aflatsus dflat)
        bar c1 c2 = [c1 den, c1 sn, c1 qn, rest en, c2 en, c2 qn]
        triple (n1, n2, n3) l = n1 l :=: n2 l :=: n3 l
        fminor   = triple (f 4, c 4, aff 3)
        bflat    = triple (bff 4, f 4, d 4)
        aflatsus = triple (aff 4, eff 4, dff 4)
        dflat    = triple (dff 5, aff 4, f 4)
    

    Ah, I see, I guess he's a runner up.

    Ladies.
    Kambing
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited March 2014
    GnomeTank wrote: »
    I'm not sure how Ruby is anymore of a "real" language or runtime than JS + Node? And this is coming from someone who is overall dubious of Node and loves Ruby.

    HAML is a nice markup syntax, and people in Node want to use it. I'm unsure of how this is strange. If you look around, you can find Jade engines for Rails, even though Jade is 100% JavaScript code.

    The bigger question is why these people would want to use HAML over Jade in the first place, but really, that's their call.

    well it's strange if you have something like Docpad that claims to support HAML as a plugin, it would be a good thing to mention that it doesn't actually support HAML but some extremely weak port of HAML that could be described as feature complete only in the strictest sense of the term

    that's a little like owning a bar and saying you sell the finest beers but actually it's just falsely labelled coors light

    this is supposed to be a good example of a Node.JS system..

    Jasconius on
  • KambingKambing Registered User regular
    bowen wrote: »
    Kambing wrote: »
    bowen wrote: »
    You misspelled Haskell.

    Lambdas are the light.

    How does it feel to be the most terrible human being of the 21st century?

    You rang?
    import Euterpea
     
    song = play $ cycle 10 bars
      where
        cycle n   = foldl (:+:) (rest sfn) . take n . repeat
        bars      = foldl (:+:) (rest sfn) (bar fminor bflat ++ bar aflatsus dflat)
        bar c1 c2 = [c1 den, c1 sn, c1 qn, rest en, c2 en, c2 qn]
        triple (n1, n2, n3) l = n1 l :=: n2 l :=: n3 l
        fminor   = triple (f 4, c 4, aff 3)
        bflat    = triple (bff 4, f 4, d 4)
        aflatsus = triple (aff 4, eff 4, dff 4)
        dflat    = triple (dff 5, aff 4, f 4)
    

    Ah, I see, I guess he's a runner up.

    Don't worry. This is not even my final form. ^_^

    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
  • GnomeTankGnomeTank Registered User regular
    Jasconius wrote: »
    GnomeTank wrote: »
    I'm not sure how Ruby is anymore of a "real" language or runtime than JS + Node? And this is coming from someone who is overall dubious of Node and loves Ruby.

    HAML is a nice markup syntax, and people in Node want to use it. I'm unsure of how this is strange. If you look around, you can find Jade engines for Rails, even though Jade is 100% JavaScript code.

    The bigger question is why these people would want to use HAML over Jade in the first place, but really, that's their call.

    well it's strange if you have something like Docpad that claims to support HAML as a plugin, it would be a good thing to mention that it doesn't actually support HAML but some extremely weak port of HAML that could be described as feature complete only in the strictest sense of the term

    that's a little like owning a bar and saying you sell the finest beers but actually it's just falsely labelled coors light

    this is supposed to be a good example of a Node.JS system..

    haml-js seems to support everything but haml's pretty printing, from my quick glance. I think you and I disagree on how feature complete something has to be to qualify as "close enough".

    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
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    GnomeTank wrote: »
    Jasconius wrote: »
    GnomeTank wrote: »
    I'm not sure how Ruby is anymore of a "real" language or runtime than JS + Node? And this is coming from someone who is overall dubious of Node and loves Ruby.

    HAML is a nice markup syntax, and people in Node want to use it. I'm unsure of how this is strange. If you look around, you can find Jade engines for Rails, even though Jade is 100% JavaScript code.

    The bigger question is why these people would want to use HAML over Jade in the first place, but really, that's their call.

    well it's strange if you have something like Docpad that claims to support HAML as a plugin, it would be a good thing to mention that it doesn't actually support HAML but some extremely weak port of HAML that could be described as feature complete only in the strictest sense of the term

    that's a little like owning a bar and saying you sell the finest beers but actually it's just falsely labelled coors light

    this is supposed to be a good example of a Node.JS system..

    haml-js seems to support everything but haml's pretty printing, from my quick glance. I think you and I disagree on how feature complete something has to be to qualify as "close enough".

    Graph 1 Graph 2

    which one of these graphs best represents what looks like a robust opensource software library you can build a product on with confidence, get support, get a ticket worked on or at least addressed, or have a pull request honored

    and which one looks like floating garbage

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Jasconius wrote: »
    GnomeTank wrote: »
    Jasconius wrote: »
    GnomeTank wrote: »
    I'm not sure how Ruby is anymore of a "real" language or runtime than JS + Node? And this is coming from someone who is overall dubious of Node and loves Ruby.

    HAML is a nice markup syntax, and people in Node want to use it. I'm unsure of how this is strange. If you look around, you can find Jade engines for Rails, even though Jade is 100% JavaScript code.

    The bigger question is why these people would want to use HAML over Jade in the first place, but really, that's their call.

    well it's strange if you have something like Docpad that claims to support HAML as a plugin, it would be a good thing to mention that it doesn't actually support HAML but some extremely weak port of HAML that could be described as feature complete only in the strictest sense of the term

    that's a little like owning a bar and saying you sell the finest beers but actually it's just falsely labelled coors light

    this is supposed to be a good example of a Node.JS system..

    haml-js seems to support everything but haml's pretty printing, from my quick glance. I think you and I disagree on how feature complete something has to be to qualify as "close enough".

    Graph 1 Graph 2

    which one of these graphs best represents what looks like a robust opensource software library you can build a product on with confidence, get support, get a ticket worked on or at least addressed, or have a pull request honored

    and which one looks like floating garbage

    Pfft, one of those is clearly done, and therefore perfect since obviously no work needs to be done on it. The other is crap that needs to be constantly fixed!

    Magic Box
    Academician Prokhor "Phyphor" Zakharov, Chief Scientist of China, Provost of the University of Planet - SE++ Megagame
    bowenan_alt
  • GnomeTankGnomeTank Registered User regular
    Jasconius wrote: »
    GnomeTank wrote: »
    Jasconius wrote: »
    GnomeTank wrote: »
    I'm not sure how Ruby is anymore of a "real" language or runtime than JS + Node? And this is coming from someone who is overall dubious of Node and loves Ruby.

    HAML is a nice markup syntax, and people in Node want to use it. I'm unsure of how this is strange. If you look around, you can find Jade engines for Rails, even though Jade is 100% JavaScript code.

    The bigger question is why these people would want to use HAML over Jade in the first place, but really, that's their call.

    well it's strange if you have something like Docpad that claims to support HAML as a plugin, it would be a good thing to mention that it doesn't actually support HAML but some extremely weak port of HAML that could be described as feature complete only in the strictest sense of the term

    that's a little like owning a bar and saying you sell the finest beers but actually it's just falsely labelled coors light

    this is supposed to be a good example of a Node.JS system..

    haml-js seems to support everything but haml's pretty printing, from my quick glance. I think you and I disagree on how feature complete something has to be to qualify as "close enough".

    Graph 1 Graph 2

    which one of these graphs best represents what looks like a robust opensource software library you can build a product on with confidence, get support, get a ticket worked on or at least addressed, or have a pull request honored

    and which one looks like floating garbage

    That wasn't your argument five minutes ago. You just moved the goal posts to the other end of the field. You said haml-js could "be described as feature complete only in the strictest sense of the term", yet when I pointed out that it seems pretty feature complete aside from pretty printing....you show me the community activity page.

    For a programmer, you don't understand logical fallacy very well it seems.

    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
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    do you believe it's plausible that haml-js could be literally feature complete without a single commit in over a calendar year

  • SpawnbrokerSpawnbroker Registered User regular
    edited March 2014
    Okay, writing web service methods that are meant to be consumed by InfoPath forms is the lowest circle of hell.

    What have I done to deserve this?

    Edit: Scratch that, that thing up there that @Kambing made is worse.

    Spawnbroker on
    Battle.net: Spawnbroker#1471
    Steam: Spawnbroker
    Final Fantasy XIV: Spawn Broken
  • InfidelInfidel Heretic Registered User regular
    Thread so salty.

    OrokosPA.png
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
    iTunesIsEvil
  • bowenbowen How you doin'? Registered User regular
    Probably overloaded from all my Java tears.

    Ladies.
  • DehumanizedDehumanized Registered User regular
    TearFactoryFactory

    bowenNightslyr
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    TearFactoryFactoryManagerBeanDroplet

    bowenNightslyrMahnmutIncindium
  • DehumanizedDehumanized Registered User regular
  • iTunesIsEviliTunesIsEvil Registered User regular
    It makes me go all O_O that MS managed to only take up about 2MB with 1.1's and 2.0's source.

  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    wow that's pretty cool

    finally with this information I can complete my emulator of DOS/4GW

  • DehumanizedDehumanized Registered User regular
    It makes me go all O_O that MS managed to only take up about 2MB with 1.1's and 2.0's source.

    In memory 1.1 only occupies 12KB of space

  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    i call upon the C++ lords

    remember I asked about pointers and good allocation practice

    so SDL_Texture is an opaque type which can only be properly used via pointer...

    if I take the return value of an SDL function that returns SDL_Texture * and then envelop that in a smart_pointer... job done? or is there more to it

    i ask because textures returned by SDL functions seem to be occasionally leaky even if you delete them manually

  • mightyjongyomightyjongyo Registered User regular
    You mean something like this?
    void DoSomething {
      std::unique_ptr<SDL_Texture> texture(getSDLTexture()); //or the boost equivalent
      //do something with texture
    }
    

    Yea, that should clean up the SDLTexture pointer.

  • InfidelInfidel Heretic Registered User regular
    Jasconius wrote: »
    i call upon the C++ lords

    remember I asked about pointers and good allocation practice

    so SDL_Texture is an opaque type which can only be properly used via pointer...

    if I take the return value of an SDL function that returns SDL_Texture * and then envelop that in a smart_pointer... job done? or is there more to it

    i ask because textures returned by SDL functions seem to be occasionally leaky even if you delete them manually

    You still need to call SDL_DestroyTexture. You probably want to assign it as the custom deleter of your shared_ptr.

    OrokosPA.png
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
    ecco the dolphin
  • mightyjongyomightyjongyo Registered User regular
    that's what I get for posting when I don't actually know anything about SDL! heh.

  • ecco the dolphinecco the dolphin Registered User regular
    edited March 2014
    Infidel wrote: »
    Jasconius wrote: »
    i call upon the C++ lords

    remember I asked about pointers and good allocation practice

    so SDL_Texture is an opaque type which can only be properly used via pointer...

    if I take the return value of an SDL function that returns SDL_Texture * and then envelop that in a smart_pointer... job done? or is there more to it

    i ask because textures returned by SDL functions seem to be occasionally leaky even if you delete them manually

    You still need to call SDL_DestroyTexture. You probably want to assign it as the custom deleter of your shared_ptr.

    Yah

    So slightly modify mightyjongyo's code above:
    typedef std::unique_ptr<SDL_Texture, void ( * )( SDL_Texture * ) > txSDLTexture;
    
    void DoSomething {
       txSDLTexture texture( getSDLTexture(), SDL_DestroyTexture );
      //do something with texture
    }
    

    Works because SDL_DestroyTexture() happens to meet the function signature for a custom deleter perfectly - void SDL_DestroyTexture( SDL_Texture * ).

    Edit: Haha, ( * ) (without spaces) is (*)

    Late edit 2: I suppose you could use decltype to clean things up...?

    (untested)
    typedef std::unique_ptr<SDL_Texture, decltype( SDL_DestroyTexture ) > txSDLTexture;
    

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    SDL_DestroyTexture()

    that sounds pretty important. I should have probably known about that. Would explain why my font textures always leak, they are the only ones I have to constantly re-create (as people type)

    Thanks guys

    P.S. fuck it I am rolling my own SDL2 based GUI lib modeled after CocoaTouch

    Infidelecco the dolphin
  • bowenbowen How you doin'? Registered User regular
    So trying to do a exclusive match on a regex with phpmyadmin, does \b not work here?

    I'm trying to hide 'mysql' but there's a database "(something)_mysql" is there and gets hit on the regex for hide_db if I put in mysql there. Is there a special syntax I'm not aware of to pop the \b's in?

    Ladies.
  • SpawnbrokerSpawnbroker Registered User regular
    edited March 2014
    I love the null-coalescing operator (??) in C#. Just saved me sooooo much time with this financial event receiver I was writing.

    Spawnbroker on
    Battle.net: Spawnbroker#1471
    Steam: Spawnbroker
    Final Fantasy XIV: Spawn Broken
    Monkey Ball Warriorbowen
  • NightslyrNightslyr Registered User regular
    I hate it when docs lie. According to the Symfony docs, a form field matched to an image is supposed to return an UploadedFile object. Instead, I'm getting an array. Very annoying since the entity I'm working with expects an UploadedFile, and I can't change it to not expect one.

    PSN/XBL/Nintendo/Origin/Steam: Nightslyr 3DS: 1607-1682-2948
    Switch: SW-3515-0057-3813 FF XIV: Q'vehn Tia
  • undergroundmonorailundergroundmonorail single-track subway Registered User regular
    I love the null-coalescing operator (??) in C#. Just saved me sooooo much time with this financial event receiver I was writing.

    I just learned about it like 15 minutes ago! I was practicing for a programming competition on Friday and our team leader was like "hey you guys wanna see something neat".

    Woaaaah

    Pokémon X | 3DS Friend Code: 0490-4897-7688
    Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
    Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
    Spawnbrokerbowenqwer12
  • undergroundmonorailundergroundmonorail single-track subway Registered User regular
    Speaking of which, I'm totally going to a programming competition on Friday! I've never been to one before and it's super exciting.

    There are four people on our team, but we're only allowed one keyboard, so the general strategy seems to be "1 programmer, 2 guys working out algorithms and 1 guy spotting the programmer". Literally my whole job is watching the guy who knows what he's doing and hoping we don't brainfart at the same time :)

    Pokémon X | 3DS Friend Code: 0490-4897-7688
    Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
    Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
    Campy
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    i one time did a 48 hour ruby on rails competition with three guys I had never worked with before

    probably the worst 48 hours of my life

    Echoundergroundmonorail
  • EtheaEthea Registered User regular
    I love c/c++ !! trick, it is even better when a type has defined
    operator bool() const
    

  • KambingKambing Registered User regular
    I love the null-coalescing operator (??) in C#. Just saved me sooooo much time with this financial event receiver I was writing.

    Congratulations. You just used a monad (sort of) without realizing it! =D

    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
    Spawnbroker
1457910100
This discussion has been closed.