|
supermikhail posted:Oh, right. The only condition I'd like to monitor is that the textfield shouldn't be empty on losing focus when the user selects another entry from the list. I don't need the program to panic each time I completely rewrite the text. Oh ok, i see now. Wouldn't it be better to have an "Edit" button besides the list that would popup a dialog with the item information that the user can fill/update? It would make checking for invalid entries much easier. And (I believe) it would be somewhat more user friendly, in the sense that it provides the user with a clear action that they must take in order to update the data. And if the only thing a user can do is update some text, JOptionPane provides an easy way to get a text only dialog. But i guess your way could work too, even if to me it sounds a bit clunky.
|
# ? Feb 28, 2014 00:45 |
|
|
# ? Jun 3, 2024 00:09 |
|
I had a dialog in the previous version, and that seemed too slow there. The entries can have a lot of information which could be hard to display in the list, but right now I can arrow down the list pretty fast and see the information in a side-pane. Most of the editing is pretty secure, only the textfield is a bit of a snag.
|
# ? Feb 28, 2014 01:32 |
|
supermikhail posted:I had a dialog in the previous version, and that seemed too slow there. The entries can have a lot of information which could be hard to display in the list, but right now I can arrow down the list pretty fast and see the information in a side-pane. Most of the editing is pretty secure, only the textfield is a bit of a snag. Could a JTable be of any help then? You do have editors in a table. And can reject data easily enough.
|
# ? Feb 28, 2014 03:31 |
|
I'm kinda stumped with a java project and could use some help. I've been moderately active in the Skyrim modding scene and stumbled into becoming the maintainer for a java API for manipulating skyrim plugin files. A number of other patchers have been written using this API and the problem is that when I fix a bug in the library the patcher authors have to rebuild and upload new versions of their programs. As its a hobby lots of patcher authors disappear from time to time so their patchers essentially stay broken. In the starter patcher project the library's jar is packed into the distributable jar. I assume its possible to change it so the library is external and the patcher can look in a specific place for it. Then when I fix a bug a user could just keep using their existing patcher jars and update the library. How would I go about doing this? I'm using netbeans if it matters. Also are there limits on what changes I can make to the library without breaking existing programs?
|
# ? Feb 28, 2014 04:28 |
|
Asking end-users to understand the process to the point where they suck a jar in the right place seems... messy. I don't think I understand the issue here well enough. Are you providing a library that modders include in their own projects? Or simply an interface that they interact with? Is there anything that would cause their projects to run worse after one of your bugfixes than it did before?
|
# ? Feb 28, 2014 05:15 |
|
Gravity Pike posted:Asking end-users to understand the process to the point where they suck a jar in the right place seems... messy. I don't think I understand the issue here well enough. The library is a java API to make programs that generate patches based on the other mods the user has installed. The program I got into it with is one that reads all the mod added weapons and armors and makes enchanted versions that match vanilla enchanted items (since doing it by hand is a huge pain and nobody does it). So no matter what mods a user has the patcher will create a tailored plugin for them. The library I've taken over maintaining handles reading and writing the actual plugin files and exposing the contents as java objects. The issue is the skyrim plugin files are rather sketchily understood so the library doesn't always do the right thing when a mod does something unexpected. I can fix the library but since its packed into each patcher a modder makes then those patchers have to be rebuilt for my fixes to apply. But modders come and go so quite a few patcher programs haven't been updated with bugfixes in over a year. Depending on the bug it means the patcher doesn't work at all if certain other mods are installed, or worse look fine but end up making corrupt plugins. Patcher programs are already at the high end of the user competency scale and require being installed in the right place anyway. It should be possible to make the patchers look for the library up one directory level and then in the /library/ folder or something, right?
|
# ? Feb 28, 2014 07:16 |
|
It might be worth looking at how other modding tools solve the same problem. WeiDU (used for modding Infinity-engine games), for example, when you install a mod, it checks the version of the modtool used against the version used to install any existing mods - and if they don't match, it reinstalls all the mods using the newest version of the modtool. It can even repack the new version of the modtool into the setup program for the older mods. It seems like that should in principle be possible here as well.
|
# ? Feb 28, 2014 15:48 |
|
Compatibility is tricky and a big topic. Oracle has documentation explaining binary compatibility in Java, but this Eclipse wiki article Evolving Java-based APIs 2 goes really into the details. See also part 1 for a more general discussion of what compatibility looks like from both an API client's point of view and the API provider's viewpoint.
|
# ? Mar 3, 2014 19:29 |
|
This thread is huge so apologies if this has already been covered but, has anyone ever had any luck re-configuring log4j to behave differently on a pre-built jar? It would look something like this:code:
code:
code:
Is this even doable, or am I going to have to bake socket logging into the application? Thanks for any thoughts.
|
# ? Mar 6, 2014 01:07 |
|
My Rhythmic Crotch posted:This thread is huge so apologies if this has already been covered but, has anyone ever had any luck re-configuring log4j to behave differently on a pre-built jar? It would look something like this: Does the jar have a log4j configuration file in it? I would just extract what's in there, change what you want, then repack the jar with the new file. Or you should be able to do it programmatically, which I've only done minimally before but I know the documentation is decent enough for that. edit: Also, I've never done socket logging, so I'm not sure about anything related to that.
|
# ? Mar 6, 2014 02:45 |
|
Does anyone know of a good Java based email server that integrates well with Eclipse and outputs sent emails as a .html file, rather than a serialized .jmsg? We currently use JES, which is fantastic for all intents and purposes, but I've found it annoying to have to run a self-made script every time I want to convert an email from .jmsg to .html. If there's something out there that is similar in functionality but outputs .html that would be fantastic.
|
# ? Mar 6, 2014 03:23 |
|
Kilson posted:Does the jar have a log4j configuration file in it? I would just extract what's in there, change what you want, then repack the jar with the new file.
|
# ? Mar 6, 2014 16:28 |
|
My Rhythmic Crotch posted:Well, I am a huge dummy, the application is not using log4j Is it using the even more awesome logback? However, I think by default both look jar local before looking at the local directory.
|
# ? Mar 6, 2014 17:16 |
|
Max Facetime posted:Compatibility is tricky and a big topic. Oracle has documentation explaining binary compatibility in Java, but this Eclipse wiki article Evolving Java-based APIs 2 goes really into the details. See also part 1 for a more general discussion of what compatibility looks like from both an API client's point of view and the API provider's viewpoint. Ugh. That's a mess but thanks for the info.
|
# ? Mar 6, 2014 18:37 |
|
HFX posted:Is it using the even more awesome logback? However, I think by default both look jar local before looking at the local directory.
|
# ? Mar 7, 2014 05:28 |
|
Hey guys, ages ago I tried making a really involved game but due to my lack of experience/knowledge I could never work out how to manage memory correctly (trying to track millions of integers and strings, it turns out that quickly turns into gigs of ram when you don't save it to the hard disk and load when needed :P). At the time I just abandoned it because the only way I knew how to store data was in text files. I decided to give another crack at it after I've worked on some simpler crap and I've realised I could just use a database like any business would. I found JDBC and it looks ideal, but I'm a little confused by how it works. If I use MySQL or Java DB, will it just work normally when I distribute the JAR to windows/linux/mac computers or will I need to include something? And is one better than the other, or are they both the same. I hope this isn't too dumb of a question, I'm still pretty new when it comes to Java/Programming in general.
|
# ? Mar 7, 2014 13:30 |
Lord Windy posted:Hey guys, ages ago I tried making a really involved game but due to my lack of experience/knowledge I could never work out how to manage memory correctly (trying to track millions of integers and strings, it turns out that quickly turns into gigs of ram when you don't save it to the hard disk and load when needed :P). At the time I just abandoned it because the only way I knew how to store data was in text files. I'd go with SQLite if you want an easy to distribute self contained database to use in your application. I think it's sort of the de facto standard for this kind of thing.
|
|
# ? Mar 7, 2014 19:24 |
|
Lord Windy posted:Hey guys, ages ago I tried making a really involved game but due to my lack of experience/knowledge I could never work out how to manage memory correctly (trying to track millions of integers and strings, it turns out that quickly turns into gigs of ram when you don't save it to the hard disk and load when needed :P). At the time I just abandoned it because the only way I knew how to store data was in text files. Are you really sure that the game absolutely requires installing a database on client machines? That's probably going to have some drawbacks, although I guess I'm not sure of how minor you can make a DB install. Still, seems like overkill. Could you do it server side? Why millions of integers and strings? I mean if Skyrim or Dwarf Fortress gets by without a database I don't know why you'd have to have one, unless you're making a simulation. That said, yeah, JDBC should just talk to MySQL (though you'll have to use the mysql configuration stuff) but you'll have to have MySQL running as a service and everything on the target machine. Zaphod42 fucked around with this message at 22:40 on Mar 7, 2014 |
# ? Mar 7, 2014 22:36 |
|
LtSmash posted:Ugh. That's a mess but thanks for the info. Yeah. Always adding to an API and never taking out or changing anything that's been out in the open for some time is reasonably safe if you also test that old no-longer maintained dependent projects don't break, but since you are also in essence a consumer of these old projects' "APIs" it starts getting interesting. You may be looking at providing one customized version of the library per each misbehaving plugin. This doesn't have to be as bad as it sounds! These one-off versions don't have to be public APIs you have to maintain, because they don't provide anything that the real public API doesn't already provide. This frees you to do things that you couldn't do with the public API. At the extreme one such version could contain a complete recompiled version of the plugin it targets, even.
|
# ? Mar 7, 2014 22:44 |
|
Zaphod42 posted:Are you really sure that the game absolutely requires installing a database on client machines? That's probably going to have some drawbacks, although I guess I'm not sure of how minor you can make a DB install. Still, seems like overkill. Could you do it server side? Why millions of integers and strings? I did not realize that I had to install a database if I wanted to use it. A game I like, Aurora, was programmed in VB.net and uses an Access database for everything so I figured it would be easy just to do something similar with Java. I just assumed MySQL or Java DB would be a single database file that you could use JDBC to interface with. There would likely be no issue with me just using text files ala Dwarf Fortress. It was just an idea I had last night that seemed very elegant that anyone could edit if they liked.
|
# ? Mar 8, 2014 01:49 |
|
Lord Windy posted:I did not realize that I had to install a database if I wanted to use it. A game I like, Aurora, was programmed in VB.net and uses an Access database for everything so I figured it would be easy just to do something similar with Java. I just assumed MySQL or Java DB would be a single database file that you could use JDBC to interface with. H2 or HSQLDB are single file databases. Sqlite is a good choice as well, though for java probably one of the former ones would be more appropriate. JavaDB uses a folder to store its files (and it can have quite a few) and MySQL is a server (that the user would need to install and configure beforehand). There's nothing wrong with using a database to store user data or preferences or ... whatever else you need, just know what you're getting yourself into and what you will be asking from users when they want to install your tool. A MySQL server for a single user program may be a bit too much to ask.
|
# ? Mar 8, 2014 19:10 |
|
H2 might be the way to go if I want to keep going down the path of a database. It looks like you can embed the database into the application itself through a 1.5mb jar file so the end user doesn't need to install anything. But I did some reading up on Java and file loading, and an 8kb BufferedInputStream is surprisingly fast. 500ms to read a 100mb file. So I might write down what I want to do and make up a pro/con list.
|
# ? Mar 9, 2014 12:34 |
|
The answer is XML obviously.
|
# ? Mar 9, 2014 19:57 |
|
I'm not reinventing the wheel with XML, sorry.
|
# ? Mar 9, 2014 21:17 |
|
lamentable dustman posted:The answer is XML obviously. Is jokes! XML is the wrong answer to basically every problem. The correct answer is probably "json," if you were tempted to use XML, but might be "a binary representation," if storage efficiency outweighs extensibility and human-readability.
|
# ? Mar 10, 2014 05:48 |
|
Gravity Pike posted:Is jokes! Ha, kids these days. Taking the one XML flaw (size) to the other extreme. Json is mighty fine for a large number of applications, especially those that send data to the browser as the browser can right away start using the objects. But when you need things like validation or just simply documentation of your structure, json does everything in its power to get in your way, to the point of being better to just give up. Yes, there is such a thing as json schema (i now just googled it), but you have to put in serious effort to enforce it. Validation against an XML schema is done automatically by every XML parsing library out there. XML schema can and does serve as the contract between the consumer and the producer. No point in looking at your crap if it's not even valid. Plus, with things like xpath and xslt one can extract information or transform it (respectively) without even needing to "look" at the XML. Makes working with XML easy and painless. Point is: there are very many valid reasons to use XML over json (or yaml or other structured text formats). XML is the right answer to a ton of problems.
|
# ? Mar 10, 2014 13:20 |
|
"Serious effort" being "choosing to use a tool that enforces the schema", right? The same as what you have to do with XML? It seems unusual to look at the mere existence of a non-validating parser as a downside of some sort. If I were to write an XML parser that didn't validate schemas it wouldn't somehow make XML worse.
|
# ? Mar 10, 2014 14:35 |
|
rhag posted:Validation That's a valid point (), although it's not enough to sway my distaste for xml. There are enough json validation options that I never really find myself missing it. rhag posted:Plus, with things like xpath and xslt one can extract information or transform it (respectively) without even needing to "look" at the XML. Makes working with XML easy and painless. Since I work in the real world, what xml libraries do you use? Compared to, say, Guava Gson, I've never found xml libraries anything close to "easy and painless."
|
# ? Mar 10, 2014 19:44 |
|
Gravity Pike posted:That's a valid point (), although it's not enough to sway my distaste for xml. There are enough json validation options that I never really find myself missing it. I'm usually fine with the standard java libraries. Don't remember the time when i really needed to switch to something else (because feature X was not there for example). Now, easy or hard i suppose is subjective, I personally don't find this code hard: code:
Or this one: code:
Yes, you'd have to write previously the entire document model for the first example to work, but you have to do that anyway if you don't want to work with the document nodes themselves (and that's true for json as well). And yes you'd have to write the xslt document for the second example to work. With a json library, maybe you'd have fewer lines of code to accomplish the first task (minimum 2 i'd guess), but the second task would be impossible (possible via code of course, but that's not the point here). This is not me arguing that XML is better than json or the other way around, but that XML has its use cases and json has its own. It is, in my opinion, better to be able to use both and to decide (based on the problem at hand) when to use which. Plus all these transformations really don't even appear in the code (they shouldn't). Both a web service or a spring controller or a jee endpoint would have the marshalling and unmarshalling done for them (for both json and xml). So at the end of the day the developer only needs to work with objects and not worry about the format they got in or how they'll look when going out.
|
# ? Mar 10, 2014 20:40 |
|
I'm need some general help. I have a project where I'm using WindowBuilder. I already have a JFrame and some buttons, but I'm trying to figure out how to make a new window appear when I click on one of the buttons and then have WindowBuilder to read from a text file and display the contents in the aforementioned new window.
|
# ? Mar 13, 2014 00:33 |
|
-Blackadder- posted:I'm need some general help. I have a project where I'm using WindowBuilder. I already have a JFrame and some buttons, but I'm trying to figure out how to make a new window appear when I click on one of the buttons and then have WindowBuilder to read from a text file and display the contents in the aforementioned new window. I'm assuming that the other window you'd like to appear when you select the button is some different JFrame? For the button, you need to add some action listener which contains behavior that will create an instance of the other frame you'd like to display. You can pass whatever details you need to to the other frame by the frame's constructor. It'd look a little like this: Java code:
edit: Also it's a bad idea to hard-code path names. You can give ClassLoader a try to load project resources. Woodsy Owl fucked around with this message at 10:24 on Mar 14, 2014 |
# ? Mar 14, 2014 10:13 |
|
Does anyone know of a Maven plugin which can generate "generic" documents? Basically all I want is to create a small XML document containing a list of certain classes. It would not end up in the jar, the XML file is needed for integrating into another system.
|
# ? Mar 14, 2014 15:33 |
|
I'm trying to build a GUI that has you enter elements to be stored in a deque, however I'm having some problems. I'm using the NetBeans GUI maker, for reference. I need to use a list of commands to add and remove elements to the deque and then check the size and if it's empty or not. The best way I could come up with separating the command from the element being added is to split the inputted string in two, then set String command = tokens[0] and String element = tokens[1]. I'm not sure why, but when the element gets added to the deque, it seems to be replacing the previously added element or creating a totally new deque. Also, before i decided to set command = tokens[0] and element = tokens[1], size and isempty both worked as commands, but only spat out 0 and true, but now when I try to use them in the GUI they don't do anything at all. All this code is in the Button1ActionPerformed listener Java code:
Java code:
|
# ? Mar 14, 2014 17:24 |
|
Are you sure you didn't mean to post that in the coding horrors thread?
|
# ? Mar 14, 2014 17:50 |
|
Spatial posted:Are you sure you didn't mean to post that in the coding horrors thread? Yeah, it's pretty bad .
|
# ? Mar 14, 2014 17:52 |
|
Welp I figured it out: I didn't make the LinkedList variable a class-wide private variable so every time the method was executed it was creating a new variable. Gaze that abortion of code and shame me
|
# ? Mar 14, 2014 18:48 |
|
Tusen Takk posted:Gaze that abortion of code and shame me Nah man, sometimes you just gotta prototype out your idea and then you can go back and polish your code. Don't sweat it.
|
# ? Mar 15, 2014 03:28 |
|
Tusen Takk posted:Gaze that abortion of code and shame me Your code would have been ten times more readable if you just gave your labels and inputs actual names instead of label1, label2. Aren't you just forcing yourself to memorize what these things mean when you modify your code? Think about how much easier it would be if they were named commandTextField and commandLabel. And use imports for cryin out loud haha. You'll remove 30% of your code if you remove javax.swing everywhere. Edit: nevermind looks like you are using something to auto generate terrible code. FateFree fucked around with this message at 14:17 on Mar 15, 2014 |
# ? Mar 15, 2014 14:09 |
|
I also have a NetBeans questions, I am a total JAVA newb, I am sure it will show. I have selection of JAR files I have acquired from the internet and I wish to add to my Library in NetBeans such that I can use them all from one location for any project I desire. I've done the usual (right click) -> Properties -> Libraries and added the JAR files to the Run and Compile Sections. This does nothing, NetBeans doesn't find the classes and the program errors (cannot find symbol). ---EDIT: this doesn't work, it looks like it does, but it doesn't. If I manually copy everything from where I want them to the netbeanscrap/project/src/ folder it does work. This seems insane to me, it means I will have 6+ billion copies of my JAR files floating around for every project that I have to constantly monitor and update whenever I change the original jar file. ----- Is there a way to add something to the netbeans library that actually adds it to the library, without having to copy it to each project directory? I mean such that it can find the class I am looking for and adds the appropriate import line (the internet claims it should do this already). Edit 2: If I manually add the imports it seems to work. I am still not sure why NetBeans doesn't do this and why autocomplete doesn't work. Everything I've read indicates that it should. Edit 3: I solved my problem by not using poo poo code from other people. Boot and Rally fucked around with this message at 02:41 on Mar 17, 2014 |
# ? Mar 16, 2014 19:11 |
|
|
# ? Jun 3, 2024 00:09 |
|
I wrote a thing:code:
|
# ? Mar 18, 2014 03:07 |