Programming › Re: 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());
|
Programming › Re: 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. |
Politics › Re: 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  ... |
Romance › Re: Mr Nairaland June 2013 - Elimination Round 1. by jacob05(m): 5:18pm On Jun 17, 2013 |
i Rep Team PC GURU |
Computers › Re: 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 Market › Re: 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 |
Computers › Re: 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 |
Computers › Re: 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 |
Crime › Re: Nigerian Cab-driver Shot Dead In Washington DC by jacob05(m): 8:36pm On Jun 07, 2013 |
, |
Crime › Re: Molestation Suspect Buried Alive In Bolivia by jacob05(m): 8:28pm On Jun 07, 2013 |
. |
Phones › Re: 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 |
Computers › Re: 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 |
Politics › Re: Do Generator Dealers Contribute To The Power Failure In The Country? by jacob05(m): 11:10am On Jun 02, 2013 |
probably.  . It seems they're getting more out of our power Crisis. |
Programming › Re: 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: "  ; 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 Etc › 419 People Like This by jacob05(op): 8:55pm On May 14, 2013 |
speech by president Jonathan
|
Jokes Etc › Google: Jonathan Is Dizzy by jacob05(op): 9:00pm On May 12, 2013 |
No be me ooo
|
Politics › Re: LAGOS Is World's 3rd Worst City To Live In. by jacob05(m): 3:47pm On May 08, 2013 |
[size=50pt]OLD NEWS[/size] |
Fashion › Re: Help Me Re- Invent My Style by jacob05(m): 3:27pm On May 08, 2013 |
Need some Advice also |
Webmasters › Re: 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  |
Jokes Etc › Re: World Leaders Explains Why The Chicken Crossed The Road by jacob05(m): 4:48pm On Apr 28, 2013 |
lol |
|
Programming › Re: 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.... |
Programming › Re: Are MVC4 ASP Developers(c#) Here? by jacob05(m): 7:50pm On Apr 23, 2013 |
huh? |
Tech Jobs › Re: Where To Learn Programming,php Precisely In Lagos by jacob05(m): 4:05pm On Apr 23, 2013 |
CCHub yaba  , great dudes there |
Programming › Re: 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" ;
|
Programming › Re: 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,  |
Sports › Re: CAN U17 - Nigeria Vs Ghana 6-1 (Full Time) by jacob05(m): 11:51pm On Apr 14, 2013 |
O ga 0 |
Islam › Re: MEND Threatens To Bomb Mosques & Assasinate Imams by jacob05(m): 8:26pm On Apr 14, 2013 |
Na wash... |
|
Webmasters › Re: Nigeria Has No Functional Official Web Portal by jacob05(m): 11:50am On Apr 12, 2013 |
The Site Self na TABLE based...  |
Celebrities › Re: Anita Joseph's "Dog Bite" Tattoo by jacob05(m): 10:38am On Apr 12, 2013 |
Na Scar Jooor |
Programming › My 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" ; Candidate myCandidate = myParty.getCandidate(Post.PRESIDENT); } else{ Party myParty = new Party("PDP" ; Candidate myCandidate = myParty.getCandidate(Post.PRESIDENT); } Election.vote(myCandidate); }
|