Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

M Bryan

Ranch Hand
+ Follow
since Jun 15, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by M Bryan

Hi,

I have a TreeView in JavaFX. The tree contains different nodes with different funcionalites, comparable to a file system tree. The nodes differ from each other (apart from name and IDs) in their icon and the entries in the context menu. When a node is opened, child nodes from the database are loaded and added to the opened node.

My question is now: What is an elegant design pattern for this problem? What I do now is having a big switch which creates all the entry objects:



This approach was fast to implement in the beginning. But now, as the number of different types grows, the class gets longer and longer since I have to offer the corresponding context menu and icon method for each type.

So, does anyone know a good design pattern for this problem?
6 years ago
Hi,

I am writing some kind of container in which I can load and run specific applications. The applications are loaded from jars at runtime. In the jars, there has to be one class that implements a common interface. Here lays the problem:

In Netbeans I hve three projects:
-ApplicationInterface (contains the common interface)
-ApplicationContainer (loads the jars and casts to the interface, contains a ApplicationInterface.jar)
-SomeApplication (contains logic and a class, that implements the interface from the ApplicationInterface.jar)

In the main class of the ApplicationContainer, the class from SomeApplication is loaded and cast to the interface. But then there is a ClassCastException, since Java thinks the interfaces differ, since they are from two jars, but I want them to be the same.

What can I do?
6 years ago
Hi,

I am currently working on styling my textfields and comboboxes, but there is a small problem.
I want both to have white border on default, a grey border when hovering them and a blue border when they are focused. This works quite well, but as soon as I start typing, they lose their border color respectivly it gets white again.

This is what my css looks like:



Thank you!
6 years ago
Hi,

On short notice, my boss told me he wants to be able to print various information shown by our program. We show data in tables and forms, but for layout reasons I cannot just print the visible area.
What he images is that the printed document does not look like our program, more as if he had printed a pdf.

What my problem now is, that I have n clue how to start. My first idea would be to create a template file which then is filled with the corresponding data. But what file format should I use? PDF? Excel? OpenOffice?

Thank you for any advice!
6 years ago
Hi,

I am developing a framework, where I have class that hold visible objects like tables. When an event occurs, I want other classes to be notified. I imagine it being used somehow like this:



But there are differnts questions that I ask myself:
  • Should the tableClass have a different method for each event type (double click, selection changed) that could happen?
  • Should the tableClass save every event type in one list and iterate through that list when the correspinding event occurs?
  • Some classes want to know which row has been selected, other only want to know the fact that something has happened. How do I cope with that? How should the object look like that the classes receive?


  • Thank you
    6 years ago
    Hi,

    I have a client/server system using a glassfish server. The client can order the server to do some calculations. While working, the server should send messages to the client telling it about its progress.

    What would be a recommended framework for that purpose?

    Thank you!
    6 years ago
    Hi,

    I have a Java application running on a VServer. It does some calculations for me and has run more than once longer than three weeks without any break.
    But since last week, the process gets killed by something external:


    root@myvserver:~$ java -jar myprogram.jar &
    [1] 9388
    [1]+ Killed java -jar myprogram.jar



    I am completly clueless what causes this kills. I have written to the support of my vserver, they told me they cannot kill specific processes, since for them the server is closed. In /var/log/ no log file tells that it has ended the process. I tried the program using different java version, it happens with every version.

    Can anyone give me a hint what to do? I am totally lost.

    Thank you
    7 years ago
    Hi,

    I have a VM which does some things. Since performce inside the VM is kind of bad, I want to host system to do some calculations.
    The program running in my VM should take a picture of the current screen and send that screenshot to the host system, which then should do some calculations. The screenshot should be taken every second and the program running in the host should start a thread everytine when it is receiving a screenshot.
    What is the easiest way to realize this?

    Thank you
    7 years ago
    That's a vry good point. I would have to call that method very very often. It's really better to create the images beforehand.
    Thank you
    7 years ago
    Hi,

    I have a grid with values and for represanting that values I want to draw an arrow. My code roughly looks like this:



    My value lie between 0 and 7, whereas 0 is representing north, 1 north-east, 2 east, ... 7 north-west.
    How can I paint my arrow in a way, that it represents the wanted direction?

    Thank you
    7 years ago
    Hi,

    I want to create a grid with (partially) random values. Lets say the grid looks like this:


    The other values should evolve from the values around them, whereas one value is fixed, like this:



    The change in value from one field to another should not be bigger than one, but should be randomly. E.g., in the bottom right field there is a 7. The field above has a 6, so it could be 5, 6 or 7. The field to the left has a 7, so the value could be 6, 7 or 8. Since 6 and 7 appear in both list, the value has to be either 6 or 7.

    Has anybody a good idea, how i could program this logic?

    Thank you!
    7 years ago

    Winston Gutkowski wrote:

    M Bryan wrote:The trees are saved in a database, with ID and parent ID.


    So you've already got a database then. Even more reason for using it as God (or is that Codd?) intended, I would have thought.


    What do you mean by God and Codd?
    7 years ago

    Winston Gutkowski wrote:

    M Bryan wrote:I can see your point. Our use cases are way bigger than just customer and names, everything is much more complex, which legitimates the file system.


    I'd be interested to see that justification in full, because it'd be the first time I've ever heard a claim that a flat file system is faster than a db substantiated.


    The trees are saved in a database, with ID and parent ID.
    7 years ago

    Jeff Verdegan wrote:First off, it sounds like a database might be a better choice than a file system.


    I can see your point. Our use cases are way bigger than just customer and names, everything is much more complex, which legitimates the file system.


    But if you're going to stick with the file system, then you definitely should NOT be writing code like node.getChild(56). That's just asking for all kinds of trouble.

    Define a layer to translate from meaningful names to those IDs. It might be an enum, so that you can do [/b]node.getChild(NodeId.NAME)[/b] or it might be some kind of mapping of Strings so you can do [/b]node.getChild("name")[/b] (which is more error prone but might also be somewhat more flexible) or just specific methods like node.getNameChild(). You may even implement one of these approaches on top of another.

    Which specific approach is right for your situation, I cannot say, but if you're not using consistent, meaningful, centralized names for these things, then you're doing it wrong.


    My suggestion was asking for nodes using a scheme like the package system in Java, it could be node.getChild("System.Groups.Customer.Name");.
    The thing is: All my coworkers are having an engineering background with chemistry or physics, when they are programming they are happy if everythings works. For other things I tried to convince them I tried to find sources in books that prooved my points. Is there any good source that helps me convincing them not to use IDs as an identifier?
    7 years ago