« first day (425 days earlier)      last day (4513 days later) » 

12:02 PM
However, the instanceof of operator, must mention it in the document that, it will not resolve the second operand(if string) via the use case statement at the top. So one must use the FQCN as a string in the second operand of instanceof operator
 
@Sudhi why cannot you hint an interface ?
 
@tereško because different commands will require different types of interface and that would ... ermm .. aha
interesting idea @tereško , why didn't I think of that ? Agreed, it would mean creating a parent ICommanArg and then inherit them with ICommandFooArg and so on
am I going right ?
 
( note : interfaces are not inherited , they are implemented )
will all object have a method with same method footprint ?
 
@tereško yes, yes, I agree. I was trying to say interface ICommandFooArg extends ICommandArg
@tereško can you please tell me what do you mean by method footprint ? (so I will know how to judge if they are same or not)
 
to have the same footprint means that method has same name , same number of arguments , same types hinted for arguments and same default values for arguments
and interface can contain footprint for multiple methods
 
12:13 PM
@tereško Hmm, as of now, no. They have different method footprint.
 
could you explain why do you need this whole setup
what is the core problem what you are solving
not the code .. the reason for that code
 
So my ICommandArg might just be an empty declaration. But I get the idea you are trying to convey. Enforce the common denominator of arguments in the parent and let children inherit them
@tereško its simple. I have an Api which would be called with multiple requests. A particular class of requests require me to check and subscribe the customer to certain products . I am trying to utilize (read : learn) command pattern by declaring an abstract function process() which are implemented as function process() { $this->_product->subscribe($arguments) } and function process() { $this->_product->check($differentArguments) }
 
ok .. that did not explain anythign
 
now I gave sincere thought as to whether to pass $arguments during instantiation of my classes. But I realize that would make my builders to know too much about how the products work (i.e. to know subscribe() needs $args and check() needs $diffArgs ) So I decided to pass those arguments inside my process($args) function declaration
@tereško which part did you not understand, or perhaps I did not understand what you are trying to ask
 
12:40 PM
anyways, I just added a note on the type of operator page but I don't see it. Can anyone ? I just want to be sure there is no silly mistake in the note
 
Static are bad have been said here so much I'm just scared to use it -_-
 
@Donut thats okay. Sometimes you have to like DateTime::createFromFormat('Y-m-d H:i:s', $input) which might seem uneasy as a static method. But in reality its just an alias for date_create_from_format (actually other way round about the alias)
I have a Dbh::createPdo($identifier) which instantiates a PDO, I had to do it somewhere. And I thought lets stick it in the Dbh aka DataBaseHandler class
 
1:01 PM
@Sudhi why cannot you use date_create_from_format() there ?
 
@tereško now, I was just giving an example. If you are styling your code in OOP fashion everywhere, you might as well use DateTime::createFromFormat() to which date_create_from_format() is an alias
 
static methods is not OOP
its "class oriented programming"
 
1:20 PM
@ircmaxell hi are u there?
anyone know about PDO here
 
@StephenWolfe depends upon what you want to ask
 
I reading more on it now, i only herd of it last night lol,
ill come back once im armed with more knowledge
 
1:40 PM
@StephenWolfe good luck !
 
1:51 PM
Good Morning
 
good afternoon
 
how's it going?
 
@StephenWolfe I'd suggest using MySQLi if you're connecting to MySQL
 
whats that? i have just been reading PDO lol
 
don't they all do the same thing?
 
2:17 PM
No
 
hi
@ircmaxell Why is that? charset?
 
@NikiC No, prepared statements
 
@ircmaxell what about them?
you can disable emulation, if that's what you mean
 
@NikiC No, you can't
you can disable emulation by default, but there are circumstances where it will still emulate
 
and anyways, what problem do you have with the emulation?
which circumstances?
 
2:21 PM
@NikiC the fact that it emulates. So you think you're using PS, but you're not
 
but what's the problem with that? ^^
 
@NikiC that it's not actually a PS. Which can make migration or fixing things rather... interesting
 
Could you maybe give an example of a problem?
@Donut Are you Robik?
 
@NikiC Yes :)
 
you're using PDO. It will let you use sql that's invalid in MySQL. So when you turn off emulation, it'll have MySQL keep erroring and not tell you at all, since it hides those errors from you in the emulation process
 
2:32 PM
> Display name may only be changed once every 30 days; you may change again on Jan 13 '12 at 20:24
:(
 
@ircmaxell thanks, this is an interesting information. will keep it in mind whenever I am using PDO
 
Yeah, I think it's a neat idea, but it really doesn't pull it off IMHO (especially because of the emulated PS)
@Donut Ha ha
 
@ircmaxell what are the circumstances under which it'll use emulation even if you tell it not to?
 
@NikiC anytime it's not a valid MySQL PS
 
@ircmaxell ah, okay
that is bad indeed
and one can't disable that?
 
2:39 PM
nope
 
you could open a bug :)
 
any one know why my function

function fixdate ($fixdate){
$date_split = explode("-", $fixdate);
$month = $date_split[1];
$day = $date_split[0];
$year = $date_split[2];
$fixdate = $year."-".$month."-".$day;
return $fixdate;
}
 
@NikiC it's expected behavior
 
is throwing this error Undefined offset
 
@StephenWolfe fixdate doesnt have at least two - in it
 
2:42 PM
can u re-phrase that>
?
 
@StephenWolfe and use different name for input $fixdate and output $fixdate , you might foobar your function if you are not careful
@StephenWolfe e.g. $fixdate = '2011/01/01' fill complain
 
@NikiC For example, if you use a PS with emulation off for GRANT ALL TO ?@? IDENTIFIED BY ? with mysql < 5.1.12, it would first try to prepare the query against MySQL. But MySQL will throw an Unpreparable error. Then it will emulate the prepare which will work. So you have a silent error being surpressed and thrown on every call, and you have no idea it's happening...
 
//how about this
function fix_date($in_date) {
    $split_data = explode('-', $in_date);
    if(count($split_data) == 3) {
        $year = $split_data[2]; $month = $split_data[1]; $day = $split_data[0];
        return "$year-$month-$day";
     } else {
        return FALSE;
     }
}
though I would rather use $tmpDate = date_create($input); if(! $tmpDate) $fixdate = $tmpDate->format->('Y-m-d');
but I am not sure what kind of input string you are expecting/enforce for $input date string
 
@ircmaxell I know, I mean a FR for an option to disable ;)
 
@NikiC It will be rejected
I have no faith that the core devs have their head on straight when it comes to MySQL
especially with PDo
 
2:49 PM
@ircmaxell because it's expected behavior ? (or the famous it's by design )
 
@Sudhi it literally is by design
and I understand why
but that doesn't make it any less wrong
 
@ircmaxell well, looks like they made a particular choice in designing PDO , and as they say there are no right choices or wrong choices
 
This is a bad choice for a good reason
which is why it won't be removed
 
@ircmaxell understood
 
because the reasoning is justifyable, even if it is wrong
 
2:53 PM
I'm not saying to be be removed
I'm saying it to be optional
 
@NikiC you are not getting the choice that they made. They made the choice for it to be mandatory not optional
 
I was told that if doc and src differ src is normally updated to meet doc ^^ So we could just document a new emulation behavior and ...
@ircmaxell
 
yes
 
hi
 
3:02 PM
I think they are actually believing what they are saying
crap, I hate sites that praise some product but I just can't find the download link
I looked yesterday, I just looked again, but I just can't find a place where I can download DTrace ...
 
@NikiC heh, if only that were true.
 
@salathe At least they said so ;)
 
@NikiC :-D
 
@Sudhi thanks for ur reply, sorry i was off reading other stuff,
@Sudhi this does look like and easier way of doing it. $tmpDate = date_create($input); if(! $tmpDate) $fixdate = $tmpDate->format->('Y-m-d');
 
3:20 PM
@StephenWolfe aye! but date_create() can parse far too many strings as dates, and I am not sure if it will treat 01-02-03 as 1st Feb 2003 or 2nd Jan 2003 . But if you are sure that your input will be in a m-d-Y format, you might want to try out date_create_from_format('m-d-Y', $input) which will work only for strings in the 'm-d-Y' format
 
I really need help with sessions...I have a siteA and a siteB, siteA is my site and siteB is another's team member's site and I am not allowed to modify it in any way. Both sites use the same credentials to login. I want to make it a SSO so that once logged into my site the user can login to siteB as well...SiteB is storing cookies on a user's browser once authenticationi s successful and my siteA.com also stores cookeis for authentication. To make it SSO what can I do to mimick siteB
I need to fool siteB so it lets the users logged onto my site into siteB
 
well i created that function to turn amecrican dates to english ones thats all (y-m-d to d-m-y)
@Sudhi that function u rewrote for me worked a treat
 
@StephenWolfe well in that case I would recommend that you prefer $tmpDate = date_create_from_format('Y-m-d', $input); if (! tmpDate) $fixdate = $tmpDate->format('d-m-Y'); look at this PHP man page to know more about date time formats
 
Heres a query to all, I have been setting user access lvls in sessions via a database lookup. I.e. accesslvl =1 or accesslvl =2 ,3,4 ect
is this a bad way to provide user access
 
@StephenWolfe but it might do something more than you expected, thus my above suggestion. A function should do no more (and no less) than what is expected of it
I must leave now, all !
 
3:31 PM
by
 
@ircmaxell thanks for the PDO PS gotcha, I am sure it will come in handy sometimes.
 
np
 
@Nadal this might help youtube.com/watch?v=P_u3g95bzIE if u want to get into the site
 
I will try this thanks @StephenWolfe
 
@Nadal not sure if it can help it just shows u about session hijacking with cross scripting :D
 
3:41 PM
yeah :P I was reading into it at the time u sent me this, i always love visuals
 
:D
Iv been trying to protect against it lol
 
oh well its always good to know how hacking is done in rder to prevent it
 
:D or to get into another teams site
 
yeah :P
 
I hate it when I give the only answer and the person who posted the question never tells me if my answer worked or not.
 
3:46 PM
lol
 
when did u post an answer
 
Last night, just minutes after his question.
 
ooooooooo
 
Any mySQL gurus?
0
Q: Changing from an enum to a linked table

NealWe are going to change something that we have an enum to an id of a linked table instead. How would we go about that? Our current enum name: strat Our new linked name: stratid What I was thinking was something along the lines of: UPDATE table SET stratid = (SELECT id FROM link_table WHERE s...

 
good luck
enums in MySQL suck
 
3:59 PM
@ircmaxell lol they do. i finally convinced my boss to get rid of them. hence the question lol
 
nice
 
^_^
 
Why there be no chat room for C?
Or is it implicitly in the C++ room :-P
 
they use IRC
 
So does C++ and PHP.
 
4:25 PM
hello everybody
 
@ciprian hola
shalom
hello
 
hi
 
jlg
Can someone help me with some PHP in my WordPress site? stackoverflow.com/questions/8523022/…
 
$sql = "SHOW TABLES FROM database"; anybody have any idea how to exclude certain tables in this query?
 
jlg
4:42 PM
can you add a where clause?
 
can you get session name from cookies?
 
@jlg I tried show tables not like '%ci_%' from database but that won't work
 
jlg
:(
 
@OmeidHerat Simple: you maintain a max size and if you try to add something when it hits the max size, you throw an exception. SplFixedArray throws a RuntimeException, but I have a patch ready so it will throw an OverflowException. Let me know if you want any more advice.
 
5:07 PM
I think I got the memory problem solved
 
@NikiC !!!! WHERE ARE THE 8 BYTES??!
Sorry, I got a little excited.
 
my current theory is that it doesn't allocate a zval but a lxr.php.net/opengrok/xref/PHP_5_4/Zend/zend_gc.h#zval_gc_info
which would add another pointer aka 8 bytes
because after hacking add_next_index_long into printing lots of memory allocation data
I noticed that MM allocated 28 per ALLOC_ZVAL, not 24 as it would be expected
and as ALLOC_ZVAL can either allocate a zval or a gc zval ... that might be it :)
 
I hate Steam.
A bunch of incompetent developers.
 
So the additional pointer is from the cyclic garbage collector
You can see that great by switching between 5.2 and 5.3 on codepad.viper-7.com/4D4Ohg (the CGC was added in 5.3)
 
@NikiC Garbage collection had to add a pointer? Odd.
 
5:18 PM
 
the reference counter?
interesting
 
doesn't look like a refcounter
some strange magic
and looks like they are exploiting undefined behavior there ;)
because the use that structure as if it were a zval in many places
I don't know whether that is legal :D
I don't even know whether I still want to write a post on that. Seems like too complicated for anyone to understand
 
5:46 PM
Hello, does anyone know how to open passworded access files?
 
Darn you .phpt .. darn you and your syntax and diffing
 
@edorian lol, I kind of like them.
What's up?
 
It's nice until it breaks with a 300 line diff and you have to search it for the one %s that breaks it
Took me half an our :)
13) FailureTest::testAssertStringMatchesFormatFile
Failed asserting that format description matches text.
--- Expected
+++ Actual
@@ @@
-%sFOO%d
-
+...BAR...

%s:%i
and the failure output was +300 lines because of all the backtraces
just always showing

-%s:%i
+PATHES

for each test
It took some time until i figured out that the "%s" from "-%sFOO%d" was matching up the whole output backtrace
 
@edorian Backtraces? ROFL
lol
 
Hm?
 
5:55 PM
0
A: Sort from dimension X to Y in a multidimensional Array in PHP

OzbekovI know this is a late answer, but it's an answer for perhaps future reference. That array is completely incorrect for what you want to do. If you want to have 3 columns, you need one dimension to indicate the column, and the second one will have an array of values. There is no built in function...

Could someone proofread/verify my answer?
 
@Ozbekov You mean upvote?
 
No.
Just to make sure the code is as good as it should be.
Oh and I made an edit to the title for clarification. SO doesn't trust me enough to let me change that on my own :-P
 
hi everyone
so i tried making a clean URL using .htaccess, but the page i redirect to gives blanks for my images and doesnt import my css file
 
Check HTML source
 
6:10 PM
sorry what do you mean?
 
Check your HTML source, click the link, see where they are pointing to
 
directs to www.tagverse.us/diary/5
the actual page references the css file too
 
Hi
could someone explain what the term context means
 
Context means the environment in which a specific thing lies in.
For instance, "program" can mean different things in different contexts. In the context of computers, it means a software; whereas in the context of television, it means a TV show of some kind.
 
6:30 PM
RequestContext, what does it mean then?
 
6:56 PM
my LDAP stores password in SHA and I have my password in MD5, anyone know how to get it into SHA?


<?php


$username=$_REQUEST['username'];

$oldpass=$_REQUEST['oldpass'];

$newpass=$_REQUEST['npass'];

  if(isset($username) and isset($newpass) and isset($oldpass)) {
     $ldapconn = ldap_connect("ldap.example.com", 389);
     $ldapbind = @ldap_bind($ldapconn,"uid=".$username.",dc=example,dc=com",$oldpass);
     if($ldapbind) {

	   print "<p>Change password ";
	   if(ldap_mod_replace ($ldapconn, "uid=".$username.",dc=example,dc=com",
 
7:06 PM
pack("H*",md5($newpass)) should be md5($newpass, true)
 
@Hyperion Well, that's a vague question. It means you're requesting the context of something. Is this PHP or what language?
 
@ircmaxell remove the pack?
 
see the second param to md5
 
ooo
 
basically, it's not necessary
 
7:17 PM
weird, for that line I get "syntax error, unexpected '{', expecting ')'"
 
you removed one too many ) closing braces
get rid of the pack
 
@ircmaxell how can I send you a private message?
 
you can't
 
OK...
 
you can however shoot me an email if necessary. ircmaxell php.net
 
7:20 PM
@ircmaxell Can you have a look at this stackoverflow.com/questions/7628734/…
Is my answer bad?
 
@ircmaxell have you got access to an LDAP DB?
 
eih, you could use us2.php.net/array_multisort instead to do the same thing
@Nadal No
bbl
 
<?php


$username=trim($_REQUEST['username']);

$oldpass=trim($_REQUEST['oldpass']);

$newpass=trim($_REQUEST['npass']);

  if(isset($username) and isset($newpass) and isset($oldpass)) {
     $ldapconn = ldap_connect('ldap://ldap:port');
	ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);

     $ldapbind = @ldap_bind($ldapconn,"uid=".$username.",dc=example,dc=com",$oldpass);
     if($ldapbind) {

print "<p>Change password ";
if(ldap_mod_replace ($ldapconn, "uid=".$username.",DC=sde,DC=site,DC=com"))
I counted all braces no extra or any missing
and it still says unexpected "{" on array(userpass) line...
if I remove the "{" it says unexpected T_print
one error after another..
 
afternoon all
 
7:37 PM
afternoon!
 
@KevinPeno g'afternoon
 
@ircmaxell eih, I didn't even know that existed.
 
7:57 PM
Wrote a loooong post on the array memory usage thing: nikic.github.com/2011/12/12/… Hope that it is still remotely intelligible
 

« first day (425 days earlier)      last day (4513 days later) »