SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'

19495969798100»

Posts

  • InfidelInfidel Heretic Registered User regular
    I almost always try to abstract out problems because half the time the very act of trying to express the problem abstractly makes me answer myself.

    Definitely, sometimes!

    But if not, then we're relying on the understanding of the person to relate the problem in an abstraction when that person presumably/often doesn't have a full understanding, hence why they're coming to others with problems. :rotate:

    And "show me your code" avoids a tedium of back and forth / abstract-answers-for-abstract-questions.

    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
  • bowenbowen How you doin'? Registered User regular
    Yeah I agree with infidel here on that.

    I'd rather see your code and see your example than the abstract stuff unless it's business critical/secret.

    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
  • InfidelInfidel Heretic Registered User regular
    The only exception to SHOW ME YOUR CODE and giving a direct answer is when it is school work.

    Then I will avoid code and dance you around in circles until you fall face-first into a pile of enlightenment.

    How bloody that process is varies.

    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
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited May 2012
    Well this IS schoolwork, but I'm pretty sure at this point I'm going above and beyond because I've always wanted to write this application. The absolute shit quality of most Point of Sale systems was in fact one of the motivations for me going into comp sci in the first place.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • InfidelInfidel Heretic Registered User regular
    There is a difference between schema and code.

    We're not needing to write SQL for you, but we kinda need to know the concepts you're working with. AKA schema.

    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
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited May 2012
    So I DO in fact need to allow partially null foreign keys, and here's why:

    A ticket will have multiple line items. Say a dude orders a large meat pizza with extra cheese and a large soda.

    Pizzas start off with a template, in this case the Meat pizza template, so they start of with normal cheese, bacon, etc.

    Soda, however, does NOT have a template. You can't customize soda. I might get more specific later on, say "Coca Cola" vs. "Sprite", but that's not customization, that's just different menu items. You can't get a Sprite with extra sugar.

    So the table that tracks the individual line items in a given ticket has to track the templates for menu items that are customizable, but not for ones that aren't. If I specifiy a template, though, I want to make sure it is one that actually exists for that menu item.

    So at this point my Ticket_items tables looks like
    CREATE TABLE Ticket_item (
        ticketid integer REFERENCES Tickets,
        line_num integer,
        itemid integer REFERENCES Menu NOT NULL,
        size_name varchar(32) NOT NULL,
        template_name varchar(32),
        quantity integer NOT NULL,
        FOREIGN KEY(itemid, size_name) REFERENCES Menu_size(itemid, size_name),
        FOREIGN KEY(itemid, template_name) REFERENCES Menu_template(itemid, template_name),
        PRIMARY KEY(ticketid, line_num),
        CHECK (quantity > 0)
    );
    

    And some dummy data that Postgres has no problem taking is
    INSERT INTO Menu VALUES
        (1, 'Pizza'),
        (2, 'Caesar Salad'),
        (3, 'Buffalo Wings'),
        (4, 'Soda'),
        (5, 'Breadsticks');
    
    ----- blah blah blah
    
    INSERT INTO Ticket_item VALUES
        (1, 1, 1, 'Large', 'Meatocalypse', 1),
        (1, 2, 4, 'Large', NULL, 1),
        (2, 1, 1, 'Large', 'Cheese', 2);
    

    So Ticket #1 has:
    1: Large Meatocalypse Pizza
    2: Large Soda

    EDIT: So here's my final schema and sample data. Now I get to try to prove it is in 4NF. YAY!

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • ecco the dolphinecco the dolphin Registered User regular
    edited May 2012
    bowen wrote: »
    ecco, I would have assumed that it would get the value of X pre assignment, that makes the most sense. The assignment on the left should be evaluated first, and then the action/logic on the right is performed.

    I can totally see how you'd think that - and I did rewrite the code so that it would behave as that.

    Unfortunately, I believe this is one of the areas where C's design decisions can accidentally trip up the programmer. It tries to leave enough behaviour undefined so that the optimising compiler has freedom to work... but that's bitten quite a few programmers. There's a whole set of "It runs under debug, but breaks under release!" bugs just related to that.

    Specifically, for equality, since assignment is *not* a sequence point, it means that the compiler is free to decide whether to evaluate the left expression first, the right expression first, or it could even interleave the two evaluations if it decided it was more efficient. But this freedom requires that the left expression and right expression be effectively independent of each other, which:

    pDest[ x ] = ++x;

    is not.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • urahonkyurahonky Dayton, OHRegistered User regular
  • bowenbowen How you doin'? Registered User regular
    Ah a vertical table, those are fun.

    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
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Ahh, the Intel manuals. They're rather good, but do you really need to know the guts of the processor / chipset?

  • bowenbowen How you doin'? Registered User regular
    He's trying to take off the edge of super crazy Java with intel tech manuals I see.

    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
  • urahonkyurahonky Dayton, OHRegistered User regular
    Hah, well I'm moving to a new project (sorta... Still have to finish the Java one, but my time is now split between the two) and we're going to be doing DMA scanning for malware and things like that through the hardware. Really interesting stuff. So I'm brushing up on my C and one of our contractors highly recommended the Intel manuals.

  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    Good news is that I think I can make my ER Model without lines crossing. That's something right?

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited May 2012
    Oh, that's pretty cool. Unfortunately for you though, any malware that's able to hide itself away from the OS can hide itself from everything if it tries hard enough on recent CPUs; ie HW can only access what the host explicitly allows it to, as enforced by the PCI root hub. Good luck though, it will at least work for older ones. What's your vector for getting in? Firewire?

    Phyphor on
  • InfidelInfidel Heretic Registered User regular
    urahonky wrote: »
    Hah, well I'm moving to a new project (sorta... Still have to finish the Java one, but my time is now split between the two) and we're going to be doing DMA scanning for malware and things like that through the hardware. Really interesting stuff. So I'm brushing up on my C and one of our contractors highly recommended the Intel manuals.

    Why does your job keep on having you chase your tail?

    It's always silly pipe dreams that won't deliver anything useful.

    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
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Also you're going to have to be very careful with a memory scan - you don't know what ranges are ram and what ranges are mapped device memory. Very Bad Things can happen if you try to scan device mapped memory. Also, since you're downstream from the root hub you can't even find out the configuration

  • DVGDVG Registered User regular
    Jimmy King wrote: »
    urahonky wrote: »
    Welp... I was down to around 25 known bugs as of last week. Then they let someone else test it... Now we're at 63.
    That's why just having the developer test the code is terrible. It used to happen all the time at my old job. I always tried to explain to them that I'm the developer, I'm biased and so at a disadvantage when testing. If I didn't already think it was correct I wouldn't have written it that way and I wouldn't be testing it yet. There are also things that you just don't even think to try because how it works is so engrained in your mind that you just know not to do X and it never crosses your mind that someone else might.

    This is why you should have a conversation with a tester before you start programming. They are hungry to break things, and will help you build something hard to break.

    Diablo 3 - DVG#1857
  • InfidelInfidel Heretic Registered User regular
    This is the old thread.

    Go to the new thread.

    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
This discussion has been closed.