« first day (1313 days earlier)      last day (3861 days later) » 

00:51
0
Q: Post-redirect-get help (Document Expired)

iheartbreakzRight now if I add an item to the cart.. then press checkout button I get to the checkout page after that when I press checkout again, I will be on shipping details page... But when I press the back button in firefox, It gives me a message saying "Document Expired". I understand there are 3 solu...

 
4 hours later…
04:53
morning
user924016
Morning
you said "setters should not be validating the data" at the top of your post, then you said I have two validation options one of which is "validation in each setter" and then at the bottom said "validation in setters is only the viable solution". And on this post from today stackoverflow.com/questions/15050497 you said "Data validation on setters fails, when you have multiple bound parameters." You seem to be saying different things all the time no wonder I am so confused. — David Feb 24 '13 at 11:55
for suck sake
is it so fucking hard to read a whole sentence ?!?!?!
and the "accepted answer" basically advicated for "validation in constructor" .. bunch or retards
so ... how's your morning ?
user924016
05:09
=]
user924016
Abit early for me, still tired, just made some coffe.. how about you?
pissed of at stupid people
user924016
haha
user924016
Weather is suppose to be super today..
not really
05:15
moin
user924016
Morning
Also, I cannot figure out how this answer got accepted and upvoted so much
basically, I am pissed off and it's not even 9AM
user924016
Did you follow the linking to stackoverflow.com/questions/1651964/…
hello
yes, I did
public class Name

  public static Name From(String value) {
    if (string.IsNullOrEmpty(value)) throw new ...
    if (value.contains(' ')) throw new ...

    return new Name(value);
  }

  private Name(string value) {
    this.value = value;
  }

  // other Name stuff goes here...
}
for fuck sake
user924016
05:21
=]
why is that when i use that code
for PRG
I can't pass values using session
anything wrong with my code?
@user3291093 stop using @
also, jsfiddle is for javascript ... the hint is in the name
yes i know
i just didn't know what else to use
user924016
@user3291093 did you start the session?
paste.org wasnt working
yes i did start the session
05:24
> Use viper-7.com, eval.in, pastie.org, 3v4l.org, gist.github.com or pastebin.com to post code when asking for help.
it works fine without that code
i am also using:
if (isset($_GET['start_prg'])){
simple_prg(true, 'PHP_SELF');
} else {
simple_prg(null, 'PHP_SELF');
}
as my header
what the hell are you trying to do !?
user924016
lol
well i needed to use post-redirect-get
for my shopping website
and now i m trying to pass the different values for shipping
like for canada, america etc
I meant - what the hell you are doing in that code
post redirect get is not done with 303 header
you use a location header instead
05:26
ok well
i have locationheader right underneath it
and i tried taking out the 303 one too
still not passing values
and this is what i m using after session_start in header
$option = $_POST['shipping'];
if ($option == "2") {
// blah
} else {
//blah
}
works fine if i take the prg stuff out
here is the whole script all togather
anyone knows angular here ? No one in JS ROOM
I took the @ and 303 header in my code
user924016
@samitha abit
I have a scope issue
can you help me to debug
?
user924016
@user3291093 why are you putting a @ in front of $_SESSION?
user924016
05:35
@samitha I might be able to, do you have a plnkr or something?
i was having problems before so i was suppressing the error messages
but i took it out.. it didn't help
i need to use barChartData variable in the jquery codes
@RonniSkansing
user924016
@samitha I never worked with jQuery side by side with Angular =/
Jquery is for Chart only
user924016
05:41
The barCharData is also never declared
why not
var barChartData = null;
user924016
Missed that one.. You should strive not to put stuff in the global space.
user924016
So, when success or then is called, then you call you chart thingy.
user924016
The code is not run top to bottom
user924016
05:47
Just look at $(window).load(function () {
user924016
Does it make sense to you?
@RonniSkansing is there any thing else wrong on my php code?
user924016
jsfiddle.net/ReKKv << that one?
yes
sorry for using jsfiddle :p paste.org didn't work but now i used pastie.org
user924016
@tereško I have read trough a couple of the questions. As I understood it, you do not appreciate throwing exceptions in the construct, if validation failed (validation in constructor)?
user924016
05:57
@user3291093 you might need to stop the execution of the script after setting header, else it might just continue executing code, unless that is the intention
i had an exit there in the code.. but when i had it.. it wasn't let me add items to my cart
for some strange reason
tried with die too... but values are still not being passed
i know i m setting values right because i remove the prg code from header
and all works good
user924016
Yea, well I have to admit I find the script abit hard to grasp. =/ I would recommend debugging it
user924016
put in a couple break points and see what is going on.
hmm
appreciate your effort
user924016
np. and make sure you never have those @ in front of sessions again =]
06:08
haha yes
took them out
06:27
array_push() or $arr[]?
the latter
user924016
^
because operator > function call
also, opinion doesn't count here ... it's matter of fact ;)
I always use $arr[] syntax. It's just cleaner.
@JoeWatkins isn't the performance difference too small for something like this?
okay, say I said "I always use array_push, I prefer function calls", would that be defensible ??
user924016
06:31
Sure
no it wouldn't
no it is not, having the standard to prefer the poorly performing awkward version (in every way) would be actively harmful to any code base I worked in, it's not a matter of opinion, you should use the operator if available ...
user924016
That would be a personal opinion
I don't think opinion matters, there are facts involved ...
user924016
"You have a right to own beliefs not your own facts" =]
This answers describes the fundamental difference between two functionally equivalent constructs. This is not opinion-based, since the doc itself states it might be the better option in this case. But it's also true that the mentioned overhead is really thin. A quick benchmark shows a difference of about half a microsecond per run, this is not even hardly noticeable on most of the code you'll write. — swordofpain 2 mins ago
Last sentence reflects my opinion. :>
06:33
how many applications have one use of array_push or [] ?
that's a stupid test, its about having a sensible standard, it's a matter of fact that operator > function call, so to establish a standard that says you should prefer the worse option is silly ...
so the only sensible standard is to prefer the better option, obviously ...
@JoeWatkins And why exactly is [] better aside from the slight performance differences? Because it's an operator, not a function?
user924016
Oh, I do not prefer the worse option.. =] I just think If someone says, I prefer this, well that is their opinion and not a matter of fact.
user924016
Like when people say, I love framework X and I think it is the best
user924016
Their opinion, not facts.
that is a matter of opinion, lots of frameworks, lots of use cases, [] and array_push have a single use case, their usage should be governed by all the facts which we do actually have ...
user924016
06:36
Hmm
user924016
Well... after given it some consideration. I can agree to that. Did not really consider it like that
Second Rikudo, Some wasteland, crushing any resistance.
56.1k 19 76 127
:D :D
user924016
yea!
Got PHP, CSS and JavaScript badges :D FTW
BLASPHEMY!
06:39
Next up, jQuery gold badge!
/me cries in a corner.
@RonniSkansing you should not have any logic in the constructor at all
@AmalMurali depends on whether you will be able to write array_push($list, ..$items);
user924016
Thanks. Do not know why that did not creep on me.
@tereško this is good, yeah ...
oh ... it actually is ... (three dots)
06:45
yeah ... I do that ...
What is it called and what does it do?
variadics (sp?)?
user924016
Cognitive scientist George Lakoff considers the concept of infinity in mathematics and the sciences as a metaphor. This perspective is based on the basic metaphor of infinity (BMI), defined as the ever-increasing sequence <1,2,3,...>. Wikipedia
we are calling it variadics now ...
it's vararg from c, it's always been there ...
I think it would be about even, if you could pass multiple arguments I mean, looping over the array in userland to use the operator would be about even to passing a bunch of parameters to a function ....
I still prefer the operator in that case, so I'd still prefer the standard to use the operator ...
@RonniSkansing .. continuing the proud tradition of scientists commenting on concepts way outside of their own field
user924016
damn
@SecondRikudo: Not really a duplicate (with the edit)
yeah he changed it ...
I think the original question made sense actually ...
@AmalMurali link?
06:53
Good morning.
I kinda think if you thought that was impossible you're missing the point of programming on some level ...
Good morning to all
I guess it wasn't a great question, I don't think he really wanted that output, because he's changed it, he's saying he wanted to process that element some how, or that's what I would have assumed ...
user924016
http://stackoverflow.com/questions/23776084/htaccess-rewrite-not-working-on-localhost-for-a-php-application

fun reading.. previos dev used Symf.. maintainer tried to use Dreamweaver (and started from scratch)... wall of text =]
07:01
@AmalMurali I already reopened it :)
@SecondRikudo Yeah, hadn't refreshed the page :-P
inb4 5 more answers with the foreach
That wink, Tony Abbott... the last time I saw someone that creepy he was slithering up to Eve. #auspol
@TheTweetOfGod you were present for the snakes approach ?? you're a real piece of work !!
@AmalMurali foreach is most readable.
@SecondRikudo indeed. But do we need multiple answers with the same thing?
@AmalMurali No, we don't.
Which is why I generally upvote one and leave the rest.
Downvoting all other answers is a pain.
07:08
Hello.
user924016
Hi @MikeM.
@RonniSkansing How are you?
user924016
Tired, but fine thanks
This is the same as this answer and this one. Not sure if having another one with the same content is going to be helpful. — Amal Murali 6 mins ago
It now has 1 upvote, so I don't think he will delete it. Ah well...
I think it generated enough crap for one day.
07:10
already CV-d
What can cause this: i.imgur.com/EJMTLZl.png on a website? I see it change when I scroll in my page.
Slow browser?
morning
Can't be the issue. @AmalMurali :/
07:20
@Duikboot dunno. Which website?
@Duikboot One thing for sure... Not PHP :D
:D
It sucks :(
user924016
@MikeM. and how are you?
How do handle classes that depend on a PHP class without an interface like Memcache? It looks like I can only make it testable by having a wrapper class or just not typehinting it. Both options seem suboptimal
user924016
Could you put those words in some mini code example?
07:31
class Example
{
private $memcache;

public function __construct(\Memcache $memcache)
{
$this->memcache = $memcache;
}
}
The problem is that now I am not able to mock the memcache class
@Patrick Can't PHPUnit mock those classes?
user924016
You could: remove the typehint, mock the Memcache or make a role interface and hint that
I am fine having math :(
@SecondRikudo Haven't tried, I to write my own mock classes instead of having to overwrite every single method with PHPUnit (which leads to uneccessary long and unreadable tests)
@Patrick You don't need to rewrite every single method. If you do, you're doing your tests wrong.
Each test should override one or two methods, not much more.
The mock doesn't need to be shared between tests
07:37
@Patrick if you actually want to use any cache with that class, you should write a common interface
also, mocks (if you do not need a mock to produce another mock) do not make tests all that complicated
I see. I did not write this class but have to write the tests for it... Thanks for the suggestions
user924016
@Patrick maybe this is of use, if you have not read it before phpunit.de/manual/4.1/en/test-doubles.html#idp1117008
@RonniSkansing I had to use it quite a bit when testing things using the doctrine entity manager, it usually ended up quite messy :(
I would use something like this:
07:47
hai all...
I hav a doubt
$cache = $this->getMock('\\Memcache', ['method1', 'method2'], [], '', false);
where:
getMock($className, $methods = array(), array $arguments = array(),
        $mockClassName = '', $callOriginalConstructor = TRUE,
        $callOriginalClone = TRUE, $callAutoload = TRUE)
user924016
nice
I am using password_hash(). In that "cost" can be set up to 31. Will change the speed of server when increase the cost value??
if you need specific returns from those methods, or check if specific value was passed, you use:
@Arun The "cost" parameter indicates how many iterations will happen on the password,
07:50
$cache->expects($this->once())
      ->method('method1')
      ->with($this->equalTo($foo))
      ->will($this->returnValue($bar));
cost of 31 = 2^31 iterations, which is ~2 billion. If your server can handle 2 billion iterations in acceptable time (hint, it can't), you can use a cost parameter of 31.
that should set you up with all that you need, @Patrick // cc @RonniSkansing
@Second Rikudo, Can I check the speed in the server?
@tereško Thanks
@Arun Google "php benchmarking"
@Arun The goal is to make it run for not much longer than 0.1 seconds
07:53
@Second Rikudo, Thank you
Because that's acceptable for a user, but impractical for an attacker.
Word up.
@Fabien Have you read?
Nope. Might save it for a boring 5 minutes.
@Seco
@SecondRikudo: ok..
07:55
Good, I like your needs. — Leri 14 secs ago
:)
hello friends
I have a problem with docusign API Integration
Any one can help me?
Mornign room
user924016
nginroM aaHeeP@
@RonniSkansing You misspelled. :)
user924016
darn! =]
Epic titles are epic: NoSuchElementException for my poker game Java.
@PeeHaa Really?
Seems like a server restriction issue to me — asprin 21 hours ago
@SecondRikudo Yes totally! Now start fixing OPs HTML damnit! :D
08:01
@RonniSkansing it's &#8207; for that :p
user924016
=] cool
‮@AlmaDo what?
like that
btw, I was pinged by it. So it's right-to-left mark :p
is there a way for object to know within which namespace it was initialized ?
basically, what I want is:
@tereško No not without passing it or raping sanity by parsing a stacktrace AFAIK
08:05
=/
that's kinda sad
user924016
return _NAMESPACE_ would not do so?
"initialized = constructed" ?
@salathe moonings
@RonniSkansing no
user924016
08:06
oh
hi, @salathe
namespace Foobar;

$test = new \SomethingElse\Test;
echo $test->getContext(); // outputs "Foobar"
this is what I was looking for
@AlmaDo initialized > constructed, no?
@Leri that's why I've asked
@tereško Nope AFAIK without some "container" in which you pass the NS not possible
08:10
yeah .. thought so
@tereško you could get the filename the method was invoked at and parse it with tokenizer
^ that's bad
That's hack ^^
@Leri define "hack"
@zerkms I think I lost few IQ points from even understanding it
=/
08:12
@zerkms Workaround that can be avoided. :)
getting stack trace + parsing are well defined and easy concepts :-)
@Leri can be? :-)
7 mins ago, by PeeHaa
@tereško No not without passing it or raping sanity by parsing a stacktrace AFAIK
yeah , so the short answer is: no, you cannot
Note the raping sanity part ;)
and the a bit longer answer is: yes, you can, but you really rally shouldnt
08:13
so people blame @PeeHaa
@zerkms Yes, by not getting namespace at all and rethinking why would you want that. :)
Gees the flags from c++ are getting more stupid with the day
@Leri it's @tereško who asked it. I wouldn't tell him "you should not do that"
08:14
he assumes that I will be able to deduce it myself =)
@zerkms Parsing stacktrace and using that in production code is something that should not be done. It does not matter who tries to do it, I'd say that because I am sure there. :)
@Leri hi
Also I've seen very few cases where "dirty" solutions does not have clean alternatives once you rethink your problem. And I bet @tereško can do that. ))
@Udaikumar Hello(?)
@Leri I have a problem in docusign API Configuration
@Leri Do you have any idea of it
@Udaikumar Yes, there's something wrong with you code.
08:19
@leri please check this link stackoverflow.com/questions/23758019/…
@L
@Udaikumar indeed there is something wrong with it
@Leri I am not able to do any thing with it. Can you give any suggestion or solution
mornings
hi
how to add element in existing xml
@user3384222 $xml .= '<tag>value</tag>';
or regular expression if you need to insert it in the middle of the document
08:27
@user3384222 1) Load document into DOM 2) Add element to document 3) ? 4) Profit!
@tereško btw, why do you need that? What's the use-case?
@zerkms really?
@DaveRandom yep
Y U NO USE TOOL FOR JOB?!?!?!?!?
@DaveRandom you just learn regex once and then you can do everything with it
08:29
You just learn DOM once and then you can do everything properly :-P
@zerkms That's like saying the same for jQuery..
@SecondRikudo a good point. You learn regexes and jquery and then you can do literally everything in web
6
@AlmaDo the damned di container thing
@tereško still playing with dics? :-D
08:34
^ never gets old
The joke or the maturity level? :P
I've listened a lecture about DIC - and realized that it's not what I want to do
I long since gave up on the maturity level, so now I'm just looking for a puerile-yet-timeless joke
@AlmaDo I am actually thinking about removing that lecture and placing in the list another one from @ircmaxell
because the DI container, that is described there is actually a service locator
@tereško well, that would be great (because lecture about DIC & other "advanced" patterns was a little bit boring & not so clear)
08:36
Guys say you have an API your contacting for some data. All you're doing is displaying that data on your own site. domain.com/request/project-name/method/tickets. What sort of process would you follow to get from request to page display? I know that's a fairly sizeable question but a small couple of keywords like a process map might help.
@Fabien As part of your application, you need to take a user's request, part of that (say because of a POST var) means that your app requires data from a third party API, and then you return that to the client-side. right?
Yeah. Here is the API i am contacting.
rowing
@Fabien Adapter pattern, write a class that 'gets' the data, another that validates it to be as you expect, and another that converts it (the adapter) into valid objects your application expects
^ If anyone has any opinions on that, I would be interested
Currently I have most of this done but I feel it's a bit immature as a process.

Dispatcher contacts Request Handler-> Request Handler (Chooses right class for request) -> Class for each part of the API with Artax sends request result back to previous Request Handler -> Handler uses Twig to turn the response in to a HTML string (for JS). -> Dispatcher receives this and echos the content.
08:47
Sounds like the Request Handler both chooses the right class for request (not sure if that's a factory?) and also turns it into what the template needs
Yeah
The last part I dislike a lot
Anyone more experienced an opinion on the above? I'm interested too :-)
A better method for knowing what request should belong to what template. I could put this with the classes that are for each API module.
The other issue is I feel like my classes are too dependant upon each other. I need to focus on that too.
@SecondRikudo Typical anime resorts to tentacles. -_-
08:52
@Fabien You have two layers called "request handler"?
@Udaikumar 1. Why do you send xml in headers? 2. Why did you ping me?
@DaveRandom No. It goes back to the original one.
RequestHandler is more appropriately known as CodeBase's API RequestHandler.
Saw it ... Why on earth would he/she say so, I tested it with Firefox browser and Firefox OS simulator ... It was working pretty nyc. Although it damn slow on android when installed via Firefox browse. :'( . this is so uncool .. First app of life sucks. :'( . and I don't know the reason
Handles the choosing of the right class for the requested content. And the conversion of that request result to the template (HTML) for JS.
Breaking some principles :(
@Fabien OK well it seems to me that what you want to do is put the control for rendering back in the hands of the dispatcher by having the handler return the API response, and then the dispatcher passes the response to a TemplateRenderer (sucky name but you get the idea)
08:57
Aye.
Help me
As it stands your handler definitely has two distinct responsibilities that aren't really anything to do with each other
Problem is my Dispatcher is actually just an callback function at the end of the $router->addRoute() function. So appending more code in there feels a little wrong.
Maybe I move RequestHandler in to my Services folder.
@Fabien Don't see why that's a problem. You may put to shove an intermediate layer between the dispatcher and the handler though
08:59
May i ask a question related with shell script ?
$router->post('request', '/request/{project}/{method}/{location}/{parent?}/{child?}', function(\PitchBlade\Router\Route\AccessPoint $route, \PitchBlade\Network\Http\Request $request) {
    try {
        $injector = new \Auryn\Provider;
        $injector->define('\PitchBlade\Network\Http\RequestHandler', array(':route' => $route, ':request' => $request));
        $handler = $injector->make('\PitchBlade\Network\Http\RequestHandler');
        $response = $handler->response($injector);
    } catch (\Exception $e) {

« first day (1313 days earlier)      last day (3861 days later) »