« first day (1776 days earlier)      last day (3169 days later) » 

9:00 AM
well normally you wouldn't, it's about intention
function intention($array) {
	foreach ($array as $k => $v) {
		if (condition) {
			unset($array[$k]);
		}
	}
}
you have a clear intention for that code to iterate over the array and unset some members
but when split into the threaded example, there are two clear intentions, one to iterate over the array and another to unset some items ...
 
Yes, but usually you just remove the current member, and copying the array first sucks. :x
It's what Java does with its CopyOnWriteArrayList.
 
we don't need a copy of the array whatever, but I just wonder if there is some value in enforcing correct usage ... iteration and deletion are clearly not meant to occur at the same time ... you cant' write code that expects that but can write code that guards against it ...
 
Well, to filter the array, iteration and deletion have to happen at the same time?
 
I don't mean in the same scope or branch of code, I mean literally at the same time, in parallel ...
(they can't really happen at the same time literally, but it seems as if they do to the programmer when they get unexpected output)
krakjoe@fiji:/usr/src/pthreads$ php q.php
0
1
2
3
4
7
8
9
I dunno if that's expected or not, or exceptional or not ...
I guess you expect it to continue like it normally would ...
 
Remember! If your $_POST is empty eventhough it shouldn't, check your submit button! Because type="submit" doesn't equal type="button", I was looking for 4 hours for this error...
 
9:09 AM
Hm, yeah, might make sense to guard against it. Every shared array operation has to go into a synchronized block then, right?
 
@kelunik if you're expecting consistency, yeah
 
@JoeWatkins My understanding of foreach behaviour dictates that I would expect a CoW at the point of the unset(), because two distinct scopes have references to the same data and there's no communication between them in that example
 
that would mean threaded objects are not useful though if the context calling unset were operating on a copy the thread wouldn't know about the change ...
so if your intention is to print first, it'd need to look like
<?php
$shared = new Threaded();
while (@$i++ < 10) {
	$shared[] = $i;
}

$thread = new class($shared) extends Thread {

	public function __construct(Threaded $shared) {
		$this->shared = $shared;
	}

	public function run() {
		$this->synchronized(function(){
			foreach ($this->shared as $key => $value) {
				printf("%d\n", $key);
			}
			$this->shared->printed = true;
			$this->shared->notify();
		});
	}

	private $shared;
};

$thread->start();

$shared->synchronized(function() use($shared) {
	while (!$shared->printed)
and vice versa like
<?php
$shared = new Threaded();
while (@$i++ < 10) {
	$shared[] = $i;
}

$thread = new class($shared) extends Thread {

	public function __construct(Threaded $shared) {
		$this->shared = $shared;
	}

	public function run() {
		$this->synchronized(function(){
			while (!$this->shared->modified)
				$this->shared->wait();

			foreach ($this->shared as $key => $value) {
				printf("%d\n", $key);
			}
		});
	}

	private $shared;
};

$thread->start();

$shared->synchronized(function() use($shared) {
this is much clearer code ... bit long winded, but all intentions are clear, it would be good if people wrote code that way and by throwing an exception we can force them ...
it's not very php though ...
2
 
9:27 AM
@tereško here is a website that converts .htaccess codes to nginx ...
 
are you saying that your current configuration does not work?
 
Is any of the php-src code written in php itself? Like many JS engines use JS itself to implement parts of standard library, and use C/C++ for most of the core.
 
@JoeWatkins Yeh this seems like a sensible restriction, on reflection. There needs to be some way to pass data in without it being subject to that restriction... sometimes I really do just want a copy and ideally I don't want to have to do it by assigning it to another var, although I'll grant you that's explicit when reading the code I thing $var = $otherVar; looks weird in PHP, it usually indicates to me that something's wrong
 
@AwalGarg no, there is php in php-src though that does a useful thing, generate vm
 
@JoeWatkins "generate vm"?
 
9:32 AM
@tereško no, it works ! I said just for your information.
 
zend_vm_execute.h is generated from zend_vm_def.h, each opcode having many handlers because of different var types
 
@Sajad there are multiple sites which do that
they can be useful for debugging, but I prefer to understand how things work
 
I gave my .htaccess codes to that site, it gave me a output, so, its output was different with what you gave me ...
there is {} in the your code: like this: ... index.php?rt={$request_uri};
but the output of that site has not {}, it is like this: ... index.php?rt=$1 break;
 
hi all
please somebody help me
0
Q: What should be the equivalent of HTTP_USER_AGENT in case of request coming from mobile app to PHP?

user2839497I want to pass an URL to some function in PHP. My concern is related to the value of server variable $_SERVER['HTTP_USER_AGENT'] Actually when I made a request from the browser the respective function works fine but when I made a request from CURL or iOS mobile app it gives following data, in bo...

 
@JoeWatkins not that I understand that but sounds fun
 
9:47 AM
Is there any one who can help me in finding the solution of my problem?
 
who the fuck thought that calling excel-like app Calc would be a good idea
 
currently i am storing some data as an array in a session container of the zend framework2 but there is problem occur in storing it at the first time
 
Who thought that to call calc anything that is not a calculator would be a good idea
 
@tereško I import my database via ssh or via filezilla ?
 
It sounds like a timing issue. For example, the Container::accessData is set after the view is rendered. On page reload/refresh, the Container::accessData would be available. If this isn't the case, can you post an example using the ZF2 Skeleton Application? — Chad Lad Aug 17 at 4:10
 
9:51 AM
@Sajad via ssh
 
ok
 
you need to run the "import" command on the server
 
0
Q: Getting error in accessing session variable in zend framework2

user3480945I am using session container and store the arrays in a session. When i logged in then on the first time it give me undefined variable when i refresh the same page then it is working why? $container = new Container('user'); $container->accesData=$data; where $data is an array. in my vi...

 
@tereško it is like CMD command ?
 
Please help me
 
9:52 AM
16 hours ago, by Sajad
c:/ xampp/mysql/bin mysql -u root -p table < file.php
 
ok good
 
88
Q: How can I import a database with mysql from terminal?

PatrickHow can I import a database with mysql from terminal ? I cannot find the exact syntax

 
@tereško and for my website files, I need to upload them one by one ? is it possible to I zip all files and when uploaded I extract them ?
@tereško tnx
 
do you not know how to use filezilla?
 
eemm, it is very simple
 
9:54 AM
57 secs ago, by Sajad
@tereško and for my website files, I need to upload them one by one ? is it possible to I zip all files and when uploaded I extract them ?
then your question makes no sense
 
ok I don't know ! just tell me for uploading, I need to zip all my files ?
 
you use filezilla, you select with mouse all the files on the left side and drag them to right side
 
ah ok :)
for next time, I will try before asking !
 
you said that you know how to use filezilla
 
Please help me in the below url
 
9:56 AM
I used it (just 1 time) 2 years ago
 
Please help me
http://stackoverflow.com/questions/31962590/getting-error-in-accessing-session-variable-in-zend-framework2
 
@Sajad your definition of "know how to use" is somewhat lacking
 
yeah it is seem so
 
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)' in /var/www/index.php:15 Stack trace: #0 /var/www/index.php(15): PDO->__construct('mysql:host=loca...', 'root', '') #1 {main} thrown in /var/www/index.php on line 15
@tereško
I uploaded all my website files
but index.php does not open
 
10:09 AM
it's the msql
I think you are using the wrong password
 
it should be noted, that index.php don't need to mysql and database
I have not any password in my codes
 
what do you mean?
 
$dbh = new PDO("mysql:host=$servername;dbname=$dbname", $username, "");
 
code?
 
password is empty
 
10:11 AM
yeah, well, on your VM you did set a pasword, when you were configuring mysql
didn't you?
the same password that you used when connecting to mysql using workbench
 
@tereško ah, wait ..
 
why I am getting error File not found ^^^ ( above image )
 
you can think of PDO as just another mysql client .. because it kinda is
 
can I remove that connection ? and create a new one ?
 
10:14 AM
@Sajad what?
 
I think I forgot my password
 
I have a connection in the workbench ! can I remove it ?
 
tereško could you look at my dumb mistake, i am getting crazy :(
 
10:15 AM
@Sajad you should never remove a password
@NullPoiиteя those files are not in the /helper/ directory
 
I want to create (add) a new connection ...
 
@Sajad why?
 
just because !
 
@tereško when i click on class name it navigate me to there .. isnt it mean i have included correctly ?
 
@Sajad can you please give a reason? Otherwise I have no idea what you are trying to do.
 
10:18 AM
I'm here right now
 
thanks gonna debug again
 
@Sajad why do you want to create a new connection?
 
but test connection fails
 
I feel like I'm watching tereško create a website through a very clunky interface.
 
@tereško because I removed the previous
 
10:19 AM
@PaulCrovella lol
 
47 secs ago, by Sajad
but test connection fails
what did you do?
47 secs ago, by Sajad
@tereško because I removed the previous
why?
 
because I forgot its password, I need to it for pdo connection
 
that connection, which you deleted, had the password saved
 
yes
 
and you deleted it
 
10:20 AM
yes, because I forgot it
 
just because you deleted the connection, the password did not change
 
ow ? really ?
 
to create a new connection you need to know the password
 
oh !! oopps !
what should I do now ? :(
 
the previous connection had the password saved, so you would not need to enter it, when connecting
 
10:22 AM
@tereško I need to it for my codes.
for this: $dbh = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
 
I am tempted to leave you to clean up your own mess
 
connection method should be 'standard (tcp/ip)' ?
 
do you know the root password for mysql?
 
yes
 
then why do you not enter it in PDO?
 
10:25 AM
ow, they are the same ?
 
i dont know
what password did you set, when you configured mysql?
 
@tereško your mean is when I use su ? (that password)
 
no
18 secs ago, by tereško
what password did you set, when you configured mysql?
 
the problem is here !! I don't know
for that reason I removed the connection
 
then how do you expect to use workbench for connection to database?
 
10:27 AM
I don't expect anymore !
I have two password in my head, can I check them ?
'username' should be 'sajad' or 'root' ?
 
have you really not understood anything?
 
his solution to forgetting a password was to immediately delete the only thing he had that remembered the password... how can you even ask that question
 
I am till struggling with maintaining calm here
 
@tereško I think it should be root
but because connection fails, I said to myself maybe it should be sajad
 
10:34 AM
have you at least opened the mysql tunnel?
 
I undrestood the password
@tereško I connected with mysql tunnel
 
seems like a progress \o/
 
This is better than going to the cinema, it's action, drama and comedy all for free, now we just need to see some romance.
 
it's always fun to read this chatroom :)
 
Finally,
my internet works.
:D
Mobile Hotspots don't work on OS X without pointing the DNS to OpenDNS ;/
 
10:59 AM
@HassanAlthaf Use 8.8.8.8/8.8.4.4 instead
OpenDNS resolves A requests that fail to it's own servers so they can present a friendly erro page, v. annoying
 
-22
Q: is it possible to find an algorithm to calculate first in first out for account

Gautam ShettyIm developing a finance website in visual studio 2010 using C#. Please give me an algorithm for calculating first in first out in accounting problem. Will be waiting for ur reply. Thank you.. sorry guys please unhold it

dont delete it now ... let him learn a lesson ( he is even offensive )
 
@DaveRandom Do you have a good idea how to handle / implement sessions in a WebSocket handler? It's probably an issue for all projects implementing authenticated WebSocket sessions. They need to somehow close connections for sessions where the user logs out and they need to somehow extend the TTL while the connection is alive.
 
@kelunik I don't see the problem, tbh. You just attach the state to the stream...?
Or are you wanting some way to share session data between multiple streams or have the data persist after the stream disconnects?
 
@NullPoiиteя I wish I had managed to see his offensive comments.
but they are gone now :(
 
u idiot u dont answer my question and instead u r suggesting me what to do and what not.. go to hell @mybirthname — Gautam Shetty 1 min ago
 
11:07 AM
Yea, I got that :P but the other comments seem to be referring to some serious butt-hurt from Gautam.
 
what should i call idiots as?? donkeys are called like that only — Gautam Shetty 17 secs ago
 
@DaveRandom Yes, I'm talking about usual HTTP sessions stored (currently) in Redis. There can be any number of web nodes, any of them can handle the logout payload and another one the websocket connection.
There can be multiple sessions per user and multiple connections per session.
 
Are you answering regular HTTP requests in the same process space as the websocket server?
 
@NullPoiиteя This dude is seriously pissed off at something.
 
That may or may not be the case, depends on the load balancer.
 
11:10 AM
@NullPoiиteя how do you quote comments?
 
just post link of comment here
and here another question
-7
Q: searching or filter the gridview using visual studio 2008

Gautam ShettyI wanted to know how to search in the gridview by using a textbox. I have tried to filter it by following a tutorial in youtube. But when we debug it , the browser will only show the textbox and button, no preview of the gridview will be available on the page load. I want to see the gridview alon...

 
i am different that means i am not idiot.. u laugh at me because im different and i laugh at u because u r all the same — Gautam Shetty 34 secs ago
looks like he is playing the racism card :P
 
@MarcelBurkhard No, he's playing the stupidity card.
 
@DaveRandom Aerys. ;-)
 
Lol, the entire comment section got wiped, a mod @Gordon finally had enough.
 
11:15 AM
@kelunik OK so extending the TTL is simple enough (you just have a recurring timer which you cancel when the socket closes). Invalidating the session data isn't too tricky as long as you have some kind of IPC between load-balanced instances (everything would need to be notified when a session is invalidated rather than polling redis). The real difficulty I see is in concurrency and write-locking, though.
 
Yeah, it's the concurrency that gives me headaches. Write locks are implemented using github.com/kelunik/redis-mutex. I could have a simple pubsub channel for sessions publishing every data update. The issue I currently have is...
Nevermind, I worried about something like this getting inconsistent when the session updates in the middle:
$user = $session->get("login");
$name = $session->get("login:name");
But that can actually never happen, because the event loop is single threaded and there are only issues if you yield somewhere in between. \o/
 
some times i hate mode when they ruin fun :(
 
@kelunik I'd maybe go for a flock()-style approach, where only one entity can have LOCK_EX at once, and every time you update session data you have to wait for a write lock, write your data and release it.
Certainly you need some way to ensure that writes are atomic, and when you are talking about multiple processes I don't see any other sane option
 
@NullPoiиteя And I'm certain that the mods hate when the users go off-topic ^^
 
Yes, that's already implemented, the only thing that's missing is observable support.
 
11:30 AM
@kelunik How can you share observability between multiple processes, though?
 
why when I 'drop table' in workbech, the table does not drop ?
 
I'm sort of thinking that having a separate daemon to deal with sessions might be the way forward, although it's kind of just shifting the inherent SPoF issue somewhere else
 
@DaveRandom That's how the current API looks like: gist.github.com/kelunik/5daeec1aafed88002957
 
@Sajad did you refresh the table list?
did you get an error message?
"doesn't work" is the most useless statement, that you can make
 
I refreshed, but the table is exist. no there is not error, when I click on drop table, it tell me "please confirm permanent deletion of table itam and its data" Review SQL | Drop Now
 
11:36 AM
@DaveRandom Well, multiple processes can subscribe to Redis, or where do you see the exact problem?
 
I did it, the problem was: foreign key !
 
@kelunik Does redis have inbuilt pub/sub that works with Amp? (I've never actually used it for anything)
 
@Epodax nope, it was the two dozen flags citing rudeness
 
@Gordon Ooooh, Figures they got flagged, ah well.
 
@DaveRandom Yes, it does even have keyspace events, but I prefer explicit pub/sub, because keyspace events are configuration specific.
 
11:46 AM
@tereško ok well, for import one .sql file, what should I do first ? using of terminal like this: mysql -u root -p database < c:\file.sql ?
or should I do something else before it ?
 
@Sajad that command is a bit wrong
and you probably will need to create a database with that name
 
88
Q: How can I import a database with mysql from terminal?

PatrickHow can I import a database with mysql from terminal ? I cannot find the exact syntax

@tereško I created ! in the workbench
 
@Sajad read the answers there carefully
 
there is just one line :-) ! I don't need to careful
 
the line that you wrote wont work
you need to understand how to write it correctly
(you cannot do any damage, so, it's a good time for you to experiment)
 
11:51 AM
I need to something like -h ? because I read it in some other refrence !
 
read this
or write in terminal: man mysql
(it will bring up the same user manual)
 
ok
Is it possible to I add my file.sql in the /home/sajad/ via filezilla ?
 
what do you mean?
 
I mean is I can import my database simply by filezilla
without command line
 
is it possible to import database sql file using filezilla
 
12:05 PM
lol
@Yusuf I highly doubt you know what you are talking about
 
I can not underestand step1 and step2 in here
 
posted on August 27, 2015 by kbironneau

/* by SynxS */

 
@Sajad it means "connect to server using ssh"
 
I connected !
 
(you probably have doe it using putty already)
 
12:11 PM
should I go somewhere like this: mysql > Or somewhere like thie: sajad@sajad ~ % ?
where should I write this: mysql -u root -p ...
OMG ! I did it ..
my problem was: I wanted to import .sql file from my laptop, not from my server!
@tereško so I remove that file in /home/sajad ? I imported it, I can see it in workbench
 
you can remove, or you can just leave it .. maybe you will need it later
 
anyone know of a service that is like the opposite of requestable.pieterhordijk.com ?
 
@tereško ok !
 
did you manage to set up PDO connection correctly?
 
@tereško when I import my table, terminal gives me a warning: Warning: Using a password on the command line interface can be insecure.
 
12:18 PM
@iroegbu I... have no idea what that would do? :-P
 
@tereško yes
 
postcatcher.in is what I'm looking for... I want to see the request
 
Hey guys. I am currently trying to get the bootstrap theme form working for Symfony 2.7. I added form:
resources: ['bootstrap_3_layout.html.twig']
But it won't work
I'm not getting any kind of error message, so I don't know what to do to get it working
and also, googling it hasn't worked out very well for me
Anybody that know how to get it working here?
 
@tereško I think I need to change all paths
<link rel="icon" type="image/png" href="img/favicon.png">
should be what ? ^
 
"img/favicon.png" is a relative path
where is the favicon located on the server?
 
12:25 PM
in the img folder
 
By the way I also tried this: {% form_theme form 'bootstrap_3_layout.html.twig' %}, I copied the bootstrap twig files to app/Resources and I tried clearing the cache and all that kind of stuff
 
Is there a design pattern that can help in building a query that can be dynamically filtered ? I'm using doctrine's query builder to build the query object, but I want to avoid writing tons of if/else based on the filters I get
 
@tereško session are fine on my server
?
 
what are you asking?
 
Notice: Undefined index: LoginValidation in /var/www/index.php on line 22
LoginValidation is a session
 
12:32 PM
@DaveRandom Thanks, its much faster for me now.
 
Are namespaces suppose to be case-sensitive when using vendor/autoload.php? pastebin.com/HPisBE9C I'm trying to dynamically set bar in the string and it will be in lowercase. But it fatal errors if it's not exact match.
 
@tereško are you busy ?
 
@crypticツ Because, Composer uses the namespaces to determine the location of a file.
If you've set Acme to be the src folder,
Then it will look for the file
 
@Sajad you need to check whether php56-session extension is installed
 
how can I check ?
 
12:34 PM
src/Foo
in a class bar
 
@crypticツ Yes. It maps namespace/classes 1:1 with the FS
 
So basically src/Foo/bar.php
It's called some PSR-4 yeah? @PeeHaa
@crypticツ More bout it. php-fig.org/psr/psr-4
 
12:46 PM
@Sajad pkg info | grep php56
 
anyone using amazon s3 ?
 
there is php56-session-5.6.12
 
then the sessions a fine
 
yes
 
problem is at your end
it might be that your previous environment was not reporting E_WARNING messages
 
12:48 PM
@NullPoiиteя I'm sure some people are.
 
@tereško yes, I adjusted it to off
 
how can i grant privilege to read object to certain users ( by token )
 
@Sajad that would be wrong thing to do
you should fix the warnings
not hide them
 
anyway, now, my website does not loaded completely ! just its header loaded !
 
that's a problem in your code
the server is working fine
 
12:51 PM
yes
how can edit files on server ? should I edit them on locan and upload them again ?
 

« first day (1776 days earlier)      last day (3169 days later) »