Posts

mysql - Create Eloquent model from complex raw SQL-query -

i thinking right design of method gives user list of clients who's last appointment long time ago. so have 2 table (simplified): clients (id, first_name) appointments (id, client_id, datetime) what trying do: list of 3 clients who's last appointment long time ago. so do: select users oldest appointments , return them (with complex sql query). create models them. is design case? use illuminate\database\eloquent\collection; class clientrepository { /** * clients no appointments in near history (sort date of last appointment asc) * * @todo make better way find falling clients (more laravelish maybe?) * @param $count how many clients should method return * @return illuminate\database\eloquent\collection */ static public function getlost($count=3) { //this sql looks long works charm //solution based on http://stackoverflow.com/questions/1066453/mysql-group-by-and-order-by $sql = " s...

php - Calling token_get_all from c program -

i'm trying write c program can analyse php scripts various reasons. need call token_get_all php core library, i'm struggling mightily it. i've compiled php7 master branch statically , linked program. i'll post couple of code snippets i've tried many ways of calling function , keep running errors of 1 type or another. this snippet gets farthest when execute it: int main(void) { zval function_name, params[1], return_value, param; zval_new_str(&function_name, zend_string_init("token_get_all", strlen("token_get_all"), 1)); printf("got here\n"); zval_new_str(&params[0], zend_string_init("<?php $x = 1;", strlen("<?php $x = 1;"), 1)); int ret; printf("calling function\n"); ret = call_user_function(cg(function_table), null, &function_name, &return_value, 1, params tsrmls_cc); printf("%i", ret); } when gets call_user_function, segfaults. ...

wpf - What wrong with this Template -

i using datatrigger change datatemplate based on enum. <treeview > <treeview.resources> <hierarchicaldatatemplate datatype="{x:type model:card}" itemssource="{binding reqs}"> <stackpanel verticalalignment="center"> <textblock text="{binding label}" fontweight="bold" foreground="gray" horizontalalignment="stretch" verticalalignment="center" fontsize="15"/> <textblock text="{binding reqs.count}" fontweight="ultralight" foreground="gray" horizontalalignment="stretch" verticalalignment="center" fontsize="10"/> </stackpanel> </hierarchicaldatatemplate> <datatemplate datatype="{x:type model:reqcard}"> <contentcontrol> <contentcontrol.style> ...

matlab - To find Coherence between matrix for compressed sensing -

i working on compressed sensing.i have 2 vectors 1 of size 200 x 800,and other of size 800 x 800. is there way find coherence between these 2 using matlab?(coherence measures maximum correlation between 2 elements of 2 different matric)

google spreadsheet - Importrange() where the source columns/rows change -

i have importrange("key", "sheet1!d" & targetrow) formula, need column of importrange() dynamic in case add/delete columns in source data: e.g. importrange("key", "sheet1!" &targetcolumn &targetrow) i researched query() language being forced use col1 , col2 etc instead of named column identifiers makes useless i'm trying achieve. can me this? easiest way column letters without script? much. i've figured out inelegant workaround: =importrange("key", "sheet!" & importrange("key", "dept") & targetrow) where "dept" single-cell named range contains column letter of column want. the column letter (e.g. 'k') result of following formula: =substitute(address(row(k6), column(k6),4), row(k6),"") is there no easier/more robust way of doing this? used calculate bonuses it's critical spreadsheet.

playframework - Play 2 Compiler Error: bad symbolic reference to scala.xml (IntelliJ 14.1.4 + Play 2.4.2) -

i created new play 2.4.2 application in intellij 14.1.4 of instructions intellij on play site (i have scala plugin installed , enabled). instead of scala selected java project. when try run created app, following error: error:play 2 compiler: bad symbolic reference scala.xml encountered in class file 'basescalatemplate.class'. error:play 2 compiler: cannot access term xml in package scala. current classpath may error:play 2 compiler: missing definition scala.xml, or basescalatemplate.class may have been compiled against version that's error:play 2 compiler: incompatible 1 found on current classpath. error:play 2 compiler: (note: looks scala-xml module missing; try adding dependency on "org.scala-lang.modules" : "scala-xml". see http://docs.scala-lang.org/overviews/core/scala-2.11.html more information.) bad symbolic reference scala.xml encountered in class file 'basescalatemplate.class'. error:play 2 compiler: (note: looks ...

class - Java. Method Inner Object as return type -

can return method local inner object method? public class myclass { public mymethodinnerclass getmethodinnerclassobject() { class mymethodinnerclass { } mymethodinnerclass mymethclass = new mymethodinnerclass(); return mymethclass; } } throws compilation error. if can't return method-local inner class object, how can save after method returns? how can reference object future usage? exception thrown: exception in thread "main" java.lang.error: unresolved compilation problem: methodinnerclass cannot resolved type and also, i'm aware, local variables in method stored in stack , deleted after method exists. the scope of class inside method only. can however public object getmethodinnerclassobject() { or static class mymethodinnerclass { } public mymethodinnerclass getmethodinnerclassobject() { return new mymethodinnerclass(); }