« first day (1813 days earlier)      last day (3128 days later) » 
01:00 - 17:0017:00 - 00:00

5:02 PM
should I use something like this in the top of all pages ?
<meta http-equiv="Cache-control" content="public">
 
5:30 PM
hi
 
Hello
my index.php file
<?php
	if(isset($_POST['submit']))
	{
		$name = $_POST['name'];
		if(isset($_POST['name']) && !empty($name))
		{
		}
		else
		{
			$error_name = "Please enter your name.";
		}
	}
?>
<form action="qa.php" method="post">
Name: <input type="text" name="name" /> <br />
<?php if(isset($error_name)) { echo $error_name; } ?>
<br />
<input type="submit" name="submit" value="Insert" />
</form>

qa.php file
<?php
	if(isset($_POST['name']))
	{
		$name = $_POST['name'];
		echo $name;
 
is there anyone who knows about session ?!
i have problem with session lock !
 
hmm .... YIFY official page is down
 
can someone explain it with example in php ?
 
has there been a DNS takeover again?
@mehdi what do you mean by "session lock"
?
 
5:35 PM
im asking that ! you know i just know that when php start a session , the tmp session file is locked and cause of that , some request can be locked ! but i don't know which requests . i really need an example
 
the lock would exist only while PHP file is being executed .. or until session_write_close() is called
that said, you can use other medium to store sessions in PHP
the "save to file in /tmp" is just the default setup
 
can you give me an example of blocking request ?
 
why?
 
you know i asked this question and a person answered me :"PHP default session files mechanic, are blocking while a request has done session_start on the same session_id. Meaning two ajax requests that both do session_start will cause the second ajax request to hit session_start will wait for the first request to do session_write_close"
 
<?php
session_start();
$_SESSION['x'] = 1;
sleep(10);
$_SESSION['x'] = 2;

// this script would probably cause a lock if you opened it in two different tabs on a single browser
 
5:39 PM
so i examined and see both ajax is done at same time !
 
ThW
@mehdi you're sure that the responses were slow enough to see a difference?
 
.. which is why I forced a 10 second delay there
 
@ThW i saw it on chrome timing ! they both started at the same time exactly !
 
@mehdi where those both same requests? Because if a browsers saw two XHR queries to the same link, it would automatically optimize the execution so that only one of those queries is performed.
 
@Andrea did you use screenshots for your slides in order to preserve PowerPoint 97 feeling? :-D
 
5:43 PM
also, browsers have some limits to how many queries-per-domain can be performed at the same time
 
@tereško i run the code you sent but but what is causing the lock isn't session , it's because of sleep
 
the lock is because if the session
if you just leave the sleep(10) in that script, you won't see it locking
the sleep(10) is there just to simulate a "really log running script" .. like a bad SQL query which needs to interact with session
basically, sessions are kept (by default) in a file and what you see there is a file-system lock
 
what do you mean by lock ! i just wait 10 sec for each page (tabs)
 
ThW
@mehdi they can start at the same time, but the php will stop at the session_start() in the second request
 
@mehdi , lemme guess: you are not really good at operating systems
because what you call "session lock" is an OS-level issue
operating system prevents same file to be open for write at the same time and the session_start() opens the session file for writing
 
5:55 PM
so does it mean that you can't write a session at the same time ?!
 
you cannot open the same session at the same time
there is no "read-only" mode for sessions
 
but if we call session_write_close () , can we do it at the same time ?
 
@mehdi just keep in mind that each user has a separate session file
 
@NikiC awesum :-)
 
@mehdi no, that comment moment command (fuck) just closes the session file. Basically: the script relinquishes the control over session at that point and the NEXT script can start using the same session
 
5:59 PM
ok ! got it ! i really appreciate your help ! thanks really
 
o/
 
> visited 1969 days, 1966 consecutive
 
@ircmaxell In a few days it's 2000 :-)
 
yup. and then a few more it's 2015
and a few more it's 2222
 
... emm .. it's about 10 months till 2222
 
6:15 PM
and?
 
it's a long time
you can get a kid in less then that
 
it's 13% of my time there
 
@ircmaxell well… you should write a blog post getters considered harmful. Not getters and setters... Do you disagree? why?
(I mean for values you can set… setters are needed for verification. Getters aren't… you can just read the value.)
 
I do disagree
if you need to set things. then you shouldn't have logic. And if you have logic, you shouldn't have properties
 
@ircmaxell Not talking about actual logic, but just simple bounds and type checking.
 
6:24 PM
use a data structure (class with public properties), and use an external validator if you have non-trivial validation requirements
 
I obviously don't want to validate every single time...
 
@bwoebi why not?
why not set the entire object, and then see if it's valid
 
I'd need to re-validate the object on every single use
 
why?
 
because it might have been altered by code?
 
6:26 PM
what code?
 
I am a bit too drunk to participate ..
 
the code consuming your object API
like, might change a value on the value object between two API calls
 
?
example?
 
$struct = new TheStruct;
$struct->val = 1;
$obj = new Obj($struct);
$obj->call();
$struct->val = 2;
$obj->call();
 
Hello
my index.php file
<?php
	if(isset($_POST['submit']))
	{
		$name = $_POST['name'];
		if(isset($_POST['name']) && !empty($name))
		{
		}
		else
		{
			$error_name = "Please enter your name.";
		}
	}
?>
<form action="qa.php" method="post">
Name: <input type="text" name="name" /> <br />
<?php if(isset($error_name)) { echo $error_name; } ?>
<br />
<input type="submit" name="submit" value="Insert" />
</form>

qa.php file
<?php
	if(isset($_POST['name']))
	{
		$name = $_POST['name'];
		echo $name;
 
6:32 PM
@bwoebi so? you're writing code to do that. Hence that's your problem to validate it
typed properites obviously help, but...
 
@ircmaxell Also, advantage on validating immediately is that you don't have to serach where the struct was set to a faulty value...
@ircmaxell Also… what's that but?
That but is exactly why I think setters (or better property setters (accessors without getters basically)) are a great idea.
 
So you find yourself writing validators for C much?
I have been moving away from a "never trust" coding mentality to a "trust, but verify". Results in far smaller and easier to understand code. What do these setters really buy you?
9993 followers, just 7 more needed
 
7:35 PM
> See 'git help config' and search for 'push.default' for further information.
O.o tnx git for telling me to ctrl+f instead of just giving the info ...
 
lol
 
@ircmaxell Oh, well. That's where I come from… But somehow nearly everyone does it… So, I'm doing it too. I have a hard time to find actual arguments why a "never trust" mentality isn't optimal when coding... Also in general: types are nice here. The only issue is when I know that a function does bounds checking and then I'm too lazy to verify myself.
Though, to be honest, I think, it's the callers responsibility to pass correct values. The point is just that a caller may forget the checking. Then centralized chicking is usually better.
Basically, I think: verification is better than trying. (meaning: check at caller-side, instead of trying and checking at callee-side)
The result is that verification at callee-side is superfluous now… as long as you don't somewhere forget the verification.
On the other hand it's a really rare code that it happens and usually not that hard to verify. But it causes the implementation to leak through in case you need to debug as you usually debug inside-out... But as that anyway could happen in case of bad, but valid values… not that much is won. [the case of unexpected output for unexpected input...] Hence, you'll be always most strict on caller-side, which is always a subset of the values accepted callee-side...
Ultimately, you should ideally check on both sides.
@PeeHaa it tells you to use grep...
 
7:52 PM
I'm viewing the website instead :P
 
cabbage everyone.. a query that has been racking my last one hour.. here it is :
I have a JSON string passed to PHP's json_decode. The JSON string was made using JSON.stringify and passed to PHP via a POST variable corresponding to a text box in the form. When PHP's json_decode decodes the output is NULL. The echo of the POST variable prints fine, and JSONLint says it's a valid JSON string.
This happens only in XAMPP (only since this afternoon and nothing's changed since). When I run the same code on a remote online shared webs server, PHP's JSON_decode works all fine.
 
@WhirlMind var_dump(json_last_error());
That will at least tell you in what direction you need to look
I meat json_last_error_msg
 
Hmm.. looked that as well, it says int(4), meaning json_syntax_error or whichever error.. which is too broad.. wonder how Jsonlint online says JSON string is fine and my remote server accepts..
 
@WhirlMind Can you share the string?
 
8:07 PM
@WhirlMind Works for me 3v4l.org/4XbYZ
 
@PeeHaa : Yup, that's the strange part, doesn't work on my local XAMPP..
 
Are you really sure the string you just shared is what you are using locally?
 
Yes, I just echoed in the local XAMPP .. the string itself is generated using user values being stringified...
There are no user-entered vlaues.. values are generated when user clicks buttons.. values like time n stuff, what you see in the string
Could the # character be a culprit lemme check..
 
Shouldn't be
 
@ircmaxell sometimes it's hard to do something when people disagree and you don't really know how to explain what you feel is bad... Only choice is then doing what they say or your code won't be accepted…
 
8:15 PM
@WhirlMind Can you try to utf8 encode the string for shits and giggles
 
HERRO
 
ohai
 
@PeeHaa : Already tried that one... as also stripslashes
 
@Jimbo caps! :o)
 
user image
3
 
8:18 PM
old people gathering
 
@Jimbo :)
 
I have no idea who these guys are. But ive touched them all
 
Room 11 representing!
 
@PeeHaa : Discovery. Yup, # did indeed turn out to be a problem, fixed it just now. In that dpaste string , there is a for color hex code (CurrColor). I just removed the # from the value and it worked on my local XAMPP server as well. Problem solved. Thanks a lot for the vibe and prodding.
 
@WhirlMind Very strange. But glad you solved it anyway :)
 
8:23 PM
Yup, beats me too. Even now, I am not sure whether it is a XAMPP issue or a browser issue or what... If I think it's a bug, where best to report it, any thoughts ?
 
Bugs can be reported here, but I doubt it is a bug
Can neither be a browser issue because you are working serverside
 
@Jimbo which one is you?
 
The ugly one
 
:-)
 
Hmm.. okay, I just re-created the same bug.. When there is a #, it goes phut. Okay, thanks PeeHaa.
 
8:26 PM
@PeeHaa that doesn't really narrow it down
 
no I'm serious .., which one?
 
:P
@Leigh @Jimbo I assume / hope you guys are drunk by now
 
@tereško the mean of this sentence is: "a beautiful face is not important?"
 
I would have to go with: no
that was not how the sentence was intended
 
bye
 
8:30 PM
later @WhirlMind
 
ok, what should I play: steamcommunity.com/id/teresko/games/?tab=all&sort=name (I cannot decide what to install)
 
"later" means "see you later" ?
 
yes
 
ok
 
@tereško commandos :)
good times
 
8:32 PM
@PeeHaa that's something I have had to put in the "incompatible" list for now
same goes for Sacred
 
Oh that sucks. Same for the gog version (assuming there is one)?
 
some games just don't work on a 3440x1400 screen
 
first world problems...
 
tru dat
 
@Sajad very right
 
8:36 PM
ow, ok :-)
you are not look like a programmer ;-)
I'm kedding
 
most of programmers don't looks like programmers
 
Teresko you should be here man :-)
 
I cannot afford that kind of trip, not on my limited budget
which is why I am currently eyeballing my steam library instead of doing anything fun
 
what is mean of "eyeballing" ?
 
it's basically a synonym of "looking" (with intention to appraise/estimate)
 
8:47 PM
ah
@tereško so why you can not?! you told you have money even for next 3 years ..
 
"next 3 months"
 
ah :-)
 
and making a trip would deplete 1/3 of it .. maybe even a half
 
and it should be noted your personality is not really look like your face!
@tereško I got it - but you are a great programmer, you can take some project and get very money :-)
 
Anonymous
@Sajad How old are you?
 
8:51 PM
23 (actually 22.5)
why?
 
Anonymous
Nothing, just curious
 
ok
 
@Sajad you sound a bit naive :P
 
heh, tnx!
 
Hi guys, Do any one knows how to find the endianess of the system using PHP ?
 
Anonymous
8:53 PM
Nope ^
 
Anonymous
We don't even know what endianess means.
 
@samayo are you sure ?
 
@Gopal Anything where endianness leaks into PHP?
 
@Gopal based on what I see on wikipedia, the answer is: with math
 
Anonymous
Sorry, I thought that was a typo. @Gopal
 
8:55 PM
@Gopal hint: pack() and unpack() should help.
 
@tereško It is related to multibyte ordering
 
@Gopal It should be possible via php.net/manual/en/function.pack.php - in particular signed short (always 16 bit, machine byte order)
But I haven't tried it.
i.e. pack something with machine endianess, and then unpack with little endian, and then look at the output.
 
yup… pack("S", 0xff) == "\0\xff" will tell you.
 
@Danack thanks and let me see.
 
4
Q: How to get the endianness type in PHP?

HomeCoderIn C# I can get the endianness type by this code snippet: if(BitConverter.IsLittleEndian) { // little-endian is used } else { // big-endian is used } How can I do the same in PHP?

Though I still thinking unpacking it first rather than comparing just the pack result would be more thorough.
Middle-endian ftl.
 
9:00 PM
middle-endian? lol
Grrr… common.prototype on Closures is a Closure…
 
> Mixed forms also exist, for instance the ordering of bytes within a 16-bit word may differ from the ordering of 16-bit words within a 32-bit word. Such cases are sometimes referred to as mixed-endian or middle-endian.
 
sound way too Tolkien-esk
 
also known as, fuck intel.
 
@samayo oh, this was a sarcasm?
 
Anonymous
no
 
9:05 PM
ah ok
 
I wonder, what's the transfer rate of my HDD .. maybe it's bottleneck-ing and I should move the "torrent folder" to the SSDs
hmm .. random write is abut 20MB/s so that shouldn't be the bottleneck :(
 
Anonymous
Problem 1
    - object-calisthenics/phpcs-calisthenics-rules v1.0.1 requires php ~5.3 -> your PHP version (7.0.0beta3) or "config.platform.php" value does not satisfy that requirement.
    - object-calisthenics/phpcs-calisthenics-rules v1.0.0 requires php ~5.3 -> your PHP version (7.0.0beta3) or "config.platform.php" value does not satisfy that requirement.
    - Installation request for object-calisthenics/phpcs-calisthenics-rules ^1.0 -> satisfiable by object-calisthenics/phpcs-calisthenics-rules[v1.0.0, v1.0.1].
 
Anonymous
ehh
 
@tereško the speed of turning of your HDD is 5400 rpm or 7200 rpm ?
 
it's a 5400rpm thing
 
9:18 PM
ok
 
Don't play 'warewolf' with Fabien he's a cheating Arabic looking bastard
 
@samayo --ignore-platform-reqs
 
Anonymous
Thanks that worked.
 
Anonymous
fake
 
Abe
9:31 PM
just like everything about religion
badumtiss
 
Anonymous
:)
 
Abe
ok lets not go there
 
hello guys
I want team collaboration tool with following requirement ---- 1) sync to the same ftp server
2) get alert when other developer is working on some file - so it is kind of locked, update my IDE with lastest file when other developer save the file
does some thing exits like that?
any one?
 
9:51 PM
I hope not
what you want is a git repository and git hooks
 
Hey Guys.. I am an ANdroid developer since 4 years but never delt with backend.. I am setting up a MAMP backup for a dating app.. can anyone plz help me? I am getting Access denied for user 'root'@'localhost' (using password: YES)
 
@FaizRasool start using version control in your company
"git" is the recommended option
oh, and stop editing files directly on production box
for management you can use GitLab: about.gitlab.com/features (the community edition is free)
@AmitPatel you have not set up mysql user account for "root@localhost" (it is a different from "root@%")
 
10:10 PM
Where I can change the password?
 
"Operation not permitted"… When I am using sudo, I know what I want and don't need a stupid System Integrity Protection ...
 
@bwoebi use freebsd
 
@tereško doesn't provide the same nice UI for everything else though.
 
well, no
it's mostly oriented at servers
the UI options on freebsd is somewhat limited, especially since linux desktop environments have started to couple directly to systemd
 
yup…
 
10:15 PM
there is a systemd-compatibility layer in the pipeline, but that's probably going live starting from 10.4 release (or 11.0)
 
10:25 PM
Morning's
 
10:38 PM
Undefined symbols for architecture x86_64:
  "_PKCS5_PBKDF2_HMAC", referenced from:
      _zif_openssl_pbkdf2 in openssl.o
  "_TLSv1_1_client_method", referenced from:
      _php_select_crypto_method in xp_ssl.o
  "_TLSv1_1_server_method", referenced from:
      _php_select_crypto_method in xp_ssl.o
  "_TLSv1_2_client_method", referenced from:
      _php_select_crypto_method in xp_ssl.o
  "_TLSv1_2_server_method", referenced from:
      _php_select_crypto_method in xp_ssl.o
@LeviMorrison do you know by chance how to fix these?
I even have installed openssl v1.1 in /usr/local, but seems to still use the version in /usr … which is the system default, aka 0.9… (and passed that to configure: --with-openssl=/usr/local)
I had fixed it somehow before the 10.11 upgrade… but now … don't remember.
it works when I change order in Makefile for LDFLAGS
but that's not my preferred fix…
 
11:11 PM
PHPUnit asserts are done like so in the source: public static function assertEquals(...). In my unit test if I try using $this->assertEquals() PhpStorm inspection kicks in and says I need to do it this way instead self::assertEquals(). Both work, but what is the correct way? This is the inspection description Analyses static method invocations and reports if they use '$this'. Ideally, code should use the 'static::method(...)' construction instead.
All docs for PHPUnit show using $this
 
@crypticツ It's not wrong. It's just, you're calling a static function via a non-static call.
 
@crypticツ turn that warning off? It seems bogus.
 
Hiya
Fast question How I know the numbers of caracthers inside a row with php mysqli?
 
11:31 PM
@JuanFernandoz If you already have the string, strlen. If you're still doing your query, then you might save a couple CPU cycles by counting the characters in the database. And yes, that was a fast question, but the answer could have come faster by asking Google...
Also, don't micro-optimize. Just because you could save a few CPU cycles doesn't mean it'll make development faster which, in most cases, has far more impact on the quality of the software than shaving a couple milliseconds off of something that takes tenths of a second to run.
 
Hello
my index.php file
<?php
	if(isset($_POST['submit']))
	{
		$name = $_POST['name'];
		if(isset($_POST['name']) && !empty($name))
		{
		}
		else
		{
			$error_name = "Please enter your name.";
		}
	}
?>
<form action="qa.php" method="post">
Name: <input type="text" name="name" /> <br />
<?php if(isset($error_name)) { echo $error_name; } ?>
<br />
<input type="submit" name="submit" value="Insert" />
</form>

qa.php file
<?php
	if(isset($_POST['name']))
	{
		$name = $_POST['name'];
		echo $name;
 
@Ghedipunk Actually, is not that simple, If Im doing my query is not that simple to do inside the while loop. And Im not asking about optimization and times, Im asking how to do it.
 
@JuanFernandoz Sorry, that bit about not micro-optimizing was more a reminder for me than a response to you, since I'm the one who brought up saving CPU cycles.
@user3216114 What is actually being sent to your script? (Use your web browser's developer tools to look at the request headers and request body)
 
I want that the following condition is true then and then form action qa.php redirect. if(isset($_POST['name']) && !empty($name))
 
11:45 PM
you accidentally a word?
 
I hope to have broken @Ocramius code now :-D git.php.net/…
 
anyone know if the TIMESTAMPDIFF() function in MySQL (dev.mysql.com/doc/refman/5.5/en/…) suffers from the Year 2038 problem?
 
@user3216114 if(isset($_POST['submit'])) is never going to be true since index.php is not what the form is posting to.
 
@bwoebi shouldn't that have an RFC? aka that's a language change, even if it is stupid that it ever worked like that.
 
@crypticツ Then how to solve problem? I want to display error message before submitting the form if the textbox is empty or data is not posted.
 
11:49 PM
@Danack It's actually fixing bugs because class constants are inlined… and when you change scope on a closure it'll go bad…
 
@user3216114 Have Javascript validate the submission client side. Then, when the form is submitted, re-validate it on the server side and reject the submission if it doesn't match.
 
Love to troll random pastebinners: pastebin.com/6HZ9Kj8h xD Dem views :P
 
@Danack It never actually was supposed to work, just worked as a side-effect of the lax checking…
 
> aka that's a language change, even if it is stupid that it ever worked like that.
 
It's a bugfix I would have done in 7.0.1 too.
 
11:59 PM
Anyone have advice on setting up an automated unit test server? I'm thinking of running a cron job to periodically pull each branch from my GitHub repo, and if there are file changes, to run phpunit.
 
01:00 - 17:0017:00 - 00:00

« first day (1813 days earlier)      last day (3128 days later) »