|
mustermark posted:I've only started to get into Java programming for work, and I gotta say that JDBC makes me physically ill and depressed. Are there any good modern guides on it, or am I stuck with having to write twenty lines of ps.setHate(..., "Fury");? You could move up from JDBC to hibernate, it does run as a standalone, and if you are using 1.5 or higher you can use annotations... code:
code:
|
# ¿ Jul 12, 2011 09:45 |
|
|
# ¿ Apr 27, 2024 13:36 |
|
iam posted:Anyone any tips on the easiest/best method for utilising properties files to store system messages? Well at a previous place we had a wrapper called CachedTypedProperties code here https://gist.github.com/1185736 Theresa
|
# ¿ Sep 1, 2011 09:47 |
|
XSLT is easy when you start but can get really complex, I used to take XML output from a Java program and using an XSLT template convert it into XML-FO which i then passed into Apache FOP to make PDF output files. once i did someone a simple example on irc - everyone said that it was way to complex
|
# ¿ Feb 23, 2013 10:49 |
|
baquerd posted:Most likely annotations confuse them and they just don't trust those screwy things. I worked for a company that refused to use that crazy thing called hibernate because the owner who was old school IT didnt believe it was better and people were fired for suggesting that they use hibernate rather than manually write JDBC interface classes that did the same as hibernate but not as slickly. (this was in 2010)
|
# ¿ Mar 19, 2013 12:53 |
|
brilliant coverage on how to debug, but when you have been programming for a while you KNOW what the problem is.. for me i saw on the marked line in one of the posts inside a loop if(variable[loop] > variable[loop +1] instant red alert there... what happens at the end of your loop [1,2,3,4] last one loop = 3 if(variable[3] > variable[4]) <---- out of bounds, the array has 4 entries 0-3 so 4 is out of bounds. if you are going to do it this way then do it on the loop as for(a=0; a< variable.length() -2;a++) so it will work me personally i would probably do it using recursion - too deep into my current epic/stories at work to put my mind to the actual solution though Just my 2p/c on the comments already made. TheresaJayne fucked around with this message at 11:11 on Apr 10, 2013 |
# ¿ Apr 10, 2013 11:08 |
|
rhag posted:How would you store the database credentials? I would love to see another idea (properties file, datasource file, whatever other configuration file). I'm asking because I had few years back a security guy saying the same thing that the database credentials were stored in the jboss datasource file on the server in plain text (only the _jboss user could read it, but ... it was there). His idea was to split the password up in at least 5 pieces and encrypt them all. I personally think that's overkill, but I'm open to any ideas that one may have on how to improve that. I don't know about Tomcat but JBoss has a utility for encrypting DB passwords and creating a hash. The tomcat docs say the following quote:If using digested passwords with DIGEST authentication, the cleartext used to generate the digest is different. In the examples above {cleartext-password} must be replaced with {username}:{realm}:{cleartext-password}. For example, in a development environment this might take the form testUser:localhost:8080:testPassword.
|
# ¿ May 29, 2013 15:52 |
|
Hard NOP Life posted:What does JBoss use for a encryption key and does it allow you to reboot the server without prompting for a password? JBoss has a utility that encrypts the key quote:15.1.1. Encrypt the data source password http://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html/Encrypting_Data_Source_Passwords.html
|
# ¿ May 30, 2013 10:38 |
|
Win8 Hetro Experie posted:My previous post probably read like I was ragging on TheresaJayne, but it wasn't my intention. I don't know much about security, but what I know is that security is hard. There may well be good reasons and proper places for using such simple encryptions. I'd just be wary of anything that smells like security by obscurity, because with my knowledge the first person being obscured is me myself. I was just raising the issue, I had to look at it for our production systems, the idea is rather than having in the JBoss config files like this code:
code:
|
# ¿ May 30, 2013 17:10 |
|
Fly posted:Another thing is that I don't want my build going out to the network unless I tell it to do so. This is another reason not to have automatic updates since those would need to check some network resource. Well Maven will get the latest if you do not specify the version you want. If you define a version of your dependency then it will never update. but the nice thing is if you say want to use MyBatis with Spring any dependencies needed by the versions on Spring you are using will be automatically installed and you have locked your version to the one you want. Also if you have it set up correctly you will only hit the network on first add, as after its downloaded once, it resides in the M2 cache.
|
# ¿ Jun 25, 2013 14:07 |
|
Fly posted:Cool. Presumably one could prepopulate the cache with versions from source control, yes? You can do a maven install which will install the jar/war file into the M2 cache for use in another project. quote:The Install Plugin is used during the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location for the artifact within the local repository.
|
# ¿ Jun 25, 2013 15:00 |
|
I know its not really Java but at the weekend i was looking to do some work with minecraftforge and create my own Mod, I am an Intellij Idea girl and have purchased my own copy. Could i get it working ? NO Could i get help in getting it working in Idea? NO The advice I got from the IRC support was Use Eclipse as we include a preconfigured Workspace Why can't they be open and tell us how to get it working in ALL IDEs rather than just their favorite version, as I don't want the hassle of 3-4 IDEs on my system when I mainly use 1 . (3-4 includes, Idea, Eclipse, Netbeans, JCreator(yes i bought this one as well))
|
# ¿ Aug 27, 2013 09:35 |
|
General Olloth posted:Come in #technicdev on synirc sometime and ask around. I'm going to PAX in a couple hours but next week I can be around to step you through it OR someone in the channel might be able to help you anyway. We have a bunch of modders in the channel. Well i did the easy way and installed Eclipse, at some point i will work out the config and probably post a blog entry showing how to set it up on Idea.
|
# ¿ Aug 29, 2013 13:30 |
|
We have a Converter that works using getters and setters found by reflection, there is a sort of issue with some of the logic with recursion but it works well, The 3rd party library we use is net.vidageek.mirror.dsl.Mirror http://projetos.vidageek.net/mirror/mirror/
|
# ¿ Sep 11, 2013 12:34 |
|
supermikhail posted:I've got writer's block. How about you have code in your app that on startup looks in current folder for the file, if it doesnt exist create it As an example look at minecraft server, when you first run it will check for the ops.txt file and create it if it is not there.
|
# ¿ Sep 20, 2013 16:08 |
|
rhag posted:Oh, ok, so some flags then should solve the problem: I am feeling as if i have been morphed over to the Post code that makes you laugh (or Cry) why not just try a decent Regex regexp="^.*(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z0-9!@#$%]+$")
|
# ¿ Oct 4, 2013 15:47 |
|
rhag posted:I've read and re-read his posted requirements. My solution was the simplest thing that met them. And most of the time that's the correct one. He nowhere said that he's trying to learn regex, but that he stumbled upon them while doing his research. My take on it is that, while regexes are useful for a lot of things, this is not one of them. Sorry rhag I disagree, Your solution was clunky and it was just a code smell to me. The Regex I posted does everything the OP wanted and we use it as a validation regex under Spring MVC validation. Our passwords have to be 8 characters + at least 1 Caps and 1 Number
|
# ¿ Oct 4, 2013 16:50 |
|
PlesantDilemma posted:Newbie here. I'm using Maven and NetBeans 7.4. How do I get maven to copy some xml & properties files from src to target when I run `mvn package`? The files are in src/main/java/com/mycompany/reports/config. When I run the jar it keeps dying saying it cant find the files in target/classes/com/mycompany/reports/config. I've been surfing the maven site for a while but I'm not seeing what I need to put in my pom to get it to copy the files. Don't you need to put them in the src/main/resources/... folder?
|
# ¿ May 29, 2014 11:18 |
|
more like dICK posted:
I did a tutorial post a while back for Spring standalone maybe that will help.... http://girlcoderuk.wordpress.com/2013/07/14/configuring-hibernate-and-spring-for-standalone-application/
|
# ¿ Jul 1, 2014 07:16 |
|
Volmarias posted:Java also needs an IDE whereas with Python you really can get away with a smart text editor for a long time. Pick up Eclipse or IntelliJ and spend a little time learning to use it. You can do Java and Python with Vi if you need to, I prefer an IDE but at a push Notepad++ is brilliant for any language.
|
# ¿ Jul 14, 2014 07:39 |
|
Lord Windy posted:In Intellij, is there a way to put a 'build artifact' button up around where the run button is? I'm making a project and due to how I'm making my folder structure it is just going to be easier to run a Jar than faff about changing strings. The build menu option is next to the run menu option But you can also set a hot key for build artifacts I used to build my webpage output with CTRL-SHIFT-'
|
# ¿ Jul 16, 2014 08:12 |
|
Kilson posted:Supposedly the error happened with -Xmx4g also, but I can't directly confirm that. I have seen VMs work as 32bit even when supposed to be 64, I have a 64 bit machine at work but am running a 32 bit eclipse (company build) I have seen on my machine with 8gb of ram that java can only access the 32 bit amount. meaning i can max use -Xmx1524m as -Xmx1525m causes a cannot create VM error.
|
# ¿ Jul 24, 2014 07:21 |
|
supermikhail posted:I tried to be fancy with a search field the following way: Hook into the onChange event as well as the focus event
|
# ¿ Jul 25, 2014 06:58 |
|
I would actually be more likely to use for(Circle circleFromArray : listOfCircles) as fromArray doesn't say WHAT is fromArray ...
|
# ¿ Aug 26, 2014 13:48 |
|
Yhag posted:Hopefully a simple question: Well you are trying to access a non static method in a static way, Plot.repaint() is static why not try super.repaint(); you have already done that with the paintComponent.
|
# ¿ Sep 5, 2014 07:23 |
|
pliable posted:Is there a particular reason why you're casting all those ints, storing them into ints, then passing those ints along to your setxx methods instead of just casting them and passing them straight? Well i have seen stuff like this in the past code:
|
# ¿ Sep 11, 2014 12:40 |
|
thegasman2000 posted:The modules are: I started those at one time about 10 years ago, they started easy and then got mega hard even for a seasoned pro, I hope you have lots of time as there was soooo much studying. Although they keep saying that courses are being dumbed down. TheresaJayne fucked around with this message at 07:22 on Oct 1, 2014 |
# ¿ Oct 1, 2014 07:20 |
|
fletcher posted:Trying to setup SSL on Tomcat (APR): Whats the folder permission (.) if its owner is root, group root and permission 770 then nothing can see into the folder, of course for folders you have read write and execute, but they mean different things. you may need to add execute to allow access to the folder.
|
# ¿ Oct 1, 2014 13:17 |
|
Necc0 posted:Make sure your log entries are verbose enough that someone coming back and reading them three years from now won't be clueless and you'll be fine. If the exception has a good chance of breaking things that are calling your method or if it's a show-stopper you should hand off the exception so that the other objects accessing it know that something went wrong and can handle it at a higher level. If you can recover gracefully handle them locally. I would like to add NEVER JUST THROW Exception make an Exception you can throw that shows what went wrong, even if its just a MethodFailedException() we are being slated at work for throwing Exception as its bad coding practice (shame its because we are implementing an interface thats throwing it so its a false positive on SonarQube)
|
# ¿ Oct 9, 2014 07:21 |
|
langurmonkey posted:So I want to get up to speed on hibernate, preferably using maven etc. to get going. All the tutorials I have found seem to be slightly out of date in terms of configuration options or just flat out don't work. Does anyone have any suggestions for good online learning resources for this? Preferably something like an existing project that can then be tweaked to learn about hibernate rather than learning about screwing around with config files. you could look at my blog post. http://girlcoderuk.wordpress.com/2013/07/14/configuring-hibernate-and-spring-for-standalone-application/
|
# ¿ Oct 13, 2014 11:28 |
|
ManlyWeevil posted:Well, like you said, the general problem is fighting against java's type system. The problem is that the utility is essentially a translator: I'm working from one set of objects that are all of a single type, basically a serialized data object, and turning that into the corresponding business object. Unfortunately, due to legacy reasons, the business objects don't share any common inheritance hierarchy other than java.lang.Object so I might be stuck going all the way up to that point. Or just add a new parent above we had FormBean and ValueObject shoehorned into a previous project because the new head dev wanted it - i will say it made it much nicer and easier to use, I ended using a similar start to my own project (seriously on hold due to getting bored of writing the boilerplate) https://github.com/theresajayne/tranquility
|
# ¿ Oct 17, 2014 07:00 |
|
carry on then posted:And the JRE, yes. But obviously if it isn't working when you double-click the file that may not be the best experience. That's weird, though, why would it only work if you run it through the console? Does it take input from System.in or something? This is common on Devs machines, i cannot double click a jar or war file to run it - i have those extensions in use by winzip (which is a default) meaning it stops it being run from double clicking a jar file - and a good thing too incase of virii think what would happen if a normal user had a file kitten.jpg.jar
|
# ¿ Dec 1, 2014 09:18 |
|
Lord Windy posted:I was reading up on Java 9 and I was wondering what Modular Source Code means? I don't really understand this new feature that I should be getting excited with, but I guess like with Lambdas I probably will once I know what it is. it also sounds like the current system where you check for another library existing and if it doesnt you have to currently have selectors to disable the code that needs that library, so in future you may be able to do something like if(!exist(pixelmonModule)) { removeModule(PixelLinks) } to remove the modules that cant be used.
|
# ¿ Dec 8, 2014 09:00 |
|
rrrrrrrrrrrt posted:Variable arguments. beaten to the punch. The nice thing is if you use a vararg in a method then its the same as an array[] so public static void main(String[] args) is exactly the same as public static void main(String args...)
|
# ¿ Dec 15, 2014 09:03 |
|
ROFLburger posted:This is a stupid question. I'm using java.util.logging and I feel like I'm doing something wrong. Does there exist a logging API where I don't have to create a new logger, level, and handlers in every class that I want to be able log from? It seems wrong to keep copy pasting this in all of my classes(that I want to log from) where the only difference is changing the filename to "classname.log". I'm wondering if theres a better way than jamming all of the logger setup poo poo into the constructor of each class? Look at SLF4J and LOG4J
|
# ¿ Feb 20, 2015 08:28 |
|
foonykins posted:This is precisely where I'm hung up. Would another set of copies solve this issue? Would it, in sorts, work a kind of save-state when the method is called again? Maybe not the solution, but one thing that makes me feel you are not doing it in the best solution, How are you determining the no repetitions? The moment I hear no repetitions I start looking at Map HashMap to be precise. as Maps cannot have duplicate keys.and you could also store the nnumber of times the item is seen in the value if needed. I will admit i an half asleep here just relaxing before heading to bed.
|
# ¿ Feb 22, 2015 20:36 |
|
Bleusilences posted:I am way not finish with my project obviously but I am running problems with my tester, this is the first class of programming and we just have learn about object oriented programming. I am have been at it for hours today without progress. So this is the main class (not finished): I notice that your getSuitAsString() is not returning the suit. its returning Ace Two Three Four Unknown instead of Clubs Hearts Spades Diamonds
|
# ¿ Mar 21, 2015 15:18 |
|
FateFree posted:I mean I hate to tell you this now but you really should be using enums for this stuff, enum Suit, enum Card even with a Suit and a value. Would make it a lot cleaner than the ints you have now. I was about to say that,
|
# ¿ Mar 21, 2015 21:42 |
|
FateFree posted:The single biggest thing that separates a good programmer from a bad one is that a good programmer will go out of his way to make any complicated problem look simple, clean, and easy to understand. That means you gotta spend time commenting your code, breaking up methods that are hard to understand into simpler smaller ones, etc. If it looks bad to you now after youve been studying it, then yes i guarantee your eyes will be bleeding. unless you follow the Agile - no comments clean code methodology in which case in 6 months you had better remember what it does
|
# ¿ Mar 24, 2015 08:18 |
|
headlight posted:Can anyone recommend what I should be looking at to start programming windows applications in Java (Swing or JavaFX)? I want to build a file explorer and mass renamer that is standalone and looks just like a Windows program. DO NOT USE NETBEANS!!!! intelij idea community edition or eclipse luna at a push... but not the horror that is NETBEANS!
|
# ¿ Apr 24, 2015 06:21 |
|
|
# ¿ Apr 27, 2024 13:36 |
|
CarrKnight posted:On the topic, does anybody here unit tests swing? I'd like to know what program you use, but also how to structure gui unit tests (i find it so hard to isolate the gui) Unit Tests are supposed to test your business logic with some simple interface tests for DB and such. If you are programming a MVC model you start testing at the controller and stop at the DAO. If you work for a big corporation you will probably have to test from View Bean down to raw DB code.
|
# ¿ Apr 27, 2015 06:15 |