₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,256 members, 8,449,445 topics. Date: Tuesday, 21 July 2026 at 07:05 PM

Toggle theme

Jacob05's Posts

Nairaland ForumJacob05's ProfileJacob05's Posts

1 2 3 4 5 6 7 8 ... 18 19 20 21 22 23 24 25 26 (of 37 pages)

ProgrammingRe: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 12:07pm On Jun 23, 2013

<?php
/*
Author: Pyjac (facebook.com/pyjac)
*/

class Spiral{

private $masterArray= [];

public function addArray(array $array){
$this->masterArray[] = $array;
}

public function getSpiral(){
$workingList = [];
while (!empty($this->masterArray) ){

$workingList = array_merge($workingList,$this->popListTopArray());
$workingList = array_merge($workingList,$this->popLastArraysElement());
$workingList = array_merge($workingList,$this->popListLastArrayReversed());
$workingList = array_merge($workingList,$this->popFirstArraysElementReversed());
}

return $workingList;

}

private function popFirstArraysElementReversed()
{
if(empty($this->masterArray)) return array();
$workingArray = [];
foreach ($this->masterArray as &$array) {
$workingArray = array_merge($workingArray,(array)array_shift($array));
}
krsort($workingArray);
return $workingArray;

}

private function popListLastArrayReversed()
{
if(empty($this->masterArray)) return array();
$workingArray = [];
$workingArray=array_pop($this->masterArray);
krsort($workingArray);

return $workingArray;
}

private function popListTopArray()
{
if(empty($this->masterArray)) return array();
return array_shift($this->masterArray);
}

private function popLastArraysElement()
{
if(empty($this->masterArray)) return array();
$workingArray = [];
foreach ($this->masterArray as &$array) {
//$testArray = $array[0];
$workingArray = array_merge($workingArray,(array)array_pop($array));
}
return $workingArray;

}
}

//Usage:
$a = ['T','H','Q' ,'P'];
$b = ['X', 'W' ,'S','O'];
$c = ['B', 'C', 'D','E'];
$d = ['G', 'A', 'R', 'K'];
$spiral = new Spiral();
$spiral->addArray($a);
$spiral->addArray($b);
$spiral->addArray($c);
$spiral->addArray($d);
var_dump($spiral->getSpiral());
ProgrammingRe: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 7:06am On Jun 23, 2013
Hmmm, cool. My solution coming soon.
PoliticsRe: Fashola Hated School Failed Waec & Almost Became A Mechanic by jacob05(m): 4:59pm On Jun 18, 2013
and you expect us to read all this undecided...
RomanceRe: Mr Nairaland June 2013 - Elimination Round 1. by jacob05(m): 5:18pm On Jun 17, 2013
i Rep Team PC GURU
ComputersRe: Huawei USB Modem Unlocker - Download Here! by jacob05(m): 8:03pm On Jun 15, 2013
Please unlock code for - GLO model:huawei e303s-1 imei:867648012501035.. Thanks
Computer MarketRe: New Acer Aspire 500gb,4gb ram ,63,000k by jacob05(m): 9:10am On Jun 15, 2013
Guy, i fit get fairly used intel i3 for 40k
ComputersRe: How Do I Unlock My Glo Netpro Modem? by jacob05(m): 7:40am On Jun 15, 2013
Manufacturer :huawei
- Model :E303
- Revision :21.157.71.00.251
- Phone IMEI :867648012501035
Thanks
ComputersRe: Unlock Huawei E303 Modem And All Stubborn Modem Unlock Difficulties Solved! by jacob05(m): 9:56pm On Jun 14, 2013
Manufacturer :huawei
- Model :E303
- Revision :21.157.71.00.251
- Phone IMEI :867648012501035
Thanks
CrimeRe: Nigerian Cab-driver Shot Dead In Washington DC by jacob05(m): 8:36pm On Jun 07, 2013
,
CrimeRe: Molestation Suspect Buried Alive In Bolivia by jacob05(m): 8:28pm On Jun 07, 2013
.
PhonesRe: Unlock Your Huawei E303 Modem And Other Modem For Free Here by jacob05(m): 1:21pm On Jun 03, 2013
etisalat e303

- Manufacturer :huawei
- Model :E303
- Revision :11.126.29.00.533
- Phone IMEI :861195002700926
ComputersRe: Unlock Huawei E303 Modem And All Stubborn Modem Unlock Difficulties Solved! by jacob05(m): 1:07pm On Jun 03, 2013
ETISALAT E303 modem unlock code pls

- Manufacturer :huawei
- Model :E303
- Revision :11.126.29.00.533
- Phone IMEI :861195002700926
PoliticsRe: Do Generator Dealers Contribute To The Power Failure In The Country? by jacob05(m): 11:10am On Jun 02, 2013
probably. cry. It seems they're getting more out of our power Crisis.
ProgrammingRe: Pls Help Correct This Code by jacob05(m): 10:33pm On May 30, 2013
#include<stdio.h>
#include<conio.h>
int main ()
{
char name;
int score;
printf("\n Enter name: "wink ;
scanf("%c",&name);
printf("\n Enter score: " );
scanf("%d",&score);
if (score >= 80)
printf("\n %c is fit",name);
else printf("\n %c is not
fit",name);
return 0;
}


should run{not tested though}
Jokes Etc419 People Like This by jacob05(op): 8:55pm On May 14, 2013
speech by president Jonathan

Jokes EtcGoogle: Jonathan Is Dizzy by jacob05(op): 9:00pm On May 12, 2013
No be me ooo

PoliticsRe: LAGOS Is World's 3rd Worst City To Live In. by jacob05(m): 3:47pm On May 08, 2013
[size=50pt]OLD NEWS[/size]
FashionRe: Help Me Re- Invent My Style by jacob05(m): 3:27pm On May 08, 2013
Need some Advice also
WebmastersRe: Intermediate PHP Developer Needed For Placement by jacob05(m): 6:04pm On May 06, 2013
webstorespro: We still need intermediate php developers for placement at our office at Ikeja G.R.A.
Skilled in Javascript, Php/MySql, JQuery, with a good understanding of MPC framework, with an ability to administer CMS's like wordpress, joomla, etc.
Applicant should be willing learn new technologies, and work with minimal supervision.
Thank you.
you Mean MVC Framework huh
Jokes EtcRe: World Leaders Explains Why The Chicken Crossed The Road by jacob05(m): 4:48pm On Apr 28, 2013
lol
ProgrammingRe: Help With Php Update Function by jacob05(m): 8:05pm On Apr 23, 2013
I think you should have something like

if (isset($_POST["name of Your Submit Button"]){
update();
}

and the createSalt() function should be declared outside the update function....
ProgrammingRe: Are MVC4 ASP Developers(c#) Here? by jacob05(m): 7:50pm On Apr 23, 2013
huh?
Tech JobsRe: Where To Learn Programming,php Precisely In Lagos by jacob05(m): 4:05pm On Apr 23, 2013
CCHub yaba wink, great dudes there
ProgrammingRe: Challenge: Strong Password Filter by jacob05(m): 6:45pm On Apr 17, 2013
OOP in PHP...


<?php

interface IPasswordChecker {

function check($password);
}

class UppercasePasswordCheck implements IPasswordChecker {
public function check($password){
if(!preg_match("/[A-Z]+/", $password)){
return "Your password must have at least one capital letter";
}
}
}

class LowercasePasswordCheck implements IPasswordChecker {
public function check($password){
if(!preg_match("/[a-z]+/", $password)){
return "Password must have at least one small letter";
}
}
}

class NumericPasswordCheck implements IPasswordChecker {
public function check($password){
if(!preg_match("/[0-9]+/", $password)){
return "Password must have at least one number";
}
}
}

class SymbolPasswordCheck implements IPasswordChecker {
public function check($password){
if(!preg_match("/[+&@]+/", $password)){
return "Password must have any of this symbols: +,&,@";
}
}
}

class SpacePasswordCheck implements IPasswordChecker {
public function check($password){
if(strpos($password, ' ')){
return "Password must NOT have any space character";
}
}
}

class StrongPasswordChecker implements IPasswordChecker {

private $checks = array();


function __construct() {
$this->checks[] = new UppercasePasswordCheck();
$this->checks[] = new LowercasePasswordCheck();
$this->checks[] = new SpacePasswordCheck();
$this->checks[] = new SymbolPasswordCheck();
$this->checks[] = new NumericPasswordCheck();

}
public function check($password) {
$error = "";
foreach($this->checks as $key => $check){
$error .= !($result=$check->check($password)) ? "" : $result. "<br />";
}
return $error;
}
}

$Checker = new StrongPasswordChecker();
echo $Checker->check("Pyjac"wink;

ProgrammingRe: What PHP Framework Is The Best? by jacob05(m): 4:19pm On Apr 17, 2013
Go for Laravel bro, Life is easy in Laravel, Trust me, wink
SportsRe: CAN U17 - Nigeria Vs Ghana 6-1 (Full Time) by jacob05(m): 11:51pm On Apr 14, 2013
O ga 0
IslamRe: MEND Threatens To Bomb Mosques & Assasinate Imams by jacob05(m): 8:26pm On Apr 14, 2013
Na wash...
WebmastersRe: Nigeria Has No Functional Official Web Portal by jacob05(m): 11:50am On Apr 12, 2013
The Site Self na TABLE based... undecided
CelebritiesRe: Anita Joseph's "Dog Bite" Tattoo by jacob05(m): 10:38am On Apr 12, 2013
Na Scar Jooor
ProgrammingMy Voting Plan For 2015 by jacob05(op): 10:43pm On Apr 10, 2013

//author: Pyjac

if( Date.getYear() == "2015" && Season.getSeason() == Season.ELECTION){
if (Electricity.getStatus() != Status.STABLE){
Party myParty = new Party("APC"wink;
Candidate myCandidate = myParty.getCandidate(Post.PRESIDENT);
}
else{
Party myParty = new Party("PDP"wink;
Candidate myCandidate = myParty.getCandidate(Post.PRESIDENT);
}
Election.vote(myCandidate);
}

1 2 3 4 5 6 7 8 ... 18 19 20 21 22 23 24 25 26 (of 37 pages)