" // Lop threw each row in array aprint out a list and
// print out a list of the usernames "
lots and lots and lots and shittons of spelling and grammar errors.
but the code is beatifull so you got that going for you. i gues that's nice.
(Mar 7, 2015 01:37 PM)Sommmen Wrote: " // Lop threw each row in array aprint out a list and
// print out a list of the usernames "
lots and lots and lots and shittons of spelling and grammar errors.
but the code is beatifull so you got that going for you. i gues that's nice.
Thanks for pointing that out. I'll be sure to go back and fix grammar.
I like the concept not the execution. Next time you do systems programming use a language like C
The point of this was to make it more portable. Doing this in c would defeat the purpose.
(Mar 7, 2015 01:37 PM)Sommmen Wrote: " // Lop threw each row in array aprint out a list and
// print out a list of the usernames "
lots and lots and lots and shittons of spelling and grammar errors.
but the code is beatifull so you got that going for you. i gues that's nice.
Tbh the code is far from beautiful.
Code protected function parse_function( $string ) {
$jar = explode('(', $string);
$function = $jar[0];$args = trim(str_replace($function, '', $string), '()').', NULL';
$arg_list = array();$in_quotes = array(false, '');$buff = '';
foreach(str_split($args) as $char) {
if($in_quotes[0]) {
if($char !== $in_quotes[1]) {
$buff .= $char;
} else {
$arg_list[] = $buff;
$buff = '';
$in_quotes = array(false, '');
}
} elseif($char === '\'' || $char === '"') {
$in_quotes[0] = true;
$in_quotes[1] = $char;
} elseif($char !== ',') {
if($char !== ' ') {
$buff .= $char;
} else {
if($buff !== '' && str_replace(' ', '', $buff) !== '') {
if($buff == 'true') {
$arg_list[] = true;
} elseif($buff == 'false') {
$arg_list[] = false;
} elseif($buff == 'null') {
$arg_list[] = null;
} else {
$arg_list[] = (int) $buff;
}
$buff = '';
}
}
}
}
if($buff !== '') {
$arg_list[] = $buff;
}
return array($function, $arg_list);
Is only one example of many. Functions are too long, their complexity are too high, naming conventions are bad..
(Mar 30, 2015 08:48 AM)Ego Inc Wrote: The point of this was to make it more portable. Doing this in c would defeat the purpose.
See, this is were you're wrong. Doing it in C won't only be way faster, but way more portable too. PHP often doesn't come pre-installed in distros, whereas clang or gcc do.[/code]
(Mar 30, 2015 04:06 PM)ManDoR Wrote: Tbh the code is far from beautiful.
Code protected function parse_function( $string ) {
$jar = explode('(', $string);
$function = $jar[0];$args = trim(str_replace($function, '', $string), '()').', NULL';
$arg_list = array();$in_quotes = array(false, '');$buff = '';
foreach(str_split($args) as $char) {
if($in_quotes[0]) {
if($char !== $in_quotes[1]) {
$buff .= $char;
} else {
$arg_list[] = $buff;
$buff = '';
$in_quotes = array(false, '');
}
} elseif($char === '\'' || $char === '"') {
$in_quotes[0] = true;
$in_quotes[1] = $char;
} elseif($char !== ',') {
if($char !== ' ') {
$buff .= $char;
} else {
if($buff !== '' && str_replace(' ', '', $buff) !== '') {
if($buff == 'true') {
$arg_list[] = true;
} elseif($buff == 'false') {
$arg_list[] = false;
} elseif($buff == 'null') {
$arg_list[] = null;
} else {
$arg_list[] = (int) $buff;
}
$buff = '';
}
}
}
}
if($buff !== '') {
$arg_list[] = $buff;
}
return array($function, $arg_list);
Is only one example of many. Functions are too long, their complexity are too high, naming conventions are bad..
See, this is were you're wrong. Doing it in C won't only be way faster, but way more portable too. PHP often doesn't come pre-installed in distros, whereas clang or gcc do.[/code] Well if you have any suggestions on how to better write the code I am open to criticism. And by portable I mean you can just copy the web files and your good to go as apposed to having to worry about transferring the db as well.
Use more methods and objects. Restructure your whole project.
You're currently trying to decrease the number of files needed by your project, which really is nonsense. It prevents people from trying to understand your code and therefore contributing to it.
I also highly suggest you to initialise a composer project for this. It'll make your "database system" even easier to install.
Oh, and don't forget to unit test too. It is really important to have them with this type of project.
(Apr 1, 2015 12:18 PM)ManDoR Wrote: Use more methods and objects. Restructure your whole project.
You're currently trying to decrease the number of files needed by your project, which really is nonsense. It prevents people from trying to understand your code and therefore contributing to it.
I also highly suggest you to initialise a composer project for this. It'll make your "database system" even easier to install.
Oh, and don't forget to unit test too. It is really important to have them with this type of project.
Thanks for the advice, I'll see what I can do.
PHP Code
<?php return ($this->auth)?true:false;
ey?
Not sure what the point in password protecting it is anyway since you're just storing the password in the same unencrypted file, it's not needed at all. Just encrypt the file with AES or whatever with the password.
DO NOT DEAL WITH THIS MEMBER
Could I make a DB Lookup tool with this/
And with it still being fast?
got 60 gigabytes of database.
(May 6, 2015 06:16 PM)SIM-2223238 Wrote: Could I make a DB Lookup tool with this/
And with it still being fast?
got 60 gigabytes of database.
Yes. I actually use it for a dblookup service I run (100GB+) http://dbspy.in/
|