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

12:25 AM
@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
 
12:35 AM
> 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 :-)
 
12:51 AM
weird, I just saw Danacks face on the web
I was googling for php-fpm and his mug was staring back at me :(
 
1:15 AM
@Danack I'll integrate your suggestions into the RFC tomorrow … tired now.
 
2:12 AM
Moin.
 
Wes
2:36 AM
\o
 
 
3 hours later…
5:20 AM
My form is not working..
im very lost, could anyone help
 
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
 
5:37 AM
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
you are looking at the wrong file. there is no echo there
 
Adi
where is the success.php?
 
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
5:48 AM
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
yes
 
Wes
also add error_reporting(-1); and ini_set('display_errors', true); before anything in your files
 
Adi
@Wes you know how to retrieve image from database using mysqli prepare
?
 
Wes
@NathanMarotta echo can't be used in an expression. must be always at the left hand side of everything, like return
 
5:51 AM
@Wes why interested in those array functions ?
array_key_index will be very terrible
 
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
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
5:54 AM
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 ...
 
anyone?
 
Wes
5:55 AM
 
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
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 ?
 
@Wes I can't see why the offset is useful
you can't use it ...
 
Wes
6:01 AM
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
@JoeWatkins TIL this works 3v4l.org/lkrp2 literally this
 
Adi
6:05 AM
yow @AdilIlhan can you help me with my code mysqli prepare?
 
what's wrong?
and why you are still using mysqli? :p
 
Adi
can you please check this? pastebin.com/1QJxA7Bx
 
PDO Rocks \m/
 
Adi
i feel comfortable with mysqli haha
 
@Wes I'll bet that's faster than the patch ...
 
6:07 AM
yeah? what's wrong?
 
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
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
well, even just once... would avoid doing that
 
6:10 AM
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
agreed, but that's not too bad. it's just iteration and simple integer or string comparison
 
Adi
@AdilIlhan
still not working
 
6:12 AM
you and I disagree on what is bad ...
 
Wes
:P
 
Adi
@AdilIlhan it directs me to the else statement
@AdilIlhan want to check my upload form?
 
24th line?
 
Adi
@AdilIlhan yes
 
so, yes
you don't send the id parameter.
 
6:15 AM
@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
before or after the isset?
 
before.
 
Adi
6:17 AM
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
@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
i don't know. if used wisely it could be useful
 
6:19 AM
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
@PraveenKumar i'll try
 
6:21 AM
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
6:22 AM
@JoeWatkins the problem is returning the offset right? because otherwise it can be O(1)
 
@samayo
 
Wes
(if implemented in internals)
 
Adi
@PraveenKumar still var_dump($_POST) is 0
 
@Adi try echo your $id in form
 
Wes
the offset is not that important, the seek is
 
6:24 AM
something like <?=$id;?> and tell me what do you get ?
 
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
in the view image.php it gives me an 0 value
 
Wes
@JoeWatkins you don't need to loop if you don't have to return the offset
 
6:25 AM
@Adi then what is the problem did you tried with $_REQUEST or $_GET ??
 
Wes
... got my point?
 
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
not your typical crushed image
 
you're still looping to move forward (next($arr);)
 
Wes
6:27 AM
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
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
i have no idea what that is but yes
 
6:30 AM
you want to set the internal pointer of an array to an arbitrary key, right ?
 
Wes
yes, which has fast random access
 
Adi
how can I send image here?
 
Wes
so you get to the linked list's Node fast, while doing it in userland now would require iteration
 
Adi
@PraveenKumar no error but also no image
 
actually, I'm not sure ...
 
6:32 AM
@Adi i cant help further :)
 
Wes
it's not a killer feature, you mean? :P
 
Adi
is there something wrong with my code in posting the image? @PraveenKumar
 
Wes
brb
 
@Adi I dont have your upload code..
 
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
 
6:37 AM
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
6:41 AM
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
so i will save my images in the root folder?
 
root folder?
 
read some articles about uploading @adi
 
Adi
okay thank you for your help guys
 
Wes
6:45 AM
@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
@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?
 
wut
 
6:47 AM
php does it for you
 
o/
 
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?
 
6:49 AM
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
yes, returning boolean
idk, do you like it? :P
 
I like it better that the other thing ...
 
Wes
would probably be useful to have the same thing in ArrayIterator, a seek taking the key and behaving the same way of this
 
6:55 AM
you can write tests and run with it ...
 
is there a page about array_seek in php.net?
 
huh!
 
@AdilIlhan it doesn't exist :)
 
i thought it's an old function
 
Wes
6:57 AM
lol joe produces internals code like crazy :D
 
good job @JoeWatkins
 

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