« first day (885 days earlier)      last day (4289 days later) » 

14:01
The old hotmail web client looked horrible. It was quite old and slow too.
@Jimbo Trolling Java? Nooooooo.... Come back to us, there's no need to go down that dark hole!
lol
It was on "Review First Posts", cut me some slack :P
@Jimbo Never! No slack cutting for you.
@wes with websockets is possible save chat conversations??
user652649
14:15
@Kakitori LOL i was joking about websockets :P you should use xmlhttprequest + dbms
Never focus on backwards compatibility. If you do, you've already lost. Instead design from the ground for forward compatibility...
@ircmaxell let's be fair here: focusing on BC achieved 80% market share. We don't know if FC would have brought the same or more.
@wes XD ok, by the way do you nodejs? is posible to make a web chat with nodejs?
@wes so far, i don't see any nodejs example, or it's just to make app's?
user652649
we are in the php chat so of course nobody here uses nodejs
user652649
nodejs is a blacklisted word here
user652649
:P
I thought C++ was a blacklisted word here, seeing it's a positively inferior language?
@DaveRandom How do you always clone JS objects?
@PeeHaa Depends. dest = Object.create({}, source) or for...in depending on the use case. It's not something I do very much to be fair, I tend to pick and choose the properties I want explicitly.
For your enjoyment: stackoverflow.com/questions/15502024/… (third code block in the question body)
How do I quote something on here?
> text here
> text here
14:28
> [O]ur analysis shows that a city-dwelling techie, who works in the northeast during the spring months, and makes six figures (but under $200k) is the happiest employee in the country. Conversely, if you find yourself working a sales job in Sacramento, perhaps this research will persuade you to pack your bags and take a cross-country road trip this spring.
GoT
GoT
@DaveRandom /vomit
> and for goodness sake, get rid of all try catch statements in your code.
0
A: PDO update error not showing

Your Common Sense i was trying to insert the word "enabled" into a tiny int column it's fairly OK to mysql. 0 will be inserted. how can i show the error message/cause for sql failed commands. for the real errors you have to just setup PHP to display them ini_set('display_errors',1); and for goodness...

@DaveRandom Nice gem you have tere
@DaveRandom Add a REMOVE ALL THE EXCEPTIONS meme comment
It just got better:
> for the real errors you have to just setup PHP to display them

> ini_set('display_errors',1);
> so - you'll be able to see every uncaught exception.
stupid MD
Basically, if you're in tech, in the city, earning £20k to £200k - you're one of the happiest people with a job
14:35
> never use try..catch to handle error message. if you want to have a email on every error (which is just crazy), you have to set up my_exception handler() for this.
dafuq is he on about? I mean he's usually at least got some valid point to make, aside from "turn on error reporting" I have no idea what he's talking about. I get "try and fix the exception cause" but "remove all try-catch blocks"?
I guess his rationale for never using try/catch is that you can handle it all in your exception handler. he probably only ever does logging when an exception occurs
That's absolute nonsense. Not every error is unrecoverable.
@DaveRandom you question the Common Sense? :)
@Gordon I do. I would question him in a comment but he won't respond so there's no point.
14:38
@DaveRandom even if he doesnt respond you could still leave a comment informing potential readers
Burn ALL the try catch's
@Gordon Good point, commented.
@DaveRandom uv'ed
He's updated it multiple times
With his update I can somewhat agree
14:46
There should be tag
Yeh that is a more sensible statement. Although it's pretty clear that this is just debugging code, but I guess it is important to explain to people that echo $e->getMessage(); is not the way to deal with error messages.
2
A: simplest php example retrieving user_timeline with twitter API version 1.1

JimboNote: This now handles both GET and POST methods. I've updated the code below. The above two answers are great from @lackovic10 and also @rivers! I combined them into a PHP class so it's really simple to make the requests you require. This uses oAuth and the Twitter v1.1 API, and works as fol...

Someone just downvoted that, I'm willing to bet I know who did...
@PeeHaa I rephrased it. it was still abrasive
@Jimbo I dunno. He's kinda angry and often not very constructive but not usually vindictive (that I have seen)
he'll probably roll it back. he hates when I do that :)
14:48
How about the PHP source code? — DaveRandom 4 mins ago
Some people just don't apply their brains before asking questions.
Has anybody used Source Gaurdian?
Guardian*
@Gordon Your change has.. changed.. again, lol.
@Jimbo yeah, he apparently really means that try/catch should never be used
lol...
It was a MD fail it would appear
TND
TND
15:08
lol hey guys, I need some help
Our web design teacher is forcing me and a friend to teach PHP to a class, and we fully intend the troll everyone throughout the entire thing
what are some hilarious things we can do while we have the chance? we're thinking of making this bad video with random things in it as an intro and then a PPT with broken english
@TND Compile British PHP and teach them using pound signs etc
TND
TND
LOL
this is a must
mornings
TND
TND
we're going to set up a script on our presentation computer so that randoms gifs of cars crashing pop up while we're programming
and other weird things
there will probably be large amounts of dolan
15:12
@TND Could also do a little 'experiment' and flash pictures at regular intervals, so fast they can't see it (subliminal messages), to make them all really thirsty / hungry or something
TND
TND
lol yeah
The prize for the worst security-related design decision goes to Ruby - for using multiline regular expressions by default
Wonder if it'd work flashing pictures of toilets at the audience.. hmm..
@TND Or you could do a proper presentation and not get smacked on the head for messing around.
TND
TND
this is too funny to pass up
our teacher is incompetent anyway xD
15:16
Which is why he wants you to explain the topic. Smart decision by him. And you are going to make a mess of it.
A little childish, don't you think?
How about focusing on making an educational but entertaining presentation instead?
I prefer flashing toilets.
Thats something worth trying. Most people fail at combining both, but those who get it are heroes.
http://stackoverflow.com/a/14854568/747609
interesting stuff, thanks @NikiC
TND
TND
lol well we'll try to teach at least some
We're already forced to teach java at computer club after school so we're just kind of getting tired of it
@TND Your attitude in the situation is awful. You don't realize this is a HUGE opportunity for you.
@TillHelgeHelwig Yes there are. Typically they are large, critical projects. Think NASA.
TND
TND
15:21
I guess so...
I'm off, I'll see all of you tomorrow. Or not, whatever.
@LeviMorrison Mhm. Not sure if NASA really counts as "on earth". ;)
@TillHelgeHelwig You do your coding for them on earth :]
In my opinion, the amount of software architecting that needs to be done is related to how serious system failures are.
This is why I don't care that much about poorly written websites. Most of the time it simply doesn't matter if they don't work properly.
Sometimes you deal with sensitive information or things with money and you need more design.
@LeviMorrison My main point was that badly written software causes immense increases in costs regarding maintenance and implementing new features...and quite often it seems as if nobody realizes that. There is a use for good programming in non-critical projects as well. Usually money is a critical factor anyway, which is why I'm so confused about this.
15:30
@DaveRandom I disagree with too localized.
There are initially higher costs when doing everything properly. But it will keep the maintenance costs lower, which in the long run will amount to lower costs for the entire project.
@TillHelgeHelwig You are correct but you are also assuming they care about that. Sometimes they don't.
Sometimes that initial low-cost, high-speed release will make your product.
After all, market penetration is key.
Yeah well...I'm working on internal business applications at the moment.
Q: is there a possibility to access remote website so the HTTP_HOST is populated with something different than the "real" URL?
There is no need for market penetration oder anything PR related. It's only about having software to support workflows...and those projects usually run on a small budget.
And keeping the maintenance costs low should be very important in those cases.
15:33
I agree with you.
At least that's what my logic tells me. Apparently my logic is broken somehow.
Architecting software is an undervalued practice.
@LeviMorrison How so? The problem is that he didn't build a valid URL.
Not "valid for the service" but syntactically valid.
@DaveRandom I am not a fan of the Too Localized close option in general.
@webarto Isn't HTTP_HOST just exactly the header from the HTTP request? I've never tried it, but does a HTTP request even work with a wrong Host-Header?
15:35
@TillHelgeHelwig Let's try, I think it does. Although I'm not sure HTTP_HOST is populated from headers.
@DaveRandom It probably should still be closed; I just don't like Too Localized.
By itself I don't Too Localized is valid for a lot of the thing we use it for.
@LeviMorrison You think we need a "PEBKAC" close reason?
@DaveRandom Better than Too Localized imo
15:38
> A client MUST include a Host header field in all HTTP/1.1 request messages . If the requested URI does not include an Internet host name for the service being requested, then the Host header field MUST be given with an empty value.
@LeviMorrison Agreed, but it is the best fitting for the scenario. For that sort of thing I generally answer and close as TL with a view to deleting as soon as the OP has seen the answer so it's just gone.
@TillHelgeHelwig Correct, it's the value from Host header (if any). "Fake" host works too.
@webarto If the webserver can resolve the given Host properly and determine which page the request belongs to, I guess.
@webarto @TillHelgeHelwig It is. And a request is not guaranteed to work with the wrong value in the host header if the server uses name-based virtual hosts, since that is what the server uses to determine which virtual host the request belongs to.
15:40
Yay multiping!
Yay!
So, only way to see if the request came from localhost is by checking REMOTE_ADDR?
@webarto And that's probably unreliable as well.
is this valid?
$obj = (object) [6, 7, 8, 9, 10];
15:42
@LeviMorrison And that was my concern too, thanks.
@iroegbu Yes, but rather pointless imo.
@iroegbu In 5.4+, yes
17
A: How can I detect if the user is on localhost in PHP?

maurisYou can also use $_SERVER['HTTP_HOST'] for which domain name/host is the client requesting. This is much reliable because when the client needs to request, it will need to send the actual host like GET example.com in the HTTP headers. $whitelist = array('localhost', '127.0.0.1'); if(!in_array($...

So, basically this is false and fakeable?
Hello people, whats your opinion on the best way to convert html tags for example i want <strong>hello</strong> to output in bold (normal) and <?php echo 'hi'; ?> i want to output <pre><?php echo 'hi'; ?></pre> so basically i want everything to output in <pre> tags apart from a few i will allow, ATM php tags do not show at all
@webarto That is unreliable, unless you are 100% certain the host doesn't e.g. run a proxy service on the same box
15:44
@DaveRandom oh... my bad
haven't upgraded yet... still using 5.3.4
@webarto I'm not one to base technical skill on things as silly as grammar, but it should have been a clue :]
or is there a function that can find wrapped tags say i have this

Hello john how are you have you seen this

<?php echo 'hi'; ?>

Isnt it cool




is there a function that can find if anything is wrapped in tags?
...and my repwhoring for today is complete. $deleteVotes++
Time to go and burn some...
@Connor You need to replace < by &lt; and > by &gt; in order to output PHP code directly to the browser without execution by the server.
@Connor You can do that with htmlspecialchars() if you have the code in a string.
@TillHelgeHelwig ok Thansk :)
15:50
@Connor For that particular code example, take a look at php.net/manual/en/function.highlight-string.php and php.net/manual/en/function.highlight-file.php, although they may not be exactly what you want, you might want to extract the code blocks and not pass other text through them
@DaveRandom he revised again: stackoverflow.com/posts/15502252/revisions /cc @Jimbo
@DaveRandom that was random
@LeviMorrison The question/answer should be deleted or changed, that's all :)
@Gordon That's a bit more like it, I might burn my comment, it doesn't really apply any more.
I've forgotten how to make large text in posts, I did it accidentally once
15:53
@DaveRandom Thank you
@DaveRandom Server is not running anything but server on port 80 :) Do you know of a way to check if request came from localhost?
Ah, found it
:)
@webarto Unfortunately $_SERVER['REMOTE_ADDR'] === '127.0.0.1' is really your only option. It's not completely fool proof but in the real world it's probably safe enough.
Hmm, so you want a DOM in PHP, maybe google.com/search?q=php+dom ? — DaveRandom 2 mins ago
I almost did lmgtfy
@webarto actually you probably want to test it against ::1 as well, people will start using IPv6 eventually, assuming the end of time doesn't come first.
THX! I found this one really helpful! simplehtmldom.sourceforge.net/manual.htmJuLy 1 min ago
DOM is the first damn result.
15:59
@DaveRandom dont say simplehtmldom when I am in the vicinity. I have compulsory slapping disorder
@DaveRandom But it's simple!
OMG he's posted an answer with a link to it and my name in the same sentence.
curl -H "Host: 127.0.0.1:1337" 127.0.0.1
Array
(
    [HTTP_USER_AGENT] => curl/7.26.0
    [HTTP_ACCEPT] => */*
    [HTTP_HOST] => 127.0.0.1:1337
    [SERVER_NAME] => 127.0.0.1
    [SERVER_ADDR] => 127.0.0.1
    [SERVER_PORT] => 1337
    [REMOTE_ADDR] => 127.0.0.1
)
I'm kind of shocked...
@webarto The only ones that can be considered even remotely sane are REMOTE_ADDR and HTTP_HOST. The others are presumably like that because you haven't got any name-based vhosts set up, or you explicitly configured the server name to 127.0.0.1, which is a really bad idea unless it's a dev server
@jojomodjo Saw it, wasn't particularly amused. I'm all for a bit a childish humour but that's just unnecessary.
16:07
Compare these two functions. I like the second for its readability, but is it ok to use return; in void function?
function example()
{
    // validation etc
    $errors = $user->validate();
    if (empty($errors)) {
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
    }

}

function example()
{
    // validation etc
    $errors = $user->validate();
    if (!empty($errors)) {
@DaveRandom SERVER_NAME and SERVER_ADDR are "real" on production, I thought at least SERVER_PORT is reliable. Thanks.
//do a lot of stuff here
Should be broken into small pieces.
@an1zhegorodov yes, you can use return; in void functions and yes, the second code is better
I myself am not a big fan of having return somewhere in the middle of a function. It can get confusing.
@webarto Oh wait, yeh SERVER_ADDR and SERVER_PORT should generally be sensible, they are generated local;ly
@NikiC @an1zhegorodov I would just return true or false
16:10
SERVER_NAME is manually defined though, and really you can put anything in there
@DaveRandom SERVER_PORT can be faked, as I've shown.
@webarto Errr... wat? What web server? Pretty sure I've tried that before and it didn't work
Trying it again now
Do it, please.
Yeh, Apache 2.4.2-win32/mod_php (the only thing I have readily available) gives me the right port
(the actual port it was received on, not the one from the header)
GoT
GoT
The best way is to check with REMOTE_ADDR. if someone have the application on localhost, he always have the possibility to change the source code
16:15
[SERVER_SIGNATURE] => <address>Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.10 Server at 127.0.0.1 Port 1337</address>
@DaveRandom :\
@iroegbu That would not be a void anymore
@webarto dafuq
I know
@iroegbu How would you document the @return? @return void|bool?
@webarto Actually I can spoof it from localhost, not from a remote machine (which I what I tested it from)
16:18
function example()
{
    // validation etc
    $errors = $user->validate();
    if (empty($errors)) {
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
        //do a lot of stuff here
       return false;
    }
   return true;

}
@DaveRandom Yes, was going to say that. Local machine only (which is good).
Odd though
I can say if (example()) { ... } else { ... }
it's not void I know
but it's easier for me to follow
swap my returns
@DaveRandom I can fake the port on remote machine too, you? Try with Host: example.com:1337 http://example.com/
@webarto No it works as I would expect it to for me
16:22
@iroegbu That's exactly what I try to avoid: ifs with monstrous internals
so, you want to call a function, return 'nothing' and move on?
@webarto Is your server definitely only listening on port 80?
I don't what better way to put return;
@DaveRandom 100% ... let me gist you the output.
@webarto Interesting. I will have a closer look later this evening, see if I can reproduce
16:24
@iroegbu This makes code easier to read and helps to avoid excessive nesting
Hey guys, I've re-written my Twitter answer with pretty pictures if anyone would like to take a look
2
A: simplest php example retrieving user_timeline with twitter API version 1.1

JimboSo you want to use the Twitter v1.1 API? Note: the files for these are on Github. Version 1.0 will soon be deprecated and unauthorised requests won't be allowed. So, here's a post to help you do just that, along with a PHP class to make your life easier. 1. Create a Developer Account: Set y...

@Jimbo i have no idea about twitter api, but you get a +1 for the pictures
@an1zhegorodov it's just a one time check
and the hand drawn arrows obv ^^
for the function
16:26
@NikiC Thanks, I've just spent a lot of time in the hope people can get their code done much quicker ^^
@DaveRandom here is teh output.
@iroegbu As function grows, there will be more...
@NikiC needz moar freehand circles.
Bez
Bez
Been looking at ZF2 quick start implementation and looking at the AlbumTable right now. Suppose I need to create objects that links to an Album object for example; a M:N relationship (many-to-many), how can I achieve this?
@an1zhegorodov nope, you just check for each function that should return 'nothing'
16:28
@webarto I wonder if it's an affectation of fcgi? (although I can't see why it would be)
Bez
Bez
My instinct is to make AlbumTable dependent on more tables related to the relationships. Is this a right thing to do?
@iroegbu What do you mean by this? Didn't get it
@NikiC @DaveRandom Do you guys use any nice arrows for these sorts of things? I see awesome looking ones all the time, but I've only ever done hand-drawn
eg. I want to do user authentication
assume form has values have been collect from form and sanitized
if (user->auth($params)) {
    Session::set('loggedIn', true);
} else {
    /*tell user to log in*/
}
*assume that $params is an array containing values
I can't do that if I have used your fn
@DaveRandom freehand ALL the circles
16:35
@Jimbo Nah, hand drawn is usually fine for me. I'm not going to make example diagrams into a work of art most of the time.
I think someone just accepted my answer and downvoted it at the same time :-S
   [SERVER_SOFTWARE] => Apache/2.2.14 (Ubuntu)
   [SERVER_NAME] => server-name
   [SERVER_ADDR] => 78.46.49.x
   [SERVER_PORT] => 1337
   [REMOTE_ADDR] => 213.196.x.x
   [DOCUMENT_ROOT] => /var/www
   [SERVER_ADMIN] => webmaster@localhost
   [SCRIPT_FILENAME] => /var/www/test.php
@DaveRandom this is CGI.
:-P
I'll have a proper play it it tonight
Sure, real work and stuff :P
True dat :D
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_SOFTWARE] => nginx/1.2.7
[REMOTE_ADDR] => 213.196.76.x
[REMOTE_PORT] => 54502
[SERVER_ADDR] => 192.73.234.x
[SERVER_PORT] => 80
@DaveRandom apache fail or php fail, the question is now.
Bez
Bez
I'm not quite sure whether or not the AlbumTable from the ZF2 official tutorial is meant for CRUD operations ONLY on Album objects and whether or not it should be aware of any relationships to other objects (and how to persist them), say a Playlist object (many-to-many).
chartjs.org this is back.
@DaveRandom +1
Question: is composer only made to handle PHP packages? Can it manage *.js libs, say like jQuery as well?
@iroegbu login systems are hard to get right without failing at least once
16:53
morning ..
@Jimbo +1 nice answer
monring, thanks @NullPonyPointer ^^
check image in aboutme
i have something to show why @Lusitanian want to puppy
how can i replace a new line with /n ?
@Connor I'm going to go out on a limb and say that you probably want json_encode()
@webarto hola
17:03
@NullPonyPointer Lol... totally a guy
@webarto Apache, in that case, pretty clear cut I would say.
no basically i have a paragraph with new lines in a database when i echo it the dont have new lines so i want to replace a new line with \n
@Jimbo yup but i just want to troll Lusitanian by this image
lol
@Connor a newline is \n. did you mean you want to change newlines to br?
17:04
@Connor No, you probably want nl2br() or a <pre> block in that case
or white-space: pre
@Connor For new lines.. I found this: INSERT INTO mytable (myfield) VALUES (CONCAT_WS(CHAR(10 using utf8), 'hi this is some text', 'and this is a linefeed.', 'and another'));
But, that's pretty.. grim..
But yeah, in the DB "\r\n"
@DaveRandom Yes, because PHP has no idea of HTTP except what it gets from Apache?
@webarto exactly. But more to the point, SERVER_PORT is an environment variable, the value of which is determined by Apache
It's weird that it works for me with the exact same Apache version though
Where did you get the Apache build from?
@DaveRandom Eih, I'm not sure to be honest, but I've tested multiple Apache versions and servers, what's up with that?
@Jimbo Actually, json_encode() with JSON_UNESCAPED_UNICODE is probably a good bet for that, MySQL escape sequences match up pretty well with Javascript
Although you'd end up with all sorts of problems with slashes
Actually that's a stupid idea
17:10
lol
@webarto Dunno, I'm going to have a proper play with it later. I'm wondering if it's mod_php vs fcgid
user895378
17:21
I'm guessing that's a failure on the part of the php adapter in use. The front-facing server (be it apache/nginx/whatever) should only ever populate the CGI 'SERVER_PORT' with the real port. If the php adapter changes the value it passes to scripts based on 'SERVER_SIGNATURE' then that's not the web server's fault.
@rdlowrey Just faked entire HTTP_HOST along with port on few shared hostings.
user895378
Yeah, the HTTP_HOST is a particularly vulnerable area.
Yes, but it affects SERVER_NAME and SERVER_PORT too.
user895378
Only in apache. Not in my server :)
Correct.
HAHA
user895378
17:24
I paid a lot of attention to that particular issue and it's impossible to spoof the hostname in Aerys.
user895378
RFC 2616 specifically states that 1.1 requests specifying a hostname not in use by the server should receive a 400 Bad Request response. But that still leaves holes for 1.0 requests (which aren't required to specify a Host header). I've also addressed that situation.
See y'all, have a good evening :)
user895378
@Jimbo laterz
Here we go, @rdlowrey is all mental again.
You've lost me :P
So, whose fault is it really?
1. Apache 2. Apache 3. PHP
user895378
My bet is that it's most likely the PHP adapter's fault, but it's impossible to know for sure without looking at the source code that handles that particular situation on the Apache.
user895378
17:29
There's no reason for apache to give you the wrong value. It 100% knows the server port's real value because it is the server.
Then it's
It seems silly that SERVER_PORT is populated from fakeable field.
Or SERVER_NAME.
Could it be a situation that Apache is not returning this data?
@rdlowrey You seem to be forgetting the most important point though: it's Apache. What it should do, what the sane thing to do would be and what it does are often very different things.
user895378
Ah, foiled by apache!
Anonymous
@Connor str_replace('\ n', '<br/>, $text);
user895378
Successful cross-OS-compatible asynchronous PHP function invocation:
user895378
17:32
$onResult = function(CallResult $result) {
    echo ($result->isSuccess() ? $result->getResult() : $result->getError()), "\n";
};

$asyncDispatcher->call($onResult, 'str_rot13', 'my test string');
@rdlowrey why do you call isSuccess when you only echo it anyway. Just use getResult() and return whatever it is.
user895378
Because if the async function threw an exception or some other error occurred getting the result back to the calling process you need to know about it without bringing down the entire event loop.
user895378
@Gordon Doing that opens you up to program errors if there were an error.
user895378
It's more readable and maintainable to have separate accessors for a succesful result versus an error.
@rdlowrey how so? you have smaller API (3 vs 1 methods). Much more readable and easier to use
17:37
@rdlowrey Share it, share it, share it
user895378
@Gordon Well I personally agree with you but I worried about the situation where you forget to check isSuccess() before calling getResult(). You would get back an exception if an error occurred.
user895378
@webarto soon.
@rdlowrey just do $asyncDispatcher->call(array($result, 'getResult'), 'str_rot13', 'my test string');
@rdlowrey yes, so you wrap it into a try/catch block
user895378
@Gordon But you can't do that for this reason:
user895378
3 mins ago, by rdlowrey
Because if the async function threw an exception or some other error occurred getting the result back to the calling process you need to know about it without bringing down the entire event loop.
user895378
17:39
You're running inside an event loop. If you have a broken pipe between processes performing a trivial async task you don't want your entire app to die.
user895378
You can't just throw.
user895378
You need to inform the application that something went wrong and let it decide how to proceed.
user895378
And you can't wrap the dispatch in a try/catch because it's asynchronous. The function call returns immediately.
user895378
That's not where the exception will be thrown from if something goes wrong.
@rdlowrey I dont get it. You are querying $result for success. and then echo a string. that can easily be moved into $result. instead of letting the callee decide, why not move that check and the decision what it will return inside $result
17:42
Anyone here knows/reads bash.org?
user895378
@Gordon What if you wanted an asynchronous method to return an exception instance? That breaks your method.
@rdlowrey why?
user895378
Hmm ... perhaps we're misunderstanding what each other mean.
user895378
Are you suggesting this:
user895378
interface Result {
    function isSuccess();
    function getResult();
}
user895378
17:45
?
@rdlowrey no. this:
class Result
{
    public function getResult()
    {
        return $this->isSuccess() ? 'foo' : $this->getError();
    }
…
user895378
@Gordon Ah, I see. How would you feel about this ...
user895378
class Result
{
    public function getResult()
    {
        if ($this->isSuccess()) {
            return $this->result;
        } else {
            throw $this->result;
        }
    }
}
user895378
?
user895378
It forces the user to account for the possibility of error with a try/catch and minimizes the API
17:50
@rdlowrey that would be an option, too but your example suggested you want to return a string for error which is why I didnt suggest it
user895378
@Gordon I provided a poor example. The result in the error case is always an exception instance. I just echoed it to display the full traceback.
@rdlowrey i think it is a bad idea when variable is an instance with undetermined interface
@rdlowrey technically you could also return the Exception but that would be mixing return types and you'd be back to asking the objectif it was successful via instanceof
user895378
@tereško You're very right. The above is a shorthand. In reality the error would be stored in a separate property from a valid invocation result.
18:26
Evenings
@iroegbu $user->auth($params) is not void, it should return boolean.
> You are wrong. Here’s why: if code was just for solving a technical problem, then Brainfuck would be as useful as Python.
Yeah because solving problems with brainfuck is just so nice to do
Hello everyone [who read this]
Hello [that guy who just came in here]
18:37
Hello @PeeHaa [because greeting twice is so cool]
@Gordon . . .
Anonymous
@neal long time no Se.e
By the way,
8 hours ago, by Alexander
AFAIK, the is not sorted by date of closing time. Is that correct?
@Alexander correct
I believe we can maximize our deleted votes if we handle sorting in the
The thing scrapes the transcript chronological
18:46
Especially since 10k users can only vote for deletion after quite some time after the question have been closed
@Alexander the entire thing would need a rework I guess
Votes get lost because people follow the list and the list has no stable sorting
@Alexander it was never more than a quickly whipped out tool to assist us
@Alexander votes also get lost because of throttling
@Gordon for example?
18:51
@Alexander the SE.API is rate limited and the backlog does not have an API key, meaning the cv backlog can only do that much requests to the API.
Also for the visually impaired:
@Gordon In that case letting the backlog to increase even more is not a good idea
@Gordon nice edit. No go close it :)
@PeeHaa will handle itself ;)
18:55
btw I banhammered my first user today
@Gordon Gratz. You make me sooo proud lately :)
@PeeHaa let me finish …
@Gordon are you being overly prudent lately?
… since I know how it works now, all of you need to be extra nice to me :P
@Gordon I am always nice to you (since you are a mod)
:D
18:57
@PeeHaa LOL
@PeeHaa oh look, a syco cough elephpant … j/k
This very nice and offtopic questions is now happily accepting delvs from you fine people.
@Alexander no. not overly. I have closed a few questions singlehandedly today. I just dont think this needed intervention
@crypticツ is not here but her votes are :o
@Gordon jk?
I believe a mod intervention is always better. Notice user's votes are extermely limited!

« first day (885 days earlier)      last day (4289 days later) »