Skip to content

Instantly share code, notes, and snippets.

View thebigdatajedi's full-sized avatar

Gabe Cruz thebigdatajedi

View GitHub Profile

###Understanding Java Version Queries

Java provides specific command-line options to check the installed version. The output can vary slightly based on the Java vendor (Oracle, OpenJDK, etc.) but generally follows a consistent format displaying the version, runtime environment, and VM information.

Here's a concise key/value pair list of commands you might use to query Java version information, along with the expected type of output for each:

  • java -version: This is the correct and standard command to get the Java version, the runtime environment, and VM details. Expected output: Detailed version information.

  • java --version: This is essentially the same as java -version and is accepted by newer versions of Java as a valid command. Expected output: Detailed version information, similar to java -version.

@thebigdatajedi
thebigdatajedi / Prompt for having ChatGPT-4, Copilot, Copilot for VSCode and Amazon Q return optimal results.
Last active February 15, 2024 02:44
Adding this gist to the end of a prompt to ChatGPT-4, Copilot, Copiot for VSCode and Amazon Q is working extremely well for me.
...and please explain it to me as if I was a 7-year-old. Would you give a detailed description with examples that are tied to a list of tasks? I better understand examples given to me when they are broken down into a list of tasks. My most optimal method of understanding ideas is using a carefully thought-out sequence-dependent tasks list. I don't know what I would do without a task list to take me through developing my tacit knowledge on a given subject and helping me understand from the simplest things to the most complex systems in the world.
@thebigdatajedi
thebigdatajedi / callerName function.ts
Created December 17, 2022 13:43
You may never get a chance to use it. Who knows it may make a come back.
//tricky because it's becoming less and less supported but this is how you did it:
static callerName(func: Function): void {
let callingFunction: string = '';
callingFunction = func.caller.name;
const dateTime: string = this.getDateTime();
console.log('***-> ' + dateTime + ' <-###-> ' + func.name + ' is being called by: ' + callingFunction);
}
static getDateTime(): string {
const today = new Date();
const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
const time = today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds();
const dateTime = date + ' ' + time;
return dateTime;
}
@thebigdatajedi
thebigdatajedi / ternary operator.ts
Created December 17, 2022 13:41
ternary explanation with example
//This is how a ternary operator works:
//<condition to check> ? <what happens if the condition is true> : <what happens
//if the condition is false>;
//Credit Union System example with evaluating fees.
function getFee(isMember: boolean): string {
return (isMember ? '$2.00' : '$10.00');
}
@thebigdatajedi
thebigdatajedi / Converting Int to BigDecimal.java
Created December 17, 2022 13:26
Java, converting Int to BigDecimal because if you know, you know.
int intSample = 1;
BigDecimal.valueOf((double)intSample);
@thebigdatajedi
thebigdatajedi / Nested loop search.java
Created December 17, 2022 13:25
Java, nested loop search.
class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
boolean found = false;
outer:for(int[] array : matrix)
{
for(int item : array){
if(item == target){
found = true;
@thebigdatajedi
thebigdatajedi / Array sort (done manually instead of a builtin sort method).java
Created December 17, 2022 13:24
Java, array sort done manually instead of using a builtin sort method.
//Outer loop
for (int i = 0; i < nums.length; i++ ) {
//inner loop
for(int j = i + 1; j < nums.length; j++){
int temp = 0;
if(nums[j] < nums[i]) {
//checking elements
temp = nums[i];
nums[i] = nums[j];
@thebigdatajedi
thebigdatajedi / reset soft.txt
Created December 17, 2022 11:50
This an explanation of what git reset soft does and how to do it. My bias is to do a git reset hard. I usually have to do them when I'm in a terrible place and the loss of code will be code I wasn to get rid off, the thing with the git reset soft is that it leaves your local files etc. the same. I just don't have much use for moving the HEAD but…
And if you reset --soft, it will move your HEAD to where they were , but leave your local files etc. the same:
git reset --soft <commit hash>
@thebigdatajedi
thebigdatajedi / reset hard.txt
Created December 17, 2022 11:45
This an explanation to what you get with git reset hard and how to do it. My bias is that if I'm having absolutely to do a reset this is the reset I do.
If you reset --hard, it will make your local code and local history be just like it was at that commit: <commit hash>
git reset --hard <commit hash>