« first day (2153 days earlier)      last day (3021 days later) » 

07:00
Enjoy.
Its a poor idea
Yes, doing development on your live server is generally a bad idea.
@Sherif i can't make people understand that development on live server is bad>they do direct changes on live server
morning
o/
07:06
@Linus Yea, we can't make humanity less lazy. It's in our DNA.
@Sherif :D
If you're going to take shortcuts the least you can do is take the right ones :/
All this shotcuts gets you is a dead end and a broken car
@Wes hmm? They're all under user control...so I tend to treat them all equivalently, as not to be trusted.
@Sherif but they don't try to understand my points in office they do work in same way whey i try to teach them i am one who is getting trolled.
@marcio Yeah, it's something that is a reasonable trade-off to forbid in new languages. Retrofitting it to a 20 year old language because people are tired of writing $ isn't such a reasonable tradeoff.
07:11
@Linus Did you try using incentives as opposed to deterrents? Sometimes stubbornness is only begets more stubbornness.
hypothetical question for the room: if XMLReader::open() could take a file handle (as returned by fopen) in addition to a uri, would that bother you or would you want it in another method?
(I'm not changing xmlreader, but trying to decide about an api based on it.)
@PaulCrovella It would bother me, but not by much. Functions that accept different types for the same argument generally do, but we have a lot of those in php so...
So far I got here: kopy.io/KpfpW ( im just doing it without the xpath way currently )
It's easier to unit test if it only accepts one type. You eliminate half the errors off the bat.
But I only need the 'PHOTO_INDEX' with '1'.
Wes
Wes
07:15
yeah but it requires a bit more care @Danack
@Sherif open is just a 2-line convenience method, unit tests fully cover what it passes through to, so I'm not terribly worried about it
@PaulCrovella already has test coverage != easier to test though. Things that are harder to test are generally easier to fuck up so that means programmer's mistake and time spent debugging as well. That's what I look for anyway.
Did I pass a string or a resource?
woops
@Sherif well i tried both
If I can know the difference by statically analyzing the code I cut down my debug time right away.
that's true, I didn't consider a user's unit testing
07:18
@Linus Well then you're just talking to a stubborn crowd. What can you do :/
:P yeah
@Linus You could try making them wear a Sombrero every time they do cowboy coding like that bnj.com/blog/cowboy-coding-pink-sombrero
Rhetoric is typically a tool to force people to reevaluate their position when all else has failed.
Morning.
mornin
Anonymous
moghdsauf#
07:23
mornin Oldskool,tereško,JayIsTooCommon
Anonymous
o/
Evenin' from Australia!
@Rawrskyes It's always morning on the Internet.
Anonymous
@Jimbo ping
07:26
It's been a while since I've been in any form of chat thing like this!
Anonymous
!!wotd
corybantic: frenzied; agitated; unrestrained.
@Sherif I just wanna say thanks for attempting to answer my question btw; cept I seen you re-read it and realised it wasn't what I was asking!
@Linus people want to be convinced, not coerced or taught by people they dont recognize as formal or subject matter authority. if you have formal authority, set up a rule against changes on the live server. easy. if you dont have formal authority, work on your arguments and become a subject matter authority. harder.
@Rawrskyes Not sure what question that was.
07:28
@Sherif
Woops!
Yes, that's my name. Don't wear it out.
It was the one where I was wanting to know the best way to dynamically select columns to enter data into using PDO
I say best.... but I mean better than what I was using...
IS DOING THIS EVEN SAIN :o :o ?
	case 'new':
	case 'edit':
	case 'revise':
	case 'new-recom':
	case 'duplicate':
		$fn->renderFlightNote();
		exit;
		break;
		exit;
		break;
O.o
No that's not sane no
Well... you can be insane and not stupid, believe it or not.
You can also be stupid and perfectly sane...
07:32
i thought so :D
which is the insane part ? the multiple case or the exit or the whole ?
morning
Anonymous
!!docs exit
[ exit() ] Output a message and terminate the current script
morngins all
@Joseph The exit followed by break would be the insane part.
Anonymous
07:32
@Joseph ^^^ have a read, then you'll see why your break is redundant
@Joseph The exit and the exit and break
It would lead to the deduction that this person believes anything can actually happen after they call exit.
To know whether the rest is sane depends in what it is doing and cannot be judged based on the snippet
well the break its because it's inside a case i assume
Anonymous
mon P
Anonymous
07:34
@Joseph Read the link. Find out what exit does.
The break and the intentional fall-through are perfectly sane by themselves.
I'd say that it's just in case you're not able to exit because the door is locked so you have to break through!
i know what exist does lol
look ,
switch ( $act ){

	case 'new':
	case 'edit':
	case 'revise':
	case 'new-recom':
	case 'duplicate':
		$fn->renderFlightNote();
		exit;
		break;

	case 'review':
		$fn->renderReview();
		exit;
		break;
from a android app developper, what would be their preference has of a php middleware to interact with, in your opinion?
07:34
@Joseph yeah that break is just wtf
like what kind of php api?
doesn't removing break gives a syntax error ? :o
Why would it?
Hi everyone, who has experience with yii2 ? I have question
Anonymous
07:36
@PaulCrovella What's the alternative to doing it in ::open()?
well i'd always thought a case is :  switch ( $act ){

	case 'new':
	 something
		break;
who has experience with yii2 ?
@PeeHaa in... handle() or setHandle() or some dumbass method name I haven't come up with
@ShaigKhaligli Bob and Marry have experience with it. They are currently on an 18 month backpacking tour through Europe. They intend to be back sometime mid 2018. We will inform them that you have asked about them.
Anonymous
lol
07:37
I would much rather "abuse" open to add something than having to remember it's in another method @PaulCrovella
@JayIsTooCommon Damn :D
@PeeHaa this is why we get along
@PaulCrovella Ensured mutual destruction?
Anonymous
@Joseph Yep, read what php exit does and then you'll understand why you don't need break or you'll realise that you don't need to use exit :)
Guys sorry for the dumb questions, i am just learning , it may seem evident but sometimes it isn't for a newbie
07:38
@Sherif Great, my question is like that. I am working on project that will use API of another application. So I won't validate password on my app, will do this via API request. I don't want to store users` passwords in db. Just check password by API.

How can I authenticate a user without login credentials?
@JayIsTooCommon thumbs up :)
Would would make the most sense if it is would have been different implementations (basically just different open signatures) but meh might be overkill
Anonymous
@Joseph Wasn't a dumb question :) Gotta learn somehow (Docs is a good start :D)
@Sherif I will check if user`s credentials are valid or not with API, and if valid I will find user_id from database with given email and how use Yii::$app->user->login($identity) ?
Is my name Bob or Marry?
07:40
Also if you want to do it "correctly" you would not base it on xmlreader either way but use contructor injection I think
@JayIsTooCommon not just docs, practice too i'd say . I knew what exit does it's just that you rarely use exit within a case, most cases you just break out and keep going :)
@PaulCrovella why doesn't xmlreader have an explicit ctor btw?
@PeeHaa you can set either a uri with open() or a string of xml with XML(), plus you can reuse the reader itself
@PaulCrovella Oh right. You can pass strings
@Sherif I don`t know who are Bob and Marry ?
07:46
Hey all; is there any benefit to using if(isset($somearray)) in an if statement as opposed to just going if($somearray). It looks to give the same result from what I've seen
The latter blows up when the variable is not declared
@PeeHaa yep, I've got json() as my other convenience method to mirror XML().. want to finalize the reader api before 1.0 so am trying to decide what to do with handles and open()
@Rawrskyes They're not the same. One just checks if the variable is set, the other checks if it's true.
!!> if ($notdeclared) { }
[ 5.6.0 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0rc1 ] Notice: Undefined variable: notdeclared in /in/soB2s on line 1
07:48
@Rawrskyes ^
And that, yes. :)
@PaulCrovella I should probably just give it a proper run to find out how the api works now
@Oldskool It's basically the same in an array though... seeing as setting any value in it will cause it to be true. But I get that if it was an integer or something and it was set to 0 then it'd be false whilst the other would be true.
@PeeHaa there are other differences, I use getters rather than __get magic for direct access to things, but they're minor
Why the dependency on intl? utfuckness?
07:50
But I don't like things blowing up if it's not set. So I'll use isset to stop that :)
@PeeHaa Thanks!
np
nvm
        switch (\IntlChar::getBlockCode($codepoint)) {
276	            case \IntlChar::BLOCK_CODE_HIGH_PRIVATE_USE_SURROGATES:
277	            case \IntlChar::BLOCK_CODE_HIGH_SURROGATES:
@PeeHaa yeah. the current dependency is pretty minor and could be swapped out for userland stuff, but I'm probably going to be relying on it more once I enforce utf-8 strictly
@Rawrskyes The better answer is actually: I'll always initialize my variables to stop littering my code with isset.
basically intl should be in your install anyway at this point
@Sherif I was needing to clear it at the start of a loop. I wasn't sure if unset() produces an error if something isn't set, so I went off on a tangent to find out about isset() as well!
07:55
@Rawrskyes No, it wouldn't, but you're still doing it wrong.
Always initialize your variables. always. every time. at all times.
ugh resources suck monkey balls
Littering your code with isset is a bad habit to get into. It lets you rely on ad hoc runtime checks that don't lend themselves to good code.
@PeeHaa is it a resource? is it a stream? is it not a dir? tada, you have a file (hopefully)
kinda why I want duck typing - all I want to know is if I can fread it
@PaulCrovella You mean get_resource_type()?
@Sherif not enough, opendir gives you a "stream" same as fopen does
need stream_get_meta_data too
could someone trigger a php-src dev with stream api related knowledge to look at this problem?
@PaulCrovella So why are you accepting streams if what you want is specifically a file? Doesn't SplFileObject insure that?
Happy Wednesday :)
@Sherif I could take a SplFileObject as well, but SplFileObject sucks and I don't expect people to use it. Allowing for a streams means people can use file handles, in-memory streams, stream filters, etc. and I don't have to worry about any of that or get in their way
08:07
@PaulCrovella Well, you wouldn't have that problem with SplFileObject either.
You are just forced to use a sane abstraction. The insistence on using a poor abstraction is consequently the pain you're witnessing now.
@Sherif But I wanted it gone at the start of each loop! Was trying to avoid a runtime error for the first time the loop runs, because I wanted a clean variable each time. Is this not the best way to do it? With an unset($variable) at the beginning of the loop?
@Sherif I wouldn't have that problem if all I allowed was a uri either.
Mornings! o/
@PaulCrovella Right
Too many keys that open the same lock gets troublesome real quick.
@Rawrskyes To do what, exactly? Those are two mutually exclusive things. To delete a variable and to check that it's set.
I'm allowing file streams one way or another - that much isn't changing until resources are gone from PHP, so SplFileObject doesn't help here.
08:11
@Rawrskyes do { $var = someFunc(); } while($var); What is the issue you're trying to solve here?
@Gordon yeah fair enough i have some freelance work and i ask them to help me in ui or frontend part in that case do i have formal authority ?
Yes; I thought I needed to check it was set before I unset it till I realised that I don't need to because unset won't produce an error if it's not set.
@Linus well, are you in a position to set up rules or give orders? if so, you have formal authority.
@PaulCrovella SplFileObject doesn't prevent you from using streams. If the abstraction you're using isn't good for solving your problem, come up with a better one.
Better abstractions are desirable. Magic isn't.
@Gordon well if i don't have authority then it's good to remain silent and let the work done in the manner as it is going?
08:14
@Rawrskyes The question is why are you unsetting it at all?
@Sherif I think you're misunderstanding what the problem is, because adding support for SplFileObject doesn't help anything at all.
because foreach doesn't have it's own scope as far as I'm aware?
github question: I have an internal site which is firewalled from the internet, and an external site for my public users to access. Much of the two sites share code, so I'm keeping three files to maintain my codebase (external, internal, and shared). I'm commiting all of this to github, and I'd like to automatically build the two different varieties of sites from the repo. Please give me a hint as to how I should go about doing that properly.
@PaulCrovella Possibly. Except that I wasn't suggesting that you add support for SplFileObject at all. I was suggesting that if you typehinted SplFileObject you wouldn't need to worry about receiving an argument that was a resource but not a file.
hi ti all
08:16
You could easily create your own abstraction that can deal with stream resources of course. That was just one suggestion that's already in PHP.
hi to all
I need last element of $update[][second][][]
I need last element of the part that I named that second
how I can do this with php
@PaulCrovella The problem is you want to make sure the supplied argument implements a specific interface, right? Whether that's a stream resource or a file handle or any of the other stream wrappers, basically.
So then wouldn't it make more sense to just have an interface typehint function open(Readable $handle) where Readable could be anything as long as it has a read/write/whatever` method?
That would be just a thin wrapper over resources basically. That way you defer the problem of validation away from your own abstraction.
[ok] => 1
[result] => Array (
[0] => Array (
[update_id] => 72274274
[message] => Array (
[message_id] => 28
[from] => Array (
[id] => 100407177
[first_name] => ARASH
[username] => arashrahimi46
)
[chat] => Array (
[id] => 100407177
[first_name] => ARASH
[username] => arashrahimi46
[type] => private
)
[date] => 1473223406
[text] => یببس
)
)
)
@Linus no. working on the live server is bad practise. It might be permissible in certain uncritical environments but in general you don't want to bypass QA. if you do a mistake on the live server, it's live for everyone to see. and depending on how hard you messed up, the results may be catastrophic. you know that and unless you are on said uncritical environment you should speak up, because you are a professional.
@arashrahimi I think you'll want to use end($yourarray) to get the last element
08:21
i need a code that returnig me zero that placed in the line
3
@Rawrskyes I used that but not response
its very difficult I think
@Linus like I said: formal authority is just easy because it gives you the power to dictate things. But that's coercion. Subject matter authority is better.
@Sherif The validation is already done in a few lines in my InputStream\Stream handler. It's not that big of a deal really, we were just bitching at how slightly annoying streams can be.
@PaulCrovella Ahh, OK. Gotchya.
@Gordon thanks for that motivation and will try to speak to them :)
you are welcome :)
08:26
How do I link something as code in here?
no one can help me ??
Nvm I got it!
Try something like this... pastebin.com/nwx8jGpp
Ok... I thought I had it...
use pastebin for long code dump
@Rawrskyes hit ctrl-k in the message box or just click the "fixed font" button that appears when you paste a multiline message. depending on the size of your snippets consider using pastebin instead.
Jeeves has plugin for that?
08:28
Bro actually I need the name of the index not the element actually I need to want your function return me the start string
endkey() then if you need the name of it?
Or if you're after the first element then it should be current($array) or key($array)
Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies,
16:50:26 [Apache] improper privileges, a crash, or a shutdown by another method.
16:50:26 [Apache] Press the Logs button to view error logs and check
16:50:26 [Apache] the Windows Event Viewer for more clues
16:50:26 [Apache] If you need more help, copy and post this
16:50:26 [Apache] entire log window on the forums
@Linus We need a better code fragment detection algorithm
08:37
i getting this issue while start in xampp
i tried with skype stuff,even tried to change in config file
still facing issues
can any one help
> Aint no sunshine when she's gone! And she's always gone too long!
aww
nice Sheriff
@AdityaVyas-Lakhan I normally turn skype off as it tends to stop me from running apache
i did that too
You might want to jump into the apache log to check the actual error. Which should be located in... YOURXAMPPDIR\apache\logs\error.log
08:42
@DaveRandom can anyhow i help in that ;p
^ that
thanks will try something for that
But what would be still super useful if you cba rolling it into Jeeves would be something that can, given an arbitrary block of text, extract any code blocks within it
@DaveRandom you've actually used xmlreader.. would it bother you if XMLReader::open() could take either a uri or file handle, or would you want taking the file handle in another method?
(if so, wtf would you call it)
08:45
@PaulCrovella I have no fundamental issue with overloading (in fact I'm all for it in cases like that) however I do have a problem with the naming semantics in that case - a file handle is, by definition, already open.
@JayIsTooCommon @pong
Anonymous
You're in spain now right?
moment let me think what I would call that
@DaveRandom that's my biggest issue with it too.. I just hate the alternatives: handle is ambiguous and setHandle somewhat unwieldy
(and doesn't fit with open() and XML() that it currently has)
what about a $handle property?
08:48
@DaveRandom fuck no
@JayIsTooCommon No not until October 17th
@PaulCrovella in a sane programming language (one with accessors) that is what I would do
In internals you do have accessors
but I do understand that reaction
ugh ffs
@DaveRandom for more context, I'm not actually screwing with XMLReader, just a useland api based on it for parsing json stream
!!docs xmlreader.open
[ XMLReader::open ] Set the URI containing the XML to parse
08:49
^ so, open() is a shit name anyway
it should be setURI()
in which case setHandle() would be obviously right
in error.log it shows this
sorry i am beginner
@PaulCrovella Oh, then that's easy - you want a constructor arg with an overload
which is what xmlreader should do
Oh dear, im totally stuck on this one, I have to add an element to my object: kopy.io/SMtWH
Having the ability to change the data source is a recipe for wtfs anyway
is there something like getppid in php-c that is preferable to use because zval or something or would I just use getppid if I needed to get the parent process id of the running php process?
08:51
@AdityaVyas-Lakhan you used example.com to sign your certificate?
what is that
How the hell can I add interna_reference below the phto_index and phto_url as third property?
@DaveRandom Is it fuck, that's why we abstract (ORM = I've literally switched from mysql to another one before just by changing one config value in Doctrine)
@Jimbo I wholeheartedly disagree. Something like XMLReader is basically a post-processing filter over a stream. Every time to want to deal with a new stream, you create a new filter instance for that stream (because the filter contains state).
@DaveRandom I mostly agree, but I'm trying to hold as close as I can to the existing XMLReader api for familiarity (though I've already switched out property access for getters to avoid __get magic bullshit). I'm unsure how valuable that familiarity is, but it's where I'm starting from for users.
08:54
@PaulCrovella OK then have the ctor arg, make it optional, overload open(), throw if they attempt to call open() (with either arg type) when $this->handle !== null
So people who want to make it work like XMLReader can have that, and people who want a ctor arg can have that, and you don't have the insanity of having to nuke all the internal state when someone gives you a new handle
So basically you have this:
Moorniin
class Thing
{
    private $handle;
    public function __construct($source = null) { if ($source !== null) $this->open($source); }
    public function open($source) {
        if ($this->handle !== null) throw new YourCodeIsBadAndYouShouldFeelBadException;
        /* set $this->handle for path or fp */
    }
}
In fact you know what you know more than me
dammit stupid object ><
can any tell me
what is wrong with xampp
09:00
@AdityaVyas-Lakhan Are you using Laravel?
i dont knw much
@DaveRandom open() is currently taking either a uri or file handle... I'm somewhat concerned about allowing things in the constructor because open() isn't the only convenience method, there's also json() (analogous to XMLReader::XML().. if I take a string in the ctor a user might expect either a uri or json string to be kosher, and I sorta don't want to fuck with that
@Jimbo That kind of business logic in ctor is harmless, because it's still testable, because you can create an instance with no arg and passing an arg is just a proxy call to a public method which you can test (IMHO)
@PaulCrovella Here's what I would do: build a sane API. Include a convenience class which wraps you sane API, providing the API that matches XMLReader. (actually I might not bother with that last part but I'm a grumpy old man and I hate people who want a shite API because they are used to it)
XMLReader isn't that shit of an api :/ .. not enough for me to be grumpy about at least
09:03
heheheh
-1
A: Foreach for an array

Explosion PillsBy numbers do you mean the strings? var_dump(array_values($your_array));

leagues ahead of crap like simplexml
/me adds class_alias(LogicException::class, 'YourCodeIsBadAndYouShouldFeelBadException'); to every bootstrap for ever more
Related meta
17
Q: Multiple accepted answer to a question?

Abhishek gurjarThis question i found here has multiple accepted answers. How come this is possible. Also note that none of the answers are moved to the top. Foreach for an array

You had one task...
@PaulCrovella OK fine, so most of it will just be direct forwarding calls to the internal object... but the very fact that this question has come up at all says that the API could use improvement
@DaveRandom XMLReader doesn't accept a file handle at all, my thing does. I'm just trying to do whatever pisses people off less. :(
09:06
Indeed. So your API is different. So write your API.
(As previously stated, I am something of a grumpy old man on this particular topic)
but naming things is hard
George, John, Dave
yw
name everything @PeeHaa's Mom
@Saitama Only objects can be called that
Also this applies quite a lot to your Twitter thing @Jimbo... sure, you want to maintain compat with an old and not-so-great API, but there's no reason that has to be the only public API
09:08
@PeeHaa that's a good one :P
@PeeHaa it's odd that neither of the accepted answers sort to the top
@PaulCrovella Neither of them are actually accepted
They are in some strange superposition
SO has proved quantum mechanics
but holy shit what a crap question
"I want to have a foreach" so fucking foreach it then
09:12
@PeeHaa why i am seeing two accepted answer?
@PeeHaa wat
That is a candidate for the most retarded question/accepted answer pair on the whole of SO
@DaveRandom It's worse...
Look again
I saw the double accept but shit happens, I'm sure that will be fixed quickly
Shit happens?
How the hell do you mess something like that up :P
someone somewhere will blame caching
09:15
:D
@DaveRandom class_alias can't alias internal classes.
what? why?
god damn it :-(
@DaveRandom Dunno, would have been nice to alias Throwable to Exception on PHP 5 as fallback.
09:28
BOOM
Third party insurer has admitted full liability for the bike accident
I'm gonna have 2 Ducatis xD
@Saitama dude looks stoned as fuck
true...
@Jimbo are you OK?
09:32
@Linus Yeah, crashed J777 PHP because some idiot pulled out on me when I was on the way to give a talk at a user group in July
I was really worried they'd lie and try and get away with it like they do, but they've admitted that it was their fault so I'll get everything sorted
cheers
is bike in enough good condition to ride again?
@Jimbo now buy a VMAX or Ducati XDiavel S
@Jimbo blackjack? hookers?
09:41
@DaveRandom okay fine, I've got setHandle and setUri now.. that okay? do you need it to be setURI? (bastard making me type a few letters)
:-P
I'm not telling you want the API should be, I'm just telling you to write your API and not someone else's :-P
but yeh that is what I prefer, fwiw
the mental gymnastics they go through to deny something is spam should've taken them to rio this year
@DaveRandom Lies. But for real a user's existing context and expectations matters in my experience - and I'm keeping open() to handle either because of it.
@Gordon Another 959 I think! Love that bike, absolutely love it :) 1299 is far too powerful and fast, but you can ride the 959 like a 600
and which do you prefer: Uri or URI?
09:46
Random ping is random ping Jimbo
@PaulCrovella I prefer capitalised acronyms, personally, but I think I am in the minority there (so URI)
@Jimbo you and your superbikes :D
@DaveRandom capitalised acronyms… like MONEY or PROFIT
@DaveRandom I think we're in the minority together. Fuck it, the haters can deal with URI.
hi @SagarNaliyapara
Yes? Mr. @BhavinShah
Random ping is random ping @BhavinShah
Anonymous
09:51
@Jimbo ah ok - coming from spain to NW thought I would see you :)
@PaulCrovella URI, except if it's a class name in PHP, then Uri.
Anonymous
Is it bad practice to throw an exception in a ctor? and then use try{} when initiating the class?
@JayIsTooCommon I'm at NW, I'll see you there?
@kelunik in a method name, e.g. setURI
09:54
@JayIsTooCommon No, I regularly throw \InvalidArgumentException in ctors
@PaulCrovella setUri, but in documentation I always write URI.
Although I'd say an Invalid Argument would be picked up by the global exception handler
Anonymous
@Jimbo Yep :) I'll be there - Just thought we could also share a romantic moment at the airport. And thanks :)
@kelunik part of what leans me toward setURI is it's not an acronym, it's an initialism - you don't say "ooreee" but instead "you-are-eye"
acronyms are pronounceable as words themselves
@PaulCrovella They are? PHP is a recursive acronym.
09:58
it's not, unless you call it ffffp
> ac·ro·nym: an abbreviation formed from the initial letters of other words and pronounced as a word

« first day (2153 days earlier)      last day (3021 days later) »