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!

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

17071737576100

Posts

  • KambingKambing Registered User regular
    Ethea wrote: »
    Kambing wrote: »
    Ethea wrote: »
    The next decade is going to be interesting as far as distributed computing is concerned. The last 40years we have spent making supercomputers look like single machines by depending on fat interconnects that allow any node to communicate with the entire system. The issue is that the meantime to failure on an exascale machine is boot time. With that in mind we can't rely on classic MPI parrelization, and the cloud framework isn't a drop in solution as we would never get sufficient speed using MPI on those type of nodes. The move to heterogenous computation is a start down the right path, but it really feels like we also need to push more of these issues down into the language. I have hopes that something like Julia can be one of the solutions.

    I'm not sure how Julia will turn out, but Erlang is a more mature effort on the front of language+runtime support for distributed computing.

    I haven' looked at erlangs performance with regards to vector operations and other forms of simd. Julia has me interested as it can target gpus once nvcc has the planned llvm backend.

    I doubt it's anything to write home about since Erlang is designed for general distributed systems rather than Matlab-style numerical computations. And I guess that's my problem with Julia. When I first read about it, it seemed like another language that's a wishlist of features without a clear purpose. But that's my general complaint about a lot of languages that come out nowadays.

    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
  • CantidoCantido Registered User regular
    edited April 2012
    A really nice grad student helped me with my non-binary enum tree today. Showed me some tricks I can do with enums. I don't know where I'd be without being able to ask for help. I wouldn't be becoming a 2nd Lt in two weeks, that's for sure.

    Cantido on
    steam_sig.png
  • seabassseabass Doctor MassachusettsRegistered User regular
    I wish the things I worked on weren't embarrassingly sequential. Being able to use the word parallel in a conference submission seems to guarantee acceptance.
    Kambing wrote: »
    Ethea wrote: »
    Kambing wrote: »
    Ethea wrote: »
    The next decade is going to be interesting as far as distributed computing is concerned. The last 40years we have spent making supercomputers look like single machines by depending on fat interconnects that allow any node to communicate with the entire system. The issue is that the meantime to failure on an exascale machine is boot time. With that in mind we can't rely on classic MPI parrelization, and the cloud framework isn't a drop in solution as we would never get sufficient speed using MPI on those type of nodes. The move to heterogenous computation is a start down the right path, but it really feels like we also need to push more of these issues down into the language. I have hopes that something like Julia can be one of the solutions.

    I'm not sure how Julia will turn out, but Erlang is a more mature effort on the front of language+runtime support for distributed computing.

    I haven' looked at erlangs performance with regards to vector operations and other forms of simd. Julia has me interested as it can target gpus once nvcc has the planned llvm backend.

    I doubt it's anything to write home about since Erlang is designed for general distributed systems rather than Matlab-style numerical computations. And I guess that's my problem with Julia. When I first read about it, it seemed like another language that's a wishlist of features without a clear purpose. But that's my general complaint about a lot of languages that come out nowadays.

    I think this is a result of people writing languages because they get upset with the limitations of what's out there and think "I can do better". I guess the better approach is to say "I want a language for X" and then build a language that is really good at that?

    Run you pigeons, it's Robert Frost!
  • EtheaEthea Registered User regular
    Haskell devs are also working on making matrix operations be Parallel tasks automatically. I can't find the presentation but it is great compiler research that looks interesting.

  • KambingKambing Registered User regular
    seabass wrote: »
    I wish the things I worked on weren't embarrassingly sequential. Being able to use the word parallel in a conference submission seems to guarantee acceptance.
    Kambing wrote: »
    Ethea wrote: »
    Kambing wrote: »
    Ethea wrote: »
    The next decade is going to be interesting as far as distributed computing is concerned. The last 40years we have spent making supercomputers look like single machines by depending on fat interconnects that allow any node to communicate with the entire system. The issue is that the meantime to failure on an exascale machine is boot time. With that in mind we can't rely on classic MPI parrelization, and the cloud framework isn't a drop in solution as we would never get sufficient speed using MPI on those type of nodes. The move to heterogenous computation is a start down the right path, but it really feels like we also need to push more of these issues down into the language. I have hopes that something like Julia can be one of the solutions.

    I'm not sure how Julia will turn out, but Erlang is a more mature effort on the front of language+runtime support for distributed computing.

    I haven' looked at erlangs performance with regards to vector operations and other forms of simd. Julia has me interested as it can target gpus once nvcc has the planned llvm backend.

    I doubt it's anything to write home about since Erlang is designed for general distributed systems rather than Matlab-style numerical computations. And I guess that's my problem with Julia. When I first read about it, it seemed like another language that's a wishlist of features without a clear purpose. But that's my general complaint about a lot of languages that come out nowadays.

    I think this is a result of people writing languages because they get upset with the limitations of what's out there and think "I can do better". I guess the better approach is to say "I want a language for X" and then build a language that is really good at that?

    Not to be elitist, but it's what you said and also the fact that most of them aren't PL people. So the language isn't built on solid foundations which becomes apparent in its one-off blemishes and lack of focus.

    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
  • Jimmy KingJimmy King Registered User regular
    I've been meaning to look at Akka for awhile now. It's the Scala and Java equivalent of Erlang's distributed concurrency stuff. Like so many things I want to play with though, I don't have any projects in mind to make use of them.

    import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.stringreturners.StringStringReturner;
  • templewulftemplewulf Registered User regular
    edited April 2012
    Not to bring down everyone's parallel computing buzz, but I was hoping somebody might have some advice on boring enterprise work.

    I'm doing SSIS for the first time, and I'm not sure how to make it do the things I would in a full on application or a stored procedure. Does anyone know the best way to get foreign keys (from dimension tables) that match records being imported into a fact table?

    E.g. what's the SSIS GUI's equivalent for this?
    SELECT customer_id FROM customer_dim WHERE stagedCustId = @stagedCustId
    

    templewulf on
    Friend me: Twitter | Google+
    Invite me: XBox Live | PS3 | Steam
    Link to me: Number Sorter | Achievement Generator
  • DrunkMcDrunkMc Registered User regular
    Cantido wrote: »
    A really nice grad student helped me with my non-binary enum tree today. Showed me some tricks I can do with enums. I don't know where I'd be without being able to ask for help. I wouldn't be becoming a 2nd Lt in two weeks, that's for sure.

    What tricks did he show you?

  • CantidoCantido Registered User regular
    edited April 2012
    DrunkMc wrote: »
    Cantido wrote: »
    A really nice grad student helped me with my non-binary enum tree today. Showed me some tricks I can do with enums. I don't know where I'd be without being able to ask for help. I wouldn't be becoming a 2nd Lt in two weeks, that's for sure.

    What tricks did he show you?

    My original programming assignment was going to use string arrays, and array lists of string arrays. At this thread's suggestion, I swapped it for enums. He showed me how to do iterative for loops with the enums (I know about iterative for loops, but didn't know I could get it to do an iterative loop on all the values contained within enums) so that making a non-binary tree according to all the values in each enum I made was automated. It went from a mangled recursive DFS to a really nice, recursive BFS. I saved my DFSing for displaying the tree properly.

    Cantido on
    steam_sig.png
  • urahonkyurahonky Registered User regular
    Guy at work told me that Sublime Text looks awful (the color scheme). I nearly broke his legs.

    Games completed recently: The Witcher, Resident Evil 4: HD Edition, Typing of the Dead: Overkill, Sleeping Dogs, Dishonored.
  • admanbadmanb the bored genie Seattle, WARegistered User regular
    urahonky wrote: »
    Guy at work told me that Sublime Text looks awful (the color scheme). I nearly broke his legs.

    The correct response. What's his preferred color scheme?

    twitter, github, resume/portfolio, if you like to play or host boardgames online, check out handtracker
  • urahonkyurahonky Registered User regular
    admanb wrote: »
    urahonky wrote: »
    Guy at work told me that Sublime Text looks awful (the color scheme). I nearly broke his legs.

    The correct response. What's his preferred color scheme?

    Looks like the standard Netbeans color scheme.

    Games completed recently: The Witcher, Resident Evil 4: HD Edition, Typing of the Dead: Overkill, Sleeping Dogs, Dishonored.
  • admanbadmanb the bored genie Seattle, WARegistered User regular
    Ew.

    twitter, github, resume/portfolio, if you like to play or host boardgames online, check out handtracker
  • zeenyzeeny Registered User regular
    edited April 2012
    Ok programming thread. It's slightly more complex, but let's simplify.
    A private array with a fixed number of elements.
    A getter and a setter.
    The getter accepts as an argument which element of the array you want and returns with a switch clause(whatever).
    The first element of the array is initialized to a value and the rest are set to bullocks.
    The only place where the second array element is initialized is if you call the getter with it as parameter.
    The only place where the getter is called with 2nd el as parameter is if you call it with the third el as a parameter.
    Tell me how chain setting like this is a valid design pattern and convince me there aren't at least 5 better ways to achieve the same goal.
    Winner gets my unconditional love.

    zeeny on
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Initializing on gets? Why not just do it all at once? Do you need to do real work to initialize this array?

  • zeenyzeeny Registered User regular
    Initializing all in the constructor will be computationally insignificant, but it is possible the values need to be refreshed during the lifetime of the array.
    Frankly, if you want to initialize in your getters with your pubic setters, I'll read your shit and move on.
    The fact that the second element is de facto initialized only from the getter of the thrid one bugged me out of proportion though. I want to see if I'm missing something obvious.

  • wildwoodwildwood Registered User regular
    zeeny wrote: »
    Ok programming thread. It's slightly more complex, but let's simplify.
    A private array with a fixed number of elements.
    A getter and a setter.
    The getter accepts as an argument which element of the array you want and returns with a switch clause(whatever).
    The first element of the array is initialized to a value and the rest are set to bullocks.
    The only place where the second array element is initialized is if you call the getter with it as parameter.
    The only place where the getter is called with 2nd el as parameter is if you call it with the third el as a parameter.
    Tell me how chain setting like this is a valid design pattern and convince me there aren't at least 5 better ways to achieve the same goal.
    Winner gets my unconditional love.

    If the array is just acting as a cache to save computational work, then this sounds like a standard memoizing approach to mathematical sequences like Fibonacci or factorials, where you have to calculate for state N-1 before you can get state N.

  • GnomeTankGnomeTank Registered User regular
    edited April 2012
    So I locked myself away for the entire weekend and finished up the grammar for my user friendly language I'll use for AI scripting in my engine.

    I don't have the ANTLR BNF handy, but I'll toss up a code sample of what it looks like. I learned more about ANTLR and LL* parsers this weekend than I probably ever wanted to know.
    function Add (a, b)
        return a + b
    end
    
    var _someScriptWideValue
    
    state Normal
        var _someStateWideValue
        message ReceiveDamage
            _someStateWideValue = Message.DamageValue
            _someScriptWideValue = true
    
            var someArray = ${ 1, 2, 3, 4 }
            var someHash = #{ "Key1" : 1, "Key2" : 2 }
            if _someStateWideValue > 0 then
                self.CastSpell(Spells.Heal, self)
            end
        end
    end
    

    It's sort of Ruby-basic-javascript-lite-esque. The syntax itself is actually very flexible. For instance, 'then' after an if is optional. And and Or boolean expressios can be expressed using they keywords 'and' and 'or', or the symbols '&&' and '||', respectively. Null can be expressed using 'null', 'nothing' or 'nil'. Just a super easy, flexible syntax. There are no OO definition constructs (no class), and no functional programming stuff (no lambdas or yield blocks). Trying to keep the language crazy simple for non-programmers, so I am erring almost completely to the side of "basic as possible, flexible syntax, does what is expected 90% of the time".

    So far all I have is the basic parsing structure, which outputs an AST, and the beginnings of static analysis of that AST (to catch errors that aren't parse related, such as unreachable code). I've also started on the code generation step, which I think is very cool. I am piggy backing completely on System.Linq.Expressions, which has facilities to express complete programming expressions in code. See http://msdn.microsoft.com/en-us/library/bb155837.aspx. The resulting code is JIT'ed when you call 'Compile' on the final expression, and runs at .NET native speeds.

    I find this much much suitable to my problem space than trying to force Lua on the problem. As awesome as Lua is, it's still written for real programmers, and has some constructs that make it less than ideal for a tightly controlled DSL.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • bowenbowen Registered User regular
    Anyone know of a batch way to conver the OSX .numbers file to CSV without having to use their export feature? Trying to make an automated processor for this.

  • Joe KJoe K Registered User regular
    GnomeTank wrote: »
    So I locked myself away for the entire weekend and finished up the grammar for my user friendly language I'll use for AI scripting in my engine.

    I don't have the ANTLR BNF handy, but I'll toss up a code sample of what it looks like. I learned more about ANTLR and LL* parsers this weekend than I probably ever wanted to know.
    function Add (a, b)
        return a + b
    end
    
    var _someScriptWideValue
    
    state Normal
        var _someStateWideValue
        message ReceiveDamage
            _someStateWideValue = Message.DamageValue
            _someScriptWideValue = true
    
            var someArray = ${ 1, 2, 3, 4 }
            var someHash = #{ "Key1" : 1, "Key2" : 2 }
            if _someStateWideValue > 0 then
                self.CastSpell(Spells.Heal, self)
            end
        end
    end
    

    It's sort of Ruby-basic-javascript-lite-esque. The syntax itself is actually very flexible. For instance, 'then' after an if is optional. And and Or boolean expressios can be expressed using they keywords 'and' and 'or', or the symbols '&&' and '||', respectively. Null can be expressed using 'null', 'nothing' or 'nil'. Just a super easy, flexible syntax. There are no OO definition constructs (no class), and no functional programming stuff (no lambdas or yield blocks). Trying to keep the language crazy simple for non-programmers, so I am erring almost completely to the side of "basic as possible, flexible syntax, does what is expected 90% of the time".

    So far all I have is the basic parsing structure, which outputs an AST, and the beginnings of static analysis of that AST (to catch errors that aren't parse related, such as unreachable code). I've also started on the code generation step, which I think is very cool. I am piggy backing completely on System.Linq.Expressions, which has facilities to express complete programming expressions in code. See http://msdn.microsoft.com/en-us/library/bb155837.aspx. The resulting code is JIT'ed when you call 'Compile' on the final expression, and runs at .NET native speeds.

    I find this much much suitable to my problem space than trying to force Lua on the problem. As awesome as Lua is, it's still written for real programmers, and has some constructs that make it less than ideal for a tightly controlled DSL.

    honestly, it doesn't look bad, but you really, really, really shouldn't be writing your own languages for something like this. ECMAScript is fine, hell make it ruby scriptable... just don't use your own shit. there's no gain to be had there. while my compiler course was fun, i have no desire to whack my hand with that hammer, and prefer to just use somethign out there that already works.

  • Joe KJoe K Registered User regular
    edited April 2012
    bowen wrote: »
    Anyone know of a batch way to conver the OSX .numbers file to CSV without having to use their export feature? Trying to make an automated processor for this.

    you know... i took a quick look, and it appears, that no, you're boned.

    Joe K on
  • bowenbowen Registered User regular
    Joe K wrote: »
    bowen wrote: »
    Anyone know of a batch way to conver the OSX .numbers file to CSV without having to use their export feature? Trying to make an automated processor for this.

    you know... i took a quick look, and it appears, that no, you're boned.

    It appears. I figured that maybe it was plain text... nope.

    Apparently .numbers files are hex based... plain text files. Yeah.

  • GnomeTankGnomeTank Registered User regular
    @Joe K: There is a ton to gain. Ruby and ECMAScript were written by programmers for programmers, they were not written to be stupidly simple and flexible for first time scripters and people playing a video game who just want to play in an AI sandbox. I don't even want the complex constructs in those languages available to my end users. This is why I am no longer using Lua for this, and rolled my own syntax. Even the presence of the Lua standard library breaks down my goals. Having to explain tables and metatables to a bunch of non-programmers is not high on my priority list.

    It's the basis of what a DSL is all about.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • InfidelInfidel Too easy. PiltoverRegistered User regular
    GnomeTank wrote: »
    @Joe K: There is a ton to gain. Ruby and ECMAScript were written by programmers for programmers, they were not written to be stupidly simple and flexible for first time scripters and people playing a video game who just want to play in an AI sandbox. I don't even want the complex constructs in those languages available to my end users. This is why I am no longer using Lua for this, and rolled my own syntax. Even the presence of the Lua standard library breaks down my goals. Having to explain tables and metatables to a bunch of non-programmers is not high on my priority list.

    It's the basis of what a DSL is all about.

    That setup is pretty much like the ZZT "OO" scripting I linked. Labels (states), messages, a script attached to an object (?). Not sure on that last one but it looks like it.

    That is much more noob friendly than ECMAScript.

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    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
  • GnomeTankGnomeTank Registered User regular
    Infidel wrote: »
    GnomeTank wrote: »
    @Joe K: There is a ton to gain. Ruby and ECMAScript were written by programmers for programmers, they were not written to be stupidly simple and flexible for first time scripters and people playing a video game who just want to play in an AI sandbox. I don't even want the complex constructs in those languages available to my end users. This is why I am no longer using Lua for this, and rolled my own syntax. Even the presence of the Lua standard library breaks down my goals. Having to explain tables and metatables to a bunch of non-programmers is not high on my priority list.

    It's the basis of what a DSL is all about.

    That setup is pretty much like the ZZT "OO" scripting I linked. Labels (states), messages, a script attached to an object (?). Not sure on that last one but it looks like it.

    That is much more noob friendly than ECMAScript.

    Function attached to an object. 'self' is basically the object the script you see is attached to. Since this will always be a "character" object, it will have a CastSpell function, most likely defined native side. There are no OO definition constructs like classes, but there is still basic dot notation for object access.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • InfidelInfidel Too easy. PiltoverRegistered User regular
    GnomeTank wrote: »
    Infidel wrote: »
    GnomeTank wrote: »
    @Joe K: There is a ton to gain. Ruby and ECMAScript were written by programmers for programmers, they were not written to be stupidly simple and flexible for first time scripters and people playing a video game who just want to play in an AI sandbox. I don't even want the complex constructs in those languages available to my end users. This is why I am no longer using Lua for this, and rolled my own syntax. Even the presence of the Lua standard library breaks down my goals. Having to explain tables and metatables to a bunch of non-programmers is not high on my priority list.

    It's the basis of what a DSL is all about.

    That setup is pretty much like the ZZT "OO" scripting I linked. Labels (states), messages, a script attached to an object (?). Not sure on that last one but it looks like it.

    That is much more noob friendly than ECMAScript.

    Function attached to an object. 'self' is basically the object the script you see is attached to. Since this will always be a "character" object, it will have a CastSpell function, most likely defined native side. There are no OO definition constructs like classes, but there is still basic dot notation for object access.

    Yep, that is precisely the "OO"-ness of the scripting I refer to.

    It makes all the management of OO go away. Just create a game object, attach code.

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    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
  • GnomeTankGnomeTank Registered User regular
    edited April 2012
    Pretty much yep. Even that part of it will be handled with a slick UI in the game menu. To edit a character's script will be one of the options, which will take you to the built in code editor (yes the game will have a built in code editor, with syntax highlighting, auto-complete, and real-time code analysis to point out syntax errors on the fly).

    If an AI script fails to compile or run, the game will silently fall back on the default UI script (which will be written in this, and visible to the user, though read-only) so that users can never "break" their party. It will also contain a combat simulator to test your scripts.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • bowenbowen Registered User regular
    @GnomeTank what was that .NET iphone thing you were looking into some time ago? I'm getting bored reading this obj-c book and just want to try some things.

  • InfidelInfidel Too easy. PiltoverRegistered User regular
    GnomeTank wrote: »
    Pretty much yep. Even that part of it will be handled with a slick UI in the game menu. To edit a character's script will be one of the options, which will take you to the built in code editor (yes the game will have a built in code editor, with syntax highlighting, auto-complete, and real-time code analysis to point out syntax errors on the fly).

    If an AI script fails to compile or run, the game will silently fall back on the default UI script (which will be written in this, and visible to the user, though read-only) so that users can never "break" their party. It will also contain a combat simulator to test your scripts.

    If you don't mind assistance on the scripting part, it's something of the game I could focus on and probably help with. Know a good bit about em and it wouldn't take up all my time heh.

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    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 Registered User regular
    Thanks brahskies.

  • GnomeTankGnomeTank Registered User regular
    bowen wrote: »
    @GnomeTank what was that .NET iphone thing you were looking into some time ago? I'm getting bored reading this obj-c book and just want to try some things.

    MonoTouch.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • GnomeTankGnomeTank Registered User regular
    Infidel wrote: »
    GnomeTank wrote: »
    Pretty much yep. Even that part of it will be handled with a slick UI in the game menu. To edit a character's script will be one of the options, which will take you to the built in code editor (yes the game will have a built in code editor, with syntax highlighting, auto-complete, and real-time code analysis to point out syntax errors on the fly).

    If an AI script fails to compile or run, the game will silently fall back on the default UI script (which will be written in this, and visible to the user, though read-only) so that users can never "break" their party. It will also contain a combat simulator to test your scripts.

    If you don't mind assistance on the scripting part, it's something of the game I could focus on and probably help with. Know a good bit about em and it wouldn't take up all my time heh.

    I might take you up on that at some point. I'll be open sourcing a lot of this (basically everything but my game data).

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • Mike DangerMike Danger "Diane..." a place both wonderful and strangeRegistered User regular
    admanb wrote: »
    "Dumb" questions are pretty much 90% of what this thread is for.

    When a User picks a major is that supposed to be an action that permanently (barring a later remove action) associates that user with that major? If so, you should have a database association between users and majors. A Sessions controller is a good thing to have, but you shouldn't be using it to handle actions involving majors or courses (I'm not 100% sure that's what you were suggesting, but it seemed like it). The Sessions controller should exclusively handle creating/updating/deleting sessions -- i.e. signin/signout.

    It sounds to me like what you want is to have a many-to-many relationship between majors and requirements, then you add the embedded resource to your router. Then if your user picked the major with id 3, the route would look like this:

    /majors/3/reqs/index

    with an edit action for a req with id 5 looking like

    /majors/3/reqs/5/edit

    for example.

    Other work kicked my ass, so I am finally getting back around to this.

    My thinking was that users don't have to sign in/out - they just go to the site, pick a major, click the courses they took, and they're done. Creating a whole account structure, sign in/out, seemed like a lot of work for little gain. I wasn't sure how to make Rails remember "okay, they clicked this on the last page, now take them here and remember that"

  • admanbadmanb the bored genie Seattle, WARegistered User regular
    edited April 2012
    Other work kicked my ass, so I am finally getting back around to this.

    My thinking was that users don't have to sign in/out - they just go to the site, pick a major, click the courses they took, and they're done. Creating a whole account structure, sign in/out, seemed like a lot of work for little gain. I wasn't sure how to make Rails remember "okay, they clicked this on the last page, now take them here and remember that"

    Well, what's the use case here?

    If a user is going to come to your site once, click through once and be done, you don't need to be saving anything anywhere. All of your relevant data can be passed via URL parameters. If a user clicks on major with id 3 they'll go to /majors/3 and do everything from there.

    If a user is going to expect to be able to come back later and find their data in the same state they left it, you need something harder than sessions.

    admanb on
    twitter, github, resume/portfolio, if you like to play or host boardgames online, check out handtracker
  • Mike DangerMike Danger "Diane..." a place both wonderful and strangeRegistered User regular
    The first one -- sad as it is, this project probably won't be around long enough for someone to worry about their data getting stored.

  • GnomeTankGnomeTank Registered User regular
    edited April 2012
    Here's the ANTLR BNF I promised for my Bliss langauge:
    Spoiler:

    This is a combined grammar, so the lexer and parser rules are in the same file. Anything with a name LIKE_THIS is a lexer rule. Name's likeThis are parser rules. Because of the way I do my grammar -> AST conversion, this is a very parser heavy grammar. The lexer does very little besides identify some lexer level constructs like strings and identifiers.

    In individual rules, everything to the right of the -> is the transform or rewrite grammar, and is basically what will appear in my AST for a successfully parsed fragment. Rewrite rules in ANTLR can be used for some really cool text transform stuff, using output=StringTemplate, but I am doing AST, so my output is an AST based on ANTLR's CommonTree. Essentially ANTLR takes my grammar and transforms it in to a machine process-able AST. That gets me to the point where I know there are no grammar errors. I then statically analyze and generate code from that AST. ANTLR actually has something called "tree grammars", where you can do all that static analysis and code generation in their BNF language, but that seemed way out of scope for the parser for me. I'd rather keep that code in hand-rolled C# and keep the ANTLR stuff specifically to lexing/parsing. The only block of static analysis you'll see in there is the scope depth check, and that's because I don't pass END on to the AST, so it would be harder to check in static analysis. Not impossible, just harder. So it's easiest to do simple scope depth checking at the parser level in this case.

    The BNF is not 100% complete. I am still missing inc/dec postfix operators, and there may be some gaps in the expression coverage I haven't fixed yet...but it's mostly a working language spec.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • InfidelInfidel Too easy. PiltoverRegistered User regular
    That grammar takes me back~

    TwitchTV channel: OrokosPA check.php?c=OrokosPA
    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
  • GnomeTankGnomeTank Registered User regular
    edited April 2012
    One other interesting thing in there is the 'k=3', which is actually the look ahead constant for LL* parsers. Do to the way they work, and the way my grammar is structured, I actually have to use a constant of 3, otherwise the parser pukes on certain rules which have similar keywords in similar orders. This is also an artifact of the parser being so parse heavy, with the lexer taking a light load. I could probably 'fix' it by removing all references to hard coded words in the parser and using lexer tokens exclusively, but this works for me, keeps the grammar simple to edit, and I see no reason that a k constant of 3 is hurting me. It also solves me from needing token pairs like FORKW and FOR, or FOR and FORNODE, to differentiate between lexer and AST tokens.

    If I were to go the lexer token route, it's likely I'd split the grammar in to separate lexer and parser files.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, D3: Brainling#1998, NintendoID: Brainling
  • Joe KJoe K Registered User regular
    admanb wrote: »
    "Dumb" questions are pretty much 90% of what this thread is for.

    When a User picks a major is that supposed to be an action that permanently (barring a later remove action) associates that user with that major? If so, you should have a database association between users and majors. A Sessions controller is a good thing to have, but you shouldn't be using it to handle actions involving majors or courses (I'm not 100% sure that's what you were suggesting, but it seemed like it). The Sessions controller should exclusively handle creating/updating/deleting sessions -- i.e. signin/signout.

    It sounds to me like what you want is to have a many-to-many relationship between majors and requirements, then you add the embedded resource to your router. Then if your user picked the major with id 3, the route would look like this:

    /majors/3/reqs/index

    with an edit action for a req with id 5 looking like

    /majors/3/reqs/5/edit

    for example.

    Other work kicked my ass, so I am finally getting back around to this.

    My thinking was that users don't have to sign in/out - they just go to the site, pick a major, click the courses they took, and they're done. Creating a whole account structure, sign in/out, seemed like a lot of work for little gain. I wasn't sure how to make Rails remember "okay, they clicked this on the last page, now take them here and remember that"

    alright, out of sheer coincidence, i've written the master schedule builder for the most widely used school admin software in the US. no, it's not exaggeration.

    what exactly are you trying to build? Student schedules? A "Master Schedule" in order to optimally place classes so that the most amount of student's get their selected classes? Both? Master schedule and student schedules?

    If you have a master schedule, a brute-force approach is what i've found most effective for student placement (spanning tree type searches, but be sure to set a reasonable dive limit). If you're trying to build a master schedule, the phrase "partially colored weighted graph" should already be a known animal to you, or you are in for an education that you probably weren't expecting.

  • Mike DangerMike Danger "Diane..." a place both wonderful and strangeRegistered User regular
    None of the above - I'm trying to build something that takes in a user's completed courses and gives back a list of progress towards the degree.

    I was going to post a question about database stuff, but I realized my problem! Variable names are important, kids.

This discussion has been closed.