« first day (2056 days earlier)      last day (3117 days later) » 

00:25
@bwoebi Some words are here, and are intended to replace everything to "Variance" and also remove the bit about 'intersections' in the patch.
"union_schmunion.md" … interesting gist title…
Also, I strongly recommend removing the bit about "it is somewhat common for a routine that interacts with a database to have one of three results" - this is not universally accepted wisdom....
The line:
> Additionally, the values 'true', 'false' and 'null' will be usable as types in both parameter types and return type definitions.
might need more explanation/justification.....I can see why it's useful and needed but it's broadening the 'type' system beyond pure types, so is something people should be asking about.
I don't like:
> In the documentation on php.net, the two possible return types are documented as 'mixed' - however it is not possible to define a 'mixed' type in PHP code.
This suggests that unions are just a workaround for a proper mixed type
which they aren't
> In the documentation on php.net, the two possible return types are documented as 'mixed' - however this does not actually document what the possible return types are, only that there is more than one possible type returned. Also, it is not possible to define a 'mixed' type in PHP code.
@Danack this is additionally to what? Additionally to scalar/class types? That needs to be written too, I think?
@Danack well, type-less is our mixed strictly seen^^
we have this mixed in a way, just not as explicit type
00:35
> Additionally, this RFC proposes, that the values 'true', 'false' and 'null'
excess commas detected
ah
better
I ought to go to bed, as getting up for work in 6 hours. laters.
good night
@Danack and before I forget it… thanks :-)
00:51
weird, I just saw Danacks face on the web
I was googling for php-fpm and his mug was staring back at me :(
01:15
@Danack I'll integrate your suggestions into the RFC tomorrow … tired now.
02:12
Moin.
Wes
Wes
02:36
\o
 
3 hours later…
05:20
My form is not working..
im very lost, could anyone help
Adi
Adi
hello who's up?
My post function is not working and I cannot figure out why
i will post the code here, give a moment
05:37
0
Q: Can't rotate image before upload PHP

Vintage BeefI want to auto rotate images before upload it. Buy my code doesn't rotate image. I've tried to upload with this image but I always got output with original image orientation. My Code : <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="fileUpload"> <...

Check out my question
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /home/codemqxf/public_html/success.php on line 3



<?php
$url = "myURL";
if ($_POST[username] == "....") {
header('Location: ' . $url, false, 302);
exit; // Ensures, that there is no code _after_ the redirect executed
}


don't see the error its giving
Wes
Wes
you are looking at the wrong file. there is no echo there
Adi
Adi
where is the success.php?
Wes
Wes
also, it's likely $_POST['username']
<?php
if(session_id() == ""){
$msg = echo "No session ID available";
}
else{
$msg = echo "Successful Login!!";
}

?>
take out the echo's?
$msg = string
i think i caught myself
Wes
Wes
05:48
echo $msg = "string"; assuming that you will need the variable $msg later
otherwise just echo "string"; will do it
Understood
threw error cuz i was setting something equal to echo?
Adi
Adi
yes
Wes
Wes
also add error_reporting(-1); and ini_set('display_errors', true); before anything in your files
Adi
Adi
@Wes you know how to retrieve image from database using mysqli prepare
?
Wes
Wes
@NathanMarotta echo can't be used in an expression. must be always at the left hand side of everything, like return
05:51
@Wes why interested in those array functions ?
array_key_index will be very terrible
Wes
Wes
why?
it'll all be pretty terrible actually ...
O(n)
if we include a function like that people are going to assume it has acceptable performance, and it will not and does not ...
if ($_POST[username] == "root") {
session_start();
header('Location: ' . $url, false, 302);
exit; // Ensures, that there is no code _after_ the redirect executed
}
Wes
Wes
i had an use case the other day but i forgot which was @JoeWatkins but yeah, clearly O(n)
than my other .php file
Wes
Wes
05:54
the same you will get using each() and stuff
<?php
if(session_id() == ""){
$msg = "No session ID available";
}
else{
$msg = "Successful Login!!";
}

?>
<html>
<body>
<?php echo $msg; ?>
</body>
</html>
it could be made a little bit better by avoiding hash functions, it's written a bit strange ...
why is my output "No session ID available" ? i start it in the if on the post.php
@Wes each() isn't O(n), code you write with it might be, but you can predict the performance of that because you are writing the code yourself ...
Wes
Wes
05:55
Adi
Adi
can guys check my php retrieve image in database?
http://pastebin.com/1QJxA7Bx
if you write some loop that uses an inversed hash because you think array_key_index has acceptable performance, the code will look nice, but be absolutely terrible ...
Wes
Wes
let's make arrays with a search tree rather than a linked list :B
maybe you are right joe. i don't know
i'd like a seek($array, $key) returning the offset though
@Wes I can't see why the offset is useful
you can't use it ...
Wes
Wes
06:01
yes you can, like for array_sp?lice
do you only write code that is O(n) on purpose ? :D
Radhe-radhe all :)
Mornin' o/
@Wes I don't like it
Wes
Wes
@JoeWatkins TIL this works 3v4l.org/lkrp2 literally this
Adi
Adi
06:05
yow @AdilIlhan can you help me with my code mysqli prepare?
what's wrong?
and why you are still using mysqli? :p
Adi
Adi
can you please check this? pastebin.com/1QJxA7Bx
PDO Rocks \m/
Adi
Adi
i feel comfortable with mysqli haha
@Wes I'll bet that's faster than the patch ...
06:07
yeah? what's wrong?
Adi
Adi
that code does not show an image from database @AdilIlhan
when you're in this position, when you are finding that there is functionality missing, I think you're really looking for a different kind of data structure, because obviously a hashtable isn't suitable ... rather than bundle another million array functions, let's have some proper data structures ...
Wes
Wes
idk @JoeWatkins it might not be optimized but it's not that you can switch data structures all the time just because you want O(1) :P
who said anything about switching all the time ?
the fact that there is one data structure in php is pretty laughable, for a mature language targeting a general audience, which it does ... one, 1, a single structure, uno ... it's so obviously not enough ...
Wes
Wes
well, even just once... would avoid doing that
06:10
you wouldn't be switching anything ...
well, id is should be integer not string @Adi
you would be writing your code to use suitable structures in the first place ...
Anonymous
@RonniSkansing who would do something like that? You do realize for that to work someone would have to call setName() method passing value of $_FILES['file']['name']. It's impossible, even if it was the case directory traversing would be meaningless since you can't upload anything but strictly image files to it
Wes
Wes
agreed, but that's not too bad. it's just iteration and simple integer or string comparison
Adi
Adi
@AdilIlhan
still not working
06:12
you and I disagree on what is bad ...
Wes
Wes
:P
Adi
Adi
@AdilIlhan it directs me to the else statement
@AdilIlhan want to check my upload form?
24th line?
Adi
Adi
@AdilIlhan yes
so, yes
you don't send the id parameter.
06:15
@Adi try once using isset($_REQUEST['id'])
when our minds eye tries to see code we are writing executing, we seem to default to simulating a single instance of the code, we see the O(n) bits and because we are simulating one instance it feels predictable, somehow minimized ... maybe precisely because we are only simulating one instance ...
@adi
take a look at result of var_dump($_POST)
then if dont see id parameter in $_POST
Adi
Adi
before or after the isset?
before.
Adi
Adi
06:17
okay
then you should focus to front-end side
that works, but it's a pernicious way of trying to predict how code really works where we deploy it - at scale - where there maybe 10,000 instances of that code running, sucking the life out of all the hardware we throw at it, just to do simple tasks, just because we only ever imagine a single instance ...
Adi
Adi
@AdilIlhan value is "0"
there must be somthing wrong in here pastebin.com/HF1WXfM9 @AdilIlhan
maybe in here <img src="image_view.php?id=$id" alt="Latest Photo">
i don't know your code. so i can't help you
Wes
Wes
i don't know. if used wisely it could be useful
06:19
take a look at to parameters that send from front-end to back-end
Here is my post method
@Adi <img src="image_view.php?id=$id" alt="Latest Photo"> to <img src="image_view.php?id=<?=$id;?>" alt="Latest Photo">
it's not scary to imagine one process looping through an array to determine an offset ... but now imagine 10% of all your hardware doing it, now imagine 40% of all your hardware doing it, now imagine 90% of all your hardware doing it ... these are situations you will find yourself in at scale ..
if ($_POST[username] == "root") {
session_start();
header('Location: ' . $url, false, 302);
exit; // Ensures, that there is no code _after_ the redirect executed
}
Adi
Adi
@PraveenKumar i'll try
06:21
Than my webpage it redirects to is this
Anonymous
@NathanMarotta bravo
if(session_id() == ""){
$msg = "No session ID available";
}
else{
$msg = "Successful Login!!";
}
@Wes wise is not writing code like that to begin with imo ...
How come my session_id is "" even though i start it in the post.php
@Adi I think this is the problem you are facing try to reply me if solved
Wes
Wes
06:22
@JoeWatkins the problem is returning the offset right? because otherwise it can be O(1)
Wes
Wes
(if implemented in internals)
Adi
Adi
@PraveenKumar still var_dump($_POST) is 0
@Adi try echo your $id in form
Wes
Wes
the offset is not that important, the seek is
06:24
something like <?=$id;?> and tell me what do you get ?
Adi
Adi
yes I tried echoing the id in the form it gives a value of the right id
the thing that makes it O(n) is the fact that you have to loop (n times)
Adi
Adi
in the view image.php it gives me an 0 value
Wes
Wes
@JoeWatkins you don't need to loop if you don't have to return the offset
06:25
@Adi then what is the problem did you tried with $_REQUEST or $_GET ??
Wes
Wes
... got my point?
Adi
Adi
@PraveenKumar i tried _GET['id'] and $_REQUEST['id'] but the output is just a box
@Wes I'm confused, I thought the point was to return an offset, what is it doing if not returning an offset ?
Adi
Adi
not your typical crushed image
you're still looping to move forward (next($arr);)
Wes
Wes
06:27
because locating a Node in userland requires iteration (O(n)) while doing it in internals it would be (O(1))
@Adi try it

<?php

include '../session.php';
require_once 'config.php';

if (isset($_GET['id'])) {

$query = "SELECT `id`, `image_name`, `$updated_photo` FROM `crew_info` WHERE `id` = ?";
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, 's', $_GET['id']);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $id, $image_name, $updated_photo);

while (mysqli_stmt_fetch($stmt)) {

sprintf("%s", $updated_photo);
}

header("content-type: image/jpeg");
sprintf("%s", $updated_photo);
no it won't be
we can't locate a node by offset
Wes
Wes
not by offset, by key
so array_set_pointer($array, "b") not array_set_pointer($array, 2) ?
we can do the former O(1) yes
Wes
Wes
i have no idea what that is but yes
06:30
you want to set the internal pointer of an array to an arbitrary key, right ?
Wes
Wes
yes, which has fast random access
Adi
Adi
how can I send image here?
Wes
Wes
so you get to the linked list's Node fast, while doing it in userland now would require iteration
Adi
Adi
@PraveenKumar no error but also no image
actually, I'm not sure ...
06:32
@Adi i cant help further :)
Wes
Wes
it's not a killer feature, you mean? :P
Adi
Adi
is there something wrong with my code in posting the image? @PraveenKumar
Wes
Wes
brb
@Adi I dont have your upload code..
Adi
Adi
wait
this is my code for uploading the image in database pastebin.com/6WhH3w0P
that code is working.
the only problem is retrieving the images from the database
@PraveenKumar
06:37
whats in your updated_photo field paste a value
> uploading the image in database
don't
I do
Toast tables FTW
how about convert it to base64?
o.O
just model it as a HASA association, and it's fine
@Adi yes dont save image in database upload it to a folder and save only path in database
Adi
Adi
06:41
i dont know that is possible
when i was work as a DevOps Engineer i saw a page. The page was really slow. I checked the page. The page's images was calling through base64 encode
i was shocked
Adi
Adi
so i will save my images in the root folder?
root folder?
read some articles about uploading @adi
Adi
Adi
okay thank you for your help guys
Wes
Wes
06:45
@JoeWatkins what does php.net/manual/en/arrayiterator.seek.php this do?
nvm, it's by offset
@Adi simply check a tutorial for uploading a image in php on google its easy... :)
NOt root folder create folder inside it named `uploads` and then upload in it...
Adi
Adi
@par
@PraveenKumar yes that is what i mean sorry
0
Q: Can't rotate image before upload PHP

Vintage BeefI want to auto rotate images before upload it. Buy my code doesn't rotate image. I've tried to upload with this image but I always got output with original image orientation. My Code : <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="fileUpload"> <...

Hi guys, Check out my question
@AdilIlhan How do you start a session on one page and carry it over to another page?
06:47
php does it for you
i start session with my post method if username is correct
than it redirects to another page, if session id is not "" it shows the data
you have to start a session in each page
51 secs ago, by little pootis
php does it for you
but how do i start the session? because that basically eliminates the whole point doesn't it?
06:49
session_start() ?
Well, something is wrong with my code
krakjoe@fiji:/usr/src/php-src$ cat seek.php
<?php
$arr = [
    'a' => 10,
    'b' => 11,
    'c' => 12,
    'd' => 13,
    'e' => 14,
];

if (array_seek($arr, 'c')) {
        var_dump(key($arr));
        var_dump(current($arr));
}
krakjoe@fiji:/usr/src/php-src$ sapi/cli/php seek.php
string(1) "c"
int(12)
@Wes
Wes
Wes
yes, returning boolean
idk, do you like it? :P
I like it better that the other thing ...
Wes
Wes
would probably be useful to have the same thing in ArrayIterator, a seek taking the key and behaving the same way of this
06:55
you can write tests and run with it ...
is there a page about array_seek in php.net?
@AdilIlhan it doesn't exist :)
i thought it's an old function
Wes
Wes
06:57
lol joe produces internals code like crazy :D
good job @JoeWatkins

« first day (2056 days earlier)      last day (3117 days later) »