« first day (661 days earlier)      last day (4284 days later) » 

6:00 PM
@we
@webarto thanks for answering any good tutorial, book?
 
@bentham I really suck at giving advices... but @tereško is good, although he might make you cry...
 
@tereško why cry?
 
@rdlowrey when you built these HTTP classes, what tool did you use to inspect network traffic?
 
@webarto why cry?
 
user895378
@webarto I didn't ... why?
 
user895378
6:04 PM
I've used wireshark with good results in windows before if you need. The ssl implementation is handled by PHP. Ensuring data is encrypted is the only reason I can think of why you'd want to.
 
@rdlowrey you're good then, no particular reason... I used Wireshark (because of these WebSocket thingy is giving me headache) and I'm :mindblown:...
damn it :)
 
user895378
@webarto I assume you're trying to see the raw HTTP messages being passed back and forth?
 
@ircmaxell Sounds like a short sighted accepted answer
and hello all
 
user895378
hola
 
6:07 PM
@rdlowrey yes, because it uses something called hybi-[numberhere] encode/decode, and that is a draft, so it is everchanging now... every browser update is potential "does not work" situation... so I just want to keep up to date... stackoverflow.com/questions/7945040/…
 
@bentham , by learning. Bot what exactly you need to learn would depend on how you write code now
 
@deceze tip: set cake/ci to ignore :D
 
we would need to see few files from your latest project
 
@webarto Good idea.
 
@deceze , on your case it might not work .. it would depends on personalization rules
as you might know , there is there small matter of your most frequented tags
 
6:10 PM
I'm doooomed! T_T
 
@tereško thanks for answering, I am trying to get better, have you used jqgrid?
 
O_o
 
user895378
@webarto Have you considered using stream_socket_client to read and write socket data like a stream instead of calling the socket_* functions directly? I do it that way -- it seems simpler to me.
 
@webarto Jquery for everything no exceptions
 
@rdlowrey yes, I "switched" to that entirely, was real noob at this, now I'm just a noob, pokit.org/get/img/d4b66aef2c35886dfe001668905dac2c.png (can you open image?) this "works" and I'm going to polish it soon, I just wanted it to function asap :)
@rdlowrey I'm trying to bypass regular websocket protocol for "master", so async (you helped me with that) would work...
 
user895378
6:15 PM
@webarto Also, I think the http library/client that @LeviMorrison and I have been working on would make your life much easier. Really easy, actually. I'm happy to walk you through what you would need to do to make it work.
 
user895378
You could just do something like ...
 
can anyone help me?
 
Do you guys advise against HEREDOC usage? Any known issues with them? Anyone use them?
 
user895378
$client = new Client();
$request = new StdRequest('http://websocketurl.com', 'GET', array(
    'Sec-Websocket-Origin' => 'some value',
    'Sec-Websocket-Version' => '13',
    // add any other headers you want to send
));

echo $request; // see the exact raw HTTP message you're going to send
$client->requestAsync($request);
 
user895378
@webarto ^
 
6:18 PM
@rdlowrey I don't mean the name. I mean the fact that these methods exist (with whatever name) in the API. It's a linked list API semantically.
 
@rdlowrey that is exactly what I'm trying to achieve, "god bless you" :)
 
@Event_Horizon I actually really like HEREDOCs.
 
user895378
@webarto I spent about 900 hours last week making all that work ... you might try it out :)
 
@LeviMorrison The main issue with HEREDOC is that PHP unnecessarily restricted their syntax
 
@rdlowrey damn :) code is beautiful, except bugs, that takes time too... you meant 90 :P
 
6:20 PM
@rdlowrey , the constructor seems over-crowded
 
In particular the fact that the END has to be followed by a newline (or semicolon with newline)
 
you should use separate method for setting headers
 
user895378
@tereško __construct($uri, $method, $headers = array(), $body = '', $httpVersion = '1.1')
 
user895378
It only looks overcrowded because I used the headers array directly instead of inserting it as a predefined variable
 
@rdlowrey looks quite nice
 
6:21 PM
and also a separate method for setting the body
 
@tereško Why do you need separate methods for these things?
 
because they are not mandatory parameters
 
user895378
Well, the point of StdRequest is to be a value object. No setters. It is what it is, and that gets defined at construction.
 
@PeeHaa huh?
 
@NikiC Yeah, the END having to start on a newline sucks.
 
6:23 PM
@LeviMorrison and that too, yes.
 
also , IMHO use of value objects is a bad practice
 
my main issue is though that you can't write END, or something, so it's ugly to use in function calls ^^
 
@ircmaxell "There is no need to define an interface if you know that the behavior defined by it will be used only once."
 
@tereško Also, the Client actually works off a Request interface. Define your own Request implementation if you don't like the actual API for creating a StdRequest.
 
user895378
@tereško I like the immutability for a request. If I use it in a web application, I populate it one time because there's only one request. I shouldn't be able to change the details of what came up from the client.
 
6:24 PM
@tereško Tell that to highly parallelizable languages . . .
They'll laugh at you.
Of course, PHP is not that language.
 
user895378
And if you want a mutable request, there's MutableStdRequest -- it takes no constructor args and you can do everything with setters. It also implements Request
 
user895378
And there's a MutableStdRequest::validateMessage so you can make sure you haven't specified a fubar'd request before you send. With StdRequest you'll know if you specified an invalid request.
 
Yo
 
@PeeHaa YAGNI much?
 
@cHao You will almost always need it
YWAANI much ;)
 
6:27 PM
@PeeHaa except when you don't. which is more often than you're willing to admit.
 
user895378
@webarto Here's a simple example of using the client and a list of features -- it's under heavy development, but the API has stabilized. Just clone the Artax repo, require the Artax.php bootstrap file (registers an autoloader) in your script and instantiate your objects: gist.github.com/3251540
 
@PeeHaa Imho it is okay to start of without an interface unless you explicitely know that you will need many of that "thing"
 
hey all. I have an array full of numerical strings, and then 2 non-numerical strings towards the end. The 2 non-numerical strings are like markers, and I need to get all the array values after the first non-numerical string, but before the 2nd. I know I need to use a loop for this but I can't think of how it would be best. basically if this is the array{1, 2, 3, 4, 5, A, 6, 7, 8, 9, B}, I need to get the values of what's between A and B
 
@PeeHaa I agree with that 100%
 
interfaces everywhere == overengineering, imo. they can always be extracted later (trivially, with most IDEs) if you find you need them.
 
@ircmaxell has a blog post for everything...
 
lol
 
hehe
 
user895378
@NikiC I agree -- Sometimes the interface is going to change significantly from start to finish and you're just creating more work for yourself if you do it first. As soon as your API has stabilized, then create the interface IMHO
 
@NikiC Either that, or an SO answer. Which is getting kinda sad...
 
user895378
6:32 PM
That's not to say you shouldn't spend time planning your API up-front ...
 
careers needs a "talks" section...
 
@ircmaxell will you be at phpnw?
 
@rdlowrey I do agree with that. However at some point it is a good idea to have an interface. for mocks and for other people as a giudeline
 
user895378
@PeeHaa lol at YWAANI
 
@NikiC not planning on it. Are you going to go?
 
6:34 PM
@LeviMorrison , of course .. i was speaking in context of php
 
user895378
@PeeHaa oh for sure -- mocking interfaces FTW
 
@ircmaxell Nah. Just wondered what you decided ;)
 
It's not even like PHP makes it that hard to mock a class. You define the class, the autoloader doesn't pick up the real one, and the code under test doesn't even know the difference. so the testing argument is bullshit
which leaves you with extensibility
 
@NikiC There's only 2 people there I would want to see...
@cHao only if you run it in process-isolation
 
@ircmaxell which you should anyway, considering
 
6:46 PM
considering what?
 
considering they're unit tests?
 
the high overhead of process isolation?
 
and should be entirely separate from each other?
 
I want my unit test suite to run in the order of seconds, not minutes...
 
and i want to be able to guarantee that my tests have no way of interfering with each other.
i'm ok with a minute or two for tests.
 
6:49 PM
wow @PeeHaa, horrible naming in your array_slice answer!
 
@rdlowrey Fatal error: Call to undefined method Artax\Http\MutableStdRequest::getMessageHeaderStr() in /var/www/helpdesk/library/Site5/WebSocket/Artax/src/Artax/Http/Client.php on line 315, excuse me, but does this sounds familiar to you?
 
user895378
@webarto I just fixed it. Please re-clone. Made a premature push :)
 
:))))
 
@salathe Which name?
all of them? :(
:P
 
Your whole answer, pretty much.
 
6:51 PM
:P
 
@rdlowrey pardon me, but fucking awesome
 
Hi, here's my problem:
I have a list of items,
every item has it's own comments
 
wait, can I tell my problems first?
 
yes
 
no, sorry, continue pls
 
user895378
6:54 PM
@webarto Yeah, me and @LeviMorrison are pretty pumped about it. I'm spending most of this week polishing details and adding functionality. If something breaks for you, please let me know.
 
ok
 
@salathe Well I thought I used OP's "namingconvention". And besides that I'll just drop in the excuse of not being a native English speaker because it is an easy excuse;-)
 
I need to inform multiple subscribers about new comment using ajax
jquery
 
@PeeHaa if in doubt, copy the variable/argument names from the manual... works for me! :)
 
how can I send the data using jquery ajax and json?
 
6:55 PM
Good vall :P lemme fix that :)
 
where should I start?
 
call that is
 
jQuery you say....
 
yes
list of items, every items has it's comments,
 
@webarto heheh
 
6:55 PM
@webarto lmao
 
and every comment can be emailed to a specific group of people listed alongwith checkboxes bellow new comment form
I should probably make checkbox array
 
@salathe Thanks for the fix of both the naming and the preserve keys :)
 
but I need to send it over ajax and process it in php
I need some basic guidelines, not complete solution of course
 
I owe you one. Actually after I screwed up the docs I owe you two :) Let me know when you are in town and I'll buy you a beer :D @salathe
 
6:58 PM
Actually I think OP wanted to have the keys
 
user image
5
 
@PeeHaa Hey thanks for replying to my thread (the array_search one). I'm trying to use your method however I'm just getting Array ( ) from the vardump. I know there should be at least 1 value in there. Any ideas?
 
@Prefix hiya :) First things first. Do you need to keys or the values from the array?
 
@PeeHaa I'm trying to get the values
sorry brb
 
Ah right.
@Prefix Can you show me what is going wrong on codepad? codepad.viper-7.com/lPf07Z
 
7:01 PM
$.ajax({
  type: "POST",
  url: "some.php",
  data: $('form').serialize()
}).done(function( msg ) {
  alert( "Data Saved: " + msg );
});
@Spec this should work for you, checkout .ajax and .serialize
@rdlowrey well you should be excited :) I'm receiving lots of 400, is it PEBKAC ? :)
 
@webarto probably ;)
 
;)
 
user895378
@webarto Probably. Try sending a request to a regular server. No way to tell without seeing the exact request/response data though.
 
$client = new \Artax\Http\Client();
$request = new \Artax\Http\StdRequest('http://site5.com', 'GET');
$response = $client->request($request);
echo $response;
response
HTTP/1.1 400 Bad Request DATE: Tue, 07 Aug 2012 19:05:59 GMT SERVER: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 CONTENT-LENGTH: 358 CONNECTION: close CONTENT-TYPE: text/html; charset=iso-8859-1
Bad Request

Your browser sent a request that this server could not understand.
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 Server at site5.com Port 80
@rdlowrey
 
is \Artax\Http\Client(); namespaces?
 
user895378
7:07 PM
@Nick yes
 
user895378
@webarto hmm -- very strange, because the same code works just fine for me
 
let me try it "solo"
 
ok enough lurking imma write some code
 
250
Q: What is the Mars Curiosity Rover's software built in?

InfinitiesLoopThe Mars Curiosity rover has landed successfully, and one of the promo videos "7 minutes of terror" brags about there being 500,000 lines of code. It's a complicated problem, no doubt. But that is a lot of code, surely there was a pretty big programming effort behind it. Does anyone know anything...

 
user895378
@webarto Just tested it and I get HTTP/1.1 200 OK with the code you posted.
 
7:11 PM
@webarto Are you connecting through a proxy?
 
user895378
@PeeHaa good call -- if so, you need to do $client->setProxyStyle(true)
 
user895378
before you call Client::request
 
@rdlowrey Hey the least I can do is give support for such a super nice client :)
 
user895378
@webarto If you are connecting through a proxy you'll need to re-clone one more time. The stuff I was working on when I prematurely pushed earlier broke that, and I've fixed it since your last clone.
 
Instead of worrying about the for loop I would worry about the use of global. And the use of short open tags. — PeeHaa 55 secs ago
 
7:16 PM
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

use \Artax\Http\Client,
    \Artax\Http\StdRequest;

require __DIR__ . '/../library/Site5/WebSocket/Artax/Artax.php';

$client = new \Artax\Http\Client();
$request = new \Artax\Http\StdRequest('http://site5.com', 'GET');
$response = $client->request($request);
echo $response;
@rdlowrey @PeeHaa
same result, I thought it was because of ZF... I'm only behind router... let me check on other server...
 
user895378
@webarto you might try re-cloning and setting the proxy option just in case, because I can't duplicate the problem ... Also, does it work for other urls? i.e. StdRequest('http://www.google.com', 'GET'); ?
 
no, they all return 400, recloning on other server now, thanks :)
 
seen in. what you mean by "adopt"?
 
No, the point is to have it in global scope, putting 5 paragraphs of lorem text inside a function is daft. Feel free to post an example where the paragraph array is declared and set outside the function but used inside the function without the global keyword (No classes)... — user1582868 2 mins ago
o.m.g.
 
7:21 PM
wat @PeeHaa lorem ipsum is srs bsns
 
@ircmaxell , i assume that you are referring to PHP core development
 
Eeeek I "killed" my apache config
 
Hahaha, someone did a serial upvote on my account. Just got reversed.
 
@PeeHaa Hi sorry about that, had to go help a coworker with something. So basically if the array is [1, 2, 3, A, 4, 5, 6 B, 7, 8, 9], I want to extract "4", "5", "6" from the array. These are values not indices.. I want all the values between the first marker and the 2nd. Hope that helps make more sense :)
 
@LeviMorrison someone snitched :P
 
7:24 PM
@Prefix you want all the values between a and b?
 
user895378
@webarto ... hold on. I may have found the problem. Gimme a couple minutes.
 
i'll make a codepad post for you
 
@Prefix My function does that :)
23 mins ago, by PeeHaa
@Prefix Can you show me what is going wrong on codepad? http://codepad.viper-7.com/lPf07Z
 
@ircmaxell It doesn't allow recursive calls at all. How interesting.
 
@rdlowrey cool :) let me check on more servers
 
user895378
7:26 PM
@webarto false alarm -- still haven't found any issues on my end -- I did push some more changes, so you might re-clone again and see if they helped you :)
 
@PeeHaa guess I'm a worse programmer than I thought :p vardump doesn't dump anything, just says array(0) { } in my test
 
@tereško Nope. PHP dev. No dynamic memory allocation at all!
 
Anyone here uses PhpStorm's PHPUnit integration?
 
@Prefix can you setup your test on codepad and share the link?
 
@LeviMorrison yeah, that's one I wouldn't have thought of...
 
7:26 PM
@ircmaxell And no recursion? :P Oh, that was already mentioned
 
true but in this context the global keyword is not bothering me... that for loop though, I want to mimic the function without a for || while loop.... but alas no ideas come to mind — user1582868 2 mins ago
 
I'm trying to set it up according to their manual, and encountered an error...
 
> global keyword is not bothering me
 
D:\Websites\php\php.exe C:\Users\Dor\AppData\Local\Temp\ide-phpunit.php --no-configuration D:\Websites\htdocs\lamed
Testing started at 22:24 ...

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "D:\Websites\htdocs\lamed.php" nor "D:\Websites\htdocs\lamed.php" could be opened.' in D:\Websites\php\pear\PHPUnit\Util\Skeleton\Test.php:100
 
Ahhhh crap
 
7:27 PM
@Truth recently started
 
Forgot to mention the super static brb
 
1md.ch/artax.php :) @rdlowrey
 
@Lusitanian Can I specify a directory for my tests?
 
@Truth with phpunit.xml
 
7:28 PM
I.e. where do I write the tests?
 
make a settings file first
like you would without integration
then point phpunit to it and it'll do the rest
 
user895378
@webarto can you add an echo $request to that output so I can see that as well?
 
@Truth click edit configurations under the little testing menu
and for the radio options choose defined in the configuration
 
Sorry. I misunderstood you. What you are looking for is a Super::$tatic: i.imgur.com/RJEsz.png. We like to call that a silver bullet and will most likely solve all your problems. — PeeHaa 38 secs ago
 
@rdlowrey last line 1md.ch/artax.php GET / HTTP/1.1 HOST: site5.com invalid?
 
7:29 PM
@webarto Why are the headers uppercase?
 
user895378
@webarto that is invalid, what are you specifying in your headers array? anything?
 
@NikiC well that doesn't really matter
headers are case-insensitive
 
user895378
@webarto oh, wait, are you sure you've cloned the latest from the repo? it may not be available but that looks like something i've fixed
 
currently, on this, nothing (decided to give it a go like that)
 
user895378
because it should look like this:
 
7:30 PM
cloned about 5mins ago
 
user895378
GET / HTTP/1.1
HOST: site5.com
 
@Lusitanian Yeah, but it's ugly ^^
 
@rdlowrey yeah there is line break, lemme repeat
 
@Lusitanian @PeeHaa hmm so perhaps the problem is with my array.. I want to share a print_r of the array with you guys so you can see what I'm trying to get, where should I paste it?
 
@rdlowrey By the way, I just did a pull and ran tests with the following results: Tests: 527, Assertions: 787, Failures: 1, Errors: 10, Incomplete: 1, Skipped: 13.
 
7:31 PM
Better question
 
@Prefix into code pad
 
@Prefix codepad
 
@NikiC yeah well....upper case headers think you are ugly (:
 
How do I include a file from outside the project directory into a visible scope of the project?
 
@Lusitanian And also, they are case insensitive in theory, not in practice ;)
 
7:31 PM
@Truth Just 1 file?
 
user895378
@LeviMorrison Yeah, I'm getting that same failure too. Working on it.
 
@PeeHaa Yes (in PhpStorm)
 
I bet you that a large quantity of code does not handle the case insensitivity
In particular: I wouldn't handle it either :P
 
@PeeHaa , seems like another case of Dunning–Kruger effect
 
@NikiC that's probably true actually
 
7:32 PM
I want it to be included in the "Tests" scope.
 
@NikiC i always normalize them to first char upper, rest lower
 
@rdlowrey Just wanted to keep you in the know on how it works in a crappy 5.3.x build :)
 
GET / HTTP/1.1
HOST: site5.com
(two \r\n below)
PHP 5.3.6 (cli) (built: May 13 2011 01:39:39) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
 
@tereško I don't know what it is, but I hope it isn't contagious. Then again by going through SO questions I suspect it is highly contagious (in specific regions of the worls).
 
PHP 5.4.4-2~dotdeb.0 (cli) (built: Jun 22 2012 13:21:56)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
 
7:33 PM
@PeeHaa , look it up
 
@tereško I know what it is. Idiots in godmode
 
the problem is usually cause by local communities
 
user895378
@LeviMorrison Fixed the outdated test case -- can you do me a favor and try to run this code and see if it returns a 400?
 
@tereško wow...that explains a lot to me
 
@NikiC only GET and HTTP, rest are ucfirst() :)
 
7:35 PM
Sometimes I would just like to go Your Common Sense on people :P
 
user895378
$client = new Client();
$request = new StdRequest('http://site5.com', 'GET');
$response = $client->request($request);
var_dump($response);
 
user895378
@LeviMorrison ^
 
@PeeHaa so i forgot my ssh key password
 
this has been one of the main reasons by i have left http://php.lv - influential idiots
 
@PeeHaa I added the print_r of the array to codepad.viper-7.com/CUvbOH Thank you so much for your help btw :)
 
7:35 PM
@Lusitanian for github?
 
@rdlowrey Did you want me to pull first? It's unclear from your question.
 
@PeeHaa yup, which wouldn't be a big deal except that i use it for 6 other servers
 
fml
 
user895378
@LeviMorrison oh, shouldn't matter, but best to pull first.
 
7:36 PM
@Lusitanian omg that sucks
 
i have to spend an hour changing them all. never again not putting a password in pw manager immediately
 
@Lusitanian how can one forget the ssh key passphrase if you use it for six servers !?
 
@NikiC because I changed it last night and then prompty forgot it
 
just wanted to say you all rock, thank you for helping out newbies like me. :)
 
hadn't in a while, figured it'd be a good idea. walked downstairs right after, got distracted, the rest is the story of my life
 
7:37 PM
Anyone? :(
 
@Truth sorry i stopped paying attention what's up?
 
lol @ Niki & Lusitanian - that just means you spent too many hours doing what you where doing.
 
I need to run multiple tests for multiple classes on a project
I can easily do it with PHPUnit CLI but I wanted to set up PhpStorm integration
 
@Prefix 1 sec lemme check
 
user895378
@webarto one more request -- can I get an echo '<pre>';var_dump($request);echo'</pre>'; in that output?
 
7:38 PM
Now, I want either one of the following
 
@rdlowrey :
/usr/bin/php /var/www/Artax/test/site5.php
object(Artax\Http\MutableStdResponse)#13 (6) {
  ["statusCode":protected]=>
  string(3) "200"
  ["statusDescription":protected]=>
  string(2) "OK"
  ["wasSent":protected]=>
  bool(false)
  ["headers":protected]=>
  array(8) {
    ["DATE"]=>
    string(29) "Tue, 07 Aug 2012 19:37:45 GMT"
    ["SERVER"]=>
    string(79) "Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4"
    ["SET-COOKIE"]=>
    string(76) "lp_132=486; expires=Tue, 04-Sep-2012 19:37:45 GMT; path=/; domain=.site5.com"
 
@PeeHaa No problem! Take your time :) Appreciate it.
 
user895378
@LeviMorrison Okay so it works just fine for you as well.
 
(better) set multiple files for testing from within the project's folder
 
@rdlowrey Yep. Nicely done.
 
user895378
Not sure what's breaking for @webarto -- neither you nor I can duplicate his 400 response :/
 
@ShawnECarter hello jay-z
 
(still pretty good) keep a single (default) test file outside the project folder, but be able to access it from within the project view.
@Lusitanian Is it possible?
 
shhhhhh
 
7:40 PM
@Truth yes it's doable
if you can do it from the cli you can do it from phpstorm. again, just make a config file that defines your test suites
 
@Lusitanian Aight than, give it to me :)
 
@Prefix works for me: codepad.viper-7.com/QKfWmv
 
@Lusitanian What syntax? Where should it go? And what should it have?
 
@cHao , can you provide an example where use of global would be a good practice ?
 
@Truth it doesn't matter where, but lemme show you an ex
 
7:41 PM
anyone have a good article denouncing global, then I'm done with this r-tard
 
in that function, it's not great, but it's not OMGZOR EEEVUL KILL IT WITH FIRE enough to deserve all of the freaking comments about it.
 
@Lusitanian What's the boostrap file?
 
@cHao wtf
 
@Truth those paths are relative to the location of the xml file. then you go to the little dropdown in phpstorm, choose test scope as defined in configuration and wallah
@Truth it's for setting an autoloader up
 
7:42 PM
bootstrap*
 
This file is run before any test?
 
@cHao "I wrote this and am wondering can it be written any better,"
 
correct
@cHao then he totally ignores all advice
 
@rdlowrey http://1md.ch/artax.php
curl https://nodeload.github.com/rdlowrey/Artax/zipball/master > artax.zip
unzip artax.zip
:happy:
 
7:42 PM
that's why i got annoyed
 
@cHao can .. you .. provide .. single example .. where .. global .. is .. the "right choice" ?
 
@Lusitanian Alright, where should I put this file?
Or do I configure to it?
 
i would have at least considered it in that very case.
 
user895378
@webarto does that mean it worked? what's the zip file for?
 
@Truth put it wherever you want, just make sure the defined paths are relative to it
@Truth then you configure phpstorm to it
 
7:44 PM
@rdlowrey works great (click on link)... I just downloaded ZIP repo, because I don't have git on this server...
 
user895378
@webarto okay awesome -- github not giving you the very recently fixed updates must've been the problem then. Let me know if you get any other hiccups :)
 
0
Q: MongoDB PHP connection management class

bl4designI'm looking for a decent example of creating a PHP class that will handle connections to multiple MongoDB databases. I'm working on a project that will have at least five separate databases. It would be extremely process heavy if I were to connect/disconnect each time I make a call to the databas...

Right, because the PECL Mongo extension doesn't have classes or anything.
 
bad use of global. best i could do lol
 
@tereško there's nothing inherently evil about that array being global. it's not like it could be a constant, and the function has an express purpose that doesn't justify passing in an array every freaking time.
the only other option is static, which is just global in disguise
 
@PeeHaa I'm using the exact same code you linked me and getting array(1) {[24]=>string(18) "registered:current"}, not the value like you are getting :(
 
7:48 PM
I have XML that I'm sending through HTTPS POST. What should I do to make sure everything's encoded correctly encoded? Currently, all I have is urlencode()
 
@cHao , unless you count "untraceable changes of value" as evil
 
@rdlowrey yes, it did throw "something went wrong" on website (for me)... probably wasn't the latest copy ;) ... quick question: does it support TCP and port e.g. tcp://host:port/request_uri ? thanks for this
 
@cHao , have you got an impression that where are not aware of that ?
 
@Lusitanian Let's say my project is called Lamed, and I want to test the DataMapperFactory found on application/include/datamapperfactory.class.php
 
@Truth okay
 
7:50 PM
My tests folder is on tests/
 
user895378
@webarto yes, it should support any valid URI you can throw at it (custom port and all) (super-ping) and supports any custom ssl operations as well
 
go on.
 
Where do I write the tests, and what do I put in my phpunit.xml file?
 
@tereško that's the impression i got, yeah
freaking cargo cultist anti global cultism is what i saw
 
@Prefix Are you 100% sure it is the exact same code (including the array declaration)?
 
7:52 PM
Aug 4 at 15:39, by hakre
ah, static class members are actually superglobals.
 
@PeeHaa The array declaration is different, since I'm using an array which is returned to me via LDAP. But the data I gave you for your array is the same
 
@Prefix Does it work with the array declaration as in my example on codepad?
 
@PeeHaa OH WAIT, I think I see the problem, 1 sec
 
:)
 
@tereško so, the better solution is....?
 
7:54 PM
Jun 26 at 19:56, by tereško
@Bracketworks , dont forget that static classes are global state too
 
@PeeHaa nevermind, thought it was because my array declaration forgot brackets[] but now the var dump is spitting out `array(0) {
}`
 
$global="It works!";
function alternate_use($var)
{
return $var;
}
alternate_use($global);
 
Apr 14 at 19:23, by GordonM
Singletons are basically glorified global state, and global state is bad.
Apr 12 at 14:11, by Chris
So, static is global and global can be unpredictable. Now, finally, I get the bloody answer.
 
and if you did that for two functions you could use that global var in both and it would be immediately obvious
 
@Prefix double check the array you are using
 
7:56 PM
@PeeHaa My declaration is like this: $courses[] = $info[0]['eduStudent']; the array is returned LDAP data
$courses is my $array
 
Mar 23 at 9:48, by Jon
if because "singleton is not global state", I respectfully disagree
 
@tereško still waiting for a better solution...cause it seems global state is useful here.
 
user895378
Calling anti-global sentiment "cargo cultist" is like saying a doctor is a cargo-cultist for telling you to not to drink gasoline. You might survive it if you do drink gasoline, but the question has already been settled: you're better off not doing it in the first place.
 
@cHao My example is a better use than global...
 
@Event_Horizon no, it's not.
 
7:58 PM
@Prefix Can you post the print('<pre>');var_dump($courses);print('</pre>'); on pastebin
 
@cHao , i was still listing the comment related to your
 
the function has a specific, defined purpose.
 
7 mins ago, by cHao
@tereško that's the impression i got, yeah
you seem to missed that part
 
yes it is, its immediately obvious where the variable gets used, which isn't the case when you use global keyword
 
@cHao as for "what else to use" : a function with receives a variable and returns the changed value
and this is scary that i even have to answer this to a 20k+ user
 

« first day (661 days earlier)      last day (4284 days later) »