« first day (1277 days earlier)      last day (3668 days later) » 

12:17 AM
2
 
Night
 
in EcmaScript, 1 min ago, by Doorknob
http://stackoverflow.com/q/23072474/1223693
quick!
 
You owe me 2 points and a delete vote.
 
Heh, my deletevote has been added
 
Pffft, someone upvoted, sad.
 
12:23 AM
I know :(
Now there's a +3/-3 and a +2/-2
 
there's just too many of them
 
woah...
 
158
Q: How to implement unit testing in PHP?

KevinI'd really like to start implementing Unit Testing in my projects. I don't know how viable this is to do in PHP. How can I do this?

We're trying to delete stuff like this, but force is strong.
7 delete votes already
 
8 now
 
Great!
9
 
12:28 AM
> 1 more vote is needed to delete this post
I feel so POWERFUL! >:D
 
:D
 
...aaaaand it's gone!
 
The feeling when you purge Q with 300+ upvotes is...
HAHA, IN B4 DAVE
> deleted by PeeHaa, Bo Persson, bmargulies, kapa, John Saunders, TOOTSKI, cryptic ツ, DaveRandom, tereško, Doorknob 38 secs ago
 
It's so satisfying :D
Now, any more 20kers to cast the final vote on this one?
 
@DaveRandom @tereško ^
 
12:30 AM
> deleted by Doorknob, tereško, DaveRandom 6 secs ago
:D
 
Yay!
 
Has anyone got any good real-world use cases for wiki.php.net/rfc/string-bitwise-shifts ?
 
Need to get me that 20K.
 
Yay for killing things for fire! Or rather, pixels on a screen. But you know, what's the difference :P
 
12:31 AM
wtf
 
wat.
 
Security certificate has been revoked it says.
 
openssl .. and Rasmus being lazy ass
 
we are not worthy of new certificate it seems
 
It's basically a proposal to change var_dump(sprintf('%08b', ord('1' << 1))); from string(8) "00110010" to string(8) "01100010", and make shifts work like you (I) would expect on arbitrary width strings
 
12:37 AM
Common names	*.php.net
Alternative names	 *.php.net php.net
Prefix handling	Not required for subdomains
Valid from	Mon Jun 03 00:00:00 UTC 2013
Valid until	Thu Jun 02 23:59:59 UTC 2016 (expires in 2 years and 1 month)
Key	RSA 4096 bits
Weak key (Debian)	 No
Issuer	PositiveSSL CA 2
Signature algorithm	SHA1withRSA
Extended Validation	No
Revocation information	 CRL, OCSP
Revocation status	Revoked   INSECURE
Trusted	No   NOT TRUSTED (Why?)
 
this company has a frontend developer which (if what drunk people tell me is true) earns more then I do ... so why the fuck must I clean up the mess !?
 
@DaveRandom Is it yours? RFC ... I can't think of to be honest, not in that business.
@tereško Because he's cool and you're not.
 
@TOOTSKI There are some, I've had them before, but cannot for the life of me remember what they were :-(
Anywho I'm going to bed because I'm softcore
 
Good night :)
 
nite @all
 
12:39 AM
that must be it ...
 
As far as I see, these days, salaries are the same...
Because with frontend, you can still write crappy code and get away with it.
I would quit that job if I were you.
 
not yet
 
> PayPal balance: €3,505.97 EUR
Do it, @tereško.
Set yourself free.
Work remotely for 'muricans.
3AM, daaaaaamn.
 
i have the same amount in my bank account .. well .. a bit more
then again, I spend much less
 
This is just one salary, I withdraw immediately.
Regardless of that, don't let them fuck you in the brains.
 
1:07 AM
anonymous and nested classes ... because voodoo ...
<?php
namespace {
	class Anonymous {
		public function __construct($methods, $properties = [], $parents = [], $flags = ZEND_ACC_CLASS) {
			if (!$this->name) {
				$this->name        = sprintf(
					"%s#%d", __CLASS__, self::getNextIdentifier());
			}

			uopz_compose(
				$this->name,
				$this->parents    = $parents,
				$this->methods    = $methods,
				$this->properties = $properties,
				$this->flags      = $flags);
		}

		public function getName()       { return $this->name; }
		public function getParents()    { return $this->parents; }
 
1:19 AM
@ircmaxell Final impl just uses a Terminal, not separate head and tail nodes. It would not give as much protection in the case that somehow the structure got into an invalid state, but it was worth the simplification.
@tereško He's probably been there longer, yes?
 
@JoeWatkins What's this!?
 
1:33 AM
@TOOTSKI I got a reply, thank you again
Btw, can someone help me out. I setup an email, and one of my e-mails is getting sent straight to gmail's spam, while the other one isn't. Why is this happening to only one e-mail? I tested it on a few gMail accounts.
 
 
2 hours later…
3:13 AM
Has anyone here used MAMP?
 
Anybody home?
 
@DanLugg Im here
 
Ahoy
Is there a name for both the behaviors of popping and shifting from a collection?
 
3:29 AM
@DanLugg removing ?
 
I suppose "remove", but didn't know if there was a generic term applied to both behaviors.
^^ Yea. That's what I was thinking.
 
"pulling" ?
 
Use case is; I have a type with a collection encapsulated, different implementations will either pop or shift, depending on the strategy used.
 
"getting" then
 
"pull"? Haven't heard it used in that context. Is that common?
"getting" doesn't imply mutation though.
I'm thinking "remove" is the most applicable so far. It doesn't imply fetching though.
"pluck"?
 
public function juiceCollection()
^^ done.
 
yw
 
lol
 
3:48 AM
I should be fucking sleeping
Example for a Zend Framework application, the controller is the logic part, his role is to interact with the Mapper. The Mapper will ask data to the db and return it to the controller. After that, you can return these data in a view (for exmample). But Mappers are models ... And will be stored in the "models" directory. By definition, a model is a db access layer. A good practice is to separate models & mappers and just store in the model file, the definition of your data (fields, PK, FK, ...) — ceadreak 10 hours ago
^ is there some undisclosed retard-breeding project?
 
user895378
4:37 AM
@TOOTSKI The phpdbg-ws project is coming along faster than expected ... will be looking to procure a sweet console interface in the next couple of weeks /cc @JoeWatkins and @bwoebi
 
user895378
 
I've been working with Codeigniter, is it really going off the bandwagon or should I stick to it?
 
user895378
I would advise anyone to avoid CodeIgniter.
 
4:54 AM
I advise the same.
 
@Skewled I would advise first learning how to write good OOP and then, when you plan to work in a company that uses a specific framework, spend 2 days on learning it
investing extensive time in a specific framework is really short-sighted
 
@tereško that makes complete sense to me, thanks for the replies!
 
1
Q: Hide the parameters passed through href tag

BinaI am passing parameters through href tag as below: <a href='message.php?toid=$userid&name1=$fname&name2=$lname'> When I get redirected to message.php, the three parameters are visible on address bar. How can I hide these parameters? I came across .htaccess as one of the solution but without .h...

Looks interesting, but I've really no idea what's being asked / what purpose it is for. :/
Wow. An answer that uses mcrypt_ecb to "encrypt" the parameters, lol.
Is it just me or does anyone else find that approach completely stupid?
 
5:30 AM
hello!
 
Hello, i am using private/protected methods to show that method has no side effects on object.
1
A: OOP--PHP , When to use private static function in PHP? not a lack of research . read the description

Second RikudoNever, you should never use private static functions in PHP. There's no single good use case. Just don't do it.

 
emm .. what ?
 
I am disagree with this without reasoned answer.
 
5:45 AM
HI, i want to make my unique key in this format (LN001) while inserting records how can i do this... ?
 
@MuhammadSaqlainArif Set unique field :^ )
 
no it will increment when next record will come like this.. (LN002)
 
MySQL?
 
Yes i am using php mysql
 
The simplest way is insert row with null value, then update row using last_insert_id
 
5:52 AM
hmmmmmmm..thats the point.. :)
Thanks
 
Hi all
 
6:13 AM
@tereško, sorry for the ping but where can i find a basic OOP resource/book that is good for a dev starting to learn OOP? My friend is asking me for one but i can't think of any right now..
 
11 hours ago, by Fabien
@AmalMurali PHP object-orientated Solutions - David Powers comes @tereško approved.
@reikyoushin ^
 
thanks! are there online materials too that you know of?
 
I'm in the same boat as you(r friend). Don't ask me :P
 
@AmalMurali thanks anyway. ;)
 
Please flag this answer as a copy-paste from this answer.
Argh. He deleted it. Flag it anyway.
 
6:27 AM
Hi @crypticツ
 
well .. WTF
 
@Ihsan hey
 
@tereško gah i can't see it T-T
 
How is florida?
 
btw what im looking for is not for advanced developers, he can write PHP but needs a thorough resource for OOP
 
6:30 AM
@tereško uh oh, and it's one of the canonical posts listed in the sticky QAs
 
I've been away for a while building a medical robot. Finally the beta stage is over. Now back to php...
 
@Ihsan boring, also crazy with gun wielding maniacs, cannibals, and stupid people.
 
robots or php?
oh flo...
@crypticツ stupid people is everywhere so it does not count, gun wielding maniacs is a real threat but ... cannibals????
 
@crypticツ well.. you voted for close it :p
good morning
 
6:35 AM
@AlmaDo closing does not mean delete it
 
ah well, undeleted now..
 
some posts we want to keep around even though they are closed since they have good answers
 
here's the funny part: none of users who voted to delete it has in his/her top tags
 
@crypticツ cannibals, like codeEater ... sorry codeIgniter ....?
Hi @tereško. I am coming out of my grave...
(don't say go back there and stay put)
:D
 
@Ihsan ibtimes.co.uk/… either cannibals or zombies. We will never know, as the police shoot them before we get to know =oP
 
6:41 AM
@crypticツ stunningly disgusting. That flags "FATAL ERROR" in my thought flow. How? why? wtf? .... OMG!!!...
 
@Ihsan explanation: Florida
we're one fucked up state
 
Why php script with uncaught exception has exit code 0?
 
@crypticツ ...and you call it boring? It is a nerve breaking adventure of survival...
 
@Ihsan I'm use to it
 
shut up and go back in the church, you should be grateful that you still can vote
 
6:43 AM
@crypticツ I see.
 
@tereško who was that in reply to?
 
2 mins ago, by cryptic ツ
we're one fucked up state
 
I'm practically a militant Atheist, also I don't care about voting. The system is bought out, my vote means nothing.
Fuck Churches and fuck politicians
 
@crypticツ at least you are not a neighbor of russia.
 
6:47 AM
You do not need to sleep in a bed with a bear...
 
<3 George Carlin
 
@Ihsan please, don't. Or something happened with this room so blame some entire nation is now ok here?
 
@AlmaDo thats a classical joke coming from the ages of cold war. I like russians.
 
@Ihsan well, I hope that won't go further. Yesterday "video joke" wasn't funny :\
 
???
Yesterday I did not post anything.
 
6:52 AM
^ that's why I said "in this room"
 
@AlmaDo now I am really out... What are we talking about?
Oh yesterday somebody posted something inappropriate...
 
@Ihsan well, it was not funny sarcastic video about "russians". Ah, well, that's why I didn't get your joke, may be
 
Well @AlmaDo I clearly agree this is not the place for discrimination. I do not like discrimination. I hate the race of "racists". And my argument was about russia not russians which points to politics, but that was a joke and agree that this is not the place for politics also.
 
good Morning #11
 
Hi Fractals
How do you do, julia set?
Mnryuning @HamZa
 
6:59 AM
@Ihsan Morniiiiiiiiiiiiiiiing!
@AmalMurali thanks for the bounty :D
How are you?
 
Fine, finished the robot beta. Now back to RIA. Healthy, fine, found a steady job. Happy.
 
nice
 
@HamZa I wish you have the better.
 
@HamZa: Morning. It's okay :D
 
Ah, I'm studying. I've got some crappy projects but also interesting ones. Part of life :D
 
7:03 AM
Just finished writing this:
0
A: Enclosing the string with double quotes

Amal MuraliAlways use contextual escaping You can't generically "clean" data without any context of what it's for. Do not try to build a single function to handle all the possible cases. Just don't. It's pointless. In your function, you're trying to "clean" the string by removing certain characters. You ca...

 
why 2 answers on same thread?
 
Because they're two distinct answers.
 
7:19 AM
Good morning.
 
good monrings
 
Good morning.
 
morning
 
7:37 AM
The internet need more manuals. Since this answer won't be even parsed — Alma Do 10 secs ago
 
@AlmaDo Actually, correct form is the Internet in that context. ^
E_PEDANT
 
@Leri I've deleted. may be offensive
 
7:52 AM
Morning
 
8:12 AM
Hello, has anyone here tried out generatecms.com ?
 
For a forum-like website that I'm building, I have PHP classes 'user' and 'post'. A user has an array of posts. How to resemble that connection in a relational database? With a foreign key on 'post', pointing to a 'user'? This makes sense to me because of a one-to-one relationship, whereas 'user' to 'post' would be one-to-many.
 
^ yay. now CMS are generated? step forward
 
> Build Custom PHP CodeIgniter CMS in Minutes
Not only E_INDIAN, but step backward
 
lol
 
@Jimbo and that is the largest text on the homepage :(
 
8:16 AM
@iroegbu Ikr, it's like they want to draw attention to the worst bit
 
mornigngin in i inini hghfgh all
 
miornihnhj
I litzerrallyyl can't see
 
you all high today?
 
w hihgih al the time
 
lol
 
8:20 AM
So... current status.
 
at yu mean?
 
What the f* is going on :D
There was barely any snow this winter, and all of the sudden, in mid spring...
Now I know how's it like in Canada.
 
Mornings
 
Morning
 
@DaveRandom morning. do you have a minute?
 
8:23 AM
@AlmaDo For you, I got 5
:-P
 
Where are you again @TOOTSKI?
 
@TOOTSKI: JS pro, halp
 
@DaveRandom ok. I'm stuck. With basics
@DaveRandom why this:
$array = ['foo'=>1];
foreach($array as $k=>&$v)
{
   $array['bar']=2;
   echo($v);
}
will echo only 1
 
@Fabien Current status: Sarajevo.
 
while this:
$array = ['foo'=>1, 'bar'=>2];
foreach($array as $k=>&$v)
{
   $array['baz']=3;
   echo($v);
}
will echo 1, 2 and 3 ?
 
8:25 AM
@AmalMurali No, that was just a joke, I suck :D
 
@DaveRandom the difference is only that in first case there's one element while in second we have two elements
 
@TOOTSKI: I had a question about something but jQuery fixed it for me! :D
 
@AlmaDo Nice.
@AmalMurali LOL
 
@TOOTSKI it's... crap :\
I thought I know how foreach works
 
615
Q: How foreach actually works

DaveRandomLet me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any answers along the lines of "this is how you loop an array with foreach". For a long time I assumed that foreach worked with the array its...

:P
 
8:31 AM
Morning
 
@Touki where's exactly the point which explains such behavior?
I'm aware of how PHP will do the copying. But we have same refcount for both cases. And, more, we're working with references
 
I guess you meant Tootski, not Touki?
 
wikitravel.org/en/Sarajevo Bridge looks familiar :P
 
LSD
‮php
^someone star* that php msg for a sec please
 
well, I've created a question
1
Q: Finally, how foreach works in PHP?

Alma DoSO, I have this issue which I can't explain for now. It's well-known that foreach in PHP works with copy of array. I.e. it copy array first and then iterates through it. All is clear with this. But I have a weird thing with: $array = ['foo'=>1]; foreach($array as $k=>&$v) { $array['bar']=2; ...

If anyone want to get some rep - here we go (:
 
8:41 AM
Good morning! I have a question.
Currently I am building website(s). Via MAMP. But sometimes we are working with 2 or 3 people on 1 website. So everytime we have to move the project from computer to computer or work on an online webserver.

Now because this has lack of backup guarantee we want to find an other solution. How do companies manage this? Do they have a NAS with a local webserver? What is the cleanest way to handle projects locally when developing? Before handing them out to a client?
 
I'd say use version control at the very least
Like git
And then use something like MAMP, or perhaps preferable, something like vagrant.
 
@Duikboot I agree with @Machiel use git
 
At least, that's how we do it.
 
I am using Git. But when you use MAMP/Vagrant you are working locally on a project? Where do you store the files?
 
In Git, you simply commit your files to your repository
 
8:46 AM
The files are stored locally that's how git works:)
 
@AlmaDo ask @NikiC, he can probably tell you exactly what's going on in that specific case. For whatever reason I guess the 2-element version either doesn't trigger a COW at all or doesn't trigger it until after the first iteration, but why that is exactly I can't even begin to imagine. I suppose the could be some compile-time optimisation that sees that the array can only contain one element and optimises the loop away, but I'd be surprised if that's the case
 
Yes but the project... So everyone can access it.
Where would you store it?
 
Once done you push to server and possibly have a commit hook
@Duikboot Centralized server
 
Use a service like github.com or bitbucket
Or githost.io
Or run a self-hosted one at Digital Ocean for example
 
Can't we do it locally?
 
8:48 AM
Locally means not everybody would be able to access it
 
@DaveRandom So I did. I linked your good question to my
 
I mean as development server.
 
2 mins ago, by PeeHaa
The files are stored locally that's how git works:)
So yeah you have that :)
 
@AlmaDo @JoeWatkins would also be a good person to ask
 
Basically in here everybody has it's own LAMP stack and uses that. Once ready shit gets pushed to server
 
8:50 AM
Meh >< Still some parts are not clear. Look. You said use a MAMP setup. For me a MAMP setup = personal. When I setup a project on myproject.local.dev I am the only one able to access it...
 
I like codebreak.com if you want a non public repo @Duikboot
 
I didn't say use mamp ;)
 
True, and your colleague get's his copy of the files on his pc
 
@AlmaDo Related
 
macs are horrible :D
 
8:50 AM
And your other colleague get's his copy of the files on their computer
 
@Machiel Isn't that duplicating work?
Or where would you hold the master version?
 
$ git add .
$ git commit -m "Works!" # Your local repo is now updated
$ git push               # Your remote repo is updated
 
Yeah ofcourse that works
 
The master version is on a central server
 
That is what my question is about
How to start with that? NAS with a linux server built in with apache and mysql?
 
8:53 AM
Like github, codebreak.com (didn't know about this one, thanks to @AlulaErrorpone), bitbucket, githost.io, etc.
 
Then I setup there a virtual host so everyone is able to access it from there?
 
No no
Your git repo is hosted on a centralized server
 
@Duikboot You have a remote version of the work (say on codebreak) and a local version on your PC
You make changes locally, then when you want, you push them to remote
 
Where everyone can check out the master branch or whatever branch you are working on
All three of you get their own copy locally
There you guys run your own development environment, hack away, and when satisfied you commit and push the changes
Then you check out again, and everyone is up to date with all the changes made
 
@Duikboot Pull this repo: github.com/Openponies/RESTfulAPI
If I change and push it, then you can pull again and just get the differences
 
and it will even try to merge that with any changes you've made locally
 
@salathe yo!
 
@AlulaErrorpone Yay for optimistic commit messages. Definitely increases the chances of the code working on the live server.
 
@DaveRandom My commit messages are awful tbh
 
@DaveRandom Hahaha.
 
8:56 AM
'Changes to app.pl'
:D
 
Not working, just stashing code on the repo. looks funny
 
Yeah, W_NEW_LAPTOP
 
git commit -m "Refactored the spline reticulation routines to ensure the auxiliary crystals are aligned correctly after polarity drive has been calibrated"
 
> I have to compare database time to client time .I have a time interval 07:00 to 19:00 hrs and time zone Asia/Kolkata how can I check that client current time is in between that interval or not.Any help should be appreciated.
Tried what have you? — PeeHaa 3 mins ago
 
git commit -m "Fuck this shit, I'm going to get a beer."
 
8:58 AM
@PeeHaa date_default_timezone_set($_REQUEST['tz']); — user3514011 1 min ago
MIND BLOWN!
 
@AlulaErrorpone I pulled it.
 
@Duikboot I didnt mean literally pull it, I meant if you pull it :D
 
Haha
 
alias yolo='git commit -am "DEAL WITH IT" && git push -f origin master'
 
So but when you make now a change
and I do a git status I should see it?
That you have changed something.
 
8:59 AM
@Duikboot Yes
 

« first day (1277 days earlier)      last day (3668 days later) »