Posts

Pong Game with HTML5 Canvas

Image
Here the simple code Pong Game with HTML5 Canvas <div style="text-align:center;"> <canvas id="myCanvas" width="600" height="400" style="border:1px solid #000000;"></canvas> </div> <script> var ky1=0,ky2=0,px=0,py=0,vx=0,vy=0,scorekiri=0,scorekanan=0; var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var lastMouse={x:0,y:0}; var pressedState=false; ky1=ky2=Math.round(0.5*c.height)-30; function drawGame(){ //draw background ctx.beginPath(); ctx.rect(0, 0,c.width,c.height); ctx.fillStyle = "black"; ctx.fill(); //draw middle line ctx.beginPath(); ctx.moveTo(Math.round(0.5*c.width),0); ctx.lineTo(Math.round(0.5*c.width),c.height); ctx.strokeStyle = "white"; ctx.lineWidth = 5; ctx.setLineDash([8,3]); ctx.stroke(); //draw kotak 1 ctx.beginPath(); ctx.rect(0,ky1,20,60); ctx.fillStyle = "white"; ctx.fill(); //draw...

The Wordpress Plugin of WhatsApp Floating Button

Image
Usually website communication need public feedback to see users enthusiasm of website's contents. One of the feedback, can be use WhatsApp floating button at right bottom of page, as screenshot image below. Uboiz WA Float Icon is simple Wordpress widget plugin to show floating WhatsApp button. Where the WhatApp number can be edited in widget form. This plugin tested on Wordpress 5.0.3 and place this plugin in your Wordpress plugin folder ( /wp-content/plugins/ ). Download Uboiz WA Float Icon Reference Castro, Kevin. 2019. Whatsapp-floating-button . https://codepen.io/demoonkevin/pen/MvPEpV . Accessed date 16 Jan 2019.

Simple Marquee Latest Post Wordpress Plugin

Image
Marquee is HTML element that used to insert a scrolling area of text horizontally or vertically. Uboiz-marquee-latest-post is a simple Wordpress plugin to show the latest post as horizontally marquee. Where the interface presented as Wordpress widget, the number of posts can be changed how many to displayed as marquee, up to 10 posts. And as Widget, its also can be placed in the sidebar as needed. Place this plugin in Wordpress plugin folder ( /wp-content/plugins/ ) and its tested at Wordpress 5.0.3. Download Uboiz Marquee Widget

Simple Wordpress Plugin to Show Page List

Image
Below is simple code that use wp_list_pages of Wordpress function as plugin. You can use shortcode [uboiz_list_page] in page, as like as screenshot below: This plugin tested in Wordpress 5.0.2, and you can download and place in plugin folder ( /wp-content/plugins/ ) in your Wordpress site. Download uboiz-page-list.zip

Fibonacci Algorithm in Java Array

Image
Code 1 package fibonaccinumber; 2 3 import java.util.Arrays; 4 5 public class FibonacciNumber 6 { 7 public static int [] generate ( int num) 8 { 9 int [] result= new int [num]; 10 result[0]=0; 11 result[1]=1; 12 for ( int i=2;i<num;i++){ 13 result[i]=result[i-1]+result[i-2]; 14 if (result[i]<0){ 15 System. out .println( " Out of range! " ); 16 break ; 17 } 18 } 19 return result; 20 } 21 public static void main (String[] args) { 22 int num=20; //numbers of fibonacci number 23 int [] fibo=FibonacciNumber . generate (20); 24 System. out .println(Arrays. toString (fibo)); 25 } 26 } 27 Output run: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181] BUILD SUCCESSFUL (total time: 0 seconds) Video Tutorial

Prime Numbers Algorithm in Java Array

Image
Code 1 package primenumber; 2 3 import java.util.Arrays; 4 5 public class PrimeNumber { 6 public static int [] generate ( int num) 7 { 8 int [] numbers= new int [num]; 9 if (num>1){ 10 numbers[0]=1; 11 } 12 int i=1,n=2; 13 while (i<num){ 14 boolean found= false ; 15 for ( int j=2;j<n;j++){ 16 if ((n%j)==0){ 17 found= true ; 18 break ; 19 } 20 } 21 if (!found){ 22 numbers[i]=n; 23 i++; 24 } 25 n++; 26 } 27 return numbers; 28 } 29 30 public static void main (String[] args) { 31 int num=20; //numbers of prime number 32 int [] prime=PrimeNumber. generate (20); 33 System. out .println(Arrays. toString (prime)); 34 } 35 } Output: run: [1, 2, 3, 5, 7, 11, 13, 17,...

How to Randomize The Order of Java Array

Image
This code is how to randomize the sequence of numbers. Code: 1 package random.sort; 2 3 import java.util.Arrays; 4 import java.util.Random; 5 6 public class RandomSort { 7 public static int [] generate ( int num) { 8 int [] result = new int [num]; 9 Random rand= new Random(); 10 int i = 0; 11 while (i < num) { 12 int a=rand.nextInt(num); 13 boolean exist= false ; 14 for ( int j = 0; j < i; j++) { 15 if (result[j] == a) { 16 exist= true ; 17 break ; 18 } 19 } 20 if (!exist){ 21 result[i]=a; 22 i++; 23 } 24 } 25 return result; 26 } 27 28 public static void main (String[] args) { 29 //how library work 30 int [] randomIndex=RandomSort. generate (10); 31 System. out .println( " RandomIn...