« first day (1748 days earlier)      last day (3200 days later) » 

12:01 PM
posted on July 30, 2015 by kbironneau

/* by Nathan Clement */

 
omg, I agree with pierre about a thing ...
 
@JoeWatkins OK, who drugged you?
 
fucking youtube
 
I'm ... not sure ...
 
heh
 
12:05 PM
not only they fucked up the android app, but now they also fucked up the subscription page on a browser
 
@tereško Not sure they're in the habit of drugging people
 
Who do I have to agree / disagree with to get drugs?
 
agree with @PeeHaa, he's an expert
 
I'm in it for the drugs :P
 
@JoeWatkins Pierre does sometimes say agreeable things. :)
 
user895378
12:24 PM
> The US is seeking the new supercomputer, significantly faster than today's models, to perform complex simulations and aid scientific research.
 
user895378
"perform complex simulations and aid scientific research"
 
We do what we must because we can
 
user895378
We're really only about advancing science in the USA lol. Totally not interested in it for defense purposes.
 
Evident when you guys screwed us in knowledge sharing with the WWII nuke.
For the second time
 
@samaYo 20x performance in ~10years? sound not too difficult, considering Moore's law
 
12:27 PM
@rdlowrey Yeh, sure, "defense". It's interesting how the US have redefined invasion and occupation as defending one's self.
Also, learn to spell defence.
 
> I'm not sure why nobody has replied to you yet, we've all looked at the
PR and spent a lot of the day yesterday discussing it.
Not sure if serious
 
well, it was mentioned about 20 times ...
 
user895378
@DaveRandom Yes, "defense" :)
 
user895378
dr_evil_airquotes.jpg
 
there isn't really that much to discuss, but it kept coming up ... someone should have replied him ...
 
12:30 PM
Hi friends,i have one dbts
 
@DaveRandom As it is said, attack is the best form of defense...
 
i upload one high resolution image with watermark, after uploading my image size is double?how its happen?
any idea?
 
Seriously, how that fuck did we end up with this insanity with integer sizes and what different languages call things? Esp int/integer and long, I have no idea what size those things will be in any random env
 
here is my code: $var = $stmt->execute(). Now I want to check this: if ($var === true) OR if ($var == true) ?
 
@Arundivakar it gained weight? did you look at the picture? How much are they wearing?
 
12:39 PM
@DaveRandom the integer issues are so bad in fact that I gave up on one project (a binary client for OrientDB) after spending two weeks plus trying to work around 32/64 bit inconsistencies. It's supposed to get better in PHP 7 with 64-bit support everywhere, except (obviously) on 32-bit systems. IMO they should stop building/supporting the 32-bit build. (who still has 32-bit hardware laying around? if they do, they're surely not going to run the latest generation of PHP on it.)
 
At least modern languages use u32 / uint32 etc nowadays
 
Yeh, I would be in favour of everything everywhere being migrated to calling everything /u?int\d+/i
 
@Sajad it works both if you really return true for the execute() function. but the last one is specific.
 
even for char/byte -> u?int8
 
@chozilla ,ys,image size is increasing 2 times
 
12:41 PM
(We still won't have control signed/unsigned integers in PHP 7 though, so my own problem wouldn't be fixed.)
 
@chozilla tnx
 
why its happen?
 
@Arundivakar image quality settings?
 
@Arundivakar What do you mean by size? Size of data? Image dimensions? Volume of the sphere described by adding together the heights of the people in the picture, cubing it and multiplying it by 4/3 Pi?
 
Are there defined Constants for the mb_xxx() function encoding parameter?
 
12:52 PM
@chozilla Do you mean for the character sets? If so, then no.
 
@Danack yes, because you can misspell them.
 
Yeh, wtf do you think this is, giving you constants would remove some of the jeopardy, that's no fun!
 
@chozilla You are free to make your own list of constants. They aren't defined in PHP as that would limit the definitions to what were available when that version of PHP was compiled, and not what is possible on the system it is being used on.
 
This room's star queue always amazes me. I come here solely to read it :D
 
I tend to match stuff against e.g. /utf-?8/i since there seems to be no agreement on how it should be expressed
 
12:56 PM
@Arundivakar paste your code
 
@AlmaDo lol
 
@Danack that is an interesting reason, let me think about that.
 
means if i upload 2mb image with watermark after uploading i will get 4mb image how its happen actually watermark image size is very small
 
Anonymous
@Arundivakar most likely becuase you are using default functions without optimization/compression
 
$upload_dir = wp_upload_dir();
$currentpath= $upload_dir['path'];
$currenturl= $upload_dir['url'];

//exit;
//echo "<pre>"; print_r($image_size); exit;
// Store the parts of the file name into an array

$file_name_parts = explode( '.', $_FILES['file']['name'] );
$extension=$file_name_parts[1];
$imagename=$file_name_parts[0]."-".rand().".".$file_name_parts[1];
//echo $imagename; exit;
$target_file = $currentpath."/".$imagename;
//echo $target_file; exit;
copy($_FILES['file']['tmp_name'], $target_file);
here s my code
 
1:00 PM
@Danack to my knowledge the mb* functions don't use system libraries to do their thing, so the range of character sets possible is indeed fixed at php compile time
it's iconv that leverages the system libraries
 
moin
 
yay interweb is back
 
1:17 PM
hey joe
 
where you goin' with that gun in your hand?
 
@DaveRandom Nice reference.
 
good morning
 
ah
workday almost over
 
Hey Ronni :-)
 
1:27 PM
@DanLugg Indeed. Annoyingly I don't know anyone called Jude.
 
Anonymous
@Orangepill morning
 
@Arundivakar your issue is here imagejpeg($img, $newcopy, 100); change the 100 to an 80 ... you shouldn't see any visible degradation but the file size will be considerably smaller
 
45 mins ago, by chozilla
@Arundivakar image quality settings?
 
@PeeHaa aren't you? don't be shy (:
 
PHP: Pee Haa Programming
 
1:33 PM
(or was it "PHP: PeeHaa horrible programs" ? :-D)
 
hi guys
 
ARGH!
Does anybody have experience with Wordpress and Visual COmposer?
 
On our website, we have edit pages. When the user clicks save, the form is posted to the same page, then redirected to the next page. For some reason, the redirects are taking a long time (like 20 seconds).
 
@John how are redirects being done?
 
I also added -
header( 'Content-type: text/html; charset=utf-8' );
header("Location: " . $url, true, 307 );
flush();
ob_flush();
exit;
 
1:37 PM
Server load? Bad scripting?
 
@Orangepill at the end of the page I have added above script
@Orangepill where shall I put header( 'Content-type: text/html; charset=utf-8' );
in the same page?
@JustSteveKing that's the question
how can I test whether its server load or bad scripting?
code seems to be simple to me
 
@John that's not the issue... everything looks cool there. Does the timing issue manifest itself if you drive to the page without doing an edit?
 
we have photo upload+cropping (7 diff sizes)
+database saving thats it
 
That is what will be taking the time then
How are you cropping images?
 
@Orangepill sorry i didn't get you ...
 
1:41 PM
xdebug - profile the thing, save your time :-)
 
I am cropping images using
`include_once("includes/imagecropping/resize-class.php");`
`$resizeObj = new resize($pic);`
//For Website Events Images Crooping And Saving.
`$resizeObj->resizeImage($imgwidth, $imgheight, 'crop');`
`$resizeObj->saveImage($evt_tmp, 70);`
 
@John the actual redirect is probably taking no time at all it's all in the image processing, database work, also I imagine there is cache invalidation happening and some other maintenance stuff
 
@Orangepill okay
 
Yea it will be the image cropping to 7 different sizes that will take awhile
 
as I said I have added this lime at the bottom
I also changed URL to google.com
still its taking same time
 
1:43 PM
Back to my question ;) I have a WP site where I created a shortcode to grab a custom post type by ID, however as it is using Visual Composer it is spitting out the garbage code from that - how can I get it to render properly?
 
@John your best option is to do what @mindplay.dk said. profile with xdebug
 
@JustSteveKing but when i log the timing of image cropping then its taking 5-6 secs and remaning is like 0.004 sec
so it mus redirect after 5-6 logically
@AwalGarg that will be welcome when its happening on local .. its just happening on server. :(
nope that is not the code anywhere is used
haha
you mean sleep(20);
 
if it turns out it's the image creation, I would suggest you work up a deferred image creation system... it's not as difficult as it sounds - make sure your image URLs follow some kind of pattern, e.g. "images/profile-123.jpg" source image at 500 px might be "images/cache/profile-123.500px.jpg", as long as it's a pattern you can parse.
Set up a rewrite for missing files in "images/cache" folder to a PHP script that generates (and sends) the file. Now you don't need to generate images in advance anymore, you just generate URLs - the script generates the image versions the first time you hit a missing URL.
Deferred image creation is a good idea under any circumstances - you won't be generating images that never get used.
 
@John the meta-redirect metatag has a seconds value that you can set.
 
@AlmaDo Yeah I totally am
 
1:49 PM
Hey,
 
What do people need? mdma? meth? acid? pot? bath salts?
 
right now they are dying for the windows 10 update
 
@PeeHaa so you're on it right now? (:
 
@AlmaDo Nope. Just opened my first beer though
 
@PeeHaa bath salts sounds good
 
1:51 PM
@PeeHaa Im back with a WP problem :P
because we all know how much you love WP
 
@chozilla but that is not the case we can use here
 
WP means Wild Piss, isn't it?
 
@FlorianMargaine I have heard some rumors that it actually isn't good :)
@JustSteveKing lol
 
@john isolate the image resize to it's own file and test the timing on that by itself. If the image is not going to be used in all seven sizes you might be able to just get away with saving the original and resizing when the image is requested (with result caching of course)
 
Bloody Visual Composer!
@PeeHaa trying to get it to render shortcodes
 
1:52 PM
@PeeHaa it's pretty good, from firsthand experience
 
@JustSteveKing I actually like that thing
Imo it's the best thing in WP
 
@john something like this
 
WP === windows phone or wordpress? I guess latter but former is also somewhat popular these days :P
 
@AwalGarg Cutting yourself is popular too, but I'd argue that it isn't a good idea.
 
@PeeHaa I created a shortcode to grab my custom post type, which is passed an ID from a Visual Composer Element, however on the front end it is showing the raw VC code
 
1:55 PM
Don't you have to register that somehow somewhere?
Just put global somehwere and it will work
It is wordpress after all
 
LOL
 
Matcher::match(Context $c, Mutator &$m) : bool I... I don't know why I do things.
 
@DanLugg is & necessary?
 
@Orangepill Unfortunately yes.
 
@DanLugg Typo. Should be Mutilator
2
 
1:58 PM
Thought php object where pass by reference out of the box
 
^^ Would rename if it were the same number of characters.
 
@PeeHaaI feel stupid ....
 
@DanLugg :D
 
I was returning instead of echoing ....
 
@Orangepill Yes, but this reassigns the object.
 
1:58 PM
Yes you should feel stupid and bad
 
ohh I see...
 
@DanLugg Use some kind of mutable container then
 
The Matcher applies a predicate to the Context, and returns bool accordingly. However, it also assigns a Mutator if the Matcher's predicate results in changes to the Context. So, then Mutator::mutate(Context $c) : Context is called.
@DaveRandom And return the bool + Mutator ?
 
@DanLugg "reassigns the object"
WTF dude
 
2:00 PM
No, just to avoid the reference
 
:P
 
@PeeHaa Err, assigns by ref. It should be null going in.
@DaveRandom Right, so I'd return [bool, Mutator] or something.
 
Have mutator extend exception, and throw the result #yolo
 
lol
 
BRILLIANT
 
2:01 PM
You are a serious asswipe
 
inorite
 
both of you :D
 
posted on July 30, 2015 by kbironneau

/* by Vooodoo */

 
foreach ((function () {
    yield new Mutator;
})() as $mutator) throw $mutator;
 
@DaveRandom that's brilliant! I'm never using return statement again ;-)
 
2:02 PM
^ => dinosaur
 
Q: Can my function return to a different function higher up the call stack?
A: YES! THROW THE RETURN VALUE! THROW IT HIGH, THROW IT WIDE! HAIL MARY! HE'S GOING FOR A TOUCHDOWN!
@DaveRandom I should've used send and thrown from the generator.
 
@Orangepill yes same original image is called and used on each 7 time so may be 700kb of image is called 7 times ..
this might be the issue.
 
throw... the goto of the 21st century.
 
but when I just keep creating original image then also same situation arises. :(
 
2:05 PM
$g = function() {
    throw yield;
};
Um.
 
haha, whoops, I broke PHP again


function make_fun() {
return function () {
static $value = 1;

return $value++;
};
}

$a = make_fun();
$b = make_fun();

var_dump($a(), $a());
var_dump($b(), $b());

Static is not so static now :-D
 
@DanLugg Just write throw $x instead of $g()->send($x)? What are you trying to do?
 
ImageMagick is useful for creating different sized images?
 
@mindplay.dk How's that? It's static to the closure's scope.
 
2:07 PM
seriously though @DanLugg, I meant something more like pastebin.com/5yrBnmCa - whether it gains you anything is debatable, but at least it avoids the ref and enforce type safety on what was the out param
 
how is it static then?
 
@kelunik I'm trying to be convoluted. And you're ruining my fun.
 
@John That's not really a question, it's a statement with a question mark on the end. Not the same thing.
 
@DaveRandom Ah, gotcha. I dunno if that'd save me anything. The byref isn't such a bugaboo to me.
 
@mindplay.dk you are returning a new function that defines a static within it. They are not the same function they just happen to contain the same code
 
2:09 PM
@mindplay.dk Static variables are only static to the local function scope. When you do return function() {} you are instantiating a new closure. Technically $a and $b are two different functions. So they each have their own static variable.
 
@DaveRandom I was thinking rather wrap up the bool and Mutator in a return type.
 
@DanLugg I'm not sorry. :-)
 
;-)
 
s/a new function/a new closure/
 
@mindplay.dk I guess the real question is, "how are they not static?". Perhaps you had a different expectation of how static variables would behave there?
 
2:10 PM
@danack yeah... sherif worded it more accurately.
 
@DanLugg I have no issues with return [$bool, $mutator]; as an acceptable analog for structs. I used to get all het-up about type safety but if you are really bothered then use a classed VO instead of an array as the retval
 
@DaveRandom I still get uppity about return type safety, even pre-"7"
 
I thought static meant "for the lifetime of the program"? - here it's for the lifetime of the closure instance only.
 
@DaveRandom haha nice catch what about this "Is ImageMagick useful for creating different sized images?"
 
So yea. As much as I want to use a pseudo-struct array, I'd probably class out a type.
 
2:12 PM
@mindplay.dk If you want it to be static for all created closures: 3v4l.org/8XKuW
 
VARIADIC GENERIC TYPE PARAMETERS!
 
@mindplay.dk Well, technically it's for the lifetime of the program, but it's still only static within the local scope of the function.
 
Tuple<T...>
function getASpecificTuple() : Tuple<Foo, Bar> { }
 
An yes #room11 is indeed a very toxic place. Everything you heard about them is true.
 
The real distinction here isn't that the instance lifetime has effected anything, but that you have two different instances (or local scopes).
In practice a function definition in PHP exists for the lifetime of the program. Albeit that sort of changes in cases where you have anonymous functions or conditionally defined functions.
 
2:14 PM
@PeeHaa what happened?
 
I get it now, it surprised me though - the introduction of closures sort of changed the meaning of static depending on context. A static variable inside a closure is really just a property of the closure instance.
 
@kelunik you just taught me something... closures close over the value in the use not in the variable
function make_fun() {
    static $value = 1;
    return function () use ($value){
        return $value++;
    };
}
 
doesn't work the way I would expected it but return function () use (&$value) does...feels like a bug
 
@PeeHaa what happened?
 
2:16 PM
@mindplay.dk Well, there are two different uses of the keyword static in PHP. static could mean a static method or property in a class. Or it could mean a static variable in a local function scope, which is how you're using it here.
 
lol
 
uups
 
@Orangepill Nope, use just captures the variable, it's not a bug.
 
class Tuple <...T> {

    private $v = [];

    public function __construct(...$v) {
        foreach(<...T> as $i => $t) {
            if (!($v[$i] instanceof $t)) {
                throw new TypeException($v, $t);
            }
            $this->v[] = $v[$i];
        }
    }

    public function get($i) {
        return $this->v[$i];
    }

}
^^ That'd be fun and awesome.
new Tuple<A, B, C>(new A, new B, new C)
 

Java

Dedicated to the discussion of the Java programming language a...
 
2:18 PM
OH HAI @tereško I DID NOT C U THAR
:-|
 
Er, it's inconsistent though.
 
@DanLugg I don't see a use case for that. :P
 
In this case it doesn't matter that it's a new context/scope.
 
@kelunik Variadic typesafe containers
 
@mindplay.dk objects are always passed by reference
 
2:19 PM
AHahaha
 
@DanLugg Containers should have exactly one generic type, no?
 
Yeah, but there are two instances here.
 
@mindplay.dk so the & is inferred
 
@kelunik Disagree, variadic type params are super useful; saves you having to define Tuple<T1>, Tuple<T1, T2>, ..., Tuple<T1, T2, Tn>
 
You may have __construct(T ...$t), but all objects would be the same type?
 
2:20 PM
@mindplay.dk Sure it does. A class does not redefine a function upon object instantiation. The definition only happens once. The same is not true for closures. Each new closure is a new function definition.
 
@kelunik Right, that's not the goal here.
You still need to typecheck in the method body, but the type is generic and is enforceable.
 
@DanLugg You can define those types, but you can't use them anywhere then?
 
@John I believe the summary answer is "Imagick Is Awesome And Does All The Things" but I've not used it for ages and I don't know that much about it. @Danack is you best bet, not sure if he's about atm
 
@mindplay.dk I see what you mean... but static in this case is referencing scope not lifetime of the variable
 
@kelunik I don't understand.
 
2:21 PM
Ah, I get it - only the object is new, the method isn't new. Got it.
 
@John I prefer it ... can do a lot more with it then gd but I think it eats more resources
 
If you have Tuple<T, T2>, you can typehint methods and return types with either T or T2, but how would you do that with T...?
 
@mindplay.dk Yes, in other words, the function has nothing to do with the object :)
Static variables are just compile-time initialized variables bound to the local symbol table of that function.
 
@kelunik Oh, well, the typecheck would have to count type params where applicable.
 
@Orangepill depends - if you're resizing huge images, IM can be more efficient than GD, both memory usage and CPU time.
 
2:23 PM
@DanLugg Count them? I don't understand.
 
@mindplay.dk and it gets much better results when doing small resizes (squeezing a few pixels as opposed to thumbnailing)
 
Generics, what are you guys talking about, not PHP?
 
morning
 
@mindplay.dk Wishlist for PHP.
 
2:26 PM
:( @PeeHaa is cool, I hope nobody was trolling them
 
@DaveRandom It would actually be good if people referred anyone asking to Imagick to phpimagick.com as it has pretty pictures.
And I suck at whoring that site out search engine optimization.
 
@kelunik yeah, it's on my wishlist for sure - on a related note, I wrote this:

https://github.com/phpDocumentor/fig-standards/compare/master...mindplay-dk:features/generics
 
@PeeHee I can post more kitten GIFs if you like? :)
 
@john imo ImageMagick is to Photoshop as GD is to MS Paint
 
If I could have support for generics in php-doc and my IDE, I wouldn't care so much if it's supported in php or not.
 
2:29 PM
@Danack stackoverflow.com/questions/tagged/php+imagick 785 questions, not too shabby
 
Much higher on my wishlist for PHP is complete gradual typing. With return type-hints, we're almost there - except we're not, because there's still no type-hint for properties. To that effect, I wrote this:
https://wiki.php.net/rfc/property_type_hints
 
@Danack Duly noted
@Orangepill Err... I think you meant that with photoshop and GD the other way round
 
@ScottArciszewski About half the questions are about people having problems installing it (due to just grabbing random libraries from download sites) and of the remaining questions, all of the interesting ones are so specific to a user, that they barely gather any upvotes: stackoverflow.com/…
 
Also accessors. With that, and property type-hints, PHP would start to compare with modern gradually-typed languages that were designed that way from the ground up. For some reason, we have to inch towards a complete, consistent type-system with one new feature added every 5-6 years ;-)
 
ah I see :\
 
2:32 PM
@mindplay.dk Any RFC on property type hints should have a big section on how references will be handled
 
k, I'm going to be tackling file uploading in a blog post soon
 
And another big section on how you're going to deal with initialization
 
@NikiC that's a damn good point.
@NikiC another good point - that's the first constructive feedback I've gotten :-)
 
and a little bit of post-upload image processing advice might help some people ;)
 
@ScottArciszewski What advise would you give?
 
2:35 PM
Is there a "nice" way to store json into a mysql database?
 
Yo
 
Suggestions? I have a program here which has an include of the following: include("/home/.cmsapp/class.client.php");
But i cannot find that file :P
 
@chozilla what do you mean by "nice"?
 
@Orangepill don't blindly just copy files into a publicly accessible folder (under your document root) and let people execute freshly uploaded .php files, for starters ;)
 
@Orangepill "nicer" than just throwing it into a TEXT column like i do right now.
 
2:36 PM
@ScottArciszewski Sage advice
 
@Duikboot Did you check with ls -al? :P
 
@chozilla that's how I do it... but it feels dirty.... and not in a good way.
 
@NikiC I guess for type-hinting to be truly complete, you would need to add type-hints for variables as well? I don't feel it's as necessary though, as getting to complete type-hinting support for the public interfaces of objects, e.g. function paramters (check!), return types (check!) and properties (miss!)
 
@Orangepill the next MySQL version will have a JSON data type.
 
2:39 PM
@chozilla sweet I was not aware of that. it's going to be fun to see how that is misused.
 
@mindplay.dk type hints for variables..what should happen if you do something like Foo $a = ...; unset($a); Bar $a = ...?
 
@kelunik Yes :(
 
@mindplay.dk I don't see variable typehinting as particularly critical. Most modern languages use inference for the vast majority of local variables
 
In the downloaded files I did, on the online version I only have access to cPanel.
 
@ScottArciszewski :-)
 
2:40 PM
@Duikboot Maybe it's really not there and you just ignore the warning you get?
 
@salathe <3
 
There is no warning.
I have to find that file because there are the DB credentails probably.
 
@kelunik unset() on typed local variables can't "remove" the variable (which is a spooky feature anyhow) and probably should just be equivalent to setting it = NULL. (?)
 
@Orangepill also i am not sure how PHP will handle for example JSON_EXTRACT() of MySQL
 
@mindplay.dk We'd need nullable types before we can set it to null.
 
2:42 PM
@NikiC doesn't inference raise the same questions though? infererence is just static typing without explicit type-hinting. So if $a is inferred as int locally, it's the same as int $a, so raises the same issue with unset(), I think?
 
@mindplay.dk I was referring to your earlier message there. In a typed environment unset() on variables should be simply forbidden. It makes zero sense, just like isset on simple variable
 
@kelunik agreed, which means we'd need generics - unless you decide that all variables are nullable; which is a shitty solution, something I'm really unhappy with in Typescript. It's probably better than the status quo in PHP though? already every variable is "nullable", so it's maybe less of a departure to just maintain that feature.
 
0
A: separating unique error from the rest

Robert CatheyExceptions are objects which contain information. The message of the error type should be attached to that object, so you should just be able to: try { } catch(PDOException $e) { echo $e->getMessage(); } The exception message should be defined when the exception is thrown.

 
Weird weird /home/.cmsapp/ dir is not yet there.
 
@NikiC very elegant solution, disallow unset() - I love that :-)
 
2:44 PM
@mindplay.dk It does not need generics, just ?Type or Type|null
 
@chozilla should work the same as any other function result... biggest issue I think is how type info is transferred back through the driver. and if a requested property does not have a scalar representation
 
@mindplay.dk Except that type hinted values / return types do not allow null.
 
And making types nullable by default is an absolute nogo :)
 
@Sajadq do a var_dump($e)
you will see that contraint violations have a specific error code
you can filter the errors using that error code
 
@tereško your mean is I put that error in if statement as a string?
 
2:46 PM
@kelunik yeah, that's weird and has tripped me up sometimes - like function set_user(User &$user) doesn't work and can't ever be called, if you're expecting to set $user from within the function. Instead you have to write set_user(User &$user = null) which works, but has the unintended side-effect of also making the argument optional. Sorta messed up.
 
@tereško ah, it returns a number ?
 
/home/.cmsapp/custom_mod/xyz/xyz.php
 
@mindplay.dk Arguments should be input variables, not output variables.
 
> Returns the exception code as integer in Exception but possibly as other type in Exception descendants (for example as string in PDOException).
 
2:47 PM
anyone knows if that is a existing cms that is using that structure?
.cmsapp and custom_mod ?
 
@NikiC yeah, everything is nullable now though, so it's already a shit show, but I agree - it's a bad solution. I think they did it that way in Typescript to stay closer to how it works in JS, but it's been widely criticized. Facebooks type-checker thing has a better solution, with a generic Nullable<> type.
@kelunik of course, but it's our only means of returning more than one value, unless you return arrays, which, like, no thanks.
 
@mindplay.dk I don't see why Nullable<> is helpful there, ?Type is fine.
 
Maybe it's this? modx.com/get-modx
:P
 
    } catch (\PDOException $e) {
        if ((int) $e->getCode() === 23000) {
             // UNIQUE violation
        }
    }
 
?Type is just sugar for Nullable<Type>
 
2:49 PM
@kelunik Isn't ?Type an alias for Nullable<Type>
^^^
 
@mindplay.dk I'd rather use list(...) = func() than references.
 
@tereško I LOVE YOU !!! worked correctly !
 
@kelunik ideally, so would I, but it breaks type-hinting in IDEs, completely.
 
If you return multiple values from a function, you should probably consider splitting it up or returning an object.
 
(I type-hint everything statically, all the way down to local variables if they can't be inferred)
(with php-doc that is)
 
2:50 PM
@Sajad sorry .. I like girls better. Redheads, if possible
 
@tereško :-) ! just one thing: what is (int)in the if() statement ?
 
@kelunik of course, I consider that, but in the case of short-lived values, it doesn't make sense to construct objects. That is, when you're really truly returning two values that aren't related (enough) to exist in a class with any meaningful name.
 
@mindplay.dk How many /** @var ... */ statements do you have inline? I just use them for values sent in by yield.
 
@kelunik not that many, because Storm infers pretty much all local variable types from @return annotations.
 
@mindplay.dk Do you have a (good) example for two (typed) values being returned?
 
2:52 PM
@kelunik hmm, thinking...
(find in files "&$")
 
@Sajad I copied the code from a project. I think it's because I was not betting an integer as a return value there
 
@tereško Amen brother. Amen.
Oh Isla Fisher... it just wasn't meant to be.
 
so I guess json_extract will return a string given this definition CREATE FUNCTION json_extract RETURNS string SONAME 'libmy_json_udf.so'; so I'm assuming that means complex properties will be returned a json strings.
 
What would you do if: you hve setup a system where users can register, login, after they are logged in they can approve their data with a form to confirm a purchase. With a file upload etc.. nothing that magic.

In the backend the admin should be able to do actions like approve and deny people
In the backend the moderators can only look at the data by a url with password protection.
I have to setup that thing it's pretty small but what should I use for it? Is a framework overkill?
 

« first day (1748 days earlier)      last day (3200 days later) »