« first day (978 days earlier)      last day (3973 days later) » 

12:02 AM
@bwoebi implemented what we discussed before and works fine, thx :)
 
@Shady relogin, and you'll be able to talk
 
evening @Ocramius, I think I heard your name mentioned tonight
probably somebody bitching, you know how it goes
 
@igorw I am an annoying little guy, you know that :)
 
yeah, but I was surprised that other random people know this as well
 
heh
 
12:11 AM
in particular real people, not IRCmaginary ones
 
O.o what did I do this time? :|
 
I guess you proxied someone or something
 
rofl
 
or maybe your speed approxymated the speed of life
 
I'd put a lazy on that
that's way too fast
nn
 
12:40 AM
How do you guys feel about relatively new Phalcon framework (phalconphp.com) when compared with laravel, I want to start with one of these and i find Phalcon as more interesting since its entirely new approach with high effciency when compared with other frameworks.
 
@RohithRaveendran Are you building the new Facebook? Yes -> use phalcon, No -> anything else
 
Either I'm doing something really dumb or the file option for composer doesn't work on my Mac "composer update -file composer.local.json":
"The "--file" option does not exist."
 
Morning
How to flag question to move it other Stack site?
 
@Ocramius Obviously not but seriously hoping to host some php projects that require medium traffic on low cost vps servers.
 
12:58 AM
@sectus the flag button next to the close button for a question. But the options of where to send it to are limited.
 
@Danack , so, there is no such option
 
crap - sorry. I was confused. If you do "close" -> "offtopic" it should show you the other sites.
 
i need more about 400 rep
 
Thanks @ircmaxell, I will check now :)
 
1:05 AM
"you just saved a whopping $2400 per year!" OMG free monies!
 
Yay! I moved up 1 spot! stackexchange.com/leagues/1/alltime/stackoverflow/… Now just 351 spots more to go
 
With that I can buy like 4 days of coder time! Per year!
 
@sectus You can flag it for a moderator to move it if the target is not in the list
 
Hi guys :)
When POST request is get cached
 
user895378
?
 
1:10 AM
never
 
user895378
@RohithRaveendran My thoughts:
 
user895378
May 12 at 3:31, by rdlowrey
<announcement>OMFG!!!!11 PHALCON PHP FRAMEWORK IS SO FREAKING STUPID.</announcement>
 
user895378
For compiled code I expected it to be much faster than it actually is. The performance difference isn't nearly enough to justify using compiled code IMO. Also, I don't like how it asks you to structure your code at all.
 
exactly
 
I am building an image hosting website and POST is getting cached
 
user895378
1:15 AM
Not to mention, the slowest part of ~95% (probably more) of all PHP applications is going to be DB access and disk IO. Phalcon won't help with either of those.
 
@ircmaxell You have your opinions, but I feel you are talking just from one side of the wall. Having used Zend framework previously for normal projects I really didn't have to go through any of the internal library files.. Okay I am not a expert coder just have 1 or 2 year freelancer experience.
 
It's my opinion. I'm not saying you're wrong for using it. Just that's my take
I answered my 5th question!
0
A: md5 or urlsafe_base64 or other for creating an auth_token

ircmaxellOutside of the context of Rails (since we're talking general web application security here), it's pretty easy to discern. So, using MD5, you have two methods. Either with a fixed input, or a random one. For the sake of this discussion, any input that includes a random component (like the usernam...

 
user895378
@ircmaxell ... making RoR a less spectacular security fail one answer at a time.
 
ROTFL, if only it was that easy
 
user895378
Automatic thermostat turned off the air conditioning in my office @ 5pm, now I have to suffer for a few minutes while it cools off.
 
1:51 AM
morning ..
 
morning!!
 
yeah english makes me wanna die sometimes :c
the weathers are nice today :D
 
@NullPoiиteя @DaveChen Have you ever tried french or dutch ?
 
haha is it worse?
 
1:54 AM
@HamZa yuipp for one day only :P
 
I think that english is the most simple language
@DaveChen Do you speak french ?
 
English is from french...so I imagine the makers might have removed the "complex" parts
no :D
 
@DaveChen lulz
Dutch is even worse than french
 
@HamZa what about German ?
 
@NullPoiиteя I'm speaking out of experience, and since I don't speak german, I can't say anything about it
 
1:58 AM
cya guys ..its English grammar time :)
 
German is way harder than french
 
@cheesemacfly haha
 
An object can be a female, a male or something else
seriously :)
 
lol
To be honest, I still can't differentiate between some words "le" and "la"
One day I was making a tutorial for my friends and I said "le fenetre", the next day my friend told me "le fenetre", I was like WAT
And then they explained to me it's "la fenetre" xD
 
its complicated .... what about other then in this book :-/
 
2:03 AM
then --> time
than --> comparison
 
@HamZa yep this part is tricky but in german it could be das Fenster or die Fenster or Der Fenster (just one more case!)
 
@HamZa ty
 
But hey, don't forget the weird letters: la fenêtre :D
 
@cheesemacfly haha too tired to use ALT+0234 :p
@NullPoiиteя yw
(I'm on qwerty)
 
Yeah I'm cheating I have a french keyboard on that computer!
 
2:09 AM
è_é :p
 
ééé ùùù
maybe this one is the worst: ç
I don't even know why someone one day told himself it would be a good idea to use a ç instead of a s
 
I do only know the alt code of : é the rest I need to search for it
 
words in German is way long than English
 
@NullPoiиteя again è_é than
 
2:12 AM
هههههه
Gota go now, see you guys later
 
see you!
 
@HamZa laterZ
 
2:51 AM
Hey guys
im really needing help like asap
0
Q: Get html into a massive array

CodecubeI have a little project where i have to save an entire website's DOM, then do some operations, such as get the css computed style etc.. (this will be done with jquery) At the moment i have, written a couple of functions to get the HTML markup via cURL. Is there any way to then save this DOM into...

 
holly crap. You think you have issues with PHP Arrays? pastebin.com/HJBcvB5k
please help :P
 
lemme see
 
Gave you an Answer @Codecube
 
hmm not sure that is gonna worl
that is my code so far.
 
You can use PHPQuery in a number of ways
foreach(pq('tr') as $a)
{
    if (strpos(pq($a)->attr('class'),'section main') !== false) {
        $unitname = pq($a)['a:first']->text();
        foreach(pq($a)['li'] as $li)
        {
            if (strpos(pq($li)->attr('class'),'activity resource') !== false and !is_null(pq($li)['a:first']->text())) {
                //print pq($li)['a:first']->text();
                //print pq($li)['a:first']->attr('href');
            }
            else
            if (strpos(pq($li)->attr('class'),'activity assignment') !== false and !is_null(pq($li)['a:first']->text())) {
There is an example of how I use it
Really bad code don't judge ;)
 
3:08 AM
looks fine, what's the bad part of it :)? besides the swears
 
haha, I should probably rename that var
 
 
1 hour later…
user652649
4:41 AM
morning
 
@Wesツ Good Morning :)
 
user652649
hey
 
@Wesツ I need help
 
user652649
@Cody I need coffee
 
user652649
xD
 
4:47 AM
I need to know that when GET and POST response is cached
 
user652649
what do you mean? cached?
 
Are you kidding me ? :(
 
user652649
no. you made the question wrong. do you mean the browser, when it does cache the page and according to what?
 
user652649
@Cody
 
Yeah i mean browswer
 
4:53 AM
morning
 
morning
 
user652649
there's no difference between get and post
 
user652649
that's a request not a response
 
user652649
anyway, pages are cached accordingly to the Expires: header (http 1.0) and the Cache-Control: header (http 1.1) iirc
 
user652649
plus there are many other headers may be relevant... actually they may refer to older browsers... but you may want to set them too
 
user652649
4:56 AM
for example Pragma: header
 
user652649
also Last-modified: maybe can influence too the caching
 
here is my code pastebin.com/g526wuqb
 
user652649
and the ETag: header also... i don't remember any more... i guess that's a complete list
 
user652649
if you use var_dump surely you will get "headers already sent" error
 
It's commented
 
user652649
4:59 AM
so what do you want to do?
 
Here when i click Fill Form form is displayed using GET request then it get submit by POST . When i back from this page GET sends another header I read from some resource that

GET allows the browswer to cache a request - as no request is done again, no headers as well. POST does not allow that. As with post the request is not cached, there are headers
and if i submit this form again without modifying POST request is cached . Why is it so ??
 
user652649
5:15 AM
i don't understand what you're saying
 
@Wesツ See the gif
 
user652649
it's too fast
 
@Wesツ Wait let me create another one
 
m59
5:31 AM
Would you guys have an objection to an api that worked like site.com/api/table/field/value which basically did SELECT * FROM table WHERE field=value?
of course, this would allow someone to get any information from any table, so I'd have to think about how to restrict that and all.
 
good mornings
 
good mornings
 
good day people
 
Good morning!
 
any suggestions would be much appreciated
 
5:35 AM
@m59 there is some benefit by using named parameters: site.com/api/select?fields=*&from=table&where=field%3Dvalue
 
m59
@hakre ick.
Trying to stay as close to REST as possible.
My purpose is that if I make a new plugin or some such thing that uses its own table, then add it to my cms, I'd like its info (table) to be available in my api instantly without needing to attach it to the api in anyway.
from what I've read about REST, the url should be api/collection/item
but any system doing that would seem to require a method for each collection (which is more static than what I am looking for)
 
5:52 AM
@m59 Yes, REST is about resources. To stay in your table example, the table would be the resource. The query part could go into the query-info part and you need to consider how to update and delete the resource.
 
@Wesツ morning
 
So I'd say that REST is not a good manner to represent a database table as a resource (but that is a quick decision).
 
morning ... all*
 
user652649
morning
 
@m59 well inside your application you can parametrize that, so it's not more static per-se. That would only be by hte way you implement it.
 
m59
5:54 AM
@hakre ahhh, so my problem is somewhat that users/1 should return the resource (row 1, based on the id) whereas users/id/1 is not as clear that we are dealing with a row from users
yes?
 
@m59 Well technically the resource is the user, not the table, in that example.
 
user895378
/users/1 is vastly superior to /users/id/1 ... the latter is poor URI design
 
m59
and the user is a row, is what I mean.
@rdlowrey yes, I agree, but I can't find or think of an implementation that suits me.
 
@m59 well that is how you store a user in the database. but you must not hand that through to the rest API. You could also treat this as implementation detail.
Which has some benefits to keep changes local.
Which will prevent you to re-write the whole application only you change something somehwere.
And cool URIs don't change, that's true for REST as well.
 
user895378
5:57 AM
Good URI structure does not mean a 1:1 mapping to the database schema. It might happen to work out that way in exceedingly simple situations, but for the most part it's a vast oversimplification:
 
user895378
TDD: Table Driven Development. Apparently all PHP devs think application architecture means mapping ActiveRecord RDBMS schema to URIs. #sigh
 
m59
Yes, I greatly undertsand REST and the standard practices.
 
I have a number which must be in const range. How i must name errors when value is not in that range? When value more than range i can use 'overflow' word. But what word i must use when value less than range?
 
m59
@rdlowrey I stated a goal above...but it may not be possible with any standard approach.
 
user895378
Well I'd be shocked if you could find open source code that wrapped it all up with a nice bow on top for you :)
 
6:01 AM
@m59 Where you think it's not possible with a standard approach is actually the interesting part. Continue to look in there, differentiate more.
 
m59
It is important for me that the api can serve a request solely because there is a table (representing the collection) and therefore using a generic method.
 
user895378
Good architecture for any non-trivial application arises from careful, well-thought-out design for the problem at hand -- not one-size-fits-all canned framework solutions.
 
m59
so, it's totally feasible to do
api/users
api/users/1
api/users/1/name

.....but
 
.... but you could just use an SQL query?
 
m59
6:03 AM
that assumes to want to look them up by id.
huh? @hakre
 
user895378
/api/users/1 should encapsulate all the properties of user 1 ... a user's name isn't a resource, it's a property of the user resource identified by the number 1. There's no point in having /api/users/1/name
 
m59
how would you update user 1's name, then??
 
@m59 You update the user, not the name.
 
user895378
PUT /users/1 HTTP/1.1
Host: api.mysite.com
Content-Length: n
Content-Type: application/json

json body here is used to update the resource
 
Let's say I have five users named Paul. Now update the name Paul. Right. You update the user, not the name.
 
m59
6:06 AM
What I mean is....you're saying you replace the whole row everytime rather than just the appropriate field?
 
@m59 Well, if you look into your database manual, it will tell you that it doesn't.
 
user895378
No, how you persist the data in the backend has no bearing on your HTTP request.
 
m59
ah, I get it.
 
user895378
If you wanted a way to only get, say, the "name" property for a user I would do something like this:
 
m59
You mean you take the json name: 'newName' and therefore update the users name
 
user895378
6:09 AM
I wouldn't even use "newName" the PUT HTTP verb is enough to tell your application that you're performing an update. Just use the same format as you would if you were creating the record and go with "name."
 
m59
lol no
 
user895378
GET /users/1?only=name HTTP/1.1
 
m59
that was the value.....
 
user895378
oh lol, sorry :)
 
m59
name: Johnny is that better?
 
user895378
6:10 AM
Yeah, that's what I was trying to express :)
 
m59
Cool.
 
user895378
That request line above is how I would go about it if you want to only get a specific property (or properties) for a given user resource.
 
m59
So, I understand all of this (thanks for helping me clear it up a little bit)
I didn't quite get the individual record part
but yeah, I've read this stuff like crazy and still am not getting anywhere
My biggest problem gets into, like, filtering and resource identification
users/usernameHere
for example
that would require an individual method for the users that allows it to be identified by username rather than id
 
user895378
Yep.
 
m59
and would of course mean that you can't look it up by id now?
like an alias
 
user895378
6:13 AM
Don't see why that's a problem: you can just slap a unique index on the username column in your DB table.
 
m59
users/1 or users/blah
So, I could look it up by either, but it would still require an individual method.
and that's bad news for me.
 
user895378
Why should it be? How hard is it to add another method? Also, why would you want multiple ways to look it up? A major benefit of REST is resource addressability. Having multiple addresses for the same resource is like having two addresses for your house. It only complicates things unnecessarily.
 
m59
Hopefully, you'll be cool with just respecting my preference on this one, though I'd be ok with hearing your thoughts. I am HUGE on being able to easily attach/detach things. I was saying above that I want to be able to have any info I get (maybe via a plugin or some other functionality I create) to be automatically accessible in the api (no change to api folders and no additional file added outside of the plugin's own folder)
 
user895378
And if you do have multiple addresses for the same resource you start getting into territory where you need to designate one as the "canonical" address and look at potentially using 3xx redirects.
 
m59
I'm not as concerned with the multiple as I am with maybe my preferred one of the two...
 
user895378
6:18 AM
Do it however you want, but having multiple "IDs" defeats one of the major benefits of RESTful URI design (addressability).
 
Again: Cool URIs don't change. Applies to REST as well.
 
m59
like youtube looks up videos by id but users by username.
 
user895378
Not to mention it opens you up to duplicate content penalties from search engines if you aren't using something like a 302 Found redirect from the non-canonical URI to the canonical URI.
 
@m59 Actually the youtube video ID is quite like a Name in my eyes. Just saying, it's just that there is one kind of primary key to look-up a resource.
 
m59
yes, but they must have a method for each collection that determines what it is being looked up.
yeah, I'm great with that @hakre
But I want to choose what that key type IS
and still have a generic method
 
6:21 AM
@m59 well, your database table has this information. query it.
 
m59
I don't get what you mean by that.
The only way to choose what the key type is while using a generic function would have to be to pass it in the url.
I think.
 
Downvoters are downvoting without any reason stackoverflow.com/a/17206374/1679187
 
m59
users/1?field=id
users/johnny?field=name
which also has drawbacks.
 
user895378
Let me guess: you're using some sort of activerecord or orm?
 
m59
I'm not sure what that means.
 
user895378
6:24 AM
For your database access?
 
m59
pdo, mysql
 
user895378
Okay, cool. That's the right answer :)
 
m59
and prepared statements, all that goodness.
I understand that I am straying from REST practices and stuff according to what I'm talking out here, but I want to weigh the advantages/disadvantages...
 
user895378
To whom it may concern: artax now has full support for cookies without any effort from the user:
 
user895378
6:27 AM
$response = $client->request('http://www.google.com/');
$response = $client->request('http://www.google.com/'); // will send cookies set by the first response
 
@m59 No, you can ask the database table what the primary key is. So you can then query it. Without having the name of that column in the URI.
@rdlowrey bound to the client instance? (well why do I ask... :))
 
m59
@hakre boooooomshakalaakaaaaaaa for reals??
 
user895378
@hakre technically you have to do this first:
 
user895378
$client = new Client;
$ext = new CookieExtension;
$ext->subscribe($client);
 
m59
@hakre so it would just require an extra query at the start?
 
6:28 AM
@rdlowrey yes, thought so. that's why I was joking. So you can bind multiple clients to the same cookie store I guess, right?
 
user895378
Right.
 
@m59 Or when you build the application (reconfigure plugins)
 
user895378
The above code will only persist cookies for the life of the $ext object, but you can do this to store them in a file as well:
 
user895378
$client = new Client;
$cookieJar = new FileCookieJar('/path/where/you/store/cookies.txt');
$ext = new CookieExtension($cookieJar);
$ext->subscribe($client);
 
Good morning again :D
 
m59
6:31 AM
ok, I'm decently satisfied with that, but then what about filtering? To show you what I mean, here is what i was thinking before...
users/today?field=joindate

and I would get all of the users that joined today. What would be an approach to that?
 
When I execute database functions, is there a way I can see more details about the variables that are executes ( Not var_dump ) echo but I mean when they are used and what there value is. ( Im using sometimes last_inserted_id but I would like to see the route it does).
 
database functions... ?
 
user895378
/users?joindate=today
 
m59
SELECT * from users WHERE joinedate=today ?
 
user895378
6:33 AM
strtotime('today'); // this is php we're talking about here, don't be a numpty
 
users/password?field=id
 
m59
heh, you know what I meant
woooot
 
user895378
yeah, something like that :)
 
m59
great, now I'm narcolepsin. I got excited that I'm getting somewhere.
made that ^ word up I think.
 
I'll show an example:
 
6:34 AM
Narcolepsy is a chronic neurological disorder caused by the brain's inability to regulate sleep-wake cycles normally. It often begins mildly and progresses over a period of time until it reaches full manifestation. People with narcolepsy often experience disturbed nocturnal sleep and an abnormal daytime sleep pattern, which often is confused with insomnia. Narcoleptics, when falling asleep, generally experience the REM stage of sleep within 5 minutes, while most people do not experience REM sleep until an hour or so later. REM sleep is where most dreams occur. One of the many problem...
 
m59
Yeah, that ^
 
user895378
Insomnia, or sleeplessness, is a sleep disorder in which there is an inability to fall asleep or to stay asleep as long as desired. While the term is sometimes used to describe a disorder demonstrated by polysomnographic evidence of disturbed sleep, insomnia is often practically defined as a positive response to either of two questions: "Do you experience difficulty sleeping?" or "Do you have difficulty falling or staying asleep?" Insomnia is most often thought of as both a sign and a symptom that can accompany several sleep, medical, and psychiatric disorders characterized by a persis...
 
$client_id I would like to see how it got stored when executed
let's say I receive it from ' last_inserted_id'
 
@YogeshSuthar don't answer such crap questions. Just vote to close them:
^ crap crap crap - let's keep it out of the kitchen.
 
Is there a way I can see more clear when it got called and where it's going to and the value?
 
m59
6:36 AM
Well, it may be a matter of time before my face hits the keyboard, so I probably have to get going soon.
Ok, so @hakre, you talked about checking the primary key in the db without having to do it every api call? How would I cache that?
if that's what you meant.
 
@m59 Yes, meant it that way. It's some kind of caching or better worded configuration because that data won't change after you've designed the table.
I would first not care about performance and just integrate the method that is getting that value.
Later on that method could use some store so that this happens transparent to the rest of the application.
 
m59
yeah, I see what you mean.
 
Which is bascially caching, so, yeah, caching :)
 
m59
Craaaappp, I really want to write come code.
 
But most importantly, just do it first. Get it to the run, don't worry about any caches when you start.
 
m59
6:41 AM
Yeah.
 
In the end the mysql is that fast and has this info anyway so that you don't see any speed differences at all
 
hi guys, can anyone advise me of a faster alternative other than using subqueris to find another id from a different table. Heres an example

http://pastebin.com/PvuNXxEp
 
@tomexsans Have you tried adding more RAM to your database server and give it faster platters?
 
Just asking, ... When u use a framework did you noticed you made less mistakes then you were writing in plain php?
 
@Duikboot Err, no.
The difference is that next to your own mistakes you only need to confront yourself with other persons mistakes as well.
 
6:45 AM
@hakre, i have not tried it since i have no control over the server, can i do this on a shared hosting settings?
 
@tomexsans well, in that case you contact your hoster and tell them their database server is slow and you ask them how to improve this.
 
That seems to be a clear answer, does using a framework improve your time to release a project?
 
m59
I'm just going to recap...
api/users //just return the table - users
api/users/1 //check table users' primary key and use that to return the row
api/users?field=value //return any users where column "field" = "value"
@hakre @rdlowrey
The implementation would be generic and handle everything?
 
( Some questions came up in my head last night )
 
user895378
Looks fine to me
 
m59
6:46 AM
Rockin!
mind if I pick your brain just a little more? This is huge for me!!
 
@m59 This looks much more polished now. Very fine.
 
@hakre , thank you but by any case is their other alternatives other than subqueries which is faster or even just in microseconds i think this would help?
 
m59
Gosh, I can't tell you how much I appreciate this.
 
@hakre Ok thanks. :) voted.
 
m59
Also just thinking about authentication levels and stuff. Obviously, I can't just return all tables and all fields in all rows.
 
6:49 AM
@tomexsans You could right join with the second table on id and only select those that have NULL there. That should be much faster, however this highly depends on the database server. What you actually need is some testbed you can try mutliple query strategies. Must be nothing big, can be just a script to compare multiple queries.
 
m59
That would give out passhashes and all that.
 
@m59 Well, you can do updateable views in your database that are used for the resources.
 
m59
Could you elaborate?
I am really struggling hard to stay awake, so I can't quite explain what I was thinking before. Something about a table that would flag other stuff for public availability...
 
Can I reset my ID from sql tables to a specific one
 
@hakre , thank you sir
 
6:53 AM
I would like to start some tables for the next inserts from ID 2. ( 1 is already filled) Because I neverdeleted the first row while testing
 
@m59 A view in a database is feeling like a table - albeit it's just a pre-configured SELECT query representing the table. So you could have a view on users without the password hashes.
The updateable variant of a view can also be updated. The database server cares of all this, for your application this looks like a normal table.
@Duikboot yes you can. search for "next insert ID"
 
m59
table acesss
row users
fields name=0 image=3 password=x

0-5 access levels, x for self only, something like that @hakre
I'm reading through your suggestion also.
 
@m59 well, if you do it that way, you need to have more configuration than a single view. probably using multiple database users and then configure it in the database which user can access which view.
the other alternative is something like RBAC on your objects and methods, but it sounds to me you are trying to re-implement a key-value store with a REST interface so far. So you probably will gain much more benefit by not over-generalize everything.
 
user895378
FYI RESTful applications are stateless ... that means that authentication should generally be handled using HTTP headers on each request. This isn't a big deal because API consumers aren't browsers ... they have control over and can easily send authentication headers with each request. You determine on each API request the level of credentials for the user making the request with a custom HTTP header scheme based on a keyed-HMAC.
 
It makes you looking into the wrong places too often.
 
user895378
6:57 AM
Once the authentication process is complete you should know what permissions the user has and you should be able to incorporate that into your db queries.
 
Maybe just get some sleep for the moment and keep the results with you.
 
posted on June 20, 2013 by Christian Weiske

A discussion how to load html files properly and run XPath on their DOMDocument objects. Loading html content The correct way to load a html document is to fetch it via HTTP with the Accept header listing all the MIME types your application understands. Accept: application/xhtml+xml; q=1, application/xml; q=0.9, text/xml; q=0.9, text/html; q=0.5

 
m59
@hakre Ah! I understand what you mean about the view. I don't quite understand how I would be able to get/save/change the passhash if the db isn't giving it out
 

« first day (978 days earlier)      last day (3973 days later) »