Posts

Showing posts from April, 2015

BroadcastReceiver for Ethernet(RJ45) and USB in Android TV -

how can detect plug , unplug of ethernet cable , usb devices(any device pendrive) in android tv. there receiver internet connectivity? i need check tvbox app. solution: got solution ethernet - can checked type_ethernet in connectivitymanager but still usb remaining ethernet check out connectivitymanager the connection type type_ethernet usb check out usbmanager broadcast action_usb_accessory_attached .

json - How to use Groovy JsonOutput.toJson with data encoded with UTF-8? -

i have file utf-8 encoding. i write groovy script load file json structure, modify , save it: def originpreviewfilepath = "./xxx.json" //target file def originfile = new file(originpreviewfilepath) //load utf8 data file json structure def originpreview = new jsonslurper().parse(originfile,'utf-8') //here own code modify originpreview //convert structure json text def resultpreviewjson = jsonoutput.tojson(originpreview) //beautify json text (indent) def finalfiledata = jsonoutput.prettyprint(resultpreviewjson) //save jsontext new file(resultpreviewfilepath).write(finalfiledata, 'utf-8') the problem jsonoutput.tojson transforms utf-8 data unicode. don't understand why jsonslurper().parse can use utf-8 not jsonoutput.tojson ? how have jsonoutput.tojson use utf-8? need have exact inverse of jsonslurper().parse i believe encoding applied @ incorrect statement while reading itself. change below statements : def originfile =...

php - Laravel Auth in error pages -

when user logged application, there dropdown in navigation access administration. however, when user stumbles across error page (404, instance) doesn't show them being logged in. instead shows "login". why this? here's code. @if (auth::check()) <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a style="cursor: pointer;" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-user"></i> {{ auth::user()->name }} <b class="caret"></b></a> <ul class="dropdown-menu"> <li> <a href="/admin/dashboard"><i class="glyphicon glyphicon-tasks"></i> dashboard</a> </li> <li role="separator" class="divider"></li> ...

javascript - Displaying object inside object in kendo grid -

i new kendo , have problem kendo grid. have structure this var data = [{ key1: value1, key2: value2, objectinside: [{ insidekey1: insidevalue1, insidekey2: insidevalue2, insidekey3: insidevalue3 }, { insidekey1: insidevalue1a, insidekey2: insidevalue2a, insidekey3: insidevalue3a }, { insidekey1: insidevalue1b, insidekey2: insidevalue2b, insidekey3: insidevalue3b }] }]; and need create kendo grid , fill objectinside elements. can display 1 of element of array: var grid = $("#grid").kendogrid({ pageable: true, selectable: "row", datasource: data columns : [ { field: "objectinside.insidekey1[0]", title: "value1:" }, { field: "objectinside.insidekey2[0]", title: "value2:" }, { field: "objectinside.insidekey3[0]", title: "value3:" } ] }).data("kendo...

c++ - why the iterators can't refer to the container they belong to when container calls assign? -

string s="zhangzhizhong"; s.assign(s.begin()+2, s.end()-2); string correct! vector<int> ivec{0,1,2,3,4,5}; ivec.assign(ivec.begin()+1, ivec.end()-1); vector correct!!! the above code correct, written in book iterators can't refer container belong when container calls assign() . this illegal sequential containers, vector or deque . [sequence.reqmts]/4 table 100 a.assign(i,j) pre: i , j not iterators a but believe it's explicitly made valid std::string : [string::assign]/20 template<class inputiterator> basic_string& assign(inputiterator first, inputiterator last); effects : equivalent assign(basic_string(first, last)) . the standard requires implementation make copy of sequence before performing assignment (or @ least, behave if does). there no requirement can see iterators not point string being assigned. i'm not sure why doesn't work way containers, if had guess, i'd it's precisely a...

How to group row value using SQL Server? -

Image
i want group same yaxistitle in sql server, below image shows data. expected result: query used: select q.questionid, q.questionname, p.perspectivetitle, x.xaxistitle, y.yaxistitle, c.value coaching_questionperspectivemap c inner join coaching_question q on c.questionid = q.questionid inner join coaching_perspective p on c.perspectiveid = p.perspectiveid inner join coaching_xaxisdata x on c.xaxisdataid = x.xaxisdataid inner join coaching_yaxisdata y on c.yaxisdataid = y.yaxisdataid q.questionid = 14 , p.perspectiveid = 1 order c.sort please provide solution? thanks, if want data ordered shows in groups of yaxistitle, use this: select q.questionid, q.questionname, p.perspectivetitle, x.xaxistitle, y.yaxistitle, c.value coaching_questionperspectivemap c inner join coaching_question q on c.questionid = q.questionid inner join coaching_perspective p on c.perspectiveid = p.pers...

java - How to make object null by having only its reference in array? -

i have array of game objects in gameworld , can removed world. problem game objects have references other game objects. e.g. player class has reference bird. bird gets randomly removed gameworld, player still has reference it. null check check whether gameobject still valid , in world. however, removing object array not make reference null. how can make null? here example: // gameworld creates bird arraylist<object> gameobjects = new arraylist<>(); object bird = new object(); gameobjects.add(bird); // player references object referencedbird = gameobjects.get(0); // later in gameworld, scope, there no access 'bird' object, trying remove bird world object objecttoremove = gameobjects.get(0); gameobjects.remove(0); objecttoremove = null; // in player class debug.log("is null " + (referencedbird == null)); // false! need true you can't make object null , can make reference null . updating 1 reference object doesn't change other ref...

asp.net mvc 4 - Validating Username and password using OWIN in MVC5 -

using owin want validate username , password not use default aspuser table custom user table in mvc 5. if use code first approach check model validation in other words, if don't want use generated tables have write own classes migrate them database. in process of writing classes have add validations too.

java - Firebase Android method to check existence of user's profile info in Firebase database -

i don't error message want execute code differently. if check following java code, runs tag:1 > tag:2 > tag:4 > tag:5 > tag:3. want run tag:1 > tag:2 > tag:3 > tag:4 > tag:5. basically, want check user's profile exist or not before starting of new activity. looking method check existence of child in firebase database. not changing data database. so, should not ondatachange() method. think, there once() method available in old firebase same. there method available? thank you log.i("tag:","1"); string userid = getuid(); log.i("tag:","2"); databasereference.child("users").child(userid).addlistenerforsinglevalueevent(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { userprofile userprofile = datasnapshot.getvalue(userprofile.class); log.i("tag:","3...

Type Erasure in Scala -

i'm rather confused what's happening here: import scala.collection.immutable._ object main extends app { sealed trait node sealed trait group case class sheet( val splat: string, val charname: string, val children: listmap[string, node], val params0: listmap[string, param], //params0 separate sheet-general parameters val note: option[note] ) extends node group case class attributes(val name: string) extends node group case class param(val name: string, val value: string) extends node case class note(val note: string) extends node i've got 3 versions of replace function - last 1 one i'm trying write, others debugging. class sheetupdater(s: sheet) { def replace1[t <: group](g: t): unit = { s.children.head match { case (_, _:sheet) => case (_, _:attributes) => } } } this version throws no warnings, apparently have access type of s.children @ runtime. class sheet...

node.js - How to run a npm script on a deployed Heroku NodeJS app -

under scripts in package.json have following. 'refresh': node refresh db is there way trigger particular npm script on nodejs app deployed on heroku. yes: $ heroku run npm run refresh

javascript - Bootstrap navigation arrows missing for datepicker -

Image
i realize there similar questions problem correct font family not being referenced. however, in version using, don't use icon navigation arrows, use html character code double-left , double-right arrows. my html references - <link href="content/css/bootstrap.css" rel="stylesheet" /> <link href="content/css/datepicker.css" rel="stylesheet" /> <link href="content/css/navbar.css" rel="stylesheet" /> <link href="content/css/jquery-ui.min.css" rel="stylesheet" /> <link href="content/css/jquery-ui.structure.min.css" rel="stylesheet" /> <link href="content/css/jquery-ui.theme.min.css" rel="stylesheet" /> <script type= "text/javascript" src="scripts/jquery-2.2.0.min.js"></script> <script type= "text/javascript" src="scripts/bootstrap.min.js"></script> <script t...

Safe refactorings when migrating from Java 6 to Java 7 -

what safe refactorings when migrating application java 6 java 7? for example 1 can consider using new diamond operator, new automatic resource management a.k.a. try resources, multi-catch functionality there more? diamond operator / type inference safe. try-with-resources safe. if didn't close of files, streams before, correct few bugs free. may have side effects. multi-catch has same caveats, if replace catch (exception) or worse: catch (throwable) proper multi-catching, have throwables bubbling stack got caught before ( nullpointerexception s , mostly).

javascript - Fetching data with redux actions -

i having issue internally how structure redux actions fetch data via rest api. i fetching variety of data like all posts published a singular post all current users search results i wondering if create action fetch's data each endpoint or if create singular fetch action fetches data supplied route? current implementation: function requestposts(site) { return { type: request_posts, site } function fetchposts(site) { return dispatch => { dispatch(requestposts(site)) return fetch(`http://notareallink.com/posts`) .then( response => response.json() ) .then( json => dispatch( receiveposts( site, json ) ) ) } function requestpost(site) { return { type: request_post, site } function fetchpost(site) { return dispatch => { dispatch(requestpost(site)) return fetch(`http://notareallink.com/post/post-id`) .then( response => response.json() ) .then( json => dispatch( receivepost( site, json ) ...

JSON Data Conversion for Rest Calls in Scala -

i have worked on rest development spring. spring library takes care of json data conversion in request body in response. wondering approach dispatch, scala rest library, convert case class json data request body , convert response data case class. update: after study, think tostring method can used convert case class json data. there more code if case class has option fields. in combination of dispatch using json4s serialise / deserialise json bodies. can have @ here : http://json4s.org/ . can consider using spray-json, circe, argaunot, it's !!

Android SQLite Where Clause not considered -

i created parametric query data database table. works, and tipo = 2 not considered. have suggestions? string sql = "select titolo, icona, colore, tipo, identificativo, dato_campo table " + "where titolo '%" + parametro + "%' " + "or dato_campo '%" + parametro + "%' , tipo = 2 group identificativo order titolo asc"; brackets: select titolo, icona, colore, tipo, identificativo, dato_campo table (titolo '%" + parametro + "%' " or dato_campo '%" + parametro + "%' ) , tipo = 2 group identificativo order titolo asc";

ios - Presenting a Modal ViewController from a TableViewController lags -

i have uitableviewcontroller needs present view controller modally when cell tapped. i'm using didselectrowat this. the modal view controller custom uiviewcontroller subclass has loadfromstoryboard() class method load it. sometimes when tap cell, view controller presented without issue. however, other times doesn't show until i, instance, try scroll on tableview or tap cell. i'm guessing sort of problem threading. however, throughout entire app, never delegate task thread or start queue @ all. n.b.: using swift 3. update here's loadfromstoryboard() method: class func loadfromstoryboard(particle: particleprotocol, isfavourite: bool = false) -> particledisplayviewcontroller { let storyboard = uistoryboard(name: "main", bundle: nil) if let viewcontroller = storyboard.instantiateviewcontroller(withidentifier: "particledisplayviewcontroller") as? particledisplayviewcontroller { viewcontroller.particle = particle ...

Eclipse import project error, overlaps workspace location -

i have big project want import eclipse, everytime get: invalid project description. d:\svn\myproject\vr overlaps workspace location: d:\svn\myproject\vr i reinstalled eclipse, set workspace program exists , choose import project , error. anyone has solution this? doing wrong? thanks. use empty (thus clean) directory clean workspace. eclipse doesn't require projects in workspace directory.

I am evaluating Google PUB/SUB vs Kafka? -

i have not worked on kafka wanted build data pipeline in gce. wanted know kafka vs pub/sub. want know how message consistency, message availability, message reliability maintained in both kafka , pub/sub thanks in addition being managed, other difference google pub/sub message queue (e.g. rabbit mq) kafka more of streaming log. can't "re-read" or "replay" messages pubsub. with google pub/sub, once message read out of subscription , acked, it's gone. in order have more copies of message read different readers, "fan-out" topic creating "subscriptions" topic, each subscription have entire copy of goes topic. increases cost because google charges pub/sub usage amount of data read out of it. with kafka, set retention period (i think it's 7 days default) , messages stay in kafka regardless of how many consumers read it. can add new consumer (aka subscriber), , have start consuming front of topic time want. can set retenti...

java - SimpleDateFormat producing wrong date time when parsing "YYYY-MM-dd HH:mm" -

i trying parse string ( yyyy-mm-dd hh:mm ) date, getting wrong date expected. code: date newdate = null; string datetime = "2013-03-18 08:30"; simpledateformat df = new simpledateformat("yyyy-mm-dd hh:mm", locale.english); df.setlenient(false); try { newdate = df.parse(datetime); } catch (parseexception e) { throw new invalidinputexception("invalid date input."); } produces: sun dec 30 08:30:00 est 2012 (wrong) i tried setting lenient off no luck. appreciate help. update thanks sudhanshu answer, helped me solve java conversion. when enter returned date above code database getting date correctly time 00:00. ps.setdate(3, new java.sql.date(app.getdate().gettime())); yyyy should yyyy- simpledateformat df = new simpledateformat("yyyy-mm-dd hh:mm", locale.english); please check documentation simpledateformat here java 6 : http://docs.oracle.com/javase/6/docs/api/java/text/simpled...

c# - quicksort algorithm not sorting final element? -

i have code wrote using algorithm found on wikipedia: public static void quicksort(int[] arr, int low, int hi) { if(low < hi) { int pivot = part( arr, low, hi); quicksort( arr, low, pivot - 1); quicksort( arr, pivot + 1, hi); } } public static int part(int[] arr, int low, int hi) { int pivot = arr[hi]; int = low; for(int j = low; j < hi - 1; j++) { if(arr[j] <= pivot) { swap(arr, i, j); i++; } } swap(arr, i, hi); return i; } public static void swap(int[] ar, int a, int b) { int temp = ar[a]; ar[a] = ar[b]; ar[b] = temp; } given input: 31, 5, 5, 5, 5, 4, 4, 4, 5, 4 one should expect get: 4, 4, 4, 4, 5, 5, 5, 5, 5, 31 but instead get: 4, 4, 4, 4, 5, 5, 5, 5, 31, 5 what gives? i call initial sort with: quicksort(arra...

javascript - How to add plus minus symbol to a basic accordion using jquery? -

i'm using basic jquery accordion written luca filosofi this thread . here version: $('.product-details .post-body dl dt').on('click', function (e) { e.preventdefault(); $(this).parent('dl').children('dd:visible').slideup('fast'); $(this).nextuntil('dt').filter(':not(:visible)').slidedown('fast'); }); the script works perfectly. however, don't know how have plus , minus text ( + , - ) attached before title (e.g: + title) based if content shown or not. i have following permanent markup , must stay is. must not add more class or html, except via jquery: <dl> <dt>title</dt> <dd>description 01</dd> <dd>description 02</dd> <dt>title</dt> <dd>description 01</dd> <dd>description 02</dd> <dd>description 03</dd> </dl> you toggle icons when click this: $('.product...

qt - Is there a combined guide to install Python and PyQT with an IDE and debugger on Windows? -

i have found various downloads. here there executable "pyqt5-5.6-gpl-py3.5-qt5.6.0-x64-2.exe". says has need except python. presume have install python 3.5 (and not other version?). have 2.7, mean not compatible? also, want ide (but not eclipse if poss), have looked @ eric6 suggested on different question. what trying avoid having mess of various versions of python, qt libs, pyqt , ide not work/has no debugger. can provide guidance/steps on how integrate these tools together? note : eric webpage need: to able run eric6 should have following installed: python 3.3.0 or better python 2.7.0 or better qt 5.3.0 or better (from qt company) qt 4.8.0 or better (from qt company) pyqt 5.3.0 or better (from riverbank) pyqt 4.10.0 or better (from riverbank) qscintilla 2.8.0 or better (from riverbank) i find more confusing - mean need 2 different versions of python, qt , pyqt installed? at moment, binary windows releases pyqt5 py...

C++ Virtual Inheritance -

#include <stdio.h> class abc{ public: abc *next; protected: int flags; const char * name; const char * comments; public: abc(const char *name, const char *comments, int flags); virtual ~abc() { printf("\nreached @ virtual ~abc\n"); printf("returning @ virtual ~abc\n"); } }; class def: public abc{ public: def (const char *myname, const char *mycomments, int myflags): abc(myname, mycomments, myflags) { printf("\nreached @ def\n"); printf("name=%s; comments=%s\n", myname, mycomments); printf("returning def\n"); } }; class ghi: public def{ public: ghi(const char *myname2, const char *mycomments2, int myflags2): def(myname2, mycomments2, myflags2) { printf("\nreached @ ghi\n"); ...

scala - value is not a member of Equals -

i'm trying add object list (third list), i'm using code var okii = result.firstlist.find(dimension => firstobj.rank == firstobjrank).map(_.secondlist).getorelse(seq.empty).find(secondobj => secondobj.rank == secondobjrank).getorelse(seq.empty) okii.thirdlist :+ newobj but error: value not member of equals my structure: "result" : { "firstlist": [{ "firstobject": "objectfirstlist" }, { "secondlist": [{ "secondobject": "objectsecondlist" }, "thirdlist": [{ "thirdobject": "objectthirdlist" }] ] }] }

mysql - PHP: For loop that repeats the first item instead of looping through all items? -

i have mysql query requests list of items. i fetch them , want display every item loop, but shows me first item repeated, instead of every item. why? <?php $conectar = mysqli_connect(host, user, pass, database); $query = " select cursoid, nombrecurso, estadocurso cursos estadocurso='abierto'"; $buscarcurso = mysqli_query($conectar,$query); $curso=mysqli_fetch_assoc($buscarcurso); $totalrows = mysqli_num_rows($buscarcurso); //there 3 rows of results echo $totalrows; ($i=0; $i < $totalrows; $i++) { echo '<br>'; echo $curso['nombrecurso']; echo '<br>'; } ?> the intended result is: curso 1 curso 2 curso 3 and instead curso 1 curso 1 curso 1 your loop should fetching result set on every iteration. standard way (as in many examples given in php documentation ) in while condition: $totalrows = mysqli_num_rows($buscarcurso); //there 3 rows of results ...

c# - How to do a specific order by in Entity Framework with a mixture of values and nulls -

i using entity framework, , returning cut down collection, using skip , take, based on order using nullable date column. want order list in following order: date less today date of today date of null date in future how can in 1 db query? using (var context = new customersdbcontext()) { var customers = context.customers.orderby(c => c.nextcontactdate).skip(10).take(10); } you can order first "priority" defined rules, (only applies equal priorities) use current criteria this: var customers = context.customers .orderby(c => c.nextcontractdate == null ? 2: c.nextcontactdate < datetime.today ? 0 : c.nextcontactdate > datetime.today ? 3 : 1) .thenby(c => c.nextcontractdate) .skip(10).take(10);

javascript - Setting height of div + scroll to bottom -

Image
i'm trying page scroll bottom automatically - easiest thing in world, right? not much. we've got spa (using kendo ui) simple discussion forum. part of js page includes setting height of our content div, i've discovered preventing standard scrolltop functionality working. here's page: the header static, , footer sticky @ bottom of page. you'll notice scrollbar doesn't go behind add comment section, part of reason we're setting height. setting height: $('.content-area').height($(window).height() - ($('header nav').height() + $('.disc-add-comment-cont').height())); .content-area on page, excluding header , nav. header nav static header, , .disc-add-comment-cont add comment footer. the code i'm using bottom scroll vanilla comes: $("html, body").animate({ scrolltop: $(document).height() }, "slow"); i've tried: $("html, body").animate({ scrolltop: $(window).height() - ($('hea...

How to specify TFS Build Options in Powershell? -

Image
i'm using tfs edit build deinition queue it. have need build server , build itself. can queue build, don't know how specify option when do. builds gated, , when manually queue them, have specify "latest sources" when so, not "latest sources shelvesets" seems default. here example of i'm clicking when queue build manually. below have coded far: $teamprojectcollection = [microsoft.teamfoundation.client.tfsteamprojectcollectionfactory]::getteamprojectcollection("$serveruri") $bs = $teamprojectcollection.getservice([type]"microsoft.teamfoundation.build.client.ibuildserver") $build = $bs.getbuilddefinition("$project", "$template") #here of build editing, it's not important. $request = $definition.createbuildrequest() $bs.queuebuild($request, “none”) this code works, don't know how specify option of "latest sources" on "latest sources shelveset". can help? based on t...

Displaying contents of array on multiple lines in React Native -

i have array of strings display on screen on multiple lines in react native ios. in text view, have 1 line of code: <text style={styles.text}> {this.state.selectdata} </text> i display 3 elements of selectdata array per line, can't figure out how go executing it. something this render(){ <view> {this.state.selectdata.map((value, index) => { return ( <text key={index}> {value} </text> ); }) } </view> ); }

string - Python str/bytes type with cmd -

i have written python script use string in bytes type. simple script : s = 'just string'; b = str.encode(s); print(type(s)); print(type(b)); if run script in python idle output is: <class 'str'> <class 'bytes'> and if run cmd; output result. cmd output : <class 'str'> <class 'str'> i need use string data in bytes type cmd. why happened? , how can correct it?

3-D interpolation using LinearNDInterpolator (Python) -

i want interpolate 3-d data using scipy linearndinterpolator function (python 2.7). can't quite figure out how use it, though: below attempt. i'm getting error valueerror: different number of values , points. leads me believe shape of "coords" not appropriate these data, looks in documentation shape okay. note in data want use (instead of example) spacing of grid irregular, regulargridinterpolator not trick. thanks help! def f(x,y,z): return 2 * x**3 + 3 * y**2 - z x = np.linspace(1,2,2) y = np.linspace(1,2,2) z = np.linspace(1,2,2) data = f(*np.meshgrid(x, y, z, indexing='ij', sparse=true)) coords = np.zeros((len(x),len(y),len(z),3)) coords[...,0] = x.reshape((len(x),1,1)) coords[...,1] = y.reshape((1,len(y),1)) coords[...,2] = z.reshape((1,1,len(z))) coords = coords.reshape(data.size,3) my_interpolating_function = linearndinterpolator(coords,data) pts = np.array([[2.1, 6.2, 8.3], [3.3, 5.2, 7.1]]) print(my_interpolating_function(pts))...

html - Ionic Grid - row not taking up full width -

i trying create simple grid, 1 row , 7 columns. each column consists of div containing 1 letter of text. want these columns space evenly out across page, meant default behaviour, bunched on left. setting row's width 100% id doesn't help. appreciated. <div class="row"> <div class="column positive-bg stable" ng-repeat="i in [1,2,3,4,5,6,7]">m</div> </div> use col instead column class. <div class="row"> <div class="col positive-bg stable" ng-repeat="i in [1,2,3,4,5,6,7]">m</div> </div> more ionic grid .

Group Concat using SQL Server -

i have view these enter image description here and want group concat as: 198733366,folledosanguir marcelina yolan,bsdc,pe 1,st1 ,nstp 1,"",devc 10,v1r and on. each studno. thanks.

excel - Excell cell value is not read as Number? -

Image
i trying add data in 2 cells of excel sheet if excel cell of type number not add cells. seems there space infornt of number not add....image below. there vba code remove space each of cell if presesnt. i have exported excel pdf. excel attempt convert value number if apply operator it, , conversion handle spaces. can use =a1*1 or a1+0 convert value in a1 number, or within function =sum(iferror(a1*1,0)) . that kind of implicit conversion automatically performs trim() . can conversion explicitly using funciton n() , or numbervalue() newer versions of excel . however, others have pointed out, many characters won't automatically handled , may need use substitute() remove them. instance, substitute(a1,160,"") non-breaking space, prime suspect because of prevalence in html . clean() function can give shortcut doing bunch of characters known problematic, it's not comprehensive , still need add own handling non-breaking space. can find ascii code specifi...

angularjs - Failed to instantiate module ng due to $injector:strictdi -

i have "migrated" angular project es6 adding babelify gulp browserify task. working fine, though come weekend , broke... my app complaining of following: angular.min.js:formatted:7382 error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=ng&p1=error%3a%20%5…0%20%20at%20bb%20(http%3a%2f%2flocalhost%3a3000%2fjs%2flibs.js%3a173%3a246) @ error (native) @ http://localhost:3000/js/libs.js:136:412 @ http://localhost:3000/js/libs.js:170:134 @ q (http://localhost:3000/js/libs.js:137:355) @ g (http://localhost:3000/js/libs.js:169:222) @ bb (http://localhost:3000/js/libs.js:173:246) @ c (http://localhost:3000/js/libs.js:151:19) @ object.yc [as bootstrap] (http://localhost:3000/js/libs.js:151:332) @ http://localhost:3000/js/app.js:745:11 @ http://localhost:3000/js/libs.js:260:226 when opening link error: failed instantiate module ng due to: error: [$injector:strictdi] http://errors.angularjs.org/1.5.5...

python - Qt (QOpenGLShaderProgram) - setting a uniform boolean value? -

how pass boolean value fragment shader, using qopenglshaderprogram? (python) if program called _program , use this: self._program.setuniformvalue('myvar', 1) in order pass value of true , , use in fragment shader using: uniform bool myvar; would okay? or should using way? thanks! it ok. gluniform documentation says: either i, ui or f variants may used provide values uniform variables of type bool, bvec2, bvec3, bvec4, or arrays of these. uniform variable set false if input value 0 or 0.0f, , set true otherwise.

php - PDO prepare insert values -

i try insert data form (createbuilder) database, using pdo , custom prepare request: public function createuser($data) { $connect = $this->connectbdd(); $rq = " insert user (email, password, firstname, lastname, salt, role, addf, addl) values (:email, :password, :firstname, :lastname, :salt, :role, null, null)"; $t = $connect->prepare($rq); $t->execute([ ':email' => $data["email"], ':password' => $data["plainpassword"], ':firstname' => $data["firstname"], ':lastname' => $data["lastname"], ':salt' => $data["salt"], ':role' => 'role_user' ]); return true; } but following error: sqlstate[42601]: syntax error: 7 erreur: erreur de syntaxe sur ou près de « user » line 1: insert user (email, password, firstname, lastname, sal... ...

node.js - javascript reading data results in an empty object -

i have following code: var linereader = require('readline').createinterface({ input: require('fs').createreadstream('graph.txt') }); var graph = {}; linereader.on('line', function (line) { var spl = line.split('\t'); graph[spl[0]] = spl.slice(1); }); console.log(graph); graph.txt contains data representing graph in adjacency lists such as 1 3 2 3 2 1 3 3 1 2 1 i ran code node script.js . don't understand why @ end graph still empty object. what's correct way read data object? try replacing console.log(graph); call with: linereader.on('close', function () { console.log(graph); }); you see empty object because log happens before file read, reading async .

jsf 2 - How to avoid preRenderView method call in ajax request? -

i need call method in backing bean while page loads. achieved using <f:event listener="#{managedbean.onload}" type="prerenderview"> but whenever ajax request made in page, method invoked again. don't need in requirement. how avoid method call in ajax request? the prerenderview event invoked on every request before rendering view. ajax request request renders view. behavior expected. you've 2 options: replace @postconstruct method on @viewscoped bean. @managedbean @viewscoped public class managedbean { @postconstruct public void onload() { // ... } } this invoked when bean constructed first time. view scoped bean instance lives long you're interacting same view across postbacks, ajax or not. perform check inside listener method if current request ajax request. @managedbean // scope. public class managedbean { public void onload() { if (facescontext.getcurrentinstance().getpartialvi...

spoofing - postfix check the From address field matches the authenticated username or other valid aliases in LDAP -

we have internet facing mx server whereby users authenticate outgoing connection submit emails via port 587. mx server routes incoming mail our domain internal postfix smtp server delivers mail local imap servers. the internal postfix smtp server users ldap alias_maps = ldap:/etc/postfix/ldap-aliases.cf, lookup imap server users mailbox resides on. there postfix option... reject_sender_login_mismatch can mapped... smtpd_sender_login_maps = ldap:/etc/postfix/smtpd_sender_login.cf however - following error jul 4 11:23:26 smtp-1.domain1.com postfix/smtpd[31530]: warning: restriction `reject_authenticated_sender_login_mismatch' ignored: no sasl support no users authenticate internal postfix smtp server - route emails mx server. believe reason see warning "no sasl support" because postfix doesn't handle authentication it's taken care of mx server. postconf -n alias_database = hash:/etc/aliases alias_maps = ldap:/etc/postfix/ldap-aliases.cf, hash:/etc...

azure - Microsoft.IdentityModel.Clients.ActiveDirectory AcquireTokenAsync always requires a resource when the documentation says it doesnt -

Image
i have requirement use azure ad authenticate clinet applications using oauth 2.0. we started using microsoft.identitymodel.clients.activedirectory.acquiretokenasync library must pass resource: even though documentation here: https://azure.microsoft.com/en-us/documentation/articles/active-directory-protocols-oauth-code/ says it's optional: we don't want pass resource our clients should know little possible back-end services changes in future minimal. another requirement use app-only flow dont need user interaction. i have tried writing straight http rest calls using restsharp can't around popup. any great. i think issue related version of ddl, facing same issue have replace ddl below version microsoft.identitymodel.clients.activedirectory.dll--> v2.23.0.0 now work me. you can download here https://www.nuget.org/packages/microsoft.identitymodel.clients.activedirectory/2.23.302261847

jquery - Acess element in a nested table -

im trying print policy when of child elements clicked. it's weird list got , trying work cannot display. $(".submenu li").click(function() { alert($(this).text()); alert( $(this).parent().find('li.sub').text()); }); i tried alert( $(this).parent().find('li.sub').text()); alert($(this).closest('.submenu').closest('a').text()); alert($(this).closest('.submenu').closest('sub').find("a").text()); http://jsfiddle.net/ettnxuxa/ expected output after clicking child element: alerts "policy" the parent() method gives immediate parent element. you'd do, try: alert($(this).parent().parent('.sub').text()); better though, use: alert($(this).closest('.sub').text()); to child element of .sub use children() method, so: alert($(this).closest('.sub').children('a').text()); jsfiddle

login - TYPO3 Plugin - One action public access and one private -

Image
i'm developing extension have both, list of records (action show ) , form send new record (action new ). the list must public access, form must require login form (i'm using login form content type comes typo3). i have tried using access tab plugin selecting show @ login applies entire plugin not each action. currently, how page looks like: how display login form when tries create new record? note: extension based on extbase , fluid. target version typo3 6.2. the easiest split actions in different "views" switchablecontrolleractions in flexform. need place separate plugins on 2 different pages, way can have different access configuration plugins. if don't know how adjust flexform, can post content of here. the other way make check inside controller, use if have lot of different roles need check. if ($this->loginuser === null && $globals['tsfe']->loginuser && !empty($globals['tsfe']->fe_use...

ruby - Do not understand locals in rails - getting a No method error -

i new rails , trying shopping cart html view site admin when order made. email portion working fine simple html when add ruby code render views page following error: nomethoderror in charges#create showing /home/ubuntu/workspace/app/views/order_mailer/order_email.html.erb line #7 raised: undefined method `size' nil:nilclass extracted source (around line #7): 5 6 7 <%= render "carts/shopping_cart", size: @order_items.size %> rails.root: /home/ubuntu/workspace application trace | framework trace | full trace app/views/order_mailer/order_email.html.erb:7:in `_app_views_order_mailer_order_email_html_erb___1590505826361550286_70123907983000' app/mailers/order_mailer.rb:11:in `order_email' app/controllers/charges_controller.rb:10:in `create' from have read think need add locals render code confused on locals , in code. if off track , error has nothing locals appreciate guidance in right direction. thanks! order_email view: <h1>you h...

STLloader and three.js - How to check if file is binary? -

um using three.js (r79) , stlloader rendering .stl files. following piece of code should processed if file binary, because if it's ascii - error. geometry = new three.geometry().frombuffergeometry( geometry ); the following code adds new property generated geometry isascii , isbinary. var loader = new three.stlloader(); loader.parsebinary = function(data){ var parsebinary = three.stlloader.prototype.parsebinary.bind(this); var result = parsebinary(data); result.isbinary = true; return result; }; loader.parseascii= function(data){ var parseascii= three.stlloader.prototype.parseascii.bind(this); var result = parseascii(data); result.isascii = true; return result; }; loader.load(url,function(geometry){ if (geometry.isascii){ ... } else if (geometry.isbinary){ ... } }); the loader separates binary , ascii files. makes use of feature.

c# - Apply generic visitor to generic derived class of non-generic base class -

currently have this: public abstract class base {...} public class derived<t> : base {...} class visitor { public static void visit<t>(derived<t> d) { ... } } my question is, given base reference know derived instance, how can apply visit function object, using correct generic instantiation? understand answer involve type-checked dynamic downcast, make sure object isn't other type derived base, fine. assume answer involves reflection, fine, though i'd prefer if there way without reflection. it's ok if answer involves abstract method on base , derived ; have enough control of classes add that. @ end of day, need call generic function, correctly instantiated t of derived type. sorry if easy question; come c++ background, instinct use crtp or else that, isn't possible in c#. edit: here's example of need able do: base getsomederivedinstance() { ...; return new derived<...>(); } var b = getsomederivedinstanc...

visual studio 2015 - Exception while Merging the Conflict in C# code - VS2015 -

Image
i getting attached error message whenever try merge conflict in c# code in vs2015. please let me know reason. following error in activitylog.xml

c - Why does the RST packet not need the TIME_WAIT state? -

i know time_wait prevent delayed segments 1 connection being misinterpreted being part of subsequent connection. segments arrive whilst connection in time_wait wait state discarded. in experiment, can't see time_wait when client sends rst packet instead of fin packet. why? server while (1) { int len = sizeof(struct sockaddr); fd = accept(sfd, &remote, &len); read(fd, buf, sizeof(buf)); strcpy(buf, "hello client"); write(fd, buf, strlen(buf)); close(fd); } client res = connect(sfd, result->ai_addr, result->ai_addrlen); strcpy(buf, "hello server!"); write(sfd, buf, strlen(buf)); close(sfd); note: client sends rst instead of fin because not read buffered data sent server before closing socket. when close(2) connection pending of receiving data, connection broken, not reading pending data (that can in buffer, acknowledged, unacknowledged or in transit) breaking state machine , provokes rst (w...

c++ - Why doesn't foward declaration of class work when class is included in another class -

this compiles #include "sprite.h" class gameobject { public: int x, y, w, h; sprite sprite; public: gameobject(); gameobject(int _x, int _y, int _w, int _h); virtual ~gameobject(); }; this doesn't class sprite; class gameobject { public: int x, y, w, h; sprite sprite; public: gameobject(); gameobject(int _x, int _y, int _w, int _h); virtual ~gameobject(); }; i know forward declare , use pointer sprite why doesn't forward declaration works here. doesn't "class sprite;" tells sprite exists? i'm trying #include classes in .cpp , avoid in .h @ cost. classes not including each other there no need use sprite*. guess understanding of forward declaring is wrong or because don't see reason why doesn't work. thanks in advance. pretend you're compiler. without having complete declaration of sprite @ disposal, how possible determine whether sprite 1 byte big, or 1 hu...

bluej - Java Turtle Animation Issue -

Image
i trying make animation 2 rectangles appear , disappear frame when type in: c turtle graphics. problem have not understand how incorporate turtle graphics loop. this, have use do-while loop. suppose have rectangles made move horizontally across screen. have general idea set out, not know how use turtle graphics loop. code not orderly when tried set here. /** * write description of class animation here. * * @author (author) * @version */ import java.util.scanner; import java.awt.*; class animation { //set conditions turtle start drawing public void prepareturtletodraw(turtle myrtle, color color, int x, int y) { myrtle.hide(); myrtle.penup(); //pick pen avoid leaving trail when moving turtle myrtle.setcolor(color); //set myrtle's color myrtle.moveto(x, y); //move coordinates myrtle.pendown(); //put pen down start drawing }//end of prepareturtletodraw method //draw line public void drawline(turtle myrtle, int x1, ...

java - Trying to correct simple array program -

i'm trying practice java before starting new programming class. this, decided remake old perl programs made earlier class. original perl file entered numbers entered user array , output array in 4 ways: numbers entered, ascending order, descending order, , largest , smallest numbers. i looked through several examples here , elsewhere online troubleshoot , while program compiles, output wrong. is, array outputted couple dozen times, outputting numbers entered. think have 4 loops set wrong, i'm still learning java there's missed. here's java code now: import java.util.arraylist; import java.util.scanner; public class arrayoutput { static scanner input = new scanner(system.in); static string converttostring(arraylist<integer> numbers) { stringbuilder builder = new stringbuilder(); (int : numbers) { builder.append(numbers); builder.append(","); } builder.setlength(builder.length() - ...