« first day (1648 days earlier)      last day (3291 days later) » 

12:49 AM
@PeeHaa +1 to your +1 on the phpstorm issue tracker :)
 
 
2 hours later…
2:20 AM
RETRYING: Is it okay to call a function with $this->$method_name($this->method_args); VS call_user_funct() ? The first method works successfully for me, but I am reading that it is not suggested. True? Thoughts?
 
2:33 AM
@LeviMorrison how would that be useful?
 
Oh it's so incredibly useful!
(Or would be)
It is a finite number of types, some of which have properties.
Beyond being longer the traditional version can't restrict who inherits from the base.
The switch also won't fail if there isn't a match, whereas algebraic data types with pattern matching typically do.
 
2:53 AM
btw, i should clarify that i meant this inquisitively :)
 
I took it that way :)
 
hmm, having case AuthenticationType::UserDb($hash) confuses me.
can't you just have AuthenticationType::UserDb?
 
That's a detail that I'm unsure of.
pattern matching typically allows stuff like this too
case AuthenticationType::UserDb($hash) if ($hash === "*"):
    // do something with password that doesn't have a hash
You could argue that putting the if inside the body of the case is just as good.
 
well, if $hash is out of the scope where you put the match {}, I can imagine it becomes odd
 
Oh, $hash is extracted. I didn't explain that at all; oops
enum AuthenticationType {
        Remote,
        UserDb($hash), // UserDb has a property named hash
        PendingRequest($hash) // PendingRequest has a property named hash
}
That's not passing something to a mythical constructor
And then in the pattern matching the value is extracted:
 
2:59 AM
I know, it probably comes out of whatever you're testing against.
 
case AuthenticationType::UserDb($hash):
 
I won't deny that this is very powerful stuff, but it's quite far removed from, you know, the php way ... disclaimer: without casting any judgment on php itself :)
 
Sure; it's not what PHP has really done in the past.
 
Btw, I think what this would make it shine is to compare it against how you would write it now.
 
Yeah. There's sort of one in the RFC: wiki.php.net/rfc/enum#explanation_of_implementation
But, that uses features that don't exist :)
 
3:13 AM
hmm, so Foo::A <=> Foo::B is 1 and Foo::B <=> Foo::A is also 1 ...
actually, how does the > and < operators work on them?
if A comes before B in the enum definition .. shouldn't it logically compare that way?
 
@Ja͢ck They always return false unless they are the same enum type and value.
@Ja͢ck I agree. Others didn't.
 
isn't that how traditional enums work?
 
@Ja͢ck Using what language as the base? ;)
 
C
 
C has the worst enums of any language I am aware of that has enums.
 
3:21 AM
Objective C?
 
A fair number of implementations use definition order for comparisons.
 
I'm not sure how Java does it
 
The argument against it is that not all enums have a logical order to them. Directions, for example:
enum Direction { North, East, South, West }
 
apparently Java allows == comparison between enum values.
@LeviMorrison while that argument is true, that doesn't mean it should exclude enums that do have a logical order to them.
 
@Ja͢ck Sure; in general you need a comparator function to compare objects, though.
Why should enums be different?
If some property doesn't hold for all enums then it doesn't make sense to have it on all of them.
That's the argument anyway.
I'm still unsure.
 
3:26 AM
This is one of those "no matter what" arguments ... trashing laws of logic shouldn't be taken lightly.
 
I think in some languages you would have your enum inherit the Comparable or Ord type.
 
Now, getting down to the technical implications of being able to order in the manner I've just mentioned ...
 
@Ja͢ck You mean comparing based on the order they are defined in? Would be like a one-line diff.
 
yeah, as in ... Foo::A <=> Foo::B would yield -1.
 
It would be really easy to do it.
It's a matter of deciding what should be done.
 
3:30 AM
not sure how comparison should be done between an enum and something that's not the same enum.
I don't have any strong opinions on that ...
 
@Ja͢ck Do what other types do: return false.
 
yeah, but <=> doesn't yield false.
 
By side effect <=> returns 1
 
yeah
that's in the absence of a comparator.
btw, in the future scope part ... would it be possible to refer to the enum itself as self::? :)
 
@Ja͢ck Probably.
In Java enums can implement interfaces, so you could make your enum JsonSerializable or something like that.
I'm still not sure on that -- I'd prefer to just do abstract data types and rely on functions.
That's one reason this proposal is so basic -- I don't want to make any decisions that prohibit some of these other choices.
 
3:37 AM
that's the next thing i was going to ask you ... persistence :)
persisting only the ordinal value isn't going to work, from what i gather.
ehh, that would work for the foundation portion i think .. but not for the future scope.
 
If #3 in future scope is implemented there would be a method to get the raw value, which is what you would use instead of the ordinal.
And there would probably be a method to create an enum value from a raw value.
 
But as it currently stands, there's no provision for serialising enums, right?
so it becomes like resource :)
 
As per the current patch it works but that's just because I haven't implemented the handlers yet ;)
Some think I should make them return the same instances -- others think of forbidding serialization altogether.
In any case I think this exercise has shown me that the Zend Engine has really bad internal APIs for doing anything remotely like what I am doing
 
:)
I was considering the idea of making certain naked operators return a closure that would actually perform the operation ;)
i.e. $x = +(2, 3);
 
Eh, I haven't toyed with that exactly but I have discussed something like it with several others.
I think we need operators to be syntactic sugar for function calls.
 
3:46 AM
would be fun to implement array_sum() like array_reduce($arr, +);
Though, it would nicer like $arr->reduce(+) heh
 
Nah, algorithms work regardless of data type.
They shouldn't be methods.
reduce should work the same on every iterable data type.
 
that's fair
 
I mean, if PHP was a fully OO world where literally everything is an object then reduce should be a final method really high up the chain on Iterable.
 
yep yep
 
I can actually implement algebraic data types without too much trouble (it's a complete and utter hack, mind you, but it's doable)
What is significantly harder is the associated pattern matching that would need to go with it.
(At least I personally think we need pattern matching for algebraic data types to be useful)
 
3:54 AM
dunno, i think this is the first time i'm seeing such a thing ;-)
 
They are just so useful.
I have loved them from the moment I learned of them.
 
4:05 AM
@Ja͢ck I could go the ceylon route and have you define enums literally as sum types:
class Bar {}
class Baz {}
enum Foo = Bar | Baz;
;)
This is actually something of an epiphany.
I already understood this but I didn't actually connect it until just now.
 
like bit mask?
 
Not sure what you mean by 'bitmask' there.
@Ja͢ck What do you think about this? gist.github.com/morrisonlevi/fa092aa4ede926c51654
 
4:25 AM
depends on what you mean by sum type :)
 
Basically it means a union type.
Traditionally a tagged union.
So an AuthenticationType is either Remote or UserDb or PendingRequest.
 
I see.
somewhat peculiar syntax, though i understand the implied meaning of it
 
4:42 AM
It's similar to how people want to do have multiple types for things, such as string|false or array|Traversable or SomeObject|null.
(I realize false isn't a type but hopefully you get it)
However, we do consider null to be a type:
> The special NULL value represents a variable with no value. NULL is the only possible value of type null
@bwoebi Teehee:
function f(): null {}
> Fatal error: Cannot use 'null' as class name as it is reserved
I was looking at the parser/compiler to see how I might make union types work and realized this kind of thing would happen :)
 
heh
 
5:03 AM
I'll look at fixing it tomorrow -- need to go to bed!
Thanks for talking about enums with me, @Ja͢ck.
 
hey, my pleasure! :)
 
5:34 AM
moin
 
morning
 
6:07 AM
Bah, can't sleep.
 
You need to count the sheep, not become the sheep ;-)
 
making my way through a document with tracking parameters that my boss wants to add into the new project ... sigh
i'm just glad he's not asking for the user's shoe size
 
morning
 
http://stackoverflow.com/questions/29763581/hebrew-language-not-s‌​ave-in-mysql-database of stackoverflow.com/questions/5287821/…
 
6:23 AM
@MikeM. why didn't you add the close vote?
 
I forgot to add that tag, I am on my mobile.
 
you can issue a close vote using the mobile app
 
I did so.
apparently...
I was on the bus network man that was slow :-)...
 
my SO involvement on a mobile phone is nearly zero, except for commenting and seeing how much rep i'm getting ;)
 
I had nothing else to do in the bus :-) So I had to go on SO with a slow network :-P
By default I am just playing with php on the bus on a local machine but I forgot my Ext. HDD (^_^)
 
6:31 AM
When on the bus I just stare outside and think of unicorns.
3
 
@Ja͢ck I used to do that until I seen elephants running by with a big ass PHP tag on it's sides, so I started playing with PHP instead of staring outside.
 
We have enough strings laying around that it is worth centralizing some of them.
For instance the string "null" is referenced 19 times in php-src.
 
isn't that optimised by the compiler?
 
Only to a degree.
I ran the program strings on the binary ;)
 
haha
 
6:40 AM
@tereško Thanks mate :)
good morning
 
good morning guys
I want to do a mysql database export on click using php code like in this question stackoverflow.com/a/15224166/2083526.Now my question is does this work on windows?The script does not work for me
 
good moringins
 
@MikeM. In which country do you have net on the public transport?
 
anyone direct me to mysql database export script that should work on windows
 
6:56 AM
@ziGi The Netherlands, it's since this year in our busses.
 
wut, they actually have wifi on the bus?
 
Yup xD
 
better wear a vpn condom when you surf, then.
 
xD
 
@ziGi In Germany, at least in buses. I think some trains might get free WiFi, when they're finally in use.
 
7:00 AM
I only check SO and some forum [which is not quite important]
I change my SO password often, so did I just a few mins ago...
 
Angelina Jolie removes teeth in fear of tooth decay
 
xD
 
why change your SO password so often @MikeM. ?
 
Morning
 
Free WIFI
+ LOGIN....
 
7:02 AM
hey gusy what's wrong in the code?? am getting Illegal Invocation in jquery
 $("#choose_image").on('change',function(e){
        var data = {
            'aa' : 'InlineManagement.customImageSave',
            'securityToken' : $('input[name=securityToken]').val(),
            'image' : e.target.files
        };
        $.ajax({
            url : ip.baseUrl,
            type : 'POST',
            data : data,
        })
        .done(function() {
            console.log("success");
        })
        .fail(function() {
 
morning @PeeHaa
 
@PeeHaa morning
 
Good Morning @PeeHaa
 
Is there anyway to get last inserted table name in mysql using PHP?
not the ID
 
o/
 
7:03 AM
\o
 
@MikeM. Well, it's not that different whether it's free and open or not.
 
when I remove image from data then it works fine
however the e.target.files return file object list
 
@user2736704 Please use a pastebin and use the right room. There's a Javascript room, this room is about PHP.
 
@PeeHaa do you know of a way to export mysql db using php code on windows i.e without using phpmyadmin tool?
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
 
7:07 AM
@Gotalove exec('mysqldump db --opt -R > db.sql')
Bonus points for reading the last line of the dump to check whether it is correct
 
hi to all we are new this php.We have download file when we button click .We need to know how may number of download file we tried like this


<?php

//$Down=$_GET['Down'];
$a="hello";
$i=0;
?>
<script>
function echoHello(){
alert("<?PHP hello(); ?>");
}
</script>


<html>

<head>


</head>

<body>



<?php




FUNCTION hello(){
GLOBAL $a;
ECHO $a;
GLOBAL $i;

$i=$i+1;
ECHO $i;
}


$fp = fopen("Count.txt", "r");

$count = fread($fp, 1024);

fclose($fp);
$count = $count + 1;


//Un-comment to display the downloads.
 
@PavanAlapati please use pastebin.
 
@Jack Please guide me how to use pastebin in php .Please explain what is pastebin
 
Have you tried asking google?
 
7:14 AM
@PavanAlapati you can use pastie.org
 
good meurning
 
dunno how google fares with question like "please guide me how to use pastebin in php"
 
thanks to all we will try
 
@FlorianMargaine Aaaaarggh changing avatars!1!11
 
Yes, precious, we will.
 
7:16 AM
@FlorianMargaine I was thinking the exact same thing, but you beat me to it :P
 
@PeeHaa :3
 
:)
@Ja͢ck :D
 
moin
 
Mogguh
 
7:34 AM
Good morning
 
@PeeHaa I hadnt specified the wamps mysqldump location thats why it wsnt working for me.Thanks for the help
 
hi
 
I just made my first vanilla js click listener :P
 
damn it's still exporting a blank
I cant seem to get this php code snippet to export my database in windows pastebin.com/aYLznKRz are there some permissions or anything else I need?
 
Who's nginx adept here? I'm sending 200 Status + Location header and then I see 302 in response. Where that could happen?
 
7:51 AM
@AlmaDo I'm no HTTP expert, but it sounds like a redirection
 
@FlorianMargaine yes.
so that I think nginx default behavior is valid. However, I do not want code to be 302, it must be 200 (because of "restful app")
 
@AlmaDo Are you sure this is an nginx problem and not a application logic problem?
 
@PeeHaa yes. in the very end, app sends 200 + location
but curl shows me response like
 
200 + location is odd
 
* upload completely sent off: 106 out of 106 bytes
< HTTP/1.1 302 Moved Temporarily
* Server nginx/1.7.0 is not blacklisted
< Server: nginx/1.7.0
< Content-Type: application/json
@PeeHaa it is, but there is iOS app which relies on that, so I can't just change it for now
 
7:56 AM
@AlmaDo :(
 
more, if I do
201 + location from app, then I see correct response
* upload completely sent off: 106 out of 106 bytes
< HTTP/1.1 201 Created
* Server nginx/1.7.0 is not blacklisted
< Server: nginx/1.7.0
< Content-Type: application/json
< Transfer-Encoding: chunked
so it appears to be nginx issue
 
@AlmaDo I still don't see a location header?
 
@PeeHaa because I didn't paste it. Here
* upload completely sent off: 106 out of 106 bytes
< HTTP/1.1 201 Created
* Server nginx/1.7.0 is not blacklisted
< Server: nginx/1.7.0
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.5.9-1ubuntu4.6
< Cache-Control: max-age=0, must-revalidate, no-store, public, s-maxage=0
< Date: Tue, 21 Apr 2015 07:44:09 GMT
< Location: {beautiful url here}
< ETag: "0a494ce4a63567940149ef4cd59e4b6c"
< Vary: Accept-Language, X-App-Domain, X-Device-Id, Content-Type, X-App-Id, Authorization
 
@AlmaDo Sorry don't have a nginx box available right now and google turns uyp nothing
 
Morning
 
8:06 AM
mornig
 
@AlmaDo @Danack is quite knowledgeable with nginx if you need someone to more directly ask.
 
good mooning
 
Morning @salathe
@AlmaDo You checked the sites config file?
 
@salathe Morning
 
Usually in /var/nginx/sites-enabled/foo.conf
Also @PeeHaa y u no use nginx?
 
8:09 AM
@Fabor I do use it?
 
Oh right, carry on then...
 
@Fabor it's standard
 
:)
 
good mornings :)
 
@AlmaDo Those site ones are created, not normally a default. Only the /var/nginx/www.conf is default.
Morning Hakre
 
8:11 AM
@hakre Moening
 
@Fabor well, it is like
location / {
        rewrite ^(.+)$ /index.php?_url=$1 last;
        break;
    }
 
why was I using jquery again? plain js is a piece of cake
 
and
location ~ \.php {
        fastcgi_pass unix:/var/run/php5-fpm.sock;

        fastcgi_index /index.php;

        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
 
@MarcelBurkhard so is PHP, but everybody is frameworking :)
 
so nothing special
 
8:13 AM
@hakre yeah I figured... weird though
 
@AlmaDo Here's Danack's in case you want to try changing stuff]
 
@hakre seems like douchebags are more likely to "educate" others than those that do it right
 
Also I meant /etc/nginx* not /var/nginx earlier -_-
 
@MarcelBurkhard no, it's just that the level of precision in communication is subject to the noise to signal ratio.
 
    root     /var/www/html/public;

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }
 
8:15 AM
@hakre sounds interesting, can you elaborate?
 
@MarcelBurkhard it's not that somebody is plain wrong. it's also that the person receiving that information can't differ.
(for various reasons).
 
@Fabor will take a look, thanks
 
@hakre by differ you mean if said person is able to distuingish between good and bad (e.g. practices)?
@hakre but how should that person (someone like me 2 years ago) know that there is a better way? Is one supposed to look up words in a dictionary in school to look for "better" synonyms?
 
@MarcelBurkhard not necessarily between good and bad, just being able to differ. the communication is incomplete.
@MarcelBurkhard by raising the intense of communication to get more signals so it's easier to filter them by pattern recognition.
 
@hakre well, I don't disagree but sometimes it's hard to differ with the limited knowledge somebody has when first learning something
 
8:23 AM
@MarcelBurkhard sure, that is one of the problems in communication.
 
It's the same really when you look for "php tutorial"... prepare for spaghetti code using mysql_* function
 
yes, it's sad each time I see a new question on SO that is actually still using mysql_* functions.
@Jimbo bonjour bonjour!
 
@AlmaDo it's PHP, not nginx. php.net/manual/en/function.header.php: "The second special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set."
 
@hakre I've said before that php.net as an official source should provide more information or even just links to sites like phptherightway.com. That's the only chance we have, because google sucks in this matter. Look up something about css/javascript and you get get to w3schools ^^
 
8:28 AM
One could also leave this as an excercise to the user.
 
but the probability that the user adopts bad practices is sky-high
 
@AlmaDo as a followup on that, forcing the status to 200 after setting the location header seems to work.
 
some of my friends just started a new php repo. Their code looks like they used a php 4 tutorial... :(
 
@PaulCrovella I found that, yes. But I probably won't break RFC. Instead I will go and break a leg to the guy who designed that..
 
@Patrick that's what I observe from anyone starting with php ^^
 
8:33 AM
@MarcelBurkhard If we did stick a link to PHP The Right Way, where do we draw the line on other pages to link to?..
 
somewhat annoying is that setting the location header will overwrite a 202 response, which it shouldn't
 
We don't want to end up with a page like github.com/ziadoz/awesome-php (or, do we?..)
 
@salathe that is a question that could be answered if some people would focus on it, I think that link you posted is even slightly better than having nothing
 
linked from the homepage
 
posted on April 21, 2015 by kbironneau

/* by gouy95 */

 
8:39 AM
moin
 
moin
 
moin
 
moin
 
8:59 AM
moin
 
moin
 
Anonymous
moin
 
<input id="id" class="class" name="name" type="hidden" />
 
 
Anonymous
he broke it. damn
 
9:08 AM
@Jimbo No, I did
 
Anonymous
@MarcelBurkhard Y U NO say 'moin'?
 
-1 billion internet points for @Marcel ...
 
@samaYo nope, almost lunch time
 
Still moin if almost
 
boo!
 
9:10 AM
How many strawbs are left @DaveRandom?
 
I'm tasked to look at reactjs and decide if I'm going to implement this as our whole front end for this application with a couple of million legacy LoC
 
Enjoy
 
Yeah, Facebook uses it so it must be good
@DaveRandom is a JS slag now, you used reactjs man?
 
9:27 AM
@Jimbo I think both the JS and the html/css/webdesign people seem to like it
 
it's my BD today, so enjoy guys :)
11
 
<blink>Gratz with your birthday @SergeyTelshevsky!!!!</blink>
8
 
@SergeyTelshevsky Happy birthday. And. You bastard.
 
@Jimbo better delete that without evidence before anyone sees that
 
9:30 AM
@SergeyTelshevsky %&@#$@!
 
@SergeyTelshevsky Happy Birthday! You are 2 days before me :-P
@kelunik I know the people on my network... Do you know the people on a free and open for everyone wifi spot?
 
Yo guys, who knows the name of that fancy-hipster eCommerce platform, their name starts with "S"... Sylus, Siliyus, something weird like that. Any help is appreciated.
 
@Jimbo I know a guy who knows react pretty well if you want
@Loktar in the JS room, US timezone
maybe he can answer questions or stuff like that
@PeeHaa btw, did you try to scan my avatar? :D
 
@FlorianMargaine Nope not yet. Will do so after lunch :)
 
@PeeHaa sorry it's not super interesting
 
9:42 AM
:(
 
Some "about me" text with a couple of links
 
@Fabor Maybe half?
@Jimbo I haven't done much JS recently actually, or much front-end in general
 
@DaveRandom They're a bit more-ish. Haven't had any in along while
Work internet is being real terrible. Just did a speed test and got 1 down 10 up
 
@Fabor Tell your colleagues to stop watching porn and do some work
 
heh
Even if they were we get about 40 down normally.
 
9:53 AM
wait
you have more up than down?
 
@Fabor GBit/s?
 
lol
@FlorianMargaine yeah. Something isn't right. I don't have access to router though. Up to the boss to sort.
 
Or are you working at an IX? Then it's rather TBit/s …
 
$boss->sort();
 
I think slow internet follows me around.
Sweet I guessed the router pass :P 1337 h4x
 
ThW
9:57 AM
Morning
 
bossort()
 
@PeeHaa needs moar marquee
 
Morning ThW
 
@ThW mornin'
 
Not sure whether to be proud of that, or not...
 

« first day (1648 days earlier)      last day (3291 days later) »