Skip to content

Instantly share code, notes, and snippets.

function loadMainUI() {
console.log("Loading main UI");
views.navigate("menu");
}
function unloadMainUI() {}
kpay.initialize(unloadMainUI, loadMainUI);
@LazaroIbanez
LazaroIbanez / MassiveUpdate.sql
Created October 31, 2017 19:38
MassiveUpdate.sql Massive update using CURSOR FOR LOOP and UPDATE
SET SERVEROUTPUT ON
DECLARE
   inFindString      VARCHAR2(100);
   inReplaceString   VARCHAR2(100);
   countRecords      NUMBER;
   CURSOR c1 IS select variable_im_interested from table_to_update where col_to_update like '//old_string_to_find/%';
BEGIN
  Dbms_Output.Put_Line('Starting: ' || Systimestamp);
  inFindString := '//old_string_to_find/';
  inReplaceString := '//new_string/';
@LazaroIbanez
LazaroIbanez / Calculator.java
Created September 3, 2017 17:32
Java 8 Lambda Expressions
public class Calculator {
interface IntegerMath {
int operation(int a, int b);
}
public int operateBinary(int a, int b, IntegerMath op) {
return op.operation(a, b);
}
@LazaroIbanez
LazaroIbanez / TestClass.java
Created September 3, 2017 17:28
Java Garbage collection
public class TestClass {
public Object getObject() {
Object object1 = new String(“New_String”);
Object objectArray[] = new Object[1];
objectArray[0] = object1; //After this line, object1 and objectArray[0] are pointing to the same String object.
object1 = null; //After this line, object1 points to null but objectArray[0] is still pointing to the String object.
objectArray[0] = null; //After this line objectArray[0] also starts pointing to null so there is no reference left that is pointing to the String object.
//So it is now available for Garbage collection.
return object1;
@LazaroIbanez
LazaroIbanez / B.java
Created September 3, 2017 17:24
Behaviour of the static and instance variables
public class B {
public static void main(String… args) {
System.out.println(“Value of var1 = “+B1.var1);
System.out.println(“Object 1”);
B1 object1 = new B1();
object1.printData();
System.out.println(“Object 2”);
B1 object2 = new B1();
object2.printData();
@LazaroIbanez
LazaroIbanez / A.java
Created September 3, 2017 17:21
static initialization
public class A {
static { System.out.println(“A Loaded”); }
public static void main(String[] args) {
System.out.println(“A should have been loaded”);
A1 a1 = null;
System.out.println(“A1 should not have been loaded”);
System.out.println(a1.i);
}
@LazaroIbanez
LazaroIbanez / E.java
Created September 3, 2017 17:05
Java interface static method is similar to default method except that we can’t override them in the implementation classes.
public class E implements Interf1 {
public String getId() {
return “E: get Id”;
}
public String getOtherId() {
return “E: get Other Id”;
}
@LazaroIbanez
LazaroIbanez / D.java
Created September 3, 2017 17:02
D must implement getId
public class D implements Interface1, Interface2 {
public String getId() {
return “1111”;
}
}
interface Interface1 {
public default String getId() {
return “0000”;
}
@LazaroIbanez
LazaroIbanez / D.java
Created September 3, 2017 16:58
The default keyword
public class D implements Interface2 {
public static void main (String… args) {
Interface1 acct = new D();
System.out.println(acct.getId());
}
public String getId() {
return “1111”;
}
@LazaroIbanez
LazaroIbanez / C.java
Created September 3, 2017 16:52
Interfaces ambiguous fields
class C implements I1, I2 {
public void m1() {}
public static void main(String… args) {
C tc = new C();
System.out.println(( ( I1) tc).VALUE);
}
}
interface I1 {
int VALUE = 1;