« first day (724 days earlier)      last day (4224 days later) » 

8:00 PM
what's a pem file?
 
Ignoring .pem from now ;-)
@NikiC private key
 
oh, private key. yeees we like public private keys :)
 
ouch.
 
@NikiC lolz
 
8:29 PM
i think i need a tea
 
0
A: PHP: How to dump/delete an array completely?

Dainis AbolsM8, read more specific what unset does, take this example: <?php $array = array( 1 => 2 ); var_dump( $array ); /* array(1) { [1]=> int(2) } */ ?> Now when we unset it: <?php unset( $array ); var_dump( $array ); /* Notice: Undefined variable: array in test.php ...

Is it acceptable to start an answer with M8? I wouldn't even start it with Mate
 
array_pop using foreach
 
how does "/" sign look like in preg match?
 
8:38 PM
@DaveRandom My bad. I meant array_pop using a for loop. Or the quickest way unset
 
:5700620 Are you looking for \/ ?
 
Ah crap. I think I wound up in hell somehow. The only thing on tv are news and twilight... sigh...
 
@UchihaObito Note that you can just use a different character as a delimiter if you need to have a literal / in the regex...
 
@UchihaObito Are you back to thank me sincerely?
 
@DaveRandom hmm, I need to search for '<title>500</title>' but when I have $pattern = '/<title>500<\/title>/'; all the results are wrong :D
 
8:41 PM
btw , looks like stackoverflow.com/questions/12769982/… has been unlocked
 
@MadaraUchiha today is new manga :D!!
 
It's still tomorrow for me
@tereško Yes, and closed, and reopened (again)
 
yeah, but it sometimes gets published today, sometimes tomorrow
 
I've burned my rov on that one
 
@UchihaObito You are committing a great sin by parsing HTML with regex. Use DOM instead.
 
8:42 PM
no , i mean UNLOCKED
 
@tereško I know,
 
because it was locked by a mod
 
Yes, I know
You're not listening
 
@DaveRandom ok, thanks
 
And since it was unlocked, it was already closed and reopened again
 
8:42 PM
oO
what the fuck
 
Who unlocked the question?
 
> Post Unlocked by Community♦ --- occurred 4 hours ago
 
if it stays open, good news :)
 
well .. we will try to keep it open , and when we run out of votes , i will try to acquire some from JS room ( i think, i should be able to get at least 5 )
 
@UchihaObito preg_match("/^<title>500</title>$/"); works for me
 
8:46 PM
I have seen many more comments on the meta discussion
 
@chx101 No it doesn't. It just doesn't.
 
@chx101 But it won't work for _<title>500</title>
 
4 hours ago, by hakre
@Gordon we unlocked the unlock achievement.
 
@chx101 " Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Unknown modifier 't' .... "
 
or <head><title>500</title></head>
etc etc etc
@UchihaObito Do me a favor
Be a Uchiha
 
8:48 PM
Are you matching global or just single ?
 
Use a DOM parser
 
@MadaraUchiha +1
 
yeah, but im just sayin...
 
Only senju n00bs use regex for HTML.
 
8 mins ago, by DaveRandom
@UchihaObito Note that you can just use a different character as a delimiter if you need to have a literal / in the regex...
 
8:50 PM
$p = new DOMDocument('1.0'); @$p->loadHTML($html);
 
@Jocelyn yes some folks couldn't stop arguing. I mean there are not that many arguments to exchange.
 
Quick question.
I never really got what the DOMDocument constructor's argument mean
I mean, sure, charset, that's fine. WTF is "version"?
 
@MadaraUchiha XML version
 
One more time
 
lol
 
8:53 PM
But that's assuming you're parsing XML
Also, shouldn't that be inferred from the XML document itself?
Much like it does with HTML doctypes?
 
@MadaraUchiha It only has any bearing if you do saveXML() or something. I think that if you load an XML file with a different version it will over ride it - but I'll admit it's a question I've never asked.
 
DOM is a great parser, but it's kind of awkward, wouldn't you say?
Like the PHP hammer
 
@MadaraUchiha well you create a new document. So you tell the XML version.
 
@hakre Why won't it infer it from the XML document itself?
It would make more sense, being an XML parser and all
 
@MadaraUchiha It does. new creates the new Document and you put the version in there as parameter so the XML document itself has a version.
 
8:57 PM
@MadaraUchiha Because it's not just a parser. You can use it to create a document from scratch as well.
 
It's not only a parser, its the DOMDocument model
 
Oh
So it has basically no use in the case of loadXML/loadHTML
 
duh!
yes
 
$title = (string) simplexml_import_dom(@DOMDocument::loadHTML($html))->xpath('//title')[0];
 
@MadaraUchiha I don't think so, interesting question though I've never tried creating a document of a version and then loading a doc of another.
 
Sem
8:58 PM
Could someone explain to me why bcrypt();is so much slower to bruteforce? I don't quite understand completely what @ircmaxell means by that in his presentation. I'm talking from the CPU perspective
 
because it does the hashing over and over again for the hashing.
I think that is called stretching
 
@Sem The hashing algorithm itself is very fast
So it is looped over and over to slow it down
 
Sem
I don't think that's it. Apparently bcrypts default loop iteration is 10 times. Which isn't that much.
 
Ghostbusters II starting in 2 minutes. Oh yes, oh yes it is.
@Sem I'm not sure cost == number of iterations in that context
(not actually sure though)
 
@Sem 10 probably means 2 ^ 10 or something like that.
depending how bcrypt does it internally. I'm not fluent with that.
 
9:03 PM
@DaveRandom for a person with full access to internet this behavior seems strange
 
4
Q: Bcrypt - How many iterations/cost?

ObtoI've read some articles saying you should set the cost to be at least 16 (216), yet others say 8 or so is fine. Is there any official standard for how high the cost should be set to?

 
Sem
Aah now I know, I was confused with what he mentioned about GPUs
 
@tereško Nothing wrong with a little background cult-awesomeness
 
Sem
@DaveRandom BTW look at my rep! I've been repwhoring on jQuery :D Now you people will know rep points on SO have no true value.. MUHAHAHAH
 
0
A: Bcrypt - How many iterations/cost?

tereškoThe cost should depend on your hardware. You should test your cost settings and aim for the 100 .. 500 ms interval. Of course, if you are working with highly sensitive information, the time could be 1000 ms or even more.

 
9:08 PM
@Sem No no they're like air miles. You can exchange them for... oh, right, f*ck all.
 
@Sem Here's a simple benchmarker
<?php
header("Content-type: text/plain");

$pass = "Mypass";

$time = microtime();

$md5 = md5($pass);

$time_to_md5 = microtime();


$stretched_md5 = md5($pass);
for ($i = 0; $i < 1000; $i++) {
    $stretched_md5 = md5($stretched_md5);
}

$time_to_stretch = microtime();

$md5_period = ($time_to_md5 - $time) * 1000000;
$stretched_period = ($time_to_stretch - $time_to_md5) * 1000000;

echo <<<EOF
Results:
--------
Pass:       $pass
MD5:        $md5
Stretched:  $stretched_md5

Time to md5:     $md5_period mcs
I get this:
Results:
--------
Pass:       Mypass
MD5:        21dcf10fbdd83246a202cda0413edbbd
Stretched:  fdc83fad889066261e706e09de9a14e5

Time to md5:     16.999999999989 mcs
Time to stretch: 2154 mcs
 
Sem
@MadaraUchiha Where's the uniquely generated salt? :P thanks though
 
This is even without a salt
A salt doesn't add to the time it takes,
it adds uniqueness to the password, which ensures that even 123456 is relatively safe (if only the database is compromised)
 
Sem
@MadaraUchiha I guess so. I was quite shocked at the brute force results.. If people that use hash + static array salt would know that people would be stressed.
 
Well, if you put the first through a 1GHz iterator, you'd get approx 5.88e13 actions hashes per second
The second, only 4.54e10
While it may still seem like a lot of hases per second, that's a 1000 times difference
It's the difference between 1 day and 3 years
@UchihaObito
In case you're interested:
 
9:27 PM
@MadaraUchiha nice :D
 
@MadaraUchiha OK it would seem that loading a document with a different version to the one passed to the constructor does get overriden to the one declared in the document - but this is currently irrelevant since it complains about loading a document with a version of 1.1. Weirdly though it doesn't complain when you pass 1.1 to the constructor.
 
I have come to conclusion that CakePHP is worse then CodeIgniter
4
 
@tereško Worse than CodeIgniter? :o
I've tried CI for about a quarter of a project when I realized just how bad it is. Never tried CakePHP though
 
mostly because in cake you are encouraged to use ActiveRecord pattern ( through the AppModel superclass ) but in CI you do it because of your own stupidity
 
Hmmm, forced stupidity, or own stupidity... That's a tough one
Well fellas
I'll be off then
good night :)
 
9:33 PM
also, there is nothing much to learn about basic XML .. unless you include all the formats that stem from XML (like SVG and XSL) .. the hardest part would be writing custom DTD
 
gnite
tomorrow is the day
 
Sem
@tereško Looks like you havent seen this question yet. stackoverflow.com/questions/5624319/… was expecting at least a 200 words answer from you.
 
it's ancient , i joined SO in April 27, 2011
 
Sem
16 days to early it seems. :(
 
you have to understand that in early 2011 i still thought that activerecord was best thing invented since day-after-pill and and RoR was the source of all good an right in the world
 
user1125394
9:46 PM
no accepted answer yet, the guy won't much care now
 
@tereško why did you think that, out of curiosity
 
mostly because first time i learned about the whole MVC pattern was in the on-site interview exercise in late 2010
 
the task was to make an "MVC application" ... i googled it .. looked at some examples and mimicked Rails as everyone else
@KeyneON it's [tag:cv-pls]
 
9:59 PM
ah i see
 
@cyril the question is badly worded. the book explains this fairly well, especially if you read the other chapters.
 
user1125394
it should have been closed so?
 
Sem
@tereško Active record and ORM are the type of anti-pattern IMO. Both become an obstacle once you want to do more exceptionary / complex things. Which beginning developers (Like me) mostly won't face that much.
I ment the same type there :)
 
10:19 PM
@cyril it is closed.
 
user1125394
@hakre was talking about the one raised by sem stackoverflow.com/questions/5624319/…
 
me too, no idea at which question I looked when I said it is closed :)
getting late I suppose.
 
user1125394
there r many questions not closed, not answered, a little dead because the question owner doesnt care now
 
Hey guys is this a good query strcuture? I need one regular and one left join.
SELECT a.Name, b.Name, c.Name WHERE a.com=b.id LEFT JOIN c ON a.id=c.com. 'a' and 'b' rows are unique, in c table, there can be more than one result row.
 
user1125394
the more joins you have, the less easy you can move to other DB
 
10:29 PM
@cyril so what do you suggest, to fragment it to two more simple queries?
 
user1125394
or to adapt your schema
 
It has angered me slightly and I'm going for a cigarette.
 
Hum, so many people smoking
 
user1125394
so bad
 
user50049
10:46 PM
Thanks for break dancing in my inbox folks :P (and the nice compliments)
 
@hakre a single connection for benchmarking server page loads times? Really?
 
@DaveRandom who said single connection? I just wrote that you can use curl to get differentiated timings.
Which actually is already better than just only picking the total time.
But you would need to call it more than once and from more than one region.
depending of what exactly you want to metric.
 
@hakre Fair enough, but I think more needs to be made of the fact that a single connection (which is what all the code samples show) simply will not cut it. The guy says his load balancer is supposed to be able to cope with 120000 concurrents :S
 
@DaveRandom lol, I just deleted my answer, should have read the question more thoroughly.
No free gems for idiots, he should take that crappy code and take the total time.
It is so no-saying because of DNS.
 
@hakre I misread it at first, probably because of the misleading title and the unbroken wall of text you kindly assisted him with. I just recommended (and I still can't believe I would recommend this to anyone for anything ever) exec()ing Apache Bench, at least that might give you something approaching some useful info.
I'm too tired for explaining things like this I think, it irritated me more than is reasonable. I'ma going to beddy bye byes
 
10:57 PM
@DaveRandom bye bye, me 2
 
that sounds like a good idea
good night everyone :)
 
11:24 PM
$var= "";
while ($var= mysql_fetch_array($categoriaSel)) {
global $var;
}
echo $var
why wont that work?
 
@Sem the idea of ORM in-and-of itself is not an antipattern
Activerecord is as are the catch-all libraries which are designed to cover every corner case and end up as monolithic blobs of code (most ORM libraries)
You should use a repository or data mapper pattern to implement the concept behind ORM fully tailored to your application
@TimPost Is idling in the PHP room a new thing for you or have I just somehow missed your presence here before?
 
user50049
@Lusitanian When I'm active on the site I tend to idle here. The last few weeks have been extremely busy for me, so I have not been around as much as usual. But I am known to be in here quite often.
 
i see
 
user50049
Lately, even when I'm not active on the site (mostly because, I work almost strictly with PHP these days, at least until the end of the year)
 
user50049
Kev and BoltClock are the other two who can frequently be found here.
 
11:38 PM
gotcha
 
user50049
But still, regarding the error list @hakre posted, I probably would have said "Dunno, try it and see how it goes, don't get upset if there's a negative reaction." if asked prior. And that's exactly what he did.
 
user50049
I was just hoping the community would have taken the idea and intent and ran with it a bit more, rather than just shooting it down completely.
 
commonerrors.stackoverflow.com
phpfaq.stackoverflow.com
 

« first day (724 days earlier)      last day (4224 days later) »