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:
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
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
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
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?
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.
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.
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 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.
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
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.
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
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
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.
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
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.
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!
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
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.)
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.
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.
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
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.
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?
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.
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.
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.
Posts
A bug with the 32 bit glibc not present in the 64 bit? Maybe out of memory issues?
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.
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?
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.
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.
What is your goal here? If you need to make 1.5+ compatible compiles, use "-target 1.5" with javac.
Ah. Well. Better fix that now.
http://stackoverflow.com/questions/152757/is-java-object-serialization-compatible-between-1-5-and-1-6
Serialize is meant for saving and loading local state, because it is not guaranteed to work in situations like the above.
Does this work for .jar files? I'd rather not place our source code into a demo.
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.
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.
e: Looks like this is the culprit: image = new ImageIcon(".\\images\\tact\\Contact\\M.jpg");
e2: Time to search and replace "\\" to File.separator
Yeah I wasn't thinking that far ahead when I made this design. File.separator seemed to fix it though!
It should, OSX is a unix variant so it makes sense.
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.)
new ImageIcon("./images\ test/tact/Contact/M.jpg");
Which is correct for Linux/OSX but fails on Windows.
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.
Ahah I hate that.
Blew the heap.
cmd+option+esc.
or ps aux | grep <process name> -- kill -9 <pid>
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).
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.
Can you clarify what you're trying to do and what the problem is?
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.