Skip to content

Instantly share code, notes, and snippets.

View mherman22's full-sized avatar
:octocat:
Try again and again and again

Herman Muhereza mherman22

:octocat:
Try again and again and again
View GitHub Profile
/**
* Java implementation of the Bisection method for solving equations.
*
* @author samuel
*/
public class Bisection {
private static final float TOLORANCE = (float) 0.01;
/**
@mherman22
mherman22 / More understanding of Java gui
Created March 29, 2020 07:34
more understanding of java gui. #from analysis to design
package gui;
import javax.swing.*; //i am to use JOptionPane
public class Rectangle {
public static void main(String[] args) {
// TODO Auto-generated method stub
double width, length, area, perimeter;
String lengthstr, widthstr, outputstr;
lengthstr = JOptionPane.showInputDialog("Enter the Length:");
package myJourney;
import java.text.NumberFormat;
import java.util.Scanner;
public class Calculator {
public static void main(String[] args) {
final byte MONTHS_IN_A_YEAR = 12;
final byte PERCENT = 100;
package myJourney;
import java.util.Scanner;
public class NumberElement {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a Number : ");
@mherman22
mherman22 / Update-branch.md
Created October 18, 2021 12:29 — forked from whoisryosuke/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@mherman22
mherman22 / Merging PR for 2 branches
Created October 18, 2021 14:14 — forked from alopresto/Merging PR for 2 branches
Instructions to merge pull requests for multiple branches (master, support, etc.)
#Steps to merge/close pull requests with two main branches
As NiFi now has a 1.0 (master) and 0.x (support) branch, pull requests (PR) must be applied to both. Here is a step-by-step guide for committers to ensure this occurs for all PRs.
1. Check out the latest master
``` $ git checkout master
$ git pull upstream master
```
2. Check out the PR (example #327). This will be in `detached-HEAD` state. (Note: You may need to edit the `.git/config` file to add the `fetch` lines [below](#fetch))
import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*;
import static java.nio.file.LinkOption.*;
import java.nio.file.attribute.*;
import java.io.*;
import java.util.*;
/**
* watching a directory for changes to files.
*/
@Entity
@Table(name = "project")
public class InfoFile {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long infoFile_id;
private String batchErrorstate;
@mherman22
mherman22 / WatchFolder.java
Created March 9, 2022 13:29
this class monitors a folder and in particular it monitors the info file. In the infoReading() Method, the data inside the info file is read into a json object whenever the there is a change to the file
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
@mherman22
mherman22 / dbdeserialising.java
Created March 10, 2022 12:32
just for keeps
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
public class JsonToDatabase {