« first day (1035 days earlier)      last day (3910 days later) » 

user895378
4:00 PM
You're right. Case-by-case basis. 90% of the time is probably about right.
 
Yesterday I wrote a class that I named OneRegexToRuleThemAllRouter. Based solely from the name, can anyone tell me what it does?
 
@LeviMorrison overrides existing routes; or acts as a fallback?
(I had to hedge my bet)
 
(Guessing twice with one guess; cheater :)
 
Well, was I right?
 
4:05 PM
@Bracketworks No. >.<
Guess the name isn't good enough to keep.
That means I'll have to change the method forgeTheOneRegex as well :(
 
A router that takes a single regex and delegates to sub-routes? I dunno, I'm probably overcomplicating it.
 
It uses one regular expression for ALL routes. You don't provide that regex; it will build it for you.
 
It's actually really fast but the code is a horrible abomination. Okay, it's not that bad but it's nasty.
 
@LeviMorrison So... how does it match all routes?
$router->match('/.*/')->dealWithIt()?
 
4:07 PM
No.
 
Give meh teh codez pls.
 
Here's a test method to help you understand what's going on:
function testMultipleRules() {
    $method = 'GET';
    $routeA = '/resource/1234';
    $ruleA =  '/resource/$#id';
    $routeB = '/resource/abcdef';
    $ruleB =  '/resource/$param';
    $resultA = ['id' => '1234'];
    $resultB = ['param' => 'abcdef'];
    $handler = [__CLASS__, 'handler'];

    $router = $this->makeRouter();
    $router->addRoute($method, $ruleA, $handler);
    $router->addRoute($method, $ruleB, $handler);

    $result = $router->matchRoute($method, $routeA);
    $this->assertEquals($router::MATCHED, $result[0]);
 
Are $param and $#id replaced in some expression builder? Nevermind, I'm reading backwards.
 
user895378
4:10 PM
Tim Berners-Lee is an idiot has made many people's lives more difficult. Correctly determining a request host is so idiotically complex and nested if you follow RFC 2616.
 
Hey, the man screwed up on some stuff, doesn't mean he's an idiot.
 
Yea, don't talk about Grandpa like that!
 
:)
$param would be (effectively) replaced with (?P<param>[^/]+).
$#id would be (effectively) replaced with (?P<id>\d+).
 
and $#id with (?<id>[0-9]+) ?
Oh yea, shorthands. :-)
 
That's not quite what happens because of some issues you have to work around, but that's the idea.
 
4:13 PM
Any reason you use the ?P<> notation?
 
user895378
Probably blame me for that -- I suggested it.
 
Because that's the original Perl notation?
 
Is it? Didn't know; I omit the P
 
It might not be the original notation, now that I think of it. However, it was the first notation PHP supported.
 
user895378
I've always used ?P<> just because I've always used it and not the shorthand.
 
4:14 PM
I'd hardly call omitting the letter P a shorthand :-P
 
user895378
PHP: Because one way to do something is never enough.
 
^^^ And that's the crux of my issue with conventions!
 
Haha!!! I have my first gold badge!
 
@MaciejCzyżewski grats
 
Blarglemuffins. I'm going to smoke.
 
4:17 PM
@Bracketworks For reference, if you do that direct mapping and you have multiple rules with the same parameter name you get this:
> Warning: preg_match(): Compilation failed: two named subpatterns have the same name at offset %d in %s on line %d
 
@rdlowrey in this case, blame Python and Perl via PCRE :P
 
Whats navicat like?
 
@I'll-Be-Back It's like a SQL program
 
Yea just seen a screenshot...
phpmyadmin is enough for me :)
 
As long as it's the old theme
 
4:21 PM
I kinda like new theme
and ajax support
 
Am I just being a moron or is it not possible to create issues on forked projects on Github?
 
AJAX support has some nifty features
 
@Danack depends if the forked-repo owner has turned on issues, or not.
 
Otherwise I don't like a lot of it. The modal overlay isn't for me.
 
@salathe Thanks.
 
4:26 PM
@I'll-Be-Back I use Navicat
 
cool
@SweetieBelle What todo planning do you use?
 
@I'll-Be-Back I use trac
For personal planning Conqu on my Blackberry
 
user895378
Has anyone ever actually sent Trailer headers after sending a chunked HTTP request body?
 
I need to check trac out.
 
@rdlowrey Probably nobody knowingly >.<
 
4:38 PM
I hate negating the result of expressions so much, that I'm using continue.
foreach ($things as $thing) {
    if ($thing->isOk()) {
        continue;
    }
    return false;
}
return true;
 
or you can do this
`foreach ($things as $thing) {
if (!$thing->isOk()) {
return false;
}

}
return true;`
 
4 mins ago, by Bracketworks
I hate negating the result of expressions so much, that I'm using continue.
Actually, array_reduce works nicely for any() and all() behaviors.
 
5:06 PM
When applying an all predicate against a collection, what should the result be for an empty collection; I'm thinking false.
"All of this empty basket of apples are red".
 
@Bracketworks No - an empty collection should return an empty collection - i.e. an array.
So the code that calls it doesn't have to check what was returned, unless it wants to.
 
I'm with @Danack on this one. If a method returns a collection it should always return one, even if it is empty
 
No, I mean a boolean predicate; "Are all of these apples red?" => pick up and examine each apple until a green one or none are left
 
$apples = $appleBucket->getApples();
foreach ($apples as $apple){ $apple->polish();}

Rather than having to have a test for false every time you get it.
oh
misread you.
 
S'alright
If there are no apples to begin with; it's indeterminate, but returning null doesn't seem appropriate here either.
That's why I'm just thinking false; which I can achieve by and'ing a count()
 
5:18 PM
@LeviMorrison well .. I opened 3 projects from that list. One was stellar example in how to break object's encapsulation and two other we static functions wrapped in several classes.
I don't think i can find enough strength of will top open 4th link from that site
Oh well .. let's make one more attempt. Maybe that mongoDB abstraction will not suck
 
@Danack @cspray 3v4l.org/VWmfX
I dunno why I (bool) cast; explicitness I guess.
 
@Bracketworks I think as long as you keep your predicates as positive then yes, returning false for empty sets is correct. e.g. any_red is false, but any_not_red is urrrgggh...
 
Anonymous
conspiracy nuts - no more
 
Anonymous
It seems Area51 is real
 
@Danack Ok, so it makes logical sense to incorporate the boolean result of the collection count into the evaluation (first especially to short-circuit)
 
5:23 PM
.. oh well ... it's not as bad as 3 others , but still sprinkled with static calls and ugly wrappers
 
So any([]) and all([]) should be false.
 
@Bracketworks Probably. I'd advise asking cleverer people e.g. Ocramius who has probably encountered the same coding in Doctrine.
 
A vacuous truth is a truth that is devoid of content because it asserts something about all members of a class that is empty or because it says “If A then B” when in fact A is inherently false. For example, the statement “all cell phones in the room are turned off” may be true simply because there are no cell phones in the room. In this case, the statement “all cell phones in the room are turned on” would also be true, and vacuously so, as would the conjunction of the two: “all cell phones in the room are turned on and turned off”. More formally, a relatively well-defi...
I guess I have some reading to do. As well, I'm wrong. lol..
vacuousAll($array) has a certain ring to it.
 
@HamZa The accepted answer is pretty funny.
 
5:36 PM
@Bracketworks yeah and the comment below it lol
@HamZa, it's against the TOS to post a comment about a question being off topic because it's like a gangster formation, trying to cause a landslide in the minds of others. — Terminal 33 secs ago
 
@HamZa policing trolls since 2012.
 
@Bracketworks lol that guy is crazy
 
@HamZa Yea, he's a bit of a nut.
 
5:47 PM
Why do people get drunk and use Stack Overflow?
 
Dunno, but a lot of regulars seem to do it.
 
Hmm, true. Rephrased, why do alot of irregulars get drunk and troll Stack Overflow?
 
@Bracketworks Heh, I bet Schrödinger can make a cell phone be on and off at the same time!
 
@Bracketworks I do this so I can actually put up with looking at the PHP tag
 
@tereško It's been a little while. How's the MongoDB abstraction looking?
 
5:49 PM
@Gordon Haha, ba-zing!
I haven't read the article fully, however it appears that indeterminable is true.
 
Thank you, @tereško, once again for the @dataProvider tip. It's quite nice.
 
@LeviMorrison i would give it 7/10, with a strong hint of underlaying ugliness. I only skipped over it quickly.
 
@cspray I just don't look anymore.
 
@Bracketworks I've tried to do that. It is like a horrible train wreck; I can't help but look every now and then
 
Then again, it's about 2+ levels of skill above the other 3 libs that I looked at from that list
 
5:52 PM
@cspray Y U WASTING THEIR TIME
cspray, don't waste our time please. we are learning here. — Aneed Hamas 3 mins ago
 
@HamZa :P
I'm pretty sure they're starting to downvote all my stuff too
 
@LeviMorrison where "level" would be 3-6 month of studies - the point at which your older code, that you wrote, starts look like crime against humanity
 
@tereško I've been an employed coder for 5 years now and all of my code looks like that, even the stuff I wrote 3 months ago.
>.<
Well, maybe not "crime against humanity" but gives me a nasty feeling.
 
which means that you either are good at learning stuff .. or your project manager is a retard, who never gives enough time
 
@cspray yeah ...
 
5:56 PM
@tereško I'm hoping it's the former as I am my project manager. If it's the latter that's really bad news.
 
@HamZa Oh well, I'm not here necessarily to make friends with people who try to rep whore answering dupe questions
 
@cspray How do you think I got close voting privileges? I AM NOT ASHAMED! :)
 
@LeviMorrison :P Clearly you just weren't caught enough!
It isn't that bad really...
I just don't get answers where the very first thing they say is "I know this is a duplicate but..."
 
By the way, has anyone else got their pay-cheques yet?
 
I also get a kick out of them calling me a child for using the features of the site then they go and revenge downvote my questions
That's pretty amusing too
 
6:09 PM
@LeviMorrison it doesn't sound as you are believing your own lies there
read this: amazon.com/dp/0201835959 .. that should help a bit
 
6:24 PM
Hi @HamZa
 
@MaciejCzyżewski hello there
 
@HamZa I have my first gold badge :-D
 
@MaciejCzyżewski nice, keep it up :)
 
@HamZa Thx :-D
 
Hey guys
I'm sorry for being annoying lately but I got error with my pdo
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$user = "username";
$pass = "password";
if(isset($_POST['register'])){
    try {
        $conn = new PDO('mysql:host=localhost;dbname=database', $username, $password, 'database');
        $sql = "SELECT * FROM users WHERE username = :username AND email = :email AND password = :password LIMIT 1"
        $sth = $con->prepare( $sql );
        $sth->bindParam(':username', $username, PDO::PARAM_INT)
        $sth->bindParam(':email', $email, PDO::PARAM_INT)
does any one regonize the error?
 
6:31 PM
@Yotam You didn't post the error message
 
I forgot to add that the page doesn't even running because the PHP (HTML is fine)
 
@Yotam Why in the world would a username or email be an integer?
 
you are not hashing the passwords .. i would call it a MAJOR bug, @Yotam
 
E_I_DONT_KNOW
 
lol
 
6:32 PM
What should i use for email and username?
 
also, PDO::PARAM_INT is for integers
 
and why hash is a bug?
should i use PARAM_STR?
 
Sorry i'm new :)
at this subject
 
is this first time you have tried to learn anything ?
 
6:34 PM
Lol, I've learn almost all web client-side languages
the popular only ofcourse
 
then how exactly can you be "new at learning" ?
 
"subject"
not learning
When i said subject i meant SQL
So what should i use instead PARAM_INT?
 
$username = $_POST['username'];
$password = $_POST['password'];
$user = "username";
$pass = "password";
 
^^ that's going to confuse you at some point; and the results will be pretty bad.
 
6:38 PM
@tereško Thanks, i'll check that out.
 
Could someone help me identify the syntax error in my SQL query?
 
> Discussion for all things PHP SQL - Don't ask whether someone is here to help you. If someone is around and wants to help they will.
 
@nnash it's in the line 4, just after WHERE statement
 
$SQLString = "INSERT INTO event_system(user_id, title, date_time, location, activity, participants, description) VALUES ($uid, '$title', $time, '$location', $activity, $participants, '$description')";
 
6:40 PM
$uid = mysql_query("SELECT user_id FROM user_system");
$title = mysql_real_escape_string($_POST['title']);
$time = $_POST['time'];
$location = mysql_real_escape_string($_POST['location']);
$activity = $_POST['activity'];
$participants = $_POST['participants'];
$description = mysql_real_escape_string($_POST['description']);
 
Why are you ... what?
 
Somebody might need to get @tereško some aspirin and a bandage...
I could only imagine the amount of going on right now
 
He may defenestrate himself.
 
@Bracketworks lol
lol
 
@nnash Seriously; why are you only escaping some of the inputs?
 
6:41 PM
because only some are varchar
rest are select input
 
That doesn't matter
 
...
Ok, somebody needs to bring me some aspirin and a bandage
 
Just because it's not varchar doesn't mean someone won't spoof your form and submit evil code anyway
Select boxes can still be easily manipulated to inject bad code
Everything going into your database from the user should be escaped regardless of datatype or origin
 
Also, your $uid is likely a boolean or a resource
 
it shows up as Resource id #2
or whatever when i echo it
 
6:43 PM
Well, there's one thing right there. How do you intend to insert a resource into a database field?
 
That means that it's a resource, and you can't insert a resource into a database
 
not really sure how to approach that part tbh this is my first mysql project
i assumed you could just reference it as a variable
 
Even if you did retrieve the results of the query
Your SQL statement would return all user IDs
Chances are you want a specific user and not just all of them
 
the user that submitted the form
 
I've fixed the code, changed PARAM_STR instead INT and it working, but the command still not excute (I mean he doesn't show me the details of registration)
 
6:46 PM
And how does your query indicate that? Your SQL statement is plainly saying "give me all the user_id from user_system"
 
Screw multi-part files, I send stream handles via POST.
 
Then there's the lack of checking if any of the $_POST indexes are set, the SQL injection, not wrapping quotes around some things and the use of an outdated, deprecated extension to work with MySQL
 
CREATE TABLE users(
    username VARCHAR(30),
    email VARCHAR(30),
    password CHAR(41),
    date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
)
Here is my database
 
CHAR(41)!?
WTF results in a 41 byte string?
 
@Bracketworks What those CHAR, VARCHAR keyword? I would like to see the list so I know how it works
I got that from open source (not the code, the database)
 
Can I get any help about this one? I'm pixel away from the solution :)
 
@yotam padding-left:1px should get you there?
2
 
posted on August 16, 2013

The PHP development team announces the immediate availability of PHP 5.5.2. About 20 bugs were fixed, including security issue in OpenSSL module (CVE-2013-4248). All users of PHP are encouraged to upgrade to this release. For source downloads of PHP 5.5.2 please visit our downloads page, Windows binaries can be found on windows.php.net/download/. The l

 
BTW, I've changed 41 to 30 (I notice they are called predefined constants and google it)
 
@Orangepill lol
 
6:55 PM
@Orangepill margin rulez!
 
@Yotam No it doesn't; unaffected by box-sizing: border-box
 
Is there anything i missing in my code?
Some one help, I'm a bit in a rush here..
 
 
@Yotam In your example you have no code to fetch the results of your query
 
I just took out three fish :)
 
7:00 PM
@cspray I'll try that.
 
@hakre Sew them together and submit it as a patch for 5.5.3
 
Is there a way I can mimick imgur's image ID system? I think letters are a lot more friendly than numbers. For example they'll uniquely name a image ZhoOAUl.png? Maybe have a letter stand for each digit in a number ID?
 
@cspray I was trying this code below excute and it failed.
print("PDO::FETCH_ASSOC: ");
        $result = $sth->fetch(PDO::FETCH_ASSOC);
        print_r($result);
        print("\n");
I mean it doesn't give me the needed details to database
 
do you know why password should be hashed ?
 
7:05 PM
Not really..
 
then start by learning about that
 
Lol, right now I'm 1 day freshment in MySQL
All i'm trying to do is get a working regstration code to work
 
Thomas Pornin on November 01, 2011

How passwords should be hashed before storage or usage is a very common question, always triggering passionate debate. There is a simple and comprehensive answer (use bcrypt, but PBKDF2 is not bad either) which is not the end of the question since theoretically better solutions have been proposed and will be worth considering once they have withstood the test of time (i.e. “5 to 10 years in the field, and not broken yet”).

The less commonly asked question is:

why should a password be hashed? …

 
@Yotam Unfortunately, if you A) don't want it to be a mess, B) want it to be secure, C) want it to work, D) any or all of the above, "All I'm trying to do" isn't quite the right way to phrase that.
 
@Yotam in that case you are a week too early to write any functionality for registration
it require at least basic understanding of SQL
currently you have almost none ... and i suspect you are quite aware of that
 
7:11 PM
@tereško All I need is that code fixed, the rest I'll figure out alone.
 
@Yotam It doesn't work that way.
 
that's not how this chat room works
 
@tereško I didn't even mean chat; I meant coding.
 
you show us what you are currently doing, and we will poke and prod and kick you in the direction in which you have to learn .. while you are kickin'n'screamin all the way
 
I'm mostly learning from open sources and stuff like that, in the time I watching and research about this language I getting advanced.
 
7:13 PM
that might be a quite bad idea .. since most well known opensouce project in php is wordpress
it also happens to be famous for how extremely horrible it is
 
I going more for the simplest code in the net
 
don't
seriously
 
Why not? I've learned this way php
I've success with XML system using php
the xml is database
but since xml is unscure
I wanna learn mysql, so i get higher security level.
 
XML isn't any less secure than SQL databases.
 
Ofcourse it is..
You can easly break in to my files on my ftp
 
7:16 PM
if you put your XML file outside DOCUMENT_ROOT it will be as secure as the rest of your environment is
 
and take all the passwords
 
@Yotam No I can't. If you hashed them.
 
No, it isn't. Simply using MySQL doesn't magically get you a "higher security level"
 
@Yotam if i can break into your files, i can also see your mysql connection details
 
@tereško ...which could be worse, because if you've reused any credentials across disparate systems, I can probably engineer entry to something else.
 
7:18 PM
posted on August 15, 2013 by PHP: Hypertext Preprocessor

The PHP development team announces the immediate availability of PHP 5.5.2. About 20 bugs were fixed, including security issue in OpenSSL module (CVE-2013-4248). All users of PHP are encouraged to upgrade to this release.For source downloads of PHP 5.5.2 please visit our downloads page, Windows binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.

 
I didn't knew that XML can be secure, all this time people said its insecure
 
who did ?
 
@Yotam XML sitting in a publicly accessible folder? Yes, that's insecure. So are MySQL dumps and credentials sitting in a public accessible folder.
 
IDK people who understand coding (not neccessary in this comunity)
 
@Yotam Without more context, it sounds like those people don't understand coding.
 
7:19 PM
@Yotam One could argue that perhaps they don't understand coding as much as they think they do
 
well .. if they said "xml is less secure then mysql" then they do not understand coding ... or computers in general
 
@cspray Beat ya to it ;-)
 
@Bracketworks Yea...well, mine is longer so...ppbbfffttt
 
So I've used xml files as member files and use simple xml element
does it count as insecure or secure?
 
@Yotam where is that XML file located
 
7:20 PM
folder called users.
 
@Bracketworks the three headed fish?
 
@hakre Yessir ;-)
 
fuck XML
 
where is the folder users/ located ?
 
Oh Sir, thank you for your feedback sir!
 
7:21 PM
users/file.xml etc..
 
Where is sir @webarto?
 
@hakre Don't worry, I had a doubt too.
 
I've use htaccess with deny all if it matters
 
@Yotam do you know what document_root is ?
 
I know what <root> and <clomuns> tags does
so it basically the same
 
7:22 PM
google it
 
this is where the other parts went into. can't wait when it's ready.
 
if you place your XML file outside document_root, the people will not be able to directly access it , but your php code will still be able to read it
problem with this approach is that on cheap hostings you usually cannot put anything outside document_root
 
I think XML is more secure cuz there is no XML injunction :D
 
@Sparrow lol, you something still needs to escape stuff ;-)
 
sadly, that's actually a valid point
 
7:24 PM
@PeeHaa what do you mean by that documentation platform?
To create documentation files?
@Sparrow there is XML as well as XPath injection.
 
@tereško Now I got it.
 
and XQuery injection.
 
But I still think mysql is better..
The biggest websites are built in them.
 
@Yotam No, no they're not.
 
@Bracketworks What databases use facebook?
 
7:26 PM
@Bracketworks all the summer I was learning sql injection
 
facebook use PDO most likely.
 
You see..
 
PDO is not a database
 
As i said, MySQL
 
@I'll-Be-Back I'd guess mysqli actually if they use MySQL as their database.
 
7:27 PM
@hakre what is XPath injection :O
 
It PHP Data Objects.
 
MySQL
 
but it part of MySQL
 
Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers robust support for clusters spanning multiple datacenters, with asynchronous masterless replication allowing low latency operations for all clients. Cassandra also places a high value on performance. University of Toronto researchers studying NoSQL systems concluded that "In terms of scalability, there is a clear winner throughout our experiments. Cassandra achieves t...
 
@Orangepill Yotam was saying if facebook using mysql old function.
I said most likely using PDO.
 
7:28 PM
and currently they are using : en.wikipedia.org/wiki/HBase
 
@Yotam PDO is not part of anything -_-
 
@Sparrow Its way to use mysql, that what I meant
 
Facebook, I'm sure, like most other enterprise level environments, doesn't put all their data persistence eggs in one basket; for a number of reasons. The one that stands out to me is, intent. MySQL can't be used for everything, because not all data is the same relational.
 
@Yotam mysql is an old way and not mostly used now days , today we use mysqli or PDO , PDO is the best
 
@Sparrow Who said i use mysql? I'm using PDO.
If you scroll up you will see my code
 
7:32 PM
@Sparrow isn't PDO part of PHP5.4 itself? it's more like an interface between PHP and the DB? or am not making sense again? lol
 
i will now crawl away and cry a bit
 
Yotam is like the biggest troll hahaha :)
 
@reikyoushin yeah I meant not part of mysql method
 
@DaveChen you are charm too..
 
Oh, for fuck's sake: there is MySQL the database, and mysql_* the extension. mysql_* the extension is an API to interact with MySQL the database. PDO is another API to interact with MySQL the database, along with several others.
 
7:34 PM
PDO is a database abstraction layer... theorically if you use PDO and the standard SQL you can switch between database by changing nothing but the connection string.
 
@Yotam so you relized that it is defferant than mysql
 
Hello
 
@Orangepill yeah.. its a connector.. XP
 
@Sparrow I didn't say they are the same. -.-
 
@Yotam programmers hear like to troll new programmers so do not care :D
are you using OOP @Yotam
 
7:36 PM
@Sparrow Notice that :)
o_OP?
Wait don't tell me! I google!
 
I'm trying to allow accent characters into #hashtags, however I haven't managed to make it working, this is what I tried: preg_match_all('/(^|[^a-z0-9_])#([a-z0-9_]+)/ui', $message, $matches); anyone have any clue what I could try?
 
Object-oriented_programming
right?
 
@Yotam yes
PDO is part of it 8|
 
So has C, C++ Java Python etc.
 
C does not have OOP
 
7:39 PM
I can't take this anymore.
 
Meant C#
 
@Bracketworks what is it
 
I think he means visual C xD
 
@DaveChen I mean invisable you.
 
@Bracketworks Me and you both. See you guys later
 
7:47 PM
now i am wondering.. when do i use a relational vs a non relational db.. (research mode)
@Yotam both C++ and C# are OOP.. it's just that C# looks more like VB.. (has UI)
 
@reikyoushin I read it in wikipedia
 
I will learn C# soon and I will chat about it
 
@reikyoushin Hu? Oo
 
-5
Q: IF GOD HAD A SEXY DONKEY, WOULD HE NAME IT "PHP" OR "PYTHON"?

TerminalIt should be considered Trolling when a comment is posted to label a question as off topic. it is an attempt to cause a "chain reaction" within the minds of others. it does not matter if the comment is automatic, people do not know this. label it "automatic" next to the comment. otherwise...

lmao
 

« first day (1035 days earlier)      last day (3910 days later) »