« first day (1396 days earlier)      last day (3566 days later) » 

12:29 AM
@RahulKhosla NOW()?
 
Is that a real function?
 
@CSᵠ welcome back
@RahulKhosla MySQL function
 
Oh ok, thanks.
 
yey :) you too btw
 
@CSᵠ I was never gone, just hiding in the shadows
 
12:30 AM
same :)
 
watching O_O
 
and less time
sneaking around heh :)
 
yay, the NSA really cares about us =o)
 
HTML5, JavaScript, PHP, CSS and XML => ONE
wtf
programming ^ ???
 
or...they want a unified language which they can easily parse to datamine.
> The only software coming from the NSA will be malware
haha so true
 
12:34 AM
> Wyvern requires the Java 8 JDK.
no thx
lol
 
ah, so the closed source prerequisite to install
every Java update will be a hotfix to steal one more liberty of yours.
 
12:47 AM
@crypticツ ohi, you're back from the dungeon :)
 
@Jack hey, yeah back from my bunker for awhile. Will likely head back in and seal myself before Ebola gets here, lol =oP
 
12:59 AM
Who is Ebola?
is she crazy?
 
 
1 hour later…
2:21 AM
Hi, need help decrypting an encrypted using PHP in objective-c
 
what what?
 
I am using this to encrypt the string in PHP openssl_public_encrypt($string, $cryptedText, $this->publicKey);
i want to decrypt this text in objective-c
 
wrong room then, see for help in the obj-c chat room
 
okay, so what's the problem?
 
@CSᵠ sure, going to check in there
@Jack i tried various method to decrypt in objective-c and none works
I was hoping for any pointers
@CSᵠ i couldn't find any room for obj-c
 
2:43 AM
@IbrahimAzharArmar Add what you have tried in your question.
 
 
1 hour later…
4:00 AM
hi, anyone here?
 
4:50 AM
is there any advantage of
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
over
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]{2,}+\z/i
for a beginner level email regex validation?
(i know i should use PHP's inbuilt , but i am trying to learn regex)..
i tried to use regex101 , the first one takes 24 steps while the second one takes 13 steps to match
abc@de.ef.co
 

RegEx - Regular Expressions

Discuss about Regular Expressions. Learn at: Regular-Expressio...
 
5:21 AM
@shortCircuit please use filter_var() instead
 
@tereško i am not doing php right now.. :) in php i use filter_var ... and i have seen that jumbo regex in the spec ..
 
5:38 AM
ruby is purely OO .. and everyting you do invokes a method on the variable name .. a[0] == a.[](0) ..
can these be any more twisted?? god..
 
5:55 AM
morning
 
morningz
Genie. You're free. http://t.co/FWQWPDPP42
7
 
Hello everyone good morning
 
6:10 AM
morning
 
can you help me in cakephp
I am facing some kind of problem
 
@user3752096 cakephp is your problem
 
my network has slowed to an unbelievably slow crawl ... as everyone searches for their favourite Robin Williams clips this morning :(
 
@pa
@Patrick no
 
6:36 AM
posted on August 12, 2014 by kbironneau

/* by Sbiky */

 
@user3752096 what is the problem?
 
^cake php
 
awsome
 
my birthday cakes :D
 
u were the one who did the elephant php??
 
6:46 AM
I dunno what you mean ... so probably not ;)
 
why does the elephant move so fast?
 
because
 
6:56 AM
if (5 + 1 == 7) {
    nothing_makes_sense();
}
 
> No one was hurt in the incident but an employee riding in a car behind was suspended in mid-air for three hours before he was moved to safety.
5 + 1 == 7 for large quantities of 1.
 
my internet is nice and broken this morning ...
 
shocking news that
 
@JoeWatkins well
morning
 
7:13 AM
moin @AlmaDo
 
morning all :)
 
@RonniSkansing please see this link stackoverflow.com/questions/25257410/…
 
morning
 
mornig
 
7:30 AM
@akhilesh have you spend 3 min reading the php manual, especially php.net/mysql_query ?
 
morning
 
morning
 
morning new ppl
 
what the heck...
 
7:35 AM
where
 
@RonniSkansing it would be better for me if you solved my issue
 
@AlmaDo I was surprised that @user3752096 replied to @RonniSkansing. It means that this user has multiple accounts!
 
morning
 
@HamZa I think he changed his account name
 
@RonniSkansing i have read the php.net/mysql_query
 
7:37 AM
yay, I now know new way to get help: intimidate :p So.. "It would be better for you if you solved my issue. Or else.."
 
@akhilesh and did you notice the big red box?
 
@user3752096 btw room owners and mods can read deleted messages :)
@AlmaDo where did you read that lol
 
room owners can?
 
@AlmaDo yes
 
@HamZa I just invented that :-p
@HamZa when I was owner here I couldn't ..
 
7:38 AM
@AlmaDo Yes you could, you just had to click on the deleted message and view history :)
 
@HamZa so I was too lazy :\
 
@akhilesh did you read the red box? (in top of the mysql_query page) it pretty much says do not use this. So why are you using it?
On your question it seems like you already got a answer which you commented back on about using render or something?
 
@RonniSkansing i am trying with it
 
how to filter array by array key ? key is greater then $var ?
any solution without foreach ?
 
any such solution will still use loop inside it (it'll be just explicit) - if only your keys aren't sorted
 
7:48 AM
I mean any PHP core function for this ?
 
@user007 have you looked at this list php.net/manual/en/ref.array.php
 
@user007 nothing elegant
you could do a flip/filter/flip cycle
 
okey so its better to use foreach ?
 
yes
 
@NikiC you couldn't ..
 
7:50 AM
Morning
 
@AlmaDo you could maybe ^^ depending on the values
 
use array_map() for the win
 
@NikiC doubt. values may be same
 
yeah, flip might not be a good idea
 
my array key contain timestamp, I want to get value which are newer then a given time
 
7:51 AM
@user007 just use a foreach loop, it's way simpler
 
@user007 what is the reason for avoiding a foreach/loop ?
 
I am using foreach currently, but I just want to ask if there is any php inbuilt function
 
Hi all. Anyone guide me to parse this type of JSON in Php. pastie.org/9464068 @AlmaDo
 
Solution will be ugly. Use foreach
$var    = 5;
$array  = [2=>'foo', 0=>'bar', 7=>'foo', 6=> 'baz'];
$result = array_reduce(array_keys($array), function($c, $x) use ($array, $var)
{
   if($x>$var) $c[$x]=$array[$x];
   return $c;
}, []);
 
@AlmaDo Thanks
 
7:53 AM
@AlmaDo ahhhhh
my eyes
 
kekekeke
 
@NikiC there's only if without {..} .. so
 
@TopCat google it, json_decode()
 
@AlmaDo and incorrect whitespace in a number of places ;)
 
@NikiC huh, where?
 
7:54 AM
Done but i cant access inner elements Got Trying to get property of non-object @HamZa
 
one more suggestion need, I am caching my array in a file.. I want to ask caching in file is better or caching in APC is better ?
this array is used to PUSH live updates to browser...
 
@AlmaDo for example after the if?
 
@NikiC well, it would work..
 
@TopCat you also forgot محمد رسول الله :)
@TopCat use json_decode($json, true); ?
 
yes
@HamZa is in my hearts
 
7:55 AM
@AlmaDo so what was the comment about the {} about? works without as well
 
@NikiC that was about "bad styling"
 
@AlmaDo so is the whitespace ;)
 
opnionated
 
anyway, foreach there would be just simpler
 
off-topic: has anyone tried Yoga? Your thoughts?
 
7:58 AM
@HamZa yeh I always do :D
 
@HamZa Yoga is some heavy shit..
 
Really?
 
@HamZa it was too boring..
 
I see
 
@user007 what php version are you using?
 
8:03 AM
Each person has own way to relax. Well, for me yoga didn't provide such way. I was practicing aikido to get rid of all thoughts at the end of the day
 
I see
 
@NikiC that reminds me .. i have to document my array_filter() changes for 5.6 =D
 
@Jack you changed something?
 
of course
it just wasn't rfc'ed
I've added one more argument to also pass array keys into the filter callback
 
Anyone on?
 
8:06 AM
unfortunately the same couldn't be done for array_map() :(
 
Guys why do you use an interface?
like what does it do?
 
an interface by itself does nothing.
 
all u do is
list some functions?/
 
you define an api with interfaces
 
what does that mean now.
Can ya explain me, why interfaces are used?
My English sucks, so I'd love it if you explain me in the simplest term's possible.
 
8:08 AM
hmm, it's a separation of concerns in the sense that you only define the what instead of the how.
the how = implementation, the what = interface
 
@HamZa If you think is crap.. Try Pilates.. that's even harder :D
 
like
jack
better way?
to tell
 
@HassanAlthaf Interfaces are meant to hide implementation details from a requiring class.
 
@SecondRikudo I don't get what you say? -.-
I feel like a noob now.
 
A simple example would be a logger
 
8:10 AM
Yeah?
 
Let's say you want to allow logging in your class
 
And you want to do it in an OOP way.
 
Using Dependency Injection, you inject a logger inside of your class, the constructor will looks something similar to this:
public function __construct(Logger $logger, /* Other dependencies */) {
Okay so far?
 
8:12 AM
Logger is a class right?
 
No
Logger, in this case, is an interface.
 
And, yes, I got it.
oh.
 
interface Logger {
    public function Log($message);
}
 
mornings
 
good moaning
 
8:13 AM
ok, so, what does that thing do @SecondRikudo?
 
not sure about good
 
brb, meeting
 
jury is still out on that
 
morning random one
 
8:13 AM
someone continue second rikudo's explanation pls
lol
 
@DaveRandom mornig
 
@Naruto I don't especially think it's crap. I was just wondering...
 
s/Log/log @SecondRikudo
 
@HassanAlthaf He already explained it someday way back
That said, @SecondRikudo write a blog post about it :P
 
Question. I have some url paths stored in my table as site_id | path ( 1 | /hello-world). I have a sites table which has all the site_ids and their values. site_id 1 = php.com. How can I create a query to switch the site_id from that first table when selecting from it to get a proper URL?
 
8:15 AM
@HamZa pls help. I dont understand this interfaces lol
 
@HamZa Well What I meant was: If yoga is too soft.. You should try pilates.. It's way harder.. :D
 
@HassanAlthaf The code that uses an interface doesn't care about the implementation, it just expects the log() method to be available.
 
@Naruto I'm doing calisthenics now...
 
nm being dumb
 
so, this makes it easy to exchange different implementations as long as they implement that interface.
 
8:17 AM
@Jack oh, so an interface expects some methods to be available in a class?
 
Yes, it's like a contract.
 
Oh, are they locally in the class which gets injected or are from other classes?
 
@HassanAlthaf Start reading from here:
Jul 29 at 10:56, by MoshMage
I think I got what Interfaces are (though why they are needed is beyond me) and what I understood from the manual is "Interfaces are like guidelines and each class that gets implemented to it must use them guidelines"
 
One benefit of interfaces is that a class can implement multiple interfaces.
 
Oh, they are like guidelines.
So, I have a question, whether an interface works like this
 
8:18 AM
@HassanAlthaf An implementation needs to specify implements Logger to indicate that it can be used as Logger.
 
@HassanAlthaf click on that link and follow the conversation. @SecondRikudo has explained it very well with an example
 
So ... class Foo implements Logger { ... }.
 
Oh, but @SecondRikudo injected into the class?
 
what did I just read....
 
@HamZa okay, sure?
 
8:19 AM
@HassanAlthaf don't worry about terms like injection.
 
I know injection.
Ohh, so can we instantiate an interface?
 
No
You can only instantiate classes (i.e. implementations)
 
So, how did he do $log_>message()
*$log->message(0;
function writeToLog(Logger $log, $message) { $log->writeLine($message) }
 interface Logger {
    public function writeLine($line);
}
 
@HamZa You could also just join me to the gym? ;)
 
@Naruto where do you live?
Oh belgium...
 
8:22 AM
@HassanAlthaf because $log is a Logger, therefore the method can be called; but $log is an instance of some class.
 
E_TOO_FAR
 
@HamZa pff, neighbors
 
@HassanAlthaf it means that the argument passed to writeToLog ($log) must be a class that implements the Logger interface (a class with a public function writeLine($line)
 
then again, i consider Johor Bahru as too far haha
and that's like a 20min drive
 
@Jack hehe, we got gyms here everywhere but I prefer training with my own weight
 
8:23 AM
@HamZa Where are you from then? :) And The Gym is never too far!
 
Ohhhhhhhh @RonniSkansing Thank you. So, to do that, do you need to inject the class '$log' ?
 
@Naruto I live in amsterdam
 
@HassanAlthaf you must have a class of any name that specific implements interface
 
@RonniSkansing what do you mean, should you inject the class which implements the interface as well to call that function?
 
class Hassan implements Logger{
  public function writeToLog($line) {
    // somecode
 }
}
 
8:25 AM
@HamZa you can do that at home ;-)
 
Is launchpad.net down for anyone?
 
@RonniSkansing and then?
 
then you pass a object instance of Hassan to the writeToLog function
 
@Jack Yes but I love the bars in the park nearby. At home I have only a pull up bar which is a bit too low for my height...
 
Then ->writeToLog(new Hassan(), 'hello world'); for instance @HassanAlthaf
 
8:26 AM
@crypticツ up here
 
hai any WP developers is there?
 
@HamZa too much opportunity to cheat you mean? :)
 
@Jack what do you mean?
 
Aug 4 at 14:25, by Patrick
Welcome to the PHP Room. If you have a wordpress question, please press 1. If you have a CodeIgniter or CakePHP question, please press 2. If you have a javascript or jQuery question, please press 3. Otherwise, please hold and we will connect you with one of our friendly chat members...
 
Then, I have a class like this which needs writeToLog thing
 
8:27 AM
@HamZa Well enough gyms in Amsterdam aswell :D
 
@Jack Meh, I could live with that. Outside you have fresh air. Also I can't do the muscle up since I will hit the door frame
 
@HamZa 1
 
@HamZa lol
 
interface Logger
{
  public function writeToLog();
}
class HassansBro
{
  public function __construct(Logger $log)
  {
    $log->writeToLog('Some shit');
  }
}
Would that work?
Or should I inject the class which implements the interface
 
8:29 AM
@Boopathi anyways what's the question? You surely aren't hiring?
 
writeToLog looks like a redundant name
 
@HamZa i just want to use editor for textarea in Buddypress
<?php $post = get_post( $post_id, 'OBJECT' );
$args = array(
'quicktags' => true,
'editor_class' => 'frontend',
'textarea_rows' => 5,
'tabindex' => 1
);
wp_editor( "", 'topic_text', $args ); ?>
 
@Boopathi ok, can't help you with that. Good luck
 
@HamZa its working
but in edit page it does not work
I using like that
wp_editor( bp_the_topic_text(), 'topic_text', $args ); ?>
 
Does anyone know when PHP source will be compatible to compile with bison 3.x? I'm compiling from git source and I have to keep bison downgraded to be able to compile. =o( Am I doing it wrong?
 
8:32 AM
@crypticツ Bison 2.7 should be good for use.
In any case, you can have multiple versions of Bison on your system.
 
@HassanAlthaf Why would you want to log in the constructor?
 
@Jimbo just example?
 
@HassanAlthaf Decorate your object, log outside it, then you don't have the logger as a dependency :)
 
guys is using include myFile.php to echo the same html,js,css across many pages a nice idea? how much more/less server load would it cause?
 
@Jimbo I am writing an example code for a interface k
<?php
namespace HassanAndHaseeb;

interface Logger
{
	public function writeToLog();
}
class Hassan implements Logger
{
	public function writeToLog()
	{
		echo "Hello world!";
	}
}
class Haseeb implements Logger
{
	public function __construct(Logger $log)
	{

		$log->writeToLog();
	}

}
$hassan = new Hassan();
$haseeb = new Haseeb($hassan);
?>
Whats wrong in that?
 
@HamZa ok thank
 
Fatal error: Class HassanAndHaseeb\Haseeb contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (HassanAndHaseeb\Logger::writeToLog) in C:\xampp\htdocs\code.php on line 23
 
@FlorianMargaine yea that is what I am asking, how much more/less?
 
My error.
 
8:34 AM
AccessInterceptorValueHolderFactory <-- @Ocramius I think living in Germany might be getting to you :-P
 
Ok, @Jimbo so what should I do to make it work?
 
@HassanAlthaf "implements" means that you have to declare all the methods declared in the interface. You're not implementing writeToLog in Haseeb
 
@DaveRandom zomg
 
@HassanAlthaf One min
 
@Jack it's downgraded to 2.7 now. Using Ubuntu server, and if I install 3.x it replaces 2.7 since package name is the same. =o( I don't need 3.0 it's just the sometimes it gets upgraded during an upgrade even though I have it marked as hold.
 
8:35 AM
add all the nouns!
 
nvm, got it working
Thank you very much everyone.
 
@crypticツ compile from source with --prefix
 
good mornings
 
Thank you @SecondRikudo
Thank you @Jack
Thank you @HamZa
 
hey @crypticツ, welcome back
 
8:36 AM
Thank you @RonniSkansing
Thank you @Jimbo
And, thank you @FlorianMargaine
 
wat? so many thankyous... :D
 
@iroegbu thanks
 
@AwalGarg 7
 
@FlorianMargaine 7 what? as in, is 7 some kind of measure?
 
@crypticツ actually .. instead of installing compile tools on your server, you may wish to consider building on another machine.
 
8:39 AM
no, it's a way to say that your question doesn't make any sense, and that you shouldn't worry about it. Worry about separation of concerns for now.
 
@AwalGarg 7 as in Php "7"
 
@FlorianMargaine ok... what is "separation of concerns"?
@iroegbu xD
 
In computer science, separation of concerns (SoC) is a design principle for separating a computer program into distinct sections, such that each section addresses a separate concern. A concern is a set of information that affects the code of a computer program. A concern can be as general as the details of the hardware the code is being optimized for, or as specific as the name of a class to instantiate. A program that embodies SoC well is called a modular program. Modularity, and hence separation of concerns, is achieved by encapsulating information inside a section of code that has a well-defined...
 
kk
 
Would it be possible to async send mail out?
 
8:43 AM
ok, I get it... but I still don't know if doing that is a good idea or not? Do programmers generally do it?
 
@Fabien yes
 
Is it recommended?
 
@AwalGarg programmers worry about separation of concerns
@Fabien depends on your use case
but that requires an external tool usually anyway
 
@Fabien you mean, without using sendmail?
 
Unsure atm. Just querying how to effectively send out mail fast.
 
8:45 AM
@FlorianMargaine ok, thanks :)
 
@Jack the tools are already pre-installed on Ubuntu Server. I know securitywise it's best to not put such tools on a server, but I have no idea how many come pre-installed and which to remove. That being the case I may as well use them right? Unless there are others reasons.
 
@crypticツ other reasons than security? hmm, not really :)
 
@HassanAlthaf 3v4l.org/TvDhX
 
other than the typical "if you don't need it ..." narrative
 
@HassanAlthaf Decorator pattern. You're wrapping the object in another one (the 'decorator'), and doing your logging in the decorator instead. So if you ever want to change your logging, or anything else, you can. And you can re-use the object with the business logic around your application or anywhere else because it doesn't require a logger - which other objects or developers might not want
 
8:50 AM
If I wanted to create a mailing interface to allow us to swap out the libs we use to send mail is there a design pattern I should be looking at?
Basically want to easily be able to swap out phpMailer for something like SwiftMailer and so on.
 
goodnoon @all
 
DataMapper?
 
@Fabien Adapter pattern
Make your own interface for mailing, and adapt each external mailer to your own interface
 
Ah makes sense cheers
 
In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used from another interface. It is often used to make existing classes work with others without modifying their source code. == Definition == An adapter helps two incompatible interfaces to work together. This is the real world definition for an adapter. The adapter design pattern is used when you want two different classes with incompatible interfaces to work together. Interfaces may be incompatible but the inner functionality should suit the need. The Adapter pattern...
 
8:52 AM
Also, when they say interface, you don't have to think of an actual interface file as above
Even if you're using legacy code which has shitty methods and stuff that you want to adapt into your own OO class, the public methods of that are basically the interface
@Patrick Have you implemented the adapter (ever)?
 
@Jimbo uh? Isn't that the facade pattern?
also called the "hide yo shit" pattern?
 
> Yeah, I keep dropping this because... SQUIRREL!!!!!!
^ what in joke am I out of there?
(on internals)
 
@DaveRandom I always ride my bike slowly, in case I get potatoed.
 
@Jimbo yes
 
@Patrick Say you have a 3rd party object with say 10 completely different methods. If you're adapting those methods to your own interface, I'm right in thinking you will most likely have 10 methods in your own adapter to forward the calls to your interface, right? You wrap their object in your adapter, and forward calls to their object to your own interface instead
@FlorianMargaine Oh, the legacy code was just an example, but maybe they can be used together?
 
8:58 AM
@Jimbo say you have a shitty 3rd party library and you don't like how they did things but you also don't want to write everything from scratch because it works even though it's crap code. So you define your own interface as you would if you write it from scratch and the adapter then basically translates things between your interface and the 3rd party library
 
@Patrick Awesome, glad I'm doing that right :D
 
No idea if I am doing it right, but that's how I interpreted it and it's what I needed at the time :)
 
Same, and it makes sense in-code too
 

« first day (1396 days earlier)      last day (3566 days later) »