|
My professor has me doing his sweat shop programming to help his 120 class that are using GameMaker (long story/school sucks). Basically, he wants me to write the chapter examples in the gamemaker book in java. The last one he's given has a guy that runs around an environment top/down style and what you see in the screen is relative to the position of the character. Is it possible to have a JFrame the size of the screen with a JPanel the size of the level and just have the JPanel repainted in the JFrame to a certain point? It's hard to describe what I'm asking, but if you think about a roguelike, the character approaches the side of the screen but the level shifts over so you can see more to one side. I'm basically trying to recreate this in Java but am not sure how to do the moving environment thing with JFrame/JPanel/JWhatever.
|
# ¿ Nov 9, 2008 03:27 |
|
|
# ¿ May 13, 2024 10:25 |
|
I assume all of this is within a for loop?
|
# ¿ Mar 23, 2011 18:19 |
|
Aleksei Vasiliev posted:
Also, Aleksei has a point. If you only have 0-9 and someone puts in 20, your if statement will actually try to access the accounts[20] and throw an out of bounds error. Maybe: code:
|
# ¿ Mar 23, 2011 18:24 |
|
If someone puts in 20 as their account, you are still getting array out of bounds errors. Do:code:
code:
|
# ¿ Mar 23, 2011 19:01 |
|
Yah, accounts with unique ids are just begging for a hashtable to be used.
|
# ¿ Mar 24, 2011 02:04 |
|
Brain Candy posted:It’s been said that there are only two hard problems in Computer Science: cache invalidation, naming things and off-by-one errors Do you not like the names of my variables?
|
# ¿ Mar 24, 2011 14:03 |
|
chippy posted:Guess again What's sad was that I was right the first time I offered code and then later on in the thread changed it.
|
# ¿ Mar 24, 2011 15:23 |
|
Alternatively, you can use a java decompiler to decompile the class file and just copy/paste the method into your own code. http://java.decompiler.free.fr/
|
# ¿ Mar 30, 2011 21:58 |
|
Zewle posted:Is there a way to read all serialized objects in a file at once? When you say you deserialized it, do you mean you actually have an array of objects at the end? If that's the case, you can just loop through the array and grab each object.
|
# ¿ Jun 23, 2011 18:39 |
|
baquerd posted:Something like this: Do this. If you're not familiar with the syntax, all this is is a for loop that loops through each Student object in the array.
|
# ¿ Jun 24, 2011 20:17 |
|
Blacknose posted:I need a good Spring MVC book. Any ideas? This got skipped over, but I recommend: http://www.amazon.com/Spring-Action-Craig-Walls/dp/1935182358/ref=sr_1_1?s=books&ie=UTF8&qid=1311350259&sr=1-1 I have the second ed. The third just dropped last month I think.
|
# ¿ Jul 22, 2011 16:58 |
|
MonsterUnderYourBed posted:simple question with the JDBC hooking into MySQL. Shouldn't this be handled in the DDL for the table? Some column is the auto incrementing key?
|
# ¿ Dec 20, 2011 16:25 |
|
Bob Morales posted:Book recommendation? I don't want to sludge through 122 pages and there isn't one in the OP/first page. http://www.deitel.com/Books/Java/JavaHowtoProgram7e/tabid/1191/Default.aspx I know there's some mixed feelings but I've gone through 2 editions of this book and if you like looking up a topic and seeing code examples EVERYWHERE as well as detailed explanations as to what's going on, then this is the book for you. The latest editions took away those stupid rear end covers with bugs doing dumb poo poo, but I kinda liked them.
|
# ¿ Mar 4, 2012 05:45 |
|
Janitor Prime posted:Look at Spring Boot guides should get you rolling Seconded. Spring Boot and latest Spring framework in general means no more web.xml and no more WEB-INF folders. gently caress XML configuration forever. Also Gradle is a great replacement for Maven.
|
# ¿ Dec 5, 2016 22:58 |
|
Zaphod42 posted:I find doing that is a huge pain in the butt compared to just dropping libs in a "libs" dir though. Sounds like you want Gradle. You keep your non standard libraries local as needed. If you work anywhere where you're maintaining multiple projects with different requirements, you're gonna want something like Maven or Gradle. You can't assume anyone coming in is going to have the same libraries in a folder as you. That runs dangerously close to the "works on my machine" issues.
|
# ¿ Dec 6, 2016 06:12 |
|
Wheany posted:Yeah, I checked out a Minecraft mod and it used Gradle. Fine, whatever, just enable Gradle support in Idea. Import gradle project and... it takes 2 hours to resolve the dependencies. This is not typical. I'm guessing that mod has repositories pointing all over the internet with slow connection speeds.
|
# ¿ Dec 6, 2016 17:22 |
|
Wheany posted:That's what the .m2 directory under your home directory is. Or the .gradle directory under your home directory if you're using gradle.
|
# ¿ Dec 6, 2016 17:23 |
|
Jo posted:Would this be the place to talk about Kotlin? I recently stumbled upon the language and have taken a liking to it. Do we have a JVM languages thread? I don't know poo poo about Kotlin or Scala besides the fact that they don't do anything that Groovy doesn't already do and the syntax looks like rear end.
|
# ¿ Dec 6, 2016 22:01 |
|
Zaphod42 posted:I don't want it in a compiled jar though; I want to just have a folder with the loose libraries for building with without Maven in the future. I'm not sure what libraries you need to download and put in a folder that aren't already on mavenCentral or jCenter. Imagine for a second that you have one additional file in your project that lists all the things you want. Now imagine there's a single command to download all the things you want and build your jar. Now imagine that someone can clone your git repo or unzip your source (lol) and run that same command and get the exact same outcome as you did on your own machine. That's gradle and/or maven. If you're just doing Java to dick around and you don't think anyone will ever touch your source code and you don't think you'll write anything worth sharing, then go ahead and download jars manually and add them to your classpath. Even for one off projects and hackathons, I still find gradle is easier than going and downloading libraries and adding them to projects manually. There's a reason why other languages have package managers tied to them. Seriously, check this: https://gist.github.com/poemdexter/6cb747368e34992ea6e0aeb386981259 code:
code:
poemdexter fucked around with this message at 10:16 on Dec 7, 2016 |
# ¿ Dec 7, 2016 10:07 |
|
TheresaJayne posted:build.xml is Gradle build.gradle is Gradle. Volguus posted:If you have a Makefile you have an external dependency on make. Yes, the solution is never build a project ever.
|
# ¿ Dec 8, 2016 11:21 |
|
A lot of configs use the word "password" for fields. I think you might need to lower your security settings on that one because it's not like you can go and change the external libraries to start using a different word.
|
# ¿ Dec 8, 2016 23:29 |
|
AbrahamLincolnLog posted:So, I'm going to preface this with the point that this is potentially a very dumb question, but I have to be honest and say that I'm just totally stumped. http://www.cs.armstrong.edu/liang/intro9e/html/GenericMatrixWithLineNumber.html is this it? Still, I would hit up the professor.
|
# ¿ Dec 14, 2016 17:00 |
|
Zorro KingOfEngland posted:Apache POI is the library I've always used - https://poi.apache.org/ This is the only answer for Excel imho.
|
# ¿ Dec 15, 2016 17:35 |
|
smackfu posted:Has anyone had any luck slowly updating a legacy code base to newer technologies? The old code has SQL mixed in with controllers all over the place. It's pretty easy to pull out repositories and modes and such but it would be nice to stick in Hibernate and some kind of dependency injection framework but without breaking all the other existing code that we aren't touching yet. I took something from old Spring to new Spring so we could get off the xml config. I also swapped it to Groovy so we could use that. src/main/java turned into src/main/groovy and the file extensions went from .java to .groovy with a couple @StaticCompiles where needed. If you have all of your business logic contained in a decent way, it might be easy to hop on Spring but I dunno. Depends on the codebase size and how messy it is. Good luck!
|
# ¿ Dec 16, 2016 21:40 |
|
You should have separate jobs per branch and you can set the branch in Jenkins job config. Use this for automatically doing builds. We only watch the development branch and the release branch for automatic builds and each has it's own job. Here's the Continuous Integration/build engineering/devops thread: https://forums.somethingawful.com/showthread.php?threadid=3695559
|
# ¿ Jan 24, 2017 18:38 |
|
venutolo posted:Thanks. I was hoping not to have to do separate Jenkins jobs for different branches. When you create a new job, there's an option to clone a previous job. Use that, change one string, poof you're done.
|
# ¿ Jan 25, 2017 00:08 |
|
Wheany posted:I can't find a library that does 3D delaunay triangulation in Java and I refuse to believe one doesn't exist. I don't know much about 3d delaunay triangulation, but maybe this will help? http://download.java.net/media/java3d/javadoc/1.5.1/com/sun/j3d/utils/geometry/Triangulator.html Maven dependency: https://mvnrepository.com/artifact/java3d/j3d-core-utils/1.5.1 pony: poemdexter fucked around with this message at 21:25 on Jan 31, 2017 |
# ¿ Jan 31, 2017 21:22 |
|
fletcher posted:Why does the GC log have to be so annoying to parse. I'm trying to write a logstash pattern for it, what a fuckin' pain! They don't make monitoring applications for this sort of thing so you don't have to manually parse it all an then do something with results from logstash later?
|
# ¿ Feb 17, 2017 20:57 |
|
HFX posted:Emoji is neither a valid return type or a valid character for identifiers. Well there goes my plan to have all my packages named poop emoji.
|
# ¿ Mar 23, 2017 16:28 |
|
PierreTheMime posted:So I managed to wrestle Eclipse and Maven into working order and get a working SOAP test created which returns my expected result from my API. What is the best (or at least a semi-standard) way of using SOAP for websites? I have absolutely zero experience with HTML/Javascript (outside of HTML 1.0 from the late 90s), but I have a feeling I'll need to get a few things in place. I tried searching for good basic examples and didn't turn up much--does anyone have a good idea of where I should start? SOAP is really for service to service communication. Why not use REST? Is your API only allowing SOAP requests?
|
# ¿ Apr 4, 2017 22:01 |
|
smackfu posted:Anyone use any neat Spring things with Spring Boot? They have what seems like dozens of packages, are there any that you found particularly useful? Yes! Spring Security is awesome for setting up auth. Spring Actuator is great for all the nice endpoints it gives you for server status tracking as well as the ability to write custom endpoints easy. Basically all our projects here start with these lines in gradle: code:
|
# ¿ Apr 12, 2017 16:58 |
|
smackfu posted:I will need to try that. I've been playing with the SpringFox Swagger package which auto documents your REST apis. It's useful for seeing which end points you were lazy with, like "why is DELETE enabled on this controller???" And useful if someone says that you need to document APIs of course. For production servers that are directly addressable, automated health checks by sysadmin tools is great. Plus you can write custom endpoints for things like integration health checks (can service A reach service B) for microservice environments. Personally, I wrote a little webapp at work that pings all servers' /health endpoint in all environments to get the version deployed. I think display it in a simple table on a page. Now people can just hit that to see what version of what is deployed where instead of bugging the hell out of me. P.S. Devops is a rabbit hole you do not want to go down if you're a developer trying to write code. There's always more things to monitor and automate and tweak and people will lean on you hard when things randomly stop working.
|
# ¿ Apr 16, 2017 12:26 |
|
Make drat sure you're not breaking any HIPAA poo poo throwing medical information onto the cloud. Amazon wrote up a white paper to cover AWS and HIPAA. https://d0.awsstatic.com/whitepapers/compliance/AWS_HIPAA_Compliance_Whitepaper.pdf
|
# ¿ May 11, 2017 20:15 |
|
Hughlander posted:Stupid question that's been bugging me. When you import your project, don't navigate just to the directory. Instead navigate all the way to the build.gradle file. That will set up your project as a gradle project. From the gradle tab thing on the right, you'll be able to see all your tasks and you can double click them to run them. This is built into intellij and you don't really need a plugin.
|
# ¿ Sep 11, 2017 03:35 |
|
Volguus posted:Well, that's one name that I haven't heard in a long time. With the release of Spring Boot, the advantages that Grails brings to the table diminish quite a bit. While I do not know how it performs nowadays, but back in 2010 when I wrote my first app in grails it was quite slow for the time (and upon release I had 10000 hits in the first 2 minutes and that didn't help the poor thing). I've been writing Spring Boot apps in Groovy for the past 2+ years so it's definitely not a Grails only thing. I did get an email this morning about the Dallas Grails group disbanding due to lack of interest. I've never seen a Grails app in the wild either. It's all Spring or Spring Boot and sometimes Ratpack depending on the team.
|
# ¿ Jan 4, 2018 21:10 |
|
CPColin posted:It did seem like Grails was on its way out, given the age of many of the Grails search results I've been seeing. Unfortunately, I don't know enough about Grails or Spring Boot to make any meaningful comparisons, but I'll be sure to keep this info in mind if and when it becomes time to start making some large-scale tech recommendations. Spring Framework has been around forever it feels like and is incredibly stable and easy to use imho.
|
# ¿ Jan 5, 2018 22:37 |
|
Import project from existing sources. When you navigate to the project, click on the build.gradle file and import that. Your project will be setup as a Gradle project. Right now IntelliJ is just building it however it thinks it can based on project type so who knows what it's doing.
|
# ¿ Jan 16, 2018 21:34 |
|
PierreTheMime posted:Another dumb question--this project team wants all code put into one repository. I've got my different little applications separated into packages, but all the dependencies are managed in the same pom file, so performing an export of one of the applications as a runnable .jar pulls all the dependencies and bloats the executable (13MB instead of 1MB). It's not a huge deal, but in the interest of learning not to be terrible I'd like to know if there's a way to manage which run configuration export receives which dependency within the same project or if I should just ask them for a different repo and split it into two projects. Are you not using some artifact repo like artifactory, dockyard, or nexus? How is your CI/CD handled? This sounds like hell from a devops perspective.
|
# ¿ Feb 20, 2018 16:50 |
|
Back in college, we used Dietel Dietel Java books as textbooks. https://www.amazon.com/exec/obidos/ASIN/0134743350/deitelassociatin It's basically everything you could possibly want to know about "how to do X in java" with explanations and full code examples. They even explain line by line what's going on. It was my bible starting computer science in college and I still have it on my shelf. It's basically the book version of stack overflow (which didn't really exist when I was in college).
|
# ¿ Feb 21, 2018 17:46 |
|
|
# ¿ May 13, 2024 10:25 |
|
CPColin posted:Thanks for that playlist. I started messing around with Spring Boot a little bit ago using "see how easy?" type stuff, so it'll be nice to get a better handle on what's actually going on. Especially since my project was trying to figure out how Spring Boot + Thymeleaf + Ceylon could fit together and the Ceylon folks want me to write up an article on my findings. It'll be a better article if it looks like I actually know what I'm talking about! I don't know anything about Ceylon, but I already dislike the package.ceylon and module.ceylon files sprinkled everywhere instead of contained in a single build.gradle or pom.xml. I understand Ceylon is trying to support java and javascript at the same time, but meh... (just opinion) Here's a ping pong ELO app I wrote using thymeleaf and spring boot super quick for the last company i worked at if it helps a little. I kept the "business logic" in the controllers because I was lazy and doing this when I had spare time in afternoons before anyone gives me poo poo about MVC practices. We played way too much ping pong and I'd rather do that than write code to track rankings. https://github.com/poemdexter/rn-pingpong I wrote this with groovy so it already has a lot of features that Ceylon has. Look how clean my model is! https://github.com/poemdexter/rn-pingpong/blob/master/src/main/groovy/com.rnpingpong/models/Player.groovy Looks like a lot of the features from ceylon are already in groovy with the big exception being support of javascript. But then again, javascript.. poemdexter fucked around with this message at 21:00 on Apr 12, 2018 |
# ¿ Apr 12, 2018 20:51 |