| [+] HTML Pages with CSS and JavaScript » Front End configuration to connect to back end (Go to) | | Tim Cooke |
I do have a package.json file but that is part of the code repository and as such falls under the scope of a versioned build in our deployment pipeline. Updating a value in here would be a version bump which is not ideal when all I want to do is deploy the same build that's been tested in our testing environment into our production environment. Norm and Bear your suggestion of using a separate JS file that contains only constants for config values might just work and I can keep that separate from the versioned package code. Just the same as I would maintain an application.properties file for a Java app separately. Nice one, thanks! |
| [+] Introductions » Howdy All (Go to) | | Raphaelle Senger |
Welcome back Miles! We're a friendly bunch here so make yourself comfy and ask for all the help you want. As you've noticed, the forum software is in continual development by our wonderfully talented volunteer staff who like to make our little corner of the internet better and better just for the love of it. See you around. Tim |
| [+] HTML Pages with CSS and JavaScript » Front End configuration to connect to back end (Go to) | | Tim Cooke |
Hi web savvy folks, I have a problem, and that problem is most likely caused by my lack of front end web technology skills. I have a web application that consists of two separate projects, a Java backend system that exposes a REST API, and a front end HTML, JS (actually Vue) system that uses that API. The problem I have is that the URL location of the API is hard coded into the front end JS code which means a code change and new versioned build is required to deploy it to different environments. This is not ideal. My question is: Is it possible to define some external configuration values for a front end html and js web application? Somewhere I can define properties that may change over time? Thanks, Tim |
| [+] Servlets » Is Cors Filter a necessity ? (Go to) | | Tim Cooke |
Given the speculative nature of your question I'm going to assume your web app is working just fine, which means that you don't need to worry about CORS. If CORS was a problem then the front end of your app would be unable to communicate with the back end. |
| [+] Reactive Progamming » * Winners: Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams (Go to) | | Campbell Ritchie |
First, a big thanks to Adam Davis for being here to promote the book Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams. The winners are: Rodrigo LopesWill Myerspaul nissetDinkar Chaturvedi Please send your snail mail address to bookpromotion AT javaranch DOT com. To ensure the quickest response, please provide the following: Your name (first and last - if your CodeRanch name is different, please include both your real name and Ranch name) Email Country (needed even if requesting an e-book) Address Phone Number Also, please include the following as the subject of your Email. Book Promo Winner - Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams - Tuesday, October 15th, 2019 Image from https://m.media-amazon.com As noted in the Book Promotion Eligibility Requirements and Legal type stuff, the winners have 8 days to submit their information. Within 3 days of receipt of your email, we will reply to let you know we got it. If you don't hear back, the goat might have eaten your email. Please let us know by posting in the Ranch Office so we can check on it. Once you have received your copy please let us know by editing the Book Promotions Winners Page and updating the 'Status' column to say you have it. Thanks and congrats to all the winners. |
| [+] Reactive Progamming » * Welcome Adam Davis (Go to) | | Comal Rajagopalaratnam Muthukumar |
This week, we're delighted to have Adam Davis helping to answer questions about the new book Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams. The promotion starts Tuesday, October 15th, 2019 and will end on Friday, October 18th, 2019 We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Apress. Image from https://m.media-amazon.com Please see the Book Promotion page to ensure your best chances at winning! Posts in this welcome thread are not eligible for the drawing, and should be reserved for welcoming the author. Questions posted in this topic are subject to removal. |
| [+] Reactive Progamming » Videos: React Conference London 2014 & San Francisco 2015 (Go to) | | Tim Cooke |
A few years ago I attended a conference dedicated to Reactive Programming in London. It was organised by an excellent software house near to me in Belfast called Instil. Since we now have a shiny new Reactive Programming forum it's a good place to share the recordings of the event. https://www.youtube.com/user/reactconf |
| [+] Meaningless Drivel » If cats could text you back... (Go to) | | Campbell Ritchie |
Saw this in a gift shop in Canada |
| [+] Kotlin » Date null and String null (Go to) | | Tim Cooke |
| |
| [+] Kotlin » Date null and String null (Go to) | | Tim Cooke |
| |
| [+] Java in General » How to find out if a string looks like normal English? (Go to) | | Tim Cooke |
Piet Souris wrote: Jesse Wiatrak wrote:The strings do not contain spaces or punctuation. Do you mean that when you deciphered the text, you may end up with 'themeat' with possible split "th eme at" or them eat" or so? That doesn't make it easier. oh dang, I didn't see that bit. Yea that's just made it a lot more difficult. This is a college course assignment right? Assuming this exercise is to practice stuff you've already been taught, what kind of stuff have you been taught in this class so far? Perhaps that'll give you a clue on the approach to take. |
| [+] Spring » Possible to switch from synchronous to asnchronous? (Go to) | | Tim Cooke |
If it were me I'd be looking more closely at why it is taking 10 minutes. Do you have an inefficient database query? Are you pulling back a lot of data you don't need? |
| [+] Programmer Certification (OCPJP) » Array of String sorting (Go to) | | Manuel Prochnow |
Not everybody has a copy of the book to hand, perhaps you can include the questions? |
| [+] Java in General » How to find out if a string looks like normal English? (Go to) | | Tim Cooke |
Have you been given an English dictionary to work with? If you're on a Linux machine then you'll find words at /usr/share/dict/words. I don't know if something exists on a Windows machine although I expect it probably does. I expect a reasonable approach would be to take your deciphered text and count how many words appear in your dictionary. The text with the most dictionary hits has probably been deciphered with the correct key. This would be a very naive solution and as Paul says, does not take into account valid words that are not in your dictionary, abbreviations, slang, misspellings, etc etc. Then how do you pick between two texts that have the same number of dictionary hits? Now you're into the NLP territory Campbell talks of, which is a whole new level of complexity, in fact it's a whole new level of computer science research. Let us know how you get on. |
| [+] Beginning Java » Best IDE for Java (Go to) | | Campbell Ritchie |
For an absolute beginner I would recommend using no IDE at all. IDE's are great and afford you a lot of conveniences but they do so by hiding a great deal of complexity, which is awesome but only if you understand the complexity that's being hidden, otherwise you just have gaps in your understanding. By starting with no IDE and just a simple text editor you are exposed to the whole picture and will help your core understanding of how the Java compiler and runtime environment really work. Once you've got a good handle on this and the compiling and running process becomes boring and monotonous to you then it's time to bring in a good IDE to do that stuff for you. Personally I think Intellij is the top of the Java IDE pile. Even the free 'Community Edition' is a great IDE and includes a set of refactor tools that are brilliant. You'll probably not use any of those refactor tools for a long time but when you do you'll see what I mean. |
| [+] JavaFX » Adding boilerplate codes automatically? (Go to) | | AhFai Chan |
Also, I'm not a fan of Project Lombok for reasons discussed here and have recently removed it from a work project in favour of explicitly writing getters and setters. |
| [+] JavaFX » Adding boilerplate codes automatically? (Go to) | | AhFai Chan |
It looks like Eclipse already has this feature built in, according to this DZone article anyway: https://dzone.com/articles/generate-rename-and-delete I'm an Intellij user and it has this feature built in, along with many many other really useful tools that make writing code faster and safer. |
| [+] Beginning Java » Logging and rethrowing exceptions (Go to) | | Brecht Geeraerts |
Throwing all possible exceptions can expose some implementation detail that you'd like to keep hidden from users of your class. You may wish to catch it and then thrown a different exception. Let's say I have a class who's responsibility it is to generate PDF documents. Turns out it's very difficult to do using just Java so I choose to employ a third party library called itextpdf to do the work for me. This itextpdf library handles problems by throwing its own set of exception types such as a DocumentException. I will need to handle this but do not want to expose it so catch it and throw something else instead. |
| [+] JDBC and Relational Databases » What happens when auto increment id generated future increases to generate a very large int value (Go to) | | Monica Shiralkar |
I suggest you measure your current usage and extrapolate it out to see how long it'll take to become a problem. How many new records are created in a day on average? You can determine this from your application history What's the maximum value for the index data type? What index are you currently on? From this you can calculate how many days from now you'll likely overflow you data type. If it's next week then it's probably worth doing something about it. If it's hundreds of years in the future then don't worry about it. |
| [+] Books » Java for passionate developers - get it free! (Go to) | | Avdesh yadav |
| |
| [+] Android » writing pdf directly to Firebasestorage (Go to) | | Tim Cooke |
This looks promising: https://github.com/barteksc/AndroidPdfViewer wrote:All available options with default values: ... pdfView.fromBytes(byte[]) ... |
| [+] Android » writing pdf directly to Firebasestorage (Go to) | | Tim Cooke |
Perhaps even a new question for a new thread "How to display a PDF on an Android device that's stored as a byte array?" |
| [+] Android » writing pdf directly to Firebasestorage (Go to) | | Tim Cooke |
| |
| [+] Android » writing pdf directly to Firebasestorage (Go to) | | Tim Cooke |
Retrieving from firebase is easy as there's a getBytes() method. How easy it is to display on an Android device is a question for someone more Android savvy than me. |
| [+] Android » writing pdf directly to Firebasestorage (Go to) | | Tim Cooke |
What about creating your PDF document in memory as an OutputStream and writing the byte[] directly to your firebase database. The following example does not write anything to the file system: |
| [+] Spring » Sending email GMAIL account (Go to) | | Angus Ferguson |
I'm totally confused too about the Windows comment.... all I see it information about authenticating to your Google account. I was thinking it might be something to do with 2-Step or not 2-Step verification |
| [+] Spring » Sending email GMAIL account (Go to) | | Angus Ferguson |
| |
| [+] Artificial Intelligence and Machine Learning » * Winners: Natural Language Processing (Go to) | | Campbell Ritchie |
First, a big thanks to Hobson Lane, Hannes Hapke and Cole Howard for being here to promote the book Natural Language Processing. The winners are: Carl ByrdTerseer Anthony Shaguy Please send your snail mail address to bookpromotion AT javaranch DOT com. To ensure the quickest response, please provide the following: Your name (first and last - if your CodeRanch name is different, please include both your real name and Ranch name) Email Country (needed even if requesting an e-book) Address Phone Number Also, please include the following as the subject of your Email. Book Promo Winner - Natural Language Processing - Tuesday, August 13th, 2019 Image from https://m.media-amazon.com As noted in the Book Promotion Eligibility Requirements and Legal type stuff, the winners have 8 days to submit their information. Within 3 days of receipt of your email, we will reply to let you know we got it. If you don't hear back, the goat might have eaten your email. Please let us know by posting in the Ranch Office so we can check on it. Once you have received your copy please let us know by editing the Book Promotions Winners Page and updating the 'Status' column to say you have it. Thanks and congrats to all the winners. |
| [+] Cloud/Virtualization » * Winners: Cloud Native Patterns (Go to) | | Liutauras Vilda |
First, a big thanks to Cornelia Davis for being here to promote the book Cloud Native Patterns. The winners are: Matthew Kellerpaul nissetCarl ByrdLiutauras Vilda Please send your snail mail address to bookpromotion AT javaranch DOT com. To ensure the quickest response, please provide the following: Your name (first and last - if your CodeRanch name is different, please include both your real name and Ranch name) Email Country (needed even if requesting an e-book) Address Phone Number Also, please include the following as the subject of your Email. Book Promo Winner - Cloud Native Patterns - Tuesday, August 13th, 2019 Image from https://m.media-amazon.com As noted in the Book Promotion Eligibility Requirements and Legal type stuff, the winners have 8 days to submit their information. Within 3 days of receipt of your email, we will reply to let you know we got it. If you don't hear back, the goat might have eaten your email. Please let us know by posting in the Ranch Office so we can check on it. Once you have received your copy please let us know by editing the Book Promotions Winners Page and updating the 'Status' column to say you have it. Thanks and congrats to all the winners. |
| [+] Code Reviews » An efficient Pull Request and code review workflow (Go to) | | Tim Cooke |
That's an interesting approach Stephan, thanks. I'll have to discuss with the team and see what they think of it. |
| [+] Cloud/Virtualization » Cloud Native Patterns: Outsourcing I.T. departments (Go to) | | Cornelia Davis |
In general though I think you're right. The move to cloud computing has removed the need for a certain group of roles within an organisation, primarily relating the maintenance and security of the physical infrastructure and the maintenance and security of the operating system. Although you might argue that the role has not been eliminated, rather simply moved to the cloud provider companies. |
| [+] Cloud/Virtualization » Cloud Native Patterns: Outsourcing I.T. departments (Go to) | | Cornelia Davis |
Cloud is just a fancy new name for somebody else's computer. You still need developers to build and maintain the application right? I think you're conflating the term "developer" here which is causing some confusion, for me at least. To me a developer is the person who builds the application, who writes the code, who packages it up for deployment. I think the developer you are referring to is more of a system administration role rather than software developer. |
| [+] Cloud/Virtualization » Cloud Native Patterns: Outsourcing I.T. departments (Go to) | | Cornelia Davis |
You say "IT employees" but do you really mean the employees who look after the server infrastructure? Just because you don't physically own any server hardware doesn't negate the necessity to manage it. I see it as a change in skill set rather than the elimination of a role. I have worked in large companies who own their own server hardware but have them located in data centres. From a practical point of view this is not so dissimilar to 'cloud' services. They're both server resources you don't have physical access to. You make some gains in not having to maintain the hardware and manage security updates, and you incur some costs in having to learn and navigate a 3rd party management console application to administer your resources. |
| [+] Code Reviews » An efficient Pull Request and code review workflow (Go to) | | Tim Cooke |
I have a code workflow dilemma to resolve. I'm a developer on a small team. Our current workflow for pushing code changes is to branch from the main 'dev' branch, do your work, then create a Pull Request for approval back into 'dev'. My development cadence us usually quite fast, I'll write tests, implement features, fix issues, refactor unpleasantness, all in a relatively short space of time, which is great but at the end of that I am inflicting an unmanageably large diff in the resultant PR that gets sent out for my team members to review. Because of this I usually end up having to sit down with them and walk through everything I've done. At the last review it was suggested / requested that I keep my PRs smaller to be easier to review. This is a fair enough comment. The problem I have now is that I don't know how to adapt my workflow in order to produce smaller PRs and maintain a reasonable cadence of development. For example, my current bit of work started out with writing a new covering test for some existing functionality, and resolving a bug that I happened to find along the way. That seemed like a nice sized chunk for a PR code review. All is good. But..... it formed the basis for the next bit of work but the first PR has not been approved yet so I can't submit the second PR without it including the first also. I hope this is making sense. My question is: Have you any suggestions from experience about Pull Request size, frequency, scope, or anything else that works for you to maintain good development speed while making it easy for your colleagues to review your output? |
| [+] Cloud/Virtualization » Cloud Native Patterns - pitfalls? (Go to) | | Tim Holloway |
As it happens I have recently implemented what Cornelia discusses for configuration files for the same reasons. Property files were being bundled up in the jar (it's a Java app) so the build was directly coupled to the configuration. Also we had sensitive configuration in plain text files, such as database credentials, email server credentials, Stripe payment gateway credentials (eek!). I got the idea from Michael T Nygard's "Release it!" book, which is a terrifyingly excellent read and highly recommended. (I say terrifyingly excellent because it makes you realise how under prepared your application is for the production environment.) We already use Amazon AWS for a bunch of other services so it was a natural fit to make use of their Parameter Store offering to keep our application configuration in. There was some code changes required to retrieve the properties and add them to the environment but it turned out to be not that hard because the AWS Java SDK does most of the heavy lifting for you. |
| [+] Spring » Spring XmlBeanDefinitionStoreException (Go to) | | Tim Cooke |
You're welcome Muhammad, nice to see a 4 year old topic is still helping people Spring stack traces are really cryptic are require some familiarity to decipher which is half the battle of working with Spring. |
| [+] Artificial Intelligence and Machine Learning » * Welcome Hobson Lane, Hannes Hapke and Cole Howard (Go to) | | Ganesh Patekar |
This week, we're delighted to have Hobson Lane, Hannes Hapke and Cole Howard helping to answer questions about the new book Natural Language Processing. The promotion starts Tuesday, August 13th, 2019 and will end on Friday, August 16th, 2019 We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Manning. Image from https://m.media-amazon.com Please see the Book Promotion page to ensure your best chances at winning! Posts in this welcome thread are not eligible for the drawing, and should be reserved for welcoming the author. Questions posted in this topic are subject to removal. |
| [+] Cloud/Virtualization » * Welcome Cornelia Davis (Go to) | | Comal Rajagopalaratnam Muthukumar |
This week, we're delighted to have Cornelia Davis helping to answer questions about the new book Cloud Native Patterns. The promotion starts Tuesday, August 13th, 2019 and will end on Friday, August 16th, 2019 We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Manning. Image from https://m.media-amazon.com Please see the Book Promotion page to ensure your best chances at winning! Posts in this welcome thread are not eligible for the drawing, and should be reserved for welcoming the author. Questions posted in this topic are subject to removal. |
| [+] Java in General » Opinions on Project Lombok please? (Go to) | | salvin francis |
Tim Cooke wrote:It's now on my list to be refactored out. An update: Project Lombok has been removed from our codebase many weeks ago and nobody has missed it. |
| [+] Blatant Advertising » All you need to know about system.gc() (Go to) | | Tim Cooke |
In my experience of working with very high performance systems, if you've got garbage problems then calling gc() is not even close to a solution. |