Skip to content

Instantly share code, notes, and snippets.

View julianjupiter's full-sized avatar

Julian Jupiter julianjupiter

View GitHub Profile
@julianjupiter
julianjupiter / php_pdo_mysql.php
Last active December 5, 2015 22:30
PHP and MySQL with PDO
<?php
try {
$connection = new PDO('mysql:host=localhost;dbname=jtest2', 'root', 'admin123');
} catch (PDOException $e) {
echo $e->getMessage();
}
$firstName = isset($_POST['first_name']) ? $_POST['first_name'] : '';
$lastName = isset($_POST['last_name']) ? $_POST['last_name'] : '';
$position = isset($_POST['position']) ? $_POST['position'] : '';
<?php
try {
$connection = new PDO('mysql:host=localhost;dbname=jtest2', 'root', 'admin123');
} catch (PDOException $e) {
echo $e->getMessage();
}
try {
$querySelect = 'SELECT id, course_type FROM course_type';
$statementSelect = $connection->prepare($querySelect);
$statementSelect->execute();
@julianjupiter
julianjupiter / bs_table_modal.html
Last active October 16, 2023 23:06
Get the specific id and display its values to a Bootstrap modal
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
@julianjupiter
julianjupiter / hs_err_pid6705.log
Created May 5, 2016 04:09
Error log of my Gluon SceneBuilder on Ubuntu 14.04.4 LTS 32-bit
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb7771428, pid=6705, tid=1691421504
#
# JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
# Java VM: Java HotSpot(TM) Server VM (25.65-b01 mixed mode linux-x86 )
# Problematic frame:
# C [+0x428] __kernel_vsyscall+0x10
#
@julianjupiter
julianjupiter / While.java
Last active October 16, 2017 16:36
Triangle in Java While
public class While {
public static void whileLoop1() {
int columnCounter = 5;
while (columnCounter >= 1) {
int rowCounter = 1;
int space = 5 - columnCounter;
while (space > 0) {
@julianjupiter
julianjupiter / DoWhile.java
Last active October 17, 2017 02:53
Triangle in Java Do While
public class DoWhile {
public static void doWhileLoop1() {
int columnCounter = 5;
do {
int rowCounter = 1;
int space = 5 - columnCounter;
do {
@julianjupiter
julianjupiter / JFrameDemo.java
Created November 13, 2017 07:23
Pass string from one JFrame to another.
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class JFrameDemo {
public static void main(String[] args) {
    String name = "Juan";
@julianjupiter
julianjupiter / Database.java
Last active September 21, 2024 19:27
Sample JavaFX application with MySQL JDBC operation.
package io.github.julianjupiter.javafx;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Database
<?php
function sql($terms)
{
$q = "SELECT * FROM table1 WHERE ";
$i = 0;
foreach ($terms as $each)
{
$i++;
@julianjupiter
julianjupiter / CalculatorTest.java
Created January 28, 2018 10:33
Basic calculator in Java
import java.util.Scanner;
public class CalculatorTest {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("First Number: ");
double firstNumber = input.nextDouble();
System.out.print("Second Number: ");
double secondNumber = input.nextDouble();
Calculator calculator = new Calculator();