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/
Options

PA Programming Thread :: PAdev.net - Need hosting for a service of yours? Check it out.

15960626465100

Posts

  • Options
    bowenbowen How you doin'? Registered User regular
    seabass wrote:
    So, I'm working on some C++ code for an upcoming conference, and I'm running up against a weird error that I'm having issues replicating. On some machines, when running our code, we get the following error:

    *** glibc detected *** ../../code-WORK/downward-4: invalid fastbin entry (free): 0x0921c120 ***

    That looks like a memory management error to me. I've got some object getting destructed multiple times perhaps?

    The difficulty in fixing it is that I can't reproduce the error on any machine I have access to, and the guy running the experiments for me doesn't have time to do debugging or the authority to give me access to the compute cluster. How should I narrow down where this is happening? Is this something I should be able to run down with valgrind?

    Near as I can tell, the main differences between my machines and the compute cluster are I'm running on a 64-bit system, and they're running 32's. Additionally, I'm using half a dozen flavors of linux, but none of them are Red Hat, which is what they've got set up.

    A bug with the 32 bit glibc not present in the 64 bit? Maybe out of memory issues?

    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
    BarrakkethBarrakketh Registered User regular
    bowen wrote: »
    Getting boost installed on OSX was a fun and interesting adventure. Trying to place the includes into the common search path from g++ proved fruitless so I just made an alias for it.

    So now when I type b++ locally I get:
    g++ -I/opt/local/include
    
    You could modify GCC's specs file (gcc -dumpspecs > /path/to/lib/gcc/triplet/version/specs) and add it to the search path that way. It may or may not involve some voodoo.

    Rollers are red, chargers are blue....omae wa mou shindeiru
  • Options
    bowenbowen How you doin'? Registered User regular
    Honkey : chmod +x thefile

    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
    Barrakketh wrote:
    bowen wrote: »
    Getting boost installed on OSX was a fun and interesting adventure. Trying to place the includes into the common search path from g++ proved fruitless so I just made an alias for it.

    So now when I type b++ locally I get:
    g++ -I/opt/local/include
    
    You could modify GCC's specs file (gcc -dumpspecs > /path/to/lib/gcc/triplet/version/specs) and add it to the search path that way. It may or may not involve some voodoo.

    Yeah I was trying that, I even tried CPLUS_INCLUDE or whatever it was. I got frustrated so I made an alias.. g++ vs b++ meh, alias works okay.

    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
    It was a chmod problem. Seemed to work. Thanks guys!

    Problem the second: The program is running in Java 1.6, and I need to run it in 1.5... NO idea how to change environment variables in Mac OSX (Lion) and get it to point to the right Java version. Any ideas?

  • Options
    bowenbowen How you doin'? Registered User regular
    They'd need to both be installed and you'd need to know where they are honky.

    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
    bowen wrote:
    They'd need to both be installed and you'd need to know where they are honky.

    I was afraid of that. Sighh... We're trying to support 1.5 with our program, but everything is 1.6... So when you run it in 1.6 it breaks.

  • Options
    bowenbowen How you doin'? Registered User regular
    I've include java binaries in the past and had a script go into a subdirectory to run ./java_runtimes/java ./myapp.java

    Or something like that in the past. Not sure why I did that, though. Probably breaks all sorts of rules.

    What exactly is breaking between the two?

    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
    bowen wrote:
    I've include java binaries in the past and had a script go into a subdirectory to run ./java_runtimes/java ./myapp.java

    Or something like that in the past. Not sure why I did that, though. Probably breaks all sorts of rules.

    What exactly is breaking between the two?

    From the sounds of it: since we serialize our Designs in 1.5, when you load them up in 1.6 they don't work.

  • Options
    InfidelInfidel Heretic Registered User regular
    urahonky wrote:
    It was a chmod problem. Seemed to work. Thanks guys!

    Problem the second: The program is running in Java 1.6, and I need to run it in 1.5... NO idea how to change environment variables in Mac OSX (Lion) and get it to point to the right Java version. Any ideas?

    What is your goal here? If you need to make 1.5+ compatible compiles, use "-target 1.5" with javac.

    OrokosPA.png
  • Options
    bowenbowen How you doin'? Registered User regular
    urahonky wrote:
    bowen wrote:
    I've include java binaries in the past and had a script go into a subdirectory to run ./java_runtimes/java ./myapp.java

    Or something like that in the past. Not sure why I did that, though. Probably breaks all sorts of rules.

    What exactly is breaking between the two?

    From the sounds of it: since we serialize our Designs in 1.5, when you load them up in 1.6 they don't work.

    Ah. Well. Better fix that now.

    http://stackoverflow.com/questions/152757/is-java-object-serialization-compatible-between-1-5-and-1-6

    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
    InfidelInfidel Heretic Registered User regular
    urahonky wrote:
    bowen wrote:
    I've include java binaries in the past and had a script go into a subdirectory to run ./java_runtimes/java ./myapp.java

    Or something like that in the past. Not sure why I did that, though. Probably breaks all sorts of rules.

    What exactly is breaking between the two?

    From the sounds of it: since we serialize our Designs in 1.5, when you load them up in 1.6 they don't work.

    Serialize is meant for saving and loading local state, because it is not guaranteed to work in situations like the above.

    OrokosPA.png
  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    Infidel wrote:
    urahonky wrote:
    It was a chmod problem. Seemed to work. Thanks guys!

    Problem the second: The program is running in Java 1.6, and I need to run it in 1.5... NO idea how to change environment variables in Mac OSX (Lion) and get it to point to the right Java version. Any ideas?

    What is your goal here? If you need to make 1.5+ compatible compiles, use "-target 1.5" with javac.

    Does this work for .jar files? I'd rather not place our source code into a demo.

  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    Yeah we know we need to change the way our designs are saved, unfortunately we haven't had the time. :( We had roughly 3 years worth of work piled onto our shoulders and it's all due this September.

  • Options
    bowenbowen How you doin'? Registered User regular
    -target 1.5 should produce compatible bytecode while using javac. I would suppose.

    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
    InfidelInfidel Heretic Registered User regular
    urahonky wrote:
    Yeah we know we need to change the way our designs are saved, unfortunately we haven't had the time. :( We had roughly 3 years worth of work piled onto our shoulders and it's all due this September.

    Yeah, it is unfortunate. You will just have to try to get it working with serialize.

    In theory the serialization in Java is supposed to be as agnostic as possible.

    In theory, Java I can just compile and run anywhere on a JVM without thinking about it.

    We know things really turn out when you're doing anything interesting though.

    It was always my experience that trusting serialize in any situation where you don't load it back into the same environment you saved it in will break on you somehow down the road. Serializing to a database seems like a good idea until someone upgrades their Java on one workstation and you didn't account for all the issues etc. I usually serialize myself now so at least it is predictable.

    OrokosPA.png
  • Options
    BarrakkethBarrakketh Registered User regular
    bowen wrote: »
    Barrakketh wrote:
    bowen wrote: »
    Getting boost installed on OSX was a fun and interesting adventure. Trying to place the includes into the common search path from g++ proved fruitless so I just made an alias for it.

    So now when I type b++ locally I get:
    g++ -I/opt/local/include
    
    You could modify GCC's specs file (gcc -dumpspecs > /path/to/lib/gcc/triplet/version/specs) and add it to the search path that way. It may or may not involve some voodoo.

    Yeah I was trying that, I even tried CPLUS_INCLUDE or whatever it was. I got frustrated so I made an alias.. g++ vs b++ meh, alias works okay.
    Probably could've appended it to the cc1plus spec.

    Rollers are red, chargers are blue....omae wa mou shindeiru
  • Options
    bowenbowen How you doin'? Registered User regular
    Yeah I serialize manually too because of issues like this. Though I have a feeling assuming an unsigned 32 bit integer across all x86 windows platforms may come back to byte me in the ass some day. :D

    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
    Barrakketh wrote:
    bowen wrote: »
    Barrakketh wrote:
    bowen wrote: »
    Getting boost installed on OSX was a fun and interesting adventure. Trying to place the includes into the common search path from g++ proved fruitless so I just made an alias for it.

    So now when I type b++ locally I get:
    g++ -I/opt/local/include
    
    You could modify GCC's specs file (gcc -dumpspecs > /path/to/lib/gcc/triplet/version/specs) and add it to the search path that way. It may or may not involve some voodoo.

    Yeah I was trying that, I even tried CPLUS_INCLUDE or whatever it was. I got frustrated so I made an alias.. g++ vs b++ meh, alias works okay.
    Probably could've appended it to the cc1plus spec.

    Probably but it was like 11:00 last night and I was pissy that my hello world example wasn't working.

    Guess I should've just used the fucking linode to compile and test but was lazy.

    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
    Is file handling different on a Mac vs Windows? I have a file that outputs to: "data/Demo/Demo/Contact" and I'm getting an exception when running in OSX saying that it's not a valid name.

  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    edited January 2012
    Dived deeper into the exception. Now I'm reading (when typing e.getLocalizedMessage()): failed to load image contents. Hmm...

    e: Looks like this is the culprit: image = new ImageIcon(".\\images\\tact\\Contact\\M.jpg");

    e2: Time to search and replace "\\" to File.separator

    urahonky on
  • Options
    bowenbowen How you doin'? Registered User regular
    The only thing that matters is endianness when loading binary files, but java should handle files the same way across all platforms. I say this tongue-in-cheek similar to how infidel said earlier.

    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
    DrunkMcDrunkMc Registered User regular
    If you're going to be going between different OS's you may want to use File.seperator instead of hard coding in \\ or /. I don't know if that bothers Macs like it can on UNIX.

  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    DrunkMc wrote:
    If you're going to be going between different OS's you may want to use File.seperator instead of hard coding in \\ or /. I don't know if that bothers Macs like it can on UNIX.

    Yeah I wasn't thinking that far ahead when I made this design. File.separator seemed to fix it though!

  • Options
    bowenbowen How you doin'? Registered User regular
    DrunkMc wrote:
    If you're going to be going between different OS's you may want to use File.seperator instead of hard coding in \\ or /. I don't know if that bothers Macs like it can on UNIX.

    It should, OSX is a unix variant so it makes sense.

    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
    InfidelInfidel Heretic Registered User regular
    urahonky wrote:
    Dived deeper into the exception. Now I'm reading (when typing e.getLocalizedMessage()): failed to load image contents. Hmm...

    e: Looks like this is the culprit: image = new ImageIcon(".\\images\\tact\\Contact\\M.jpg");

    e2: Time to search and replace "\\" to File.separator

    Also, as I think we discussed earlier, current directory will vary from OS to OS in how you ensure the relative paths are correct. Unless you're using a proper package/asset manager class that doesn't find resources by literal paths. (Which I would recommend for a project like this, which is multi-OS in nature.)

    OrokosPA.png
  • Options
    EtheaEthea Registered User regular
    You really need a resource class and a proper file string building class because I expect you don't properly handle the use case where a folder or file name itself contains a space and the following encoding happens:

    new ImageIcon("./images\ test/tact/Contact/M.jpg");

    Which is correct for Linux/OSX but fails on Windows.

  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    Infidel wrote:
    urahonky wrote:
    Dived deeper into the exception. Now I'm reading (when typing e.getLocalizedMessage()): failed to load image contents. Hmm...

    e: Looks like this is the culprit: image = new ImageIcon(".\\images\\tact\\Contact\\M.jpg");

    e2: Time to search and replace "\\" to File.separator

    Also, as I think we discussed earlier, current directory will vary from OS to OS in how you ensure the relative paths are correct. Unless you're using a proper package/asset manager class that doesn't find resources by literal paths. (Which I would recommend for a project like this, which is multi-OS in nature.)

    If I run the .jar file wouldn't that make it work the way I set it up in all OSs?

    Ethea: The file location is static because that's where the images I have are located. That code is just creating a design behind the scenes. So it shouldn't be a problem, right? Whenever a person selects an image the location is automatically saved into the Design.

  • Options
    bowenbowen How you doin'? Registered User regular
    Ethea wrote:
    You really need a resource class and a proper file string building class because I expect you don't properly handle the use case where a folder or file name itself contains a space and the following encoding happens:

    new ImageIcon("./images\ test/tact/Contact/M.jpg");

    Which is correct for Linux/OSX but fails on Windows.

    Ahah I hate that.

    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
    Is there something similar to ALT+CTRL+DEL for Mac? My program has crashed hard. :-/

    Blew the heap. :(

  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Wait, isn't the "\ " just a shell thing on linux?

  • Options
    admanbadmanb unionize your workplace Seattle, WARegistered User regular
    urahonky wrote:
    Is there something similar to ALT+CTRL+DEL for Mac? My program has crashed hard. :-/

    Blew the heap. :(

    cmd+option+esc.

    or ps aux | grep <process name> -- kill -9 <pid>

  • Options
    bowenbowen How you doin'? Registered User regular
    urahonky wrote:
    Is there something similar to ALT+CTRL+DEL for Mac? My program has crashed hard. :-/

    Blew the heap. :(

    Somewhere buried deep in the admin folder I think there's one. You can do a kill if you know it's pid (ps should tell you in command line).

    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
    Thanks guys.

    Turns out my images are much larger than the default heap size given. So I set it to 512 and it seems to not run into any issues yet.

  • Options
    agoajagoaj Top Tier One FearRegistered User regular
    How can I sort a JList so that the selection isn't pointing to the wrong item. There doesn't seem to be anyway to update the selection from the model interface.

    ujav5b9gwj1s.png
  • Options
    InfidelInfidel Heretic Registered User regular
    agoaj wrote:
    How can I sort a JList so that the selection isn't pointing to the wrong item. There doesn't seem to be anyway to update the selection from the model interface.

    Can you clarify what you're trying to do and what the problem is?

    OrokosPA.png
  • Options
    agoajagoaj Top Tier One FearRegistered User regular
    While editing object in the JList, I want the list to resort itself for any change. It does this now, but the selection index stays the same. I want it to follow the object to it's new sorted location.

    ujav5b9gwj1s.png
  • Options
    bowenbowen How you doin'? Registered User regular
    There's no built in procedure for that I don't think. When you resort your list, update the selected index?

    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
    InfidelInfidel Heretic Registered User regular
    agoaj wrote:
    While editing object in the JList, I want the list to resort itself for any change. It does this now, but the selection index stays the same. I want it to follow the object to it's new sorted location.

    So you have a single-selection list, and you can edit the currently selected item?

    Just find the index of your edited item and set it again yeah.

    OrokosPA.png
  • Options
    agoajagoaj Top Tier One FearRegistered User regular
    The problem is that it can't be done from the listmodel, because the model doesn't have access to the JList. I'm hacking it from all the methods that adjust the data, I'm just looking for a better more Java way.

    ujav5b9gwj1s.png
This discussion has been closed.