« first day (675 days earlier)      last day (4287 days later) » 

10:00 AM
array_delete_first()
array_delete_all()
array_delete_recursive()
array_add()
array_add_multiple()
array_replace()
array_is_subset()
array_is_real_subset()
array_first()
array_first_key()
array_last()
array_last_key()
array_nth()
array_nth_key()
array_key_slice()
array_key_splice()
array_key_rename()
I'm not creative enough. I need more functions
@hakra I know, it's hilarious!
 
no , it's scary in sad sort of way
 
array_group_by_key_substring() ?
 
@tereško I think authentication details belong to the user profile. E.g. one user could reasonably have multiple ways of logging in ;) (Like registering multiple oauth etc accounts)
 
array_shuffle_keys()
array_shuffle_values()
 
@hakra What does that one do? :P
 
10:07 AM
@NikiC that was not what i was asking
 
array_shuffle_cross_product() - shuffle key/value pairs by shuffling keys independent to values
 
@tereško okay, then I don't quite get the questoin. I thought you were asking whether auth should belong to user or user to auth.
 
Good morning
 
morning @Donut
 
Good morning.
 
10:09 AM
What is the best way to get lastest ID from table in MYSQL? I was reading on SO questions that SELECT MAX(id) FROM table; is not good way, if not, then what's better solution?
I'm looking for something similar to Postgres' pg_get_serial_sequence(table, column)
 
@Donut pdo or mysqli?
 
mysqli
 
@Donut LAST_INSERT_ID?
 
@NikiC It does not take table and column parameters
 
ah, so you don't want to get it right after an insert?
 
10:12 AM
Nope
 
@Donut If you are not using it to calculate the next number or anything you can just sort by id and limit by 1
 
Okay.
 
@NikiC I wonder how an experienced developer can actually suggest a core function that has different parameter meaning to the exetreme value / callback type even.
Really sad.
Hi @Petra!
 
@hakra in particular you can't safely delete anything with it
because strings in php can be callbacks
Uncareful usage could open up a nice security whole ;)
and obviously you also can't delete callbacks from an array ^^
but that's just minor details, the issue is that this proposal exists at all
 
@hakra hiya!
 
10:17 AM
@hakra you been to unconf?
 
@Nikic Hi
 
hi @Sharmaji :)
 
I have a question. I am having xml webservices which returns xml.
 
stackoverflow.com/a/12052745/871050 Anyone has improvements?
 
10:19 AM
Earlier developer of the project is caching json file from the response. that json file is having xml in it.
 
@Sharmaji Replace XML webservice with JSON webservice. Problem solved. (Whatever the problem was.)
 
@Sharmaji Implement an adapter pattern solution.
 
ohkk..and than I will not need this
ob_start();
echo $res;
$json_body = ob_get_clean();

header('Content-Type: application/json');
header('Content-length: '.strlen($json_body));
header('Expires: '.$api_cache->get_expires_datetime());
echo $json_body;
 
In computer programming, the adapter pattern (often referred to as the wrapper pattern or simply a wrapper) is a design pattern that translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface. The adapter translates calls to its interface into calls to the original interface, and the amount of code necessary to do this is typically small. The adapter is also responsible for transforming data into appropriate f...
 
@Truth I need to parse the xml instead of JSON right.. ??
require 'api_cache/api_cache.php';
$cache_file = 'jsonfile';
$api_call ='xmlfile';
$cache_for = 5;
$api_cache = new API_cache ($api_call, $cache_for, $cache_file);

if (!$res = $api_cache->get_api_cache()) {
$res = "{error: 'Could not load cache'}";
}
ob_start();
echo $res;
$json_body = ob_get_clean();

header('Content-Type: application/json');
header('Content-length: '.strlen($json_body));
header('Expires: '.$api_cache->get_expires_datetime());
echo $json_body;
@NikiC Thanks
 
10:23 AM
@Sharmaji Sorry :P I just hate XML ^^
 
@NikiC Oh..sorry.but thanks for you help... @Truth should I need to remove all stuff and need to use xml here right.
 
@Sharmaji The point of the adapter pattern is to take one interface and transform it to another, you take the XML API, and implement your own JSON API on top of it, and use that.
 
@Truth Ohk..It means the above code is right ?? but that json file is actually a xml file so we directly need to parse the xml rather than going for json file.
 
@Sharmaji You need a wrapper layer around the file, where you interact via it.
Just like you don't interact with the file directly, you tell your PHP file to fetch if for you from the cache,
you talk to an API, and that API is responsible for interacting with the file and process it, that you, you can "fool" the application into thinking it's a json file (because the API does the magic for you), while in reality, it's an XML file.
 
How about using Jquery for that? — freebird 26 mins ago
@Truth ;D
 
10:30 AM
@webarto :D :D
@freebird: How about not? OP wants this on the server side, jQuery is not a magic solution. — Truth 24 mins ago
stackoverflow.com/a/12052840/871050 <- wtf? someone upvoted that?
 
@Truth ok truth .. thanks for your time.
 
@Truth aaaaand it's downvoted :D
PHP could easily spit out the required snippet of Jquery! In fact all PHP needs to do is fill in the replacement text. It avoids using $dom->loadHTML and $dom->saveXML methods which might have unwanted side effects. A valid option say I, and its nice to have options, the down vote might be a bit harsh. — Anthony Palmer 5 mins ago
omfg
stackoverflow.com/questions/12052910/… these high rep users only open Javascript without jQuery :)
 
10:53 AM
@NikiC did someone upvoted this crap again or am I wrong?
 
Dunno
It just needs to be deleted
Then it's done with
 
word :)
 
@NikiC 2181 rep to go :)
 
@PeeHaa Huh? You should be able to delete already
 
10k right? or 20...
 
10:55 AM
Because it's and old question
 
@NikiC only after x hours after closing
 
@PeeHaa ah, after closing
right
forgot about that
 
0
Q: How to get end time using jquery

NikhilHere in jsbin demo i m getting start time but i dnt know any idea how to get end time. how should i go further to get end time. i dont want to change html. i have to get end time using present html. i m trying since last three days. $("#btnAllot").click(function () { var calculat...

 
heh
I think we need to subsidize @PeeHaa with rep
So he can delv too
 
11:03 AM
I can give 200 hehe
 
@NikiC delvoted, but this question would take more than 3 delvotes to remove
 
@Truth We will do whatever is necessary
@PeeHaa That's not a good question: stackoverflow.com/questions/7825448/…
Too much noise
Liked this comment:
The only situation I can think of is //eval(""); :D — Petruza Jan 4 at 15:30
 

Indian Enthusiastic Programmers

Anyone can join, it's not only for indians. Room is most acti...
:D
 
Sem
@webarto "Hi folks.. Need help in using background worker" Seriously.. good to hear they're keeping themselves busy >:D
 
11:20 AM
:P
 
@NikiC It did great repwise though :D
 
@PeeHaa it's jquery ;)
 
@webarto If we see IAP in here, should we move it in there?
 
jquery second tag :P
 
11:31 AM
@PeeHaa You should be ashamed of yourself
:P
 
hehe
 
@PeeHaa rep-whorin
0
A: Valid use cases for at-sign in php

LusitanianThere is some value to the @ sign, but it's normally a code smell. Consider the following: you're developing a library that needs to be compatible with multiple projects, and you don't want to change the error handler globally. Unfortunately, many PHP functions (including the sockets and streams ...

I wrote a better answer than you :(
 
lol everybody jumped onto that one :)
 
i knew that would happen
i do like when devs recognize that it's bad though
 
@Lusitanian There is still hope :)
 
11:39 AM
@PeeHaa this was a rep-* one for me
6
A: PHP: Breaks in default case switches?

LusitanianThere's no reason its required so long as the default is at the end of the switch statement. Note that the default doesn't need to be the last case: http://codepad.viper-7.com/BISiiD <?php $var = 4; switch($var) { default: echo "default"; break; case 4: echo "t...

no idea why
 
@PeeHaa lol, really. we all answered it ^^
 
0
Q: PHP use one central variables file inside functions

AlexIn PHP, what is the right way forward for the following situation: I have a 'central' vars.php which contains some parameters like MySQL hostname, user, pass, a $Test variable which indicates if the code is running in a test environment or not, and some other variables which I use throughout my ...

OH GOD MY EYES
 
@NikiC would be nice I think...
 
Sem
@Lusitanian Eeny, meeny, miny, moe. Where will my lovely upvote go.
 
to me
 
11:50 AM
Can i Use cURL to post to a database
 
@NikiC AAP detected :D
@Sitati why should we care?
 
Sem
Is there something even more ugly then @mysql_connect();?
 
@Lusitanian Muahaha, I got one more upvote than you :P
 
@Sem @eval( $_GET[command] );
 
0
Q: PDO refuses to delete a row of data (in specific table)

FluffehOkay, I am stumped with this one. I have a table in my database where I cannot seem to delete rows via PDO (I have noticed this behaviour for a few weeks now, it was working perfectly before that). My PHP Code is this: // Echo's have been added for testing. try{ $dbh = new P...

how can 7k user write this ugly statement?
 
Sem
12:05 PM
@tereško Fair enough.
 
Mic
@Sem, Hi Sem, May you help me with my question, please.
@PeeHaa, Good day, can you pls help me with my question? Thank you.
 
Sem
@Mic Go ahead and ask :)
 
Mic
@ Sem, yehey, thank you so much i'll post here:
pls hold on :)
-1
Q: How to Create a Key and Bind the Array Values in Multidimensional Way PHP

MicI have data here: Here's the result of my first function.The variable I used for the result was $this->arrays. Array ( [1] => Array //Transactiondetails of SiteID 1 ( [SiteID] => 1 [Balance] => 2000 [MinBalance] => 1000 [MaxBalance] => 500 ...

@ Sem, Thank you in advance :)
 
@NikiC my answer was accepted though :)
 
Mic
@Sem, still there? Thank you :)
 
12:19 PM
@Lusitanian :P
 
Hi folks.
Is there a good place to see/grab a template for RFC content/structure?
 
what kind of RFC?
 
12:49 PM
@Mic I saw that multidimensional array 3 or 4 times on SO, different users, what's with that? It's a school assigment?
 
@MihaiIorga I sure hope it's not some new framework :P
 
script.aschool.us :)
 
how do i php
 
@NikiC It's already opened, but I don't think it should be.
 
1:03 PM
@Truth See the comment below it. It was discussed on meta a few times already
 
@Truth consensus on meta
is that it should be
@NikiC do you know of a matrix math lib for php? :)
 
nope
 
sadface
 
Wouldn't be nice if they made something with php.ini? I mean it will be nice that in the future to set some ini in headers (ini_set('php_ini', 'development');) and PHP will load that specific ini file?
 
@Lusitanian There probably are userland libs, but for matrix computations a C implementation is a must
 
1:05 PM
I know, exactly
a pear package is useless here
unless i have some uber-php-compiler-magic
 
Models sending emails? You must be kidding...
 
Doesn't seem to have particularly many features
 
"Fortran 90"
hm, lemme take a look
loks like it has a tiny subset of the actual libs features
but may have all i need
thanks!
 
what you need it for?
 
econometrics
if that's a word :P
 
1:12 PM
> either the controller or a mediator. but not you DB models..
 
DB models he says...
 
@ircmaxell You wanted to ask something yesterday?
 
yeah, I'm about to skip off to work though
I'll catch up with you later
nothing important
 
@ircmaxell , of course , we all know that controller is were the real work happens in MVC
the model is just pretty interface for mysql
 
Does Twitter have some kind of financial interest in spammers?
 
Mic
1:14 PM
@ Mihai sorry fot the late response, no, it's my current project :( but it takes difficult for me :( I'm so sorry guys if I always ask a question.
 
Because I see no reason why they can't automatically block them.
 
@ircmaxell in my case its triggered by the Registration Service that know all my business logic.
 
@NikiC , because then you might want to also block twitters "advertisement campaigns"
 
that's too advanced to do in a language like java
 
I'm out, later
 
1:17 PM
I mean, seriously, it can't be that hard to detect users where the majority of the tweets has the form @xyz http://abc
 
@NikiC it improves their look to investors
more tweets = good
 
your default investor know as much about internet as he/she does about gene splicing
 
1:30 PM
 
@NikiC hahah lol
 
@PeeHaa @NikiC i can't erad it
what's it say
 
@Lusitanian You're really missing out :D
 
:(
only 3.5k rep
needs moar
 
@Lusitanian 1 sec lemme cap
 
1:32 PM
i'll go on a reptrolling rampage
 
user image
7
 
omg
 
It got closed because the title didn't match the question :)
 
"social-networking"
Lol
 
why...
 
1:35 PM
needs moar stars
 
-1 for not using curly braces as it was meant by god ;-) — PeeHaa 7 mins ago
 
That's impossible.
 
HTML. is. not. a. regular. language. HTML. is. not. a. regular. language. HTML. is. not. a. regular. language. HTML. is. not. a. regular. language.
 
@_teresko only if you make them so. I use DTO's and leave business logic to the Service Layer
 
0
Q: ubuntu screen black after log in

dotI have a problem with my ubuntu install. After I get the log in prompt, the screen goes black and never comes back. But I know the system is running because I can ssh into the box and my websites that I built still run. I think the problem is related to the fact that a few days ago, I had seri...

 
I just noticed the Indian Enthusiastic Programmers chat room ... has someone created it to avoid all the unanswerable questions we had been getting a lot of?
 
@cauancabral and models should not know about your business logic or information flow. Separation of concerns.
 
Hi all can plz smoene tell my how to program a site like facebook i want to start the web 2.0 business and sell it for money my site will be bigger than facebook and google
9
 
1:58 PM
Good morning
 
sure, wait 1 minute
 
Afternoon @ircmaxell, how's life/work?
 
You want it PHP, Python or dot.NET ?
 
going good, and yourself?
 
@Greg you will definitely need Ruby on Rails and JQuery with coffeescript ... and a Mac , you cannot make social networking sites on Windows
 
1:59 PM
@MihaiIorga This took you a minute?
:P
 
@Donut Almost ... I'm getting older :)
 
@tereško static html pages 4 life
 
@ircmaxell not bad thanks, just spent a lot of time today trying to hack php to do something it shouldn't ... and failed :/
 
@ircmaxell morning :D you always have two mornings per day, right?
 
@NikiC One at home, and one at work
 
2:04 PM
looks like something interesting is happening at apple : discussions.apple.com/thread/4220060
 
@NikiC yes, I've been there. Was really great!
 
@NikiC: My plans changed for Europe in October. I'm skipping Munich because Oktoberfest will be over by then. So now I'm setting up another schedule, do you think Berlin is worth going to?
 
One of the best cities in Europe. Why not...
 
@ircmaxell sure
oh @ircmaxell we are missing your here: stackoverflow.com/questions/667382/…
 
@NikiC that doesn't sound overly sure...
 
2:16 PM
@ircmaxell Berlin is great
@tereško :D
 
Berlin of current is probably what New York was in the 70ties.
 
@hakra that's not exactly a good thing
 
@PeeHaa cannot you just see hordes of hipsters panicked and running in circles
 
2:32 PM
 
@NikiC How long before we can vote on generators?
 
hehe I can :)
 
    /**
     * @var int The number of items per page
     */
    protected $pageSize = 50;

    /**
     * @var int The number of items per page
     */
    protected $windowSize = 5;
@PeeHaa
Wrong description?)
 
@hookman copy paste FTW! ;)
 
2:46 PM
@PeeHaa ^^
 
i might see why you would want a docblock for $windowSize , but what's the point of using it for $pageSize
do you really imagine people going "i wonder , what this variable could be for ... "
/**
 * Returns the ID
 */
public function getId()
{
     return $this->id;
}
pointless ..
 
@tereško comment for each line of code, ftw! ^^
 
@tereško It may be useful for documentation generation
But I do agree :)
Yeah I just pinged three times for the same message I suck :)
 
@LeviMorrison four days
 
no worries , i was in the kitchen
 
2:51 PM
@PeeHaa what would you do if you needed to join two tables in order to get the data?
 
@hookman JOIN them :)
 
@PeeHaa Each entity of your model layer is associated with one table... How would you do that?
 
@PeeHaa wrong answer , you should have said "then i would use activerecord , of course"
 
@hookman Are you sure you have read the disclaimer of the project?
 
user895378
@LeviMorrison Yeah -- it doesn't happen often, but I was frustrated and just had to take the afternoon/evening off and not write any code :)
 
2:55 PM
0
Q: php regex - search for matches and save and maybe replace it

Timo Rütteni'll try to explain my question in the best way i can ... okay. i have a multi line string like this: Hello World And again Hello <a:b:c> And again ... Now i want to replace but it depents on what is the first letter, the second and so on. I have a regex snippet to get an array with th...

preg_maybe_replace()
 
@PeeHaa It's not a complaint. I don't have decent knowledge in OOP, and thought that i'm thinking of a problem which does not exist
 
@hookman What happens in there is a coupled the models 1:1 to tables (not exactly but you get the drift) Either one run 2 queries or builds another model :)
Yes beeer time
 
@PeeHaa How would you run 2 queries if you model entity knows about 1 table?
Am I missing something?
 
@hookman query 1 use data to run query 2
 
@PeeHaa Yes, but you need second table name also
 
user895378
3:01 PM
@Darius Yes, it is possible to send multiple HTTP requests at the same time in PHP. You can use sockets directly and use the socket_select function inside a loop to receive all the responses in parallel. It's a non-trivial task to get right, though, and you'll likely have a much easier time using the curl_multi_* functions if you have access to the libcurl dependency. I would offer you my own library that makes this a simple task, but I'm in the midst of refactoring it at the moment :)
 
@hookman Yup. You would need two classes when going that route.
 
user895378
If you go the socket route, you need to setup a state machine and read until you've received all the HTTP response headers and then determine the entity body according to the rules set out in RFC 2616.
 
@rdlowrey refactoring... again
:)
 
user895378
@PeeHaa Yeah, it's a curse. I just have to get the architecture right before I move on otherwise it'll be a nightmare to maintain :)
 
@rdlowrey If it's needed it's needed. :)
 
I didn't write any code last night. Rewatched some of Misko Hevery's talks.
 
user895378
I spent literally three hours reading various theories about how the "A Song of Ice and Fire" book series will end :)
 
Can anyone give me help with XPath? When supplying a context node, the query has to be far too specific to return nodes...
 
> Discussion for all things PHP - Don't ask whether someone is here or can help. Just tell us your problem. If anybody can and wants to help, they will.
 
3:18 PM
@salathe In XPath, when supplying a context node, the query has to be far too specific to return nodes...
 
what the funk are you talking about?
 
@webarto PHP
 
like talking to a bot... what is your question? All I see is some nonsense statement...
teh codez
 
how to jquery xpath
 
3:22 PM
Hey there Levi
@LeviMorrison
 
@Lusitanian there is a plugin for that :)
 
@webarto :D
 
Hi
 
3:40 PM
@JordanRichards Hello :)
 
@JordanRichards Sorry haha didn't mean to click that.
 
Has anyone here purchased the Raspberry Pi?
 
no but do want
 
@rdlowrey Feeling better now?
 
user895378
@LeviMorrison Yeah -- I just hit the wall and got a little burned out yesterday. Motivated once more :)
 
Is there a magic method like __toString() to change how an object is displayed in a var_dump?
 
again, WTF
 
I don't think that's a WTF question
 
3:55 PM
well... do you see one here: php.net/manual/en/language.oop5.magic.php
 
@Greg Internally there is :P (get_properties or get_debug_info depending on purpose). In userland there isn't :P
 
@NikiC aha yeah, that's what I was looking for
sorry @webarto, I am aware of the PHP Docs. My question may have seemed a little weird, but that's why I asked... because I didn't have any other ideas and thought that here might be a good bit of inspiration.
I guess I should have said 'is there a method like the magic method toString()', but I didn't expect a response like I was on IRC... else I would have asked on IRC :)
 
Unfortunately, there is not, if you post an example of your expected result, you might get help, otherwise, no one can read your mind or have enough time to figure out your cryptic questions.
 
Heh ok, I'll stop asking cryptic questions when people stop answering them :D
 
4:22 PM
Finally, some feedback
18
Q: Security Review - password_hash implementation for PHP

ircmaxellI'm currently working on a "helper function" for PHP's core to make password hashing more secure and easier for the majority of developers. Basically, the goal is to make it so easy, that it's harder to invent your own implementation than to use the core secure one. It's also designed to be updat...

 
@ircmaxell nearly two months later (:
 
yup
 
4:37 PM
I have no rep on security or I'd give it a fat +500 bounty
 
4:48 PM
@ircmaxell the thoughts of you talking about traits as a potentially abused feature now come rushing back
 
1
Q: Finding and dealing with duplicate users

ChrisIn a large user database with the following format and sample data, we are trying to identify duplicated people: id first_name last_name email --------------------------------------------------- 1 chris baker 2 chris baker chris@gmail.com 3 chris ...

 
user895378
@Lusitanian Traits: bringing PHP Service Locators to the masses since 2012.
 
@Lusitanian :-D
 
@rdlowrey lol
Let's take a trait, tightly couple it to a global class and then have it provide a service locator!!!
 
tight coupling to tight coupling?
 
4:56 PM
wait, it's actually not coupled to a global class
it just looks for a property called app
 
@ircmaxell I like the idea, but can I ask why not an OO implementation? As much as I love PHP, I am loathe to see yet more do_something() functions in the core
 
still is awful though
 
what would an OO implementation look like, and what benefits would it provide?
 
user895378
That usage is even worse than asking for the service locator in the constructor. Every class that uses the trait has instant access to everything in the application. The constructor API doesn't even lie about what it needs ... it doesn't even have to exist.
 
@rdlowrey yes it does, but it's base's constructor that does it
 
4:58 PM
@Chris regarding that question you posted
 
which is even worse...
 
@ircmaxell oh...):
anti-pattern density record goes to...
@Chris why not a table called non_duplicates. each row contains a primary id, and two user ids
just set pairs that aren't duplicates
and reference that when building report
 
@ircmaxell Organization, mainly. Some of the PHP functions that are both procedural and OO are basically using the OO version as a way to namespace or ogranize
 
I just replaced a string in 30 files by hand, because I didn't want to figure out how to do it with the crappy unix tools :/
 
@ircmaxell And extendable, if desired
 

« first day (675 days earlier)      last day (4287 days later) »