« first day (257 days earlier)      last day (4696 days later) » 
00:00 - 13:0013:00 - 00:00

12:49 AM
anyone know which memcached pecl client version is compatible with php 5.1.6?
nevermind! I figured it out;
 
1:22 AM
Upgrade your php...
 
apparently memcache instead of memcached is what i need
 
1:43 AM
Sigh...
 
 
3 hours later…
4:22 AM
posted on June 30, 2011 by Larry Garfield

My article from the inaugural issue of Drupal Watchdog is now online. Design Patterns of Drupal is based on my original session from DrupalCon Paris. Although Drupal-centric, it serves as a great introduction to the concept of design patterns in general. If you're going to be at DrupalCon London, watch for Watchdog issue #2 in your swag bag! It looks like I may have as many as three artic

 
 
3 hours later…
6:56 AM
Heeee, first time enter chatting XD
 
any one
 
7:17 AM
@Raynos np.
cheers :)
 
7:41 AM
anyone know if there is a MongoDB chat yet or when there might be one.
 
@Sirwan if there is none at chat.stackoverflow.com then there is none. Rooms are community created. So it will be created when someone with enough reputation decides there should be one.
 
@Gordon, do you know the value of the privelege required to create a chatroom in here?
 
@SirwanQutbi nope, sorry.
 
I can create one for you if you want
 
7:55 AM
sure
quite suprised there isnt one actually
 
do you want one specifically for mongo or would noSQL be better? might attract more people
 
mongodb is pretty different to couchdb
ah you created it
 
given that there wasnt a room I guess its safest to make it broad topic, so couch, mongo, cassandra, hadoop, map reduce etc should be fine in there
 
@Gordon - Brace yourself for some code :P
 
yeah i guess your right @gordon, better discussions are when there are more topics to be included
thanks alot
 
8:01 AM
no problem. now its your task to drag people to it ;)
 
Remember Thursday I promised to write some code to show what I was talking about? Well, it's there and it works. Kind of.
 
looks like a simple version of what Zend_Form offers
 
You suggested I do as much JS output as possible instead of direct HTML, since most widgets contain as such.
 
@ChristianSciberras would you like to hear some complaints about it?
 
8:09 AM
I'm wondering whether I really need two methods for JS output or not.
@KamilTomšík - Sure, but not trivial ones.
 
@ChristianSciberras is "class FieldEmail extends Field" trivial one?
 
go on :)
Well, normally it would be FieldText extend Field and FieldEmail extend FieldText
 
you should inject those validations (as standalone objects) inside standalone field - possibly to even more types of fields (like textarea)
@ChristianSciberras nooo, I'm talking about that extends :)
 
Hmm, separating validation from field? I like :)
 
@ChristianSciberras cool, now sit down and hack it ;)
 
8:12 AM
@ChristianSciberras no i didnt. i said its more feasible to write complex components that require a lot of behavior completely in JavaScript instead of generating the JavaScript through PHP.
 
@Gordon - But eventually, the actual form could still be written in PHP?
Say, for example, you have something like:
js_make_form([{type:text,name:"name",value:"Your Name"},{type:text,name:"surname",value:"Your Surname"}]);
You could still make use of PHP to actually write that.
 
posted on June 30, 2011 by Lorna Mitchell

This week I've been using phpMyAdmin for what feels like the first time in years. I'm happier at the command line, but needed some graphical representation of information and easy ways to export example queries for the book I'm working on. I noticed that phpMyAdmin now has a Designer tab, which shows relationships between tables and allows you to define them. If your table types d

 
@ChristianSciberras could
but actually i could do lots of things
like i said GWT generates your entire frontend through a java api
and ive been told that works remarkably well
 
Question is, which one's best?
 
@Gordon I had a "pleasure" with GWT and... never again :)
 
8:18 AM
@Gordon .. and it is a lie
 
but then again, there also have been attempts at providing wrappers for ExtJS/Sencha in PHP and that project died afaik because its easier to write components directly in Ext/Sencha
@KamilTomšík @teresko :)
 
If I had to be honest, I've written form generation software before, for 3 different projects. Each had requirements that made the code specific to the project, and made code useless in other situations.
 
... mornings
 
Is converting errors to exceptions a good practice?
 
Hello @teresko
 
8:20 AM
@Gordon no offense, but it is always cool to hear "GWT rocks", "works remarkably well", however actual experience is usually not that cool.
 
@rickchristie - Sure, if you plan to go OOP style in your code
 
@ChristianSciberras if you want all purpose forms, use Zend_Form. its awkward to use but works for every form
@KamilTomšík i have no experience with it whatsoever, so no offense taken
 
Then again, @KamilTomšík, just because it doesn't have a feature you want doesn't make it bad. I'm saying so because I'm clueless of your experience with it.
 
@Gordon I'm not complaining about java/js compiler - it works well (and it's not from google, anyway), I'm complaining about any need for integration, that really sucks
 
@rickchristie afaik its what PHPUnit does to make errors catchable
3
 
8:22 AM
heh , i suspect that form generation scripts exist in same space as "perferct ORM" and unicorns
 
@teresko As does the whole concept of computers. We've been with 'em for years, and I don't see flying unicorns yet.
 
@Gordon and you have a point in there - everytime I did something in GWT, I was wondering: "OMG, I could do this in html+js 10 times faster and easier"
 
@Gordon @ChristianSciberras - I've read the example: php.net/manual/en/class.errorexception.php - but the first user note confuses me, which is correct?
> The class synopsis states that the error code ($code) is the 2nd argument, while the example code provides the error code ($errno) as the 3rd argument.
 
@ChristianSciberras , and what has any of this to do with "concept of computers" ?
 
@teresko Oh, Zend_Form really can do everything. It's a Composite. Element renderers are decoupled, so is filters and validators. It's just a pain to use because its so complicated to glue it all together.
 
8:24 AM
@ChristianSciberras no, it does have features, but it's overcomplicated, it simply doesn't work
> Element renderers are decoupled, so is filters and validators. It's just a pain to use because of that.
yeah, doesn't sound familiar? templates... :-P
 
@KamilTomšík - I most definitely don't want to defend GWT since I haven't ever used it. May I ask you for a brief example of why?
@teresko - That reminded me, this form code is for general purpose forms. Ie, the 80-90% of forms we get. The rest, is still hand coded.
 
@Gordon , i haven't used it , is i cannot be sure , but i suspect that the whole thing becomes unusable when you start creating custom form controls
 
the doc is correct, $errno is level of the error raised, which means severity
 
@teresko - By the way, others have gotten this (form generation) right, so I can't see why it should fail in PHP.
 
@ChristianSciberras it is completely okay if you want to program html+js app - however you can do this 10 times faster with just html+js
and if you want to integrate app with some J2EE code - it's 1. slow (in the sense of build process) and 2. indirected. It's pain to get it working with IDE and if you prefer gvim it's even more pain.
 
8:29 AM
@KamilTomšík Then they must have done it wrong.
 
@ChristianSciberras sure :)
 
@ChristianSciberras without having seen those "other form generators", my assumption would be, they traded supporting almost any use-case for supporting their use-cases and simpler usage.
 
What I want to do is to stop writing <input type="xxx" name="yyy" id="yyy" value="zzz" {condition?checked:selected}/>
And, even better, make it automatically do zzz and the condition according to yyy matching a property of an object.
In the end, it could be as simple as; new TextField($user,'username');
 
@ChristianSciberras so? what's the problem?
 
There's no problem. I'm trying to determine the best approach to the problem without over-engineering it. (while asking the experts ;))
 
8:34 AM
@ChristianSciberras then forget about framework - write what you need. what fits your use-case and be happy. trying to "guess" is useless effort.
 
Not before I get my morning scoop of ice-cream :D. (brb)
 
but you're IMHO spending too much time in details - is it really important to "know" about form or fields? from high-level point of view, you usually want to request some data, according to passed validations and pass them to some handler.
something like: $ui->request_data($rules, $handler);
 
and validation is something you can achieve easily with a filterchain or even filter_input
 
@KamilTomšík - have you used Google Guice as a DIC before? I wanted to know what you think about provider classes.
 
@rickchristie no, but Guice is one of best DIC, we wanted to, providers are imho great concept
@rickchristie If I were choosing DIC, I'd consider Guice, NanoContainer and JBoss Seam (if JSF are expected)
Seam does injection in a different way - it's okay to inject private vars, without constructors or even setters, it's byte-code magic. However weird does it sound, it leads to less and more readable code - but you have to "teach" your co-workers about it.
 
8:44 AM
@KamilTomšík - I already have that in the works.
The codebase of form generation can change according to design, but it cant amount to none. :)
 
@ChristianSciberras so do not focus on new Field(xxx), it's implementation detail, focus on problem - retrieving valid data and handling them
 
That's already there. (retrieving data)
class Form($structure,$datasource) // <- signature
// two examples...
$form = new Form('contact.inc.php','SELECT * FROM contact WHERE user_id=5');
$form = new Form('SELECT * FROM forms WHERE form_id=2',$user);
 
WTF?!
 
Yeah, there should be appropriate data wrappers
But the idea is to simplify exchange as much as possible
 
no there shouldn't, it would be even worse...
what have I said? forget about forms...
 
8:54 AM
well, what's exactly wrong with it?
 
and forget about database too - or you'll experience hard day with non-db functionality. (you won't be able to use your "form")
 
@KamilTomšík Not at all. It's very similar to DI you see.
But as I said, the query should be wrapped in a FormStructureSqlAdapter or something.
 
@ChristianSciberras Let's say you want to implement simple account - withdraw(amount) ,deposit(amount) - that's your business logic, it's well readable, it clearly expresses intention. No forms, no database. Now imagine "magic" container. You'll move your account there and it will work as web application. It will provide forms, and it will persist everything to database. That is high-level approach.
I don't want to write "new Form(xxx)", or anything like that.
Because you can then come up with another "magic" container - which will transform your account to regular js-only app - with cookie-based persistence for example.
There are a lot of ways of expressing "interface" - REST, RPC, html+db, html+js, GUI, whatever
 
If you're doing these major changes, you'd have to swap the "magic" containers.
 
@ChristianSciberras yeah - you'll just swap them. that's it - no rewriting at all.
 
9:06 AM
I still can't see the problem, sorry.
 
doesn't matter, just implement what you want and if it fits your use-case it's good enough.
 
Uhm, ok :)
@KamilTomšík - How would you name methods, on_render() or render() (for a field element)?
 
get_field()
or render_field()
.. on_render is better suited for event name
 
@ChristianSciberras general rule - object is not about its data, but rather about what it is capable to do. which means - private vars for data, public methods for "orders". $field->renderHtml(), $field->renderJs(), $field->doWhateverElse, it always should be "verb"
 
@teresko $field->render_field() ?
 
9:13 AM
oh .. heh
 
Well, I'm ok with renderHtml()
since I'll also need a renderJs()
 
no you don't
your html should not contain javascript
 
@ChristianSciberras also - renderHtml, and renderJs is sign of duplication, missing indirection. $field->render() would be better (but it had to take care of both)
 
renderHtml() writes an <input/> and renderJs() binds the input's events
 
@KamilTomšík , can you give one good reason why one would add javascript in a html fragment for form field ?
 
9:15 AM
Having a single render() would mean having a script tag for each field being rendered. (which is bad, no?)
 
@teresko you've missinterpreted me - render() would have to take care of 1. rendering html 2. rendering js to some "temporary" js buffer, which would be served separately.
 
oh
 
Well, I suppose I could do it in the base class.
 
this explains the mention of GWT hour or so ago
 
function render(){
  $form->html[]=$this->renderHtml();
  $form->js[]=$this->renderJs();
}
 
9:17 AM
base class... oh my :-P
 
And renderHtml/Js would be abstract
 
oh yeah, more abstract methods, the better :-D
 
@KamilTomšík - Uhuh?
Well, if it's empty, it must be abstract XD
 
@ChristianSciberras what's the point of empty method? or abstract one?
 
To waste memory space? :P
 
9:19 AM
can you even test it?
 
Unless you replace the class.
 
it's useless, abstract methods are misplaced ones.
 
It's a developer aide.
Helps you know you have to fill in something.
 
it's kind of "I don't know where to put this method, so let's make it abstract and push it to base class - and document it with at least page long comment" method.
 
hey anybody plz tell me how can i use count and * at one query like this select COUNT(),
 
9:21 AM
@RockDance , could you be a bit more vague ?
 
@KamilTomšík - No, it's more like "if you don't fill in this method, your class can't/won't run."
 
this is where you use interfaces
 
@ChristianSciberras yeaaaah - I'm too lazy guys, this is just template, it doesn't work, but you can get it working, if ...
 
@KamilTomšík :D
 
@ChristianSciberras yeah, funny interpretation, but it's really sad to work like this.
 
9:23 AM
@teresko, @KamilTomšík I'd agree with using an interface, but an interface to define two methods to be used once in a base class?
What's the point of an interface that will be used only once?
 
It's more along the lines of "If I have a class of this type, I know it implements this method".
 
@ChristianSciberras forget about base class
 
@KamilTomšík No one asked for the philosophical concept behind abstract
 
@ChristianSciberras there isn't any - except of laziness...
 
The point is, if I do it as an interface, it can only be used once, in the topmost class. Child classes will automatically inherit the interface, hence it's useless.
 
9:25 AM
@ChristianSciberras interface is not a cure in here...
@ChristianSciberras why do you want base class?
 
If instead of a base class I wanted to use an interface, it won't work since the interface had to implement render(), but interfaces can't contain code.
The only realistic fix is mixins, which ain't supported.
 
@ChristianSciberras neither mixins :-P
 
@KamilTomšík - So that I can easily create new classes based on a "template"
 
@ChristianSciberras template based programming(TM) - implement this and that and possibly even that and it could eventually even work :-)
 
It's a valid way to relate things together.
Without a base class, I can't relate FieldA to FieldB, since interfaces aren't the solution either.
 
9:28 AM
@ChristianSciberras , it would be much more robust , if you would compose the structure from multiple objects
 
@teresko aka mixins?
 
@ChristianSciberras aka composition.
 
aka: "favor composition over inheritance" (tm)
 
@teresko dammit, we agree, I can't believe that :-D
 
@KamilTomšík yeah , now i feel like i need a shower
 
9:32 AM
hello to all
 
@teresko i wanted to fetch records with no of records in 1 query.
 
@teresko, @KamilTomšík - You agree on a philosophical concept, great. How about we see into making it into a PHP reality?
 
@ChristianSciberras forget about extends - I'm pretty sure you don't need even one for this.
 
@KamilTomšík - I'm pretty sure I do..
First of, I need a system to enumerate all field classes.
 
@ChristianSciberras remember that EmailField extends TextField? we've solved that by injecting validation. where else do you need extends?
why?
 
9:36 AM
Without having to "register" each class.
There will be a form generator GUI
I was going to use $children=get_classes('Field');
 
so? how extends could help you?
 
when it comes to UI, validation is half of the story.
When you want to enforce what kind of characters are entered, for example, is separate from validation.
 
please go on faster - will gotta go.
 
Though admitedly I could make use of "validation" as a code interface, it's not validation.
They're behaviours.
Also, there are different types of widgets, and it seems obvious some "extend" a parent.
Plus, having a proper class hierarchy helps.
 
@ChristianSciberras what's wrong with new Field($behavior, $validation)?
@ChristianSciberras there is no proper class hiearchy.
 
9:42 AM
new EmailField() sounds better.
 
@ChristianSciberras so? you can have factory method for that. $factory->emailField()
 
EmailField() could be a subclass of Field which automatically adds the right behavior and validation.
No no and no.
No factories here.
 
ok, gtg :-D
 
Anyway, maybe a topic for another time
Cya, cheers!
 
10:14 AM
hi, does anyone know about ffmpeg on windows ?
i have a shared account and i need ffmpeg support there, for the videos conversion into flv format... my site is a joomla based site and it uses a component called hwdvideoshare for converting the uploaded videos into flv format.... but for it to work, it needs ffmpeg enabled...
 
@dskanth ask your hosting provider if its possible
since video conversion is a resource intensive process i doubt its possible. if your hosting provider allows it, be prepared for running into resource limits
 
ok....
@gordon thanks
and for testing purpose, iam trying to setup ffmpeg on my local windows system, but unable to get it work.. getting error such as: "Unable to load extension..."
does anyone have a luck here ?
 
you might have more luck moving the encoding to some external webservice then
> The Web service route is nice because there is less setup involved. I have not used Hey!Watch but it looks promising. PandaStream is easy to set up and it works well, plus you get all your videos on S3 with no additional effort.
these are commercial services though
 
oh.. ok... i will consider them...
thanks again
 
np
 
10:25 AM
@dskanth "Unable to load extension..." is a bit vague
is there no other message?
 
@Artefacto yes.. it says...
PHP Startup: Unable to load dynamic library '\xampp\php\ext\php_ffmpeg.dll' - The specified module could not be found.
This happens when i include php_ffmpeg.dll in my php.ini file, and also put the corresponding dll file in the extensions directory
 
and I suppose the dll exists in that directory
 
yes
 
put just extension=php_ffmpeg.dll
and set extension_dir appropriately
 
yes, i used the same line in my php.ini file, below the extension=php_gd2.dll;
and extension dir is also properly set
is there any problem with the php version ?
by the way, iam using php 5.3.1
 
10:31 AM
you usually get a "module mismatch" message if that's the case
but yes, you must be using a version of the extension compiled for PHP 5.3
plus if the extension dll depends on other dlls, they must be in a searched location
 
oh.. ok
 
i also copied some dll files like avcodec.dll, avformat.dll into the windows/system32 directory
 
you can try opening the dll with the dependency walker and see if those dlls are found
 
this is closely related to my problem... phpbuilder.com/board/showthread.php?t=10370768
 
10:38 AM
Good Morning
 
@dskanth well it says there's no version for 5.3 (the project is dead)
 
oh... no
 
I'm sure you people have heard about "Deprecated: Call-time pass-by-reference has been deprecated in" before?
I'm ok with the explanation, but not the fix.
Currently, I have:

function test(&$arr){ /* ... */ } // <-- the new/good way

test(&$arr);    // <-- the old/deprecated way
The problem is compatibility.
 
other way around
 
Good morning @ircmaxell
Right oops
 
10:42 AM
test(&$arr) <-- That's deprecated, it's called call-time-pass-by-reference
 
So, my problem is compatiblity.
I have both enabled
 
@Artefacto fine, i will consider calling the ffmpeg executable from my code, using exec()
 
@ChristianSciberras the problem isnt compatibility, but poor design :)
 
@Gordon I don't get you.
 
@dskanth I think you may be able to compile the extension for 5.3
The latest SVN is from 2009 and compiles fine in my debian box
 
10:45 AM
@ChristianSciberras having to use references is almost always a design smell in my book.
 
@Gordon I'm passing an array instead of an object
 
@ChristianSciberras yeah, obviously you are doing that. and you are doing that by reference.
 
@Artefacto great.. can you send me the compiled dll file for php 5.3
 
@Gordon array_sort(); <- does that sound like code smell?
 
@dskanth Not really, I don't have a vc 9 here
 
10:50 AM
@ChristianSciberras given that we have usort … yes
 
@Artefacto oh.. ok...
 
Why do you need usort when it could be done by sort, faster?
 
@Artefacto i have ffmpeg.exe and i could successfully convert a video file to flv format, like this: ffmpeg -i abc.mpg abc.flv
 
But usort also uses pass-by-reference.
 
Speaking of which, doesn't usort do it the same way?
 
10:52 AM
usort uses reference parameters, not pass-by-reference
you call usort($var) not usort(&$var)
 
@ircmaxell - You missed the point
 
usort and sort are native functions. array_sort isnt. its userland, so why are you recreating native functions?
 
@Gordon - I'm not. I just listed u/sort as an example.
 
how does array_sort work? Can you show the code?
 
I figured @ChristianSciberras meant sort instead of array_sort.
 
10:53 AM
@Artefacto this code has converted a .mpg file into .flv file, using ffmpeg.exe:
<?php
exec('ffmpeg -i MELT.mpg abc.flv');
?>
 
ooh ooops
I meant sort
 
different tools for different jobs
 
F*ck I need a damn break :(
 
And you are still passing sort/usort a reference of an array, in that it actually sorts the array, rather than returning an array that is a sorted version.
 
which is what we want
 
10:55 AM
tbh, i think sort should indeed return the array
 
@Gordon - I disagree.
 
@ChristianSciberras feel free to do so
 
Just out of curiosity, isn't that still pass-by-reference, just not call-time?
 
For the sake of performance, passing by reference when you explicitly don't need dupes is plain better. :)
@Aether yes
 
@Artefacto might shed some light on the performance implications.
 
10:57 AM
he
it depends
 
It's the difference between $array = sort($array); and sort($array);.
 
i for my part think a function called sort should return whatever it sorted or be a method on an object
 
well, if you returned a different result, memory would be the prime use
 
@Gordon on the other hand, array_sort sounds like it should sort the array.
 
$array->sort(); would be nice.
 
10:59 AM
@ChristianSciberras there is no array_sort
 
@Gordon True.
 
depends on what the function does and depends on kind of arguments are passed
but for sorting functions, performance-wise, passing by reference would generally be more efficient
 
ok, I'm off to take a shower. later
 
but the advantage is negated if the array to be sorted is referenced by more than one variable
 
@ircmaxell later
 
11:01 AM
@Artefacto - You lost me there.
@ircmaxell Laters
 
say, in $a = array(); $b = $a; sort($a); the array is copied anyway
or if you're inside a function and the array to be sorted is an argument
 
Because arrays are never passed by reference.
Unlike objects. Right.
 
well, more or less
the premise is not very accurate to begin with
because a variable cannot simultaneously be a reference and not be a reference and the reference count is already > 1, so it must be separated (copied)
with objects it would not be as penalizing because there's an extra level of indirection, so only the "pointer" is copied
but again passing by reference != passing a (object) reference
 
@Artefacto - I've always had this strange question about PHP's internals;
can you find the address of a variable?
 
you mean in the address space of the process?
 
11:12 AM
yes
 
sure, with a debugger :p
 
lol
strace anyone? :P
 
11:30 AM
@Artefacto it's copied at $b =$a though. PHP only uses copy-on-write for strings
I thought at least
off to work. driving in today, so won't be on. Later all
 
@ircmaxell PHP uses copy on write always, not just for strings
@ircmaxell And it's copied only when passed into the function. On $b = $a only the refcount is increased. But when passing to sort is needs to be split into on zval with is_ref = 0 and one with is_ref = 1 ;)
 
12:03 PM
YAY!
Form generator finished! In 255 lines of well spaced code!
And only 23 revisions. :P
Now, a little more abstraction and off we go connecting our form to the world!
 
12:16 PM
posted on June 30, 2011

Here's what was popular in the PHP community one year ago today:Fawad Hassan's Blog: CRUD using jQuery and Codeigniter (Part 2) Mark Karpeles' Blog: PHP can do anything, what about some ssh? Developer.com: PHP Development Tools Improve in Eclipse Helios Update Ole Markus' Blog: Gentoo Linux and PHP-FPM Codrops Blog: Fresh Sliding Thumbnails Gallery with jQuery and PHP Richard Thomas' Blog: Sola

 
Dan
Does anyone here write WordPress plugins?
 
posted on June 30, 2011 by PHP Classes

Dedicated PHP in Cloud Solution with PHPFog - Lately in PHP podcast episode 13 By Manuel Lemos PHPFog is one of the first Cloud Hosting solutions dedicated specifically to PHP. On the Lately in PHP podcast episode 13, Manuel Lemos and Ernani Joppert interview Lucas Carlson, founder and CEO of PHPFog, to tell us about the advantages of using a Cloud Hosting service that is optimized to add

 
12:44 PM
@salathe a DOMNodeList returned by an XPath is not referenced? e.g. one can safely remove items from it without accidently skipping nodes?
 
@Gordon remove items from the node list?
 
@Dan I do. Why?
 
with the xpath version, the length of the domnodelist stays 2 despite removal of items from the DOMDocument
i would have expected to be able to use getElementsByTagName and xPath interchangeably
 
00:00 - 13:0013:00 - 00:00

« first day (257 days earlier)      last day (4696 days later) »