Win a copy of Head First Android this week in the Android forum!

John Landon

Ranch Hand
+ Follow
since Sep 25, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Landon

Tim Holloway wrote:That's not really enough information.

I have built environment-insensitive applications since long before containers and cloud computing. JEE web applications, for example, get their configuration information (per the standard) from 2 deployment descriptors. There's a server-independent deployment descriptor, which is the webapp's [tt]/WEB-INF/web.xml[/i] data. And the server-dependent deployment descriptor that, as its name indicates, is specific to the particular instance and type of deployment. Tomcat, for example, uses a Context XML element. By leverating this, I can use the exact same WAR on my desktop, on Beta test machines, and in Production. Which means that if Production fails, I don't have to worry about there being something different in the compiled classes that would prevent trying to re-0ccreate the fault in a test/diagnostic environment.

Configuration for non-java apps under Linux typically goes in an '/etc/" file or directory. When containerizing such a setup, one generally aliases it to an external mountpoint. That's what my Bacula containers do, for example. Since the containers are not integral to the OS, the actual target here is /opt/bacula/conf", mappring to the container's internal /etc/bacula/ directory.

It's really pretty easy to do this kind of stuff and inject it as part of container deployment, regardless of which sort of container orchestration system you're using, be it Kubernetes, Docker Compose, or in my case, Ansible.



Thanks but I really dont see a question to fill in the information in your answer. What you need to know in order to help? These are java apps running in AWS.... with spring boot
Greetings,

Currently, in the code (multiple very dependent on each other microservices running on AWS), we have a separate per environment configuration file.  All environment data needs to be entered into this file before building the code.

We need to get to immutable deployable artifacts. In order to do that we need a better mechanism for configuration management.

We need to decide the mechanisms to use for configuration management.

High level requirements:

be able to make changes without redeploying containers

be able to provide per environment or per service defaults

Any help will be appreciated!

Henry Wong wrote:

John Landon wrote:
This is awesome thanks (the closest I've seen) but it does match 5.0.......



It matches "5.0" because that is how the regex is coded. I took your original post, as disallowing trailing zeros, but allowing one digit after the decimal point. So, "5.00" is not allowed, but "5.0" is allowed.

The fix to this, is actually very simple. Just get rid of the alternation after the decimal, that allows it.


And .... Remember when I said that you should never use a regex that you don't understand? Well, this fix is ridiculously easy to do, and this is a chance for you to understand the regex. So, give it a try at fixing it yourself.

Henry



LOL Thanks Henry. I removed //+     "0"        // Match zero and it works. Is there any chance to limit the number of digits total (except the dot) say to 11?
4 years ago

Knute Snortum wrote:

John Landon wrote:Also it doesnt match number 5


Henry Wong's regex?  It does for me, running the little program.



This is awesome thanks (the closest I've seen) but it does match 5.0.......
4 years ago

John Landon wrote:

Carey Brown wrote:When working with complex regular expressions I find it useful to create a 20 line regex tester program that takes as parameters an array of "good" test cases that are expected to match, and an array of "bad" test cases that are expected to fail. If any test doesn't result in the expected outcome it should report the failed string.



It matches the 0
http://www.freeformatter.com/java-regex-tester.html#ad-output



Also it doesnt match number 5
4 years ago

Carey Brown wrote:When working with complex regular expressions I find it useful to create a 20 line regex tester program that takes as parameters an array of "good" test cases that are expected to match, and an array of "bad" test cases that are expected to fail. If any test doesn't result in the expected outcome it should report the failed string.



It matches the 0
http://www.freeformatter.com/java-regex-tester.html#ad-output
4 years ago

Henry Wong wrote:
First, I guess I can take a shot at it (and without actually compiling or testing it, so take with a grain of salt)...



Second, assuming that this even works, I highly recommend that you don't use it without actually understanding it !!

Henry



It doesnt. Does the same thing as mine: ^\d+(\.\d{1,10})?$

It passes even if you do 75.550 (the extra zero should fail it)
4 years ago

Carey Brown wrote:

How about leading zeros? Pleas how do I apply them all at once?

If you look closely you'll see that it is one long regex String put together with String (+) concatenation.

I just broke it out so that you can see the separate rules separated by an OR (|).



thanks.
Yeas I saw but this website denies it
http://www.freeformatter.com/java-regex-tester.html
4 years ago

Carey Brown wrote:
Haven't tested it but I think this should work.



How about leading zeros? Pleas how do I apply them all at once?
4 years ago
05.5 will fail
5.50 will fail
0.5 will succeed
4 years ago

Ron McLeod wrote:

John Landon wrote:No because I need to do it in validation annotation


You could make your annotation take multiple expressions.



Thanks so how would you put this inside? (its regex that does what I want except trailing zeroes):^\d+(\.\d{1,10})?$
4 years ago

fred rosenberger wrote:Why do you want a single regex to do all these things? Wouldn't it be easier to write several, smaller ones that each do a picece of the checks you need?


No because I need to do it in validation annotation
4 years ago
Hi guys,
I need regex for:
String must fail if:
1) Non numeric
2) If any leading zeroes are entered without a decimal point
3) If there are any zeroes trailing a decimal point
4) If there is a decimal point with no numbers before it
5) If there is decimal point more then 10 digits after the zero

I came up with this but its not quite right it still matches if there are zeroes
^\d+(\.\d{1,10})?$

Thanks!
4 years ago
QUARTZ 1.8 how to pass a transaction into the scheduler.unscheduleJob method
6 years ago

Paul Clapham wrote:Oh right, you asked for examples of how to use that.




Thanks.

So I wrote this and it never hits the sleep breakpoint (never gets into the thread) and after 10 seconds just throws TimoutException.....

7 years ago