« first day (121 days earlier)      last day (4826 days later) » 

12:45 AM
@KennyCason: no idea... sorry
 
 
8 hours later…
8:32 AM
hi friends..
 
hi
 
0
A: Unit testing accessors (getters and setters)

edorianGood Question, i usually try not to test getters&setters directly since i see a greater benefit in testing only the methods that actually do something. Especially when not using TDD this has the added benefit of showing me setters that i don't use in my unittests showing me that ether my t...

unsure
 
8:54 AM
Wooo posting my template generator on smashing magazine FB page was a good idea :)
 
@edorian fine answer. I tend to test the getters and setters separately. It's superfluous when they are covered elsewhere but I like to be complete, even if it was just for agile documentation
 
@Gordon testdox or what do you mean with agile documentation in that case ? :)
@Shikiryu the stats page looking nicely now ?
 
everyone likes jquery
 
yep that's the conclusion.
 
9:07 AM
@edorian yes. testdox
 
Do you use that for anything else than looking at it ?
(e.g. docs, reports, something) interesting
 
not yet
i might should we ever get a CI server at the project though
a man can still dream
 
9:19 AM
dreaming about atlassian
:)
 
good morning
 
morning greg
 
9:38 AM
not looking forward to this week... gonna be busy!
 
busy as in "stuff I don't really want to do" i assume ?
 
there's always lots of stuff I don't really want to do, but this week there's also loads of stuff I want to do, but the other stuff is in the way :D
 
hehe, yeah. that sounds familiar :)
 
10:08 AM
@Gordon hi
@e
@edorian hi
 
hi
 
10:31 AM
@go
@Gordon hi
i have one problem html doms using php
any one can help me?
 
@JamesPHP what's your problem?
by the way James, if you press the up arrow, you can correct your last message - like this
 
@Greg thanku
@Greg in doms parsing i am getting one string .
in this string special charters add
how to remove .
 
have you got a test case?
i.e. codepad.org?
 
@Greg this is my string.
$a="Delivered\r\n\t\t\t\t\t\r\n\t\t\t\t01/28/2011";
how to remove
 
this is not DOM related
 
10:38 AM
@JamesPHP to remove certain characters from a string you can use a regular expression, or if you don't want to get your head around them you can use str_replace
 
i am doing dom.getting this string man
 
è_ê
 
@JamesPHP $a = str_replace(array("\r", "\n", "\t"), "", $a);
 
str_replace ?
 
that's what I said
 
10:40 AM
no!
 
ok
i will try
 
but james, please paste a test case onto codepad.org in future.
 
ok
$a=str_replace(array("\r", "\n", "\t"), "", $a);
but i want
$b="Delivered@01/28/2011";
this
i am doing now
@Greg hello
 
@JamesPHP hi :)
 
@JamesPHP you can figure this out yourself
the second argument is the replacement character
so instead of '' you pass in … ?
 
10:46 AM
@Greg yes how to replace
 
@JamesPHP people here love to help other developers out, but don't like spoon-feeding
27
@JamesPHP please paste your best attempt to codepad.org
 
@Greg ok
 
if you want to become a developer you have to learn how to read APIs
 
ok
 
11:20 AM
usually, when learning a language, going to the effort of writing a test case in something like codepad answers the question for you. The process of breaking down your question into modular problems makes you think more laterally about your problem.
Rubber duck debugging, Rubber Ducking, or the Rubber Duckie Test is an informal term used in software engineering to refer to a method of debugging code. The name is a reference to an apocryphal story in which an unnamed expert programmer would keep a rubber duck by his desk at all times, and debug his code by forcing himself to explain it, line-by-line, to the duck. The process is to meticulously explain code to an inanimate object, such as a rubber duck. It is expected that when the programmer comes across a piece of code that is incorrect, they will realize this Similar terms *Cardbo...
 
didn't know the prase, nice
 
didnt know the practice either. Will adopt it to PHP by telling it to ElePHPant
ElePHPant debugging
 
hey
i know this if offtopic anyone knows a link to get an programable usb button?
 
what's a programmable usb button?
 
like a normal ugly button you click on, and that you click it should do something that you have programmed it to do
 
11:35 AM
I use autohotkey.com and a F[1-12] button for all my macro needs
never spoken to external usb input devices, no clue there
 
you might find something like this at thinkgeek.com
 
@Karem yeah just use autohotkey.com and set it to trigger on the scan code of the usb button
 
so making the button pressing a f12 and then program f12 to do something ?
 
@Karem if you have the capability to change the key it is associated with - it may simply send its own scan code, which autohotkey can be programmed to match
 
11:39 AM
@Greg hmm thats what i dont know any link for a good button that have its own key, i only managed to find some usb buttons that opens a website and stuff -.-
too expensive and not what im after @gordon
 
oh i see
you could make your own?
 
@greg rather not im planning to give this button out to around 50 others
 
take apart an old keyboard, cut up the circuit board but preserving the pause/break key (nobody uses that)
aha ok
 
:P
 
@Greg hi
@Greg wt is the best method for doms using php
 
11:50 AM
sigh can i closevote questions in the chat, too?
@JamesPHP you realize that your question doesnt make sense, do you?
wt is not a word
what is "doms" supposed to mean? Plural of DOM? And what do you mean by "best method". Best method for what?
 
@JamesPHP probably PHP Dom. But your question is extremely ambiguous.
 
@Gordon best method for doms
 
ahh, that clarifies it.
 
yeah totally sigh
 
@Greg best method
 
11:55 AM
sigh
 
@JamesPHP the best method for doms is getElementsByTagName()
it's best used in combination with $framework->readMyMind and $framework->doWhatIWant()
 
@Gordon you know now you're going to get @mention spammed now
 
@Gordon can you any example for that
can you tell me any example for that
 
Sure
 
ok
 
11:59 AM
$framework = new WonderFramework('unicorn');
$doms = $framework->doWhatIWant(
    $framework->readMyMind()
);
print $doms->getElementsByTagName(42);
4
 
what is unicorn here
 
magic parameter name
 
@JamesPHP like magic methods, its magic param
@JamesPHP you can access it with __autounicorn() too for greater performance
 
i have one html page.how to parse
 
i love php
 
@greg true written
 
i am using same but i need same help
in that
 
@JamesPHP ohhhhh.... why didn't you say so?
the same framework is really easy to parse html with
 
@JamesPHP out of curiosity.. what is your native language?
 
ok sorry
 
12:10 PM
@JamesPHP where are you from actually? Maybe someone in the chat comes from the same country. You could open a chat room for you two then so you can speak in your native language. Might make things easier.
Oh, and sorry for making fun of you. Wasn't fair if english isnt your native language.
 
12:25 PM
Morning lads
 
@JakobBowyer good afternoon
 
How are you doing todaY?
 
very busy...
nothing that a large dose of caffeine can't fix!
 
Mmmm Im writing my ict coursework -_-
 
what level? school/university?
 
12:29 PM
School (UK system)
Id rather be programming
 
You get taught PHP at school? wow, wish I did.
 
No I was never taught php
I don't even know it
I come here for the conversation
 
@JakobBowyer aha!
 
Im a python fan
 
what programming languages do you know?
 
12:32 PM
python, C, bash, learning js, learning java, learning some other stuff too
python is my strongest
 
@JakobBowyer if you're learning, I'd suggest sticking with one of those languages until you're a ninja at it
then you'll be able to learn any other language within minutes
 
Im pritty ninja with python
 
great :)
 
Problem is I dont really have the time for learning comp sci stuff because the school drains my personal time
 
@JakobBowyer you'll have to get the uberman sleep schedule so you can learn at night
 
12:38 PM
Im trying to :P
Its hard
I truely hate my ICT course
its pathetic
 
are you writing a website in ms word?
 
No
worse
Investigate the role and contribution of communication technology to business
 
:|
 
I want to stab people -_-
 
1:04 PM
-1
Q: remove double quotes around "function() { ... }"

BMMHi All, Brain not working today - can anyone give me a regexp that would turn: {events:{click:"function() { alert('hi'); }"}}}}} into: {events:{click:function() { alert('hi'); }}}}}} any any other instances such as this in a string.

sigh
 
Why the sigh?
 
look at the question. you'll understand :)
 
It is a foolish question
` $string = str_replace('"', "", $string); ` in php
` ' {events:{click:"function() { alert('hi'); }"}}}}}'.replace('"','') ` in python
:O it didnt code it
 
I like to think there is no foolish questions. Everyone had to start somewhere once. But it's the laziness that makes me sigh
 
@Gordon Why didn't it codetag wrap my snippits
 
1:12 PM
dunno
out for lunch
 
@JakobBowyer Maybe because of spaces between backtick and code (only a guess)
 
@Shikiryu Dont think so
print("heyworld")
Nh now it works
 
$string = str_replace('"', "", $string);
yeah weird.
 
Oh well....
Someone do my work for me?
 
1:34 PM
Sure. If you do mine ;)
 
Whats yours
 
what's your work, guys? ;)
 
I have ICT Coursework to do.
:(
 
I need to make some batches in Java.
 
@Shikiryu: do it in groovy - it's compiled to java bytecode and it will be much easier this way (or any bytecode supported platform - jruby, jpython, etc.)
 
1:40 PM
Unfortunatly, I can't.
 
@JakobBowyer: :-(
@Shikiryu: why? - you can always link groovy library and embed groovy code directly to java class
 
Because it's on an already existant Java project which is very restrictive. Plus, I can't really chose my tools here :(
 
yes you can :-) I don't like java as much as I did before but this was very common thing to use groovy for scripting (and seamlessly integrate with existing app)
 
Yeah, but again, I can't choose what to use here. I can make a proposition for it but it needs to be integrated and fully understand by all developpers here (they got their habits); So I won't lose my time with that.
 
@Shikiryu: any java code is valid in groovy - there is no need to completely understand it...

well - it's your decision :-)
 
1:48 PM
@Gordon Absolutely brilliant! +1 internets to you...
 
Yeah, plus I don't see the point of embedding a library for just batches.
 
Back
 
@Shikiryu: ok, ok, I'm just saying that when I was employed last time we were using groovy for all batches...
 
My internet cuts out every 9.5 minutes
 
@JakobBowyer That's a nice precision.
 
1:51 PM
its a automated system
its security
 
@JakobBowyer: so 9.5 minute is considered to be secure? :-)
 
Yea means you only get 9.5 minutes to wreck everything before your thrown off -_- (I hate my school)
 
Someone could do quite a bit with 9.5 minutes...
 
1:57 PM
:( sigh
 
Especially hijack wifi sessions since they are forced to reconnect every few 9.5 minutes. SO it would be trivial to bomb the schools router so it drops out and setup your own. Boom, instant MITM attack facilitated by the inept security policies of the school...
 
@ircmaxell dude, just do a root bridge attack.
plug a home router into a network and watch everything crash
 
lol
 
Im not joking
Because home routers are set to be the route bridge in stp, they crash everything when you slap them onto enterprise netowkrs
 
2:18 PM
Everyone has died now
 
nope
 
yes.
 
Yay I got started
:D:D
 
lol
 
I love being recognised
recognised*
 
2:29 PM
lol
 
heh :)
Almost finished one Assesment objective for the ict -_-
 
0
A: Using if(!empty) with multiple variables PHP

awmSave yourself some typing and put it into a loop... foreach ($varname in array('vFoo','vSomeValue','vAnother')) { if (!empty($$varname)) $result .= '<li>'.$$varname.'</li>'; }

(puke)
+2 more from bronze in Security!
 
Why create multiple variables and not a container?
 
@Gordon has James been back?
 
@Greg not lately
 
2:52 PM
have you noticed how many websites does have xsrf-vulnerable logout action?
and some of them also allows custom imgs to be placed... :-/
 
?
 
Well, the question I'd ask, is what's critical about logout that needs protection from csrf?
 
@Shikiryu: <img src="http://current_server/logout">
imagine that in some kind of forum or avatars in comments...
 
Oh, that.
 
Fair enough
 
2:55 PM
@ircmaxell: it's sad :-/
 
A lot is sad
 
what's the most? :-)
 
The weather.
 
agree :/
 
I love iterators
0
A: Bulk Rename Files in a Folder - PHP

ircmaxellWell, using iterators: class SKUFilterIterator extends FilterIterator { public function accept() { if (!parent::current()->isFile()) return false; $name = parent::current()->getFilename(); return strpos($name, 'SKU#') !== false; } } $it = new SkuFilterIterat...

 
3:17 PM
back
 
shorter*
 
@Shikiryu: IMHO shorter & faster & simplier & more readable -> better :-)
 
I agree on simplier and shorter.
 
shorter, yes. Faster, yes. more readable, perhaps. More correct, I think not, since you can have directories that get renamed...
 
3:23 PM
@ircmaxell: corrected... (thx)
 
And there goes your more readable claim :-P
 
@ircmaxell: for me, it is - I consider func-approach for filtering as more readable
 
instead of foreach you can use array_map and a lambda
that would be even more functional
 
@Gordon: you're right - but without PHP5.3 you can use only create_function which is ... :-/ (BTW: it can cause OutOfMemory if you call create_function in a loop :-))
 
5.2 is officially dead though
 
3:29 PM
Added a GlobIterator solution
 
@Gordon: some clients still have 5.2 :-/
 
Sorry for steering the subject, but does anyone have experience writing C extension modules for php?
 
@ircmaxell: btw: my version could be easily executed from command-line - your one would be little trickier :-)
 
4
Q: where can i learn php internals, how they work ?

Adam Ramadhanis there a good link to start learning the internals of php ? a video like http://www.youtube.com/watch?v=E_kZDvwofHY&feature=youtu.be&a ? ( python ) or anything, pdf, books, link that can i start ? to learn from the very root how php work. i google, and shamely olny have found a mailing ...

@FooBah tag has some Q&A for extension writing
@ircmaxell @KamilTomšík I wonder if one could make preg_replace use streamwrapper::rename and do the renaming in one function call
 
@Gordon: I guess it could be accomplished using array_walk
 
3:34 PM
Fair enough
 
@Gordon so for python there's a tool from the boost framework that lets you quickly lift C++ structs and methods. Is there an equivalent for php?
 
@Gordon, not without implementing the full stream wrapper IIRC...
 
@FooBah i dunno. sorry. cant code c
@ircmaxell would be interesting to have that. kinda like a PHP sed
 
@Gordon: there was a project that reimplemented all std unix utilities using php (to be really portable - without need for compiling C code which is of course as much portable as possible)
 
preg_replace_callback should work for renaming the files too
 
3:42 PM
yeah...
 
@Gordon: as well as 'e' modifier in preg_replace itself :-)
 
I looked at stream wrappers, contexts, etc and couldn't find anything simple to implement
 
im sure there was a glob stream context
but it doesnt support rename
actually I am wondering what it supports at all :)
 
looping... :-D
aka directory calls
Yay, there's the security bronze (well, there will be tonight when the next refresh cycle runs)
 
3:59 PM
@ircmaxell: you're welcome ;)
 
@Kaml do you have link to the project?
 
hehehe, thanks
 
i got the [badge:mvc] recently
 
@FooBah: which one?
 
pah.. they should implement that
 

« first day (121 days earlier)      last day (4826 days later) »