Options

PA Programming Thread: Arguing, Cursing, and Recursing

1246787

Posts

  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    urahonky wrote: »
    Infidel wrote: »
    urahonky wrote: »
    Hey guys I got my first programming job, and I start on Monday. I was wondering if there are any online tutorials or something that I can use to refresh my memory on Java. I've used it before many times, but I haven't used it for about a year and a half and I don't want to go into my job a complete noob.

    What have you been working with?

    This quarter it was SQL, the quarter before that I had MATLAB, the quarter before that it was Python, before that was OpenGL and Ruby and Scheme.

    I'd figure anything that covers database and swing/gui shit would be more than fine. You probably won't do much more than database driven apps.

    bowen on
    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
  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    edited March 2011
    Jimmy King wrote: »
    urahonky wrote: »
    Infidel wrote: »
    urahonky wrote: »
    Hey guys I got my first programming job, and I start on Monday. I was wondering if there are any online tutorials or something that I can use to refresh my memory on Java. I've used it before many times, but I haven't used it for about a year and a half and I don't want to go into my job a complete noob.

    What have you been working with?

    This quarter it was SQL, the quarter before that I had MATLAB, the quarter before that it was Python, before that was OpenGL and Ruby and Scheme.

    And what is the job? j2ee? Some sort of swing gui stuff? Back end libs? Android? What technology will you be working with. The good and bad thing about Java is that it's huge and has a ton of different stuff, so it's hard to recommend what to look up, beyond basic "intro to java" type stuff which probably won't be all that useful to you without knowing what it is you'll be working with.

    I'm not sure. I don't think I'll be working with GUI all that much, but again I'm not sure. The company is a data warehouse company, so I assume some SQL stuff. They told me Teradata and Java are the things I'll need to pick up or learn as I go. I'm okay with that.

    I guess I'd like to refresh my memory with stuff like abstracts and creating classes, and stuff like that.

    urahonky on
  • Options
    Jimmy KingJimmy King Registered User regular
    edited March 2011
    urahonky wrote: »
    I'm not sure. I don't think I'll be working with GUI all that much, but again I'm not sure. The company is a data warehouse company, so I assume some SQL stuff. They told me Teradata and Java are the things I'll need to pick up or learn as I go. I'm okay with that.

    I guess I'd like to refresh my memory with stuff like abstracts and creating classes, and stuff like that.
    Maybe start at Oracle's site about Java? There's a LOT of info there, it appears. I know when it was run by Sun they had a full online book (which was also available in print) that taught Java.

    There's a whole section about data warehousing stuff, too, so some of that might also be useful.

    Jimmy King on
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    Yeah stick to SQL, and swing then. You don't really need probably the swing even, as jimmy says.

    bowen on
    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
  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    edited March 2011
    Sounds good, I'll check it out! Thanks.

    urahonky on
  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited March 2011
    I very nearly did a "if success return true" statement today.

    Forgive me.

    Jasconius on
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Jasconius wrote: »
    I very nearly did a "if success return true" statement today.

    Forgive me.

    That's only bad if you have an "else return false"! :D

    Infidel on
    OrokosPA.png
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited March 2011
    Jasconius wrote: »
    I very nearly did a "if success return true" statement today.

    Forgive me.

    I still occasionally get confused by Ruby returning values by default if they're the last statement to be executed. Then I go "oh yeah" when I see a line with nothing but "foo == bar".

    Echo on
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    Jasconius wrote: »
    I very nearly did a "if success return true" statement today.

    Forgive me.

    Don't worry, we all do it occasionally.

    Then hurry and push another revision before someone notices.

    bowen on
    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
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    Also, I am excited to be getting my first mac in the next couple of weeks. Yay iPhone programming.

    bowen on
    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
  • Options
    EtheaEthea Registered User regular
    edited March 2011
    bowen wrote: »
    Also, I am excited to be getting my first mac in the next couple of months. Yay Instruments profiling tools.

    Ethea on
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    Wait, how did you know that?

    bowen on
    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
  • Options
    Jimmy KingJimmy King Registered User regular
    edited March 2011
    Echo wrote: »
    Jasconius wrote: »
    I very nearly did a "if success return true" statement today.

    Forgive me.

    I still occasionally get confused by Ruby returning values by default if they're the last statement to be executed. Then I go "oh yeah" when I see a line with nothing but "foo == bar".
    Perl does the same thing. I hate it when people do that. I prefer to be explicit about it even when I don't have to be (you might be asking why the hell I write Perl then right about now). It makes it more clear what is going on and less likely to break when I have to go back and make some changes later.

    Jimmy King on
  • Options
    Jimmy KingJimmy King Registered User regular
    edited March 2011
    grrrr. What am I missing with this Django view and modelForm?
    def add_version(request):
        content = get_object_or_404(Content, id=request.GET.get('content',None))
    
        version_id = request.REQUEST.get('version','')
    
        if version_id:
            version = ContentVersion.objects.get(pk=version_id)
            form = att_load_app_content_version_form(instance=version)
        else:
            version_count = ContentVersion.objects.filter(content__id=content.id).count() + 1
            form = att_load_app_content_version_form(initial={'content':content,'qiid': '%s-%s' % (content.name,version_count)})
            #This save here fails for some reason claiming that content.id cannot be null
            #form.save()
    
        if request.method == 'POST':
            #This bit here works just fine if I hit the button to save my form
            form = att_load_app_content_version_form(request.POST, request.FILES, instance=version)
            if form.is_valid():
                form.save()
                return HttpResponseRedirect('/att_app_load/view_versions/?content=' + `content.id`)
            else:
                return render_to_response(
                    'app_load/add_version.html',
                    {'content':content,},
                    context_instance=RequestContext(request))
    
    
        devices = Device.objects.all()
        return render_to_response(
            'app_load/add_version.html',
            {'content':content,
               'devices':devices,
               'form':form},
             context_instance=RequestContext(request))
    
    

    I want to save the form there if it's a new ContentVersion being created because I need the ContentVersion.id in my view. When I do form.save() it says that the content_id column in my contentversion table cannot be null.

    Why is it null? content has an id as I'm able to create the object ok. The value for qiid shows up correctly in my final output, which means that content.name is there and content.id must be there for i to get version_count. I also access content.id in the template and it's there.

    What silly little detail have I missed?

    edit: nevermind, figured it out, I guess. It seems that creating the form and passing the initial values to it and saving doesn't actually save the form to a new instance of the model. I needed to create an instance of the ContentVersion object first and then initialize a form with that instance of the model.

    Jimmy King on
  • Options
    ASimPersonASimPerson Cold... and hard.Registered User regular
    edited March 2011
    bowen wrote: »
    ASimPerson wrote: »
    General rant:

    So 3.5 years ago I got a laptop from my company that had a nice big 1600x1200 display.

    Now our highest resolution laptop is 1600x900.

    Good lord I hate widescreen displays.

    But you can write like you have two terminals side by side!

    But I could do that with a 1600x1200 display and display more lines in my file!

    ASimPerson on
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    edited March 2011
    ASimPerson wrote: »
    bowen wrote: »
    ASimPerson wrote: »
    General rant:

    So 3.5 years ago I got a laptop from my company that had a nice big 1600x1200 display.

    Now our highest resolution laptop is 1600x900.

    Good lord I hate widescreen displays.

    But you can write like you have two terminals side by side!

    But I could do that with a 1600x1200 display and display more lines in my file!

    You know what would be a nice experiment to try?

    Get one of those e-ink displays, and use that for a monitor.

    I mean, if we're going to be staring at a monitor for hours every day, might as well make it comfortable, right?

    The refresh rate would probably be a problem, though - although there might be 5 minutes of nostalgia - "Awwww... fades out like the old green monochrome CRTs!"

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited March 2011
    Who spent all day trying to make this shit

    someBlock = ^{
    someBlock();
    }

    actually work?

    This guy.

    Well. That example will work. My actual case was much harder. But hell on earth, as you see, there is zero debugging capabilities for Blocks in XCode 4. None. At all.

    Jasconius on
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    Hm. Yeah I can see that being a problem. Couldn't you just put that whole { } block into another method and get it to play nice with the debugger?

    bowen on
    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
  • Options
    EtheaEthea Registered User regular
    edited March 2011
    Woo, I am now a Qt Ambassador.

    Ethea on
  • Options
    Jimmy KingJimmy King Registered User regular
    edited March 2011
    Oh man, rm *>modified is a terrible, terrible typo of rm *.modified. I hope the rest of you don't have to learn that the hard way.

    Jimmy King on
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    edited March 2011
    Jimmy King wrote: »
    Oh man, rm *>modified is a terrible, terrible typo of rm *.modified. I hope the rest of you don't have to learn that the hard way.

    Unable to delete "modified" - file in use. But I did manage to delete every other file, like you requested!

    That is what you wanted, right?

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2011
    Ahahahahahah. Jimmy, it seems that both you and I hold the shift key for a little too long sometimes.

    I've done something VERY VERY similar before.

    [ed] Also, eeccccoo, I lol'd at that.

    iTunesIsEvil on
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    I've noticed I do this a lot.

    bowen on
    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
  • Options
    exisexis Registered User regular
    edited March 2011
    Full disclosure: this is homework.

    Figured this might be an appropriate place to ask. I'm working on making some sort of resource to enable high school teachers to teach CS-related stuff. I'm planning on doing something to explain the concept of intractability and NP-completeness (which will actually be a part of their curriculum next year). The first step is to find a bunch of other resources and evaluate what could be used at this level.

    I was just wondering if anyone here had seen some good explanations of this stuff. I'm hoping to track down videos/lecture slides of examples that aren't just formal proofs. More 'real-world' scenarios like the travelling salesman problem are great, but I'm trying to pull together as much stuff as I can.

    As an example, here's a video of my lecturer teaching primary school kids about finite state machines (obviously this is aimed at a slightly lower level ;-))

    exis on
  • Options
    Jimmy KingJimmy King Registered User regular
    edited March 2011
    The most annoying part of the accidental deletion is the code was not yet in git. It was a project that I started just to see if it might work. I decided today that it was definitely doable and a good idea and also realized I had a good bit of code, so that delete was actually me cleaning up the crap to get it ready to go into git. Argh. Should be able to have it all back up and running with just a couple of hours of work, though.

    Jimmy King on
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    *pours a 40 of coffee for Jimmy's code*

    Infidel on
    OrokosPA.png
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited March 2011
    Question, not really programming but maybe someone will know.

    I have a PC I use as a server, it's got a fairly old gentoo install on it. I discovered that the HttpRequest PHP module wasn't installed, so I went to download it, but there's no makefile that I can see. So another site tells me to go get this pear library to install it with and I did, but it's still not working (well technically on restarting apache to check I seem to have broken php completely, but that's something else.) So, any tips on getting it to install?

    Phyphor on
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Phyphor wrote: »
    Question, not really programming but maybe someone will know.

    I have a PC I use as a server, it's got a fairly old gentoo install on it. I discovered that the HttpRequest PHP module wasn't installed, so I went to download it, but there's no makefile that I can see. So another site tells me to go get this pear library to install it with and I did, but it's still not working (well technically on restarting apache to check I seem to have broken php completely, but that's something else.) So, any tips on getting it to install?

    You're trying to hack my Gibson, aren't you!

    Infidel on
    OrokosPA.png
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited March 2011
    Pfft, I don't need php for that!

    Phyphor on
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited March 2011
    Through copious rebuilding the problem has been fixed!

    Phyphor on
  • Options
    SnowblindvictimSnowblindvictim Flying casual Registered User regular
    edited March 2011
    I'm not going to ask you guys to do my work for me. But if you guys could help me here I'm a bit lost.
    Basically I'm given this in C.
    
    /*Enumerated type creates set of constants numbered 0 and upward */
    typedef enum{MODE_A,MODE_B,MODE_C,MODE_D,MODE_E} mode_t;
    
    int switch3(int *p1, int*p2,mode_t action)
    {
        int result = 0
        switch(action) {
        case MODE_A:
    
        case MODE_B:
    
        case MODE_C:
    
        case MODE_D:
    
        case MODE_E:
    
        default:
    
        }
        return result;
    }
    

    And I have to fill in the holes so that the assembly code looks like this
    
    1 .L17:                                             MODE_E
    2   movl     $17, %edx
    3   jmp      .L19
    4 .L13:                                             MODE_A
    5    movl   8(%ebp
    6    movl   (%eax), %edx
    7    movl   12(%ebp), %ecx
    8    movl   (%ecx), %eax
    9    movl   8(%ebp), %ecx
    10  movl   %eax, (%ecx)
    11  jmp     .L19
    12.L14                                             MODE_B
    13  movl   12(%ebp), %edx
    14  movl   (%edx), %eax
    15  movl   %eax, %edx
    16  movl   8(%ebp), %ecx
    17  addl    (%ecx), %edx
    18  movl   12(%ebp), %eax
    19  movl    %edx, (%eax)
    20  jmp     .L19
    21.L15:                                            MODE_C
    22  movl   12(%ebp), %edx
    23  movl   $15, (%edx)
    24  movl   8(%ebp), %ecx
    25  movl   (%ecx), %edx
    26  jmp     .L19
    27.L16                                             MODE_D
    28  movl   8(%ebp), %edx
    29  movl   (%edx), %eax
    30  movl   12(%ebp), %ecx
    31  movl   %eax, (%ecx)
    32  movl   $17, %edx
    33.L19:                                            default
    34  movl   %edx, %eax                      Set return value
    
    

    I'm running around like a headless chicken trying to figure how to even begin
    Any help would be much appreciated


    Hey guys, its me again. I don't think I've progressed enough with this and I am still in need of help.
    From my understanding this is what I have so far. If you guys could help me as to where this would
    go under each mode I'd greatly appreciate it. I swear to God I'm going to get this even if it kills me.
    
    28  movl   8(%ebp), %edx    Stores int *p1 in result
    29  movl   (%edx), %eax      Stores a pointer to result in eax
    30  movl   12(%ebp), %ecx  Stores *p2 in ecx
    31  movl   %eax, (%ecx)      Sets *p2 = *p1
    32  movl   $17, %edx           Falls through to Case E where it sets edx to 17.  
    
    

    Snowblindvictim on
  • Options
    Fantastication2Fantastication2 Registered User regular
    edited March 2011
    1 .L17:                                            MODE_E
    2  movl    $17, %edx      // edx = 17
    3  jmp      .L19          // break
    4 .L13:                                            MODE_A
    5    movl  8(%ebp         // eax? = p1
    6    movl  (%eax), %edx   // edx = *eax
    7    movl  12(%ebp), %ecx // ecx = p2
    8    movl  (%ecx), %eax   // eax = *ecx
    9    movl  8(%ebp), %ecx  // ecx = p1
    10  movl  %eax, (%ecx)    // *ecx = eax
    11  jmp    .L19           // break
    12.L14                                            MODE_B
    13  movl  12(%ebp), %edx  // edx = p2
    14  movl  (%edx), %eax    // eax = *edx
    15  movl  %eax, %edx      // edx = eax
    16  movl  8(%ebp), %ecx   // ecx = p1
    17  addl    (%ecx), %edx  // edx += *ecx
    18  movl  12(%ebp), %eax  // eax = p2
    19  movl    %edx, (%eax)  // *eax = edx
    20  jmp    .L19           // break
    21.L15:                                            MODE_C
    22  movl  12(%ebp), %edx  // edx = p2
    23  movl  $15, (%edx)     // *edx = 15
    24  movl  8(%ebp), %ecx   // ecx = p1
    25  movl  (%ecx), %edx    // edx = *ecx
    26  jmp    .L19           // break
    27.L16                                            MODE_D
    28  movl  8(%ebp), %edx   // edx = p1
    29  movl  (%edx), %eax    // eax = *edx
    30  movl  12(%ebp), %ecx  // ecx = p2
    31  movl  %eax, (%ecx)    // *ecx = eax
    32  movl  $17, %edx       // edx = 17, followed by implicit break
    33.L19:                                            default
    34  movl  %edx, %eax      // return edx            Set return value
    
    /*Enumerated type creates set of constants numbered 0 and upward */
    typedef enum{MODE_A,MODE_B,MODE_C,MODE_D,MODE_E} mode_t;
    
    int switch3(int *p1, int*p2,mode_t action)
    {
        int result = 0
        switch(action) {
        case MODE_A:
    		result = *p1;
    		p1 = *p2;
    		p2 = p1;
    		*p2 = p1;
        case MODE_B:
    		result = *p1 + *p2;
    		*p2 = result;
    		break;
        case MODE_C:
    		*p2 = 15;
    		result = *p1;
    		break;
        case MODE_D:
    		*p2 = *p1;
    		result = 17;
    		break;
        case MODE_E:
    		result = 17;
    		break;
        default:
    		;
        }
        return result;
    }
    

    That's my best guess. Looks a bit woobly in A, but I'm assuming there's a bit left off in line 5.

    Fantastication2 on
  • Options
    DaedalusDaedalus Registered User regular
    edited March 2011
    Hey, any POSIX gurus in the house? I've got a problem.

    I've got this hardware driver, we'll call it The Driver. It puts data in a big chunk of memory and then has a function that gives my code a pointer into this big chunk of memory.

    I've got this communication library. It gives me a pointer to a buffer where I put data, and then I can publish this data with a different function.

    I'd really love it if that buffer from the driver and that buffer from the library were actually pointing at the same piece of memory so I don't need to waste time with memcpy() over and over. I feel like this should be possible with mmap() or something but I don't know where to start.

    (No, I can't modify the driver or the library, and yes, I need to use them).

    Daedalus on
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited March 2011
    1 .L17:                                            MODE_E
    2  movl    $17, %edx      // edx = 17
    3  jmp      .L19          // break
    4 .L13:                                            MODE_A
    5    movl  8(%ebp         // eax? = p1
    6    movl  (%eax), %edx   // edx = *eax
    7    movl  12(%ebp), %ecx // ecx = p2
    8    movl  (%ecx), %eax   // eax = *ecx
    9    movl  8(%ebp), %ecx  // ecx = p1
    10  movl  %eax, (%ecx)    // *ecx = eax
    11  jmp    .L19           // break
    12.L14                                            MODE_B
    13  movl  12(%ebp), %edx  // edx = p2
    14  movl  (%edx), %eax    // eax = *edx
    15  movl  %eax, %edx      // edx = eax
    16  movl  8(%ebp), %ecx   // ecx = p1
    17  addl    (%ecx), %edx  // edx += *ecx
    18  movl  12(%ebp), %eax  // eax = p2
    19  movl    %edx, (%eax)  // *eax = edx
    20  jmp    .L19           // break
    21.L15:                                            MODE_C
    22  movl  12(%ebp), %edx  // edx = p2
    23  movl  $15, (%edx)     // *edx = 15
    24  movl  8(%ebp), %ecx   // ecx = p1
    25  movl  (%ecx), %edx    // edx = *ecx
    26  jmp    .L19           // break
    27.L16                                            MODE_D
    28  movl  8(%ebp), %edx   // edx = p1
    29  movl  (%edx), %eax    // eax = *edx
    30  movl  12(%ebp), %ecx  // ecx = p2
    31  movl  %eax, (%ecx)    // *ecx = eax
    32  movl  $17, %edx       // edx = 17, followed by implicit break
    33.L19:                                            default
    34  movl  %edx, %eax      // return edx            Set return value
    
    /*Enumerated type creates set of constants numbered 0 and upward */
    typedef enum{MODE_A,MODE_B,MODE_C,MODE_D,MODE_E} mode_t;
    
    int switch3(int *p1, int*p2,mode_t action)
    {
        int result = 0
        switch(action) {
        case MODE_A:
    		result = *p1;
    		p1 = *p2;
    		p2 = p1;
    		*p2 = p1;
        case MODE_B:
    		result = *p1 + *p2;
    		*p2 = result;
    		break;
        case MODE_C:
    		*p2 = 15;
    		result = *p1;
    		break;
        case MODE_D:
    		*p2 = *p1;
    		result = 17;
    		break;
        case MODE_E:
    		result = 17;
    		break;
        default:
    		;
        }
        return result;
    }
    

    That's my best guess. Looks a bit woobly in A, but I'm assuming there's a bit left off in line 5.

    A would be:

    result = *p1;
    *p1 = *p2;

    Which makes me suspicious that this isn't even compiler generated code, a compiler would be unlikely to do that, it would do:

    movl 12(%ebp), %ecx // ecx = p2
    movl (%ecx), %eax // eax = *ecx
    movl 8(%ebp), %ecx // ecx = p1
    movl (%ecx), %edx
    movl %eax, (%ecx) // *ecx = eax
    jmp .L19 // break

    instead


    edit: unless optimizations are turned off I suppose

    Phyphor on
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Daedalus wrote: »
    Hey, any POSIX gurus in the house? I've got a problem.

    I've got this hardware driver, we'll call it The Driver. It puts data in a big chunk of memory and then has a function that gives my code a pointer into this big chunk of memory.

    I've got this communication library. It gives me a pointer to a buffer where I put data, and then I can publish this data with a different function.

    I'd really love it if that buffer from the driver and that buffer from the library were actually pointing at the same piece of memory so I don't need to waste time with memcpy() over and over. I feel like this should be possible with mmap() or something but I don't know where to start.

    (No, I can't modify the driver or the library, and yes, I need to use them).

    Buffers are a good thing, you'll want to continue copying memory.

    Infidel on
    OrokosPA.png
  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited March 2011
    In my computer arch class last quarter, the correct answer to about half the questions was "a buffer".

    So this spring break, I want to implement as many sorting algorithms as I have time for. All I've done so far is call Go's standard library sort (a quicksort) for a baseline control, and a Radix sort, because I never could wrap my head around it before.

    As it is, I've been using a few KB of randomly generated uint64's. I'm thinking, maybe I should try to find a practical example of a large chunk of data that needs sorting. But where would I find such a thing?

    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
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    In my computer arch class last quarter, the correct answer to about half the questions was "a buffer".

    So this spring break, I want to implement as many sorting algorithms as I have time for. All I've done so far is call Go's standard library sort (a quicksort) for a baseline control, and a Radix sort, because I never could wrap my head around it before.

    As it is, I've been using a few KB of randomly generated uint64's. I'm thinking, maybe I should try to find a practical example of a large chunk of data that needs sorting. But where would I find such a thing?

    Make a name generator?

    bowen on
    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
  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited March 2011
    bowen wrote: »
    In my computer arch class last quarter, the correct answer to about half the questions was "a buffer".

    So this spring break, I want to implement as many sorting algorithms as I have time for. All I've done so far is call Go's standard library sort (a quicksort) for a baseline control, and a Radix sort, because I never could wrap my head around it before.

    As it is, I've been using a few KB of randomly generated uint64's. I'm thinking, maybe I should try to find a practical example of a large chunk of data that needs sorting. But where would I find such a thing?

    Make a name generator?

    Hmm, you mean actual names that are reasonable, not just random chars. Thats... an interesting challenge in itself.

    But what you are saying is that sorting strings is more common than sorting ints?

    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
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    I've dealt more with sorting strings than ints. They're practically the same thing in theory. Though comparing 4 bytes of memory to 4 bytes of memory is different than comparing 15 bytes to 25 bytes. And it's also why a lot of sorting/searching algos make copious use of hashing.

    bowen on
    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
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited March 2011
    I find that I do much more sorting for searching than pure sorting. Often, when I want something sorted, it's just easier to keep it sorted all the time.

    Phyphor on
This discussion has been closed.