« first day (806 days earlier)      last day (4142 days later) » 

user1125394
12:07 AM
I agree sql covers all application needs, I guess nosql was born to avoid the hassle of schema creation, of altering tables when design changes
 
I will go zocking now. Cu l8ters folks.
 
user1125394
I mean the new db's was born, because hashtable are there since before of sql
 
// however, you might wanna check this out:
$array['func'] = function(){
 echo "hello";
};

$array['func'](); // it works! i discovered that just recently ;)
Just read about it on php.net
Seems very flexible
 
@Eugene afaik that has worked since forever
the inverse is new in 5.4 though: $func()['foo']
 
@igorw how could it be? Anonymous functions where introduced quite recently.
 
12:16 AM
string function names :)
 
user1125394
$func = function(){
 echo "hello";
};
$func();
 
@igorw emm, what? What are you talking about?
 
user1125394
what's the diff with ^
 
user1125394
there's nothing special
 
@cyril well only, that it uses an array. Not everything that is allowed with simple variables is allowed with arrays.
 
@Eugene this is what I meant btw: `$array['func'] = 'var_dump';
$array['func']('foo');`
 
@igorw I see. And that became possible only since PHP 5.4?
 
no, that's been possible since the beginning of time afaik.
in 5.4 you can do this, which you could not before:
`$func = function () { return [ 'foo' => 'bar' ]; };
echo $func()['foo'];`
 
And what does it do?
I mean last line.
 
outputs "bar"
 
12:27 AM
Ou. So you can immediately address result?
 
yes
 
As for anonymous functions, how to invoke such lambda function:
$obj = new stdClass();
$obj->func = function(){
return 42;
};
 
@dev-null-dweller either call_user_func or assign to a var, then call.
 
12:30 AM
$var = $obj->func; $var();?
 
yep
 
yes, I know this way
 
otherwise it will look for method func in stdClass?
 
also $obj->func->__invoke();
 
exactly
yeah, that works
 
12:31 AM
I see.
Good to know.
 
actually it'd be kind of nice of this worked:
($obj->func)()
 
@igorw I was just about to post that ;)
 
@NikiC thoughts?
 
or "{$obj->func}"(); ;P
 
12:35 AM
ugh :D
 
well, php 5.5 has string dereferencing so it might work
 
@NikiC btw, I have a strange segfault that is probably related to generators. no minimal script, but I have core dump + backtrace: gist.github.com/b19325f95492fd402700
@dev-null-dweller whoa, did not know that. this is awesome :)
 
@igorw Do you have one with line numbers?
 
12:52 AM
@NikiC I failed to paste, now updated, refresh page
better?
 
do you know whether the segfault happened in conjunction with a fatal error?
 
yes, it did
 
ah ok, I wasn't sure what to look for. thanks for looking at it :)
 
It's not hard to fix, but I'd like to check back with dmitry before doing it
Also I'm lazy (that's the main reason...)
 
1:00 AM
@dev-null-dweller parse error, I guess it only works for array access notation currently.
@NikiC sure, if you let me know when it's fixed I'll verify
 
To be honest I'm relived that it does not work ;)
 
@ircmaxell I think it would be cool to make the zvals polymorphic. I think that would be a lot more convenient for doing a lot of stuff. Are you sticking with the IS_ flags for some particular reason?
Does this look like a delv-pls? stackoverflow.com/questions/6590902/…
I think it does, so:
 
php is for web apps, not for 3d. You need a lower_level language. — Codeglot Jul 6 '11 at 2:23
 
I think the answer is very unprofessional
Nobody uses print
Also it should really be using nowdoc there...
 
previous comment is from a person with 3 (!!!!) reputation points in PHP. clap clap clap.
 
1:14 AM
@igorw He uses rails, nothing else to expect ;)
 
@NikiC I was trying not to be an asshole, but yes.
(lambda stored in object property)
 
1:32 AM
@igorw @NikiC it could be used with any expression, like (tell_me_what_to_execute_now())();
 
ideally that one would even work without the parentheses. function function dereferencing in addition to function array dereferencing.
the next step would be function () { return 42; }()
:)
 
looks good to me
 
@NikiC what's the best way to push for this? write an RFC? and I guess a separate RFC for each?
 
@igorw I'd just wait
laruence wanted to do this
Though you never know, waiting isn't always good when it comes to PHP :/
@igorw There are some tricky things with implementing that though
One is that if you put a closure in there it would segfault on your because it expects to be externally referenced to work
forget the last thing I said :D
anyway, good night now
 
@NikiC laters
 
1:42 AM
@NikiC glad to hear that core is already on it. g'night!
 
user1125394
1:59 AM
anyone here mind browse to 138.96.242.20/geo want to test server-sent events
 
@cyril I did something. did it work?
 
user1125394
138.96.242.20/backend/… triggers SSE events
 
sweet! what are you using for it?
 
user1125394
java.io.IOException: Broken relay (pipe)
 
user1125394
sometimes I get that
 
user1125394
2:07 AM
on the Java SSE server
 
user1125394
when the app is idle for long
 
3:08 AM
Is it possible to change the background of the page to an image by fading it in?
like a transition?
 
@DemCodeLines Indeed it is.
 
If so, then how?
I tried a lot with JQuery, but failed.
doesn't work though
<input type="text" onkeyup="$('#body').fadeTo('slow', 0.3, function(){ $(this).css('background-image', 'url('http://www.hdwpapers.com/walls/windows_vista_aurora_standard_hiyaany_more_looking_general_desktop_wallpaper-normal.jpg')');
}).delay(1000).fadeTo('slow', 1);" />
Doesn't work.
 
I don't know if you can do it like hat. In which way are you trying to "fade"?
 
the page by default is set to some random color. Like Red for example
if the user pastes a url into the textbox and hits a button (not shown above), the background should fade into that image that is retrieved by the URL
@Nile ^
 
@DemCodeLines google finds lots of results
 
3:13 AM
I looked at many of them, but couldn't get it work
 
@DemCodeLines Try jquery background fade to image
 
3:30 AM
couldn't get much out of it, but no problem, thanks for the help :)
 
@DemCodeLines you need to extrapolate...
 
Does anyone know why this isn't working?
  $current_a = explode("-", $current_cart);
  print_r($current_a);
   echo $pos = array_search($product_id, $current_a);
  unset($current_a[$pos]);
 
depends what you're trying to do
 
hmm wait
i found why
lol
 
 
1 hour later…
5:00 AM
1 hour later…
 
1 hour later...
 
1 hour later…
 
> 1 hour later...
 
11 mins ago, by NullPointer
1 hour later…
@Lusitanian its bold text ...:P
 
i know :p
 
5:14 AM
hello
 
:6923220 _1 hour later…_
 
NullPointer
 
@NullPointer What are you trying to do??
 
no idea how this chat works!!!
 
how to write italic with bold ?
 
5:15 AM
@NullPointer ***italic bold***
1 hour later…
 
@ShaquinTrifonoff yey'
 
Or ___italic bold___
like this
 
@Rocks so using asp backhand and web socket/ajax with database .... lol
 
what??
 
@ShaquinTrifonoff i got it .. it's burrrrr
 
5:17 AM
can i post my question here?
 
@Rocks yup ... you can ask here ...
 
good
so i am trying to convert this code to PDO and i'm stock, any suggestions?
$input = $_POST['input'];
$categories = $_POST['category'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];

$qq = " SELECT * FROM classified ";
$result = mysql_query($qq);
$rows = mysql_num_rows($result);


if ($rows>0){
$q = " SELECT * FROM classified where confirm='1' ";

if(( $_POST['input']!='Search')) {

$q .= "AND title LIKE '%".$input."%' ";
}


if (!empty($_POST['search_category']) )
{
$q .= "AND id_cat = '" . $categories. "' ";

}

if (!empty($_POST['state']) )
{
$q .= "AND id_state = '" .$state. "' ";
 
but we dont want to see big wall of code .. so if you want to write code here please dont do this .. just write in pastebin.com and link here
its ok ...not too long
 
sorry
 
so 1 you need to validate input form post ,check post is set /not
and than ... check either this or this
both are decent article ..
 
5:22 AM
I gave it a try like this pastebin.com/CFU3pvGP
 
id recommended to use try catch ..instead of die
 
good point
the code doesn't work thou
I get no results
 
what you getting
if (count($cond)) {
    $query .= ' WHERE  ' . implode(' AND ', $cond)or die(print_r($query->errorInfo(), true));
}


$stmt = $db->prepare($query);
here in query ?
 
I made use of the implode function to glue all the conditions together in the case at least one condition is defined. And to combine this with security when using prepared statement
or like this:
if (count($cond)) {
$query .= ' WHERE 1 ' . implode(' AND ', $cond)or die(print_r($query->errorInfo(), true));
}
 
before smtp what is $query now ?
 
5:34 AM
this:
$query = (" SELECT * FROM classified WHERE confirm = '0' ");
$cond = array();
$params = array();
suppose to be like this:
$query = (" SELECT * FROM classified ");
$cond = array();
$params = array();
I was just doing some changes and paste it wrong
are you there?
 
yupp... i am back
 
5:50 AM
Ok i'm getting this: SELECT * FROM classified WHERE title = ?
and if I select a category I get this:
SELECT * FROM classified WHERE title = ? AND id_cat = ?
 
6:08 AM
It's a generic question!
No code any help provided
 
have you tried to debug your code ?
 
no
 
your query seems fine to me
 
I thought so too
How about this part:
if (!empty($input)) {
$cond[] = "title = ?";
$params[] = $input;
}
it should be
 
also empty takes white space as a character .. so if thre only white space it will go inside body
 
6:11 AM
if (!empty($input)) {
$cond[] = "title = :input";
$params[] = $input;
}
but i'm not using named placeholders
 
what you need to chedk what you getting in query and param before query if its ok than every thing before it is ok
 
It's been a long day. I'm sure I get something tomorrow
Thanks for your help
 
@Rocks sorry i couldnt solve your problem .
 
You helped
thanks
 
@Rocks yours welcome
 
6:16 AM
buy
 
later
 
Hello everyone. does anyone know the answer to this question:
3
Q: I want to add a facebook functionality of displaying a message when my user looses internet conenction

user1763032In facebook if you loose internet connection, you see a message "No internet connection. Try again." and you are changed from online to offline. I want that in my website. How can I do that?

 
6:46 AM
Anyone able to help out with a regex ? Trying to get "foo/bar/?keyword=hello&page=2&sortby=views" to "/search/foo?keyword=hello&page=2 ? I haven't found any tutorials on how to pass two get variables over to the rewritten form. A link to a tutorial perhaps? Thank you.
 
7:02 AM
Hi i am wondering if anyone would be able to help with a code igniter product category tree?
 
fantastic
 
@user1093111 serial down voting or answer or pointing anything else ?
 
ha, well i wasnt sure if the serial down voting was at me
 
@user1093111 somebody downvoted my 4 answer within 40 second
 
7:09 AM
@nu
wow. Sorry im new here.
@NullPointer they must be nice
 
7:26 AM
@TimPost have to ping you .... some dude serial down voted me .. i got 4 downvote in 40 second ...
 
user50049
@NullPointer Not enough to really show up on our radar. If it continues the system will catch and reverse it
 
@TimPost mai i ask how many serial dv it requires ?
 
user50049
@NullPointer I can't really discuss it.
 
user50049
What I'm saying is, I don't think it's one person.
 
@TimPost ohh privacy policy ...
 
user50049
7:31 AM
Well, I don't give out details of how our voting fraud detection works, at all .. or that's just information to be used to circumvent it.
 
user50049
In this case, it doesn't appear as if you've been targeted by a single user, hence it's not revenge down voting.
 
user50049
Probably just a coincidence
 
@TimPost agreed .... also i am not suppose to be ask .. . than its fine if it just a coincidence ...thankyou for your supports .... you are rocking :)
 
user50049
If you see it keep up flag one of your posts as 'other' and let us know.
 
7:48 AM
@LeviMorrison hola
 
@NullPointer Hola.
 
@TimPost and his magical moderation tools!
 
:6923625
lol..:P
 
user50049
Do I want to know what that is?
 
@TimPost lol.. i am .... kidding ...
 
7:53 AM
"wat."
 
@Lusitanian ?
 
just... wat.
 
user50049
Well, whatever that is, let's go do it to all the things.
 
exactly
eh it's 3 am
i'm going to sleep
 
@Lusitanian later .. gud night ..
 
7:57 AM
night
 
 
1 hour later…
9:31 AM
Guys I need help in my php code
 
@Othman what help
 
about templates in php
I am building a script similar to CMS, and I want to allow the admin to change the design of the tables
I couldn't find any approach to do it.
 
9:46 AM
The problem is not how to show the data.
Is how to give the admin access to change the table design
 
if admin want's to change the "design of table" then said admin should be well versed in CSS
 
<aside class="block">
<header class="block_header">{title}</header>
<article class="block_content">

{content}


</article>
</aside>
 
stop trying to create another "CMS for developers"
normal people DO NOT NEED to make new templates
 
yeah that's right
but if the admin wants to add a new div ?
 
the he/she either knows programming, or he/she should stay da fak away from code
 
9:49 AM
OK
do you see the above code ?
how i can put a dynamic php code inside it ?
 
yes , see
it is pointless
PHP itself is a templating language
4
use it
 
Look, I need a way to change this block design one time.
I am using this design 50 times in my website.
I need it to be in one file and create the block itself
Thank you though
 
11:03 AM
@tereško not trying to start a flame war, but that post completely lacks HTML escaping.
 
@igorw emm ... that post also lacks the rest of the application which might be using that kind of templates
your point ?
 
my point is that if you advocate against template languages, you should address the issue of escaping. at least imo escaping would be the only reason to use a template lib. but perhaps I'm just being an ass, so I guess I'll stop here.
 
did you actually read the article ?
 
as a matter of fact yes, I did.
 
11:35 AM
@tereško I need to find a better way to phrase my concerns, so that we can discuss them in a civilized way. but not today :). still waiting to see @rdlowrey's approach. so nevermind!
 
user50049
PHPunit thinks I'm a horrible programmer
 
user50049
(it might be right)
 
user50049
Sharing fixtures can't always be evil, can it? I just need to preserve something returned by the first test for the rest of the tests to use, so I can clean up after running tests and not leave a ton of test crap in a database.
 
Hey guys
 
@TimPost as in creating the db once and using it for the whole test suite?
 
user1125394
11:48 AM
serversent events with Glassfish is crappy, after a couple of minutes, clients lost the connection, ("broken relay exception") guess it's Java's implementation that sucks
 
user50049
Sort of. My first test results in a record being created and its ID returned. Every subsequent test needs to know that ID, as it has to be referenced in the call. I can just have those tests use a function to get it directly from the DB, just seems silly since its known after the first call.
 
user50049
I'm testing a RESTful API I'm working on
 
user50049
I have tests written that just test the business logic, all of that is decoupled. Testing the client is just kind of tricky
 
user50049
and singletons suck for testing.
 
user50049
I'll just put all of the client tests into one big test
 
11:52 AM
Anyone got time to set a fool straight? Got some issues with logic by trying to return error messages if a user doesn't meet the conditions.
 
user50049
Aw man I'd love to trade issues with you
 
haha I am lucky I am still a noob.
Noob = noob problems ^^
 
@TimPost it kind of depends. speaking of which, you can use the @depends annotation to return some information from that test case to the other ones.
but since you are most likely creating different sets of functional tests, I'd try to make them more isolated if possible. the trade-off in this case is usually the speed at which the test suite runs.
are you testing against an sqlite in-memory db?
 
user50049
@igorw No, MySQL. What I'm exercising is the client I wrote for the API.
 
@TimPost in that case I'd consider making a snapshot / recording of the server side and dump that to static files, then run the client against those.
with a way of re-generating those static fixtures
not only will those tests run way faster, it produces a cleaner separation
I've never used it, but you could take a look at wsunit for that: github.com/lapistano/wsunit
 
user50049
12:00 PM
@igorw That sounds like a winner. I knew I was going awry when I found myself wanting to share fixtures
 
user50049
It's so much easier for me to just persist what I need in Redis, actually.
 
user50049
I really need to spend more time just playing with phpunit
 
the main point is that you're testing the client. which means you probably do not want to test the API itself at the same time.
 
user50049
totally separate tests
 
the client should not care about storage, etc. the client just cares that if it sends x, it should receive y.
 
user50049
12:06 PM
And it does. It's just the tests that have to remember what some of the client calls returned in order to test the other calls
 
and when testing the client you only care that if it sends request x and the API (fake API also counts) sends response y, the client does the right thing with that response
 
guys is it alright to nest if statements infinitely into eachother?
 
@TimPost if you only have a few tests that are related then using @depends to chain calls is ok imo. but once they are no longer in the same file, you should probably use composition to do those calls
@TimPost since you want to be able to look at the test and see what it does right away. without it depending on some global state, etc.
@MarioS that usually means that you should be using a loop instead.
 
Yea, I figured as much.. loops make my head hurt though :[
 
@MarioS it's not that hard. in most cases a loop just means that you have a list of things and look one item at a time.
 
12:27 PM
1
A: About "mysql result" resources

shiplu.mokadd.imFrom PHP.net manual of mysql_unbuffered_query, mysql_unbuffered_query() sends the SQL query query to MySQL without automatically fetching and buffering the result rows as mysql_query() does. This saves a considerable amount of memory with SQL queries that produce large result sets, and you c...

 
i know too little about mysql_* to be sure that it any of this is true ...
 
user50049
1:04 PM
yehey! First time ever. Finally, I made something with a completely decoupled design verified by completely decoupled tests. And I can't show it to anyone. Booo hooo!
 
You deserve a ^5.
 
@TimPost does that mean you tried wsunit?
 
user50049
@igorw I just re-thought the client tests completely
 
okies :)
 
user50049
Though wsunit does look extremely handy for more complicated cases not so easily 're-thought'
 
1:22 PM
@NikiC That's an idea... I just implemented it to get it working. But that may be a good option...
 
@ircmaxell morning :)
what evil thing are you guys going to do to php? :)
 
hi friends! anybody can help me how upload local system files to google drive using php script?
 
;-)
 
1:48 PM
github.com/ircmaxell/PHPPHP/issues/2 the bar is set high ;-)
 

« first day (806 days earlier)      last day (4142 days later) »