Posts

php - Adding parameters to the relation in laravel -

i have query uses many ->with() in laravel so: $campaign = $this->campaign ->with('tracks.flights.asset')->take(4) ->with('tracks.group') ->with('tracks.media') ->with('tracks.flights.comments') ->orderby('created_at', 'desc')->find($id); and in track model have method: public function flights() { return $this->hasmany('flight\flight')->orderby('start_date'); } what want achieve having same result want put date constrains on flight level, example this: public function flights($start_date, $end_date) //dynamic dates { return $this->hasmany('flight\flight')->whereraw('start_date > $start_date , end_date < $end_date')->orderby('start_date'); } how can achieve kind of result? new laravel. thanks in advance. chain wherehas onto query. $campaign = $this->campaign ->with...

How to only show tableau column subtotals -

i trying show column subtotals in tableau. when select analysis>"show subtotals", row subtotals show well. can please advise on way hide row subtotal column? click on caret @ right side of field on row or column shelf corresponding subtotals wish turn off. when see list of menu commands, uncheck subtotals field

sass - How to remove gutter for first and last element of row in Susy grid -

how can remove gutters first , last elements of row while using susy grid? this mockup markup. http://codepen.io/anon/pen/mvbmly $susy:( columns: 12, gutters:2, gutter-position:split, ); ul{ @include container(800px); } li{ @include span(4); } it uses "gutter-position:split". can see on codepen, first , last element in row still have outside margins. i can work around setting gutter-position "after" , using "last" keyword on last element in row. http://codepen.io/anon/pen/ejgwke $susy:( columns: 12, gutters:2, gutter-position:after, ); ul{ @include container(800px); } li{ @include span(4); } li:nth-of-type(3n+3){ @include span(last 4); } is there other way? using nht-of-type selector kinda defies point of using grid me. after bit of experimenting, managed create mixin provides such functionality: @mixin new_span($elements){ @include span($elements); $n: map-get($susy, columns)/$element...

Python 3.3 Encoding Issue -

i have sql database has encoding issues, it's returning me result similar this: "cuvée" from can tell because encoded latin-1 when should have been encoded utf-8 (please correct me if i'm wrong). i'm processing these results in python script , have been getting few encoding problems , have been unable convert it's supposed be: "cuvée" i'm using python 3.3 using codecs.decode make change latin1 utf-8 i'm getting: 'str' not support buffer interface i think i've tried found no avail. i'm not keen on going python 2.7 because i've written rest of script on 3.3 , quite pain rewrite. there way unaware of? yes, have called mojibake ; latin-1, or windows codepage 1252 or closely related codec. you could try encode latin-1, decode again: faulty_text.encode('latin1').decode('utf8') however, sometimes, cp1252 mojibakes, faulty encoding results in text cannot legally encoded bytes, bec...

javascript - window.matchMedia('print') failing in Firefox and IE -

i have print button launches print functionality on webpage. button hides user clicks on , shows if user done printing or presses close in print window. works fine in chrome failing in firefox , ie. <input type="button" onclick="launchprint()" value= "print me" /> function launchprint(){ $(".print-box").hide(); window.print(); } (function() { if (window.matchmedia) { var mediaquerylist = window.matchmedia('print'); mediaquerylist.addlistener(function(mql) { if (!mql.matches) { $(".print-box").show(); } }); } }()); any suggestions may missing? unfortunately, on same problem , did research. seems bug exists on recents version of ff , ie still , hasn't been fixed. you can check out bug firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=774398 i found person having same issue , hasn't satisfying answer: https://social.tec...

hibernate - Storing date, time, and timezone in PostgreSQL with Grails and GORM -

i have grails 2.5.3 application connecting postgresql, , want store java date or calendar object in database, , include time zone. based on postgresql documentation , default timestamp type not include time zone, need use timestamptz type include time zone. unfortunately when try set in mapping closure of domain class, fails. i'm trying use this: createddate type: 'timestamptz' and error receive is: nested exception org.hibernate.mappingexception: not determine type for: timestamptz unfortunately list of hibernate types not seem include map value. ones related dates are: date , time , timestamp , calendar , calendar-date . have tested each of these, , none of them create desired timestamp time zone in postgres. there articles talk creating custom hibernate usertype this, seems common use case, , can't think there should let me working out of box. you can create own dialect , map java type sql type. can see how it's done in grails-p...

php - Apache Htaccess - Rewrite Rules Conflicts and/or Order -

i don't use .htaccess often, had setup local webserver , ended following rewrite rules: # settings: general options +followsymlinks rewriteengine on rewritebase / # settings: protocol rewriterule ^ - [env=proto] rewritecond %{https} on rewriterule ^ - [env=proto:s] # remove www (https://www.example.com/ -> https://example.com/) rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^ http%{env:proto}://%1%{request_uri} [r=301,l] # versioning (main.20150826.css -> main.css) rewritecond %{request_filename} !-f rewriterule ^(.+)\.(\d+)\.(?:bmp|css|cur|gif|ico|jp(?:eg?|g)|js|png|svgz?|tiff?|webp)$ $1.$3 [l] # forbidden/missing resources (403 if directory/file starts '.') rewriterule (?:^|/)\. - [f] # missing resources (403 if file/directory not found) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ - [f,l] # hotlinking prevention rewritecond %{http_referer} !^$ rewritecond %{request_filename} -f rewritecond %{request_filena...