« first day (799 days earlier)      last day (4152 days later) » 

user1125394
5:00 PM
 
Anonymous
@Jack can you check out the link and tell me if you think, it is ** is one of the most retarded things ** you have read today
 
Anonymous
@tereško I don't care what the f*** you think, or die(); is a good example to let others know what exception are.
 
That comes nothing close to being one of the worst things I've seen this week. It's bad code, but man, someone here doesn't hang out in the tag when the copy and paste wannabe devs from a certain asian country are at work...
@TheCOMPLETEPHPNewbie No, it isn't. or die is never appropriate. never. Never ever.
Ever.
 
@Baba ^^ I don't think regular expressions are a good idea in that case though. Simply because it's not really clear when something is part of a word and when it isn't.
 
5:03 PM
@TheCOMPLETEPHPNewbie That's not correct; die() is like a ChuckNorrisException() ... and the latter doesn't exist.
 
@NikiC .. i know its not a good idea
 
@Jack been reading that java Q?
 
@NikiC Yeah, the comment about not being able to throw a ChuckNorrisException was epic!
 
btw, an exception based die implementation would have been cool. For testing redirects and stuff
 
Anonymous
@Charles I don't know. But, I tried to give explanation telling the user it was A BIT like the using die(),
 
Anonymous
5:05 PM
And Rasputin comes in and starts downvoting, apparently for a hateful reason
 
honestly guys, I think @TheCOMPLETEPHPNewbie is right
 
Anonymous
^^ YAY
 
In the sense that the die(mysql_error()) and the exception have the same function here, namely error handling
 
user1125394
but catch the death
 
Except that die() doesn't handle the error. It's just a glorified echo and exit()
 
5:06 PM
Awesome post on coroutines @NikiC!!!
 
Exceptions are just a superior, generalized, more flexible way to handle them
@ircmaxell thanks
@ircmaxell Btw, I find it funny how people always calls you ircmaxwell (like here: reddit.com/r/PHP/comments/15ahfc/…)
 
Anonymous
The way I imagined it was
`try{}` or` catch exception`
` mysql_connect` or die`

The logic is somewhat the same
I hope I was a BIT right, like I said. @NikiC
 
@ircmaxell What does maxell actually mean? I guess irc is irc, right?
 
@TheCOMPLETEPHPNewbie if you really don't care what i think, why have you been whining about to for past 20 minutes ?
 
the logic is nowhere near the same unless there's a die or exit in your exception handler, which is moronic
 
Anonymous
5:08 PM
 
lol I think @tereško has you there @TheCOMPLETEPHPNewbie :)
 
@Charles For connection failures that is not moronic at all, I'd say
 
Anonymous
I never meant die() as in exit.
 
Or query failures of other kind
 
what else the die() is then ?
 
5:09 PM
I think that's one of the situations where you would plausibly not try to run anything else and just print an error page ;)
 
@TheCOMPLETEPHPNewbie die() and exit() is synonymous.
 
> die — Equivalent to exit
 
@NikiC There are better ways to give the user an error message than through a die. Much better ways.
 
Anonymous
Check the image. I was not telling the user that exptions are a bit like die() I was telling him, it was a bit like die(mysql_error()) can't you read before downvoting for once @tereško
 
Anonymous
@vascowhite I was wining (according to him) because, he downvoted my answer.
 
5:10 PM
die(whatever) is still die().
 
@Charles yeah sure. the point is that you get a full request abort
 
@TheCOMPLETEPHPNewbie Down votes aren't such a big deal. They're a fact of life for anybody active on SO. You can't please all of the people all of the time.
 
@NikiC you can still use php-cgi to test redirects, exit, and such.
 
die = exit from OPCodes point of view
I can see any difference
Script use to generate the code 3v4l.org/jDfaO/vld#tabs
 
@igorw I can. I would still find it "cleaner" if die used an exception ;) Like in cooler languages like python :)
 
5:14 PM
@TheCOMPLETEPHPNewbie i read it , but i assumed that mentioning harmful link to Nettuts, wrong PDO instantiation, complete nonsense about "calling $conn when ever your do you queries", fact that or die() is NOT a part of sql connection, or that your "answer" did not answer the question, would have been pointless
 
@NikiC python has exit exceptions? that's kinda neat.
 
@igorw It also has interrupt exceptions
 
like.
 
i.e. if you get a user interrupt you can actually catch it
python is generally cool :)
 
Anonymous
@Jack but still catch(){} isn't even a bit similar to or die(mysql_error()) ?
 
5:17 PM
btw, is it possible to handle interrupts on windows? AFAIK you need pcntl for that on PHP, which is *nix only.
 
but then they invented python 3 :/
 
@NikiC It's a long story...
 
user895378
@igorw No, it's not possible.
 
user1125394
jabbermaxell sounded not good..
 
user1125394
5:32 PM
, commonly known as Maxell, is a Japanese company which manufactures consumer electronics. The company's notable products are batteries -- the company's name is a contraction of "maximum capacity dry cell" -- and recording media, including audio cassettes and blank VHS tapes, and recordable optical discs like CD-R/RW and DVD±RW. Additionally, the company sells electronics and several kinds of accessories, ranging from CD and DVD laser cleaners to storage boxes. On March 4, 2008, Maxell announced that it would no longer manufacture its optical media, but would start contracting other com...
 
@cyril Please explain to @NikiC what VHS and audio cassettes are ;)
 
user895378
I feel like a google commercial. I just did a google video chat with my mom, picked out the exact product on bestbuy.com for a gift to give my dad, googled the phone number for her local Best Buy retail store, google voice dialed the location, purchased the gift, and asked them to bring it to the front. My mother was able to pick it up right away ... and my Christmas shopping is complete. Winner.
 
user1125394
 
user1125394
@PeeHaa don't know but they sell recent stuff also ^
 
user895378
9 hours ago, by Charles
It won't stop me from thinking that PHP template languages are idiotic.
 
user895378
5:37 PM
^ That's because PHP template languages are idiotic.
 
user1125394
 
user1125394
wow what's that revolutioanary 80GB storage? :P
 
@cyril They still sell those
 
@rdlowrey does manually escaping your vars make you feel tough?
 
user895378
@igorw No, but you don't need Twig (or any other template language) to auto escape output.
 
5:42 PM
:6846642 Because you never increment the counter used in the loop
 
We are not going to start a template flame war now, are we?
 
:)
 
Urge to destroy world rising.
 
@UchihaObito try for($i=0;$i<=$allr;$i++){
 
8 mintes into the video, I have a fully working brainfuck executor, and start refactoring
 
5:45 PM
@rdlowrey do you have an example of your approach to that somewhere?
@ircmaxell looking forward to that. :)
 
My guess is the video will wind up being 12 to 15 minutes long
 
user895378
@igorw My "View" classes only accept assignment of scalars, objects with __toString() or Traversable/arrays for template variables. IMHO, templates shouldn't contain any logic that isn't iteration or a very strict set of display-only logic. If you do that, it's trivial to have the templating "view" class apply proper contextual escaping based on JS or HTML contexts when the assigned vars are output.
 
user895378
If you're working in an environment where unskilled devs are writing the templates, of course, something like Twig can be helpful.
 
user895378
I would argue that having unskilled persons is an organizational issue, not a PHP issue, though.
 
whats wrong here pls SELECT * from ( select distinct f2 FROM TableName )
 
user895378
5:51 PM
And I certainly wouldn't let a "designer" anywhere near anything that isn't HTML.
 
i get this error
Every derived table must have its own alias: SELECT * from ( select distinct f2 FROM TableName )
 
@rdlowrey I would like to see an implementation of that.
 
@rdlowrey I'm also a bit scared when designers are near HTML tbh
 
user895378
@igorw I'll try to put something together into a gist in the next couple of days to demonstrate. If I forget, please try to remind me ... because I might forget :)
 
@goodmood "Every derived table has to have it's own alias" means you have to give the "table" you created in your subquery inside the FROM clause a name.
so SELECT ... FROM (...) AS Derp
 
user986408
5:56 PM
$stmt = $db->query('SELECT * FROM table');
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);

how do i loop $results the best way ?
 
Define best?
 
@Charles thx u was right
 
@PeeHaa I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
 
user986408
@PeeHaa i always did it with while($row = $stmt->fetch(...)) .. but what if i already have the result ...
 
user895378
FWIW I used PHP templating languages (well, Smarty /hides) for a long time before arriving at my current stance on the subject ...
 
5:59 PM
Define "already have the results"
 
while, do/while, for or foreach. Pick one.
And when it doesn't work, pick another.
There is no wrong way.
There are ways that will get you laughed at, but none of them are wrong.
If they were wrong, they wouldn't work.
 
@rdlowrey We don't count smarty
 
user895378
@NikiC lol I know, so embarrassing ...
 
@rdlowrey alrighty, thanks :) sorry for my harsh response ;-)
 
user895378
@igorw It's okay, I'm guilty of harsh responses from time to time :)
 
user895378
6:02 PM
I need to put a post-it note on my monitor that says, "Calm down," just to help prevent that.
 
lol
 
/me is getting really pissed at OSX
 
@ircmaxell Just install Win7 on it and call it a day
 
@ircmaxell I honestly don't understand why you are still using it
Though wait, you're using PHP too, so ...
 
user895378
Yes, we're all gluttons for punishment here. This is the PHP room ...
 
6:05 PM
I just don't like "$foo is stupid because I'm so superior" type statements. and I have seen such behaviour in this channel before. but if you acknowledge that escaping is an issue and provide alternate solutions, that's a different story.
 
One can not truly grasp PHP until one can barely contain a burning, seething hatred for it. Only then can you fully use it.
 
user1125394
eh not wrong, but im more pythonizing now..
 
user895378
@igorw You're definitely right. I want to amend my previous statement about the "idiocy" of php templating languages. Escaping is a real security issue for a large number of people writing web applications. It's unrealistic to expect everyone to know everything on the topic, but I do think there are better ways to be safe with your output if you know what you're doing.
 
@NikiC It's my work computer
and it's the only one I have with a decent enough CPU for video rendering
 
@ircmaxell So they don't allow you to install a different operating system on your computer?
 
6:08 PM
I prob could, but I wouldn't put windows on it. Which would sort of defeat part of the purpose for having it for work...
 
Not sure I understand
 
user895378
@igorw Nerd testosterone ... it can be dangerous to put a bunch of smart guys with differing viewpoints in the same place at the same time :)
 
connecting to our corporate stack (which only works on Win and Mac)
 
@ircmaxell So, what is the issue with Windows then?
 
user1125394
bah win+mac covers >90%
 
6:10 PM
Eih, I don't know. Perhaps I am too lazy
 
user1125394
sorry it's not php but this is full of sql injection right?
 
depends on the query_db method
 
user1125394
@ircmaxell o right because args are putted separately, thx
 
@MikelGarcesEtxebarria Is that an official google API that you're working with there?
 
6:18 PM
Is the official call of suggest
 
Lemme rephrase. Is it a published API with documentation and whatnot?
 
@cyril because it uses db.execute(query, params) which escapes the params, see also the 4th code sample here: docs.python.org/2/library/sqlite3.html
 
Then stop using it. Chances are that google is blocking the request because it's detecting that it's an automated request from a script and not from a user.
 
++
 
6:21 PM
ok Charles, do you know what is the official API for youtube suggestion ?
 
@MikelGarcesEtxebarria If I did then I would have recommended one.
 
user895378
Is it possible to selectively start/stop xdebug profiling from within a php script if you only want to profile a specific section of the code?
 
@rdlowrey Doesn't seem like it from a quick RTFM.
 
user895378
6:26 PM
Yeah, I was glossing over that too ... doesn't look like it :/
 
Maybe xhprof can? I've still been waiting for an excuse to use it...
 
user895378
Looks like it:
 
user895378
// your code

// start profiling
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

// the code you want to profile

// stop profiler
$xhprof_data = xhprof_disable();
 
Nifty, an excuse!
 
user895378
I might have to check it out now :)
 
user895378
6:29 PM
It's difficult to profile code that runs in a loop and only does anything when action is necessary with xdebug because you get lots of "noise" from the infinite loop that you aren't interested in ...
 
@rdlowrey I haven't found a way to do it with xdebug. it would be quite nice indeed.
 
@an_animal I'll give you a hint: It bridges PHP, BrainFuck, Object Oriented Design and Automated Testing ;-)...
 
6:48 PM
> Is this code correct? If not, what should I change?
argh
 
@rdlowrey it would be awesome to have a version of stream_copy_to_stream that works correctly with async streams without dropping data.
 
user895378
@igorw Agreed. I was wondering for performance reasons if there was a tangible difference between stream_copy_to_stream and fread/fwrite in those scenarios.
 
user895378
No need to speculate about it though. I'm going to test it directly at some point in the next day or two. I'll report my results if they're worth reporting.
 
6:53 PM
@rdlowrey in my benchmarks going through userland was about 4x slower. may include other overhead from react though, so I'd be curious to see raw bench results.
 
> You've reached the maximum of 16 Deletion votes per day; come back in 5 hours
and 5 hours to go :(
 
> member for today
I'm pretty sure that user will be gone soon
 
7:22 PM
total video: 17 minutes
 
@PeeHaa > 4th company, www.rejola.com is in incubation right now and I am looking forward to the help from members of www.stackoverflow.com to help me make rejola.com a success.
 
Hmmm perhaps we get paid to help him
 
@ircmaxell I have a domain name suggestion for you, it is quite awesome.
 
user1125394
7:41 PM
 
@igorw Oh yeah?
 
@ircmaxell see public private shared channel
 
yeah, saw that ;-)
 
8:04 PM
Hi everyone
i've read some SO posts and found this:
http://stackoverflow.com/questions/3897434/password-security-sha1-sha256-or-sha512

"A salt should always be as random as you can get, and used only once."
 
Hi, I have a question that I thought was fixed, and then closed as not a real question, but then figured that it was not fixed - problem still exists. Could someone please advise? -> stackoverflow.com/questions/13987709/conditional-regex-and-php
 
Yay! video is cut and audio recorded...
took only 7 hours! /me cries a little
 
8:22 PM
Brainfuck should be compiled, not interpreted :)
Otherwise it gets too slow
Once you run a brainfuck interpreter in brainfuck for example :D
 
I'm quitting programming and going into literary analysis, it's really fun. /sarc
@NikiC I once wrote a LOLCODE interpreter in BrainFuck
2
 
@Lusitanian Now you need to write an Ook interpreter in LOLCODE.
 
9:16 PM
@NikiC phlexy-powered brainfuck lexer?
@NikiC then AST parser and optimizer
 
10:16 PM
jow :), that is a list to burn down ^^
 
Started from the bottom of the list.
 
jow. Better take your polygon tv with you :)
 
Figure if I'm gonna sit here watching boring football games I may as well do something while I'm out of votes...
 
@Charles Are you interested in the lastest version of the bookmarklet?
 
@hakre Were there updates since the one posted in that question? Been using my old one anyway.
 
10:21 PM
@Charles let me put it onto github
the expanded one is the current one. I hope it's working, dunno where I was with dev'ing it. But will use it soon, too. It works be retagging PHP5 -> PHP and saving that retag, then openining the editor for further edits.
I normally tab between tabs and just do 20 or so in a row for the re-tagging and then reviewing the questions for edits. If you press the save button of the editor, the tab will automatically close after successfull save and if it was opened in a tab (history length = 1 or so). Very comfortable.
 
Wow, that's comprehensive as all hell.
 
changeTags(function(string) {
    return string.replace(/(^|\s)php5(\s|$)/, '$1php$2');
}, editorActivate);
 
I dunno if the crap-level is not too high to even reopen. But it might be nice so that that user has a positive experience.
E.g. vote to close the dupe, vote to re-open the earlier question.
 
10:36 PM
Out of all votes :(
 
Evening
Bloody hell, 22 outstanding cv requests? @DaveRandom to the rescue!
 
lol
Evening @DaveRandom
 
@PeeHaa Yo yo. Got anywhere with the rebuild yet? Also thoughts: would it be safe to use the same private key to sign the Chrome and the Opera ext?
 
@hakre Um, why do you have that list in there?
 
@DaveRandom CentOS is installing as we speak
 
10:42 PM
@PeeHaa Crap, I'd better get my act together with FF auto updates then :S
 
@DaveRandom I don't see why that wouldn't be safe. The only problem is that when you share the key again with the entire world we would need to change the key of both ;)
 
blah
 
Hmm, also it kinda costs nothing to make another key, seems like a pointless economy
 
video is rendered and uploaded to YouTube... Now to write the blog post around it...
 
10:44 PM
@DaveRandom Take your time. There is still lots of shit I need to install before installing the webservicy stuff.
 
@PeeHaa I know but I am going AFK for 4 days as of tomorrow lunch, I kinda wanted to have a code freeze on 0.20 before I left.
 
@DaveRandom My hero!
Also: I really, really want to kill . Badly.
 
@DaveRandom A nice. What are you going to do?
 
@Charles Is it totally valueless? Seems like a useful tag, even if it attracts sh*t questions. I've no problem with a re-tagging-to-filter-out-the-noise attack though
 
@DaveRandom That's really the main problem. There are lots of bad tagger honeypots...
 
10:49 PM
@PeeHaa See the GFs family for Christmas, nothing too exciting, I'm sure I'll pop up in here a couple of times but won't have any time to do anything I suspect. Just spent the last 2 hours wrestling with the god damn roof box on the car.
Which is my new mortal enemy.
 
I'll trade you our roof bag for your roof box.
 
lol yeh but you're American you car's probably 30 yards long.
 
hehe
 
na, our stereotype vehicle is a SUV. A real one, mind you, but still a SUV
 
@Charles Define "a real one". If it's not a LR Defender it's not a real 4x4 in my book.
Or maybe one of those insane bowler things that does 170mph
(over rough terrain)
 
10:53 PM
@DaveRandom Freaking beasts I tells ya
 
So, in 'MURICA, there are two kinds of SUVs: things that are based on trucks and can actually, say, go off road, and things that are based on cars that can't. Ours is the former. :p
 
@NikiC I just copied it there two days ago. It's just what I had found as "nice" closing phrases for "well" written questions.
 
@Charles Yeh exception to the rule: Hummer H2, based on a truck, could barely even go on-road, I hate to think what would happen if you showed one a sign that said "welcome to Canada"
 
The H2 was much more capable than the H3, I will give it that. Still, hahahaha, oh man, hummers.
 
@PeeHaa What are you sporting about in? It won't be as good as my battered MK4 Golf
 
10:55 PM
Is there an equivalent in PHP to the Java Scanner that lets you read a text file one integer at a time?
 
Someone at one of the companies up the street where I work has a first-gen H1. Man, that thing's a beast.
@Zigu Well you can read one byte at a time using fread...
whoops.
 
Yeh I was very careful to make that distinction. The H1 is a worthy vehicle. Stupid, but worthy.
@PeeHaa has uncle @Gordon turned up or have your otherwise managed to discuss the backlog plans yet?
 
@Zigu you can use unpack to decode a PHP binary string as an int
 
@DaveRandom Nopez. Haven't seen him. Will ping him later tonight on GitHu
+b
 
@igorw Why don't you have comments?
 
@igorw I think he's talking about reading numerics from a file represented as ascii delimited by whitespace. Not 100% sure though.
 
I'm really wishing that they didn't decline the RTFM close reason.
I know it'd be abused, but maaaan.
 
I know, but TL gets abused at the moment. At least with RTFM it would be truthful.
 
Ahah, oh god, there's a
 
i have quick question
i have this $mycaptchadata[7] = $params->get('shadow_color', '#fff0f0');
 
11:03 PM
@goodmood 42.
 
and i want add margin left on it ?
but not from $params
 
@Charles Propose a synonym. It'll be easier. It's only 144 qs
 
those seem to be kind of overkill:
I just have a text file with the first number being the number of nodes, then each line after being a tuple of <source_node, dest,_node, edge_cost>
 
@NikiC work in progress, I'm looking for a self-hosted disqus
 
@igorw why?
 
11:04 PM
@goodmood Insufficient input. We don't know what the rest of your code looks like and have no idea what classes are involved, what methods there are, what properties there are, what HTML is being generated, etc, etc, etc. Go post a question.
 
i tried this $mycaptchadata[8] = 'margin-left: 25px'; but didnt work
 
@DaveRandom Can't propose a synonym of a version-specific tag. :(
 
@Zigu just csv or that kinda weird half HTML tag format you show? Have you got some sample data?
 
`$mycaptchadata = array();
$mycaptchadata[0] = $params->get('font', 'texb.ttf');
$mycaptchadata[1] = $params->get('img_width', '100');
$mycaptchadata[2] = $params->get('img_height', '30');
$mycaptchadata[3] = $params->get('bg_color', '#fff');
$mycaptchadata[4] = $params->get('border_color', '#996666');
$mycaptchadata[5] = $params->get('text_color', '#6f6f6f');
$mycaptchadata[6] = $params->get('grid_color', '#ffb6b6');
$mycaptchadata[7] = $params->get('shadow_color', '#fff0f0');`
 
11:06 PM
@NikiC because I prefer to be in control of that kind of stuff. for a number of reasons.
 
and i want add this margin-left: 25px but not from $params
 
@goodmood That ain't CSS, that's an abomination. Go post a question.
 
@Charles Start creating type tags and they'll change their tune...
 
http://tantongco.net/Coursera/Algorithms/Assignment2/coursera_assn2.php
I was thinking of using explode on each line then casting back to numbers but it feels like this problem should have a more verbose solution
 
Twitters search is so fucking aweful
If you type something in it first shows you the suggestions you actually want and in by the time you want to click on them it adds some shit above them
 
11:07 PM
@DaveRandom Don't give people ideas. I'm just thankful there's no edit limit like there are vote limits.
 
really good usability if you always end up clicking the wrong thing
@igorw Ah, okay :)
 
@Zigu I wouldn't say so. Just fgets() and explode(), you probably don't even need to cast them to ints explicitly, they will get converted to ints when you try and do something mathematical with them.
 
ok. just thought i'd ask people with more experience first.
 
Although @Zigu I think the "scanner" thing you were looking for is fscanf(), a function I have never used once and have only just remembered about the existence of.
 
11:22 PM
blah
 
blah?
 
blah?!
 
blah.
 
blah$
 
blah[?!.]*
 
Anonymous
11:25 PM
 
time to write the blog post I spent all day editing video for
 
Evening
Guys, does anyone know does symfony have Observers in it? Sepcifically Symfony 2.
 
No
at most mediators (I believe they use mediators), but almost no popular framework uses observers (because they are such a limited pattern)
 
Who's good with htaccess here?
?
 
@DemCodeLines Depends on whether you really mean mod_rewrite or not
 
11:35 PM
@Eugene The pain I see coming is maintaining all the different components written in all different languages.
 
RewriteRule ^a/b c/d [L]
file d exists directory c
 
@DemCodeLines Yeah, that's mod_rewrite.
 
a itself is a file
 
@PeeHaa well I'm considering only PHP, even more I think that he will not go past PHP and Java.
 
but i want to access file b through the url /a/b
 
11:36 PM
Please show you actual rules. Pseudo-code is rarely a good idea when asking for regex help.
 
@Eugene Sure if OP goes for PHP only it should be a breeze (kinda ;) )
 
RewriteRule ^register/terms login/terms [L]
register.php is a file, and through rewrite, it can be accessed as /register, not just /register.php
terms.php is another file and can be accessed as /terms too
Possible to rewrite it?
example.com/register/terms ?
?
 
why /register/terms ? How are they related?
 
terms is second part of registration
 
11:49 PM
@igorw Generator::throw() is now in ;)
 
++ nice job!
 
How much work would it be to convince SE that any question should force the user to acknowledge that they shouldn't use mail() first...
 
@DemCodeLines So how do you determine which level of file to rewrite? Are they in different dirs?
@Charles They probably shouldn't be using PHP. Unless you are really good at email you should not be sending them programmatically.
 
lol
2
Q: Is it possible to forge a PHP session ID?

iightIf a page checks for the existence of a PHP Session: if (isset($_SESSION['secret'])) {...grant access to EVERYTHING!!!} Is it possible / How could I generate $_SESSION['secret'] on my machine, in a situation where I don't have access to the page's back-end code? I'm trying to hack into the int...

 

« first day (799 days earlier)      last day (4152 days later) »