|
Are they loading and just not showing? You may need to apply some sizing info to the img tags there.
|
# ? Feb 6, 2012 04:38 |
|
|
# ? Jun 12, 2024 12:41 |
|
ComptimusPrime posted:Are they loading and just not showing? You may need to apply some sizing info to the img tags there. They are showing as redX when I run it in eclipse, and in a browser they just do not show. I am trying to alter an xml document, trying to update an element code:
code:
DholmbladRU fucked around with this message at 08:41 on Feb 6, 2012 |
# ? Feb 6, 2012 05:44 |
|
Regarding the img tags. First, I would recommend opening up the developer tools in chrome, or installing firebug in ff, and looking at the errors that are being logged. The first thing you need to find out is if it is loading or not. And if it is logging a not found then you know at least that much. Also, I am not familiar really with tomcat, but I would make sure that requests for /src/images are really serving that directory. Also, I don't think this is likely the case, but if you are using XHTML, then you need to get that img tag to be lower case. ComptimusPrime fucked around with this message at 08:57 on Feb 6, 2012 |
# ? Feb 6, 2012 08:53 |
|
Luminous posted:You may want to consider an account as, well, just an account that has f.ex, a username and a role or a list of roles, where a role is an admin, a mod, or a schmoe (use inheritance here). Yes, I think you're right. Thanks.
|
# ? Feb 6, 2012 15:40 |
|
ComptimusPrime posted:Regarding the img tags. HM using a URL seemed to work. I probably just dont have the images in the correct directory.
|
# ? Feb 7, 2012 01:31 |
|
Why does the finally block override a return?code:
|
# ? Feb 7, 2012 07:06 |
|
Innocent Bystander posted:Why does the finally block override a return? It doesn't override the return, the return still executes (unless the finally block returns). Check out the second answer here: http://stackoverflow.com/questions/65035/in-java-does-return-trump-finally
|
# ? Feb 7, 2012 07:24 |
|
Innocent Bystander posted:Why does the finally block override a return?
|
# ? Feb 7, 2012 08:17 |
|
I am trying to build a drop down using elements from an array in jscode:
|
# ? Feb 7, 2012 11:03 |
|
DholmbladRU posted:I am trying to build a drop down using elements from an array in js How, exactly, does the HTML output look?
|
# ? Feb 7, 2012 15:35 |
|
code:
|
# ? Feb 7, 2012 16:06 |
|
Let me rephrase: Not the code that creates the HTML, but the HTML that is has created. If you view source in a browser displaying the output from that code, how does the HTML look? I'm just wondering if it outputs value="" or value="0" or value="Null" or value="i" or something else wrong - or if it actually looks fine, and the problem is elsewhere. Usually a good place to start debugging. Computer viking fucked around with this message at 16:14 on Feb 7, 2012 |
# ? Feb 7, 2012 16:11 |
|
Computer viking posted:Let me rephrase: Not the code that creates the HTML, but the HTML that is has created. If you view source in a browser displaying the output from that code, how does the HTML look? Ill show you in a little while. I am having some problems getting it to publish on this instance of apache/eclipse at work.. working through a 404 error
|
# ? Feb 7, 2012 16:38 |
|
DholmbladRU posted:
Are you checking setAsSold[], or just setAsSold? Maybe it's being treated as an array?
|
# ? Feb 7, 2012 20:58 |
|
Doctor w-rw-rw- posted:Are you checking setAsSold[], or just setAsSold? Maybe it's being treated as an array? thattt may be my problem, I am doing 'request.getParameterValues("hSold")' where 'hSold' is the name of each attribute element in the drop down. Does anyone know what would cause a 404 error 'resources not available' in Eclipse/Tomcat(7.0). This is project specific(created test with .html and .jsp which worked), which was imported from my machine at home as a file system. The onlyyy thing I can think of is that my mahcine at home is 64-bit, and I dont remember if the IDE was 64bit or not. But I can view/edit the files jut cant see them from apache. DholmbladRU fucked around with this message at 21:59 on Feb 7, 2012 |
# ? Feb 7, 2012 21:47 |
|
Computer viking posted:Let me rephrase: Not the code that creates the HTML, but the HTML that is has created. If you view source in a browser displaying the output from that code, how does the HTML look? code:
DholmbladRU fucked around with this message at 02:09 on Feb 8, 2012 |
# ? Feb 8, 2012 01:53 |
|
I have a giant XML document formatted like this:code:
Clearly what I need here is an XML parser! Can someone recommend one suitable for something this basic (read: easy to use)? I need to do very little transformation, so I don't need anything full-powered. fake edit: googling looks like the w3c DOM classes may do what I need? Confirm/deny? http://www.developerfusion.com/code/2064/a-simple-way-to-read-an-xml-file-in-java/
|
# ? Feb 14, 2012 20:40 |
|
If you go back a few(?) pages in this thread, there's a bunch of talk about XML parsing in Java. That said, the stuff in that link could certainly do what you want. Just know there are probably much easier libraries to use than that horrible W3C/DOM thing, and if you want to do something more complex you would be wise to look into other choices.
|
# ? Feb 15, 2012 03:26 |
|
Forums upgrade or equivalent for anyone willing to help me complete a java assignment tonight. I don't want someone to do it for me, rather to walk me through the whats and whys in a collab online editor. E: Got a lot of help in the general megathread. Tots fucked around with this message at 22:53 on Feb 21, 2012 |
# ? Feb 21, 2012 06:09 |
|
Tots posted:Forums upgrade or equivalent for anyone willing to help me complete a java assignment tonight. I don't want someone to do it for me, rather to walk me through the whats and whys in a collab online editor. More details, please
|
# ? Feb 21, 2012 21:06 |
How can I name these variables better?code:
|
|
# ? Feb 24, 2012 02:52 |
|
fletcher posted:So it doesn't seem like a good idea that the two List<Thingy> have the same names, seems a bit confusing. Should I use a prefix to indicate scope? i.e. m_thingies vs. simply thingies. Or something else? It's not a good thing, no. Your IDE probably has a warning for that, something like "local variable hides field". Rather than a prefix, you should set your IDE to use a different color for fields. So why is the same name most natural for both of them? If it's because they are the same thing then you should use the field directly. If it's because the method is divorced from the instance and operates mainly with just the field, see if you can't make it a static method. Bottom line, use the best names you can. If this leads to warnings or conflicts, there might be a problem with the overall design.
|
# ? Feb 24, 2012 03:24 |
|
I am in posted:So why is the same name most natural for both of them? If it's because they are the same thing then you should use the field directly. Look at that accessor again. It's a lazy-instantiation pattern.
|
# ? Feb 24, 2012 08:02 |
I don't really have a good reason for needing lazy loading, it just seemed convenient. My IDE gives them different colors, they aren't really ambiguous to me. I just want to access thingies all willie nillie in these methods, and not have to concern myself with whether or not they have been instantiated yet.
|
|
# ? Feb 24, 2012 10:42 |
|
Jabor posted:Look at that accessor again. It's a lazy-instantiation pattern. Right right. I'd call the lazily initialized field something like cachedThingies, so that the name thingies is available everywhere where it's clear initialization has happened.
|
# ? Feb 24, 2012 13:59 |
|
I am in posted:Right right. I'd call the lazily initialized field something like cachedThingies, so that the name thingies is available everywhere where it's clear initialization has happened. This actually makes a lot of sense. It's certainly more meaningful than having some awkward wart to signify a class member.
|
# ? Feb 24, 2012 16:44 |
I am in posted:Right right. I'd call the lazily initialized field something like cachedThingies, so that the name thingies is available everywhere where it's clear initialization has happened. I like this, thanks guys!
|
|
# ? Feb 24, 2012 19:35 |
|
In C#, the standard practice is to name private fields starting with an underscore- could work in Java, too.
|
# ? Feb 24, 2012 20:42 |
|
Internet Janitor posted:In C#, the standard practice is to name private fields starting with an underscore- could work in Java, too. Oh you
|
# ? Feb 24, 2012 20:52 |
|
Hungarian notation is one of those ideas that will never stop being reinvented, as long as programmers have to name things.
|
# ? Feb 24, 2012 20:59 |
|
I don't think "adjectiveType" identifiers such as "cachedThingy", "tempFoo" or "someBar" count as Hungarian notation so much as a self-commenting literary identifiers. Ad-hoc scoping with underscores is just as open to divergence and ambiguous interpretation as other much unstated and unenforced conventions.
|
# ? Feb 24, 2012 22:20 |
|
Paolomania posted:I don't think "adjectiveType" identifiers such as "cachedThingy", "tempFoo" or "someBar" count as Hungarian notation so much as a self-commenting literary identifiers. Ad-hoc scoping with underscores is just as open to divergence and ambiguous interpretation as other much unstated and unenforced conventions. Oh gently caress, I guess I misread Internet Janitor's post. Yes, I agree with this. I hope I can explain my thought-process for coming up with the name cachedSomething without coming off like a huge pedant. So I have some data that's lazily-initialized, but why go for lazy initialization? 1. Naming it cachedItems says that it comes from an unreliable external source like an SQL database and my snapshot can go stale with no ill effects. 2. Naming it computedItems says it's the result from an expensive algorithm that I could rerun whenever and get the same results. 3. The lazy initialization is actually part of two-phase construction and the objects are reused in an object pool: naming it items is fine, because everything else in the object should work as if the object had been fully initialized in the constructor. That last one is a bit of a stretch. Max Facetime fucked around with this message at 01:23 on Feb 25, 2012 |
# ? Feb 25, 2012 01:14 |
|
I'd use "things" instead of "thingies". Also mangling using underscores is punishable by death. Unrelated, a question about caching with a SoftReference. I've got an object where one of its fields can be easily reconstructed if need be, it's a ZonedDateTime constructed out of a long. I'd like to use a SoftReference since it isn't actually necessary memory. IBM's code here: https://www.ibm.com/developerworks/java/library/j-jtp01246/index.html says that once a SoftReference's referent is collected, I can reset it to a new object with SoftReference#set. Except that that method doesn't exist. Do I just do: code:
(I don't know if that compiles) e: added context Malloc Voidstar fucked around with this message at 07:57 on Feb 25, 2012 |
# ? Feb 25, 2012 07:54 |
|
You would appear to have two race conditions: A) Reference is dead initially, and gets GC'd between these calls: code:
code:
code:
|
# ? Feb 25, 2012 08:18 |
|
Sedro posted:You would appear to have two race conditions: And I know it's a premature optimization, but I'm using it anyway if it breaks, it'll fail loudly in any case
|
# ? Feb 25, 2012 08:32 |
|
MyBatis or JPA/Hibernate? Relative strengths? Background: After a lot of finagling to get Guice and JPA/Hibernate to play nice, I've finally got something hooked up to a h2 database (for testing) to where I can call entityManager.persist(foobar) or entityManager.createQuery("SELECT f FROM FooBar f").getResultList(), but I'm wondering if it's worth it. MyBatis' Guice integration looks awfully neat, and all this SessionFactory and EntityManager and persistence.xml stuff looks mighty confusing. However, JPA generates SQL schemas, which is super useful for me before I even know what my schema should be like. I'm tinkering with Quartz, Guice, and Abdera. For now the goal is just to get an RSS feed and stuff items in a database, but ideally I'd be crawling stuff like web searches or my facebook feed and persisting the crawl. Not really sure how to approach this, and I think that choice of ORM framework would influence these. This is sort of for a hobby thing so it's also for learning, so "Just use JDBC directly" is a boring option I'd prefer alternatives to.
|
# ? Feb 27, 2012 10:08 |
|
Hibernate is great until it's not. Once you hit that wall you will be loving pissed at it until you invariably rip it out. But that all depends on the scale of your application. If it never grows very big Hibernate is perfectly fine. Personally, I like it for prototyping and that's about it. Using the DDL generator (like you mention) is definitely a plus, it's a very slick little tool. MyBatis is great if you know SQL well and you don't really plan on being a DB nomad. SQL is a fine language and MyBatis is a good way of making your SQL calls less ad hoc.
|
# ? Feb 27, 2012 16:11 |
|
TRex EaterofCars posted:Hibernate is great until it's not. Once you hit that wall you will be loving pissed at it until you invariably rip it out. But that all depends on the scale of your application. If it never grows very big Hibernate is perfectly fine. Personally, I like it for prototyping and that's about it. Using the DDL generator (like you mention) is definitely a plus, it's a very slick little tool. Sweet. Thanks. I suppose I'll keep on going with JPA until I've got something worthwhile to make less prototype-y.
|
# ? Feb 27, 2012 19:14 |
|
I am a Python programmer, and I need to learn semi-basic Java. All the books I see online are really old, designed for people that have no idea how to program, and/or designed for people who are already know Java to hone their skills.
|
# ? Feb 29, 2012 03:06 |
|
|
# ? Jun 12, 2024 12:41 |
|
Have you looked at The Java Tutorials? From when I've come across them, they seem oriented at someone who is looking for examples of Java features but isn't necessarily completely new to programming.
|
# ? Feb 29, 2012 06:24 |