₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,794 members, 8,423,766 topics. Date: Wednesday, 10 June 2026 at 09:14 AM

Toggle theme

Craigston's Posts

Nairaland ForumCraigston's ProfileCraigston's Posts

1 2 3 4 5 6 7 8 9 10 (of 27 pages)

ProgrammingRe: A Little Javascript Problem by Craigston: 8:12am On Dec 27, 2016
paranorman:
i did PHP, using a recursive function, Mr. kodejuice
function jarvis(&$i, &$j, &$count) {
//$j = 10, by default, equivalent to the max number
//of the range;

$rand = rand(1, 10);
if ($j > 0) {
//is the first instance of the generated random number = 10 ? (print the number) : (keep looping through);
if (($rand == max(range(1, 10))) && ($count == 0)) {
print pow($rand, 2) . '<br />';
$j--;
$i = $rand;
$count++;
jarvis($i, $j, $count);
} else if ($rand == $j) {
//check if it's the next instance whose product
//should be printed; is instance consecutive?

print pow($rand, 2) . '<br />';
$j--;
$i = $rand;
jarvis($i, $j, $count);
} else {
//keep loopin through if the nth instance is not consecutive
//wrt to the previous

jarvis($i, $j, $count);
}
}
}

function ironMan() {
$i = 0;
$j = 10;
$count = 0;
//the $i parameter is not necessary, just included in function construct in case
//you wanna track the random number

jarvis($i, $j, $count);
}
ironMan();
Kodejuice:
LoL, u try sha, anyway heres my solution


// helper functions
function cons(x, y) {
return function(f) { return f(x, y) };
}

function car(pair) {
return pair(function(x, y){ return x });
}

function cdr(pair) {
return pair(function(x, y){ return y });
}

function nil(f) {
return f(nil, nil);
}

// ....
function range(start, stop) {
return start <= stop ? cons(start, range(start + 1, stop)) : nil;
}

function map(list, func) {
return list === nil ? nil : cons(func(car(list)), map(cdr(list), func));
}

function foreach(list, func) {
if (list !== nil) {
func(car(list));
foreach(cdr(list), func);
}
}

function reverse(list) {
return (function rev(list, ret){
return list === nil ? ret : rev(cdr(list), cons(car(list), ret));
})(list, nil);
}

Someday these guys are gonna hatch monsters...
ComputersRe: Ubuntu Linux by Craigston: 10:11pm On Dec 26, 2016
stynhaq:
I believe at some point it would fail, regardless of the hardware available because VBox does not yet support Nested Virtualization
I might try that someday, maybe after I upgrade my hardware.
ProgrammingRe: Friendosphere.com is there for you, developer-inclined website by Craigston: 3:25pm On Dec 25, 2016
DanielTheGeek:
Will look into it.
Same moniker if you need to check.
ProgrammingRe: A Little Javascript Problem by Craigston: 3:07pm On Dec 25, 2016
dhtml18:
Why are you guys like this? This is xmas, you ought to be killing turkeys, rams, goats, cows etc or at least eating one somewhere, but why?
You guys just wanna code year in, year out, no way, i am out of here, runs away at top speed!!!!!!!
Don't mind them. Coding like bots. Oya choose your favorite: turkey, beef, venison, snake, crocodile, antelope, grass cutter, pork, or rat. You have at most two choices smiley
ProgrammingRe: Select All Rows Where The Sum Of Column Equals A Value by Craigston:
How precise do you want the results to be? Do you want to carry out an exhaustive search of all such possible rows, and thus obtain every possible answer?
This seems like a combinatorial problem, and if you want an exhaustive enumeration of the problem, the cost of computing increases fast as the number of rows increases.
Also, are negative integers allowed in the rows? Are the numbers restricted to any set of numbers (integers, natural numbers, complex numbers, real numbers...).
I don't know how to implement this in a database, but you can do it in a program using a 1 x n matrix that maps to your table.

See these SO links, [1] and [2], for similar problems.
This problem is not one at which SQL can shine. It requires much use of repetition and the running time grows exponentially. In fact, I wouldn't attempt it for N results where N > 3, N being the number of rows whose sum matches the expected result.

However you do it, I wish you good luck. I don't know what I'm saying, so do not assume it to be credible advice. I just came to say hello.
DanielTheGeek, dhtml18, Jregz, seunthomas, FincoApps, cbrass, FrankLampard, godofbrowser, thewebcraft, Javanian, booyakasha, larisoft, stack1, yawatide, tr3y, Knownpal, rayval, blueyedgeek, jidez007, KvnqPrezo, Jenifa123, VenantCode, directonpc, DavidTheGeek, crotonite, Blenyo11, CodeNister, CodeHouse, logicalhumour, Asalimpo, lekropasky...
Someone needs help.

Disclaimer: the mentioned monikers were semi-automatically generated.
Merry Christmas and a Happy New Year to all devs and techies.

[1] http://stackoverflow.com/questions/21020619/sql-server-select-rows-whos-sum-matches-a-value

[2] http://stackoverflow.com/questions/6289314/how-to-get-rows-having-sum-equal-to-given-value
ProgrammingRe: A Little Javascript Problem by Craigston: 1:02am On Dec 25, 2016
Let me watch the big techies solve this.
ProgrammingRe: Friendosphere.com is there for you, developer-inclined website by Craigston: 11:36pm On Dec 23, 2016
DanielTheGeek:
I will look into this issue and get back to you. Sorry for any inconveniences.
Registration successful. What's up with the confirmation email? I didn't receive it.
ProgrammingRe: Friendosphere.com is there for you, developer-inclined website by Craigston: 7:39pm On Dec 23, 2016
DanielTheGeek:
I guess you're trying to login with your old details. Due to the recent data-loss that won't be possible, I hope you don't mind re-registering.
I got this error on attempting a new registration. It's the same thing with login.
That "Please click again to confirm" just doesn't go away.

ProgrammingRe: Friendosphere.com is there for you, developer-inclined website by Craigston: 12:45pm On Dec 22, 2016
DanielTheGeek:
@Craigston, I appreciate your support, Still trying to get things to Seun, maybe we will go with @sleepingdemon's way at the end of the day.
Holla Dan, what's up with friendosphere? I've been unable to login there: the pahe keeps asking me to retry. Is it a temporary problem you are aware of?
Congrats on the new design.
Foreign AffairsRe: World On Terror Alert: Security Ramped Up In EU Major Cities Over Berlin Attack. by Craigston: 8:29pm On Dec 21, 2016
Explorers:
Citizens are protesting now, no to immigration.
While we try to be politically correct and not offend anyone on religious lines, it's clear that the problem is largely islamist fundamentalism. It'll only get worse as we continuously try to tame beasts with soft words. You don't sing to a dragon; you don't stroke a bear to calm down.
Tommy Robinson's "Enemy of the State" is a nice account of everyday life amidst islamist terrorism.
ProgrammingRe: What Is Your Most Valuable Asset As A Developer? by Craigston: 11:23pm On Dec 20, 2016
FincoApps:
Haaa seriously I don't care if my pictures go to the world. Also as long as you don't use these backups as your default HDD, no browser passwords would be stored there.... besides a really determined hacker would decrypt it and I don't think such hackers would be stealing drives.

My point is, don't waste time encrypting things except of course you've got secrets
I get your point, and I think it makes sense for everyday experiences.
Of course not everyone needs it, but I just do it. I find it advantageous in some situations.
ProgrammingRe: What Is Your Most Valuable Asset As A Developer? by Craigston: 11:22am On Dec 20, 2016
FincoApps:
smh, what's the use of encrypting it ? The content won't be needed by the thief.... they'll probably format the drive before they even realize it's encrypted....

Was thinking someone would say they wanna start using a cloud service as Backup 2
It depends on who steals it. If it's someone with malicious intentions, encrypting it makes sense. You also don't want photos of friends and family in the hands of unknown persons. And if your browsers automatically store your passwords, it could be a nasty experience in the hands of a thief.

Cloud backup services are expensive wrt data bundles. I backup only important documents to cloud services. Some on Dropbox, some with my email providers, some on Google drive and others.
ProgrammingRe: What Is Your Most Valuable Asset As A Developer? by Craigston: 5:50pm On Dec 19, 2016
It's my laptop first. I really hope nothing happens to it. I felt really bad when my 500GB hard drive crashed.
I backup redundantly whenever I can. I got 4GB DVD discs (I'll still get more) and I backup materials that will be relevant for a long time to them. My flash drive has a backup of all my documents. My phone and my SD card have some. My hard disk has another set too.
I'm thinking of encrypting every drive I can so its content remain useless to whoever steals it. And I'm about redoing the backup process on every drive I carry about by first encrypting the compressed image of the files before putting them on encrypted drives.
ProgrammingRe: Frameworks Dont Make Sense by Craigston: 12:58pm On Dec 12, 2016
I've become a little skeptical about comments from this papa troll (name.match("/^dhtml.*/i")).
I hope Jenifa123 is not his new interface.
WebmastersRe: Photo Editing Apps Should Be Banned by Craigston: 12:24pm On Dec 12, 2016
+1 like for identifying the trend as a problem. But those apps are not the cause; they only give vent to expressions of low self-esteem. If there's anything to thank them for, it is that they've helped us identify the problem.

RoyalBlak007:
Cant believe this is coming.
[color=gold] from a Lady grin[/color]
This comment has a sexist tone. You may want to reword it to make the right point.
ProgrammingRe: What Operating System Are You Using On Your Computer System by Craigston: 8:43pm On Dec 01, 2016
Jregz:
*dies*
Oh, that...is no problem. *pours ice-cold water into his ears and over his head*
ProgrammingRe: What Operating System Are You Using On Your Computer System by Craigston: 5:53pm On Nov 30, 2016
Jregz:
Boss keh ? We know the true bosses
Huh? Baba Jregz don dey deny the title? We know them sha, but you sef dey. One day, we'll become true bosses.
ProgrammingRe: What Operating System Are You Using On Your Computer System by Craigston: 8:07am On Nov 30, 2016
Ubuntu 16.04 (Xenial Xerus). I recently moved over from Debian 8 (Jessie). But power management just got worse. My battery now discharges faster than before and "powertop --auto-tune" does not work. I find it annoying that the default screen brightness is too high and I have to force it further down every time. Going to Windows 10 could solve the power and driver issues but it'll bring me into more trouble with development (I find it easier to work on Linux).
PetsRe: The Persecution Of Cats In Nigeria by Craigston: 7:33pm On Nov 27, 2016
dreezybines:
Smiles...

I think I get What you're saying...

You could have Just said they're important...

They are never equally important...

God gave we humans dominion over everything on earth...

They're far less to we human...
I understand you too. I'm emphasizing the functional importance, not dominion. Of course we are needed to play the role of the caretaker, but they do the things we cannot do at such little cost.
I once heard a quote that I vaguely remember as follows:
If all insects disappeared from the Earth, within 50 years all life would end; if all men disappeared from the Earth, within 50 years all life would flourish.
PetsRe: The Persecution Of Cats In Nigeria by Craigston: 10:56pm On Nov 26, 2016
dreezybines:
Equally important in what sense...
Equally important in the sense that we depend on them, either directly or indirectly, for our survival. And what's the Earth if no creature other than man exists?
PetsRe: The Persecution Of Cats In Nigeria by Craigston: 9:00am On Nov 26, 2016
I love cats and I understand how horrible those crude beliefs are. My cats, three kittens, were much persecuted by neighbors and only one grew into a cat. They finally killed it too. I was disheartened when I saw a whole street excite themselves with killing a helpless kitten that was only taking shelter from the rain, after its previous habitat had been destroyed for construction of a building.
I find these creatures more amiable than some humans. Until we learn that these creatures are equally important as humans, we cannot respect nature, let alone the God we blindly profess knowing.
Foreign AffairsRe: Trump And Clinton's Supporters Fight Outside White House Over Election Results by Craigston: 8:47pm On Nov 09, 2016
This may be the end of the greatest democracy of our time, as we know it; and Trump may be our greatest mistake of the century, and we'll bear it.
The weakest link of democracy has been exploited, and the outcome may be more than regretted. We saw ourselves and others, and we let our complaints reduce to shudders. Welcome, democracy 2016. It's the year human foolishness once again distilled.
I would wail for them, and for us, and for the world. But they will see me as lame, yet another one gone nuts, and names will I be called. So let us watch history, not from the books, but from our own lives, get replayed. And whether the warnings of the minority thinkers were prophetic, or just prescient, we'll come to know only after it's all over. Good luck to Trump, to the USA, and to the world. Right now, American exceptionalism just got ridiculed. Is this still the land of the free?
ProgrammingRe: I Study Computer Sciences In A Finnish University. Ask Me Anything by Craigston: 8:19am On Nov 07, 2016
Badyear:
Where exactly in my statement did it show that I am complaining?
All I stated was facts and you don't even know me or my situation or which 'east african country' i was referring to but you are already hot.
Please mr patriotic try reading carefully and understanding before throwing a feedback.
Sorry, I misunderstood you as much as you did me. And we both know tech does not flourish here as it does there.
I really wasn't attacking you. And a feedback could be valuable too. Just get my view as I now get yours.
ProgrammingRe: I Study Computer Sciences In A Finnish University. Ask Me Anything by Craigston: 10:34pm On Nov 06, 2016
Badyear:
Oh good for you then,
You see unlike you I am a student in a poor little east african country and here we don't have the Microsofts and Googles so computer science is not really the dream, and I am about to graduate but I have no idea what to do next and that is why i am asking all this questions.
Thank you for your reply
You're not the first to complain of the situation here and you'll definitely not be the last. But instead of counting the things we don't have, we can work with the little we have and hope it gets better.
PropertiesRe: See The Future Of African Homes And Cities.......... by Craigston: 10:53am On Oct 30, 2016
I'm still a lover of natural, brilliant designs that blend well with the environment without depending on technology that might just disappear someday. It scares me to think what will happen if all these smart devices were hit by an EMP. Suddenly our houses become too useless and we suffer massive withdrawal due to our dependence on technology. We are not getting very productive with our current applications of technology. We need to make these technologies more human. Suddenly your house cannot maximize natural light, air, space, and stops being environmentally friendly because these smart systems got dysfunctional? Scary.
ProgrammingRe: Which Programming Pdfs Do You Recommend For A Web Developer? by Craigston:
Averted:
i will advice you to Remove PHP and JavaScript from there tongue and Learn Ruby and Rails ... download "Ruby in practice".pdf
What's wrong with learning JavaScript?

I'd say remove PHP for now and use a language that has an elaborate type system. If you really want PHP, learn the newer versions of the language (PHP >= 5.6).
Forget Angular; go straight to Angular 2 but be sure to know your JS well (especially ES 2016).
Also try to reward those authors by paying for their work and respecting copyright. Most free soft copies are pirated works.
This link points to a good collection of freely available programming books:
https://github.com/vhf/free-programming-books
ComputersRe: Ubuntu Linux by Craigston: 7:22pm On Oct 23, 2016
AwesomeRomeo:
I didn't download ISO file, please help me with the link. Thanks bro.
Go to the download page (www.kali.org/downloads).
But why Kali? Kali is specifically designed for penetration testing so it's not recommended for regular use. Do you intend to use it as a regular distro?
Here's a link to the 64-bit full ISO image:
[url]cdimage.kali.org/kali-2016.2/kali-linux-2016.2-amd64.iso[/url]
ComputersRe: Ubuntu Linux by Craigston: 5:04pm On Oct 23, 2016
AwesomeRomeo:
I have never used virtualbox b4 or Linux distro. I am a novice bro
Uh, have you downloaded the Kali Linux ISO file? Download it to a folder and also install virtualbox.
Start Virtualbox and add a new Virtual machine of type Linux and choose the Debian/GNU Linux distribution. Select 64-bit if your ISO file is a 64-bit ISO.
Customize the properties of the Virtual machine (memory, CPU, etc) and setup other options as you need.
Then start the virtual machine and point it to the downloaded ISO file.
The entire process is easy with the guided mode. Just follow the steps in virtualbox and accept default options where you are not sure. Youtube may be of help if you need some guidance.
ComputersRe: Ubuntu Linux by Craigston: 4:08pm On Oct 23, 2016
AwesomeRomeo:
Please bro, how can I install Kali Linux os on virtualbox? Tanx
You can do it just as you install any other Linux distro in VirtualBox. My version of Virtualbox doesn't have Kali Linux as an option so I choose Debian Linux as the distro option. It works.
ProgrammingRe: How It Feels Like To Learn Javascript In 2016 by Craigston: 5:29pm On Oct 22, 2016
jboy01:
Bro! where did you get your fact from that angular is on its way out, with the angular 2 on it RC that even framework like ionic that power highest percentage of the hybrid are following back to back with the ionic 2 also in RC now. Bro angular is not going anywhere now.
Angular != Angular 2. They're different, so I heard.
Maybe someone will find this survey report helpful:
[url]stateofjs.com/[/url]
ProgrammingRe: How It Feels Like To Learn Javascript In 2016 by Craigston: 10:22am On Oct 22, 2016
Just know that whatever you are using now may be outdated in a few months, not because it's too deficient but, you know, it's another year and whatever you are using now will be "...so 2016, so 20??...".

ProgrammingRe: Hello PHP Dev, If You're To Dump PHP What Language Will You Adopt? by Craigston: 8:21pm On Oct 21, 2016
DanielTheGeek:
You may want to accept the upgrade by default:
sudo apt-get -y dist-upgrade.
You're welcome.
Yea. C++ this semester so I've got some titles (one hard copy, the rest as soft copies) to learn with.
My ebook library has gotten huge from the initial hunt for good resources. After organising them into groups, it's time to learn.

1 2 3 4 5 6 7 8 9 10 (of 27 pages)