Stephan van Hulst

Saloon Keeper
+ Follow
since Sep 20, 2010
Merit badge: grant badges
For More
Cologne, Germany
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stephan van Hulst

Git probably could have been a bit simpler. But the criticism of Git ignores something very important: Teamwork IS complex.

In the article, the author illustrates some seemingly simple use cases, but as with anything, the devil is in the details. Let me quote a part:

I have some changes. I wanna share it with Jon and Johnny so they can tell me what they think. And then maybe they can add their ideas. And then we can have a merging of our ideas, and eventually test out if it works, and have it out there and ship it.

This sounds simple, but it really is a very strong distillation of some very complex ideas. What does "sharing" mean? What does "adding ideas" mean? What does a "merging of our ideas" really look like? What if that doesn't work? What does "getting it out there" mean?

I can explain anything to a person as if they're five years old, but that doesn't mean that the reality isn't more difficult.

I find that despite its complexity, Git is way WAY easier to use than other version control systems. That's because other version control systems mostly focus on the happy flow, where you don't run into conflicts. But when you run into conflicts, people then generally resort to solutions where you might as well not use the version control system at all. Git gives you very powerful tools to handle these situations in a consistent way.

Yes, that means you have to understand the tools well. Yes, that means you have to practice.
A branch is like a parallel universe where a different version of your code exists. When the code in one branch changes, it doesn't affect the code on another branch.

There are four big reasons I can think of why you'd want to have different branches of your code:

1. You and a colleague are working on the same piece of code simultaneously. It would be very annoying if your colleague made a small change that breaks your changes, and when you fix it it messes up what your colleague had planned. Instead, you both work on parallel branches and only merge your changes when one of you is done.

2. You are working on two different features. Let's say you're working on some fancy new feature for your application, and then an urgent bugreport comes in. You can't finish your feature first because it will still take a while, and you can't start the bugfix, because the codebase is still full with unfinished code from the new feature. Instead, you create a branch off of the latest stable version of the code before you started work on the new feature, and use that branch to develop the bugfix. When the bugfix is done and released, you can merge it back into the feature branch you were working on. An advantage of using a separate branch per feature or bugfix is that you can always go back and take a look at the changes that were made in order to implement the feature or bugfix.

3. You have hit a dead end in an experiment, but you don't want to throw away the code. Let's say you wrote some messy code just to find out how an API works or to experiment with a new idea. When it turns out the experiment didn't work, you don' want the code to mess up your main application. However, you might still want to keep the code around so you can review it later. Just put it on a separate branch where it won't affect the main branch!

4. Maintaining major versions. Sometimes you create a new version of your application that contains major changes that break compatability with a previous version. However, some of your customers might still be using the old version and don't want to migrate to the new version of your code, because it will break their application. So when you have bugfixes, you might have to apply them to the new version of your code, but also the old version. The solution is to maintain different branches for each major version of your application.
I means whatever YOU, the designer, has defined it to mean for a particular class.

For instance, let's say you have a bank account:

The "legal state" of a bank account is that the amount of money deposited in the account is greater than or equal to the lower limit. Here is a valid use:

At all times, the account is in a legal state. However, the following code demonstrates that the account can be in an illegal state:

The banked amount is 0, which is less than the lower limit. This should not be possible! The first requirement was violated:

All objects start off in a legal state after creation

We fix this by adding validation to the constructor:

Now, what if a bank account is not constructed with a lower limit, but instead the lower limit is read from a file:

"lower-limit.txt" is supposed to contain the value -300.

Assume that there is a problem with reading "lower-limit.txt". Maybe the file doesn't exist or is in the wrong location:

The object transitioned from a legal to an illegal state because it didn't reset before throwing. Here is the fix:

The bankedAmount is only changed if the readLowerLimit() call succeeds. If an exception occurs, the account is unchanged, and so remains in a legal state.
1 day ago
There's no hard requirement on generics in order to use functional interfaces. However, you will find that generics are almost unavoidable.

I strongly suggest you learn generics before you go on with functional interfaces. Here is an example that doesn't use generics though:

In this example, a ChessGameObserver is a type of function. The method ChessGame.addObserver() is a higher order function because it accepts a function. And ChessGameConsole.demoGame() demonstrates how you can call a higher order function by passing addObserver() a reference to printMoveToScreen.
2 days ago

In this example, getGreatest() is a higher order function because it has a method parameter that accepts a function. Here's an example of how to call it:
2 days ago
It's so you know what transitive dependencies will be included in your application automatically. Maybe you don't want them because the licence terms are incompatible, or maybe you don't like or need those dependencies for another reason, and you can explicitly exclude them.

It's just information. Don't worry about it.

Plugin dependencies and transitive dependencies are pulled in automatically. You only have to declare the plugin.
The next time, please copy the assignment text or at the very least post a link to the assignment.

This appears to be the assignment:

Anyway, it's likely you're seeing your problem because you're calling minWindow() in your last two test cases, which I guess is old code.

The following test accurately reflects what LeetCode is telling you:
4 days ago
You are correct if you meant to say: "a module does not contain another module".

Other than that, your understanding seems off. is only the the compilation unit containing the module declaration. The module itself is an abstract concept that transcends the declaration inside

You can compare a module to a package. A package is an abstract concept that more or less corresponds to a named grouping of classes. A module is an abstract concept that more or less corresponds to a named grouping of packages. So there is a kind of hierarchy:

The relationship between different modules can be considered hierarchical if you design them that way:

I can create a module named com.example.chess that contains the core packages of my application, and module com.example.chess.webapp that depends on these core packages. I could further expand the application with other modules that also follow this naming scheme that reflects a hierarchy of dependencies.

As with packages and their sub-packages, such a hierarchy is only conceptual. From a technical perspective, there is no special relationship between the packages java.util and The java.util package does not "contain" the package. They're different packages that just happen to have similar names.

Similarly, the module java.sql does not "contain" the module java.sql.rowset. Any technical relationship between them is limited to dependencies one might have on the other.
4 days ago
Welcome to CodeRanch!

The minimum OS version is tied to the JavaFX version. If you want to support older system, you need an older JavaFX version.
1 week ago
Welcome to CodeRanch!

santhosh mallem wrote:How to get end user's access-key and secret-access-key by using accountId and registered email/username  w.r.t "amazon s3" in spring boot application ?

You can't.

Please tell us what you need the access key and secret for.
1 week ago
That's great to hear, thank you for getting back to us!
1 week ago
Doesn't Selenium just test what appears in the browser? Doesn't the application at least need to be deployed on a test server for that?
1 week ago
Welcome to CodeRanch.

That makes it sound like it can remove passwords from a PDF that has read-protection. That is not the case. It would be very worrying if it could do something like that.

You mean it removes copy/print/edit restrictions on a PDF that is open for public reading.

soho albert wrote:I am saying this because it is the only one.

There are plenty of such tools. What makes yours stand out?

This will make the entire process faster and safer, as it will help avoid data loss problems.

Safer than what? And what does this have to do with data loss?
1 week ago