« first day (155 days earlier)      last day (4786 days later) » 

8:14 AM
hello
 
8:40 AM
It's late... I don't know why I felt compelled to answer that question.
Other than that, it is late.
 
 
4 hours later…
1:00 PM
lol
 
1:10 PM
What does FilesystemIterator::CURRENT_MODE_MASK do?
The current element will var_dump:
object(FilesystemIterator)#1 (4) {
  ["pathName":"SplFileInfo":private]=>
  string(14) ".\dom.markdown"
  ["fileName":"SplFileInfo":private]=>
  string(12) "dom.markdown"
  ["glob":"DirectoryIterator":private]=>
  bool(false)
  ["subPathName":"RecursiveDirectoryIterator":private]=>
  string(0) ""
}
But I fail to make sense of it
Seems to be the same as FilesystemIterator::CURRENT_AS_SELF
 
hrm...
 
Let's ask @salathe :)
> Masks FilesystemIterator::current()
isnt too descriptive either
 
yeah
 
kinda like in rambo 3
what's this? blue light. What does it do? shining blue.
 
lol
seems like it has something to do with permissions
 
1:15 PM
does it give a different result on linux over just the default settings?
 
I'm looking at the source
ahhh
I see now
#define SPL_FILE_OBJECT_DROP_NEW_LINE      0x00000001 /* drop new lines */
#define SPL_FILE_OBJECT_READ_AHEAD         0x00000002 /* read on rewind/next */
#define SPL_FILE_OBJECT_SKIP_EMPTY         0x00000006 /* skip empty lines */
#define SPL_FILE_OBJECT_READ_CSV           0x00000008 /* read via fgetcsv */
#define SPL_FILE_OBJECT_MASK               0x0000000F /* read via fgetcsv */

#define SPL_FILE_DIR_CURRENT_AS_FILEINFO   0x00000000 /* make RecursiveDirectoryTree::current() return SplFileInfo */
Basically, it's the mask for derermining the flgas
so $flags = $it->getFlags();
$objectOptions = $flags & FilesystemIterator::OBJECT_MASK;
$currentOptions = $flags & FilesystemIterator::CURRENT_MASK;
$keyOptions = $flags & FilesystemIterator::KEY_MASK;
Makes sense, but I'm not really sure if it should be public or not...
 
ummmm
not sure I get that
 
Ok, so you have 4 types of options stored in the same variable
Object, Current, Key and Other
The masks allow you to isolate the options for one type
only really useful for switches and the like since bitwise operations don't care
 
1:32 PM
can you give a practical example please?
$iterator = new FilesystemIterator('.',
    FilesystemIterator::KEY_AS_PATHNAME |
    FilesystemIterator::CURRENT_MODE_MASK |
    FilesystemIterator::SKIP_DOTS
);
foreach ($iterator as $fileSystemObject) {
    var_dump( $fileSystemObject );
}
 
It's not used in setting the constants
But
$flags = $iterator->getFlags(); from your instantiation
$key = $flags & FilesystemIterator::KEY_MASK; would give $key === FilesystemIterator::KEY_AS_PATHNAME;
In reality, I'm sure it should be exposed as a public constant
 
i guess im too dumb to understand what thats used for
 
it's not used for anything external
 
So, it's not used in the ctor for $flags?
 
AHHH
I see why
SplFileObject uses some of the constants (only the object mask)
so since there's a setFlags method, it needs to distinguish between acceptable flags
so the class internally uses the mask to determine acceptible constants
 
1:45 PM
I still dont understand it, but thanks, I guess :)
<<< stupid
 
nah, the design isn't the brightest
 
2:08 PM
im gonna try FF4 RC2 now
 
nice
breakfast time here
later
 
laters
 
2:55 PM
 
interesting
 
Is it just me, or does this post really seem rather fubar and mis-construed: powertrip.co.za/blog/archives/…
 
3:12 PM
not sure. it's not like its wrong to keep those things outside the webroot
i remember i encountered a misconfigured webserver once that would send the raw php files and they included login to the db
 
Right
But Your server should never ever under any circumstances send raw PHP files anyway
So what benefit does putting it below the web root really have anyway
 
could happen by accident
 
No it can't if you've configured the server correctly (or I should say are using the proper server to begin with)
 
if ;)
 
3:16 PM
putting them outside the webroot eliminates the risk of that if
 
static-file.exclude-extensions = ('php')
 
i'm not argueing that the server should be configured correctly and such.
of course it should
 
fair enough
 
but if for any dumb reason it isnt. someone makes a mistake and you got a high profile site
just imagine it would happen on facebook for just one tiny second
 
fair enough. But I don't like how the post sounds. Makes it seem like it's actually more secure...
 
3:18 PM
it is more secure, but I agree that the post fails to point out proper details and scenarios
 
Well, it's not more secure inherently. It adds a small layer of protection in a very narrow situation...
 
yeah
 
Not saying it's not worth it, but it makes it sound like if you don't you're wide open to attack
 
agreed
 
Hrm, now to decide if I want to write a follow up post
 
3:21 PM
i consider it good practise to not have your application files in the public webroot
 
I'd agree with that
 
It's just you
Well, that's what it says
 
Oo
 
I get an error page
Ahh, it looks like a nameserver problem
 
3:23 PM
weird
yeah, i figured that from error message
 
Nameserver trace for martinfowler.com:

Looking for who is responsible for root zone and followed m.root-servers.net.
Looking for who is responsible for com and followed k.gtld-servers.net.
Looking for who is responsible for martinfowler.com and followed ns01.thoughtworks.com.
Nameservers for martinfowler.com:

ns01.thoughtworks.com returned (SERVFAIL)
ns02.thoughtworks.com returned (SERVFAIL)
 
that site cant decide what it want
It's not just you! martinfowler.com looks down from here.
 
Now it's saying it's not just you
must have been a dns cache issue
 
anyway, back to the blog post
what do you want to answer to that?
 
Just thinking about making it explicit. Explaining the actual circumstances where it would actually make a difference...
 
3:27 PM
as long as you add that it's good practise :)
 
And pointing out that it's in no way critical to security (that it's just an added layer of protection in case something else fails)
 
even if the situation is slim, I think it's very little effort to do that
 
Very true
 
so people should do it
 
There's lots of low-effort things people should do. but they don't
 
3:29 PM
that's not a reason not to tell them to do
 
I know, but what about session.use_only_cookies = true dirt simple, yet not a lot do it
 
i guess the only thing im concerned about an answer to that blog post is that people could get the impression it's not worth it
 
Fair enough
 
Hello folks
 
sup
 
3:32 PM
hi
 
But I don't think it's a mistake to leave your config inside of your web-root.. It may not be best-practice, but it's not as bad as a mistake either
 
Is url like: server.com/index.php?PART=/topic/view/12 Seo-freindly?
 
@ircmaxell fair enough
 
the SEO is a lie
 
server.com/topic/12 would be nicer imo
 
3:34 PM
Yup but much servers have htacces blocked
And it dont looks o bad i think.
 
i wouldnt bother
 
im no seo expert but i would guess that the url format is more useful to people nowadays than to search engines
 
Buy anywat its better than: server.com/?d=topic&a=view&id=12
 
to people yes. i'd say google doesnt care
 
3:36 PM
Ok thanks
One more question about: REGEX (know, scary)
i have #[b](.*?)[/b]#si
And its translating empty string
Ive tried: #[b](.*?)+ .... (.*?){1} but it still dont works
 
PHP has a BB code parser extension de2.php.net/manual/en/book.bbcode.php
 
Know but its an example
 
for what?
 
I just dont want to translate empty strings
inside
 
you shouldnt be parsing bb code with regex
 
3:39 PM
I am not, its an example
 
then it's a bad example :)
 
Correct
 
I just ask how to make expression part that dotn accept empty or spaces
 
you want to match bsomethingb ?
 
And i think it was good example cuz its working like
look now its [b][b] = <b></b>
But its empty! If its empty i dont want to replace.
 
3:42 PM
@Robik the * means it can match "nothing", so don't use *
 
so should i use '.?'
 
if you want to match zero or one characters, sure
pesky edits
 
''(empty) = no, ' ' (only spaces) = no, 'true content' = yes
 
use + to match one or more of something
 
I know but where to insert that +?
Ive tried everywhere
 
3:43 PM
please don't guess at it!
 
go read a book or reference site on the subject
 
1. (.+) 2. (.?)+ 3. (.*+)
Which one? :D
oh and 4.(.*?){1,}
I never have been good in REGEX.
 
.+?, but that would match spaces
 
(.+?) ?
Taking empty.
I will read then that doc.
 
3:46 PM
Show your exact regex
 
#\#(.*?)\##si --- edited: #\#(.+?)\##si
 
That shouldn't match ##
and there's no need for the i modifier (case insensitive matching)
 
#a# - matching ## - matching too
I have tried (.+?), it dint work then i was adding it randomly
Then i came here
 
$ php -r 'var_dump(preg_match("#\#(.+?)\##si", "##"));'
int(0)
It doesn't match
 
BTW: It is good? #\n{2,}(.+?)\n{2,}#si
 
I want to check there is [newline][newline]content[newline][newline]
 
Well, you're matching anything between two sets of newlines
so "foo\n\nbar\nbaz\n\n" would match bar\nbaz
 
@salathe can you try to make me understand what FileSystemIterator::CURRENT_MODE_MASK is for? @ircmaxell already tried but I'm dumb today.
 
lol
 
Oh oh! I don't know there are Regex checker :D
Web-checkers
 
@Gordon it's probably not very practical in userland
 
thats what I understood so far :)
I understood its a public constant thats really an implementation detail that shouldnt be exposed at all
And I cannot do anything with it
 
if you want to get the current "current mode" you'd do $it->getFlags & ...CURRENT_MODE_MASK
 
Heck! Whats wrong with that?:#\n{2,}(.+?)\n{2,}#si
 
but for when it would be useful, I've not needed it yet
 
4:06 PM
This sh** above doesnt work right.
 
@Robik define "work right"
 
detect [newline]x2 cotnetn [newline]x2
 
ok, so because getFlags() returns the current mode for key, current and whatever, i have to put the mask constant to get only the set flag for key, current and whatever?
 
@Gordon Right
 
which means, there probably should be dedicated methods for that instead
like getCurrentKeyMode()
 
4:09 PM
Well, actually, since they are all just masked bitwise constants, you don't need to use the mask, you just need to do if ($mode & MODE_BLAH)
 
and it makes absolutely no sense to use that in the ctor, right?
 
just depends which you like most, individual getter methods or just &-ing the flags
 
Sorry its working, but there cant be any space betweet newlines - that sucks
 
well if ($mode & MODE_BLAH) is not as pretty as a dedicated method
 
Remember, flags are a very C way of doing things
dedicated methods are not really how c has been written over time
ok, battery running down, getting off now
later
 
4:11 PM
laters
 
@Robik then make the regex allow spaces betweet newlines
 
@salathe the docs are somewhat misleading regarding the options you can pass to ctors when it comes to iterators
 
misleading?
 
well, the description for $flags is
> Flags may be provided which will affect the behavior of some methods. A list of the flags can found under FilesystemIterator predefined constants.
 
ah, just unfinished
 
4:13 PM
@salathe Know :)
 
and that includes
FilesystemIterator::CURRENT_MODE_MASK

Masks FilesystemIterator::current()
 
I wish I had more time to dedicate to sitting down and properly fleshing out the docs
I feel bad pushing the SPL down people's throats when the docs still suck!
 
I remember I had a the same problem with RecursiveIteratorIterator
I never understood that RecursiveIteratorIterator::CATCH_GET_CHILD is really a flag and not a mode
 
heh
 
though the docs now say its not among mode
 
4:17 PM
Every time I sit down for the docs, I remember how utterly huge the task is and run away screaming. :P
 
catch get child catches when a subfolder is unreadable right?
for instance when using a recursivedirectoryiterator
 
yeah it catches and ignores any exceptions thrown when getting the children
so yep, for an RDI, when the folder is unreadable
 
that's great
because now i can delete
class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
{
    /**
     * Exception Catching Constructor to prevent unreadable paths
     *
     * @param	String	$path
     * @param	Integer	$flags
     */
    public function __construct($path, $flags = NULL)
    {
        try {
            parent::__construct($path, $flags);
        } catch(\UnexpectedValueException $e) {
            trigger_error(
                sprintf(
                    'Skipping Path %s with error: %s',
                    $path, $e->getMessage()
:)
 
:)
 
but I know what you mean with documenting that being a huge task
happy someone does it at all :)
i still think PHP could benefit from crowdfunding
 
4:24 PM
funding? we wouldn't know what to do with it if we got money!
 
well, you could hire some some full time devs or pay the money as bounties to most sought after features and stuff like that
 
my employers have said similar
they'd be happy to pay x amount for feature y to be implemented in PHP, Postgresql, etc.
 
that might motivate people to touch those parts of php that are ugly to touch as well
 
heh, for sure
 
not sure what it would do to the way php development is done now though. given that all of the core devs work for free on it, having full time devs might make some of the current devs to abandon php. wouldnt be good.
then again, maybe some of the current devs would like to be full time devs instead
 
 
1 hour later…
5:55 PM
1
A: Zend_Acl find all inherited roles

GordonYou can use getRoles() - Returns an array of registered roles. and then check each of these with inheritsRole() - Returns true if and only if $role inherits from $inherit See the API docs Zend_Acl at http://framework.zend.com/apidoc/core/Zend_Acl/Zend_Acl.html Alternative There actua...

who would have thought you can do straightforward things with Zend_Acl
 
6:13 PM
posted on March 20, 2011 by Stuart Herbert

Last month, I delivered my Beyond Frameworks talk at PHP UK 2011. The talk is all about the challenges that the framework-using members of the PHP community are going to face as major framework upgrades (such as Zend Framework 2 and Symfony 2) are released, and a clear strategy on what you can do to minimise these challenges in the future: build more components, don’t put all your eggs into t

 
6:56 PM
lol
 
ridiculous place. now im getting accused of repwhoring for offering a too low bounty
 
lol
 
yeah, at least he deleted his comment
 
he did? lol
 
7:04 PM
I don't see it
Hrm, $195 for the ZCE 5.3 exam...
 
yeah, apparently its gone
i have no doubt that you will pass ZCE exam
 
I'm debating challenging the CompTIA Security+ exam. And while I was looking at it, I thought if I do that, why not go ZCE
 
since you have no formal compsci degree id say go for it
thats one of the main reasons i took it
 
I don't have a CompSci degree
I have a Math degree
Ahhh, yeah
 
gonna watch some tv now
laters
 
7:07 PM
I was looking at a Security+ Training book at the book store earlier, and most of it is quite easy for me. So I figure with a week of studying I should be able to nail it
take it easy
Your PHP script is repeatedly parsing 50KB of data returned from a
remote web service into browser-readable HTML.

Users complain that the script takes a long time to run. Which of the
following measures usually leads to the best results? (Choose 2)
A: Install a bytecode cache
B: Install an SSD drive on the server
C: Cache the data returned by the web service locally
D: Upgrade to the latest version of PHP
Which would you think is correct
What is wrong with this XML document?

<?xml version="1.0" encoding="UTF-8" ?>
<node>
    <?var type="string" ?>
    <leaf>Value</leaf>
</node>
<?xml version="1.0" encoding="UTF-8" ?>
<node>
    <?var type="string" ?>
    <leaf>Value</leaf>
</node>
A: The encoding is only required for non-western languages
B: <?var is not a valid node type
C: <?var is missing a closing tag
D: Nothing
E: Not listed in the above would be the correct answer, since you can have only one <?xml declaration at the top of the file. The second one makes it invlaid...
So that's two wrong things in this practice review
Oh lord:
What is the name of the method that allows xpath expressions in
SimpleXML?
A: The is no such method
B: xPath
C: xpathExpression
D: xpath
 
7:37 PM
Hey, are you there?
 
how can i get motivation back to code.. i got stuck and every time i wish to code i think about it and get headache/ completly no self motivation to get started and then left it behind and dont get anything done..
havnt coded for like a week feels like a year..
just me getting period like this or is it normal
 
Just think about result.
 
7:56 PM
Escaping output may help protect from which common security
vulnerabilities? (Choose 2)


A: Clickjacking
B: Cross-Site Scripting
C: Cross-Ste Request Forgery
D: SQL Injection
Yet another wrong answer in the practice test
That's horrible...
All XSS vulnerabilities are automatically CSRF vulnerabilities. But how does escaping output protect against Sql Inection. Unless you consider sending SQL to be "output"
 
@ircmaxel Could you help me?
 
No, since I don't know your question
 
I just ask that you want or you can :D
 
As usual. Post your question, and if anyone can help, they will
 
My problem is that: i have that regex:<br[ ]/>\n[\t ]?<br[ ]/> and its not detecting <br />[enter][tab][space]<br />
 
8:06 PM
Don't parse HTML with regex
 
But its detecting <br />[enter][tab]<br />
Strrepalce dont take care of tabs spaces
i want to repalce to br's int oone
 
Secondly, the proper way to catch spaces in a regex is with \040
 
thanks !
 
8:58 PM
back
 

« first day (155 days earlier)      last day (4786 days later) »