« first day (428 days earlier)      last day (4524 days later) » 

3:00 AM
Jon:
include('inc://include.php/xpath/SomeQueryehere');
Omeid Herat: another: include('inc://include.php&xpQuery=SomeQueryehere');
type:query@file
but then query can not contain @
or only with urlencode
 
0
Q: I need some good books

user1104105So let's assume that I don't know any language particularly well (I know basics, but nothing advanced really, and this includes HTML) but logic/code comes very easily to me, and I want to get into web design/development. What are some good books my level for: HTML/CSS JavaScript PHP MySQL or a...

 
@Justin, @Jon, @OmeidHerat: Thanks for the feedback. I got to go, I'll chew a bit and just poke me for anything on the matter. I now think it's worth to overhaul the URL format before updating the answer to a more expressive format.
 
ok
Thanks for the help!
 
Jon
@hakre
I 'm hacking on it a bit, will poke
bye
 
cya
 
Jon
3:07 AM
actually
just got it working :P
with
include('inc://sample.xml?xpath://*[@id="foo"]');
talk later :)
 
yes, adoption in ::parseUrl is needed for that to get it working.
 
Jon
private function setUrl($url, $useIncludePath)
{
preg_match('~^inc://([^?]+)(\?xpath:(.*))?$~', $url, $matches);

$this->url = $url;
$this->path = $matches[1];
$this->file = $this->resolveToIncludePath($this->path, $useIncludePath ? NULL : '');
$this->query = array('x' => $matches[3]);
}
scrapped parseUrl entirely
 
but makes it a bit less flexible for other query types.
but I see how it works.
 
Jon
basically you can extend it to take ?QUERY-TYPE:QUERY-SPECIFICATION
 
for some reason I think it's good to keep the scheme part dynamic.
 
Jon
3:10 AM
possibly
 
because the class can be registered on any scheme.
 
Jon
that's just a PoC
 
sure.
 
Jon
cu around :)
 
and to be honest, so was my approach with parse_url.
@Jon I like that one.
windows user can't use ? anyway in file-names.
 
Jon
3:13 AM
well now that we know that works
I think I 'll try again with
 
@ ?
 
Jon
inc://xpath://*[@id="foo"]@sample.xml
yup
not sure if that looks better
 
I smell that ? is a better separator, but I like the @ analogy as well.
 
Jon
will chew on it
it's just that I like the analogy so much
 
but maybe it's a better analogy to start with the whole and select something out of it
[big]?(ask)
(part-of)@[big]
 
Jon
3:15 AM
yes, but
consider things like
inc://uppercase@sample.xml
something like that might be desirable
and the query syntax doesn't look so good there
 
$fp = fopen("php://output", "r");

stream_filter_prepend($fp, "string.strip_tags");
 
Jon
?
 
you can apply filters as well to streams
I think uppercase is available as well
already with core PHP
 
Jon
uppercase wasn't really the point
and even then
the idea here is that the stream gets created behind the scenes as a result of calling include
 
just FYI: string.toupper - Turns all characters to uppercase
 
Jon
3:19 AM
you don't get to attach filters to it
 
sure, it's more a post-execution filter then.
something for the output buffer.
 
Jon
yeah
which is kind of redundant
because you can do all of that with ob functions too
 
the include filter is pre-procession.
err, wrapper, not filter.
 
Jon
right
so a better example might be
 
@Jon I am not a fun of regex, so I suggest explode("?xpath:", $path);
 
Jon
3:21 AM
inc://line:43@info.txt
 
+1 that's a very speaking example.
 
Jon
how can you not love it? ^^
 
yeah :)
 
But a question, @hakre @Jon what would a use case for this ?
 
Jon
anyhow... it's past 5am here so time to sleep
 
3:23 AM
problem is with xpath which can contain @s, as well as the filename which can.
 
Jon
@OmeidHerat: a little bit of convenience and very large amount of "because I can"?
@hakre: that's something to think about tomorrow
cu guys
 
from my point, the class is just a test to see if it works.
 
@Jon my only concern is that it's against lots of OOP coding standards.
 
I'm still undecided for which sort of templating this makes full sense.
XHTML is not a OOP coding standard.
 
/facepalm
 
3:25 AM
cu jon
 
@Jon later
 
my drink is near the bottom..
 
@hakre are you going to use 'include()' inside XHTML ?
 
the other way round, I consider to load XHTML via include.
include will also process XML's PI php.
considering that most output is XML even, I thought it's a nice mashup.
 
all of your examples were include('inc://include.php..... but oh well.
 
3:29 AM
include will execute the PIs
you can also use file_get_contents which will leave the PIs as-is.
it's not 100% interoperable.
short-open-tags are not supported
and the missing closing ?> are not supported as well
but you bring me to the idea to support inheritance by using relative file-names for includes based on the current include's file location.
probably as a stream option.
 
4:06 AM
I fell off the chair laughing at this.
 
@Ozbekov that is rude. he deserves heaps of respect.
 
It's not about Dennis Ritchie.
He's the one saying it. Which is why it's funny :)
 
one of the reasons that we can talk to each other now is the Gentlemen in the picture.
I got it, but still that is rude.
 
It's a joke.
 
oh well, people has different kind of views. but yeah.
 
4:11 AM
The thing is, in no way does this picture show a disrespect to Dennis Ritchie. It's funny because he's saying it.
You might say it's inappropriate...
But then, "there is no such thing as an appropriate joke." :-P
 
Fact: Nothing is good or bad by nature.
Fact: People has agreements on what is good and bad with a so called Culture protocol. :P
 
@OmeidHerat You sound too much like Dwight!
 
which Dwight ?
 
@OmeidHerat Dwight from "The Office"
 
Bears, beets, boolean operators
3
 
4:19 AM
@Ozbekov
> he is actually quite gullible, ignorant, and naïve.
>->
 
It was a reference to him saying "Fact." and "False." all the time...
Have a sense of humor, man.
 
@OmeidHerat and the moral of the story ? ;)
 
@Ozbekov No thanks. my Dr. banned me from that.
@hakre Fact: Boredom increase your level of troll.
</troll>
@Ozbekov I actually laughed at the Picture out loud.
 
@OmeidHerat Congratulations.
 
You are welcome.
 
 
1 hour later…
5:34 AM
YO
 
Yo
 
sup?
 
This is up.
I have to sleep but physics is keeping me away from it.
People get more than double my reputation in 5 days... Fail.
 
5:56 AM
yes
My best single day was about 425 rep points. So not far from your rep
 
I have a gap between Feb and Dec, but never got close to 425 in any given day :P
 
mmm..there's something about a refactor that I love when the git commit says 0 insertions, 17 deletions
5
 
6:26 AM
bah, I always have the problem where my interfaces get the good names and then I'm left with crappy names for implementations or abstracts.
 
@CharlesSprayberry join the club
 
7:03 AM
Every time I open a PHP/MySQL question I brace myself...for the inevitable cringe as I see mysql_* all over the place
 
 
3 hours later…
10:26 AM
morning
 
yay
 
sup?
 
making breakfast and listening to dr. Who audiobooks
 
^^
 
hey , i'm a geek , and i embrace it
 
10:42 AM
I don't even know what that is ^^
 
10:54 AM
Hey there
 
11:07 AM
how can you not know what Dr.Who is
 
posted on December 18, 2011 by Official Blog of the PEAR Group/PEAR President

With the PEAR move to github surpassing 200 repositories, we’re seeing more contributions from folks lurking in the shadows. In particular I’d like to highlight the efforts of meldra and Gemorroj. With XML_Feed_Parser hosted on github, Meldra has been able to provide all of the patches that have been sitting in the wings internally back to PEAR, with no fuss. Faced with a backwards compabili

 
11:22 AM
@Feeds Nice per se, but will probably postpone the death of PEAR which we all need so much.
 
11:45 AM
Hey all.
A quick question, if I do array_push with demo data, refresh the page for a ton of time but it still only adds it 1 time into the array
then, how can I add a new entry on each refresh, much like mysql query or something
 
@wabbble You have to store the data somewhere, PHP cleans up on each different request.
 
The easy way would be to store the number of items you want, in a cookie or (even better) session.
 
this is my current invention, db.php is the main array
 
Keeping it in session ensures bad users wouldn't blow up your server by doing $.cookie('amount',100000000000)
 
11:53 AM
So the array I want to add to the main array would be stored in a session?
sounds to me like a whole lot of bad code
 
@wabbble Huh?
 
Look at my current code
 
Depends on what you want to store in the session
I'm quite confused with that code there.
saving everything in a file is what you need (instead of cookie/session)
 
Basically, a new entry will be added to the $db array, which will be written to a file so I can use it wherever, whenever.
 
The problem is that your logic in the code is flawed.
You're overwriting the file each time
 
11:57 AM
but then how else do I add new data to the file?
 
You would want to read array from file, add to the array, save the array back to file.
 
ah, good point
 
also, you don't have to urlencode data sent to the file.
 
because right now I have a different file for the array and then I write it pretty much to another file
which is stupid
You sure?
 
There are some concurrency issues associated with the file approach...you would want to be careful in this area.
@wabbble Sure I am. You can store any kind of data in a file.
 
12:00 PM
Yes, but if the data is broken, the array will be broken, too, correct?
 
Uh, don't try to build your own DB
just go ahead and use MySQL
 
@NikiC Agreed.
 
@NikiC You got me. I'm not planning to use it anywhere, just want to experiment this and that and stuff.
 
@wabbble What you're trying to do is to write a database into a file.
mysql runs a dedicated server for a reason...
 
Yes.
 
12:02 PM
while data saved into a file shouldn't get corrupted on the way, several processes running on the same file will cause corruption on the file itself
some 4 years ago, I wrote a simple visitor logger
it kept log by looking and storing IPs
it frequently ended up all corrupted.
@NikiC I actually came in this morning to discuss an idea of mine.
 
So what your saying is that by manipulating the file constantly it will end up broken?
 
constantly by different processes
 
All right. I guess that does make some sense
 
mysql, for example, keeps a copy of the db in memory so that it doesn't write to disk each time
but the deal is here, all different queries running against mysql, are running against the same channel; there's only one mysql process.
@NikiC what if we wrote an OS dedicated to PHP?
 
@ChristianSciberras No, there are multiple (like 20) MySQL processes
 
12:06 PM
wrote or just stole ubuntu?
there's like a gazillion ubuntu clones out there which makes me sad
 
@wabbble that's irrelevant
 
The difference simply is that MySQL has proper locking mechanisms, which ensure that data is always consistent
 
ubuntu - an ancient african word for "i am clueless"
 
@NikiC that's pretty much what I meant.
 
@ChristianSciberras How would that look like?
 
12:07 PM
@NikiC That's exactly what I'd like to discuss
@tereško 'morning :)
I figured PHP's functionality simply brings loads of OS tools together.
glob, unlink etc
but the fact that PHP 5.4 has a server within it, the idea is more realistic (IMHO)
 
wait, an os for running php or os written in php?
 
@wabbble running PHP
 
good, the other one would of declared me insane probably
 
but the OS would be also written in PHP (the higher levels of it)
for instance, the memory manager would still remain in C, but shell functionality could be provided by a PHP script.
 
well , the OS should support C , because you must be able to compile latest php
 
12:11 PM
I think it's doable... simply a stripped-down linux which runs script init.php on boot
 
heh ... why not go with Plan9 ?
 
@tereško good point :)
bell labs' plan 9?
 
yes
 
Don't have much experience with it, why would you suggest that?
 
looks ancient
 
12:13 PM
@wabbble , every time you say something only bullshit comes out
 
it's says it's still being updated
> Sixth International Workshop on Plan 9, Madrid, Oct 20—21, 2011
 
@tereško stop being so kind to me.
 
^ Not that old is it :)
I'll get an iso on my vm and see how it works out
 
especially it being one of the newest iteration on Unix concepts
 
84mb? last I checked PHP o windows was 60mb :D
definitely interesting
 
12:20 PM
huh?
 
I like their mascot :D better than a penguin XD
 
12:45 PM
hm, got stung by static again
 
PoAAE - Addison Wesley, Page 324, Model View Controller:
Then the Bootstrap and Router is the Controller ?
s/PoAAE/PoEAA
 
1:29 PM
@OmeidHerat FrontController
@tereško last time I saw Plan9 it didn't feel like next big thing. anything changed?
 
@KamilTomšík Quit honestly. I am a logical person and understand things easily.
but MVC is the first thing that has challenged me. I just don't get it.
@KamilTomšík Would still need other controllers with a FrontController or it will be doing ?
Every Book, Every website, Every FW, Every Person has they are own variation of MVC I reckon. (at least in web)
 
1:53 PM
is there some nice way to encode a binary string to hex?
bin2hex
 
@CharlesSprayberry Just found that too :D
I am currently writing the ugliest-possible code :)
 
@NikiC goto?
 
I'll show when it's done ;)
 
I'm doing some beautiful foreaching
 
2:03 PM
@CharlesSprayberry But you can already have a look at the current version: gist.github.com/40ea97deadf27ec2e159 (it will be even worse when it's done)
 
2:29 PM
phpass or any better recommendations as password hashing library?
 
 
2 hours later…
4:06 PM
 
I bet you wrote it with your eyes closed. Something like when very high, don't look down motive.
 
4:34 PM
@NikiC You there?
I need some brains with a concept of mine. And stackoverflow would close my question with a variety of excuses :)
basically, I've developed an RTCE (real-time collab editor)
it's based on javascript, codemirror, websockets and php :)
I've got it working reliably like 90% still need to iron out some issues with new lines.
but I'll figure that out myself.
my problem is with error correction.
let's say one of the editor clients produces a bad character (or looses one) in 15 minutes of use...
the character would remain until the end of session
while other editor clients work normally, changes in them would show up strangely on this one (such as the caret might be off by a character or so).
So the question is, how can I implement a form of error detection and correction?
I was thinking about md5()-ing the full content server-side and send it to the client every few minutes. If it doesn't match client-side, client requests the server for a correction packet.
 
what do you mean by bad character?
 
@Ozbekov For instance the user types "abc" and for some reason, the editor's onchange event registers it as "ac"
so all other clients get "ac" except this particular client
This is just an example. My point isn't to rectify this example, but employ e.d.c
 
So the onchange event is following a bit slower than you
Maybe you shouldn't take it character-by-character
 
@Ozbekov for example
 
but send the whole text?
 
4:45 PM
@Ozbekov too slow
 
it's less efficient but more promising
 
I'm currently buffering changes
eg 5 quick key presses are sent as one request
 
Ah
 
but sending all of it, isn't a good solution
 
do you have like a sandbox with which we can run a test?
 
4:46 PM
I'll have to set it up on my server
so far been running it on localhost :)
'bout time I send it online
 
Well, best case is to test these things online
often, localhost is faster than any other connection :-P
 
yeah, I'm guilty of two sins here :)
 
@ChristianSciberras now i am
 
@NikiC :D
let me try putting it on my VPS
now where was that password hmmm? :)
 
do that please
I want to see how it looks like :)
is it specifically for developing php?
 
5:05 PM
@NikiC nope. Got plenty of highlights (see codemirror)
finally got into my own server XD
 
5:21 PM
> So I'm curios is it a goal to use your PHP parser for 5.4/.5.3 backporting purposes. If so maybe I could help out of possible fund the project if you have your own company.
 
@NikiC Hmm?
 
hello everyone, trough GET method I send to cookies.php page the list of cookies in the browser, using javascript document.cookie function.

document.cookie function produce something like this:
cookie1=value1; cookie2=value2; cookie3=value3

How can I extract every single cookie value from this string in php?
 
I hate mails like that.
Because they make me think long what to reply
 
I don't like to be funded ^^
 
5:24 PM
Where/What is the PHP spec?
 
@NikiC You can say "yes" and send over the stuff to me, if you want. (no, I'm serious!)
 
2
A: Does PHP have a built in optimizer?

NikiCPHP uses a single-pass compilation process in which it converts the source code into an opcode stream (which is then executed). Because the compilation uses only a single pass and does not build an AST most optimizations commonly done by other languages would be very hard to implement. There obvi...

Wow, that guy really accuses me of stealing his answer.
 
I'd rather CV honestly.
 
I wonder what a mass geek fight would look like, everybody sabotaging each other's keyboards?
 
@wabbble Nerf fight?
2
 
5:30 PM
I mean, if a regular person would most likely use a fist, knife, gun or just run over a person with a car then what would a geek do ...
 
IT vs SALES (muahaha)
 
Yeah, watching it as we speak. It's like an epic battle of cubicle
I could swear I saw a guy under a desk crying while holding some sort of a picture yet I'm too afraid to scroll back to prove it.
 
Seriously, is there a PHP specification document?
 
@Raynos A specs document usually explains a specific situation
PHP probably has loads of such things...
 
@ChristianSciberras No I meant a language specification, you know grammar, semantics and standard library. Like the ansi C specification
 
5:41 PM
@Raynos Oh, I see
IDK, some features have been added quite haphazardly...
 
I presume your interpretation of "spec" is some kind of BDD test thing
 
user1385191
5:55 PM
hi, I recall a recommendation page on github for PHP autoloaders
 
user1385191
can anyone recall it?
 
Interesting .. it's undefined offset when INT and undefined index when string
 
6:15 PM
@Raynos No, PHP does not have a formal spec
@Raynos I can give a grammar though, if that's what you are looking for. The "standard library" is documented in the manual.
 
I was basically looking for the "definitive guide". I presume I should just read the PHP manual
 
The manual is pretty much the definitive guide ;)
 
Have fun, PHP has enough functions to never let you get bored and enough functions to get you a golden ticket to mental institution.
 
user1385191
the state of PHP documentation is kind of like JavaScript pre-Crockford
 
Not really
PHP has the best documentation of languages, that's generally agreed upon.
If there is one thing that PHP has done right, then it definitely is docs ;)
 
user1385191
6:27 PM
I suppose I could have phrased that better
 
user1385191
what I meant to get at was there doesn't seem to be a definitive source for style or expertise
 
ah, okay
well there actually is
this chatroom :P
 
user1385191
there are a lot of "good parts" that get overlooked because they haven't been fully exposed to the public
 
yeah
 
user1385191
the templating control structures are quite nice
 
6:31 PM
The : end ones?
 
user1385191
I prefer the braces, but yes
 
I use the endif; endforeach; endwhile; etc in html-rich file.
 
I don't use PHP for templateing anyways ^^
 
other then that, braces!
 
user1385191
<dl>
<?php foreach ($something in $something_else) { ?>
	<dt><?php echo $something -> term; ?></dt>
	<dd><?php echo $something -> definition; ?></dd>
<?php }; ?>
</dl>
 
6:33 PM
If I could do function (): // yada yada endfunction;, then I might go all the way to it.
 
@NikiC What do you use? I always thought the template powers of PHP was one of its strong points.
 
@CharlesSprayberry Personally I use Twig
 
Does anybody here have any experience with doxygen?
 
nop
 
I really like the application but the internal doxygen commands start with a `\` which just so happens to be the namespace separator. So every time I run new docs I get countless warnings about unknown commands from the namespaces :(
 
6:47 PM
Oh twig looks like the templating in django
 
it's based on jinja ;)
 
Im working with codeigniter at the moment, and well the largest files and probably the most messy are my views.
Jumbled mess of html, php and some js
Im still unsure if I need a template engine
 
you do want to separate your concerns
but whether or not use a special TE for that is your descision
Many peoples argue that PHP is the best templating engine there is
I would disagree and suggest Twig
(The only thing that everybody is sure about is that you shell not use Smarty)
 
what do you mean I should separate my concerns?
 
I mean separate your view from the rest of your code ;)
 
6:53 PM
Ah right I see. Well when I say PHP I mean stuff like forloops. or just printing values. So those things cannot be avoided.
How else can I separate my view?
 
ah, okay, you obviously will need to use loops and such in your tempaltes, yes
It's only about not printing or assembling any html in your "main" code
 
How can I order array by a certain array key like ID?
 
usort with custom compare func
 
I mean, array_reverse seems the only solution from where I'm sitting
That's more like it, thanks.
 
I have a question.
What does this do
set_value('settings_fullname') ? set_value('settings_fullname') : (isset($account_details->fullname) ? $account_details->fullname : ''),
 
7:06 PM
you mean what the ternary operator does?
 
Well I want to know what its doing yes
 
A ? B : C === if(A) B; else C; (roughly)
so basically it will either return set_value('settings_fullname') or $account_details->fullname or '' (depending on which of them is set)
 
Ah right ok
so its a if elseif else statement?
but shorthand
 
yep
by the way, please don't write code like that
Nested ternaries are really hard to read ;)
 
haha yep, I didnt write it. Its from an open source project. I guess the guy did it like that since its a lot shorter once you know what it does.
 

« first day (428 days earlier)      last day (4524 days later) »