« first day (451 days earlier)      last day (4497 days later) » 

9:06 AM
@Greg what did it cost you ? I hope not globals.
 
@OmeidHerat A lot of dependency injection, but really it was achieved by restructuring the framework to be more concise and meaningful. There is no real need for statics any more.
 
@Greg That makes sense, but there is still place for appropriate use of statics. :)
 
Yeah. Having constructor overloading in PHP is the one case where statics are fine
 
@Greg How did you go with your Autoloader ? I still use statics.
I couldn't find a work around.
 
9:13 AM
(And If you don't care about maintainability then there is also no issue at all)
@OmeidHerat spl_autoload_register(array($autoloader, 'load')); ?
 
@OmeidHerat There certainly aren't any appropriate uses of statics in my framework any more since it has been restructured. When I feel the need for a static, it usually means I can structure better.
 
@edorian That global are fine too.
 
@OmeidHerat I don't use __autoload
 
What global?
 
@edorian using any sort of global variable is fine, if:
1 min ago, by edorian
(And If you don't care about maintainability then there is also no issue at all)
 
9:15 AM
If i: s/That/Then, s/global/globals i understand then :). Didn't make the connection
 
Oh, typos.
 
But constructor overloading is pretty much the only always valid use case I'm aware of where it makes sense to have that language construct
 
@edorian can you explain?
 
@edorian Yeah that, but I warp them around a class.
and then all I have to do is,
require_once 'Core'.DS.'Autoloader.php';
\App\Autoloader::register();
@edorian But I don't understand constractor overloading, can you explain or some example perhaps ?
 
@Greg Weight::fromKilogram(100); Weight::fromPounds(100); Weight::__construct(100); // whatever your default metric is
Just as an example.
10
Q: Constructor overloading in Java - best practice

errrThere are a few topics similar to this, but I couldn't find one with a sufficient answer. I would like to know what is the best practice for constructor overloading in Java. I already have my own thoughts on the subject, but I'd like to hear more advice. I'm referring to both constructor overlo...

 
9:20 AM
Ah that makes sense, I just didn't knew it's called, Constructor overloading.
 
@OmeidHerat But why does your autoloader need to be able to register its self. All it does it takes away the possibility to configure it. Does it magically know where the code it should load is? $x = new \App\Autoloader($path); spl_autoload_reigster($x); // If it's invokable
Then again my autoloaders are closures that i just require once anyways .. so I shouldn't talk "configure pathes" :)
 
@edorian Ah I see. Yes I can see that if you were to need that style of code in your app, then statics would be the only way to do it, but again if I felt like I needed that style of code in my app, I'd think about restructuring.
 
@edorian You don't need to change the Autoloader path unless you restructure your FW.
in fact, that Autoloader registration is in the init.php which holds the configurations.
so all I need to make an App is:
 
@Greg There are valid use cases for building classes from multiple input sets. Not that I could make them up now :) But "new" and "static" but are global access so its the same "semantics" :)
 
// Initalize the Application Envoriment.
require_once 'App/init.php';
$App = new App(new ....,new ....);
$App();
 
9:24 AM
@OmeidHerat I don't understand how why you construct App and then call it?
 
@Greg look up __invoke
 
@Greg I pass all it needs.
//Create the Application
$app = new \App\App(
	new \App\Core\Config(CONFIG_INI),
	new \App\Core\Session(),
	new \App\Core\Router($_REQUEST));
I like a clean Entry point, that way it's easy to follow up things and go deep.
or it's true at least for me.
 
One could argue about object live-cycle times and that this design doesn't allow you do execute the application two times on one object
 
Why not ?
 
$app = new \App\App(
	new \App\Core\Config(CONFIG_INI),
	new \App\Core\Session(),
	new \App\Core\Router());
$app->execute($_REQUEST);
// In app
$this->router->dispatch($request);
Because you tie $_REQUEST to the construction of the router and not the invocation of the router
Really minor concern for most real word usages but a router should be able to route more than one set of inputs (usually)
You don't want to end up with a router factory if you have to route multiple routes
 
9:30 AM
@edorian I can inject a new $_REQUEST to the router, but still it will be only executed when the App is executed.
so I have:
$App = new App(......);
$App()
$App->Router->setRequest($_REQUEST);
$App();
 
Well yeah.. but that feels a little arcane. If something has a setter it shouldn't have a (non-optional)constructor parameter but usually a method parameter. Just how I look at it. (Also $app exposes its member which is a little strange)
But I can't explain that as good as other people so I won't try
 
@edorian I understand that, but if it doesn't expose the members it must have lots of proxy methods.
aight, heading home. Later.
 
@OmeidHerat Well it doesn't have to expose all the classes it contains at all :)
And a lot of proxy methods are a flaw (video: youtube.com/watch?v=RlfLCWKxHJ0 text: http://misko.hevery.com/code-reviewers-guide/flaw-digging-into-collaborators/ that you seems to have recognized but covered up by making the properties public :)
 
9:50 AM
I've got a very strange issue, which I can't reproduce elsewhere.

print_r( array( $field_data, $field_data[2] ) );

Yields:

Array (
    [0] => Array (
            [2] => a
            [3] =>
            [1] => b
        )
    [1] =>
)
For some strange reason, index 2 (as well as index 1, for the matter) are not accessible.
I've also tried this:

foreach($field_data as $k=>$v) echo $k.' ('.ord($k).') => '.$v.'<br/>';

Yielding:

2 (50) => a
3 (51) =>
1 (49) => b
That said, if I create that array myself, I can access it normally. That array is being deserialized from a JSON string.
 
10:33 AM
anybody know the answer of this que? please suggest...
1
Q: How to crop this image?

user1133643I have this image, http://farm8.staticflickr.com/7164/6671913371_89fbd71a2e_z.jpg I want to crop this image to several sizes, for that i use this function- function thumbanail_for_image($Id, $newfilename, $size=NULL) { $file_extension = substr($newfilename, strrpos($newfilename, '.') + 1...

 
@edorian Indeed, I had the option to expose the router and or create proxy methods.
and also, why would the App (FrontController) should know anything about the request or raw route.
@edorian That is one good reading
 
The question is: Why do you need to expose the router at all. Application uses the router to route, application is not a container for your dependencies :)
Why should your front controller know about your request? Well because it should dispatch it? http://java.sun.com/blueprints/patterns/FrontController.html ? If i got that right
 
Yes, correct. but the Front-controller shouldn't know where the request is coming from, all it needs to know is the Route, clearly broke down in parts (Controller, Action, Data).
That way, All I need to do is write a new router to use my App, say over NotHypertextProtrocol.
I understand that switching the Protocol is out of context for a web application - at least for now - But I might have to switch to a new way of passing the route based on the Environment. :)
s\broke\broken
 
10:50 AM
Well whether the front controller asks someone to take apart the route or just asks for the pieces is something you can decide on and that depends on how your "request" looks like. Yeah. I guess my main point was that the front controller should take a broken down request.. so maybe it just wants what the execution of the router produces?
All in all I think you got my point and those details are a) hard to talk about and b) something an application an easily figure out depending on it's needs
Having requests come from the CLI would be an example here it makes a lot of sense of having the "WebApp" be able to not only work from HTTP
$ php app.php user create john doe
Created user with id: 7

comes to mind
 
@edorian Ever heard anything related to my issue?
 
@ChristianSciberras Can you var_dump(); that ?
 
@edorian There we go. I couldn't have though of use case like that.
 
and what is "not accessible" ?
 
@edorian Deadly agree, sometime I find explaining programming issues are harder then Asking out.
 
10:55 AM
string(1) "2"
string(1) "3"
string(1) "1"
 
@ChristianSciberras is it an array object ?
 
@OmeidHerat Not unless json_decode does something funny...
 
@ChristianSciberras Can you share the JSON object ?
 
uhm... O.o
as in the JSON string? sure
 
Yeah, the JSON string.
 
11:06 AM
{"2":"a","3":"","1":"b"}
That's the stuff in the DB.
Which...uhm...should result in an object, rather than an array
but I've got the system intelligently typecasting the DB data to match the object property data type.
Typecasting is basically: (array)@json_decode($value);
 
@OmeidHerat happy new year bro
 
meow
 
@OmeidHerat u forgot me -_-
 
@salathe bark
 
@ChristianSciberras lol
 
11:16 AM
@Abhishek No, Happy new year dude. I was stack in PHP.
 
:)
 
well need a suggestion , if som1 wanna brainstorm [though not php solution but we are programmers ,aye? ]
 
Go ahead.
 
Hmm what can be the best way of implementing abilities ? [say for instance i make an application where peoples can unlock some stuff depending on the time and things they do with my app , now they can earn points and these points will unlock abilities say "cool avatars" for them , how exactly this should be handled , Server is Node.JS - just in case -]
 
11:20 AM
@edorian In the sense that echoing $data[1] causes a notice (bad index) as well as null result (obviously).
@salathe can you give my issue a quick look.
 
@ChristianSciberras codepad.viper-7.com/Wvuq7I
Feel free to through stuff at me.
 
@edorian Thanks for highlighting new. I sometimes oversee that. And good day btw.
 
@Abhishek It's not language related, the best way would be to keep track of the Privileges in database and let them the stuff they have the right to do with.
 
was that for me ?
and well i know best way to do that will be database and databases to handle but .. databases create an issue
esp SQL
 
11:24 AM
@Abhishek Write your specification first, the problem you describe should be language agnostic.
Then test your specification.
 
try handling SQL with a node.js [its possible but SQL bottlenecks if there are too many events fired altogether ]
 
If specification tests pass OK, go ahead.
 
@hakre tested it :( failed :(
 
So back to specs.
 
http://codepad.viper-7.com/ZaBJjI

Same thing ^
 
11:25 AM
Don't care about the technical layer at first.
 
@hakre bet this would interest ya
 
hmm
 
@ChristianSciberras it's weird that if you serialize it and unserialize it again, it works !
did you check the link I posted ?
 
@OmeidHerat That would make my code überslow.
@OmeidHerat yes
 
I know, that is indeed not a fix. but at least says something.
 
11:28 AM
@ChristianSciberras what is the problem with that?
oh
try with a hexdump
 
@OmeidHerat img849.imageshack.us/img849/195/3785b9a242b54fc8a2a15e7.png Any critic on design { its for a mobile chat x-platfrom HTML 5 }
 
@hakre I tried ord'ing each byte, it only yield one byte, of the correct ascii value
it's definitely not a character issue
 
@Abhishek it's nice, but I would go with a lighter color for the background.
 
interestingly it works if the index contains string characters
So my guess is that PHP object don't like numeric property names.
 
a more reflected view on things: codepad.viper-7.com/gEnPTr
 
11:32 AM
Dynamic properties huh? Fun
 
@OmeidHerat whats lighter then white ?
 
@Abhishek my bad. s\background\border
 
oh!
sent to my insane g-designer :)
 
@ChristianSciberras Those you add at runtime, same with stdClass (and the other objects).
 
she basically puts whatever she can create on photoshop & dreams to me .. "Now, go u code it idk how .. just get this done"
 
11:34 AM
@hakre I don't understand this bug TBH
'Cause the property is being added twice to the dynamic stack. If it got added somewhere else, one could guess they forgot to take note of it.
But adding it to the same place by mistake (without checking for dupes) is kinda strange, no?
 
I found the culprit :)
let me double-check
 
I'm all ears. Erm. Windows.
 
okay, this has to do with how PHP handles numeric keys.
When you access $array[1] or $array["1"] PHP will look for the integer key.
 
The (array) cast however will allow string "integer" keys.
You just created an array index you're normally not able to access any longer in form of the array access in PHP :D
The write only array member.
 
11:44 AM
@hakre MUAHAHA!
 
Nice title for a blog post btw.
 
I don't blog.
You're free to take it upon yourself to do that tho. (keep me posted ofc!)
 
I might, but have to finish some paperwork.
 
@hakre Wait...
 
It might be useful to report this as a bug probably.
 
11:45 AM
then why this one works:
$JSON = '{"2":"a","3":"","1":"b"}';
$output = serialize(json_decode($JSON));
$output = (array)unserialize($output);
var_dump($output,$output[1],$output['1']);
 
because of serialize.
 
or does the serialize converts the key to string ?
Ah.
makes sense.
 
let me check if it's serialize or unserialize, mom
so now you can laugh: a:1:{s:1:"1";s:1:"a";}
in the serialized representation, it's still a string key.
but unserialized that string gives you:
array(1) {
  [1]=> string(1) "a"
}
which is the integer key then.
 
Feel like writing the bug report? Or should I do it myself?
 
IMHO the cast should mimic the expected behavior and not let the value be un-accessible.
Or the way how arrays are accessed is broken.
I bet, they want to fix the cast, not the latter :)
If they refuse to fix the case, I want them to fix unserialize :)
Probably best way to tell: json_decode unserialization is broken when casted to array.
 
11:50 AM
@hakre I rather see the array cast be fixed.
 
And then show that unserialize does it by converting string keys to integers if they are ints.
@OmeidHerat sure, the other would lead to some sort of overkill.
 
Hope they fix.
 
@ChristianSciberras it's not json_decode.
it's only the cast.
$object = new stdClass;
$object->{"1"} = 'a';

var_dump($object);

$array = (array) $object;

var_dump($array);

printf("Isset: %d\n", isset($array["1"]));
gives:
object(stdClass)#1 (1) {
  ["1"]=>
  string(1) "a"
}
array(1) {
  ["1"]=>
  string(1) "a"
}
Isset: 0
 
Ah, good point.
> Object to array casting breaks integer property names
 
11:55 AM
also intersting: var_dump(array_keys($array));
rightfully returns the string key.
 
Then defs, casting should be fixed.
 
To normalize: $array = array_combine(array_keys($array), array_values($array));
 
hi
 
@hakre Hold up; let me talk to the WordPress Answers mods and see if they want that
If they do I can migrate it
 
Question: How would you pass the Object itself as the iterator for the ArrayObject ?
That is, I want to use the object defined offset* methods when used by foreach, var_dump and stuff like that.
 
eek
12:05 PM
Does anyone knows a platform or a plugin for an existing eCommerce script that allows you to run a client 2 client marketplace? like etsy.com for example? like eBay and so on?
 
@NikiC Hi :)
 
Hey @BoltClock :) Are you our new personal PHP mod? :)
 
@NikiC Hmmm, good question
@hakre migrated
@hakre If you feel a question belongs on another Stack Exchange site that isn't available for 3k rep users to move to, flag it first so we can handle it.
 
12:23 PM
@NikiC Someone has to watch the kids? :)
 
12:35 PM
@BoltClock ack
 
60 rep to go till 10k :)
Not that I would be able to play with you guys then :P
 
@edorian right :)
@edorian nope, you won't. you need 20k for that
(okay you can delv with 10k, but only after two days or so)
 
But at least I can see what you killed.. which should "unbreak" more than half the links in here :)
@NikiC Thats what I was trying to say
 
@edorian Waiting for 20k too :(
@edorian Just voted you above 10k :)
 
yeah, helped a little ;)
 
12:43 PM
@hakre Right, I already wondered why there is more rep than I voted ^^
 
errr.. ok
that wasn't what I was getting at but well
goes of to playing around with shiny
 
@edorian I would have written that as well for the log. ;)
 
@edorian Never browsed your answers before. So there are many nice answers I didn't yet have the chance to vote up. This obviously isn't for getting you over 10k cautious look at @BoltClock
 
> 196 flagged post
Oh my .. my OCD is kicking in again
Wow.. there is a lot of shiny stuff in the 10k tools
.. browsing the flags really shows how much traffic there is on SO
Why do I only have 37 "inform moderator" flags. Don't they fill up every day?
> very low quality – 2 hours ago × 2
 
12:59 PM
@edorian Low flag weight probably
 
How do i add my "yeah" stamp on that?
@NikiC 550+ flag weight
 
@edorian flag it ^^
 
As what?
Other?
 
@edorian As inform moderator -> lowq
 
Hm.. yeah.. for other questions that works out
But for that question there is just "invalid flag" and "other"
I assume that is because the question has upvotes?
 
1:02 PM
@edorian Congrats on hitting 10k :)
 
@BoltClock Thanks :)
 
@edorian The "other..." flag is for anything else that doesn't fit the options given to you, available to any flagger. The "invalid" flag is to say the existing flags aren't correct; you only see that option in the 10k tools as that's where you'll see flags that others have raised.
 
@edorian btw, you are really phpunity.
 
For this question: stackoverflow.com/questions/8801644/jpeg-image-not-shown-in-qt I can't flag "low quality" / "not a question"
 
Whether a question has upvotes or not doesn't matter.
 
1:05 PM
While questions with 0 votes (or whatever decides that.. It the only distinction i found) I can flag "very low quality"
 
Oh, that's what you were referring to.
Yeah, if a question has upvotes, it's presumably not of low quality.
Most of the time, "very low quality" flags should be simple downvotes instead.
 
@NikiC Well If I want to teach people how to use array_merge and array_map .. I have colleges for that :)
 
We get a ton of VLQ flags on stuff that is salvageable through edits or just isn't that bad to begin with.
 
Ok. Thanks @BoltClock. Then I got that right it seems as I downvoted it :)
 
@edorian No problem.
 
1:14 PM
It's so nice to revisit every page and see that little things have changed
 
@edorian I revisit old pages to change those little things :P
 
hey, i have a normalisation query
anyone want a pop at it, although i think i have solved it :D
 
All the better
 
1:46 PM
If I'm reading this question correctly...
This guy can write XPath but not CSS?
-1
Q: Syntax of CSS & DOM

narayana suryaHow to write XPATH,CSS,DOM in selenium, and what is the syntax for those? Cany you explain how to write CSS & DOM. Example for Xpath:-//title[@lang='eng']

 
@BoltClock No, he can copy and past XPath but doesn't know XPath, CSS or DOM ;)
 
@NikiC Makes sense.
 
I'm way better with XPath than with CSS
 
@edorian :O
 
I still couldn't solve this one:
2 hours ago, by Omeid Herat
Question: How would you pass the Object itself as the iterator for the ArrayObject ?
 
1:48 PM
I can't even remember how to write #id .class div,span div > span half the time
 
2 hours ago, by Omeid Herat
That is, I want to use the object defined offset* methods when used by foreach, var_dump and stuff like that.
and here is an example: codepad.viper-7.com/jPjk5R
 
That reminds me... I'm on my way to a gold badge for an obscure tag that nobody cares about @_@
 
@BoltClock I just a lot of XPath and very little jquery and pretty much no html/css :)
 
@edorian Yeah.
 
@OmeidHerat call_user_func_array(array('parent', __FUNCTION__)); Does that even work? It should at least throw an E_STRICT
 
1:52 PM
@edorian nope it works just fine.
 
Was that 'fixed'/'hacked' in 5.3.later..
 
but if I use call_user_func_array(array(parent, __FUNCTION__)); it does throw a warning.
@edorian I don' know, what exactly is wrong about that ?
 
In 5.2 it just broke the script and in early 5.3 it raised an E_NOTICe
But it seems to work now. Nice that they fixed that
"Back in the day" one had to write call_user_func_array(array($this, parent::__construct'), $args); or endure very strange side effects
(not that that helps you in any way of course)
You want your Object to be traversable? Or at least you want it to be an iterator
 
but at least it makes me feel see the good side of it though :)
 
> ArrayObject implements IteratorAggregate , Traversable , ArrayAccess , Serializable , Countable {
 
1:58 PM
@edorian Yeah, the problem is that it's traversable but not the way I want.
 
So you have to override getIterator i assume?
 
It doesn't use the offset* functions that I have defined.
@edorian I think that is it.
let me check
 
ArrayAccess has nothing to do with Iteration :)
 
hey @jcolebrand
 
New people :) Welcome
 
2:02 PM
Howdy
 
Holla @Crontab
 
@BoltClock Yo
I'm sad that my blue doesn't extend over here
 
@jcolebrand Heh
 
Life goes on
however, I do believe I need to go put my lunch in the fridge, bbiab
 
2:37 PM
Got my second announcer badge today.. I can't even remember sharing the link :P
 
@edorian I got freakin' ONE HUNDRED AND FIFTY THREE
user image
3
That's almost double my existing bronze badge count of 177
 
@BoltClock I think we already have established that you have a very unhealthy lifestyle. You even turned blue because of it
3
Errrr...
Why do all of them say "13 mins ago"
Do you have 24 friends that can click really fast? :)
 
@edorian lolz
 
@edorian No, it's because they changed the badge criteria to no longer have time constraints. I've been tweeting SO links so naturally those got clicked over time.
/seriousanswer
 
I see
That explains why I got the badge :)
 
2:43 PM
Same goes for the silver and gold versions
 
Reading meta can really be useful from time to time :)
 
23
A: Booster badge should be golden or easier to achieve

balphaThis is actually already in the works. The Announcer / Booster / Publicist triad will behave like other similar badge groups afterwards, e.g. Nice Answer / Good Answer / Great Answer or Notable Question / Famous Question. In particular: The timeframe will not matter anymore. You still get the F...

 
@BoltClock very nice
@BoltClock I just got Booster this morning
And just announcer 13 minutes ago
 
Hi. has anyone tried yet php 5.4?
 
Yes, Yes, Yes! It always feels so good that half way through writing a proper question, you find the answer yourself.
 
2:58 PM
@develroot That's an odd question, but yes
 
@develroot few mins ago, I dump the virtual machine. but Yeah I have.
 
@OmeidHerat Whenever that happens, I finish writing the question, write the answer... then throw them into Evernote.
 

« first day (451 days earlier)      last day (4497 days later) »