« first day (145 days earlier)      last day (4806 days later) » 

1:00 PM
actually
i am getting the problem
lemme send my problem
@belinda
i already shooted in the stackoverflow
but no answer
/:(
 
can any one suggest a server-push framework for flex?
with php as the backend
I know this is the wrong place to ask this question, but i did not find any one in the flex/actionscript chat room
is any flex developer arround?
 
1:21 PM
sign
 
Back
@edorian: I pushed what we were talking about to GitHub: github.com/ircmaxell/PHP-CryptLib
 
Hollaaa If U can Read Me!!!!
 
I can't read you
 
I am stucked up in an issue I need u all geeks to pls go thru the question I have and help me out with the proper solutions
0
Q: How to find coordinate of desired text in PDF file using PHP?

OM The EternityHello I have been looking for the way to find the coordinate of string in PDF using PHP I searched in GOOGLE and also looked into many questions in SO, but didnt find something relevant, can someone help me in finding me the solution... Thanks

 
@OMTheEternity It's very difficult
6
A: Is there a PDF parser for PHP?

ircmaxellI've written one before (for similar needs), and I can say this: Have fun. It's quite a complex task. The PDF specification is large and unwieldy. There are several methods of storing text inside of it. And the kicker is that each PDF generator is different in how it works. So while somethi...

 
1:31 PM
-1
Q: Remove rep. gained from answering a question that is a duplicate?

edorianWhen answering questions that are except duplicates of other questions i feel the site only gets more cluttered, especially when the answer also is a copy of an old answer. The last time the subject was brought up (in 2009*) there seemed to be a consensus that rep. gained from answering a questi...

 
lol
 
my first meta and i don't understand the downvote
 
@edorian Downvote on Meta means disagreement. Also, this is a duplicate
 
@edorian It's not like SO. MSO downvotes are used as an I don't like it...
Not that it's a bad idea, just that some wouldn't like to see it implemented...
 
@YiJiang I'm aware of the irony with that and state that the old one is 18 month old and there was a lot of talk ofter that between that last proper meta
But thanks, i thought that only applied to Meta answers
 
1:34 PM
@edorian On Meta, the distinction isn't always clear
 
@ircmaxell can u make it simpler..its hellish
 
@OMTheEternity Can I make what simpler?
 
Because there are a lot of questions where many people disagree strongly that are vote with a clean 0
 
@edorian If you split the vote there's usually something like +4/-4
Voting is fairly liberal on Meta
 
@ircmaxell The answer to my question.. It seems u have Short term, Memory Losss:)
 
1:36 PM
@OMTheEternity Can I make what simpler? The PDF spec?
 
@ircmaxell No ways... The solution to my need in my question
 
@YiJiang i can't do that on meta (splitting) so i just went from what i've seen. I'm not mad or anything, just curios, thanks :)
 
is there a floatint() function or something that I can use to drop the decimal of a number. e.g. ( 180.00 ) i want to look like "180". I know I can use substr() but is there an easier way?
 
@sadmicrowave int cast? $int = (int)180.00;
 
@sadmicrowave floor($float) : $int = floor(180.00);
 
1:38 PM
same thing :)
but more expressive so it's better
 
@edorian I wonder if they are. testing...
 
thanks guys the floor($var) worked
 
@ircmaxell any solution
 
@edorian Floor returns a float with no decimal points.
@OMTheEternity Yes there's a solution. Use mechanical turk to have people do it for you manually
 
@ircmaxell y being rude??? its not like using floor() and substr(), its bit tricky thats y i am here
to get the help frm u people
 
1:41 PM
@edorian Actually, quite different
$ php -r '$val = "123.43e2"; var_dump((int) $val, floor($val));'
int(123)
float(12343)
 
@ircmaxell and it's the same in c/c++ what don't i know that already.. it seems arcane enough
 
@OMTheEternity It's difficult. I don't know how to say it in any other way. The easiest way I can think of is to build a full blown PDF renderer to render a PDF into an image, and then parse that image for your coordinates. So since I don't know of any good solutions, I'm not providing any solutions. I pointed you in the best direction I can think of quickly. That's all I can do. I'm sorry
 
php -r 'var_dump((int)(float)"123.43e2");'
 int(12343)
 
@ircmaxell thanx mann
 
int casting on strings will break, yeah.. but i assumed for float input
still nice.. that floor returns a float still strikes me as odd
 
1:46 PM
@edorian I thought they would behave the same on all situations. It's odd that they don't...
 
Since i was told to "not compare floats because of IEEE floating blabla" if the digits don't matter just floor them and compare
 
Well, you can compare floats, just don't do ==, do something like abs($float1 - $float2) < $precision where $precision is based upon the scale of the 2 numbers (usually 6 or 7 orders of magnitude less)
 
hey guys can you check this out: this works for me but I have a question about the output
0
A: php implode multidimensional array to tab dilimited lines.

sadmicrowave $lines = array(); foreach($BlockData as $data) { $lines[] = implode("\t", $data); } echo implode("\n", $lines); I would like to give credit to @Alex for recommending this, then deleting his post. This solution worked for me even with my 13 dimensions in my array elements.

 
Yeah with "compare" for that case i meant ==
 
d -231.88 82.91 1:CR200 90 1AB005470009 L1CP7A-030
d -182.86 36.81 1:C1043 180 1AB012890135 L1CP7A-040
d -171.30 48.11 1:CR1004 180 1AB002440002 L1CP7A-041
I can't get this chat to replicate what I'm seeing. but essentially the first 2 lines are tabbed correctly between the values, then on the 3rd line between the 1:CR1004 and 180 there is a huge tab that looks like triple the space between the other lines
 
1:53 PM
@sadmicrowave: what's wrong with what I suggested yesterday?
0
A: php implode multidimensional array to tab dilimited lines.

ircmaxellHere's an option that I suggested yesterday in chat: $callback = function($value) { return implode("\t", $value); }; echo implode("\n", array_map($callback, $BlockData));

 
I could'nt get the array_map to work :(
 
just copy and paste it, and it'll work
wait, what version of PHP?
 
@sadmicrowave Use the fixed font button to get code formatting
 
5 what? there are a lot of 5s out there
 
1:54 PM
php5
 
5 point what
 
@YiJiang, where is this button?
 
5.0, 5.1, 5.2, 5.3, etc?
 
i guess 5.0, I don't know sudo apt-get install php
 
you have console/terminal access?
 
1:55 PM
@sadmicrowave When you enter a multi-line message it will appear
 
run php -v
 
d -231.88 82.91 1:CR200 90 1AB005470009 L1CP7A-030
d -182.86 36.81 1:C1043 180 1AB012890135 L1CP7A-040
d -171.30 48.11 1:CR1004 180 1AB002440002 L1CP7A-041
nope didnt work
thanks, 5.3.3
 
did not work is not a valid answer. How did it not work. Specifically, what's wrong with it
 
sorry, I mean the fixed font button didnt work
 
1:57 PM
class ItDidNotWorkException extends Exception
{
}
 
lol
 
What I want to know, is how that recursive function got +4... It won't even work properly...
 
lol, I didn't upvote it so don't ask me
 
@sadmicrowave Well, you didn't click the fixed font button, because if you did, the message's source will show four spaces in front of each line
 
2:00 PM
@YiJiang, ok, well there you go....the link you provided is what I'm getting as my output now, and I'm not sure why its putting that large tab in some spots and not others.....moreover; will that be corrected when I export this to a txt file?
@YiJiang, how did you make that link to the text selection so I can do that later
 
@sadmicrowave How do you what?
 
the "message's source" link you created to the text
how do you do that?
 
d -231.88 82.91 1:CR200 90 1AB005470009 L1CP7A-030
d -182.86 36.81 1:C1043 180 1AB012890135 L1CP7A-040
d -171.30 48.11 1:CR1004         180 1AB002440002 L1CP7A-041
 
@ircmaxell I understand op has an $a['x']['x']['x']['x']['x']['x']['x']['x']['x']['x']['x'] = 3 style array. So i can see the +4 answers making sense
 
Look, just use the fixed font button
 
2:02 PM
@YiJiang no you didnt. you used backticks for that
 
without the chat here i would have provided something similar
 
@edorian If it worked, but it doesn't
 
You can get the source of any message with http://chat.stackoverflow.com/messages/{message_id}?plain=true, but it's troublesome
@Gordon backticks for inline code, four spaces in front of each line or the 'fixed font' button for code blocks
 
i know
 
2:03 PM
Wait, what?
 
@ircmaxell ok. fair enough
 
@Gordon Also, I did not do that there; you can look at the source
 
You want the values each dimension separated by \n, and each dimension by \t?
can you give a simple example of source data and output data?
 
the elements of each array separated by \n and the values of each dimension separated by \t
 
2:05 PM
question about datastructure without a "in" and "out" are kinda hard to answer tbh
 
I don't know why I have to do this; you can't create multiline code blocks with backticks. The parser simply doesn't handle them
 
@sadmicrowave That doesn't make sense though to me. Show me an example
 
two array elements look like this:
[35]=>
  array(9) {
    [0]=>
    string(1) "d"
    [1]=>
    string(7) "-203.81"
    [2]=>
    string(6) "169.65"
    [3]=>
    string(4) "1:T5"
    [5]=>
    float(0)
    [6]=>
    string(12) "1AB127660004"
    [7]=>
    string(9) "L1XP2B-12"
    [8]=>
    string(4) "1:T5"
    [9]=>
    string(23) "XFMR_000_00_076_076_059"
  }
  [36]=>
  array(9) {
    [0]=>
    string(1) "d"
    [1]=>
    string(7) "-248.14"
    [2]=>
    string(6) "103.48"
    [3]=>
    string(5) "1:U21"
 
Show multi dimensions tho
 
that is, array element 35 and 36 with multidimensions 0-9
 
2:09 PM
'And out of curiosity, is this GPS data?
 
nope
 
See, I still don't understand what you mean by multidimensions 0-9. That's a flat 2 dimensional array
 
well then I'M the one confused
but i guess that makes sense
 
do var_dump($BlockData) and show from the first line until the end of the first data array
 
I did that, thats what you see under "two array elements look like this:"
 
2:12 PM
but that doesn't show the parent data
 
array(712) {
  [0]=>
  array(9) {
    [0]=>
    string(1) "d"
    [1]=>
    string(7) "-272.01"
    [2]=>
    string(6) "182.73"
    [3]=>
    string(7) "1:CR331"
    [5]=>
    float(270)
    [6]=>
    string(12) "1AB064350001"
    [7]=>
    string(10) "L1CP7A-001"
    [8]=>
    string(7) "1:CR331"
    [9]=>
    string(25) "SOT143_004_19_014_030_010"
  }
 
Show something like this:

array(100) {
    array(9) {
        [0] =>
        string(1) "d"
        [1] =>
        string(7) "-203.81"
...
Ok, so based upon that, my solution using array_map is correct. You want to make the data look like d\t-272.01\t182.73\t...030_010\nd\t..., correct?
 
then the array_map solution I provided is the correct one. (well one thereof)
 
and it really doesnt matter because it was meant to be humorous anyway
 
2:17 PM
@Gordon What in the world does the Markdown used to write the 'fixed font' button have to do with what I was saying to him?
 
@YiJiang geez, forget it :) not important
 
@Gordon ಠ_ಠ
 
Oh @Gordon: I added the rest of the code I did until now to there. The key package still needs to be documented, but the rest is there...
 
@YiJiang cool face :D
 
I'm still not happy with either the Encryption or Key packages, but they are a start
 
2:20 PM
@ircmaxell nice
 
@ircmaxell, what if instead of echoing I wanted to append the results to a variable...
 
Then change echo to $str .=
 
$BlockString = $BlockString . "\n". implode("\n", array_map($callback, $BlockData));
$str .= ?
 
Yeah, that will work
$str .= is a shortcut for $str = $str .
 
what is connect.me? do i need that? what for?
 
2:24 PM
@ircmaxell, I want to keep adding the results to the end of an existing variable...but everytime I add to the previous content in that string there is no line break
 
Anyone know how to detect the suhosin patch without having to parse phpinfo()?
 
@ircmaxell the autoloader is missing from the CryptLib isn't it? (and the tests but meh)
 
@sadmicrowave Show your code. Trying to explain a problem like that isn't really going to work...
@edorian Yeah. But it's dirt simple:
$autoload = function ($class) {
        $path = __DIR__ . '/lib/' . str_replace('\\', '/', $class);
        $path .= '.php';
        if (file_exists($path)) {
                require_once $path;
        }
};

spl_autoload_register($autoload);
 
i c
 
I don't know if that belongs in the library. Perhaps I'll add it to the root as a "bootstrap" file...
Oh, and I'm going to start adding tests soon...
 
2:27 PM
I sort of want to be able to use a lib without figuring out what autoloader to use
 
Fair enough. Where should the file go? /lib/bootstrap.php? /lib/CryptLib/bootstrap.php?
 
how would I replace all tabs with 4 spaces in a reliable way with eclipse? just search/replace?
 
@Gordon That's the best I've done for that problem
 
/lib/CryptLib/bootstrap.php i guess, if the "CryptLib" folder is what you would ship if you create a pear package
 
Right...
 
2:31 PM
@ircmaxell, can you append contents of an array to other contents of an array to create 1 long array using the same method you used earlier?
 
@sadmicrowave: no
 
is there a method to do this?
 
Give an example of what you want
 
the reason I ask is because:
$BuildData .= implode("\n", array_map($callback, $BlockData));
is only returning the contents from the last array it cycled through...not appending all data from all arrays
 
huh?
Pastebin your code
 
2:35 PM
sorry, I don't know how to pastebin my code
2
 
spl_autoload_register(function ($class) {
        if (substr($class, 0, 8) != 'CryptLib') return;
        $path = substr(str_replace('\\', '/', $class), 8);
        $path = __DIR__ . $path . '.php';
        if (file_exists($path)) {
                require_once $path;
        }
};);
 
Yeah, I know I can do that. But I find storing it in a variable first is more readable... But then again, it's a global variable...
 
thats what i was going at
 
I had to slim it down and just give the pertinent code
 
2:43 PM
ho-hum.
 
and require $path should do it?
 
The comments from github.com/ircmaxell/PHP-CryptLib/blob/master/lib/CryptLib/… show nicely why i hate phpdoc
it makes people duplicate documentation
 
Yeah...
 
and shouldn't be AbstractFactory.php and Strength be in CryptLib/core ?
 
2:48 PM
@sadmicrowave Here's what that boils down to:
 
I'm only talking about stuff like that because i have absolutely nothing to complain about codewhise
 
@edorian Yeah, I've been thinking about that. It's been bothering me...
 
Apart from the optional dic but thats a choice i can respect, ease of use > gain
   /**
    * Determine if the hash was made with this method
    *
    * @param string $hash The hashed data to check
    *
    * @return boolean Was the hash created by this method
    */
 
yeah, that's a bit fubar
 
It's done well, it's consistant
but it just makes me cry
 
2:52 PM
it's such a pita to do as well
 
But since the only thing I'd change about the codebase is a very minor
- `return substr($hash, 0, 7) == '$pbkdf$';`
+ ` return strncmp($hash, '$pbkdf$', 7) === 0; `
i don't want to complain about some overly verbose docs
 
Good Morning :)
 
Well thats not entirely true, but i like it a lot
Good afternoon @EricColeman :)
That AbstractHash::getSize as a boolean parameter is a another minor complain.. (i'm just talking because i avoid working .. sry :) )
 
@edorian Why? It's saying do you want the size of the raw output or the hex encoded output?
 
->getSize(true); looks ugly
 
2:59 PM
0
Q: PHP MVC: Improving my page controller

lauthiamkokHi, I am practising MVC to build my website, this is my page controller, /** * this file handles the retrieval and serving of page */ class controller_core { public $connection = null; public $page_model = null; public $authentication_admin = null; public $authentication_mem...

 
searches for the refactoring book to get the name right
 
OMFG
 
fair enough, but it's consistent with the $binary parameter of all the hash functions
 
Gordon will do too
 
huh? will do what?
 
3:00 PM
@Gordon "FUBAR" isn't a appropriate answer is it?
 
@ircmaxell why would I pass true to`getSize()`
 
Tell my what the name of "preplace boolen parameter with extra method" was
 
@edorian but it can be a comment :)
 
@ircmaxell, i've got everything working except for the large space between some tabs as displayed here:
http://codepad.viper-7.com/r068i5
It only happens when the 1:CR202 column has something in it that is 8 or more characters
 
3:02 PM
@edorian a Boolean flag is usually an indicator that the method does not one but two things
 
@sadmicrowave: it because of the tab size of how you're viewing it
 
so it should be getBinarySize and getHexSize
 
@Gordon It does one, the boolean flag indicates whether to return a binary result or a hex one...
 
@ircmaxell yeah, that's two things
 
@Gordon True, however the problem comes in when proxying a parameter. Just like hmac does...
 
3:04 PM
Non-PHP question, but does anyone know if there's a nice way to retain the window.opener reference across page views (in the popup obviously)?
 
@ircmaxell, so my end variable would be getBinarySize($variable)??
 
@sadmicrowave No, that was for me...
 
I always thought the popup retained the window.opener reference (and it does in FF), but it turns out Chrome drops it
 
@ircmaxell, lol - ok
 
@edorian That's F3: Flag Arguments in Clean Code
 
3:06 PM
@Gordon thanks :)
@BlairMcMillan no clue, sorry :)
 
hrm... @Gordon, @edorian: I'll work on that more later. I guess I could provide a helper class to convert a binary string into a hex one. That way all hashes will be binary, and if you want a hex one just pass it through the converter class...
 
@ircmaxell, so how do I fix the viewing problem?
 
@sadmicrowave The file format is correct.
 
@ircmaxell Very minor complaints tbh :) It's just a piece of code that is at least worth talking about (and that doesn't happen that often)
 
the problem is just because you're viewing with tab-space 4 instead of something higher
 
3:07 PM
@ircmaxell if it overcomplicates things leave it like it is. I was just answering to @edorian what refactoring that is
 
@edorian Ok thanks. It's looking like I have to do everything within an iframe inside the popup.
 
Well, I can see the arguments for it. I think I'll just get rid of the binary argument alltogether, and build a decorator to do that transparently...
 
:)
 
@edorian in Fowler that's the more general Replace Parameter with Explicit Methods
wasnt there someone yesterday asking about cctv motion detection? could this be of interest to him: secure.wikimedia.org/wikipedia/en/wiki/OpenCV
 
3:25 PM
i have a baseclass and concreate1 and concreate2 extending those, concreate1 needs a concreate1dataProvider and concreate2 needs a concreate2dataProvider, there is baseclassDataProvider too.

How to pass those in the constructor ? While it's possible it doesn't seem like a good idea to hint against baseclassDataProvider in baselclass and hint against concreate1dataprovder in concreate1
Am i allowed to do that? Good idea?
 
concrete drinking game
depends on the used methods in concretedataprovider
 
just has noticed that all the surrounding classes use setter injection anyways so the constructor doesn't matter
but the paramter for the setter matters
 
@edorian You're not allowed to do that
What you could do is have an options array passed in
 
@ircmaxell In the constructor i would be allowed to do that
class foo { public function __construct(Foo $f) {} }
class bar extends foo { public function __construct(ASDASD $asdasd) {} }
 
It'll raise an E_STRICT error
since the signature is changed
 
3:30 PM
Not in 5.3.3+ or in head afaik
 
I thought if the signature changed at all, it would error out...
 
i like
edo@mc-ci:~/php5399/bin$ ./php -v
PHP 5.3.99-dev (cli) (built: Jan 12 2011 12:20:59)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies
edo@mc-ci:~/php5399/bin$ ./php -d display_errors=1 -d error_reporting=-1 -r 'class foo { public function __construct(Foo $f) {} } class bar extends foo { public function __construct(ASDASD $asdasd) {} } '
edo@mc-ci:~/php5399/bin$
 
is there any function I can use to find the length of the line that my searched text is on...
for example. if I search for "FID2" out of this text:
"00001",0,"F","FID1",-271.05,1.35,0.00,"FID1",1,0,0,0,0,"",0,"000"

"00002",0,"F","FID2",-14.40,1.35,0.00,"FID1",2,0,0,0,0,"",0,"000"

"00003",0,"F","FID3",-14.40,191.67,0.00,"FID1",3,0,0,0,0,"",0,"000"

I want to find the strpos of the last character on the line that "FID2" is found on...
????
 
anyone here?
 
no
 
3:43 PM
no :-P
 
ok
 
but i was here yesterday
 
And I am here tomorrow
deja-vu
 
so if you quantum entangle us, you might get the best of both of us now.. or the worst
 
@ircmaxell, or @gordon, could you guys help me with my question above....
 
3:46 PM
@Gordon: true, but he could also then access us whenever he wanted, but we couldn't do anything else... Man that would be odd
 
i have clubs ratings made by users in disco_ratings..

this contains uID, dID, rating, date

And when I want to find the average rate of a club, im taking all where dID = x and then divide by how many exists.. Works fine

Now i would like to make an top list, of all the clubs, where it shows the best average rate descending
 
Oct 26 '10 at 19:34, by ircmaxell
Why not ask your specific questions. If people can help, they will...
 
and In this select option where you select to order by the best rating, there also is most views and "latest.."
Ive build everything except this last, like this:
http://pastebin.com/9LH9rwmL
 
@sadmicrowave: do $pos = strpos($data, 'FID2'); $endPos = strpos($data, "\n", $pos);
 
What should i do at the case 1 in $s which is if you chose "best rating"
 
3:48 PM
@Karem either im not getting it or you paste the wrong pastie
 
Can you make a query that outputs the top average rating..?
@Gordon its not wrong pastie.. what dont you get?
 
there is no uid did rating date
 
no that is inside the disco_ratings that i have yet not made any code for..
 
@Karem you want the top 10 clubs, right?
 
Although as you can see the way it has been coded, how should i implement in this, that it should grab the average rating dID in disco_ratings..
yes @gordon
 
3:54 PM
rating is the average or did?
 
Hi! :)
 
dID is the discoID(club's id), rating is what the user rated
 
Nobody at the MySQL room :/ I'm a beginner and I need help
 
I'll head there now
 
try SELECT dID, AVG(rating) AS averageRating FROM disco_ratings GROUP BY dID ORDER BY averageRating DESC LIMIT 10;
 
3:56 PM
I didn't knew that SQL stands for Structured Query Language... until I selected it in Notepad++.
 
@Gordon wow that worked surprisingly
 

« first day (145 days earlier)      last day (4806 days later) »