Hilariously I've actually found the most use of regexes outside actual programming - usually in Sublime when I have to apply the same transformation to a shitton of (log lines|method names|variable names)
|
|
# ? Dec 6, 2017 04:19 |
|
|
# ? Jun 6, 2024 19:53 |
|
Volguus posted:You have one problem. You decide to solve it using regular expressions. Now you have two problems. It's a greedy regex and now you have all of the problems
|
# ? Dec 6, 2017 05:06 |
|
I am often tasked with parsing plain-text files generated out of mainframes with little guide to where and what can appear in the file. Think human readable reports generate by Cobol code from the 70s-90s. In order to do this, I use regular expressions a lot. One item I have found is, don't make your regular expressions overly complicated. Sometimes it is better to use several small regular expressions chained through code to get what you need than one giant one. Finally, be sure to performance test often because regular expressions will happily do to much work all the time.
|
# ? Dec 6, 2017 17:49 |
|
I'm wondering if anyone can recommend a "java for utter neophytes" learning resource. I was looking at this, but I'm not sure how up-to-date it is (I think they were using JRE 7). Or maybe that's not as much of a concern with Java? I dunno, with Python the switch from 2 to 3 was pretty significant. Anyways, any suggestions are appreciated.
|
# ? Dec 16, 2017 15:53 |
|
Seventh Arrow posted:I'm wondering if anyone can recommend a "java for utter neophytes" learning resource. I was looking at this, but I'm not sure how up-to-date it is (I think they were using JRE 7). It wouldn't be the end of the world--Java is usually very stable version to version, so there won't be too many things that have changed (Java modules in Java 9 are the only thing that comes to mind), but you'd be missing out on many new additions, including some very nice syntax features added in Java 8 surrounding Lambdas and Streams. Since it sounds like you know some programming, the official Java tutorials are usually recommended around here: https://docs.oracle.com/javase/tutorial/ but Java was my starting language back in college so others who picked it up by themselves will probably have better recommendations.
|
# ? Dec 16, 2017 15:59 |
|
carry on then posted:including some very nice syntax features added in Java 8 surrounding Lambdas and Streams. That's underselling it a bit; lambdas and streams are so amazingly good and useful that any course that doesn't cover them is really missing out. For someone who is completely new to programming I'd recommend Eloquent Javascript (which isn't Java obviously but it's the best introductory book I've ever seen and it sets you up nicely for the additions in Java 8) followed by going through the most recent editions of Core Java.
|
# ? Dec 16, 2017 16:15 |
|
I dunno if I'd recommend a Javascript book to a programming newbie who eventually wants to learn Java. It looks similar but works so differently, I think it would just end up confusing them
|
# ? Dec 16, 2017 16:37 |
|
If it helps, I'm looking to learn Java with an eye towards being a data engineer - so lots of ETL, batch processing, data lakes, data warehousing, that kind of stuff.
Seventh Arrow fucked around with this message at 16:50 on Dec 16, 2017 |
# ? Dec 16, 2017 16:47 |
|
baka kaba posted:I dunno if I'd recommend a Javascript book to a programming newbie who eventually wants to learn Java. It looks similar but works so differently, I think it would just end up confusing them Although I wish the author would have picked a better language, Eloquent JS is at least nice enough to tell you when JS is crazy and bad (equality testing, inheritance, scoping) so I don't think it would be a problem. It's like learning C++ so you know why modern languages don't let you do weird things that melt your entire codebase into an unmaintainable mess.
|
# ? Dec 16, 2017 17:04 |
|
The Phlegmatist posted:Although I wish the author would have picked a better language, Eloquent JS is at least nice enough to tell you when JS is crazy and bad (equality testing, inheritance, scoping) so I don't think it would be a problem. It's like learning C++ so you know why modern languages don't let you do weird things that melt your entire codebase into an unmaintainable mess. I don't really mean the gotchas (although those are confusing too), just that your approach to solving a problem and writing code is very different. A lot of what you learn just won't apply to Java at all, and some of it might look confusingly similar. It's definitely good to experience this stuff later, to expand your knowledge and skills, but for a beginner I think it would be frustrating to learn a bunch of stuff that's "wrong" in the language they're actually gonna be using If it's someone who actually wants to learn JS, or just 'coding' (so JS is an option they can go with) then great! It is a real good book for JavaScript, definitely - but if the goal is to learn a specific language, for someone who's unfamiliar with programming, I just think it's better to focus on teaching them through that language Seventh Arrow posted:If it helps, I'm looking to learn Java with an eye towards being a data engineer - so lots of ETL, batch processing, data lakes, data warehousing, that kind of stuff. You're already coding in Python though right? So really you just want to get a handle on Java? The Java trails linked up there are honestly decent and pretty short (skip generics for now, they're needlessly confusing) - that should give you a good grounding in the language. Effective Java is a standard intermediate book, and Java Concurrency in Practice is really useful for understanding... concurrency and all the issues it can cause, being aware of them and the tools you have to wrangle it
|
# ? Dec 16, 2017 17:50 |
|
baka kaba posted:If it's someone who actually wants to learn JS, or just 'coding' (so JS is an option they can go with) then great! It is a real good book for JavaScript, definitely - but if the goal is to learn a specific language, for someone who's unfamiliar with programming, I just think it's better to focus on teaching them through that language I dunno, I'm of the opinion that it's best to learn fundamentals instead of just learning the syntax and standard libraries for a chosen language -- and Eloquent JS is really good at teaching modern programming fundamentals. Yeah you'll probably run into issues trying to translate what you learn to Java but that's just something you will always deal with in your career. I still accidentally run into the most vexing parse in C++ after having learned Java first. There's no real Java equivalent for that book and I wish there was.
|
# ? Dec 16, 2017 18:07 |
|
baka kaba posted:You're already coding in Python though right? So really you just want to get a handle on Java? I'm still kind of noob-ish on python, though, so a beginner resource on Java is probably still necessary. Anyways I'll try out the recommended resources, thanks!
|
# ? Dec 16, 2017 18:11 |
|
The Phlegmatist posted:I dunno, I'm of the opinion that it's best to learn fundamentals instead of just learning the syntax and standard libraries for a chosen language -- and Eloquent JS is really good at teaching modern programming fundamentals. Yeah you'll probably run into issues trying to translate what you learn to Java but that's just something you will always deal with in your career. I still accidentally run into the most vexing parse in C++ after having learned Java first. There is Effective Java - which just released v3 this week - been skimming through the PDF at the new stuff, covers lambdas and streams really well. Java in a Nutshell is also a really great book I always thought. I use it when working with web devs who want to make the transition to java.
|
# ? Dec 21, 2017 02:04 |
|
In school I used Introduction to Java Programming by Liang. I thought it wasn't bad. I haven't read any other Java books, though, so I can't really compare. By the way, please do NOT try to learn Java using the books meant to practice for the Oracle Java certification exams. Those do a terrible job at teaching you how to use the language, they're there to teach you some of the more obscure inner workings of the language, and to make you learn the syntax so thoroughly that you could replace the compiler's error checker. Because that's what those certificates are about. IMO those certificates have no practical use except some employers like to see them on your resume. Because apparently IDEs haven't been invented and we're all coding in vi.
|
# ? Dec 21, 2017 08:14 |
|
Someone I knew suggested this: https://www.safaribooksonline.com/library/view/learning-modern-java/9780134383613 and that's what I've been going with. The guy is a bit long-winded but other than that, so far so good. Thanks for the suggestions though, I'll check them out if I need additional materials.
|
# ? Dec 21, 2017 15:01 |
|
I'm brand new to Java development. I've purchase a few books to get started and will gradually build my skills through reading their content. At some point I'd like to develop a simple P2P program. Is JXTA/JXSE still the way to go for that or are there better options? Cross platform communication isn't a strict requirement, but it would be nice to have my PC talk to my Android phone.
|
# ? Jan 1, 2018 19:57 |
|
Can anyone tell me if I'm doing something wrong here. This test method converts RGB values from sRGB color space to CIE XYZ color space and back. Nothing more. It uses java.awt.color.ColorSpace to do the conversion. The usual RGB range of 0...255 is normalized to 0.0f...1.0f for conversion.Java code:
code:
|
# ? Jan 2, 2018 07:54 |
|
Wheany posted:Can anyone tell me if I'm doing something wrong here. This test method converts RGB values from sRGB color space to CIE XYZ color space and back. Nothing more. It uses java.awt.color.ColorSpace to do the conversion. The usual RGB range of 0...255 is normalized to 0.0f...1.0f for conversion. Have you stepped through it with the debugger? It's the first time around the loop so you should see where it's going wrong pretty quick Honestly I can't see anything wrong with your code, it looks like the conversion just isn't giving the results you're expecting. Are you sure that original colour is in the sRGB gamut? Maybe the conversion back is hitting the closest valid colour
|
# ? Jan 2, 2018 08:33 |
|
baka kaba posted:Have you stepped through it with the debugger? It's the first time around the loop so you should see where it's going wrong pretty quick The original color is the rgb value I generate in the 3 nested for loops. R: 0, G: 0, B: 31 definitely is in the sRGB gamut. Testing different gray levels: [0.0, 0.0, 0.0] -> [0.0, 0.0, 0.0], delta 0.000000 [63.75, 63.75, 63.75] -> [57.622566, 57.050583, 52.731518], delta 14.277065 [127.5, 127.5, 127.5] -> [125.47082, 126.44358, 126.61089], delta 2.454407 [191.25, 191.25, 191.25] -> [190.36186, 190.35019, 190.54085], delta 1.449602 [255.0, 255.0, 255.0] -> [249.69261, 252.73541, 252.98444], delta 6.112219 That last one (white) would be correct if I rounded and clamped the RGB values, yay! I could understand there being a difference if I made any further processing to the color, but it's just a straight round trip from sRGB to XYZ and back, using the same ColorSpace object. Edit: I tested all 16.7 million RGB values and there were 191 colors where every color component was less than 0.5 away from the original after the roundtrip. Wheany fucked around with this message at 09:36 on Jan 2, 2018 |
# ? Jan 2, 2018 09:26 |
|
Wheany posted:The original color is the rgb value I generate in the 3 nested for loops. R: 0, G: 0, B: 31 definitely is in the sRGB gamut. Do you know what you SHOULD get in the CIE XYZ? Then you can check if there's an issue with the to..() or the from..() or even both methods. Your code looks ok even though I have no clue about color spaces and if they are truly bijective.
|
# ? Jan 2, 2018 15:06 |
|
As far as I know, CIE XYZ is the "uber" color space that contains all other color spaces. And anyway, the only color space conversions that should be lossy (excluding rounding errors) are ones that reduce the number of channels (color to grayscale) or where the gamut of the destination color space is not big enough to contain the original color space. Going from sRGB to XYZ and back should be lossless, as far as I know, since XYZ is bigger than sRGB. Then again, I tested the conversion with ImageMagick: magick hald:2 -depth 8 hald-srgb.txt magick hald:2 -colorspace XYZ -colorspace sRGB -depth 8 hald-xyz-roundtrip.txt And while most of the colors are converted losslessly, the brightest colors aren't: code:
This is imagemagick's built-in hald:2 image mentioned on the command line above, enlarged 1000% And this is it after the roundtrip: What is weirder is sRGB -> Lab -> sRGB in imagemagick is lossless magick hald:2 -colorspace Lab -colorspace sRGB -depth 8 hald-lab-roundtrip.txt even though according to https://github.com/ImageMagick/ImageMagick/blob/beb4c2b6fc958ce24feb400366624b3f1979759b/MagickCore/colorspace.c#L200 rgb-lab conversion is done through xyz C code:
|
# ? Jan 2, 2018 17:16 |
|
Working on upgrading from Struts 2.3.24 to 2.5.14.1 Struts 2.5 repackaged com.opensymphony.xwork2 into Struts and you're supposed to remove xwork2 from Maven / Gradle. This was not documented anywhere and seems to be a straight import of xwork2 2.3.24 (it's still referenced as such in "gradle dependencies") EXCEPT ActionContext was changed where instead of returning a Map<S, O> they changed it to something new HttpParamters and didn't even bother to update the goddamn JavaDoc. I'd like to see what else Struts decided to change without documenting anything, but I'd rather just gaslight Struts to the ground once and for all.
|
# ? Jan 2, 2018 21:20 |
|
Is Grails dead in the water, or what? I see that its Eclipse integration support died a few years ago and its IDEA integration needs the Ultimate edition in order to help with GSP files. Did everybody move on to something else? (And if so, what?)
|
# ? Jan 4, 2018 18:48 |
|
CPColin posted:Is Grails dead in the water, or what? I see that its Eclipse integration support died a few years ago and its IDEA integration needs the Ultimate edition in order to help with GSP files. Did everybody move on to something else? (And if so, what?) 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). Just out of curiosity, if you're familiar with current day Grails and list its features and compare them with Spring Boot, what do you get? What would be the killer thing that Grails has that Spring Boot doesn't (other than Groovy)?
|
# ? Jan 4, 2018 20:26 |
|
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 |
|
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.
|
# ? Jan 5, 2018 18:46 |
|
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 |
|
poemdexter posted:Spring Framework has been around forever it feels like and is incredibly stable and easy to use imho. Grails is using spring/hibernate/everything else as well. What Grails was bringing to the table was the convention over configuration paradigm that became popular with Ruby on Rails. Which is now the same approach that Spring Boot takes, although Spring Boot does a little less out of the box than Grails. With a generator like jhipster though, one can have a fully working CRUD Spring Boot application in seconds, with security, admin panel (basic, but working), swagger and a lot of ther things on top. This is why I asked about the feature comparison, because in the last decade I assume it evolved and it does a lot more than it used to.
|
# ? Jan 5, 2018 23:03 |
|
I was wondering for half a day why my UnitTests don't log to console.. turns out one of the cached packages sets the warning level of the root logger to WARN. For some reason it was part of the classpath, and when it loaded that log4j.xml it ignored my log4j.properties settings. https://github.com/linkedin/rest.li/blob/master/generator/src/main/resources/log4j.xml This is not exactly a good practice for published packages, right? Is there anything I can do to prevent that from happening?
|
# ? Jan 8, 2018 14:36 |
|
Any reason to about the https://www.mooc.fi Java course?
|
# ? Jan 9, 2018 17:40 |
|
BabyFur Denny posted:I was wondering for half a day why my UnitTests don't log to console.. It sounds like you're using version 1 of the log4j library. Under version 2 according to this page https://logging.apache.org/log4j/2.x/manual/configuration.html you're properties file should have priority over the xml file. Version 2 has the useful feature of allowing for the log4j2-test.properties to be loaded first, thereby allowing you to control what logging config gets used for your unit tests. I use Maven so by putting that file in src/test/resources everything Just Works™. As for that library, it's very bad practice to ship a logging configuration file. Raise a bug on their tracker. They should be putting stuff like that in their src/test/resources folder instead src/main/resources.
|
# ? Jan 9, 2018 19:21 |
|
Harminoff posted:Any reason to about the https://www.mooc.fi Java course? I assume you are talking about the English language version of the Java course at http://mooc.fi/english.html ? It's a good course but getting a bit old. The English language material is largely from 2013 so it doesn't cover the newer Java features such as Streams. If you are fine with that, by completing all the exercises you are sure to pick up the language (and general programming) pretty well. The same material (well, with 4 or 5 years of updates) is used to teach the CS freshmen their first programming courses. As a bit of insider info there's talk of an effort to redo the English language part to 2018 standards (adds Streams, unit testing, visualization, JavaFX, much better exercises) next summer or so but, you know, university funding so no guarantees of the actual timeline with that.
|
# ? Jan 10, 2018 08:43 |
|
Harminoff posted:Any reason to about the https://www.mooc.fi Java course?
|
# ? Jan 11, 2018 07:26 |
|
They're using github certificates...
|
# ? Jan 11, 2018 13:27 |
|
Yeah a website that cannot set up a secure certificate correctly is probably not the best one to learn something about software engineering from.
|
# ? Jan 11, 2018 15:01 |
|
I'll contact someone who can fix that stuff.
|
# ? Jan 11, 2018 15:51 |
|
I'm starting to learn Hibernate and IntelliJ (some of us at work get to switch from Eclipse), and I'm suddenly having a very strange problem with IntelliJ: it says it compiles, but doesn't seem to produce any actual output. My src directory is marked as a source directory. What else can I check?
|
# ? Jan 15, 2018 03:12 |
|
hooah posted:I'm starting to learn Hibernate and IntelliJ (some of us at work get to switch from Eclipse), and I'm suddenly having a very strange problem with IntelliJ: it says it compiles, but doesn't seem to produce any actual output. My src directory is marked as a source directory. What else can I check? As in, your out directory is still empty?
|
# ? Jan 15, 2018 03:17 |
|
hooah posted:I'm starting to learn Hibernate and IntelliJ (some of us at work get to switch from Eclipse), and I'm suddenly having a very strange problem with IntelliJ: it says it compiles, but doesn't seem to produce any actual output. My src directory is marked as a source directory. What else can I check? you forgot to say "stay safe Java ghost" It went somewhere, probably into IntelliJ's out directory in your source tree. Check your compiler settings to see where it went. Javac complains loudly if an output path is not set, so it wound up somewhere. Are you using Maven/Gradle?
|
# ? Jan 15, 2018 03:34 |
|
|
# ? Jun 6, 2024 19:53 |
|
I've got a gradle.build file in the project, but I haven't yet told IntelliJ to use it. The compiler is set to output to path/to/project/out, but that directory didn't get created. I saw something while Googling about creating that directory if it isn't already there, but that didn't change anything and that out directory remains empty.
|
# ? Jan 15, 2018 04:09 |