₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,153 members, 8,420,590 topics. Date: Friday, 05 June 2026 at 05:49 AM

Toggle theme

Kodejuice's Posts

Nairaland ForumKodejuice's ProfileKodejuice's Posts

1 2 3 4 (of 4 pages)

LiteratureRe: If You Were Asked To Write A Book About Your Life, What Would The Title Be? by Kodejuice: 7:52am On Jul 13, 2016
LoL, The Story of my Life
ProgrammingRe: Write And Record App: Android App To Quickly Record Anything by Kodejuice: 6:11pm On Jun 28, 2016
Nice but its not well organized, check out Anki in the playstore
ProgrammingRe: Meet Nairachat - Nigeria's New Phenomenon by Kodejuice: 5:50am On Jun 28, 2016
jidez007:
There's nothing stopping you from modifying it or writing your own.
just saying.
ProgrammingRe: Meet Nairachat - Nigeria's New Phenomenon by Kodejuice: 10:46pm On Jun 26, 2016
jidez007:
here https://gist.github.com/djade007/9eda80ad4567e337b7ac4a09e28e0623
LoL, you have to be very specific if you're doing such. Because even if the login was successful, the page returned may contain the string 'Wrong username Or passwaord', may be in a particular threads name, the best way is to check if the element holding that error message exists and contains the error message.
ProgrammingRe: See The Javascript Code That Is Turning My Brain by Kodejuice: 9:33pm On Jun 26, 2016
lillylove2:
Please guys help me o. I've searched all over the internet and still can't find solution to this.

I have a link (html element), whose ID is automatically generated with PHP. Whenever the link is clicked, i want to insert the ID of the link into my database. The only problem now is how to get the ID.

This is my mock code:

///// The PHP that generates the id:
<?php
$id=(an array of numbers returned from a while loop);
?>


////the html link
<a href='#' onClick='MyId()' id='<?php echo $id ;?>'>Click Me</a>

/// the javascript function
function MyId() {
var ID=document.getElementById( the id of the element generated by php ).id;
}

My question now is how do i get and put the id of the clicked link into variable var ID
its quite easy with jQuery, but Vanilla JS it is.


//This should work

<a href='#' onClick='getId(this)' id='<?php echo $id ;?>'>Click Me</a>

function getId(Element){
var ID = Element.getAttribute('id');
//id now stored in ID
}

But if the php code is in the same place with the html, then no need to put the 'this', just put '<? echo $id; ?>' in the link elements onClick function arg.
ProgrammingRe: Hilarious Memes you can relate with as a Programmer by Kodejuice: 10:33am On Jun 01, 2016
More

ProgrammingRe: Hilarious Memes you can relate with as a Programmer by Kodejuice: 10:30am On Jun 01, 2016
More..

ProgrammingRe: Hilarious Memes you can relate with as a Programmer by Kodejuice: 10:20am On Jun 01, 2016
LoL

ProgrammingRe: How Do I Extract Data From Online Websites? by Kodejuice: 11:25am On May 18, 2016
parkicism:
Thanks a lot for your help. A lot of the websites do use RSS, so I'll just extract XML content from those websites. Could you please send the script you used, I would really love to check it out and do let me know when you release the app.
Download link (Download nl-pageparse.zip), includes tests to see how it works and a manual.
ProgrammingRe: How Do I Extract Data From Online Websites? by Kodejuice: 7:58pm On May 17, 2016
If the websites use RSS, you could just grab the url and use an XMLParser to conver it to object and arrays, XMLParser are found in all web prog-languages, or a plugin for parsing XML will certainly exist for the language u wish to use.

Or you could go hardcore, i actually built a Nairaland App for android using phonegap(screenshots included below), my popsi seized my Laptop untill i write my neco finish, after then i could push the app to Android app stores and probably build the ios version.

You know nairaland provides no API for getting it posts,it has RSS but it only includes 12 post from the FP (very annoying), so i used JavaScript to parse the pages fire for fire,

first of all i got the source code of each sections in nairaland, and i inspected the HTML, got the elements that holds the posts, comments, topics and stuffs like that, i then used jQuery to get the contents of these elements and stored them in an array, i did this for all sections apart from the FP, that one is quite different, different element for its posts and stuffs like that.

Acts much like an API but its just a hack, not saying u should follow this route, because its a very cumbersome task and a dangerous one any slight change in nairalands html may cause the app to fail, the app allows you to do everything, i couldnt include things like (login) so i added an option 'Nairaland web', gives u the nairaland webview inside the app, allowing you to do everything!, will be releasing the app after my Neco exam.

If you need, i could give you the script i wrote for parsing NL pages, it doesnt parse the (search, edit profile, new) and other irrelevant pages.

The screenshot i included is an old one, updated the app with more options b4 my Lapi got seized, options like (Trending, Recent, ...)

So, best of luck with the hacks!.

ProgrammingRe: These Are The Biggest Password Mistakes You Can’t Afford To Make by Kodejuice: 7:38am On Apr 26, 2016
Djangocode:
I guess it aint a matter of how short a password is, Its 'bout how strong it is... Example....

H*g2F^e0D%....


This is a short password buh its very strong owing to the nature of the combinations used...
Nice 1, it would take 173,000 years for a very fast super computer to bruteforce this password, but i knw say u no fit use am cheesy
ProgrammingRe: These Are The Biggest Password Mistakes You Can’t Afford To Make by Kodejuice: 12:22am On Apr 26, 2016
my password is 'Incorrect', even social networks remind me of my passoword saying "Your password is Incorrect"
ProgrammingRe: Phonegap Addicts, I Need Your Help by Kodejuice: 12:15am On Apr 26, 2016
You could just decompile the app or you rename it to a '.zip' file and locate the 'assets/www/' folder, then you see the scripts, in doing so you'll figure out the libraries used.
Jokes EtcRe: If Jesus Was A Nigerian ( Funny Pics) by Kodejuice: 7:26pm On Mar 28, 2016
lol
ProgrammingTry This Math Problem by Kodejuice(op):
The common difference of a arithmetric progression are (+3) and (-2) respectively.

E.g => if the first term of this sequence is 4, the terms would be:
4, 7, 5, 8, 6, 9, 7
i.e 4, (+3), 7, (-2), 5, (+3), 8, (-2), 6, ...

The task here is to come up with a formulae to get the nth term of such sequence.
ProgrammingRe: 6 Programming Exercises by Kodejuice(op): 10:41am On Jan 16, 2016
Fulaman198:
Look at the method vowelsCounted(), that is what it's for. Java and JavaScript are different languages. I created the main class to illustrate how it works.

EDIT: In case you don't know what I'm referring to, I'm talking about the method here



public int vowelsCounted(String myString){
int numVowels = 0;
for (int i = 0; i < myString.length(); i++) {
if (myString.charAt(i) == 'a'|| myString.charAt(i) == 'e'|| myString.charAt(i)=='i'
|| myString.charAt(i)=='o'|| myString.charAt(i) == 'u') {
numVowels++;
}
}
return numVowels;
}



In Java, functions are referred to as Methods.
You dont get, return all vowels in the passed string not just the number of vowels.


vowelsCount("hello world"wink; //=> 3, eoo
ProgrammingRe: 6 Programming Exercises by Kodejuice(op): 10:35am On Jan 16, 2016

//exercise 2, Closed Parenthesis
//Language: javascript

function closedBracket(str){
var openedBraces = str.match(/\(/g),
closedBraces = str.match(/\)/g),
opened = openedBraces.length, closed = closedBraces.length;

if(opened===closed){
return true;
}
else if(opened>closed){
//not well placed, eg "(()"
var needed = opened - closed,
fix = br(needed, "wink"wink;
return str + fix;
}
else if(opened<closed){
//not well placed, eg "())"
var needed = closed - opened,
fix = br(needed, "("wink;
return fix + str;
}
else{
return str; //?!
}

function br(n, b){
//br(2,"("wink => ((
var s = "";
while(s.length!==n){
s += b;
}
return s;
}

}
ProgrammingRe: 6 Programming Exercises by Kodejuice(op): 3:52pm On Jan 14, 2016
Fulaman198:
Programme: VowelCount
Language: Java



import java.util.Scanner;

public class VowelCount {

public static void main(String[] args) {
String myText;
int vowelsTotal = 0;
countVowels cntVwl = new countVowels();
Scanner scan = new Scanner(System.in);
System.out.println("Please Enter a String with vowels: " );
myText = scan.nextLine();
vowelsTotal = cntVwl.vowelsCounted(myText);
System.out.println(myText + " has " + vowelsTotal + " vowels" );

}
}

class countVowels {
public int vowelsCounted(String myString){
int numVowels = 0;
for (int i = 0; i < myString.length(); i++) {
if (myString.charAt(i) == 'a'|| myString.charAt(i) == 'e'|| myString.charAt(i)=='i'
|| myString.charAt(i)=='o'|| myString.charAt(i) == 'u') {
numVowels++;
}
}
return numVowels;
}
}


Below is programme output
You approach to solve the problem is yucky, and doesnt follow the rule completely, return the vowels!
Language: JavaScript



function vowelCount(str){
var vowels = ["a","e","i","o","u"], count = 0, seen = "";
for(var i=0;i<str.length;i+=1){
if(vowels.indexOf(str[i])>-1){
//a vowel, increment count variable and add to seen string
count += 1;
seen += str[i];
}
}
return count + " vowels,("+seen+"wink";
}

vowelCount("this is a simple vowel test"wink; //=>8 vowels,(iiaieoee)
Programming6 Programming Exercises by Kodejuice(op): 5:25pm On Jan 13, 2016
1. String length
Language: Any Language
Determine the length of a string without using the default function provided by the programming language you're using.

FUNCTION stringLength(){
//...
}
stringLength("hello" ); //=> 5


2. Closed Parenthesis
Language: Any Language
Write a function that takes a string containing opened and closed brackets, your function should be able to determined if the brackets are well placed, if there are not then fix it and return the fixed version.

closedBracket("(2+2)" ); //=> true
closedBracket("(5+3)*2)" ); => false, ((5+3)*2)


3. Vowel count
Language: Any Language
Count the number of vowels that appear in a string and also return the counted vowels.

countVowel("sample" ); //=> 2, ae


4. argSwitch
Language: Any Language
Create a function named "argSwitch", this function will take 2 arguments and return each of the argument one after the other, when the function is called, the same argument should not be returned twice

1st call: argSwitch("me", "you" ) //=> me
2nd call: argSwitch("me", "you" ) //=> you
3rd call: argSwitch("me", "you" ); //=> me


5. Color validate
Language: JavaScript
Create a function named "isValidColor", this function would test if the string passed to it is a valid color or not.
Rule: Do not use any list of valid colors to validate.

isValidColor( "red" ); //=>true
isValidColor( "asshy" ); //=> false
isValidColor( "#f7c" ); //=> true


6. String replace
Language: Any Language
Create a function that replaces strings without the use of the default function provided by the language you're using. No RegExp support. But if you feel you're a geek, include RegExp replacing.

stringReplace("Hello world", "world", "Nairalanders"wink; //=>Hello Nairalanders


Post your solutions.
ProgrammingRe: Quadratic Equation Solving App I Developed In Python by Kodejuice: 9:48am On Nov 28, 2015
Teempakguy:
determinants . . .
Yeah, Matrices
ProgrammingLogical Math Question by Kodejuice(op): 12:57pm On Nov 21, 2015
Think you're smart?, try this


A painter charges $40 per day for himself, and he also charges $10 per day for his assistant. if he paints some cars for some couple of days and received $2000. And the painter worked 10 days more than his assistant. How much will the assistant and the painter receive ?
ProgrammingJavascript Ticchek Board Game by Kodejuice(op): 6:01am On Oct 25, 2015
ProgrammingRe: Quadratic Equation Solving App I Developed In Python by Kodejuice: 5:52am On Oct 04, 2015
Try building a simaltaneous equation solver, that should be more challenging.
ProgrammingRe: Quadratic Equation Solving App I Developed In Python by Kodejuice:
...

X1 = (-b+√b2-4ac)/2a
X2 = (-b-√b2-4ac)/2a

As easy as this, using the quadratic/almighty formula
Programming............ by Kodejuice(op):
Blah Blah Blah
ProgrammingPlease Review This Website by Kodejuice(op):
Just a link shortening website i've been working on for a couple of days now, but i'm finally done with it (99.9%) - click to visit the website


I am actually not good at designing, so pleeeeaaaase i need your feedbacks, so i can correct my mistakes, thank you
WebmastersPlease Review This Website by Kodejuice(op): 6:15pm On Sep 09, 2015
Just a link shortening website i've been working on for a couple of days now, but i'm finally done with it (99.9%) - click to visit website
ProgrammingRe: The Four Things People Can Still Do Better Than Computers by Kodejuice: 10:58pm On Jul 23, 2015
faithugo64:
come to think of it

IF THE BRAIN CREATED THE COMPUTER,THE COMPUTER CANNOT BE BETTER THAN THE BRAIN!!!
BUT IT MAY DO THINGS FASTER THAN THE BRAIN

1 2 3 4 (of 4 pages)