|
Kilson posted:Can't you just use .drainTo() on the queue? Just drain the queue to a new list, and it's atomic. Well theres no drainTo function, but I'd rather not drain the queue because if the save fails I'll lose all the metrics in memory. With removeAll I'll empty them only if they successfully save to the db, otherwise they'll stick around for the next attempt.
|
# ? Aug 7, 2013 03:24 |
|
|
# ? Jun 12, 2024 08:07 |
|
You can always put things back into the queue Use LinkedBlockingQueue to have drainTo. Use offer to add things. edit: there were words about iterators, but you don't need to care Brain Candy fucked around with this message at 04:40 on Aug 7, 2013 |
# ? Aug 7, 2013 04:16 |
|
Oooo I'd never seen that drainTo method, I knew it had to exist but I was barking up the wrong tree, I needed to look at the BlockingQueue interface and it's implementations.
|
# ? Aug 7, 2013 04:40 |
|
FateFree posted:Well theres no drainTo function, but I'd rather not drain the queue because if the save fails I'll lose all the metrics in memory. With removeAll I'll empty them only if they successfully save to the db, otherwise they'll stick around for the next attempt. If you run the save operation directly out of the queue, and something is added from another thread right before you clear it, you're going to lose items anyway. Drain it to a list, and just don't clear the list unless the things save properly to the db.
|
# ? Aug 7, 2013 16:01 |
|
I asked this in another thread but I figured I'd ask it here as well. I had an interview today for a Junior Java Developer job. It went really well and I like the culture, size, etc. I'm just a little concerned with the technology they use. They're using some Java technology (EJB/JBoss/JSP) that others have told me is "outdated" and while it fits the product they make, this was a little disconcerting to hear. This will really be my "first" dev job, so I'm not sure what to make of it. How much is it going to impact my career by starting off working with these things that (I've been told) may soon die? Will the experience I get here still open me up to good jobs in the future? Forgive me if this is a retarded question. I'm a complete newbie and this really is my first developer job. As far as Java goes I haven't done much beyond advanced algorithms courses which used no frameworks or anything outside Core.
|
# ? Aug 8, 2013 17:47 |
|
Java technology gets outdated on a yearly basis, but going to raw EJB and JSP is almost a decade behind the curve. It should still be somewhat relevant because all of the modern tech that you should be using is built off of the older stuff.
|
# ? Aug 8, 2013 18:00 |
|
Yea I wouldn't worry to much about it if you like the company. The tech is dated but is the foundation for all the newer tech. A key thing about java Dev is being able to adapt to new poo poo all the time.
|
# ? Aug 8, 2013 18:06 |
|
I'm having embarrassingly hard time getting my head around generics. Here's the code I want to write:Java code:
Java code:
Java code:
Java code:
|
# ? Aug 8, 2013 22:27 |
|
IMlemon posted:I'm having embarrassingly hard time getting my head around generics. Here's the code I want to write: I'm pretty sure you want your implementation to have code:
|
# ? Aug 8, 2013 22:31 |
|
Yes, the T in InMemoryGateway is a different T than the superclasses' T. I think the subclass could be changed to InMemoryGateway<T2 extends BaseEntity> (not as a fix, but to restore some sanity).
|
# ? Aug 8, 2013 22:50 |
|
So, simplified, you haveJava code:
Java code:
code:
code:
code:
|
# ? Aug 9, 2013 00:25 |
|
nevemrind
DholmbladRU fucked around with this message at 15:26 on Aug 9, 2013 |
# ? Aug 9, 2013 15:06 |
|
I think I'm getting the hang of "Classes" now. Any suggestions?Java code:
|
# ? Aug 14, 2013 21:06 |
|
Class<C extends Class>?
|
# ? Aug 14, 2013 21:14 |
|
baquerd posted:I think I'm getting the hang of "Classes" now. Any suggestions? did you mean to post that in the coding horrors thread? I'm getting dizy just looking at it
|
# ? Aug 14, 2013 21:17 |
|
carry on then posted:Class<C extends Class>? I like it. It compiles. code:
|
# ? Aug 14, 2013 23:18 |
|
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
|
# ? Aug 15, 2013 03:52 |
|
I just attended an induction for my new course today (Software development, an HNC in Scotland) and they told us that we'll primarily be learning/using Java and I'm coming to the course as a complete newbie. Curious if there are any absolutely necessary/worthwhile books or documents online I should be aware of? I'm sure my lecturers will fill us in come the start of the actual course but I want to get a headstart and try and not gently caress this course up seeing as I'm floating entirely on student loans now (our Gov't usually funds a few courses but I burnt that funding "finding my way"). Any advice in general for a newcomer learning via a college course would be great and if anyone has specifically had education in Scotland (the west for me) then I'd love to hear more about your HNC/D experience. If this isn't necessarily the right place to discuss that though, let me know where to post! Sundowner fucked around with this message at 13:15 on Aug 15, 2013 |
# ? Aug 15, 2013 13:11 |
|
I have created a web service in java using import javax.xml.ws.Endpoint;. However I am a little confused about how to make this service available constantly. Do I need to incorporate this in a jsp page which is externally accessible? `
|
# ? Aug 18, 2013 19:45 |
|
Is it just for testing? Maybe run a local tomcat with it deployed, like this.
|
# ? Aug 19, 2013 01:43 |
|
rrrrrrrrrrrt posted:Is it just for testing? Maybe run a local tomcat with it deployed, like this. Its a little more than testing. Currently I have apache tomcat running on a server. Can I deploy a eclipse Web Service project much like a war file on tomcat?
|
# ? Aug 19, 2013 02:14 |
|
The artifact of your build should be a war file.
|
# ? Aug 19, 2013 03:32 |
|
DholmbladRU posted:Its a little more than testing. Currently I have apache tomcat running on a server. Can I deploy a eclipse Web Service project much like a war file on tomcat? You should be able to export to a WAR file. Other options would be an ant build script or mavenize it
|
# ? Aug 19, 2013 21:41 |
|
I've been tasked with a project to produce a report on methods nearing the 64k size limit. Our application uses a lot of jsps and generated code and we've seen issues in the past where a small change in one place leads to problems in other pages that import the new code. Does anyone have any idea how I could go about determining the size of a method compiled in a class file?
|
# ? Aug 20, 2013 22:02 |
|
HatfulOfHollow posted:I've been tasked with a project to produce a report on methods nearing the 64k size limit. Our application uses a lot of jsps and generated code and we've seen issues in the past where a small change in one place leads to problems in other pages that import the new code. Does anyone have any idea how I could go about determining the size of a method compiled in a class file? You are doing it wrong.
|
# ? Aug 20, 2013 22:20 |
|
pigdog posted:You are doing it wrong. Ok, so maybe tell me the right way to do it? I'm not a java programmer at all. I'm a systems engineer and for some reason this task falls on us. And it is completely outside anything I would normally do.
|
# ? Aug 20, 2013 22:22 |
|
Sorry for the unhelpful post, I saw "64k methods" and kinda knee-jerked. If we're talking JSP's that are compiled into such monster methods, then that's another thing. Try to have less crap stuff in your .jsp files, move the business logic to proper java classes, Javascript files to separate .js and such. While it's down to any particular JSP framework, perhaps try replacing static includes such as <%@ include file="blah.jsp" %> with dynamic like <jsp:include page="blah.jsp"/>. Anyhow, it depends a lot on your context. Could you decompile some of the .class files the JSP gets compiled into and see what takes up all the space?
|
# ? Aug 20, 2013 22:56 |
|
pigdog posted:Sorry for the unhelpful post, I saw "64k methods" and kinda knee-jerked. If we're talking JSP's that are compiled into such monster methods, then that's another thing. As I stated before, I'm on the engineering side of the house. The problem we have is that we have a lot of disparate teams working on different parts of the same application. Most of that work doesn't overlap, but occasionally someone will change a global file that gets included in many other places. Now it may work completely fine in their project, but it blows up something else. The development teams working on one project have no idea that their change is loving up 3 other teams. That's where I come in. As part of the Release Management team, we're responsible for any issues where integration issues occur. So, I've been tasked with coming up with a way to generate a report on method sizes that cross a threshold so we know the code needs to be more closely evaluated. As far as your suggestions go, they make sense to me, but again, I can't enforce developer behavior changes. And even if we did, this could still happen due to various nested includes which could still gently caress up jspService (which is where 99% of these problems come from). That said, I've been doing some research and it looks like some combination of org.apache.bcel.classfile.ClassParser, org.apache.bcel.classfile.Code, and org.apache.bcel.classfile.JavaClass should be enough to get me started. Maybe I'll post my horrible code and you can all laugh at me.
|
# ? Aug 21, 2013 00:44 |
|
We actually ran into this problem at my old job, but our solution was to just clean up the offending JSPs.
|
# ? Aug 21, 2013 01:38 |
|
You do have automated tests, right? Just make it so people can't actually commit code to trunk unless those tests all pass. That way if someone breaks another project, even if they don't find out about it while putting their commit together, they'll find out when they try to commit and can fix it before it ends up breaking that other team. If your tests take too long to run to do them for every change, pick out a subset of them as quick "smoke tests" you can run for every commit, and save the rest for milestone builds or whatever.
|
# ? Aug 21, 2013 02:18 |
|
ended up using different editor
DholmbladRU fucked around with this message at 15:15 on Aug 21, 2013 |
# ? Aug 21, 2013 02:35 |
|
HatfulOfHollow posted:As I stated before, I'm on the engineering side of the house. The problem we have is that we have a lot of disparate teams working on different parts of the same application. Most of that work doesn't overlap, but occasionally someone will change a global file that gets included in many other places. Now it may work completely fine in their project, but it blows up something else. The development teams working on one project have no idea that their change is loving up 3 other teams. That's where I come in. As part of the Release Management team, we're responsible for any issues where integration issues occur. So, I've been tasked with coming up with a way to generate a report on method sizes that cross a threshold so we know the code needs to be more closely evaluated. When i had to inspect a lot of classes to make sure they behave (for other reasons than you), what I did was to write unit tests that would do the inspection for me. The tests would be run with each build, giving me very fast feedback on the status of the build. The library i used was the ow2's asm library. They have apparently reached the 4.0 release but in maven they only have the 3.3.1 . The maven dependency looks like this: <dependency> <groupId>asm</groupId> <artifactId>asm-all</artifactId> <version>3.3.1</version> <scope>test</scope> </dependency>
|
# ? Aug 21, 2013 04:00 |
|
rhag posted:When i had to inspect a lot of classes to make sure they behave (for other reasons than you), what I did was to write unit tests that would do the inspection for me. The tests would be run with each build, giving me very fast feedback on the status of the build. Yeah I actually was playing around with exactly how to do this last night. I didn't see a mechanism to get just the byte code bytearray for a specific method. I think the "easiest" way without trying to write some kind of huge java thing is to use javap to decompile each one of the stupid classes and see if there is a method with a byte position greater than (say) 62,000. Shouldn't be too hard to do with grep/awk.
|
# ? Aug 21, 2013 17:36 |
|
I have to process a large number of text files that were originally written by some kind of Cobol program. Many languages support the concept of writing into a record structure for output. The text files look like they were written by just such a program. Now, here comes the hard part. I would like to reverse this so my program can consume the document without me having to write a parser with lots of special rules. Are their any java libraries that given a record structure and format of items in it, they could automagically suck out the items into some Java objects?
|
# ? Aug 21, 2013 18:15 |
|
javassist is another Java bytecode library. Usually these libraries have two parallel APIs. A high-level API provides a view that looks similar to Java source code, but you'll want the low-level API which let's you see the bytes itself in bytecode.
|
# ? Aug 21, 2013 18:33 |
|
HFX posted:I need to parse but I don't want to write a parser. Can I parse without creating a parser? FTFY You need a parser. Maybe a parser generator library will help but grammar description can still be pretty hard. Off the top of my head - and this is super outdated - ANTLR is one such parser generator, though maybe something newer and shinier has come along since then.
|
# ? Aug 21, 2013 18:37 |
|
HFX posted:I have to process a large number of text files that were originally written by some kind of Cobol program. Is this a COBOL master file or just a text output from some kind of log or extract? It may be possible to read in as byte delimited record fields. Do you have a few samples?
|
# ? Aug 21, 2013 18:43 |
|
HFX posted:I have to process a large number of text files that were originally written by some kind of Cobol program. If the format is just some arbitrary format, then I don't think so? If the syntax is really simple then I might just do it by hand. If it's more complex than, say, two terminals then I might use something like ANTLR.
|
# ? Aug 21, 2013 19:04 |
|
Thanks guys. Looks like I'm going to be writing custom parsers and explaining why I can't just use regular expressions over and over. (Column + MultiLine + Context sensitivity ahoy!)
|
# ? Aug 21, 2013 21:23 |
|
|
# ? Jun 12, 2024 08:07 |
|
HFX posted:Thanks guys. Looks like I'm going to be writing custom parsers and explaining why I can't just use regular expressions over and over. (Column + MultiLine + Context sensitivity ahoy!) You might try flatworm although I haven't personally tried it.
|
# ? Aug 22, 2013 06:11 |