|
This is more an Eclipse setup question (and I come from an IntelliJ setup so Eclipse is very new to me) Project tree is /svn/project/trunk/core/src/main/java/com/company/package/class Project builds fine with Maven, and works properly when deployed; however Eclipse keeps throwing errors that: com.company.package is not valid and needs to be main.java.com.package. It also does not recognize / reference other classes within the same package. Eclipse can see my Maven repo, but not this. I have the same project setup with IntelliJ and it's working fine. Using Dynamic Web Project at the moment, but the others had similar results. Is this a setting or in the type of project it should be?
|
# ¿ Jul 17, 2009 14:52 |
|
|
# ¿ Apr 28, 2024 20:26 |
|
zootm posted:Are you using the Maven plugin for Eclipse? I imagine some horrors occur trying to make Maven's ultra-consistent weirdness work within an ad-hoc project context. I have m2eclipse installed, but I don't think I'll use, I usually just build from the command line. I had the MVN plugin for IntelliJ installed and maybe used it once total over 3 years. quote:This sounds like Eclipse doesn't know what your root source directory is . In the project properties, set the source directory to that "main/java". Then the packages will follow from there( eclipse will properly see com.company.package as the package). Yep, this was it - thanks!
|
# ¿ Jul 17, 2009 15:34 |
|
This isn't exactly elegant or the best solution. I have 1000s of XML files that reference each other. Each xml file has a "story_id" and may contain a "related_story_id". The related_story_id matches the file's name story_[related_story_id].xml Then it reads the related file and adds the primary_uri element value to a String[]. This is all output of Bricolage (an archaic and terrible CMS) via SOAP; unfortunately there's no time to go through and traverse the DB schema, but after spending the past few hours on this, I'm starting to wonder if it would be quicker. in "parseRelatedStory" I'm getting a NullPointerException and no values are being added to String[] relatedLinks and the line after which should output to the log file does not work. Should String[] relatedLinks actually be a HashMap? This nearly same block of code (except for a different subset of elements in the same XML file) works. I'm not sure why it may be failing here. code:
php:<? private String[] relatedLinks; public String[] execute() { Iterator<Element> childs = null; Element child = null; // field is private, but set here by a setter childs = field.getChildren().iterator(); while (childs.hasNext()) { child = (Element) childs.next(); if ("linkbar".equals(kid.getAttributeValue("element_type"))) { parseStoryXml(child); } } return relatedLinks; } private void parseStoryXml(Element elements) { Iterator<Element> containers = elements.getChildren().iterator(); Element container = null; int i = 0; while (containers.hasNext()) { container = (Element) containers.next(); if ("bricolage_link".equals(container.getAttributeValue("element_type"))) { if (!"".equals(container.getAttributeValue("related_story_id"))) { String story_id = "story_" + container.getAttributeValue("related_story_id"); parseRelatedStory(story_id, i); i++; } } else if ("non_cms_link".equals(container.getAttributeValue(element_type))) { parseExternalLink(container, i); i++; } } } private void parseRelatedStory(String story_id, int i) { try { Document doc = null; String fileName = getRelatedUri(story_id); boolean isPrimaryUri = false; SAXBuilder sax = new SAXBuilder(); doc = sax.build(fileName); Element assets = doc.getRootElement(); Element story = null; Element field = null; Iterator<Element> fields = null; Iterator<Element> stories = assets.getChildren().iterator(); while (stories.hasNext()) { story = (Element) stories.next(); fields = story.getChildren().iterator(); while (fields.hasNext()) { field = (Element) fields.next(); if ("primary_uri".equalsIgnoreCase(field.getName())) { if (!"".equals(field.getValue())) { isPrimaryUri = true; log.info("main story: " + storyId); log.info("FileName: " + fileName); log.info("Primary URI: " + i + " : " + field.getValue()); // All of these logs show up when the script is running. // nothiing is added to relatedLinks relatedLinks[i] = field.getValue(); // this does not output to the error.log file! log.info("relatedLinks length: " + relatedLinks.length); } // no need to continue parsing the XML file break; } } if (isPrimaryUri) { // no need to continue parsing the XML file break; } } else { log.error("fileName is NULL"); } } catch (JDOMException e) { // TODO Auto-generated catch block log.error("parseRelatedStory:JDOM: " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { log.error("parseRelatedStory:IOException - Most likely FileNotFound " + e.getMessage()); e.printStackTrace(); } catch (Exception e) { // also tried this with NullPointerException - catch works, no message // e.getMessage doesn't show anything log.error("parseRelatedStory:Exception " + story_id + " " + e.getMessage()); } } ?> Log file output this repeats for each main story_id code:
|
# ¿ Oct 21, 2009 18:42 |
|
tkinnun0 posted:I don't see relatedLinks being initialized, so it's probably null. Another thing is that arrays in Java do not expand after creation. Thanks! That took care of it. I've been switching between Java, JavaScript, Sling and PHP too much the past few days and I've pretty much just been cross-eyed because of it.
|
# ¿ Oct 21, 2009 19:27 |
|
Parantumaton posted:Maven, however, doesn't improve your build quality at all, it's like sticking ice picks into your eyes. You're better off making reusable Ant scripts and using Ivy for dependency management. Everyone seems to be torn (well not torn on opposite ends) on this , myself included. My old job moved from custom Ant scripts to Maven. Never really noticed any major issues except that we had several POMs per project and if one was out of sync, build would fail. Over all I like Maven and I like that Maven is pretty simple to setup and use from the start, but some things still trip me up and online help / documentation doesn't seem to cover it. My main issue with Maven: it's either all or nothing with including dependencies. I can't just add what's needed. This is especially frustrating since I work with OSGI and it's easier to include dependent jars in the build jar instead of going through the hassle of Bundle-ing them or hacking them to pieces ( had to do this with Apache POI) but that's another thread. geeves fucked around with this message at 06:15 on Nov 19, 2009 |
# ¿ Nov 19, 2009 06:12 |
|
Actually, based on my last post I have a question: Is it bad form to hack apart and repackage Jar files, especially those from Maven repos? I work with OSGI, so it's a bit of a pain and here's why: We need Apache POI for dealing with Excel documents (we dont' need POI, but it's super easy to work with and we're only reading before passing data onto the JCR). But when loading into OSGI we need 2 jars: poi-3.x-FINAL and poi-ooxml-3.x-FINAL Basically to instantiate the code it's: Workbook wb = WorkbookFactory.create(InputStream in); Well, WorkbookFactory is in poi-ooxml and Workbook is in poi-3.x yet they're in the same location / package (org.apache.poi.ss.usermodel) OSGI will only load the classes of the package of the jar that's loaded first. So if I load poi-3.x first WorkbookFactory is not seen (even if it's in the MANIFEST) or if I load poi-ooxml first, Workbook (and other classes in poi-3.x) won't be seen or available. I get this as a fail-safe. To get POI to work, I had to extract the jars, move WorkbookFactory into poi instead of poi-ooxml (it was the only class in that package in poi-ooxml) then re-jar the classes, create bundles using Bnd (http://www.aqute.biz/Code/Bnd) and upload them to my OSGI manager. It works. I couldn't be happier. But, is this retarded or stupid? Is there a better way? Related to the above issue that, for me, Maven has been an all or nothing build with my dependencies (many of which are already loaded into the OSGI repo that I'm using). Hence why I had to find an alternative to include 3rd-party packages. On the final note: I really like OSGI - it's saved lots of time in restarting the webserver as well as giving an immediate rundown on what's working or what's not because of a dependcy missing. But some things are a bit of a pain that could be solved in other stages of development.
|
# ¿ Nov 19, 2009 06:45 |
|
I'm having a problem setting a cookie via the HttpServletResponse object with all flavors of IE. When in debug mode, everything is set as it should be and I can follow the Response through the Servlet and the JSP code. But it fails to be set. Is there something I'm missing with IE? I have never run into this problem with JavaScript or PHP or even Java before. Firefox, Opera, Safari, Chrome all work as expected. It's just IE. In a method for UserLogin I have the following: php:<? Cookie fooCookie = Bar.addCookeu(handler, request); if(null != fooCookie) { reponse.addCookie(fooCookie); } ..... // in Class Bar: public static Cookie addCookie(ContactHandler handler, HttpServletRequest request) { Cookie fooCookie = null; String uuid = ""; String pass = ""; int age = -1000; String cookieString = null; if(null != handler) { uuid = handler.getUuid(); pass = handler.getPassword(); age = (handler.isRememberMe()) ? Constants.COOKIE_LENGTH_REMEMBER : Constants.COOKIE_LENGTH_DEFAULT; cookieString = uuid + ";" + pass; log.info("Cookie String: " + cookieString); } try { fooCookie = new Cookie(Constants.COOKIE, cookieString); String serverName = ".foo.org"; fooCookie.setDomain(serverName); fooCookie.setPath("/"); fooCookie.setMaxAge(age); } catch (Exception e) { log.error("CAN'T ADD COOKIE: " + e.getMessage()); } return fooCookie; } ?>
|
# ¿ Nov 25, 2009 20:31 |
|
dreamality posted:I believe it's got something to do with foo.org is just replacing my company's domain.) I'll try a simpler one and it fails with and without setDomain().
|
# ¿ Nov 27, 2009 01:39 |
|
tef posted:Any recommended json libraries or such? I've been looking at this as well and currently have been comparing json.org/java vs json-lib.sourceforge.net (based on json.org but probably a bit more developed, according to them) and Jackson http://jackson.codehaus.org/ There is also one in Sling, but it's a bit limited and geared toward working with a JCR.
|
# ¿ Dec 10, 2009 16:42 |
|
I have a question about performance and loops. Right now it works, but I'm looking for efficiency. I guess this is more general programming than Java, but here it goes. I am getting a list of tags, looping through them and then looping through the list of pages each of them return. I'm working with a Java Content Repository. So I have a loop within a loop. I've never thought this was ideal. I'm still a somewhat Java beginner when it comes to certain concepts, but I hate nested IF statements, especially when checking for NULL. Should I leave that to the catch / exception handling? If something is null I don't want it to kill the whole loop, just ignore it (and log it, of course). Should the second loop be another method or does that not matter? Is it better to have a nested try/catch/ finally? Should these be in a separate method? Is it personal preference? Or just something I'm stuck with? Besides working, I like to go for readability and I know I'm not perfect in that area, but I do try my best. code:
|
# ¿ Dec 15, 2009 05:59 |
|
HFX posted:I'm having a bit of trouble figuring out the bigger picture of what you are doing (which could help me recommend something better for you). A simple weighting system for recommending an item for a user. I have, for example, 7 tags on an Item. Each of those tags maybe used on 40 or 50 other Items. If an item already exists in the HashMap, then its weight (the Integer) is added. If it's a certain "mega" Item, its weight is +2 instead of +1. That's a simple if/else in the if (null != page) quote:
It runs only when a user saves an item to their cart. I don't know how often this will run. We know very little of the behavior of our visitors aside from what basic HTTP stats will tell us. Our site however gets upwards of 600-700k unique visits per month and 4-5 million page views per month. How many people will register and save content - I don't know. Nobody does and yes, that is the problem. This is an entirely new feature and we're going from a completely static HTML site (managed with a "baked" CMS) to a JCR-based content repository. Basically I'm thinking worst case scenario. quote:Now for your code: That is the whole method, minus an if/else statement in the inner loop. I used to write a lot of loops for some hosed up business logic that needed to break the outer loop, so it's an old habit to label them in that way. quote:
That's been the problem with development, we have so much content and items that it's several gigs to import onto our local machines. That and there were several iterations of importing (to find the best structure in the JCR) so it was just easier to check for null or else it would throw a NullPointer and kill action. quote:With more knowledge about what you are trying to achieve, I possibly could recommend a better way of solving it, however, there is nothing super wrong about code.
|
# ¿ Dec 15, 2009 17:03 |
|
Not a specific code question When are the best times to synchronize? It seems like the logical choice is for when transactions occur (adding / modifying database or repository). But are there other times when synchronization becomes crucial? Or should it be kept to the minimum?
|
# ¿ Jan 15, 2010 05:41 |
|
wigga please posted:I'm a .NET guy, pretty new to Java, and iI have a Struts/EJB question. I'm trying to teach myself some stuff but I'm pretty disappointed in the tutorials I found so far. Any collection should do.. have you tried using <logic:present> to see if it's been loaded / available? Are you able to access the Collection with JSP instead of struts tags? Also, just a quick check - you are including the logic taglib, right? That last one has lead me to many headaches over time. http://struts.apache.org/1.2.9/userGuide/struts-logic.html#iterate As for the second, yes, at my old job we loaded everything into the session scope on success of the Action.
|
# ¿ May 7, 2010 16:33 |
|
Does anyone have any recommendations for a solid and free / inexpensive code profiler? Perhaps one that's a plugin for eclipse?
|
# ¿ May 11, 2010 21:56 |
|
crazyfish posted:My personal favorite profiler that I use is jProfiler, however whether or not it will work for you depends on your definition of inexpensive. An academic license is $200 and a full license is $500. Thanks, We're a non-profit, and might be able to qualify for an academic license. I've never been the one to set up the profiler before and with only 2 other developers most is falling on my shoulders since the they are pretty much new to Java and my boss is paranoid about performance and potential memory leaks coming from a C/C++ background.
|
# ¿ May 12, 2010 01:27 |
|
I'm building a search based on weightings of Tags that ends with returning Weighted HTML pages. For example Tag A would have a value of 5, Tag B: 3, Tag C: 2, Tag D: 1. These are used as search parameters for a Lucene search with XPath. This search is ridiculously fast. It's searching through about 80,000 pages. Takes less than a second most searches. Search returns Page A that has Tags B & C, Page B has tags A, C & D and so on. Anyway, that's not the problem, the search on average returns 6500-8000 Pages. Each Page has a certain number of Tags assigned to it, so now I have a loop in a loop. I have to go in and weight the returned Pages and order them descending. I'm using a HashMap<String, Integer> (Page.getPath(), Total Weight) right now to handle this, but I don't this this is the best way and this adding of total weights. So I end up with something like this. Not pretty, but I'm at a loss on how to improve this or if I should even be using a Map for this (I inherited the initial version from a Contractor we had and all around his code was sub-par) . Right now this part takes ~6 seconds to run. code:
|
# ¿ Jun 1, 2010 14:36 |
|
TRex EaterofCars, Added the initial capacity, didn't make much difference.rjmccall posted:1. Consider whether you can reasonably just add this as an int field to Page. Page is actually a Node (we're using a JCR) and it's its own object. I even went as far as thinking to extend it for this purpose, but that might be overkill. quote:2. You're doing a lot of unnecessary re-lookups. This actually hashes the tag name twice: Did this, no improvement. quote:3. Profile. quote:4. If Page is hashed/compared by object identity, consider using an IdentityHashMap. It's actually a totally different hash implementation from HashMap which is (1) substantially faster and (2) substantially less memory hungry. This is where I am now. Giving it a try. quote:5. Consider making the values of pageWeights a mutable record of some kind so that you don't have to create new objects all the time. You're talking about where I create Integer weight = pageWeights.get... ?
|
# ¿ Jun 1, 2010 21:42 |
|
Sereri posted:To be fair, those are from the mid to late 90s and haven't been updated ever since. There's stuff in it like "Avoid lines longer than 80 characters, since they're not handled well by many terminals and tools". This is completely subjective, but I've found the 80 character limit to be a decent rule of thumb for readability. Usually up to about 120 characters is good for me; anything more than that, usually have to scroll to the right and it becomes easy to overlook something when debugging.
|
# ¿ Jul 6, 2010 15:55 |
|
HFX posted:I like this one too. Can make it hard to sometimes deal with passing args without storing to a temp variables first. I have a widescreen laptop / Apple monitor as well - it's great and that if I wanted to, I could get to 220 characters in one line at my resolution / font size. I just prefer to read straight down instead of having to read way across the screen. Like I said, just more a matter of personal preference (thought I have Checkstyle set to 150 characters - more so to accommodate co-workers' styles.
|
# ¿ Jul 7, 2010 00:28 |
|
Here's really candid interview with James Gosling - some interesting tidbits, including a bit about microSPARC that was a touchscreen LCD in the early 90s - which the people leading that were heavily involved with the iPad later. http://basementcoders.com/?p=721 http://www.basementcoders.com/transcripts/James_Gosling_Transcript.html
|
# ¿ Sep 29, 2010 05:01 |
|
Anyone take the IKM tests for Java? Reasonable or should I brush up on obscure stuff?
|
# ¿ Nov 5, 2010 04:51 |
|
What are some decent frameworks that anyone can recommend I take a look at - I know a bit about what's out there, but I've been mainly stuck in Struts and Apache Jackrabbit / Sling for the last 5 years and really haven't really looked. I have the opportunity to possibly pick something fresh (for me anyway) for a small freelance project I'm taking. The project is a licensed search-oriented application based on pre-defined content - there are other details to be handled but that is the bulk of the application.
|
# ¿ Mar 6, 2011 18:55 |
|
Stubb Dogg posted:I recently worked on a project with Seam 2.2 and it removed lots of usual annoying stuff you have to deal with when doing complex web sites in Java and made it actually enjoyable. Thanks to everyone who responded - seems it was all for naught though - for at least the demo. I have to convert their DB from... Filemaker Pro to MySQL. 1 million records which will convert to about 25k after properly designing the DB. Unfortunately it seems I'll be doing the proof of concept in PHP since more of my time is being spent converting this database - as well as hosting it myself.
|
# ¿ Mar 8, 2011 05:02 |
|
This is Struts 2 specific - but <html:select /> won't apply the error css class or style when I add addFieldError(String elementName, String errorText). Google has failed me and all I've been able to find is discussion about the addFieldError method in general. We don't have any special tags to further handle the struts tags in case of an error. Edit: figured it out. html:select needs cssErrorClass to be set. Which for some reason is not an attribute that's required for textfields / areas / etc. geeves fucked around with this message at 17:23 on Feb 2, 2012 |
# ¿ Feb 2, 2012 16:19 |
|
I am in posted:I was pleasantly surprised by GSON's ability to fill fully generic containers inside objects correctly without needing to add extra annotations or getters. Yeah GSON is great. Just make use of their exclusions, especially if you use Hibernate and have associated mappings. It will cry foul about circular dependencies (even if they're not)
|
# ¿ Jul 19, 2012 22:50 |
|
Struts 2 question (possibly). And it's difficult to explain so I hope this comes across simple to follow. I have a user-created dynamic form that's built with loading components via ajax (for cardinality, nested form fields, etc.). All of the fields dynamically added have a name of formfield[N]. N being the row index. Due to the dynamic ajax loading, for each added field, incrementing is not sequential, but skips by 10 (for more complicated reasons, it cannot be sequential as technically we're loading 2 or 3 fields not just one). When the form is submitted, it thinks the formfield List size is 100, instead of just 10. That's been fine, until now. When the form fails validation, (the values are saved no matter what) the formfield List is reloaded in the Action. The Action would clear out and null the formfield List and get a fresh set of the List from the DB. What is happening now, is that the formfield List still thinks it has 100 members and outputs 100 fields instead of just 10 fields (though logs and debugs say there is only 10 members). Following the debugger, 10 are loaded and all the data matches up, but instead 100 fields are now displayed once formfield gets to the JSP. It seems that something in Java or Struts is keeping the submitted formfield List in cache / memory / something instead of using the cleared, null'd & fresh formfield List. I've been stuck on this for most of the day, and really having a hard time asking the right question. The HTML would look something like this (these have been dynamically added): code:
code:
code:
geeves fucked around with this message at 17:55 on Oct 3, 2012 |
# ¿ Oct 2, 2012 22:13 |
|
Gravity Pike posted:Personally, I have a strong preference for JSON unless there is a compelling reason not to. The Gson library is super nice to work with. Gson is great. Just be weary if you use with with Hibernate objects (specifically 3.x, haven't used 4.x) as it can get messy with mapped objects that could end up circularly referenced. So make sure you use the @Expose annotation in those cases.
|
# ¿ Jul 1, 2014 03:17 |
|
Have a Jersey 2 question that I hope is just something small that I'm missing. We're creating an Asset library for users to upload video, docs, etc. for the projectson which they'll be working. I've found similar answers, but those cover most of what I've already done, with the form, method, web.xml and registering MultiPartFeature.class. Here the simple act of implementing a ContainerRequestFilter impedes MULTIPART_FORM_DATA (file upload) from uploading. Returning 415. I'm curious what I'm missing, as I've followed the docs. Anyway, the following works sans filter and the file uploads as expected and returns what is expected. code:
code:
code:
geeves fucked around with this message at 21:43 on Feb 20, 2015 |
# ¿ Feb 20, 2015 21:02 |
|
Volguus posted:On Home Depot there were some articles that were saying that the higher ups were warned years before about the lack of security and potential breaches. And they didn't give a poo poo. How do you think they'll behave when you come and tell them about how well are you going to make this software, and how many good development practices are you going to apply once you present them the price for it? This is what's infuriating about my company. Our deadlines are set by marketing. Marketing! Some arbitrary date that seems like they're slotting a movie for release than they are a SaaS application. We've been run by marketing and their existential threats for the last few years. We were hacked through an exploit in Struts - a well known exploit and even we raised it to get time slotted to upgrade (we were denied) . Suddenly we had to basically halt everything to address this because what we said would happened, happened. It probably doesn't help that we are in one city while the rest of the company is in another. It doesn't even feel that we're part of a company. It feels like we're more a group of independent contractors. Our CTO is in our office, and he knows about all of our complaints and suggestions for improvements; they're well documented. Yet either he is not willing or not able to get the point across to the rest of the executives that some things need to be addressed. The CEO and others rather keep up the charade instead of actually delivering a well-designed and well-tested product. Hell, until the last 6 months we hadn't had a new hire in almost 3 years while the other office nearly tripled in size to meet non-existing demand. Volguus posted:I have learned over the years to pick my battles, however. Always try to improve, always try to do the right thing, but look at your surroundings, look at what can you do and let some things go if you have to. Change them if you can on the fly, and if you hit a wall ... make your decision then if you want to continue or not. You are sounding like a stubborn little child who's not going to do his homework unless the exact amount of cake is present on the table. No more, no less. And throws a tantrum until the cake arrives on the table. Good luck, is all I can say. I've learned just to do whatever I want to improve things when I can and ask for forgiveness later; my boss has basically given me his approval for this approach. It's the only way we get critical things done that aren't new functionality.
|
# ¿ Mar 31, 2015 23:22 |
|
Volmarias posted:The same key combo to lock the screen on Ubuntu. You can change it in the keymap to whatever combo you'd prefer.
|
# ¿ Sep 2, 2015 15:54 |
|
The Laplace Demon posted:And how you'd actually write the above in Java 8: My company just upgraded to Java 7. Now I want them to upgrade to 8 because this involves a good portion of what I deal with.
|
# ¿ Sep 7, 2015 21:40 |
|
Zaphod42 posted:A list should never be called "currentItem", that makes no drat sense. Having "currentItem" and "aCurrentItem" is REALLY confusing. Don't do that. My coworker does poo poo like this, as well as using shortened names that are sometimes hard to decipher. I've wasted a lot of time just trying to figure out what things are when using semantic names would make things much quicker.
|
# ¿ Oct 5, 2015 18:44 |
|
Squashy Nipples posted:Also, its taking me a while to get used to the Java variable naming conventions, I really miss prefixing with the variable type, as it makes them stand out to me. Because we're not writing PHP. I still use str / int / dbl as a prefix sometimes when stubbing out methods until I figure out a better name. I especially did this in my earlier days when my methods would be stupidly huge and cumbersome.
|
# ¿ Oct 6, 2015 20:22 |
|
Gravity Pike posted:Arcane generics/inheritance typing question: I think the problem was that your Scratch class doesn't reference a Record object or have a wikiWikiWiki() method
|
# ¿ Oct 7, 2015 00:21 |
|
Necc0 posted:This question isn't for me but a coworker of mine was put in a really lovely situation and I want to help*. Does anyone know of a really good Java decompiler? Long story short he's working for a customer who has customizations in their environment that were written 10+ years ago and the original source code has been lost. Don't know if it's because the consultant who wrote originally wrote it sucked rear end and still works here or left 7 years ago or what. We don't have the source code. All we have are the compiled .class files on the server and in the backups. He's been playing around with solutions he found via Google but I've learned that obscure yet generic/old tech problems are probably the worst queries for Google since you only get stuff that was popular back in 2003. In all likelihood there's better stuff out there and I'm guessing if anyone knows it'd be one of you guys. If you're using intellij it is pretty good at decompiling as well right in the editor.
|
# ¿ Nov 5, 2015 04:20 |
|
I am terrible with Dates and it's the first time I've used Java8 with date formatting. I have a date string (example: 2015-11-23T12:00:40+00:00) It's pulling a date from a Wordpress formatted date in the <meta property="article:published_time"> tag. What is the parse string? I've tried: yyyy-MM-dd'T'HH:mm:ss yyyy-MM-dd'T'HH:mm:ssZ yyyy-MM-dd'T'HH:mm:ssZZ yyyy-MM-dd'T'HH:mm:ssZZZ I've been following the patterns here: http://stackoverflow.com/questions/4216745/java-string-to-date-conversion Code: code:
code:
geeves fucked around with this message at 17:22 on Oct 16, 2016 |
# ¿ Oct 16, 2016 17:19 |
|
venutolo posted:You want something like this (fix any typos if it doesn't compile): Thanks! That helps a lot! My only problem is that BoundStatement for Cassandra still relies on the java Date object. Typical.
|
# ¿ Oct 16, 2016 19:00 |
|
hooah posted:I'm trying to deepen my Java knowledge, so I'm reading through some of the more esoteric (to me) sections of the Java Trails. I've come across lambdas, which are throwing me a bit. Specifically, why is it that in Approach 6, a lambda can be used instead of a Predicate<T> interface? I thought an interface (sort of like a pure abstract class in C++) and a lambda (a function without a name) were two very different things. I actually just read this last night. I hope I'm wording this correctly, but lambdas / functional programing are inferring the type of object for you without the defining them ala generics. Since Predicates return a Boolean, the interpreter translates what you're doing as that. quote:Type inference Predicate < Integer > greaterThan5 = x > x > 5 This book overall is pretty good read so far. We just started using Spark, so between this and learning Scala, lambdas and functional programming are the new norm for us.
|
# ¿ Oct 24, 2016 03:08 |
|
Sedro posted:java.util.Function is a Java 8 thing. You need to either point to a newer JDK or configure the Java language level. They're both under the menu File -> Project Structure. Edit: wait, is it java.util.function.Function ? Other alternative to open project settings is CMD + ; on Mac Not sure on Windows. Pretty sure it's CTRL + ; geeves fucked around with this message at 03:48 on Oct 25, 2016 |
# ¿ Oct 25, 2016 03:43 |
|
|
# ¿ Apr 28, 2024 20:26 |
|
baquerd posted:Usually they use a Blackhawk on ISIS, not the Apache. Thank you. I couldn't think of a good pun for this.
|
# ¿ Nov 11, 2016 00:27 |