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

Giant Programming Clusterfuck++

1474850525363

Posts

  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited October 2009
    Yeah, installing MSSQL (unless this is an Enterprise-level app) is a little over the top if you ask me.

    SQLite is a great idea though, and there's even a .NET wrapper for accessing it.

    iTunesIsEvil on
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    MKR wrote: »
    Infidel wrote: »
    MKR wrote: »
    Infidel wrote: »
    MKR wrote: »
    Use SQL if you can expect that your application will be used in environments where a knowledgeable person will be setting it up for users (workstation, server), and XML for environments where users are likely to be on their own.

    The former because it needs SQL server, and the latter because XML stuff is handled within the framework.

    You don't need knowledgeable users or separate servers to use SQL. Using SQL from the get go can be good because it's a standard way to access a database and allows your program to switch to a distributed / remote system much much easier than using XML ever will. (If you grow into multiple clients, you don't need to rewrite your application data layer, etc.)

    This is why things such as SQLite exist, they give you a setup-free (for the user) and lightweight means of working with SQL in a simple application. Or complicated application. If you use Firefox, you're using SQLite without even necessarily knowing about it.

    I was speaking specifically about .NET and MSSQL, which as far as I can tell is what he was asking about.

    How does that change anything with regards to "use XML instead of SQL"? That is what I'm addressing, because you make it sound like SQL is too heavy-handed and I'm pointing out alternatives that maybe be more suitable.

    Using SQL as a developer does not mean your users will be required to have special knowledge.

    If he uses MSSQL, his users would need to install MSSQL server.

    ...

    If he can just dump his data in XML local files, obviously he's not tied to MSSQL.

    So the saner option is to just stick with SQL but use something lightweight.

    Infidel on
    OrokosPA.png
  • MKRMKR Registered User regular
    edited October 2009
    Yes, I told him some options (XML included) as well as the pros and cons. I didn't think about SQLLite.

    I'm honestly not sure what you're getting at.

    MKR on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    Since we're all arguing about SQL now, I was hoping somebody could help me make a decision on how to implement file uploading to my site.

    Basically, I want each file to be renamed to a unique name (i.e. not keep its original name, and not have file name clashes) and have its data tracked in MySQL. My current setup is thus:
    1. HTML form uploads
    2. PHP Inserts a record into SQL
    3. PHP gets the auto increment number using mysql_insert_id, and moves the file from tmp_name to the uploads folder, using the ID as the file name
    4. PHP then updates the record with the final file path after renaming the file

    I'm trying to figure out a way to do this without updating SQL twice, but there appear to be no reliable methods to get the next auto increment ID before doing an INSERT.

    One alternative is to name each file with a timestamp + randomizer (maybe visitor's IP?), keeping the key and file name completely unrelated. However, the auto_increment feature just seems like a natural fit for what I want.

    So, does anyone have any advice? Is the extra update statement a negligible performance hit? Any obvious solutions I'm missing?

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    Why bother keeping the full filename in the database at all?

    If you are putting every file in the uploads directory, and the filename is the database key, then you can construct the full filename at any point. Storing the filename is redundant data and an unnecessary hindrance if you move your uploads folder.

    Infidel on
    OrokosPA.png
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    Infidel wrote: »
    Why bother keeping the full filename in the database at all?

    If you are putting every file in the uploads directory, and the filename is the database key, then you can construct the full filename at any point. Storing the filename is redundant data and an unnecessary hindrance if you move your uploads folder.

    The files can be of any type, and I need to know that in order to find it. I figured that if I needed to keep the file type around, I might as well have the whole file path too.

    Plus, having the file path precomputed gives me marginal efficiency gains that don't particularly matter. As someone who learned to code in C, this is a big deal to me! :lol:

    Edit:
    I realize I don't need the file extension in order to find it if I do the appropriate string manipulations, but that sounds a little unreasonable every time I do a lookup for a file.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    String concatenation is a better option over redundant storage and fetching of a column. :)

    I don't see how your filetype has anything to do with it, you can name it whatever you like on your server so long as you know how to find it again.

    A db tuple <3457,'myfile.doc'> can be known to be found at /home/www/uploads/3457 so you don't need to store it as <3457,'myfile.doc','/home/www/uploads/3457'>

    Infidel on
    OrokosPA.png
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    Infidel wrote: »
    String concatenation is a better option over redundant storage and fetching of a column. :)

    I don't see how your filetype has anything to do with it, you can name it whatever you like on your server so long as you know how to find it again.

    A db tuple <3457,'myfile.doc'> can be known to be found at /home/www/uploads/3457 so you don't need to store it as <3457,'myfile.doc','/home/www/uploads/3457'>

    I'm not sure what you mean by 'myfile.doc' as it relates to the file's type/name. Is that supposed to be a record of $_FILES?

    My relevant fields are: id (the auto_increment) and filepath (which is "$uploadDir/mysql_insert_id().$extension"). Are you saying I should just drop the extension entirely and let the user's browser figure out what type of file it is by naming my files as their auto_increment IDs with no extension?

    I assume it'll work on modern browsers, but it sounds impolite to send files without extensions. To Windows users, at any rate.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    templewulf wrote: »
    Infidel wrote: »
    String concatenation is a better option over redundant storage and fetching of a column. :)

    I don't see how your filetype has anything to do with it, you can name it whatever you like on your server so long as you know how to find it again.

    A db tuple <3457,'myfile.doc'> can be known to be found at /home/www/uploads/3457 so you don't need to store it as <3457,'myfile.doc','/home/www/uploads/3457'>

    I'm not sure what you mean by 'myfile.doc' as it relates to the file's type/name. Is that supposed to be a record of $_FILES?

    My relevant fields are: id (the auto_increment) and filepath (which is "$uploadDir/mysql_insert_id().$extension"). Are you saying I should just drop the extension entirely and let the user's browser figure out what type of file it is by naming my files as their auto_increment IDs with no extension?

    I assume it'll work on modern browsers, but it sounds impolite to send files without extensions. To Windows users, at any rate.

    This is the standard way that file uploads are handled by many webapps.

    myfile.doc is what the browser sends you. You store that. You also store the mime type typically.

    Because when you send the file back to a downloader, you say "this is the original filename and mime" and then fire off the data.

    At no point is the server-side filename relevant to the users. There is no reason to name it by filetype. The tmpname given to it is also just an id without extension. The point is to have a globally unique id, which your auto_increment already is, for each download so you don't have conflicts when two users upload "myfile.doc" or such.

    My database would look like:

    <27,'Camping.jpg','image/jpeg'>
    <28,'resume.doc','application/msword'>
    etc.

    and I'd simply have files under $UPLOAD_PATH named 27, 28, etc.

    Then if I move hosts, I don't have my site break because $UPLOAD_PATH changed.

    edit: here's the code that starts a download of character sheets on Orokos, just to illustrate why you don't need any special filename on the server-side
            $xmldata = $sheet['sheet_data'];
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename=' . $sheet_id . '.dnd4e');
            header('Content-Transfer-Encoding: binary');
            header('Content-Length: ' . strlen($xmldata));
            print($xmldata);
            exit();
    

    In this case, the data isn't even a file, it's just a blob in the database. Note that you have to specify the mime (Content-Type) and the filename you present it as manually. What file it is stored in doesn't matter on the server, even if it had an extension it wouldn't help you here. Typically you would just present back the original filename as uploaded, which is why I gave the example db records that way.

    Infidel on
    OrokosPA.png
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    Infidel wrote: »
    stuff

    Ah, I see what you're getting at.

    Where I have miscommunicated is omitting that I don't want the original file name relatable to the current file. I won't bore you with the requirements, but instead of "myfile.doc" I would store "5.doc" as a way of anonymizing it. Right now, it's at "uploads/5.doc", which I am fully aware is not the optimal situation. :lol:

    Thanks, Inf!

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    No problem. :)

    You should store it as $UPLOAD_PATH/id still, because as mentioned there is no reason to do otherwise really. Just give it a proper extension in the HTTP headers.

    Avoids possible exploits, although those are very unlikely if you know what you're doing. But sometimes people forget or make mistakes, and you get those stupid vulnerabilities (you check incoming data in like 99 places and miss one in the file uploading munger, woooops!) and then I upload See_The_New_Baby_0001.jpg/../../../../../../../../../etc/passwd and woooops I downloaded your important arbitrary file when I go to view it!

    Like I said, in this particular example it's rather unlikely someone would make this mistake, but I always watch out for needless usage of user input, especially when it comes to the filesystem. In complicated code you can miss something or not realize how the OS handles your filenames.

    Infidel on
    OrokosPA.png
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    edited October 2009
    clsCorwin wrote: »
    clsCorwin wrote: »
    Ok, can someone school me on reflection?

    The first rule of reflection club is: why do you want to use reflection?

    Because so far they've taught me nothing about it in school, I've come across the topic while doing a research paper and knew nothing about it, and finally...

    because it would make me a better programmer?

    The reason I asked is that as someone else in the thread said, there are a number of situations where reflection is exactly the right tool for the job and there are other situations where reflection is a hexeform compression rotation device and not every problem is a nut that needs tightened.

    The basic concept of reflection is this. Given an instance of a class (or indeed an instance of a class definition), you can use reflection to see what methods and properties the class has Depending on how powerful you languages reflection capabiities are you can then replace and modify those methods and properties on either a instance-by-instance or class-wide basis.

    Some awesome examples of reflection based programming are the *Unit family of unit-testing software. The use refection to exact and run all your tests by scanning the test case classes and extracting l methods that start with "test" and executing them. Simple, clean, elegant. Another fine example is Cmd.py in the Python standard library implements a generic command-line-interface, to add commands to the system you simple extend Cmd and add new methods called "do_cmdname" and when cmdname is typed in a the command line the class reflects upon it self and sees if it has a method named "do_cmdname" to execute. Simple, clean, elegant and pythonic.

    The important thing to know is that, like most programming concepts, there are very few problems that can be solved by reflection that can't be solved by some other approach and often reflection can lead you down the rabbit-hole of type unsafety & blatant hackery and at that point you may as well be passing function pointers around as void *'s in C and then where would we be? Back grunting around in the mud of computing prehistory, that's where? To start investigating reflection begin wit a language that is easy to do it in, Python is my recommendation but that's because Python is my recommendation for every problem that doesn' have raw execution speed as a constraint.

    Alistair Hutton on
    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • clsCorwinclsCorwin Registered User regular
    edited October 2009
    Ok, thanks. I'm learning Python as I go in an independent study of mine, so eventually I'll start playing around with reflection.

    Yea, I understand about not being able to use it everywhere, I just figured it'd be nice to know where I could possibly use it.

    I am enjoying Python though, absolutely love the tabbed defined block structure.

    clsCorwin on
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    edited October 2009
    clsCorwin wrote: »
    Ok, thanks. I'm learning Python as I go in an independent study of mine, so eventually I'll start playing around with reflection.

    Once you get a reasonable understanding of Python in thoroughly recommend reading the source code for cmd.py. When I did, I was enlightened.

    clsCorwin wrote: »
    I am enjoying Python though, absolutely love the tabbed defined block structure.

    You can split the world into two sorts of people - you're one of the good ones.

    Alistair Hutton on
    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    clsCorwin wrote: »
    I am enjoying Python though, absolutely love the tabbed defined block structure.

    You can split the world into two sorts of people - you're one of the good ones.

    I actually don't care for languages in which white space is significant. However, python keeps people from arguing about it, so it's better than most.

    For reference, whitespace is significant in the language I use at work. I warn you, this is not for the faint of heart:
    DO{+*(HP2)HPZ[pz]T["I",ppi]T[ppiD]^ppiD IF{*(HP2)HPZ[pz]T["I",ppi]T[ppiD]|4;
    *(HP2)HPZ[pz]T["I",ppi]T[ppiD]|0^pzT,
    PPA-*(HP2)HPZ[pz]T["A",pzT]P[pdi]|1^PPA}},
    IF{(&(HP)HPEG[peg]Q["A.AMT.SUP"]!&(HP)HPDY[pdy]Q["A.AMT.SUP"])&((ISTR<pzIO)!(ISTR<pzeIO)) ""^PPA},
    

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • ZackSchillingZackSchilling Registered User regular
    edited October 2009
    Is that Postscript?

    ZackSchilling on
    ghost-robot.jpg
  • MKRMKR Registered User regular
    edited October 2009
    That is the very structure of hell.

    MKR on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    Is that Postscript?

    I wish it were that competent.

    I've posted about it in previous programming threads, but I think this deserves a repost. The language is a descendent of MUMPS.

    Keep in mind, what I use now is actually an incremental improvement over MUMPS. God only knows what that code looked like.

    Oh, also, if you allocate more than 1024 bytes per session program, it crashes. kthxbai

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • clsCorwinclsCorwin Registered User regular
    edited October 2009
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    clsCorwin on
  • TriskaidekaphiliacTriskaidekaphiliac __BANNED USERS regular
    edited October 2009
    clsCorwin wrote: »
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    I would imagine serious programmers are mature enough to write code in readable forms on their own.

    We don't need entire languages built around this. God help you if you accidentally add in an extra space somewhere.

    Triskaidekaphiliac on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    clsCorwin wrote: »
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    I would imagine serious programmers are mature enough to write code in readable forms on their own.

    We don't need entire languages built around this. God help you if you accidentally add in an extra space somewhere.

    This is basically my stance.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • CmdPromptCmdPrompt Registered User regular
    edited October 2009
    templewulf wrote: »
    clsCorwin wrote: »
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    I would imagine serious programmers are mature enough to write code in readable forms on their own.

    We don't need entire languages built around this. God help you if you accidentally add in an extra space somewhere.

    This is basically my stance.

    To say nothing of the myriad of programs that will format code for you.

    CmdPrompt on
    GxewS.png
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited October 2009
    templewulf wrote: »
    clsCorwin wrote: »
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    I would imagine serious programmers are mature enough to write code in readable forms on their own.

    We don't need entire languages built around this. God help you if you accidentally add in an extra space somewhere.

    This is basically my stance.
    Said the man working with the unreadable code. :wink:

    You just dream about readable code, don't you Wulf?

    iTunesIsEvil on
  • LoneIgadzraLoneIgadzra Registered User regular
    edited October 2009
    I don't care about Python forcing good style, it's still pretty easy to write incomprehensible Python code. I just like it because I don't have to stare at five trillion curly braces. The language has an extremely high level of expressiveness with very little code, and I find it very easy to read. (So sick of Java and C# and typing five modifiers in front of every variable.)

    I don't know why people complain, I've done *a lot* of work in Python and never once had an issue with an extra space or whatever. (Or when I did it was fixed in like 5 seconds.)

    It's pretty easy to tell when you've done that too, though I will concede that, if there is a law that every language has to have *something* as ugly as STL errors in C++, whitespace errors are Python's version of this horror. But hey, if you can't understand the error chances are it's whitespace so it's not real hard to fix.

    LoneIgadzra on
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    edited October 2009
    clsCorwin wrote: »
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    I would imagine serious programmers are mature enough to write code in readable forms on their own.

    Oh sweet, sweet innocence.

    Alistair Hutton on
    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    clsCorwin wrote: »
    Oh God, you poor bastard.

    I like the tabbed block structure because it forces people to write their shit in a readable form, instead of one giant wall of text.

    Seriously, fuck those guys.

    I would imagine serious programmers are mature enough to write code in readable forms on their own.

    Oh sweet, sweet innocence.

    Well he's kinda right.

    The naive part is thinking you'll always be working with serious programmers in the wild! :lol:

    Infidel on
    OrokosPA.png
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    You just dream about readable code, don't you Wulf?

    Well, I miss the elegant readability of C++. Does that count?

    Also, I do appreciate how Visual Studio automatically formats in the "suggested" method so that you don't have every function different depending on who wrote it. <3 Visual C# Express

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • MKRMKR Registered User regular
    edited October 2009
    SharpDevelop does autoformatting as well. :D

    MKR on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited October 2009
    MKR wrote: »
    SharpDevelop does autoformatting as well. :D

    I decided to look up SharpDevelop, since I hadn't put any real research into it before. I read that it supports Boo, which I had never heard of before. Apparently, it's like the .NET version of Python!?

    *swoon*

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • ÆthelredÆthelred Registered User regular
    edited October 2009
    Okay, so I'm coming across this scenario a lot now. It applies to all programming languages, so I'll write it in pseudo-code:
    do
    {
        print ("Enter your selection: 1 for <x>, 2 for <y>.");
        int number = scan.Int;
    }
    while (number != 1 && number != 2)
    

    Simple scenario: user has to make a choice, loop bumps them back around to the beginning if they don't play nice. Now, with this, often you'd want the instructions to change after the user has failed. What's the best practice to do this? Is it simply to introduce a "has looped?" variable? Like so:
    do
    {
        boolean loop = false;
        if (loop)
        {
            print ("Please enter a number.");
        }
        
        print ("Enter your selection, 1 or 2.");
        int number = scan.Int;
        loop = true;
    }
    while (number != 1 && number != 2)
    

    That seems kinda clunky to me, but I can't think of any other way to do it.

    Æthelred on
    pokes: 1505 8032 8399
  • KrisKris Registered User regular
    edited October 2009
    I don't think that if statement would ever run, because you set the loop variable to false right before it each time. Maybe if you did the false initialization outside/just before the do-while loop.

    Kris on
  • EtheaEthea Registered User regular
    edited October 2009
    Æthelred wrote: »
    Simple scenario: user has to make a choice, loop bumps them back around to the beginning if they don't play nice. Now, with this, often you'd want the instructions to change after the user has failed. What's the best practice to do this? Is it simply to introduce a "has looped?" variable? Like so:

    bool badInput = True;
    while( badInput )
      {
      print ("Enter your selection: 1 for <x>, 2 for <y>.");
      int number = scan.Int;
      badInput = (number != 1 && number != 2 );
      if ( badInput )
        {
        print ("stop being a shit head.");
        }
      }
    

    Ethea on
  • ÆthelredÆthelred Registered User regular
    edited October 2009
    Yeah, I mucked up where I put the loop check. But is the principle correct? It just seems kinda ugly to me.. I mean, you quickly end up with stuff like:
    badInput = false;
    do
    {
        if (badInput)
        {
            // Detailed Explanation
            print ("I said, pick a number. Type in 1 or 2.");
        }
        else
        {
             // Initial Explanation
             print ("Enter your selection, 1 or 2.");
        }
         
        number = scan.Int;
    
        if (number == 1 || number == 2)
        {
            badInput = false;
        }
         else
        {
            badInput= true;
        }
    }
    while (badInput)
    

    Which seems a little verbose. I guess there's no easier way to do it.

    Æthelred on
    pokes: 1505 8032 8399
  • ecco the dolphinecco the dolphin Registered User regular
    edited October 2009
    You could do something like this?
    
    do
    {
      print ("Enter your selection: 1 or 2");
    
      inputSelection = readInput();
    
      switch(inputSelection)
      {
      case 1:
        functionToHandleInput1();
        break;
      case 2:
        functionToHandleInput2();
        break;
      default:
        print ("You've entered an invalid input!");
        break;
      }
    
    } while(1);
    

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • 12gauge12gauge Registered User regular
    edited October 2009
    Æthelred wrote: »
    Yeah, I mucked up where I put the loop check. But is the principle correct? It just seems kinda ugly to me.. I mean, you quickly end up with stuff like:
    badInput = false;
    do
    {
        if (badInput)
        {
            // Detailed Explanation
            print ("I said, pick a number. Type in 1 or 2.");
        }
        else
        {
             // Initial Explanation
             print ("Enter your selection, 1 or 2.");
        }
         
        number = scan.Int;
    
        if (number == 1 || number == 2)
        {
            badInput = false;
        }
         else
        {
            badInput= true;
        }
    }
    while (badInput)
    

    Which seems a little verbose. I guess there's no easier way to do it.
    
    inputRequest = "Enter your selection, 1 or 2."
    result = false
    do
    {
        // Initial Explanation
        print (inputRequest);
        inputRequest = "Please reconsider your choice, 1 or 2."
        number = scan.Int;
        if (number == 1 || number == 2)
             result = true;
    }
    while (!result)
    
    

    That way you can skip an if - no need to ever return to the first message.

    12gauge on
    davidoc0.jpg
  • StarfuckStarfuck Registered User, ClubPA regular
    edited October 2009
    So I don't know how many of you guys may work in Flex/Actionscript, and of that group how many may use the Cairngorm framework and out of that group, how many are doing Unit Testing, but fuck me, someone write an up-to-date consistent explanation please.

    I just spent all day, researching Flex Unit and Fluint, messing with Async calls and such nonsense.
    I ended up sticking with Flex Unit, although Fluint has some really nice features.
    If you happen to be one of the few, doing all of the above, here is a hint.
    CairngormEventDispatcher.getInstance().addEventListener( DistrictPropertyEvent.EVENT_ID, addAsync( listener, 3000, null, onFail ) );

    Use the CairngormEventDispatcher to try and capture the custom Cairngorm event. After this line, call that event, either by dispatching the event via a call from your View or directly. If your Command uses a Service in the Delegate, you'll probably need a short timer too.

    I don't suppose there are any Cairngorum Unit Testers in the house with some insight on how to tests when you rely on the model variables for a lot of code?

    Starfuck on
    jackfaces
    "If you're going to play tiddly winks, play it with man hole covers."
    - John McCallum
  • theparttimetheparttime Registered User regular
    edited October 2009
    I've got a problem that I've been working on all day. It asp.net gridview stuff.

    So I have a gridview that I databinded to a DataSet table with Microsoft Application Blocks. The DataSet is filled from a stored procedure that has arguments. I want to add a column to the gridview that will be a button or link that when clicked will update the record back in the database (update this record, record pulled by sending parameters to a stored proc or parameters in a sql update statment).

    My problem is that the solutions I found say to add a a button or link to the gridview by adding a datasource and commandfield to the gridview then making a deletecommand or updatecommand in the datasource, all in the markup. But doesn't this break the c# side of binding the dataset table to the gridview.

    So basically I'm asking how do you add a button to a gridview that is filled from a dataset, a button that'll take the records values as parameters and preferably be able to fire off a stored proc on the c# side. Hope that doesn't sound to confusing. and help would be appreciated, Thanks.


    woohoo. Think I found it. Amazing what the right google search will get you.
    http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23652810.html

    theparttime on
  • 101101 Registered User regular
    edited October 2009
    Is there a method in Java for checking if one string contains another, and then returning a boolean value?

    or possibly for checking if a string contains a char?

    101 on
  • InfidelInfidel Heretic Registered User regular
    edited October 2009
    101 wrote: »
    Is there a method in Java for checking if one string contains another, and then returning a boolean value?

    or possibly for checking if a string contains a char?

    indexOf

    Infidel on
    OrokosPA.png
  • 101101 Registered User regular
    edited October 2009
    ah thats what I need.

    In fact thats a much better way, as it should help with the next section as well, thanks.

    EDIT: Though how does that handle repeated characters if it returns the first index the character appears at in the string?

    101 on
This discussion has been closed.