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/

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

15657596162100

Posts

  • ASimPersonASimPerson Cold... and hard.Registered User regular
    Reminds me of LC-3, sorta

  • bowenbowen How you doin'? Registered User regular
    Anyone know of any good C libraries for MSSQL? Is there any even?

    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
  • IncindiumIncindium Registered User regular
    bowen wrote: »
    Anyone know of any good C libraries for MSSQL? Is there any even?

    I'm guessing you'd probably have to use ODBC?

    steam_sig.png
    Nintendo ID: Incindium
    PSN: IncindiumX
  • urahonkyurahonky Registered User regular
    Bahhhhh. I spent like 5 hours trying to setup the Transferable object for my DND, and for some reason the object isn't persisting. If I do:
    control = (Control)table.getValueAt(table.getSelectedRow(), 0);
    

    And then control.setIntegrated(true)

    it will set it as integrated.

    But when I do:
    control = (Control)dropEvent.getTransferable().getTransferData(DataFlavor.stringFlavor);
    

    And set it as integrated it doesn't stay integrated. Which means I can drag and drop it 100 times into the scene without a problem.

  • InfidelInfidel Heretic Registered User regular
    Isn't getTransferData returning a String object, since that's the flavor?

    Wouldn't you need a flavor for Control objects if you were trying to cast it straight to one?

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    It returns just a flat object of no type that still needs to be cast properly.

    So (Control) on a string cast will cause it to not work at all. Strings aren't controls.

    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
  • bowenbowen How you doin'? Registered User regular
    So yes, you're right infidel, and I apparently can't read this morning.

    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
  • TavTav Irish Minister for DefenceRegistered User regular
    in java, is there any inbuilt method that returns the amount of objects created or do I need to make my own counter for something like that?

  • bowenbowen How you doin'? Registered User regular
    http://pixelstech.net/article/index.php?id=1333969280

    Hahah.

    @Tav

    There isn't, you can get memory used and the like but not a specific amount of objects unless you keep track of it manually.

    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
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    Are you trying to do reference-counting, @Tav? I'm curious as to why you'd want to look at the count of objects you've instantiated/created.

  • InfidelInfidel Heretic Registered User regular
    Tav wrote: »
    in java, is there any inbuilt method that returns the amount of objects created or do I need to make my own counter for something like that?

    Your own classes only? Yeah, just static count that you increment manually works.

    OrokosPA.png
  • TavTav Irish Minister for DefenceRegistered User regular
    edited April 2012
    Are you trying to do reference-counting, Tav? I'm curious as to why you'd want to look at the count of objects you've instantiated/created.

    We're making what's pretty much a poker game and keeping track of the dealer using an int (which ever player's counter equals 0 is the dealer, 1 is little blind and 2 is big blind). At the moment it's hard coded for 4 players (At the start of the first round it's like p1 - 0, p2 - 1, p3 - 2, p3 - 4 and then at the start of the second round it's p1 - 1, p2 - 2, p3 - 3, p4 - 0...). I was wondering if there was some inbuilt in way to account for x players so it'd be like if (px = playerCount()) {dealerCount = 0}

    edit: There is probably a more efficient way to account for something like this, but this was the first thing I could think of so I'm running with it till someone yells at me for doing it wrong. Not much time for this project so it's functionality over elegance!

    Tav on
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    How are you planning on storing the variable number of players? You must be keeping them in some data structure that you can get length out of.

  • TavTav Irish Minister for DefenceRegistered User regular
    admanb wrote: »
    How are you planning on storing the variable number of players? You must be keeping them in some data structure that you can get length out of.

    I was hoping for some magical method I didn't know about where I could just be all "int players = ((getNumberOfInstances(computerAgent) + getNumberOfInstances(playerAgent));" but apparently this doesn't exist.

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Right... but how are you storing the players? I imagine when you had a fixed number you had something like
    Player p1 = Player.new();
    ...
    Player p4 = Player.new();
    

    but with a variable number you can't do that anymore.

  • TavTav Irish Minister for DefenceRegistered User regular
    admanb wrote: »
    Right... but how are you storing the players? I imagine when you had a fixed number you had something like
    Player p1 = Player.new();
    ...
    Player p4 = Player.new();
    

    but with a variable number you can't do that anymore.

    ah feck, you're right there. Screw it, hard coding it is :bz

  • InfidelInfidel Heretic Registered User regular
    Yeah, with variable number of players, the count comes first...

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    Why not use a list or array @tav ?

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    Infidel wrote: »
    Isn't getTransferData returning a String object, since that's the flavor?

    Wouldn't you need a flavor for Control objects if you were trying to cast it straight to one?

    It is actually pulling the control properly somehow. I literally cannot explain it, however. It's just that when I drag and drop it from the table into the scene it is creating a new control each time rather than using the control that already exist.

  • InfidelInfidel Heretic Registered User regular
    urahonky wrote: »
    Infidel wrote: »
    Isn't getTransferData returning a String object, since that's the flavor?

    Wouldn't you need a flavor for Control objects if you were trying to cast it straight to one?

    It is actually pulling the control properly somehow. I literally cannot explain it, however. It's just that when I drag and drop it from the table into the scene it is creating a new control each time rather than using the control that already exist.

    That doesn't sound proper to me. :rotate:

    It might have some bizarre connection with how Control has a string constructor, does Java do implicit conversion?

    i.e. If you have a string of "TextField" or such, does your cast somehow get transformed into Control("TextField")? I know C++ can do that.

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    edited April 2012
    That's what I was thinking too, infidel. I cannot find any supporting documentation for java though. And I'm suspecting the way urahonky stores the events for processing by functions other than the one that captured the event, it's creating some sort of nasty mangling.

    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
  • urahonkyurahonky Registered User regular
    Well it seems on our Table you can do:
    table.getValueAt(table.getSelectedRow(), 0);
    

    and that will return the control. Who knew!

  • urahonkyurahonky Registered User regular
    Sorta related question:

    Right now we have a WYSIWYGScene set as a singleton. Why? Because we had assumed there will ALWAYS ONLY be one scene at one point in time. Well now that we've got Tabbed Panes that won't be possible to assume. So now I'm stuck. We have 30 calls to "WYSIWYGScene.getInstance()". How will I be able to keep track of the "main" scene (ie the one that contains the window)? Create a Class that keeps track of it? Create an ArrayList in our Design Class that contains the scenes? I really don't want to break our program but it doesn't look like I can use a lot of the code that we have written already for Scenes (Which are inside the TabbedPanes) that aren't WYSIWYGScenes (which is our main program's scene).

  • bowenbowen How you doin'? Registered User regular
    You will have to rewrite it, you don't want to try and patch singleton design principles to a non-singleton system. Trust me. I know you'll try anyways but that was your warning.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    bowen wrote: »
    You will have to rewrite it, you don't want to try and patch singleton design principles to a non-singleton system. Trust me. I know you'll try anyways but that was your warning.

    Yeah that is what I'm thinking what I'm going to do. I just need to run it by the other developer because it'll break what he's working on too.

  • DrunkMcDrunkMc Registered User regular
    Doing some Android stuff, really neat so far. Lots of APIs built in, made a pretty interesting program that deals with GPS, MapViews, and a DB. Also some Canvas drawing. Very nice stuff. The GPS stuff is a bit more confusing then I think it should be, but overall pretty good.

    I made an APP that just logs where I go, (Should only log every 20mins, but its more like every second. The API isn't doing what I thought it would do) and plots the last N on the map. Eventually I'll have an export, and I'll export it to a PostGres +GIS DB and make some other visualizations for it. I think it'd be interesting to see what my steps have looked like for say the past year. I wanted it working intime for PAX East, but no go. :(

    The debugging on your own phone is pretty bad ass.

  • urahonkyurahonky Registered User regular
    I can't understand why the following line isn't working:
    layer = getControlLayer();
    

    When I debug it and highlight over getControlLayer() it has a value in it. But layer doesn't get the value. And ends up being null.

  • bowenbowen How you doin'? Registered User regular
    If you're on the current line on the debugger layer will be null until you step past it.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    bowen wrote: »
    If you're on the current line on the debugger layer will be null until you step past it.

    Yeah I keep getting a NPE. But now it looks like if I run getControlLayer().getClass() before I get to that spot I get a NPE. What the hell Netbeans??

  • urahonkyurahonky Registered User regular
    Oh I got it to work... It works... It finally works!

    Holy crap!

  • urahonkyurahonky Registered User regular
    I killed the thread. I'm sorry.

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    You dick!

  • urahonkyurahonky Registered User regular
    try{
      Thread.haveAwesomeTime(withEveryone);
       } catch (urahonkyPosts e){
       Thread.terminate();
        }
    

  • bowenbowen How you doin'? Registered User regular
    That's about right.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • InfidelInfidel Heretic Registered User regular
    When you post a lot you're gonna kill the thread eventually!

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    Java just severely depresses me honestly.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • InfidelInfidel Heretic Registered User regular
    Having the choice to continue to work with arbitrary databases and query code, or go work on a Java/Oracle stack big app, I choose sticking with the medical database fun times. Even if the pure coding side is meh.

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    What infidel said.

    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
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Java doesn't even have the Parallel Tasks library....newbs are still using raw threads and sync primitives. So 2005.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • bowenbowen How you doin'? Registered User regular
    That's what you get when you suggest the author modify his language.

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