Posts

php - Carbon::parse("25/10/1980") throws an error -

i'm facing odd issue, carbon::parse("25/10/1980") throws following error: exception message 'datetime::__construct(): failed parse time string (25/12/1980) @ position 0 (2): unexpected character' while having no problems whatsoever, if month (10) swapped places day (25) this: carbon::parse("10/25/1980") how should parse "d/m/y" string? try this: carbon::createfromformat('d/m/y', '25/10/1980')

reactjs - Global events and component's local state -

so have component, , let's when click on should trigger state change, e.g.: :on-click #(om/set-state! {:activated? true}) now, if want "deactivate" when clicked anywhere on document? guess use addeventlistener hooking onto document object, this: (componentdidmount [this] (events/listen (gdom/getdocument) (.-click events/eventtype) #(om/set-state! {:activated? false}) true)) now want, first of if have 200 instances of same component have 200 event listeners, right? which not desirable ok, guess the real question though how distinguish 1 instance of component when setting state? don't want of them "deactivated", 1 in context click event handler being triggered i think title of question points real problem: global events affecting local state. sounds me notion of being "activated" doesn't belong each of these components (as local state), higher in tree. otherwise, they'd function independently....

java - Spring Security multiple url ruleset not working together -

i have http spring security configuration appears work when comment out each individual aspect doesn't work when combine spring security rules together, know problem not regexmatcher or antmatcher rules applied in combination. here spring security class: package com.driver.website.config; import org.springframework.beans.factory.annotation.autowired; import org.springframework.beans.factory.annotation.value; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.security.config.annotation.authentication.builders.authenticationmanagerbuilder; import org.springframework.security.config.annotation.method.configuration.enableglobalmethodsecurity; import org.springframework.security.config.annotation.web.builders.httpsecurity; import org.springframework.security.config.annotation.web.builders.websecurity; import org.springframework.security.config.annotation.web.configuration.enablewebsecurit...

c++ - 433 Receiver Arduino if statement -

433 mhz receiver arduino environment the transmitter sends y , n or m works fine. problem lies in receivers code. goal is, after receiver has value message equal n, suppose trigger if statement thing. need have system can determine if receiver takes in specific value. void loop() { if (vw_get_message(message, &messagelength)) // non-blocking { serial.print("received: "); (int = 0; < messagelength; i++) { serial.write(message[i]); const char *p = reinterpret_cast<const char*>(message); if(p == "n") { serial.print("if statement works when = n"); } } } } the problem, not job, , after 2 weeks of struggle, @ loss. code compile , run, if statement ignored. if (p=="n") compares 2 pointers. while contents point can identical, not mean pointers equal. you may want strcmp (c style) or std::string::...

javascript - Displaying a DIV larger than its parent DIV -

i have 2 divs want display on same row (one on left, other on right). the left div: .leftdiv { position: relative; display: inline-block; width : 30%; } the right one: .right-div { float : right; width : 40%; background-color: lime; } the left div wraps 2 other divs: dropdown-content displayed after clicking on dropdiv . i want dropdown-content take half (50%) of page when set width 100% can not larger parent leftdiv (which must not exceed 30% of page). how fix this? js bin you can set 50vw (50% of viewport width).

ruby on rails - How to lazy-set Mongoid association -

i have 2 models associated has_one relationship. have callback initializes association. classes (roughly) this: class user has_one :relevance, class_name: 'user::relevance', inverse_of: :user, dependent: :destroy after_create :initialize_relevance def initialize_relevance self[:relevance] = user::relevance.new end # other garbage *should* irrelevant end class user::relevance belongs_to :user, inverse_of: :relevance, index: true # more other garbage *should* irrelevant end sometimes relevance association gets wonked state nil. when happens, want re-initialize relationship when called , return instead of nil. in class user , have this: def relevance self[:relevance] = user::relevance.new if self[:relevance].nil? self[:relevance] end except doesn't work , nil still returned. i've tried same update_attribute(user::relevance.new) , self.create_relevance nil seems returned. not sure go here , love ideas. can provide more code...

ember.js - Ember js warning with three.js -

what correct way use ember js three.js . have tried using cdn editing index.html file works fine warning in ember-cli three not being defined. installing bower , using app.import gave me similar warnings. the app works fine wanted know best way import in case three.js ember application without warnings. that jshint warning because isn't aware of global three variable you're trying access. have 2 ways fix it: put globals directive @ top of file uses variable. setup .jshintrc 's predef . hope helps!