« first day (662 days earlier)      last day (4268 days later) » 

8:23 AM
・ω・ノ
 
8:33 AM
Hello friends
i need logic
i m creating file hosting website
in the end of file upload i have to provide download and delete link
so user can distribute it or delete it
how can i generate this link
 
@Rstar I'd recommend using PHP
 
8:49 AM
yeah i know buddy but in php how can i ?
i want unique link for each download
 
@Rstar *cough*databases*autoincrement*ids*cough*UUIDs*random*cough*strings*co‌​ugh
so many options...
*cough*
 
@Rstar which outsourcing company do you work for?
 
buddy its a provate
why r u asking ?
 
I wonder if your client knows they hired someone without the skills to do the job.
 
buddy i am the person who is working in android
i want to have own my own file hosting site okay
i know java
 
8:54 AM
Got a simple question for anyone who has ever used Twig (or Django templating, I heard it's the same)
 
got it
 
can you not do something like this?
 
thats why i am asking
 
{% set var = 'hello{{another_var}}world' %}
 
@Leigh here i am client ok
 
8:56 AM
@Rstar I don't really care. You've basically come here and said "give me teh codez". Go and do some research.
 
yeah i need word only to search
 
@deceze you should get that checked out
 
i dont expect whole code
coz i am also programmer so i know
 
@AdamLynch @Rstar should... :)
 
@deceze but it's encrypted!
 
8:58 AM
My cough is encrypted?! O_o
 
@deceze I was making a joke at the expense of all those people who make their own "encryption" schemes :(
 
@Rstar Imho the word is "PHP", beceause you are not asking something really hard so that means you need some basics.
 
@draconis yeah u right buddy
 
Mmmkay... :)
Maybe one of us needs more coffee?
 
9:00 AM
Very dumb question, but someone can tell me, why this is not working: http://pastebin.com/h7uP5TE4 ?
I suppose, it should, but why its not?
It is a simple ajax/mysql chat
 
@DanielsPitkevičs Not enough jQuery.
 
@deceze Why? Where is not enough?
 
lol
 
@DanielsPitkevičs There are entire lines in pure Javascript. Fix that.
 
i bet deceze was meaning this : doxdesk.com/img/updates/20091116-so-large.gif
 
9:04 AM
emfcamp.org - aw, going to be out of the country :( some of those talks look awesome
 
@DanielsPitkevičs Don't let yourself be trolled. ;P
 
@deceze I wont :D I'm in a good mood. ^^
Ok, I changed that one line into jQuery. But why that script is not working? I'm trying to get more into ajax, so I feel dumb.
 
-1
Q: Formulating Physics

Brendan GriffithsHey guys I need some help I just bought a new computer and I was wondering what should I name my new puppy. I was thinking Fredrick but i'm not to sure if it suits him, please help me.

^ The Cake. He took it.
 
@deceze Hahaha, why it is closed so fast :D
 
posted on August 07, 2012 by Evert Pot

Over the last little while I've been working at fruux on a new open source project: an iCalendar/vCard parser for PHP. Actually, the project has existed since 2010 as it's really a spin-off from SabreDAV. I felt like the library could appeal to a wider audience, and benefit from a separate release schedule. The tool heavily makes use of PHP's magic object and array accessors, to provide an

 
9:10 AM
That was like high school math exercises: You have 2 apples and 4 pears, calculate differenc between sun and earth in logarithmic time including all gravity calculations.
 
Last netbeans version has introduced two new code hints, one of which is ["Immutable Variables"](https://blogs.oracle.com/netbeansphp/entry/several_new_hints)

Discuss your thoughts about this.
 
@DanielsPitkevičs 42. Why?
@Christian O_o
 
@deceze :P
 
@deceze As in "why the f did they do that?!" If so, I completely agree.
 
Anyway, im back to that freakin ajax.
 
9:12 AM
@Christian The immutable thing, what a crock
 
@Christian Yes, exactly. Also: Unused Use Statement. 'tis an April Fools post, no?
;)
 
Hi friends, I am using tinymce for posting and i am facing a problem
 
@deceze I think that that one at least works in practice.
And no, not April Fools. :(
 
I think they don't understand what "immutable" means
Constants are immutable, read-only properties are immutable, variables are mutable. That is why they are called vari-able
 
Fortunately, you can disable such hints.
@Leigh Can I quote you on that?
 
9:16 AM
Ok, I've shorten my error - what's wrong with that PHP part where in switch case is 'send?'
 
@Christian Well, actually reading the explanation... I think it's not soooo bad. It's kinda misplaced in PHP though, because mutating variable states is not exactly uncommon in imperative languages.
Use functional languages if you want to use the immutable variable paradigm, it actually makes sense there.
There may be a case or two where it catches actual problems, but personally I can't really say I have many bugs due to "too many assignments" that I'd need caught by my IDE.
 
@deceze But we're talking about PHP here. This is a feature for the PHP editor.
 
@Christian You can do what you want.
But seriously, I re-use variables a lot. If garbage collection is at end of scope, why would I want to bloat my memory usage by unnecessarily creating new variables for everything.
 
^ this
 
hi, everybody
 
9:19 AM
More than memory bloat though, it's namespace bloat.
@Christian I know.
 
@deceze At least you get more coverage in error handler $context :D
 
function ($foo) {
    $trimmedFoo = trim($foo);
    $escapedAndTrimmedFoo = escape($trimmedFoo);
    return $escapedAndTrimmedFoo;
}
They basically want us to write code like this ^?
 
Plus, it's easy to have 4294967296 bytes of memory nowadays....who cares how much variables we use?
 
@deceze their suggestion was to do return escape(trim($foo))
 
@Christian Yea, when you run a high traffic site, who cares how many extra servers you need :)
@Vatev No it wasn't
 
9:23 AM
@Vatev Which is cute and all, until you need to run it through 5 functions with long names, which is really really unreadable.
 
@Vatev Nope. What if he wanted to do addCheese() right afterwords?
 
I'm not saying i agree :)
 
function ($foo) {
    $trimmedFoo = trim($foo);
    $escapedAndTrimmedFoo = escape($trimmedFoo);
    $escapedAndTrimmedFooWithCheese = addCheese($escapedAndTrimmedFoo);
    return $escapedAndTrimmedFooWithCheese;
}
 
but anyway you are right I got the wrong impression
 
@deceze On the other hand, I just found a new hint they could work on
Multiple use of the same variable!
 
9:25 AM
it will get worse if you want to sum an array or something
 
It would have corrected my code above ^
 
: )
 
9:39 AM
posted on August 08, 2012 by Henrik Sarvell

Hgview is a fantastic tool but for some reason the search field refused to come up in my version no matter how much CTRL+F I tried.... Read More

 
10:12 AM
Are custom exception handlers removed during shutdown, before shutdown handlers have finished executing?
 
@Leigh Schlüter outlines the shutdown order in the PHPLondon 2012 talk.
 
@hakre Thank you
Oh, I can't read it :(
 
10:31 AM
Basically, when trying to catch a FATAL with a shutdown function, throwing an ErrorException is not caught, and debug_backtrace is incomplete.
 
And what he didn't tell: Super::$tatic survives even the destruction of the super-globals. Muhahaha.
 
Thanks, no mention of restoring the exception handler though.
 
good question, please post it on the website.
 
Shutdown sequence outlined: lxr.php.net/xref/PHP_5_4/main/main.c#1701
 
it probably is never removed?
 
10:39 AM
no good answers on my question yet :(
sup folks?
 
@Truth which one?
 
2
Q: PhpStorm PHPUnit integration fail

TruthI'm trying (for quite a while, with help from fellas at the PHP chat room) to succesfully integrate PHPUnit with PhpStorm. I've set up the phpunit.xml file as follows: <?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals = "false" backupStaticAttr...

 
it's not sprintf :S
 
@deceze Don't think so, I think you can use the same variable twice
 
10:42 AM
Thought so. What is the manual trying to tell us then?
 
you can reuse named parameters, and ? ones you probably can't... (makes sense)
 
Hi All. Is there anyone here who has built Web based MLM software before ?
 
@deceze No, it would appear as though you really can't use the same name twice
$stmt = $pdo->prepare("SELECT :this, :this, :this");
Throws an exception
 
:\
 
@deceze I've just been trying it and it does in fact seem to work (in 5.4.3 at least). It looks like (surprise surprise) the manual is wrong. Silly me, assuming the documented behaviour is the actual behaviour. Having said that, I'm sure I once tried it and it failed. Still, I stand at least partially if not wholly corrected. — DaveRandom 5 mins ago
@Truth
 
X-D
 
If I have made a question for which I have found the answer in the meantime, is it good and acceptable to use the Answer your Question feature?
 
@Whisperity That's what it's for.
 
10:55 AM
@hakre morning :)
 
Fixed bug #40417 (Allow multiple instances of the same named PDO token in prepared statement emulation code). (Ilia)
@dece @ze
 
I got this:
$times[$stat['time']][2] = $times[$stat['time']][2] + 1;

And get
ErrorException [ Notice ]: Undefined index: 18:00

I believe its because first time the $times[$stat['time']] arent defined , how can i make it create if it is not defined ? if statement ?
if(!isset($times[$stat['time']])) { $times[$stat['time']]; } ??
 
@PeeHaa cake users I tell you :D
 
10:59 AM
@Karem if ( !isset( $times[$stat['time']]) ) { $times[$stat['time']] = []; }
[] is array() if pre-php5.4.
 
0
A: Implement bitmask or relational ACL in PHP

WhisperityBitmasks The original problem with bitmasks is that they go against the conventions of data modelling (expressed in another answer here, with further reading here and here). A 4-byte signed integer might only contain 31 different values (represented in integer as 2 147 483 648) and calculation i...

@deceze Okay, now what do? :)
 
@hakre I think I found it in the source. The exception handler is not removed, but the use of "user error handling" is disabled for certain error types (E_ERROR, E_COMPILER_ERROR, etc). Including if you throw a new exception when you detect one.
 
@Whisperity syntax err
 
11:03 AM
It means that you are on Titanic, but the ice-block is somewhere in the future to illustrate that picture a bit ;) — hakre 19 secs ago
 
@Karem Replace $times[$stat['time']] = []˙; with $times[$stat['time']] = array();. Or update to PHP 5.4
 
:)
 
thx
 
While connecting to Apple server I am getting this error Failed to connect: 111 Connection refused any idea guys..
is there any problem in certificate.pem file or my server problem
 
stackoverflow.com/questions/5084691/… @hakre SUPER::$tatic needed :D
 
11:19 AM
lol , as bad as Kohana's architecture is , that Hafiz guy managed to make it much much worse
 
what should be the name of the class which determine whether the user is lucky or not based on some set of conditions
 
Or would it be more likely for the is it spam option?
 
@fluty whetherUserLuckyOrNot ?
 
@Whisperity that guy has only three answers and that is the only one with youtube link
not every misguided person is a spammer
 
11:29 AM
hi
 
it's like assuming that every time a politician does something bad, they do it for their own profit
.. oh .. wait .. bad example
 
public function  __contstruct() {
            parent::__contstruct();
}
^Award for most usefulstest function ever.
1
A: Passing properties from parent controller to child controller in Kohana 3

shadowhandDo not overload __construct blindly, it will break your controllers. You should be doing this in the before() method. Be sure to call parent::before() after you are done. And that global stuff is totally unnecessary. Just set $this->facebook and then access it later with $this->facebook.

 
anybody know the ans please?
 
@deceze should be before/after :D note: contstruct :P
 
@webarto whetherUserLuckyOrNot sounds like a function name aint it?
 
11:40 AM
@deceze 7 I have a application that need to use current location of user. My problem is that when browser ask permission to user , that massage display my website IP address. I need to hide that IP address — Puma 5 mins ago
 
@deceze seems legit :D
 
thats a good one :)
 
array('_', '-') <-- array of bummed out faces
 
12:00 PM
Anyone here familiar with LALR parsing?
 
@webarto thanks for your input i have decided to go with FortuneFinder name
 
1
A: Notice: Undefined index: itemid in C:\xampp\htdocs\blogshop\application\views\scripts\item\tops.phtml on line 58

WhisperityThere is no index named itemid in your $this->item array, this is why you get the error. Also, your code here seems to be a bit wrong: <?php foreach($this->item as $item) : ?> <?php echo $this->escape($this->item['itemid']);?> <img src="<?php echo $this->...

God I always fear that people are too new and that they will break into understanding my answers. :(
 
Which could be the best way to do this thing in multiplayer through jquery:
2 players, one table. If I place a card on table, oponent should see that. Which would be the best way to do that? I think of storing table places in database and when card is placed, database is updated and oponent sees it after ajax event. Good way or not?
Example, table with 5 card places for each player. And in database I store line with card id's - 10,3,20,-,-
and "-" if no card is placed
 
"2 players, one table" - did I see what you just did there?
 
@deceze didn't get it :D
 
12:10 PM
@DanielsPitkevičs Don't. Store. More. Than. One. Data. In. One. Field.
 
@DanielsPitkevičs Alright, then never mind. You don't want to get it. :)
 
Set up some tables like tables, users, cards and use the power of SQL to build the relations between them. Apart from that, your logic seems to be right.
 
@Whisperity Huh, that bad to store more than one?
 
Definitely agree with @Whisperity, you will undoubtedly run into problems storing a CSV in a single DB field
 
12:11 PM
@DanielsPitkevičs Well. Usually it is.
 
I'm working with legacy databases that do this and it is a big pita
 
@CharlesSprayberry Or storing serialize()d arrays in one DB field. I have made that mistake in my project and I'm still figuring out a way to get rid of them Also, cough cough... Should have used maybe_serialize()... my bad.
@DanielsPitkevičs Not quite related but you should take a look at this: stackoverflow.com/a/11863064/1428773
 
@Whisperity Ok thank You
 
I described why it is bad to store multiple data in one field with taking bitmasks as an example. If you know the amount of cards on the desk (wouldn't use the word table here to prevent confusion) you should take time modelling your strucutre. But the rest of the logic feels right to me.
 
12:23 PM
what does "pls" stand for, in "cv-pls"?
 
@Jocelyn Please. Like "Could you pass me the salt, please?"
 
@SwapTest Happy to be able to help. But please, take your time to understand what you are using and doing. (Related manual page for foreach) It's good that I told you what to do and that you merged my fix into your files, but if you don't understand why it works, there is production value in doing it. Also, if this was the good answer, mark it as the answer with the transparent tick next to it so further readers will see that this answer did work. — Whisperity 44 secs ago
This just came out...
 
thanks.
 
12:39 PM
Who has introduced that whitespace around ` -> ` that you can see in some of the questions?
Like $pdocon -> prepare('SELECT * FROM table WHERE blah = :blah');
Was that in some framework or so?
 
Whitespace supremacists
 
@hakre The hell...
 
grumble, another adventure in php-src
trying to implement foreach(){} else {}
 
@Leigh When would else fire?
if the array is empty?
 
12:49 PM
@Truth when there was 0 loops
so yea, empty array
 
Well I guess that's easy enough you implement with PHP? Are you trying to make a source patch?
 
@Truth Yep, got the syntax working (although I had to increase the expected shift/reduce error count for the LALR parser)... now having fun with opcodes
I found an old RFC for it, but no patch to go with it
And lets not get started with braceless syntaxes :P
 
Hello everyone
 
@Leigh Meh, I find if !empty { foreach } else {} more readable anyway
 
Is it possible in Zend Framework to get array or default Zend_Loader_Autoloader_Resources?
 
12:55 PM
@Leigh there is no else. if the iterator is empty, it is empty. no else.
it is iteration.
 
"testsuite" I think "testsuite" needs to go in there: "How to configure testsuite in Phpunit XML file?"hakre 2 mins ago
@hakre huh?
 
Ah, I see Zend_Loader_Autoloader::getInstance()->getAutoloaders();
 
Huh? Why huh? I thought that was your question. How to do that.
@Kirzilla ah okay, that you mean ;)
 
@hakre No, huh? as in I don't understand what you mean
 
@hakre its just syntactic sugar, I don't care if other people want it or not (which from searching, they do), I'm implementing it so I can understand internals better
 
12:57 PM
Well that is not sugar.
You ruin something that simplistic and nicely as iteration and turn it into branching.
 
@hakre Like I said, I don't care what people think, doing it to learn.
 
@Truth I think the error is there because of the testsuite definition, isn't it?
@Leigh Then I will try to find something again you can take a look in ;)
 
@hakre Probably, but the thing is, even when I copy their example from the manual entry on the subject, I still get the same error...
 
@hakre Sure, but it has to be interesting :) - I'm not fixing APC for git master or something ;)
 
@Truth Okay, is that with some code I can download from github? Then I can run a test here on my windows box.
 
@Leigh Sure something interesting. Who wants boring stuff?
 
Then directly copy/pasted here: phpunit.de/manual/current/en/…
@hakre
 
@Truth Okay, let me fetch it and try it.
 
Sure thing :)
 
@Truth PHPStorm 4.0.4? Mine says its 4.0.3 and updated.
 
1:03 PM
There is an updated version
No, you're right, my bad.
4.0.3
4.0.4 is my android version :S
 
Sorry for annoying You, but still, this part of code is correct?

function UpdateTable(id)
{
alert("begin");
$.ajax({
type : "POST",
url : "php/update-table.php",
data : {
"field":id,
"game":$("#game-id").text(),
"function":"updateField",
"player":$("#player").text(),
"field_part":"top",
"card_id":"1"
},
dataType: "json",
success : function (data) {
alert("success");
}
});
alert("end");
}
it alerts begin and end, but not success
 
kinda hard to tell, considering i'm not gonna try to decipher all that :P use the fixed font button so it gets proper indents
 
@DanielsPitkevičs Please indent each line with 4 spaces (or just press CTRL+K after pasting) to format the code properly.
 
Its too late to edit this message..
Simple ajax call
Should be correct
 
@DanielsPitkevičs Also, this is the PHP room, try the JavaScript room...
 
1:10 PM
what does your php script return?
does it have a application/json header ?
 
@Truth There is a PHP code too, but I'm almost sure that PHP developers here know javascript and ajax as well as php.
 
@Vatev Actually, php script don't return anything, because it just needs to update database. No, there is no json header.
 
Is SimpleXML the best way to handle XML in PHP?
 
@SomeKittens Define "best".
 
1:20 PM
@deceze Easy to use/learn. I'm not too worried about it having insane crazy features.
 
@SomeKittens Sure, SimpleXML is... simple. It's the one-size-fits-90% of XML libraries and has a simple API to work with.
 
ok. What are the edge cases I should be worried about/aware of?
 
$day = array( );
$day[0] = "1";
$day[1] = "2";
$day[2] = "3";
$day[3] = "4";
$days=$day;
^ no, I'm genuinely impressed.
I don't remember ever, ever, writing stuff like that in any state of mind I've lived through.
 
@SomeKittens AFAIK the biggest problem with it is that it parses the whole file at once into memory to give you a nice OO interface for it. For large files, this is a real problem; you'll want a library that can consume the file little by little there.
@Christian Arrays are HARD.
 
-3
Q: Can anyone better refactor this php lorem generator?

stack98I wrote this and am wondering can it be written any better, would love to get rid of the for loop! <? $paragraph[1] = "Lorem ipsum dolor sit amet ......... Fusce a ante."; $paragraph[2] = "Praesent sit amet est. Vestibulum quis elit ......... consectetuer quis, quam."; $paragraph[3] = "Susp...

 
1:26 PM
@deceze Is that supposed to be sarcastic?
 
@deceze Ok, I won't be working with large ones. Thanks!
 
Why would you ever think THAT?!
(Note to self: sarcasm don't work over the wire.) ;)
 
@deceze I must have missed the sarcasm accent.
 
wow, it's really complicated to convince PHP on the commandline in windows to to just take the php.ini file in the same directory as the binary.
Especially if you have more than one PHP version.
Does this enforces me to remove environment variables that on the other hand will totally fool pear then?
Ah, PEAR has it's own set of environment variables. Does anybody know how important the PHPRC environment variable is?
 
1:42 PM
So, back for a while
@hakre any new findings? :P
 
posted on August 08, 2012 by Liip

You may certainly have heard of the bad things which have happened to Mat Honan. Some hackers deleted almost everything of him. iPhone, iPad, Macbook, Google, hacked his Twitter Account, etc… Almost everything could have been prevented if he had used Google's 2-step Verification. So if you have a Google Account and didn't enable it, go ahead and do it. But that's not the point of this blogpost

 
@Feeds duh, lots of us already do
Wow, he has 300 lines of code to convert numbers to/from base32... I think mine does it in <30
 
@Truth I just initialized the submodules. I needed to install PHP 5.4. first. Let's see :)
 
2:03 PM
@SomeKittens LOL, nice edit.
 
It was posted a couple of weeks back, but: kickstarter.com/projects/ouya/… OUYA got up to $7.8m now
 
@deceze Hitting 2k was great. Editing's much better now.
 
Who wants to upvote me 50 times so that I get to 2000 points now? :-D
(just joking)
 
@Jocelyn You could make 250 edits, I frequent the "suggested edits"
 
Good morning
@Jocelyn you'd only get 200 points (the daily rep cap)
 
2:09 PM
294 of my rep's from editing
 
So far I never hit the 200 points a day limit
 
rep cap was reached via rep from upvotes *only* on 35 days
earned at least 200 reputation on 44 days
 
@Jocelyn I've only hit it once. I was bored aftward.
 
I get quickly bored when I read very low quality questions, from users who don't even try to explain what their problem is and prefer to paste 100 lines of PHP stupidity.
 
2:14 PM
Unable to reproduce. I just cloned, initialized submodules, fetched them, installed PHP 5.4, configured PEAR include path where PHPUnit was installed and then in PHPStorm right clicked on the XML file and run with code coverage.
Ah wait, you wand your own command, let me test that, too.
 
No blog post today. Never got a good question to answer...
 
@ircmaxell "How to write good documentation"
 
As in API docs.
Less suggestion, more me venting frustration at docs where the examples have clear syntax errors.
 
@SomeKittens Examples with syntax errors, how helpful.
The example files should be invoked by the automated tests as well so that this can not happen
Additionally those are cheap "test-cases" you can have for integration testing
 
2:24 PM
That would imply that these people did any sort of testing. Their company (run almost entirely by marketing people) has the philosophy of compileable code === shippable code.
 
yesterday, by deceze
Dunno if someone here has an opinion on that (probably more an @ircmaxell question), but would you consider a message passing system based on, for example, ZeroMQ a good architecture for an n-tier system and why not. :)
 
vague question is impossible to answer
 
Fair enough. :)
Apropos of your recent n-tier post... you describe a system based on reverse proxies/web servers for the separate tiers.
Do you see any inherent problem in having the tiers communicate using ZeroMQ instead?
 
@deceze you are looking for jQuery.ajax
 
@truth: Whatever I try, I can not reproduce your issue.
Test just run flawlessly
 
2:33 PM
@deceze I was more talking about separate systems. REST is just one way of communication. Something like ZeroMQ or Gearman can play a huge part in the practical implementation...
 
@ircmaxell The practical advantage of a web server would be the inherent caching mechanism of HTTP, I take it then? Where you don't necessarily need caching, message passing is just as well?
 
Depends on the problem
 
Sure
I just rarely see anybody talk about *MQ or similar protocols, so am looking for opinions... :)
 
needs moar jQuery — webarto 19 secs ago
 
it's fairly new
 
2:37 PM
Any experience with the ZMQ PHP libs by any chance?
Two years old, yet still "experimental"... :-/
 
@deceze You like this better? Also would it be a good idea to use mb_* instead of "normal" string functions?
 
@deceze same for php-websocket project... 2 years old, unofficially abandoned... probably no interest (small interest)...
 
@PeeHaa Much simpler and easier to follow. Scope-wise it's good, I think.
 
Good. Thanks
 
It's debatable whether you should include HTML escaping and multi-byte strings...
 
2:45 PM
Yup. Not sure about that
 
Why not at least leave HTML out of it altogether?
 
@deceze Wouldn't that make it more abstract to the reader?
 
@PeeHaa never figured it out yesterday
 
@Lusitanian the soundcloud service?
 
There are few examples on php.net that use output to HTML. Most are abstract function usage examples. How to produce proper HTML requires its own chapter IMO.
But, again, it's debatable I guess. It's not too complex as is.
 
2:53 PM
correct
 
@Lusitanian This is just stupid :( It bitches about invalid_client which should mean it's an error on our (/ my side ;) ). I've checked and double checked the body params which should be correct according to the spec. I'm going to check my current code (which already uses the soundcloud service) to figure out what I screwed up
 
i hate oauth
:)
 
Write an oAuth library they said. It will be fun they said...
;)
 
I thought .//div and /descendant::div have the same results \m/
 
*useful, they said
 

« first day (662 days earlier)      last day (4268 days later) »