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

12:00 AM
But I guarantee you that the arguments are evaluated left to right ;)
 
Jon
since the de facto spec is left to right eval
 
@NikiC I sware as well ;)
At least it's documented that assignments are right to left.
 
Jon
who would be the man to pester for an explicit reference somewhere in the docs and how?
@hakre lol
 
So one could argue that this is the special case and the normal case is the opposite.
 
Jon
don't see how they are related
 
12:01 AM
I can add it the docs if you want to
 
Jon
@NikiC: I can see no harm in that so yes please
 
@NikiC Probably wait because it depends as well on the point of view.
 
Guys can you tell me what answer deserves the bounty on my question?
http://stackoverflow.com/questions/8389253/correct-http-status-code-for-resource-which-requires-authorization
 
@Jon It's documented here: php.net/manual/en/language.operators.precedence.php The comma is left associative ;)
(If that suffices to you ^^)
 
Jon
@NikiC damn comma makes it hard for me to write a function that accepts multiple parameters ;)
 
12:03 AM
@NikiC Yeah, cool. That together with the docs on the function page.
@PeeHaa To the one with the lowest rep. stackoverflow.com/a/8394679/367456 - not making much words.
 
k
 
Jon
@NikiC: I think an explicit reference somewhere near the top of php.net/manual/en/functions.arguments.php would be good
 
@Jon: I would say the common user expects that the expressions are evaluated left to right in a programming language. For everything else it's probably better to write a blogpost with all the glory details and reference the parts in the manual.
This chat is really distracting me from finishing my stream wrapper ;)
 
Jon
@hakre: We know how the implementation does it, and we know that the docs should mirror the implementation's behavior because there is no spec. Therefore we should... do nothing?
sorry about the wrapper ;)
 
Information may be passed to functions via the argument list, which is a comma-delimited list of expressions, which are evaluated from left to right. ? I'm not sure that this is really necessary in the first sentence on arguments ^^
 
12:15 AM
^^
 
Jon
Leave first sentence as is and add "Arguments are evaluated in order from left to right."?
I don't really believe it has to be that much near the top, but then the docs go on with examples and other stuff where it wouldn't really fit in
so near the top by process of elimination... :)
 
Jon
thanks for bothering :)
ended up reading php.net/svn-php.php for some reason and almost rofl'd
Do I need an SVN account? :P
I just read the form at the bottom as well
L-O-L
aren't those some "trick question" checkboxes?
 
:D
 
Jon
boy did someone have a request queue with a really low SNR
 
12:28 AM
By the way there is no spam through that form.
The bots probably don't get past the checkboxes either ;)
 
Jon
I like that form, it's good engineering principles at work: redundancy
 
By the way I don't think I read the text above the form when applying for an account ;) So the system does work ^^
 
Jon
reminds me of the "after I explain it nine times you get it on the first try" joke... which sounds better in my native language but still
 
Those multiple socket with switch are cool to save energy.
It's only bad if you switch off w/o shutting down.
Need to reboot for diskcheck.
:/
 
Jon
if only the switch wasn't under the desk :)
 
12:41 AM
@Jon Even for users with valid reasons for SVN, they can still foul up the form.
I know I did several times :)
Also: no password confirmation check. You can see that they expect perfection in their candidates.
 
@LeviMorrison I really wonder how you did that :P
 
@NikiC Simple, because I really did need an SVN account to do the things they say I don't need one for: submitting a patch to PHP.
 
^^
 
Jon
well IMO it would be unsurprising if some candidates actually "lied" in order to stay clear of "is this a trap?" choices
 
Well, I need to go shopping. Have a great weekend, everyone!
 
12:43 AM
you too
 
Jon
u2 :)
actually now that I read it more carefully
you need to uncheck every single one
this gets funnier every time :)
 
yeah sure, what did you think?
That there are some right and some wrong?
 
Jon
just skipped over half of them the first time
so yeah exactly that
 
Any .net gurus here who might be able to lend a hand to a question of mine, let me know. I'm usually the php environment here so I don't know where to look.
 
Jon
ask and we 'll see what we can do
 
12:55 AM
@Jon you know net?
 
In PHP if I have categories (each having a array of keywords) and I want to categorize an article based on keyword relevance, how do I do that?
 
Jon
yes
 
I'm trying to do that in my .net server app
0
Q: How to sort an object in a list on a non-unique value?

JustinI'm trying to categorize articles by stored keywords. I have a list of keywords for a category, and I want an article to get assigned a category that has the most keyword count. For Each keyword As String In category.Keywords category.tempCount += Regex.Matches(article.Item("title").InnerXml...

I've asked...
I love the stack overflow philosophy - "Ask and you shall receive" we just don't know when.
 
Jon
@Justin do you know LINQ?
 
Can I say no and still be licked... ?
lol
the .net gets information from a XML API, it doesn't have direct access to the database so if LINQ needs SQL or something like that... its a no go.
 
Jon
12:59 AM
no it's not that
what you need to do is
a) make a cross join of articles and categories
b) for each category-article pair, calculate "score" for that article in that category
c) "save" the category/article/score tuple somehow (e.g. anon type)
d) group the resulting collection in sub-groups by article
 
Um... its a MySQL database.
ok
 
Jon
e) for each sub-group, order the tuples by category score
f) for each sub-group, pick the category in the first tuple of the now-sorted items
 
I was afraid I had to do all that... I'm trying to avoid the database solution. Ug... I'm not exactly Mr. DatabaseGuru
 
Jon
now this can be done as a single statement using LINQ
you don't need a database
 
ok
 
Jon
1:03 AM
you can do it all in-memory with LINQ to objects
if you don't know LINQ, then you will have to write a lot of procedural code
but the idea remains the same
 
How much memory would this take? If I work with one article at a time... would that same memory?
Unless you want to enlighten me with linq...
 
Jon
it will take as much memory as it needs to
if that might be a problem, do it in parts
 
Well I can't guess the clients pc...
anywho... so its like SQL for .net objects?
 
Jon
yes
 
so I can ammend my process from doing a list sort to sorting on the multijion ... like I was afraid I'd have to... but much simpler by using LINQ
 
Jon
1:06 AM
anyway this is probably the wrong room for this discussion :)
 
Ah... one sec, let me try this out... I'll get back to ya.
The other room has been silent for days...
Psst... jon, why not answer the SO question to get the rep...?
 
stackoverflow.com/questions/8460841/… This is no longer of any relevance
 
Am I wasting my time by answering old, unanswered questions?
 
Jon
voted
 
@Ozbekov Probably, they are unanswered for a reason
Either the question is bad (highly probable) or the answer is hard (highly unprobable)
 
1:11 AM
@NikiC Not really - no one seems to find an answer, I did.
Well, the questions were mediocre :-P
 
Or the last option: Nobody cares about the question ;)
night now
it's 2:13 am :(
 
@NikiC See ya.
 
Jon
@NikiC: 3:15 here now... time for a tea :)
 
Dim bestCat As ArticleCategory = (From cat In Categories
Order By cat.tempCount Descending
Select cat
Take 1)
Unable to cast object of type '<TakeIterator>d__3a`1[RssImport.ArticleCategory]' to type 'RssImport.ArticleCategory'.
I suppose I'm not as smart as I thought I was...
 
Jon
@Justin: Lose the Take and just use First
 
1:21 AM
where do I put first?
It's not accepting the keyword
@jon It looks like the first keyword never made it to this implementation so I've got this to work: Dim bestCat As ArticleCategory = (From cat In Categories
Order By cat.tempCount Descending, cat.Name
Select cat
Take 1).ToList()(0) thanks by the way
 
Jon
@Justin: I 'm not familiar with VB syntax
all I can tell you is that it will not go inside the parens because that's writing LINQ query-style
 
IE I've converted it to a list and took the first object (the only object returned by the query)
 
Jon
while First is only available in method-style
 
oh
 
Jon
that will work but it's unnecessarily wasteful
 
1:27 AM
the first isn't recognized as a keyword with or without parenthesis....
 
Jon
you figure out how to call it :)
 
I found this (From cat In Categories
Order By cat.tempCount Descending, cat.Name
Select cat
Take 1).First
 
Jon
It needs to be called man, it's a method
.First()
 
Not showing up in intellisense, maybe I'm using a diffrent verison of linq?
 
Jon
you need to import (isn't that how it's called in VB?) the System.Linq namespace
the documentation can answer much more than I can, and it also has examples
 
1:32 AM
@NikiC done :)
 
Jon
crap
Just came across a book I want, and it's not available in dead tree format from amazon.co.uk -- although amazon.com does have it
any suggestions?
 
contact the publishing house
Or read some other book in the meanwhile ;)
 
posted on December 17, 2011 by PHP Advent

PHP was originally designed for web sites and is still widely thought of only as a programming language for the Web. But with the approaches below and a variety of useful console libraries, PHP works great for command line scripts, too. At Etsy, we have a variety of command line utilities that are all written in PHP. Having our web site and command line utilities in the same language means ea

 
Jon
I 'm gearing up for the next order of tech books worthwhile to have on the bookshelf... grrr wanted that one
publisher's site says out of stock, not surprising
 
1:54 AM
fuck , i broke my mouse .. again
 
@tereško You use a mouse ?
turn to a vim person and you will never need it !
 
i do , it is really good for shooting virtual people
 
Oh, that is the main reason of using one I reckon.
MW or BF ?
 
neither
 
then ?
 
1:58 AM
got into Tribes beta
anyway , broke my mouse , the string in left button is fucked
thats what you get for buying 20$ rodent
 
and that is why I use external keyboard and mouse when playing games
 
there is no such thing as "internal mouse"
anyway , now the damned left button is not clickable .. instead it is "touch-sensitive"
 
external as in contrast with built-in.
there is no internal keyboard either.
 
where is no such thing as "built-in mouse"
there is touchpad and then there is that "IBM nipple-in-the-middle-of-keyboard thing"
but no build-in mice
 
Is there a lean way to find out if a PHP file has the ending ?> or not?
 
2:06 AM
@tereško not in the correct terms, but generally people use Mouse as in pointing device.
@hakre in the file itself or outside ?
 
have you tried to aim with touchpad ?
 
From within PHP, loading in the file as string.
 
@hakre , opening file & looking usually helps
 
@tereško Sure, but how?
 
with eyes
 
2:08 AM
LOL, I need this in a program
 
why ?
 
like this: $xml = '<root>'.file_get_contents('file.php').'</root>';`
If the closing ?> is missing, the XML is broken.
I normally leave them out so I just want to fix while building the string quickly.
 
well, then let it break
 
@tereško I did, but it's hard to start from middle of the track pad but your rather start toward the corners based on where the target is on the screen and then you run out of the touchpad land and get kill before you start another attempt.
@hakre why would you use a '?>' tag in XML ?
 
@tereško I'll do for the moment, but maybe someone has a quick idea how to do that nicely.
@OmeidHerat end of processing instruction.
 
2:11 AM
@OmeidHerat <?xml ?>
 
but that is not end of file.
 
I'm currently wrapping that partial include thingy into a stream wrapper right now.
 
@tereško Get one of these:
 
XPath allows to handle PHP files as XML
So you can select parts out of it via include()
if you use xhtml inside the template files.
 
2:14 AM
@OmeidHerat what is that an old mouse?
 
when the end ?> is missing the last PHP code block is an incomplete XML processing instruction.
 
Yes, not only old but also Russian. that means none-break-able.
 
<root><?php echo "hello world"; ?></root> is just valid XML.
but <root><?php echo "hello world";</root> is not.
 
its a fatal error in php
 
if the PHP has closing tags, it works just fine.
 
2:16 AM
@hakre There shouldn't be problem with parsing the XML.
 
the error is the parser can't find its end tag... thus explosion
 
Warning: DOMDocument::loadXML(): ParsePI: PI php never end ... in Entity, line:
4
that's with the missing end tag of the processing instruction (PI)
it does work if it's there.
usage: include('inc://include.php?id=divtagid');
stream wrapper are really cool.
 
whats a stream wrapper?
and wahts the "inc://"
 
that's it ;)
you can tell which protocol should be handled by what.
 
oh ok
 
2:21 AM
you create a stream wrapper class that does the handling
 
then whats the inc:// protocol
 
then you register it for a protocol
 
why
 
whatever you define.
require ('IncludeWrapper.php');
stream_wrapper_register('inc', 'IncludeWrapper');
include('inc://include.php?id=divtagid');
 
Whats the purpose of doing that as opposed to just require('includeWrapper.php');
 
2:22 AM
That IncludeWrapper takes a php include file and you can select a part of it by it's XHTML id attribute
so you can include part of php templates in this case.
1
Q: Can PHP include work for only a specified portion of a file?

MontyI have a PHP include that inserts an html form into another html form. When the form gets included I now have two form headers. Is there a php tag I could use that would allow me to... <form id="orderform"> <!-- <?php for the include FROM here?> --> PROD:<input class="Prod...

in this case, the stream wrapper is a pre-processor before php's include function get's the code.
@Justin the require statement is only in there to load the stream wrapper class: IncludeWrapper.
class IncludeWrapper
{
	private $url;
	private $path;
	private $query;

	private $file;
	private $buffer;

	public function stream_open($path, $mode, $options, &$opened_path)
	{
		$useIncludePath = $mode & STREAM_USE_PATH;
		$this->setUrl($path, $useIncludePath);
		$useIncludePath && $opened_path = $this->file;
		$this->open($this->file);
		$this->query($this->query);
		return FALSE !== $this->file;
	}
	public function stream_stat()
	{
		return stat($this->file);
	}
	public function stream_eof()
 
Jon
@hakre: what exactly you have in mind with this stream wrapper (I assume this is the one you mentioned earlier)?
 
You see the linked question?
I placed an answer there.
It contains mock-up code.
 
Jon
yup, I read that
 
I wanted to write a poc if that works
then I thought, hey let's checkout a stream wrapper for that.
I never did that before from scratch, so played around with it.
And finally, that's it.
 
Jon
I have something in mind so I wanted to see how far ahead you 've thought it out
alright
you know what would be cool?
 
2:30 AM
It actually works.
tell me what's hot.
 
Jon
make it so that you can specify which part of the file to pull in with inline xpath ^^
or part(s) possibly
 
Sure, no deal, this is already in, see ::applyXPath().
How should the query parameter be named? xpath ?
 
Jon
hmmm
what about this
include('inc://xpath@include.php?q=[something]');
and can add more query types in the future, and you keep the q= syntax for everything
 
I thought about that first, too.
 
Jon
or even
 
2:34 AM
The @ thingy
 
Jon
inc://xpath:[something]@include.php
 
but parse_urlis not very comfortable for that because of the host part.
 
or maybe include('inc://include.php;xpQuery=SomeQueryehere');
 
so this class prefers things to have in the query-info part and I think that's cool.
 
Jon
yeah definitely cool
 
2:35 AM
::$query is an array with the query-info part of the URL.
it's processed by ::query already which delegates to the ::applyXYZ() methods.
I'll add xpath with xpquery so.
let me test
 
@hakre Thats a neat little trick
 
PHP doesn't like such URLs: inc://include.php?xpquery=//*[@id="divtagid"]
 
Jon
it's very neat definitely
 
blocks it.
 
another: include('inc://include.php&xpQuery=SomeQueryehere');
 
Jon
2:39 AM
the only downside is that it's not little
 
you need to urlencode the query-info
 
Jon
hmm logical
 
include('inc://include.php?xpquery='.urlencode('//*[@id="divtagid"]')); does it
works like a charm
I'll keep it in.
 
Jon
typical php
 
@hakre don't use the ? its confusing with passing the the xpquery to include.php instead of the inc stream.
 
Jon
2:40 AM
can work wonders but forces you to write it awkwardly :/
 
I would rather go with a ; or maybe &
 
Jon
what about something like
 
@OmeidHerat Well the pattern is manifested with the URL standard. I don't see any problem with that.
 
Jon
include('inc://include.php/xpath/SomeQueryehere');
that would probably not fly either
 
@hakre that is the thing, it should be same as URL standard. because you are passing the query to the stream not the script.
 
2:42 AM
@Jon won't work. Imagine the xpath expression: //*[@id="divtagid"]
@OmeidHerat The URL is a string interface to the resource and it's parameters.
the query-info part goes into the wrapper, the resource is fetched, the query applied and the include will get the result.
hmm, would be cool to convert to plain text with xpath.
so you have HTML and plain text templates in one.
 
@hakre Nope, its not a URL standard thing.
RFC-1738 leaves the <url-path> open.
    url-path
        The rest of the locator consists of data specific to the
        scheme, and is known as the "url-path". It supplies the
        details of how the specified resource can be accessed. Note
        that the "/" between the host (or port) and the url-path is
        NOT part of the url-path.

   The url-path syntax depends on the scheme being used, as does the
   manner in which it is interpreted.
 
Jon
@hakre: would that be useful? plain text templates would need to be whitespace-preserving
 
I'd imagine that cheap thievery.... lol You could have php write php files to use immanently if that was the case. Which is a trade secret... btw.
 
@OmeidHerat I was more referring to HTTP URI. Don't know the RFC from mind, but it's the most popular one.
and the one scheme that PHP supports more specifically.
 
That RFC2616 for HTTP1.1
 http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
 
2:52 AM
the wrapper tweaks it a bit around the host / abs_path part.
 
Jon
@hakre Omeid has a point there
 
and that is my problem. your stream scheme shouldn't be same as other standard stream.
 
I'm not totally confident with that.
 
Jon
since not all URL wrappers use the same syntax
is it OK for PHP to disallow something to begin with?
I 'm prototyping a bit to find out
 
you can basically use anything that goes: [scheme] "://" [rest]
the wrapper get's the whole URL
including scheme
 
Jon
2:54 AM
yup, so you just need to get rid of parse_url
and then anything can work
 
sure, basically, that's it.
 
the point of Standard is to avoid confusion, if I look at something like include('inc://file.php?q=test') it automatically gives me the idea of q=test being passed to file.php which is not the case with your inc stream.
 
Jon
I 'd definitely go that way then
 
but what PHP doesn't accept is if there is a ? in [rest] it expects something urlencoded.
 
Jon
PHP doesn't accept it?
 
2:56 AM
jup, I get an error before the wrapper comes to play
 
Jon
I don't
e.g. with
include('inc://sample.xml?xpath://*[@id="foo"]');
 
Warning: include(): Failed opening 'inc://...@id="foo"]' for inclusion
 
Jon
that's after your code kicks in
 
that's the error I get
 
Jon
I have a print_r inside parseUrl
and it prints before the warning
 
2:58 AM
let me test if it's because parse_url returns NULL or FALSE
 
Jon
so what I was thinking is
scrap parse_url and use a quick preg_match for my preferred syntax as a POC
 
array(4) {
  ["scheme"]=>
  string(3) "inc"
  ["host"]=>
  string(16) "sample.xml?xpath"
  ["path"]=>
  string(14) "//*[@id="foo"]"
  ["query"]=>
  string(0) ""
}
parse url eats it
no problem with that.
the problem is that the path is build wrong from it.
so PHP accepts it.
so any suggestions for the URL syntax?
 

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