« first day (962 days earlier)      last day (4212 days later) » 

13:00
should've said please don't tag cakePHP as MVC ;]
well ... one step at the time
Hi any PAYPAL expert buddy is here ?
Grrrrrrr
Down HamZa don't eat nice amr!
Anyone like Symfony2 / twig?
0
Q: Symfony2 - Twig render controller and return array response

JimboI want to call a controller from a twig template, and have that controller return an array that I can then use throughout the rest of my template. I can do this with individual variables: Twig {% set testVar = render(controller('AppBundle:Test:index')) %} Controller class TestController ext...

13:10
@dragon112 no, I answered a question and got accepted with 2 upvotes, but it seems that the Q or my A got deleted :(
@HamZa Sucks when that hapens :p
@dragon ???
@dragon112 My fault for answering it ><
@DaveRandom yep, things are usually my fault
@amrKamboj It was a joke, don't mind me :)
13:11
@Jimbo why would a view call a controller?
@Farkie AJAX
oh so not directly the view
@dragon112 np
Buddies I really need help in paypal
http://stackoverflow.com/questions/16918129/paypal-recrurring-payments
there is no PAYPAL room so I am here
Jimbo
doesn't it need to be json?
I'm not using AJAX yet, I can get string responses, just not arrays
13:14
If anybody need help in PHP or ZEND
I am here
Because the response is what's outputted.. can't just output an array
what type of ZEND, @amrKamboj
@Farkie how many types are there :P
Framework, Studio, Server etc
Framework
13:18
eih
hai all
@amrKamboj ZF1 or ZF2?
13:24
ZF1
@DaveRandom I found a previous bug report bugs.php.net/bug.php?id=63823&edit=2. Seems that rewind() must be called before using an iterator, otherwise behaviour is undefined. This did cross my mind, but I couldn't find anything in the manual that states this.
Anyone know of any small project repositories that can be used?
preferably on github?
whats a good use case for rewind?
looping log file or something?
@HamZa sorry
@ircmaxell Your question makes no sense imho.
13:38
I need some examples of some small applications that are easy to read and understand, but actually do something (pref with database)...
ah - that I can understand.
@ircmaxell like for tutorials?
@HamZa what i exactly need,but written vb.net
0
Q: Find all Zipcodes within specified distance of a zipcode

user970225I know this question sounds like a repeat of few questions here, but none of those questions answered what i wanted. I am interested in knowing if someone know how to find other zipcodes within the radius of a specified zipcode. I have the zipcode database with me with latitudes n longitudes but ...

@ircmaxell actual applications or just good projects that are small ? github.com/meenie/munee
13:40
both
@ircmaxell how about making a preference widget?
I'm not looking to make anything, I'm looking to find existing thigns :-D
@zackkitzmiller I want some more real world examples of varying quality to use during a workshop on code review...
Oh - thought you just wanted good code.
'varying quality' could be a lot easier.
@ircmaxell packagist?
Yeah, but what. There's a metric-ton of stuff on there
and trying to think of good examples is tough
13:52
well, idd
it's quite big :|
I actually don't think I ever open-sourced an application
only libs
me has crap legacy app ^^ :)
Well, do you know of any small and easy to read libs, that may be of interesting quality or not?
php cs fixer
runs, does something, is small
@user1987095 I don't see where's the problem ...
13:55
@Danack oh, didn't know that one :O I wrote github.com/Ocramius/ProxyManager - maybe I should join efforts =D
@Danack too complex. Require too much brain power figuring out what it's doing
@Ocramius Artur works for Yahoo in Sydney twitter.com/artur_ejsmont
I'm going with this guy for one: github.com/jmccartie/php-url-shortener (I have found at least 1 exploitable vulnerability there)
And that's why I didn't recommend my own projects ;)
Please recommend your own, we can review and recommend patches
13:58
@user1987095 The answer there is using Great-circle distance algorithm, which is the same used here stackoverflow.com/questions/574691/…
@ircmaxell My own are probably not appropriate as either too large github.com/Danack/FlickrGuzzle or too WTF github.com/Danack/PHP-to-Javascript
@ircmaxell No database used but it is small and has tests: github.com/cspray/Setty
yeah, still too "complex" (not in code terms, but in concept terms)
@ircmaxell Fair enough
14:05
@ircmaxell It seems your latest PHP internals idea has gained some traction and support. Congratulations.
:-D
yay! More work to do!
@ircmaxell with that you meant "I opened index.php"
@tereško Yup
internet makes me sad
lol
14:09
Why the hell is my C code segfaulting without any optimization, but works as expected when I add -O3 to the compiler option?!
@bwoebi Because you don't understand what actually happens with -03
Anyone quickly know of piece of code that's doing something simple, but is really convoluted?
@hakre I don't. I was only told to use it.
@bwoebi If it breaks with -O3 then try -O2 which is generally safer.
@LeviMorrison If I use only -O1 it still works
It only breaks without any optimization
$stack[] = array(array(), $array);
while (list($left, $right) = array_pop($stack)) {
    $min = end($left);
    foreach ($right as $value)
    {
        if ($value < $min) continue;
        $left2 = array_merge($left, array($value));
        $right2 = array_diff($right, $left2);
        if (!($left2 && $count = count($right2))) continue;
        $function($left2, $right2);
        --$count && $stack[] = array($left2, $right2);
    }
}
@bwoebi Have you used analysis tools on it?
Valgrind or other things such as Clang's static analyzer?
@LeviMorrison no
14:13
$c = "abc"; // charset
$l = 2; // string length

for($t='',$cl=strlen($c),$s=array_fill(0,$l,0),$i=pow($cl,$l);$a=0,$i--;) {
    for($t&&$t.=', ';$a<$l;$t.=$c[$s[$a++]]);
    for(;$a--&&++$s[$a]==$cl;$s[$a]=0);
};

echo $t; // the string you asked for.
@ircmaxell If only I hadn't signed an NDA on it
@bwoebi You should recompile with -g for debug flags and try using debug tools such as gdb.
@LeviMorrison with -O1 and -g?
@bwoebi No optimizations. You need it to segfault
Then look at the backtrace.
14:18
I know where the error is
Then you can rerun with breakpoints.
Right, but the debugger will help you found out WHY
you can print out variables and other things at that moment.
But I just want to know why optimization removes the error
@LeviMorrison I know why it segfaults (there is something not yet set). But I don't know why it works with optimization...
14:22
@bwoebi because the compiler would be re-using the variable space in memory?
or re-using a register.
> delete all joomla questions!
@bwoebi Perhaps generate assembly with -O1 and compare the results
@tereško They are all bad the ones I mentioned ...
//I have sth like this in my code:
register int nodeVal = nodes->node->value;
if (!nodes->node) return 0;
/* do sth with nodeVal */
return 1;
It's clearly the wrong order, but why does this NOT segfault in -On mode?
FYI if you are not doing embedded systems work I highly doubt that telling it to use a register will be faster. Compilers are really good at these optimizations on traditional platforms. You'd need to benchmark it if you suspect it does help, but I am guessing it doesn't.
@ircmaxell arrived in AMS already?
@LeviMorrison It changes nothing to remove the register
Tomorrow
leaving tonight?
7pm flight
to Frankfurt direct, then a quick hop to AMS
Oh you are going to the PHP conf? :(
I can't go =/
@igorw: do you have an example of a convoluted PHP script doing something fundimentally simple (a concept you could understand in 5 minutes)
14:29
@LeviMorrison Btw. without registers it's about 10 percent slower...
@HamZa where i get the target lat/lng, this is my last question,then i will quit
(with -O3)
@ircmaxell I'll see what I can do. Which flavour of convoluted do you fancy? Spaghetti or lasagne?
@user1987095 what do you mean by "target" ?
14:30
either, but the point should be the concept should be pretty easy to understand (something that you'll stare at the code for 5 minutes going WTF, and then have a "click", and a "really, I mean really?" moment
@HamZa It calculates the distance based on the latitude/longitude of that row and the target latitude/longitude
72
Q: MySQL Great Circle Distance (Haversine formula)

NickWoodhamsI've got a working PHP script that gets Longitude and Latitude values...then inputs them into a MySQL query. I'd like to make it solely MySQL. Here's my current PHP Code: if ($distance != "Any" && $customer_zip != "") { //get the great circle distance //get the origin zip code info $z...

@user1987095 you're getting on my nerves now ...
final class kernel {

    // ~ 300 lines here

    function __get($objName) {
        // try Load dynamic module from disk
        if (!isset($this->$objName)) {
            switch ($objName) {
                case 'frameworks': // product engine frameworks
                    $fName = ADMIN_DIR.'/pd/dz/frameworks/frameworks.php';
                    break;
                default: // regular kernel module
                    $fName = strtr($objName, array("." => "", "~" => "", "/" => "", "\\" => ""));
@ircmaxell , how about this
?
14:32
@user1987095 you have 1 postcode, right ? you know how to get it's coordinates ?
sorry,yes
@tereško My condolences.
@HamZa yes
@tereško code quality is not proportional to the filesize...
@user1987095 Ok, since you have the coordinates, you want to search for postal codes within a certain range, say 20 KM, right ?
@ircmaxell can you do me a favour?
@HamZa yes,right
14:36
SELECT id, postcode, ( 3959 * acos( cos( radians(YOUR COORDINATE) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(YOUR COORDINATE) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance
FROM markers HAVING distance < YOURDISTANCE ORDER BY distance LIMIT 0 , 20;
@user1987095 Then why don't you use something like this ^ ?
anyone here familiar with opencart?
@Leigh ?
Can you tell me where exactly ZIP_ER_NOZIP is being triggered for the following. I don't have a debug build at present and been staring at the lxr for too long
also , @ircmaxell , would this fit your original premise ? github.com/cakephp/cakephp/blob/master/lib/Cake/Utility/…
file_put_contents('badzip.zip', pack('IvvvvIIv',
	0x06054b50, // End of central directory signature = 0x06054b50
	0,          // Number of this disk
	0,          // Disk where central directory starts
	0,          // Number of central directory records on this disk
	0,          // Total number of central directory records
	0,          // Size of central directory (bytes)
	0,          // Offset of start of central directory, relative to start of archive
	0           // Comment length (n)
));

$z = new ZipArchive();
ZipArchive() will not create empty zip files, so have to create one manually
looks like it's going to be in ext/zip/lib/zip_open.c somewhere, but having a hard time tracking it down
14:40
@tereško No, but absolutely doing that
you will have to rename your workshop/talk to : "Your code sucks. Deal with it"
For the record, OSX returns true in $r for that, Linux (various distros) returning 19 (NOZIP)
@Leigh not really without digging too deep
14:45
@ircmaxell Alright, was worth a shot asking someone who might have a debug build handy :P
cheers
@Leigh perhaps because of the lack of a header: en.wikipedia.org/wiki/Zip_(file_format)
btw, talking about convoluted code : look at the source of array_unique(), @ircmaxell
I have, and no
it basically sorts the array before it starts looking for the unique elements
or at least , it did in php5.3
@ircmaxell I actually got my reference file by creating a zip with an empty file in it, using linux command line zip, then removing that file. which left the end of central directory record (no other header)
validates fine on OSX php and linux command line zip, just not linux php
Greetings. I have been using PDO PGSQL and have a problem with rewinding cursor to first element. I've been trying to set 2nd paramt to cursor position, cause it sets the row to be returned, but i need to set PDO attribute PDO::ATTR_CURSOR to PDO::CURSOR_SCROLL.
When I try to do that, i get an error:
Driver does not support this function: This driver doesn't support setting attributes.

Any suggestions?
morning
I just had this crazy revelation: It is actually possible to patch the behavior of the CPU
@NikiC ?
14:54
@NikiC At what level?
9000
@tereško lolz
@NikiC heya
@ircmaxell @Leigh The CPU decodes x86 into lower level microinstructions and which micro-ops will be run can be changed
4
A: Odd - page shows up blank inside an iframe. Why?

Buh BuhHere is what I saw. It seams wordpress just dosen't like you.

^lolz
@NikiC right
14:56
If I got that right some kind of microop specification file is loaded on CPU startup
@NikiC so you can patch an ADD opcode to do SUB instead or something, as an example?
@Leigh Theoretically, yeah ^^
That's how vendors fix bugs in their CPUs
@ircmaxell Dunno why, but I find that totally crazy
There's always a level of abstraction until you get down to physical transistors
Definitely interesting... do you think you'd be able to patch it do decode "new" instructions?
@ircmaxell Yeah, I just didn't think it was dynamic. I assumed it was some hardwired fsm in there
14:59
Random Question - What does the _ in $_POST $_GET $_SESSION signify?
@Daniel You forgot $_REQUEST :p
@NikiC true. It is rather intersting how all that works. And then you get fubar things like branch prediction that make it all really weird...
Hm, in theory, you could create binaries that would only execute on your patched CPU
relying on "bugs" in the patch
lol @HamZa yep, mainly just wondering what the _ signifies, normally php variables/arrays don't have it.
15:01
i understood it coming perfectly and also get another query SELECT
vlt, vln,
3958.75 * ACos(Sin(40.86149/57.2958) *
Sin(vlt/57.2958) +
Cos(40.86149/57.2958) *
Cos(vlt/57.2958) *
Cos(vln/57.2958 - (-74.4171)/57.2958)) AS miles
FROM tbl_test
where my co-ordinate 40.86149/-74.4171
@Daniel nothing
@user1987095 does it work ?
That's what I was thinking too @ircmaxell, I'm guessing it just signifies that "This is a session/get/post/request variable/array".
@HamZa thanks,u dont know how mach i'm in problem,thanks again my friend
Nope, it's just text
15:03
hmm
@user1987095 lol you're thanking me because you're in a bigger problem :O ?
I can create a variable $_FOO
@HamZa it worked
it's nothing special
@user1987095 great ...
15:04
@HamZa why ,i little fool
How come it's not just $SESSION then?
I have issues:
1. Is this sufficient? http://pastebin.com/Lrsa8uAj
2. I want to install https://github.com/ioalessio/IoTcpdfBundle but don't know how to add to my present system (I'm not using namespaces).
@Daniel the person who wrote it thought $_SESSION was better
@Daniel The creator of PHP was drunk ?
lol 2 very good possibilities
15:05
ok ... i hate humans ... time to go home
@HamZa thanks again for ur patient
@Daniel Underscores usually denote internal variables
@user1987095 take care ...
How about an example of some short, simple and elegant PHP code
If I have an __iserror in the get request, I show a 500 page.
15:05
@HamZa bye
Ahoy hoy
@tereško take care
PLB
PLB
@iroegbu Using namespaces would make life easier for autoloader.
@user1987095 bye
Okay another random question - I know it's somewhat debated but wanted to see how you guys work - Double quotes for all situation except for quotes inside quotes?
I've forever used single quotes unless necessary, but am trying to switch to the opposite. Just wondering if it's a good idea.
@Daniel single quotes are slightly faster than single quotes
Faster as in execution or hitting the shift key?
(talking about micro optimisation)
execution
15:09
@HamZa that's a myth
I saw that they may be slightly faster in execution but not enough to ever make a difference
PLB
PLB
@Hamza I'd doubt it
I think it was @NikiC who proved it to be false... I can't remember
I'm just wondering for readability etc. if one was preferred over the other
Well not readability, standards I guess
15:10
@Daniel No, it's not a good idea
so stick with the single quotes?
Doesn't really matter what you use
just use what's readable, and forget performance or whatever else
I usually use single quotes to signify "this string does not use escape sequences"
@NikiC apart from escape sequences for single quotes :)
15:11
and double quotes if I use escape sequences, interpolation or if the string has lots of '
I see that I was wrong ...
my bad ...
@NikiC that's pretty much what I'm doing now, makes sense to me. Thanks - @ircmaxell as well and @hamza
quotes? who needs quotes in PHP? echo hello, world;
6
I guess my other question would be - Same convention for HTML?
Am I off base thinking that this would make sense?
interface IFoo {
    function dance();
}
trait TFoo implements IFoo {
    public function dance() {
        echo "truffle shuffle";
    }
}
class Chunk {
    use TFoo; // implicitly implements IFoo
}
@Daniel no that is much more about HTML-code-style I would say.
From what I've seen so far there seems to be no difference in " and ' in HTML
@Daniel There is no difference. Both work.
57
Q: Are single quotes allowed in HTML?

Scott GriffinI am a big time user of using double quotes in PHP so that I can parse variables without concatenating strings. As a result, when I am generating HTML I often use single quotes for setting tag fields. Example: $html = "<input type='text' name='address' value='$address'>" ; Now this is far mo...

For attribute values that do not contain whitespace you don't need any quotes at all.
15:15
Right, so I'm guessing I'll stick with my single quote convention for both cases unless double quotes are needed.
@hakre From 5.3+ ?
@LightningDust why don't you do any jsfiddle on it? (p.s.: see for CORS when you want to load the page from your server)
See to me though @hakre that seems like a readability issue, when I don't see quotes I almost always assume it's a variable of some sort. May just be me though.
@Daniel well, I would stick to some style like: attribute and tagnames always lowercase, attributes always in double-quotes and/or similar.
That makes HTML readable in the end.
Same with using indents, like two spaces per level.
right, yeah I may just do double quotes for HTML and then single for PHP unless needed
most all of the HTML I've read from others uses double quotes, I guess that may be the convention then in most cases, even if it doesn't "really' matter which one
15:18
@hakre I'd want to print a comma.
@bwoebi it doesn't, but the space is missing. see echo
Thanks for the input guys! Always great to have instant feedback on random questions.
@hakre I know. It's a parameter. So the commas will disappear... That's why I ask
@bwoebi ah, you want to :) hmm, echo ',' should do it ^^
Can I without heredoc/nowdoc/double quotes/single quotes/chr ... print a comma?
15:23
@bwoebi sure
1 message moved to bin
@NikiC don't suggest now to escape php's scope...
any one here with enough drupal experience to tell me how drupal knows what query to run?
@AdityaPatil get out
15:26
@hakre without single quotes?!
4 messages moved to bin
PLB
PLB
@AdityaPatil Great but it's spam and we care that fact more than the contest itself. :).
@AdityaPatil you've just been reported. so telling you.
2 messages moved to bin
@bwoebi the idea I had doesn't work for , . I'm sure there are other ways ^^
15:28
@NikiC angle brackets?
Ah shit. I could have used the bulk trash plugin :(
any one here with enough drupal experience to tell me how drupal knows what query to run?
3 mins ago, by alexdmejias
any one here with enough drupal experience to tell me how drupal knows what query to run?
@alexdmejias knowing and determining the right way to ask your question is 3/4 of the battle towards finding the answer
@alexdmejias psychic powers? can you be more specific
15:39
Sorry I got side tracke :P, So I have this page/file that is making a query. I need to find out how this query is being made so I can modify
@NikiC I have one:
@hakre I hate non-XHTML HTML. No quotes? Go to hell.
:P
// will output notices, but not important now.
echo A^m;
@bwoebi That's what I'd have done too
echo Hello, A^a, A^m, world;
15:40
Just don't like the notices part of it
@NikiC I don't like them too, but I don't know another way.
btw, ~xyz is a nice way to shove off one byte in code golf ;) [if string has non-label characters but ~string doesn't]
only if there are notices permitted =P
@Bracketworks segmentation fault. (You just tried to jmp to a not existing address)
@bwoebi Oh hoh hoh, funny guy! ;)
Hy i want to pass variable from php to js, i tried with:
1) var id = "<?php echo json_encode($Id) ?>"; // here i get only string variable
2) var id = <?php echo json_encode($Id) ?>; // here i get error: Unexpected token

Apache is working well so there is php enviroment
15:45
And what does the sourcecode this generated look like?
Have you tried to figure out what's wrong using the JS console?
@Bracketworks Or can you tell me the address of hell?
im workinh under laravel framework, and in some controller i have something like
$this->data['id'] = 10; for example
(we aren't in kernel space; 0x0...0 and 0xf...f are invalid answers.)
@bwoebi Damn
Well, then; uh.. int *p = NULL
@Bracketworks where do you think does NULL point?!
15:49
@bwoebi I believe it's implementation dependent; UB.
@Bracketworks A null-pointer constant is an integral constant expression that evaluates to zero (like 0 or 0L), or the cast of such value to type void* (like (void*)0). (cplusplus.com/reference/cstdio/NULL)
Go to hell ;)
@Bracketworks this.is.not.a.lunch.!
i am having a little problem: when i run
<!DOCTYPE html>
<html>
<head>
<script src="jquery10.min.js"></script>
</head>
<body>
<a href="#">default click action is prevented</a>
<div id="log"></div>
<script>

$('a').click(function(event) {
event.preventDefault();
$('#log').load('links.php');
});

</script>
</body>
</html>
in browser ( simply click and drag it works, but when i use xampp to run it on local host... it doesnot work..
where is located your jquery10.min.js
all in the same folder in f:/xampp/htdocs/xampp/www
@NikiC Intel microcode update payloads are encrypted - wonder where decryption takes place

« first day (962 days earlier)      last day (4212 days later) »