Oct 09

UoP Bus Timetable (Android App) released!

UoP Bus Timetable

 

UoP (University of Portsmouth) Bus Timetable is now available for free on the Google Play store!

UoP Bus Timetable Screenshot

 

Get it on Google Play

Status update

Eddy

This is just a quick post to say that I’ve started working on a simple Android app for the purpose of quickly and conveniently showing students of The University of Portsmouth the bus timetable. This app should be ready soon.

Jul 24

SA-MP PHP Query and RCON API version 1.1 released

Version 1.1 of my SA-MP (San Andreas Multiplayer) PHP Query and RCON API is now available. There’s no major changes however it should be slightly more efficient and secure now.

 

Original post with examples

 

Download

Jul 12

NetBeans PHP Tutorial – Binary Search #15

In this tutorial I show how to implement a binary search algorithm in PHP.

Code:

<?php
 
$binaryArray = generateOrderedArray();
 
print(binarySearch($binaryArray, 640));
 
function binarySearch($array, $searchFor) {
	$low = 0;
	$high = count($array) - 1;
	$mid = 0;
 
	while ($low <= $high) { // While the high pointer is greater or equal to the low pointer
		$mid = floor(($low + $high) / 2);
		$element = $array[$mid];
 
		if ($searchFor == $element) { // If this is the value we're searching for
			return $mid;
		} else if ($searchFor < $element) {
			$high = $mid - 1;
		} else {
			$low = $mid + 1;
		}
	}
	return -1;
}
 
function generateOrderedArray() {
	$array = [];
 
	for ($i = 0; $i <= 99; $i++) {
		$array[$i] = $i * 10;
	}
	return $array;
}

Jul 12

NetBeans Java Tutorial – Binary Search #4

In this tutorial I show how to implement a binary search algorithm in Java.

Code:

package tutorials;
 
import java.util.ArrayList;
 
/**
 *
 * @author Edward
 */
public class Searches {
	public static void main(String[] args) {
		Searches searches = new Searches();
		searches.testBinarySearch();
	}
 
	public void testBinarySearch() {
		System.out.println(binarySearch(this.generateOrderedArray(), 640));
	}
 
	private int binarySearch(int[] array, int toFind) {
		int low = 0;
		int high = array.length - 1;
		int mid = 0;
 
		while (low <= high) {
			mid = (int) Math.floor((low + high) / 2);
			int element = array[mid];
 
			if (toFind == element) {
				return mid;
			} else if (toFind < element) {
				high = mid - 1;
			} else {
				low = mid + 1;
			}
		}
		return -1;
	}
 
	private int[] generateOrderedArray() {
		int[] array = new int[100];
 
		for (int i = 0; i <= 99; i++) {
			array[i] = i * 10;
		}
		return array;
	}
}

Jul 10

101 CMS Released on GitHub

As of the 10th of July 2014 I’m pleased to announce that 101 CMS has been released publicly on GitHub.

101 CMS Preview Picture

101 CMS Preview

101 CMS is a gaming clan content management system, developed mainly in PHP. The project was being worked on by myself and other members of the 101st Division gaming clan

The project is now free for anyone to look at or work on, if you’re interested you can find the repository here.

101 CMS GitHub Repository

Jun 14

EM Captcha – Visual PHP Captcha Class – 1.2 BETA

EM Captcha 1.2 BETA is now available. Version 1.2 is more secure than previous versions and also more efficient.

Link to original post with example as to how to use the class

Extra Information

PHP version: 5.4.0 or above

PHP extension / library requirements: SQLite3 and GD (Version 2.0)

License:  Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

True Type Fonts: 3Dumb, LimeLight, SpecialElite – Note, these fonts are subject to their own licenses which are included in the download under the “fonts” directory.

Download

May 13

NetBeans Java Tutorial – Linear Search #3

In this tutorial I show how to implement a linear search algorithm in Java.

 

 

Code:

package tutorials;
 
import java.util.ArrayList;
 
/**
 *
 * @author Edward
 */
public class Searches {
	public static void main(String[] args) {
		Searches searches = new Searches();
		searches.testLinearSearch();
	}
 
	public void testLinearSearch() {
		ArrayList<String> myArray = new ArrayList<>();
		myArray.add("lemon");
		myArray.add("lime");
		myArray.add("pear");
		myArray.add("apple");
 
		System.out.println(linearSearch(myArray, "orange"));
	}
 
	private int linearSearch(ArrayList<String> array, String toFind) {
		int i = 0;
		for (String val : array) {
			if (val.equals(toFind)) {
				return i;
			}
			i++;
		}
		return -1;
	}
}

May 13

NetBeans PHP Tutorial – Linear Search #14

 

In this tutorial I show how to implement a linear search algorithm in PHP.

 

The code used for this tutorial can be seen here:

<?php
 
$myArray = ["orange", "lemon", "pear", "apple", "lime"];
 
print(linearSearch($myArray, "kiwi"));
 
function linearSearch($array, $toFind) {
	foreach ($array as $key=>$val) {
		if ($val == $toFind) {
			return $key;
		}
	}
	return -1;
}
 
?>

 

Feb 11

NetBeans PHP Tutorial – Short Hand Array Declaration PHP 5.4.0 #13

In this tutorial, I show how you can use PHP’s new short hand array declaration method, which is available from PHP version 5.4.0.

Older posts «