« first day (1720 days earlier)      last day (3213 days later) » 

12:20 AM
Yeah, I really came back after 2 years just to post a problem and go to bed. :(
0
Q: Silex login is storing AnonymousToken when trying to login

Silent EchoI'm using Silex framework and running into some issues when trying to implement a SecurityServiceProvider for login. When trying to perform a login action (with a correct username & password), I'm redirected to the login page instead of the / page. This is because of the following access rule: ...

Also hi guys, will try to be alive more.
 
and this is why people like me say that magic is evil
 
It really is
I'm about 3/4 of the way to ditching Silex.
The frustration from this is far worse than the frustration of writing a routing module.
 
1:18 AM
Dafuq o.0
Google just gave me a survey
This is new
 
1:33 AM
@ircmaxell: ooc, any thoughts on http://docs.hhvm.com/manual/en/hack.async.mysql.asyncmysqlconnection.queryf.php ?

(we don't support bind() for async as that makes connections stateful, which is basically impossible to do safely with cross-request pooling)
 
2:02 AM
@Danack No, I was thinking of __cast() as an alternative constructor. So for example $ustring = (UString) $string; would invoke UString::__cast($string);.
 
@Trowski likeit
 
That should return an instance of UString. Honestly, it's mostly just syntactic sugar for something that probably could just be UString::fromString().
 
@Trowski Problem is for it to be really useful you'd want to have access to $this of $string from UString::__cast
 
@Sherif In that example $string is simply a scalar string. To cast from one object to another access to $this wouldn't be necessary, but the uses would probably be limited. I was just tossing out ideas really ...
 
Oh, you're talking about casting scalars to built-in classes?
 
2:10 AM
@Trowski also important is its precedence. because if i'll be forced to write (UString)(.......) well that's not any better than new UString() or using a function UString()
 
@Sherif Right, though there's nothing that could stop you from casting one object to another.
 
Well, there kinda is. Casting non-primitives isn't trivial.
 
@RonaldUlyssesSwanson Right, and that's the point. This only came up because someone suggested adding a UString class with support for $ustring = (UString) $scalarString;
 
how about (UString)$string = "bar";
 
@Trowski Consider something like $dafsa = (DAFSA) $trie where $trie represents a non-premitive type Trie that has private members or some magic (say get/set magic for example).
 
2:13 AM
as in java
String string = "bar";
 
That's different. Java supports variable declaration. PHP doesn't.
 
@RonaldUlyssesSwanson Probably would be $ustring = (UString) "bar";
@Sherif The idea is that you'd have to be able to create object X from object Y's public API.
 
@Sherif yes, but in java that syntax also autoboxes/unboxes, which is basically casting
 
If you can't, then return null and the engine would throw something like a CastError.
Not sure if any of this is actually a good idea, just tossing ideas out there.
 
@Trowski Then it's not much different than saying new UString in that case.
 
2:16 AM
I agree.
 
Actually, the main difference is you have to forward to the constructor.
So just an added level of indirection, but that inherently makes the magic __cast function a static call then doesn't it?
Since you'd be returning new Object anyway
 
Yes, __cast() is static.
 
new self I mean
Ahh, OK. That makes sense.
 
Basically it's just an alternative constructor. Really, upon thinking about it, I don't see a lot of point.
 
Personally, I can't see it being incredibly useful, but if the implementation offered up something more intricate, like say it returns a closure with access to $this from the operand, then perhaps it would be incredibly useful :)
Because then you'd really be able to make casting across non primitive types pretty robust in userland.
 
2:23 AM
I often see requests for methods like __toInt() and __toArray(). I'm not sure how useful such things would be.
 
Man that RFC seems ancient now
 
@Sherif why would you care of how the operand is implemented internally?
 
@RonaldUlyssesSwanson You generally don't, but if you want cast between types you generally care to know if those types are desperate and should not cast.
Or otherwise cannot be safely casted.
In which case you may need access to private members of said operand.
Look at the implementation of DOMNode for example.
 
2 days ago, by Sherif
... and people wonder why PHP has such a bad name
:P
exposing $this would be too bad, imho
 
Why? We already make it possible with Closure::bindTo
 
2:29 AM
i haven't played with bindTo much, but i wouldn't like that too, probably
 
I'd much rather be able to tell if my cast should fail due to a desperate type error rather than just make bottom-up assumptions about the type.
One way makes it ad-hoc and less-useful, the other way makes it versatile and safer.
You tell me which one gives PHP a bad name
 
i don't know. to be honest i consider the whole thing unnecessary
@Trowski i'm working on a project that would need stuff like __toInt. my opinion is this: most of what people want could be achievable by the sole Comparable interface
if($someObject) // calls $someObject->compareTo(true)
if($someUTF8StringObject == "bar") // calls $someUTF8StringObject->compareTo("bar")
and so on
 
user4268046
Greetings, what is the best way to map a typed Object to a list of ints?
 
what's actually needed is a js valueOf equivalent
although __toInt __toFloat __toEtc would fit php better
 
user4268046
I came from Java, something like HashMap<Type, int[]> but in php
 
2:37 AM
@TheMineBench no generics in php. arrays can't be typed (yet)
 
user4268046
I see, well just Object => int[] would be fine, I can just cast correct?
 
@TheMineBench PHP is dynamically loosely typed. So the cast happens for you automatically in most cases.
e.g. if (1 == "1") // true
 
you don't need to cast @TheMineBench the type is kept
$x = array();
$x[0] = 10;
$x[1] = "string";
gettype($x[0]); // int
gettype($x[1]); // string

you don't need to do:
(String)$x[1]
 
user4268046
I see, but how do you use a Object as a key for an array?
 
@TheMineBench You don't
Array keys can only be ints or strings
 
user4268046
2:41 AM
:'(
 
You can't have maps of maps in PHP unfortunately
 
@TheMineBench you can't use an object as key. but you could use php.net/splobjectstorage which is a HashMap, basically
 
The key has to be scalar
bleah
That hideous implementation called splobjectstorage should be discarded like the trash it is
 
user4268046
I get that feeling a lot with php....
 
2:42 AM
No PHP has many good parts. Unfortunately SPL is definitely not one of them.
 
@TheMineBench check github.com/morrisonlevi/Ardent it has an hashmap implementation, similar to java's
 
That's basically where data structures go to die in PHP.
 
and definitely looks better than splobjectstorage
 
PHP arrays are already pretty good generalized ordered hashmaps. What are you trying to do exactly? There is likely a better solution for it in native PHP.
 
@TheMineBench in java terms, you create a map using php's arrays this way:
$x = array();
$x[$keyObject->hashCode()] = new Entry($keyObject, $valueObject);
which is ghastly, i know, that's why libraries like Ardent exist
 
user4268046
2:45 AM
I have a interface that has enable() and disable(), and I have states that are ints. I want be able to select what states the interface is enabled during.
 
During what?
 
user4268046
I want to be able to say have X enabled during state 1 and state 3
 
But what does X represent?
An object that implements this interface?
 
user4268046
Correct
 
So you want to be able to locate the object in an array?
 
user4268046
2:49 AM
Right
 
Can you have more than one of the same object in that array?
 
user4268046
Nope
 
user4268046
well, you might have more then one that are the same type...
 
Same type, but not the same instance, right?
 
user4268046
Correct
 
2:51 AM
As long as these instances will persist spl_object_hash will work if you want the lookup to be atomic. Otherwise you'd have to iterate over the entire array and compare by linear search.
You're probably better off just storing these objects in a map of states rather than in a list.
Which makes the process of changing their state much simpler.
 
@Sherif @Trowski :P 3v4l.org/TIjI8
 
user4268046
The problem with that being if it is enable during state 1 and 2 it should not get disabled inbetween those.
 
tbh i would like (UString)$lol = "bar" . "baz"; a lot
 
@RonaldUlyssesSwanson What on earth is the point of that nonsense?
 
@Sherif the discussion we just had :D
 
2:56 AM
@TheMineBench Right, that's exactly how you avert that problem. It isn't the problem with that approach. Quite to the contrary. It's the solution.
@RonaldUlyssesSwanson That looks more like vomit to me.
How is that useful ever?
 
i didn't say it's cool. just how i would like what @Trowski was proposing to work
 
bleah
 
user4268046
@Sherif So basicly have Map<Int, interface[]>?
 
@TheMineBench You just have an array of key/value pairs where the key is the state and the value is an array of objects in that state. That way changing their state based on existing state becomes as simple as a map/shift/push operation.
But perhaps I'm not fully understanding your use case.
 
user4268046
Let's call this interface a 'Feature'
 
3:00 AM
Let's not.
 
user4268046
So I would have array(State => array(Feature))?
 
Let's just consider pragmatism for a second.
Yes
Because you don't care what the object's key is in the array at that point. You just know that all of the objects under that particular key are collectively going to apply the same operation.
So there's your automic lookup right there.
Basically the difference here is that rather than trying to simplify the cost of locating a specific object in the array, so that you can find multiple objects more quickly, you are simplifying the cost of locating all of the objects at once, which gives you the same net result, pretty much.
 
user4268046
I see, but then how do you know if the object has already been enabled?
 
Well, I'm assuming you don't care because it's an idempotent action, which was the reasoning behind going the simpler map/shift route.
If that's not true then you'll need to explain your requirements in a bit more detail.
 
user4268046
so if I have a object that should be enabled at 1 and 2, it should be enabled when one starts, and disabled when 2 ends.
 
3:09 AM
Wait does this state belong to the object?
 
user4268046
No
 
OK, so you're trying to build a DAFSA, basically?
 
user4268046
There would be onStateChange($oldState, $newState) { enable what needs enabling, disable what needs disabling }
 
user4268046
I don't know what a DAFSA is x)
 
user4268046
googles DAFSA
 
3:11 AM
It's a deterministic acyclic finite state automaton. Basically just means ensuring that things happen in a specific order without looping in on themselves.
But OK, if your interface provides a call back that informs the object of the state change then what's this need for an array?
I mean the onus goes to the implementing object, no?
 
user4268046
Umm...
 
user4268046
there would be a class FeatureManager()
 
user4268046
It would take in this map, and also get the onStateChange method
 
user4268046
and it would have to enable and disable them when needed
 
Right, you're using an Observer pattern basically.
But isn't the point of having a onStateChange method to allow the object to enable or disable itself based on the state change event triggering the callback?
It's an inversion of controll
 
user4268046
3:16 AM
I don't understand, sorry
 
user4268046
The Features don't have access to onStateChange
 
Which part?
Right, but the FeatureManager does, right?
 
user4268046
Correct
 
And these Features implement some common interface, no?
 
user4268046
Yes, the one with enable() and disable()
 
3:18 AM
So why not just have them implement onStateChange and let them decide what to do?
i.e. just pass along the state change to the object
Wouldn't that be simpler?
 
user4268046
Ah, no that won't work because they will need to be reused and be enable/disabled at on different states...
 
user4268046
so they can't really store what states they are to be enabled on
 
Why wouldn't that work? The FeatureManager just passes along the the information to each object's onStateChange method and it can enable/disable itself by implementing that same state logic.
OK, but is there any reason why they can't store that information?
s/reason/particular reason
 
user4268046
Cause they there trigger reason might not have to do with states....
 
user4268046
they are supposed to be kinda universal.
 
3:21 AM
kinda unversal? I'm not sure I understand what that means.
Aren't you getting old state and new state as arguments to your onStateChange callback in the FeatureManager?
 
user4268046
Their trigger type might not have anything to do with states later.
 
user4268046
@Sherif correct
 
You mean the onStateChange callback can be triggered for a reason other than a state change?
That seems almost like a broken interface then.
 
user4268046
No... the Features might have different reasons to be enable/disabled
 
user4268046
that has nothing to do with states
 
3:24 AM
OK, but how does that change what we're talking about now?
I still don't understand.
 
user4268046
That's why I can't pass onStateChange into the feature
 
That doesn't explain why not. You just stated that there are other reason for the enable/disable methods to be called. But how does that prevent implementing on onStateChange method that calls them as well?
 
user4268046
I don't understand, you mean why can't you pass the onStateChange into the Feature?
 
Yes
 
user4268046
Because the feature is not supposed to rely on the state system whatsoever.
 
3:31 AM
Alright so if that responsibility belongs to the FeatureManager then you'll have to keep track of which objects are in which state from there and that should make it simpler to locate an object by its state.
But in my opinion this sounds like some bad loose coupling of objects.
 
user4268046
the state in universal.
 
Personally I prefer composing objects that have that kind of relationship, which makes it much easier to create interfaces.
For example, $this->state = new State(1); $feature = new Feature($this->state);
No the interface just makes more sense :)
 
user4268046
Wait what?
 
user4268046
The idea of the feature interface was so I could right features that would work with the state system, or with a different system.
 
user4268046
and I would not have to rewrite the features
 
3:38 AM
I'm not sure why this necessarily requires that feature not know about state, but shrug
If elaboration hasn't come by now I'm certain it isn't coming at all :)
 
user4268046
Erm well, I'm making a minecraft game system that has GameStates which are simply ints
 
user4268046
so I want to create features like NoBlockBreak
 
user4268046
but If I have a system that say, would stop block breaking based on when the there are x amount of players, I would like to be able to do that
 
user4268046
Or in a game that is completely different and has nothing to do with states, I would still like to be able to use NoBlockBreak without having to rewrite it
 
I see. So this is kind of a facade
got it
 
user4268046
3:43 AM
I still don't quite understand the best way of handling it for states is.
 
What is it?
 
user4268046
The features.
 
You don't quite understand the best way of handling the features for states is?
Care to fix that sentence?
 
user4268046
I don't understand the best way of handling features using the state system with a FeatureManager.
 
user4268046
or something like that
 
3:46 AM
Well, best is a relative term. So you're going to need to be a lot more specific.
 
user4268046
So I have an array(state => array(feature))
 
user4268046
Then onStateChange I loop through all the features for the new state... and enable them.
 
user4268046
but then I will be re enabling the ones that were already enabled
 
Is that bad?
 
user4268046
Yes, I can't enable it twice without disabling it.
 
user4268046
3:49 AM
I could fix this by checking if the feature is in the array of the oldState
 
user4268046
and if it is, then assume it's already enabled and not enable it
 
So what you're saying is you can't do if ($feature->isEnabled) ?
 
user4268046
Correct
 
This implementation sounds more and more hideous the more you talk about it :)
How about you do [state => ['enabled' => [<feature>,...], 'disabled' => [<feature>, ...]]] ... now you've decoupled the decoupled decoupling interface
voila
You are officially three levels removed from loosely coupled
 
user4268046
is in_array(needle, haystack) efficient?
 
3:53 AM
Ummm, is_array doesn't take a needle or a haystack.
 
user4268046
Fixed it x)
 
in_array is linear search, basically, but it does you no good when you're looking for an object in an array.
You probably want to read www.php.net/in-array to find out why :)
Ahh, I'm probably thinking of array_search
Basically in_array casts the value to a string, unless you set the third argument to true.
But it's not efficient, no. It's the same thing as iterating over the array and comparing the values.
 
user4268046
Herm... so I guess I need to get all the Objects that are in array x and not in array y
 
I'm no longer sure what it is you're after exactly. Are you having trouble getting something to work or are you having trouble getting it to work efficiently?
 
user4268046
Oh... right... I forgot about disabling...
 
user4268046
4:01 AM
Yeah, I'm going to need a array(Feature => int[])
 
user4268046
What's the best way of getting that?
 
huh?
I feel like we basically just went back in time.
 
user4268046
Probs did... I'm trying to stay awake...
 
user4268046
But I'm going to need to check for every feature if it should be enabled in the newState, and if it was enabled in the oldState
 
user4268046
then if that's true, false I enable it, and if it's false, true I disable it.
 
4:11 AM
 
user4268046
What's wrong with that?
 
Oh nothing. I just suddenly feel like I want the last 2 hours of my life back.
:)
 
user4268046
Don't we all...
 
@TheMineBench Remind me again why the feature can't expose it's enabled/disabled state?
Like why is there no enabled getter, but there is an enabled setter?
 
user4268046
Because it's an interface.
 
user4268046
4:15 AM
You can't store variables in a interface...
 
I get that, but you also don't instantiate an interface. You implement it.
What is stopping you from exposing the state of the implementing object in this interface?
You see how you managed to type an entire sentence and still not answer any part of my question?
This is something I've come to expect from Java guys :)
 
user4268046
You mean by adding a method isEnabled?
 
Yes
 
user4268046
and make people store whether or not it's enabled?
 
Well, you're making them implement a method that enables and disables the damn thing. It stands to reason that it should retain that state information for later use, does it not?
Please see CommonSenseInterfaceExceptionException
 
user4268046
4:20 AM
But we should have that information already because we are the one's who enabled/disabled it.
 
No
Being the caller doesn't necessarily mean you you know the state of the callee
That's backwards
 
user4268046
assuming no one else edited the state...
 
That's a pretty bad assumption to have to make. Especially when you don't have to make it.
Why assume anything? Why not just store the state of the object in the object.
shocked face
 
user4268046
I understand, ok I'll add a isEnabled() method
 
queue music
 
user4268046
4:22 AM
Sorry, I've been up for 20 hours+ x)
 
All more the reason to step away from the keyboard.
 
user4268046
Anywho, thanks for the help
 
user4268046
Yeah... probs should go talk to my girl... oh right I'm a geek...
 
user4268046
x) ok anywho, I'm out
 
> === Sleeping

Simple and obvious, but true ... engineering takes an alert mind.

It's very easy, very seductive, to throw a lot of consecutive hours at a
problem. One can get into a 'flow' state where one's mind becomes filled
with the problem, and the work just pours out, hour after hour. Many
writers report that they watch a story take place, and just transcribe
what they see, pounding out page after page of text. Many software
engineers have experienced a similar feeling, where the code appears
It's shocking to me how that archaic piece of literature is still so relevant :)
 
5:24 AM
HI ANYONE HERE
 
morning
 
morning :)
 
5:40 AM
good mornings
 
hi guys
 
morning
 
it's almost 2pm here xD
 
whut?xD
have you seen ziGi yesterday?xD
hey guys, wanna ask on ms sql, because I don't have it in php
how to update agent_id='3911' and set name='Jim'
when i try it in ms sql, all the agent_id becomes 3911 and all the names becomes Jim
 
5:59 AM
@JimSteven have you tried asking in the main site?
 
moin
 
need help regarding this
0
Q: CGridView Pagination not working. Yii

mdanishsI have a form in my view which selects columns from a dropdown list. The SqlDataProvider is used to get the data from the generated Query I have been trying to use CGridView with SQLDataProvider, its working a bit fine, but still having some issues with pagination. I don't have any keyField so I...

 
Where do you guys look for PHP jobs?
I was laid off a week ago and I haven't job hunted in 7 years
 
stackoverflow careers is a good place
linkedin can help too
 
Why didn't I think of SO. Hmm, thanks.
Yeah I have some LinkedIn stuff lined up, but they're all looking at my Angular experience. None asked about PHP which I thought was weird
 
6:09 AM
have you used yii framework for php ? I am stucked at a small thing, new to it
 
no. I wrote my own mvc
Oh I see your question up there
 
yeah :D
 
I mean, I guess that looks right if I look at yiiframework.com/doc/api/1.1/CGridView
@mdanishs maybe look at CPagination yiiframework.com/doc/api/1.1/CPagination
 
@FredEmmott need to look at the implementation. On the surface intrigued and slightly scared ;-)
 
Yeah 0 PHP jobs in Atlanta on SO Careers. Probably more devs than jobs, I guess.
 
6:16 AM
0
Q: Using google oauth2 profile info to set $_SERVER php variables

user1977867I recently migrated from Apache Basic Auth to Google OAuth2. Previously, $_SERVER['PHP_AUTH_USER'] used to get set according to user's entered information. Now that my page page shows signIn with google, $_SERVER['PHP_AUTH_USER'] does not gets set. I am able to print user information on the conso...

 
Yes it looks right I don't know what wrong with that. :(
 
Man, it looks like nobody wants just PHP anymore. It's PHP + 10,000 other things.
2
 
I guess that companies nowadays want a all-in-one web developer who can code both front-end and back-end, css is so so hard xD
 
Yeah, luckily I picked up a few skills the past few years in dev. Before that I did pretty much everything in IT lol
Ah, Square is hiring here, hmm!
Bleh, Java
 
our field has tons of opportunity, you can go from software to hardware :D
 
6:25 AM
I picked up Java Spring, but only for REST API SOA
yeah I did some hardware stuff for my wedding wddng.net/project/0
 
I like C# more than Java and I don't know why xD, maybe because I tried creating android games using C# instead of Java and C++(i don't want this pl) ^^
 
I'm seeing a lot of full stack Angular requiring .NET so I may look into that :/
 
.NET is so much fun to learn tho. ^^ especially asp
 
I hated ASP. lol.
I hated Windows, but Windows 10 looks cool
 
haaha, everytime windows releases a new version, some of my apps does not work xD
I have to troubleshoot their compatibility mode one by one
 
6:31 AM
I worked in Broadband/DSL support for Mindspring/Earthlink and when I discovered OS X in 2001 I switched
I was still in the Windows queue though, lol. It was usually dumb stuff like IE3 proxy settings, TCP/IP, et cetera
 
ohhh :D so you're good in troubleshooting, I wanna learn that thing :D
hahahha proxy settings is killing me ^^
 
Yeah, I once owned Troubleshoots.net but this was when Network Solutions charged $75/year and I let it expire .... :/
 
awe 75/yr is not that bad
 
I take it you're not American. You're english is a bit off
 
yes, I'm Asian :)
 
6:38 AM
Ah
Where do you live in Asia
 
btw, I wanna post this here:
http://stackoverflow.com/questions/31177145/ms-sql-invalid-object-name
I'm having some problems, maybe anyone from here can drop off to the link :)
PH
from PH
 
Jim "Steven" kind of was the red flag. "Stevens" is more common
you have an answer already
 
yeah I saw the answer, btw I tried the code in mysql and it works, I'm wondering how much is the difference between sqlsrv and mysql -_-
 
7:00 AM
Sometimes you need the backticks... `username`
cya guys
 
7:46 AM
moin!!
 
Morning
 
@JimSteven still going at it? ^^ If I may suggest you something? You should try using prepared statements
 
8:06 AM
@Naruto it works now :D thanks for the concern, my not so new problem is the last part I am doing, which is the copy button, wuehehehhe
does not work on lower versions :(
 
Anonymous
Monin
 
guys, anyone can help me :D
 
copy button as in copy a row?
 
no, copy button using html and js, I want to copy the text inside a textbox
what I want is working on all browsers
and does not use flash :D
 
Anonymous
8:20 AM
@JimSteven Why can't you use flash?
 
Anonymous
@JimSteven If you change your mind about flash - zeroclipboard.org - is the best option I've found/.
 
@ircmaxell Awesome!!!
Great work!
 
@Jay You really advising people to still use flash?!
@JimSteven not quite sure what u mean, you want to copy text between inputs or ... ?
 
@Naruto It's the only way
And if you don't have a working flash it will say so in the callback meaning you can degrade gracefully
@JimSteven That is simply not possible
security and stupid stuff like thta
 
8:36 AM
@PeeHaa I still have no idea what he's trying to do :P
 
@JimSteven Copy to clipboard? cc @Naruto
 
@PeeHaa sir I've made it when i click copy button, it will highlight and copy all the text inside the textbox, but when I try it on lower version(in the remote server in which I am developing) it does not work
 
That doesn't even answer my question...
 
@Jay I think javascript will do the thing
@PeeHaa sorry, can you please elaborate your question, I didn't quite get it :D
 
Copy how? From where? To where?
 
8:39 AM
copy the text inside and textbox and paste it in a notepad by using ctrl+V
 
Yes you need flash for that
18 mins ago, by Jay
@JimSteven If you change your mind about flash - http://zeroclipboard.org/ - is the best option I've found/.
 
ok i'll check it
 
@JimSteven If you care about all browsers, you need flash for that: caniuse.com/#feat=clipboard
 
Also there is developer.mozilla.org/en-US/docs/Web/API/… for newer browsers which probably will fail soon
 
yes, I want all browsers to have access even lower versions, I just can't update at the remote server I am working/developing :((
 
8:42 AM
The server has nothing to do with this
It's a client limitation
 
ohh I get it...
hmm, I'll try to workaround with the links you've given ^^
 
@PeeHaa overslept for work today.. This heat is killing me :P I can barely sleep :(
 
@Naruto I have seen the clock do a 5 o'clock
 
I've seen the clock do multiple hours last night ^^
 
8:57 AM
Yeah. I meant I also saw it do everything before 5 :P
 
I saw it do 5am too
but I was in bed
 
@JimSteven apparently I was not there
 

« first day (1720 days earlier)      last day (3213 days later) »