|
The JDK has VisualVM. It's been the recent go-to Java profiler for us recently.
|
# ¿ May 13, 2010 22:07 |
|
|
# ¿ Apr 26, 2024 00:11 |
|
Any Eclipse RCP experts in here? At work, we're trying to migrate one of our applications to the Eclipse RCP framework. For the most part, it has gone well. But we're hitting some sticking points for what we want to do. 1) There is a large part of our system that, naturally, has nothing to do with the presentation side of things. However, we want to allow plugins to listen in on some of this stuff. Now, normally this would be easy: whatever class can just add a listener to our stuff. But, how is this accomplished in a plugin? How can a plugin get a reference to some system in the main application so that it can add a listener? Is the assumption that such a system would have a static access point? 2) Workbenches, perspectives, pages, views, editors, etc. Fun stuff, and seems to offer a lot of possibilities. We want to accomplish something specific with this that is, at the moment, looking like a brick wall of impossibility. Let's say we have the main application, which consists of a view on the left side, and an empty area on the right (a placeholder). Now, in the placeholder area, we'd like new "windows" (not necessarily floating - they could be tabbed pages, as in when that area is an editor area). But, these windows need to have views inside of them, and this is where our lack of experience in Eclipse RCP shines. Have no clue on how to do that. A window within our workbench that can have its own views - views that can only be arranged, docked, etc, within that particular window. Preferably through its own perspective. So: main window has a view and a placeholder area. Place holder area can have multiple windows, each window having its own perspective of editors and views. Possible? 3) Is there any really good place of information? We have some older books, and the java doc pages, and snippets that they have. But, for the most part, it feels like information about Eclipse RCP is just all over the place, and not very well organized with good examples.
|
# ¿ Jun 10, 2010 02:14 |
|
So, is that saying that if we want a plugin to listen to something external, then that external thing must also be a plugin (or, otherwise developed in the rcp way of things, whatever that may be)? For instance, let's say we have SomePackage.SomeClass in its own project. This SomeClass could be used as is in other programs simply by instantiating a new one code:
code:
I should have prefaced my last post with a "we are just beginning to learn Eclipse RCP and know nearly nothing" so, apologies for the near brain-deadedess of the questions. edit: For my first question, it looks like Extension Points is what we were looking for. Will have to put something on that to test it out. Hopefully resulting in me not having to follow up question #1, ha. Luminous fucked around with this message at 15:23 on Jun 10, 2010 |
# ¿ Jun 10, 2010 14:54 |
|
Yeah, this seems to be working out well. Was just a step to realize that making something into a plugin doesn't mean it can no longer be used externally. Now that we're adding extensions and extension points, this is making a lot more sense. I am still searching for a way to nest views and editors, as well as nesting a page in a page. The lack of information is leading me to believe this is impossible, which would be quite a shame as that changes our workflow concepts for the application But if you, or anybody, know of a way (preferably simple) to get views into other views, then I am all ears. edit: Or maybe I just want a new workbench window, which can have its own perspective. I just don't know. Luminous fucked around with this message at 20:05 on Jun 10, 2010 |
# ¿ Jun 10, 2010 19:53 |
|
TRex EaterofCars posted:I'm not a "view guy", really. I know enough to be dangerous but I don't know the limitations of Eclipse's perspectives and views. I think you need to get the right terminology down and you'll probably find what you need. Yeah, terminology is a bitch. I do have another question regarding my first question, though: we have hit a little snag, and are hoping it is just our implementation (based off of the example provided here http://www.vogella.de/articles/EclipseExtensionPoint/article.html). In that example, the plugin that handles the extensions loops through the extensions that implement the extension point. But, when it loops through, it is actually creating new instances. This means, for instance, trying to add a listener results in a listener being added, but for an instance of the extension that we aren't actually using. Hur. The createExecutableExtension method seems to be the culprit for this, but we do not see a getExecutableExtension (for instance) that will get already existing ones. Maybe that's not even possible, as is. So basically: Plugin 1 defines an extension point and creates implementation code to loop through all implementing extensions and do something with them through the appropriate extension interface. Plugin 2 defines some class that implements the appropriate extension interface. Plugin 1 calls the appropriate extension interface, but on a "local" instance instead of the instance explicitly created in Plugin 2. What? Luminous fucked around with this message at 21:31 on Jun 10, 2010 |
# ¿ Jun 10, 2010 21:27 |
|
Ugh, Eclipse RCP is making me feel like a drooling retard. Why can I not find a simple example of how to share data across plugins? I already have some classes that represent data and actions on that data, and want to create a plugin that can either (or both) display that data or trigger actions on that data. I would have assumed this is a fairly common thing, but every example is so basic that you can't go anywhere from there. The only thing I can assume is that for such behavior, plugins expect static access points/factories. I've no real problem with this, but I simply want a yay or nay on if this is standard practice or if there is a different way that plugins accomplish data sharing and interaction. Extension points are nice, but, they don't seem to provide what we're looking for and I am trying to figure out if I just need to shift my thinking and expectations even farther in order to get a grip on how Eclipse RCP wants things done. This would be helped immensely by a simple application that has views in plugins that interact with or display data from some other plugin. The simplest example I've found that works is RSSOwl, and, that is far from simple.
|
# ¿ Jun 11, 2010 16:09 |
|
magicalblender posted:Is it possible to make a decorator class that doesn't call super() on its superclass? While you've received other responses, I am going to throw out these two questions: 1) do you need to use a decorator pattern here? 2) does the base Widget class need to be doing all of that work?
|
# ¿ Oct 29, 2010 20:21 |
|
MariusMcG posted:Hopefully the good folks in this thread have helped you to find a short-term solution; but if you're still interested in this topic, there's a book called Java Concurrency in Practice that is (in my opinion) worth a read for anyone who's writing Java. Man, I saw the question, and starting reading the replies, just waiting, hoping, nobody would post this so that I could do so. This is a really great book for understanding threading issues in general, and getting a grip on what Java can provide to you.
|
# ¿ Jan 14, 2011 18:51 |
|
Malfeasible posted:in my mind in both scenarios Java is creating a String from data containing the '\n' character sequence You should verify that.
|
# ¿ Feb 5, 2011 18:07 |
|
Well, I don't know specifically an answer (never used), however, the documentation MimePart.getContent says that it always returns a subclass of MultiPart for objects that are a multipart type, which I assume your MimeBodyPart would be in this case.
|
# ¿ Mar 5, 2011 01:33 |
|
Kamakaze9 posted:Not quite what I wanted to do with it, but it will work and I'll use it unless I figure out how to accomplish my goal or at least how to better articulate it. Thanks for all the help. People are getting caught up on the array issue, and the fact that, in this case, the array index corresponds to an id. If, for instance, the Accounts were a Collection<Account> then 1) the idea that the array index happens to also be the account id disappears, and 2) people would probably be giving you ideas for searching that collection. For instance, the most basic search, a simple linear search, would be to just loop through every Account in your collection, checking if the id you're looking for is the same as the id of the account currently being evaluated. If it is, return that account. If not, continue on until all of the accounts have been evaluated - in which case, you go to your error case of asking the user to enter a valid account id.
|
# ¿ Mar 24, 2011 00:40 |
|
Red_Fred posted:Your guess was spot on that the elevator can only hold 4 people so the array is for 4 variables. However some of them will be null because it's up to the input as to what people are on what floor and if they need picking up etc. Should my loop be <= instead of < ? If null values are acceptable input (i.e., a single person in your person array) in your program, then yes, you need to make sure your program can appropriately handle that case.
|
# ¿ May 10, 2011 19:21 |
|
Aleksei Vasiliev posted:no it doesn't Ding ding. The simplest way to prove this to yourself is to move all of your print statements inside of the .getArray function, at which point you ought to see the behavior you are expecting. But encapsulation is pretty important if you want to ensure well functioning poo poo. Return a copy of the array.
|
# ¿ May 13, 2011 16:20 |
|
Has anybody encountered problems with JAXB between Windows and Linux? We have been using JAXB to read in a 3rd part XML file into java object representations (autogenerated from the schema by xjc). On Windows this seems to work perfectly. All data is present and accounted for in their appropriate objects. On Linux data is missing, but no errors are emitted using a ValidationEventHandler, and the JAXB content indicated it knows about the classes (using .toString). At a loss as to what the problem is.
|
# ¿ Jun 25, 2011 20:23 |
|
Paolomania posted:Any chance you are using an open-source non-Oracle JVM? Some Linux distros such as Debian use these by default and I have noticed some subtle differences. Good question, actually. I'll forward along the question to whoever setup the OS. But, on the other hand . . . things magically started working. I hate these types of problems. My first thought was that whoever did the build didn't update, but I did watch them update and deploy. And I watched the incorrect results. So, still at a loss and its equally concerning that it has started working properly.
|
# ¿ Jun 26, 2011 15:13 |
|
Aleksei Vasiliev posted:
Can doesn't mean they will. A simple example would be a task that uses a resource that can only be utilized by one thread at a time - using an executor of multiple threads with such a task wouldn't accomplish much. That doesn't seem to be the case here at first glance, although who knows what is going on in CrushTask. How are you verifying that all other threads are idle when one thread hits a "long image"?
|
# ¿ Jul 4, 2011 03:47 |
|
You should use waitFor if you want to block until the process ends, which is what your second method there is essentially doing, just in a roundabout way. If you need to consume the standard output (you probably should, as it can lead to blocks if you don't, unless you know pngout has no output) then 1) you should be consuming standard error as well and 2) you need to do this in a concurrent manner (read the stdout and stderr both from separate threads). Kicking off the stream reads should happen before the waitFor call. Here's some brief but extended reading: http://stackoverflow.com/questions/1088941/java-reading-standard-output-from-an-external-program-using-inputstream http://stackoverflow.com/questions/611760/java-inputstream-read-blocking Luminous fucked around with this message at 14:40 on Jul 4, 2011 |
# ¿ Jul 4, 2011 14:36 |
|
Aleksei Vasiliev posted:I can't use waitFor without consuming the entire stdout. If I call waitFor before that, then it will block forever. The pngout process will eventually go to 0% CPU usage and just sit there doing nothing until I terminate my program. But if I consume the stdout , then the thread will lock, hurting performance a lot. I know you had addressed waitFor before, but I think you need to re-look there. In particular, the first link I give has another link to an old article that shows one solution of how to empty stdout and stderror concurrently and in conjunction with waitFor.
|
# ¿ Jul 4, 2011 14:45 |
|
Hidden Under a Hat posted:Can you go into a little more detail about this and how to use it? I think the issue with my program locking up may be due to out of memory but I'm not sure. I'm using JFreeChart and have several graphs worth of data plotted every 1-5 minutes for several days. You can use the heapdump with something like http://www.eclipse.org/mat/ to see what your application has been up to and then beat it over its head until it behaves like you want.
|
# ¿ Jul 16, 2011 18:42 |
|
HFX posted:Using it for the method you describe cries that you should implement an interface that Instrument classes subclass to provide that method. It is considered bad form when you are using it to basically serve as the old dreaded C 200 line if..else if.. statement. Basically, used too liberally it can point to issues with design. You're right that its not always inappropriate, but I'd much rather people default to thinking it bad than not. The cases where it is used inappropriately (i.e., they created a poor design and aren't willing to fix it) seem to be far more widespread than appropriate uses. Luminous fucked around with this message at 17:56 on Aug 31, 2011 |
# ¿ Aug 31, 2011 17:53 |
|
MonsterUnderYourBed posted:simple question with the JDBC hooking into MySQL. Also a note, but I believe getting the last inserted keys is safe from other concurrent access so long as it is in the same transaction.
|
# ¿ Dec 20, 2011 19:50 |
|
Sylink posted:Sorry my typing is awful. I meant I wanted to compile things from a command line after writing whatever in a text editor. Not using EZ mode IDE. I think a better approach would be to tell us what you expect to gain by using just a command line, and then we could tell you whether or not what you expect is an accurate extrapolation of what will happen.
|
# ¿ Jan 19, 2012 01:39 |
|
You may want to consider an account as, well, just an account that has f.ex, a username and a role or a list of roles, where a role is an admin, a mod, or a schmoe (use inheritance here). Then serializing an account and determining which actual role objects need to be instantiated is more straightforward.
|
# ¿ Feb 3, 2012 22:38 |
|
Nothing is wrong with Eclipse. Some people just don't like certain IDEs.
|
# ¿ Mar 9, 2012 16:36 |
|
Nighttheii posted:This is probably too basic of a question, but I have an object class and method where RationalNumber is an object with the two int variables numerator and denominator. return new RationalNumber(numerator, denominator); However, understand that your logic modifies the value of the rational number you're using already. code:
I'd personally recommend eliminating that side effect so that first remains unchanged. This is accomplished by introducing local variables to the .add method, not modifying the class members for numerator and denominator, and then using those (the local variables) as the input for a new RationalNumber.
|
# ¿ Mar 11, 2012 23:38 |
|
Lord Of Texas posted:Have you never had to test code that depends on an external service? Mocks are extremely useful for when you are trying to actually create unit tests, and integration tests. I suppose they could be overdone, but at my shop they're underutilized. I think this is a big point, and if I recall, has been debated in this thread before. But the lack of understanding about the different types of testing that code can and should undergo can lead to excessive or improper use of helpful technology. Even in testing, it's still about using the right tool for the job - but you need to know what the job is first.
|
# ¿ Aug 26, 2012 21:32 |
|
Win8 Hetro Experie posted:Making things actually immutable is a lot more work than deciding not to mutate things that should be immutable. Making things immutable is easy and less work than deciding "I don't want this to mutate, so I won't mutate it" and hoping everybody else that uses your code one day knows what you were thinking or remembers all of your documentation on the issue. I don't really get why people find making things immutable difficult. It's literally CS101.
|
# ¿ Oct 17, 2012 14:48 |
|
|
# ¿ Apr 26, 2024 00:11 |
|
Fluue posted:That actually sounds like it would work for what I'm trying to accomplish. Coming from a PHP background, I'm still adjusting to strong typing and built-in classes. What do you think this.head = head and head = this.head actually do?
|
# ¿ Apr 13, 2013 15:26 |