Skip to content

Instantly share code, notes, and snippets.

@davidalencar
davidalencar / scriptOracleJdkUbuntu
Created April 7, 2017 01:44
Instalar Oracle JDK no Ububtu
sudo su
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
@davidalencar
davidalencar / js
Created June 20, 2017 17:28
nimgame
import java.util.Scanner;
/**Implements a game of nim, person vs. computer.
* The game starts with a number of elements chosen
* by the person. The computer takes 1 or 2 elements.
* Then the person takes 1 or 2 elements. The game
* continues until there are no elements left. The
* play who takes the last turn wins.
* @author Jam Jenkins
*/
public class Nim
private DimensionDefault createDimensionDefault(MainAccountNum _mainAccount, container _conData)
{
int hierarchyCount;
int hierarchyIdx;
RecId dimAttId_MainAccount;
LedgerRecId ledgerRecId;
MainAccount mainAccount;
RefRecId recordvalue;
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue;
@davidalencar
davidalencar / createPurchSalesInventSetup
Created January 10, 2018 11:20
Create InventItemPurchSetup, InventItemSalesSetup and InventItemInventSetup for all itens.
static void updInventSetup(Args _args)
{
InventTable item;
InventDim dimSite, dimLocation;
InventSite site;
InventItemPurchSetup purchSetup;
InventItemSalesSetup salesSetup;
InventItemInventSetup inventSetup;
try
@davidalencar
davidalencar / binarySearch.go
Last active July 17, 2021 12:49
Golang program for implementation of Binary Search
package main
import "fmt"
func binarySerach(list []int, item int) (bool, int) {
low := 0
high := len(list) - 1
for low <= high {
median := (low + high) / 2