Posts

Showing posts from September, 2014

c++ - Multithreded udp-Server vs. Non blocking calls -

first questions here. gave searched haven't found solution answers problem here. i'm using c++ , need write kind of usp chat (server , client) programs interact 1 another. atm works quite well. i'm using googles protobuf messages. i've written that: server has list of users curently logged in list of messages process , distrubute. one thread handles receiving on socket (i'm using 1 socket). if command var in message login, looks through list , checks combination of port , ip. if not in, chat creates new user entry. if command logout, server looks user in list , deletes it. if command message, server looks if user logged in , puts on message list. the 2nd thread sending. waits till there message in list , cycles through users send messages sockets except sending one. the server has set options on socket receive ip. my question is: performat solution? i've read select , poll. it's multiple receiving sockets while have one. know receiving ...

javascript - Fullcalendar: how to get events from two variables and pass to through 'eventAfterRender'? -

i have 2 types of events , namely 'holidays' , 'events', should received 2 variables. variables holding ajax responses. want pass holidays , events calendar 'events'. not know how pass variables. following ajax code, declared variable. code correct? var return_holidays = function() { var holdays = []; $.ajax({ url: "/calendar/show_holidays", type: 'post', // send post data data: 'type=fetch', async: true, success: function(s) { //alert(s); holdays = s; } }); return holdays; }(); var return_events = function() { var dynamic_events = []; $.ajax({ url: "calendar/show_events", type: 'post', // send post data data: 'type=fetch_events', async: true, success: function(s) {//alert(s); dynamic_events = s; } }); return dynamic_eve...

tsql - SQL Server trigger for update inserted row -

i want create trigger this: have 2 tables: table 1: id - integer - primary key status - integer - values: 1 busy , 0 available table 2: id - integer - primary key - autogenerated id2 - integer - null or value of id table1 status - integer - values: 1 working 0 waiting col1 - irrelevant column 1 col2 - irrelevant column 2 col3 - irrelevant column 3 and when users this insert table2 (col1, col2, col3) values (val1, val2, val3); the trigger should check table1 , if finds , available id (status = 0) updates inserted row table2.id2 = table1.id , table2.status becomes 1 otherwise table2.id2 remains null , table2.status becomes 0. now i've tried many ways , error messages. this latest attempt: create trigger mytrigger on table2 after insert begin if not exists (select top 1 id table1 status = 0) begin update table2 set status = 0 table2.id = inserted.id end else ...

arrays - How to show content in div based on json data -

i working on angularjs app has ng-view routes. in object have option of showonhome, show product if value set true , hide if set false. in nodejs server: app.get('/cameras/:id', function(req, res){ var cameraid = parseint(req.params.id); var data = {}; (var i=0, len=cameras.length; i<len; i++){ if(cameras[i].id === cameraid){ data = cameras[i]; break; } } res.json(data); }); app.get('/cameras', function(req, res){ res.json(cameras); }); var cameras = [ { "id": 1, "title": "bvo473n 850tvl ir dome camera", "features": [ "2.0 megapixel cmos image sensor", "2 megapixel high definition image quality", "minimum illumination of 0.1 lux @ f1.2 , 0 lux ir on", "42 units of ...

javascript - Dragula - how can I modify the width of the mirrored element? -

i'm using dragula , have run issue width , padding not being respected when item being dragged. see fiddle here. if add .gu-mirror {color: red;} css, text change red in mirrored element when dragged, if add .gu-mirror {width: 200px;} gets ignored. idea how can change width , padding of .gu-mirror? thanks!

java - How to join one table with different tables with criteria API? -

i have following classes: class { private b b; // getters/setters } class b { private c c; private d d; // getters/setters } class c { private boolean outdated; // getters/setters } class d { // not important fields // getters/setters } class b connected a, c , d relation 'one-to-one'. i trying join following tables criteria api. i have following code: root<a> root = query.from(a.class); root.join(a_.b) .join(b_.c) .join(b_.d); but unfortunately code not compile, error on line ".join(b_.d)", because after joining b c cannot use fields of b joining. the reason why want make such joins because need have condition entity c not outdated (so add 'on' condition it). does know how solve problem? root.join(a_.b).join(b_.c) represents c , there no way join "b_.d" . need do root<a> root = query.from(a.class); join<a,b> bjoin = root.join(a_.b); bjoin.join(b_.c); bjoin.join(b_...

javascript - Jquery-ui Save position of draggable item -

i want keep var of x , y position of draggable item on stop. thank fiddle , topic did : $("#image").draggable({ helper: 'clone', stop:function(event,ui) { var wrapper = $("#wrapper").offset(); var borderleft = parseint($("#wrapper").css("border-left-width"),10); var bordertop = parseint($("#wrapper").css("border-top-width"),10); var pos = ui.helper.offset(); $("#source_x").val(pos.left - wrapper.left - borderleft); $("#source_y").val(pos.top - wrapper.top - bordertop); alert($("#source_x").val() + "," + $("#source_y").val()); } }); i want save position each time move item , use in other javascript function. here fiddle.js : http://jsfiddle.net/oe0fg84b/ as mentioned @john, looks you're storing x , y coordinates of draggable image in elements #source_x , #source_y, respectiv...

jquery - I can't select the parent element of an element that was created dynamically -

this <ul> holds list items in first place: <ul style="max-width:500px" id="currentroles" class="list-group"> <li class="currentrole list-group-item"> <div class="col-md-6"> @role.name </div> <a href="#" class="linkremoverole">remove role</a> </li> </ul> i remove list items , append them new list using codes below , works fine: $('.linkremoverole').click(function (event) { var rolename = $(this).siblings().text(); $(this).parentsuntil('#currentroles').remove(); $('#removedroles').append( '<li class="removedrole list-group-item">' + '<div class="col-md-6">' + rolename + '</div>' + '<a href="#" c...

How to run JUnit test case with tomcat -

i trying run junit test case application 1 of method call server location geo-coordinates, not connecting server url tomcat server not started , if start tomcat server enable find location. can guide me through or need configuration between junit , tomcat. in advance.

regex - sed - $ in Zeichenauswahl -

i have sed expression replace "$about" "about" sed 's/$about/"about"/g i want change it, $about replaced, when followed whitespace or end of line. whitespaces works: sed 's/\($about\)\([[:space:]]\)/"about"\2/g' wondefull! end of line? tried inserting $ : sed 's/\($about\)\([[:space:]$]\)/"about"\2/g' but not work! \$ not work. when insert $ without [[:space:]], works (but eol, not whitespaces of course). i missing something, not? please tell me is. you need use alternation otherwise $ literal $ inside character class: sed -e 's/($about)([[:space:]]|$)/about\2/g'

javascript - XDSOFT plugin datimepicker Issue -

i'm using xdsoft datetimepicker plugin, found here: http://easycodestuff.blogspot.in/2016/01/using-date-time-pickers-in-angularjs.html (very useful , informative blog) , have set mintime, mindate 0 mean current date, time can selected. fine today , allowed set future time now. setting mintime 0 future dates , making select current time future date. here demo plunker : http://plnkr.co/edit/vthuaraxak3ov4naa5tz?p=preview . here can select today's date , current time if select tomorrow's date i'm allowed select current time tomorrow. i need solution time can selected future date. also when date selected, manually entry still enabled,which means though mindate set 0, can select past dates. how disable once selected? will thankful if can help. i have created function("onchangedatetime") check date , set time validation. try code, working plunker. <!doctype html> <html> <head> <link rel="stylesheet...

android - onActivityResult in First Activity not returning result after finish second activity -

activity calls activityb using following code startactivityforresult(new intent(context, activityb), 1); activity b calls activity c by: startactivityforresult(new intent(context, activityc), 2); i finish activity c return result , start new activity d there startactivity(new intent(context, activityd); setresult(result_ok, new intent()); finish(); i want finish activity , activity b on return result but not getting return result. in case onactivityresult no calling in activity , activity b in short want function btngo.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent next = new intent(activityc.this, activityd.class); startactivity(next); setresult(result_ok, next); finish(); } }); i getting 1 thing of both. going next activity or returing result back. want going next activity return result simultaneously...

javascript - Upgrade Cordova Version of an iOS app -

how can transfer cordova ios app 1 pc other? app made in other version of cordova , want upgrade cordova version. you can follow steps below: in new pc, install latest version of cordova using npm install -g cordova command in new pc, create new cordova project using cordova create project_name command in desired location using terminal now navigate newly create project folder, copy contents of www folder , config.xml file old project in old pc , replace same in newly created project folder. in terminal, navigate project root directory , install required plugins in new project using cordova plugin add plugin_name command after installing required plugins, add ios platform project using cordova platform add ios command now build project using cordova build ios command you go now. gotta test project once thoroughly plugin may not works expected latest cordova version.

go - Golang: Mixing Gin with an UDP server -

i'm trying use both udp server listen continuously datagrams , http server, string "udp server , listening on port..." , command "server.run()" never reached. package main import ( "fmt" "github.com/gin-gonic/gin" "log" "net" ) func handleudpconnection(conn *net.udpconn) { buffer := make([]byte, 8096) n, addr, err := conn.readfromudp(buffer) if err != nil { log.fatal(err) } else { fmt.println("udp client: ", addr) fmt.println("received udp client: ", string(buffer[:n])) } } func main() { server := gin.default() host, port := "localhost", "41234" udpaddr, err := net.resolveudpaddr("udp4", fmt.sprintf("%s:%s", host, port)) if err != nil { log.fatal(err) } conn, err := net.listenudp("udp", udpaddr) if err != nil { log.fatal(err) } def...

Compound Promises in Typescript / Javascript? -

i writing angular2 based mobile app, using typescript nativescript runtime, facing issues promises. have homecomponent, able call various bluetooth functions. these require human interaction (like selecting device) , wait periods bluetooth scan, take several seconds complete. i want abstract methods promises, have done this: homecomponent.ts: bluetoothadd() { this.isscanning = true; this._ble.scan().then( // log fulfillment value function (val) { this.isscanning = false; //hide activity indicator this.connect(this.ble._peripheral); }) .catch( function (reason) { this.isscanning = false; //hide activity indicator console.log('handle rejected promise (' + reason + ') here.'); }); } bluetoothutils.ts (this imported above this._ble): var devices: array<string>; var _peripheral: any; export function scan() { return new promise((resolve, reject) =...

angularjs - Angular 2 order of loading content -

with angular 2 content loading in "wrong" order. i new angular 2 , decided start simple. i expect see menu.ts content before first.component.ts "hello world" content. seems content router loads before content of app.compontent. when put @router @ bottom typescript says "declaration expected" not solution either. is there no other way placing menu @ each router request? app.component.ts import { component } '@angular/core'; import { routes, router_directives } '@angular/router'; import { firstcomponent } './components/firstcomponent/firstcomponent'; @routes([ { path: '/', component: firstcomponent // hello world, loads before component below?! } ]) @component({ 'directives': [router_directives], 'selector': 'app', 'templateurl': `/templates/firstcomponent.menu` }) export class appcomponent { constructor () {} opened: boolean = true; ...

Object Array length returns undefined in JavaScript -

i have array displayed below in console. console.log(roles); user {0: "adminuser", 1: "authenticateduser"} although array unable array length. console.log(roles.length); undefined but if access array using index, able value shown below. console.log(roles[0]); adminuser it not array, object. the reason why can access using array-like notation js supports square brackets access notation. since have numbers keys, can bit misleading.

android - Why use GoogleAPIClient to request location updates? -

i noticed it's possible request location updates in (at least) 2 different ways. using googleapiclient : // callback when googleapiclient connected @override public void onconnected(bundle connectionhint) { locationservices.fusedlocationapi.requestlocationupdates( mgoogleapiclient, mlocationrequest, this); }   using locationmanager : locationmanager locationmanager = (locationmanager) getactivity(). getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 0, locationlistener);   google seems promote method 1 in tutorial "receiving location updates" . it's unclear me benefit of method 1 is, because method 2 working fine me (i'm using both methods in 2 different places in app). the new method location updates use fused location provider in android. best thing fused location provider api you not need worry location updates gives latest , accurat...

css - How to create div that automatically slides in and out with CSS3 -

i want create div automatic slides in when calling webpage , ability close x , if not press x automatic closes after 5 sec. so lets say: top of webpage slide in , div 200px width , 200px height. how can create css3 transitions? follow below code slider div using css3: first add below css in html: <style> .slider { background: #000; color: #fff; height: 20px; position: relative; padding: 30px; -moz-animation-name: dropslider; -moz-animation-iteration-count: 1; -moz-animation-timing-function: ease-out; -moz-animation-duration: 1s; -webkit-animation-name: dopslider; -webkit-animation-iteration-count: 1; -webkit-animation-timing-function: ease-out; -webkit-animation-duration: 1s; animation-name: dropslider; animation-iteration-count: 1; animation-timing-function: ease-out; animation-duration: 1s; } @-moz-keyframes dropslider { 0% { -moz-transform: translatey(-250px); } 100$ { -mox-transf...

Is it possible to put elements of array to hash in perl? -

example of file content: >random sequence 1 consisting of 500 residues. vilvwrisemnptheiypevsyedrqpfrcfdeginmqmgqkscrncliftrnafaygiv hflewgillthiihcchqiqggcdctrhpvrfypqhrnddvdkpcqtkspmqvrygddsd; >random sequence 2 consisting of 500 residues. kaaatkkpwadtipyllctfmqtsglewlhtdynnfssvvcvryfeqfwvqcqdhvfvkn knwhqvlweeyavidsmnfawpplyqsvssnldstermmwwwvyyqfedniqirmewcni ysgflsreklelthnkcevcvdkfvrlvfkqtkwvrtmnnrrrvrfrgiyqqtaiqeyhv hqkiirypchvmqfhdpsapcdmtrqgkrmnfcfiiflytlyevkywmhfltylnclehr; >random sequence 3 consisting of 500 residues. aycscwrihnvvfqkdvvlgywghcwmswgsmnqpfhrqpynkyfcmapdwcnigtyawk i need algorithm build hash $hash{$key} = $value; lines starting > values , following lines keys. what have tried: open (data, "seq-at.txt") or die "blabla"; @data = <data>; %result = (); $k = 0; $i = 0; while($k != @data) { $info = @data[$k]; #istrina pirma elementa if(@data[$i] !=~ ">") { $key .= @data[$i]; $i++; ...

python - Removing last character of JSON object -

i'm looking way remove last character of line of json, provided it's not curly brace. i've whole file of json reason of lines end few spaces , 0. i'm trying remove 0 if appears, or skip line if doesn't. for example: ignore this: {"menu": { "id": "file", "popup": { "menuitem": [ {"value": "new", "onclick": "createnewdoc()"}, ] } }} and remove 0 this: {"menu": { "id": "file", "popup": { "menuitem": [ {"value": "new", "onclick": "createnewdoc()"}, ] } }} 0 i've tried using: line = line.rstrip('0') but doesn't seem doing anything. you can use regular expressions: import re re.sub(r'0$', '', line)

filesystems - Unable to do "git add ." -

i able add directory git , git commit strangely, when doing $ git add . i getting following error: warning: lf replaced crlf in .idea/workspace.xml. file have original line endings in working directory. warning: lf replaced crlf in grails-app/controllers/com/abc/pqr/rep ortcontroller.groovy. file have original line endings in working directory. warning: lf replaced crlf in grails-app/domain/com/abc/pqr/report.g roovy. file have original line endings in working directory. fatal: unable stat 'dirname#com.abc.pqr.report': no such file or directo ry i have gone through this answer , if try: $ git rm dirname#com.abc.pqr.report i error: fatal: pathspec 'dirname#com.abc.pqr.report' did not match files surprisingly there no file on searching through above directory, not find such file described above. it worth mentioning there file dirname/#com.abc.pqr.report in root directory(i.e. file #com.abc.pqr.report under dirname under root directory). strangely no...

haskell - Understanding `System.ZMQ4.Monadic`'s `forall` in Signature -

looking @ runzmq system.zmq4.monadic : what meaning of type signature? λ: :t runzmq runzmq :: transformers-0.4.2.0:control.monad.io.class.monadio m => (forall z. zmq z a) -> m in particular, don't understand forall . from zqm docs : the zmq monad modeled after st , encapsulates context. uses uninstantiated type variable z distinguish different invoctions of runzmq , prevent unintented use of sockets outside scope. cf. paper of john launchbury , simon peyton jones lazy functional state threads. so z parameter acts s parameter in st s a . one explanation of st monad haskell wiki: https://wiki.haskell.org/monad/st

java - Traversing nested HashMap in FreeMarker -

i have following data structure need traverse in freemarker final map<string,map<string,list<person>>> root = fillmap(); for simplification imagine sort of taxonomy have “continent”, “country”, “person”, person class person{ string name; string id; } if want more clarification: you might perform following operations in java (focus on var names) map<string,list<person>> countriesforcontinent = root.get(“africa”); list<person> personsforcountry = countriesforcontinent.get(“kenya”); in freemarker, need able list each continent in map; each continent, each country; each country, each person. my html number of tabs (one per continent) , on each tab, have country section, , in each section list person belonging country. difficulties i having difficulties goes inside list tags. know example root continent not make sense; don't know how fix it. <#list root continent > ${continent} <#list continent country >...

How to get the Font Size of Text View in Android -

i have created textview , assign text size 32pt . want increase text size on button click. i have written following code, unable understand how current size of text btnincreasefont.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { tvnews.settextscalex(50); } }); kindly guide me use: textview.settextsize(getresources().getdimension(r.dimen.textsize)); sample dimensions.xml <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="textsize">15sp</dimen> </resources>

android - setOnMyLocationChangeListener and setMyLocationEnabled arent work on map -

Image
i doing written in link isn't working(image1)(line 46, 47 , 53) https://io2015codelabs.appspot.com/codelabs/fire-place#7 for image -> mapsactiviy.java import android.location.location; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.content.contextcompat; import android.view.viewtreeobserver; import android.widget.button; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.googlemap.onmylocationchangelistener; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.latlngbounds; public class mapsactivity extends fragmentactivity implements onmapreadycallback { private googlemap mmap; private latlngbounds.builder mbounds = new latlngbounds.builder(); @override protected void ...

r - t.test for all combinations of a grouping factor first by subsetting -

i trying t.test combinations of grouping factors, first choosing , subsetting data based on selection criteria column. the structure of data: str(mydata) 'data.frame': 240 obs. of 6 variables: $ group : chr "g1" "g1" "g1" "g1" ... $ category: chr "cat1" "cat1" "cat1" "cat1" ... $ subgroup: chr "sg1" "sg1" "sg1" "sg1" ... $ score : num 0.156 0.131 0.092 0.319 0.179 ... $ sd : num 0.0768 0.0768 0.0768 0.0768 0.0768 ... $ se : num 0.0172 0.0172 0.0172 0.0172 0.0172 ... i have 3 groups in the group column: g1 , g2 , g3 have 4 categories in category column: cat1 , cat2 , cat3 , cat4 have twelve subgroups: sg1 , sg2 , until sg12 currently, creating list of combinations subgroup names first subsetting data based of group id, in example g1 , g3: combinations <- combn(unique(mydata[mydata$group %in% c("g1",...

scala - Akka 2.4.6 - where is ask (or ?) method? -

i learning play akka , scala. the akka documentation says can message actor using ? or ask method. there no ? or ask in actorref class in version of akka using (2.4.6). was moved somewhere or deprecated? was moved somewhere or deprecated? no. ? defined implicit def inside asksupport trait , implicit conversion actorref type: object askpattern { implicit class askable[t](val ref: actorref[t]) extends anyval { def ?[u](f: actorref[u] ⇒ t)(implicit timeout: timeout): future[u] = ask(ref, timeout, f) } as can see, implicit works actorref , implicit class accepts 1 argument of said type. means ? method applicable actorref via implicit conversion . as @sergey notes in comments, in order bring implicit in scope, you'll need import akka.pattern.ask

javascript - Why is 'angular' not defined in a separate controller file? -

i declare angular module in 1 file, app.js this: hookpointapp = {}; (function () { "use strict"; var hookpointapp = angular.module("hookpointapp", ["ngresource"]); hookpointapp.controller("rootcontroller", [ "$scope", "$http", function($scope, $http) { $scope.getcurrentuser = function() { $http.post("/account/currentuser", { .... .then(function(data) { $scope.currentuser = angular.fromjson(data.data).id }, ... }; $scope.getcurrentuser(); }]); })(); this seems work, no errors reported when loads , runs function. then, in separate areas.js file, try declare controller module, so: (function () { 'use strict'; angular.module("hookpointapp").controller('areascontroller', ["$scope...

c# - Too many vlc activeX controls on form crashes app -

i have video monitoring app using vs2012 in c# using vlc activex plugin. can embed , watch around 30 videos no issues. once around 35, random crashes. @ 40, crashes immediate. crashes don't give me info, nvidia video driver crashed message. error pops gdi 'parameter not valid' error. rule out problems code, got rid of control items except vlc , problem still occurs. if run 2 instances on app, each 20 video windows, have no issues. is limit hitting because of single thread? workaround ideas? you need more server , memory space more 25 videos in single screen, local machine i7 processor not resolve issue. know vlc best video development kit, , kit can give more video others in single screen low memory , cpu utilization. best wishes resolve issue asp, , post article if resolve issue

c++ - Should name lookup be deferred for a dependent class/namespace-name in a class-member-access expression? -

the following code rejected both clang , gcc template<typename t> void f(t t) { t.dependent::f(); // clang accepts, gcc rejects t.operator dependent*(); // both reject } struct dependent { void f(); }; struct : dependent { operator dependent*(); }; template void f<a>(a); my reading of standard suggests both expressions should accepted. in both cases, dependent can type name. in both cases, name dependent "looked in class of object expression" t . t type-dependent expression, lookup should deferred until template instantiated. is there i'm missing? edit : if intended such name not dependent, rationale decision? can see makes life easier implementor if not have defer evaluation of construct t.operator x::dependent* or t.x::dependent::f x either namespace or type name. i'm not clear on whether intended or unintended side-effect of current wording. relevant quotes c++ working draft n3337: 3.4.5 class member acc...

javascript - Using JQueryUI as an audio Seek control, and rebinding a new slider to the same <audio> control when a song is changed -

thank looking @ question. fiddle here . i trying implement audio player many songs on page. using jqueryui slider , html5 audio, 1 audio element , multiple sliders. the problems right are: the slider not animate audio. the slider not seek audio. previously, when both of above working, once chose spot in song, slider no longer animate. i have created function rebindslider() when new song clicked. inside function, 2 things happen: a) new slider created, slide , stop listeners defined, , b) new slider bound timeupdate event on audio element new song. feel should need, slider not bind, , undefined error can seen when try drag slider. using single slider, , single audio element, have gotten 90% way there; introduced multiple divs sliders though, problems started occurring. here code rebindslider : function rebindslider(sliderdiv) { var createseek = function() { sliderdiv.slider({ value: 0, step: 1, orientation: "horizontal", ...

android - RecyclerView displaying every view on a different page after moving to api23 -

Image
i have moved api 22 23 today , recycler view presents undesired behaviour.it puts every row item - view on separate page. i'm sorry putting multiple classes in 1 place not submit question otherwise due 'unformatted' code please see below: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/grey"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="100dp" android:layout_marginbottom="1dp" android:padding="10dp" android:background="@drawable/ripple...

node.js - How to use google analytics from jade file -

i want track users of website. since not have old fashioned html file, should adapt given code jade syntax or can leave script untouched , include somehow? in case need convert jade syntax, can auto generated tool. <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-xxxxxxxx-x', 'domain.com'); ga('send', 'pageview'); </script> instead of having code file , load it. inline (like trevor suggested better). in order accomplish have make use of script. tag.... not script see below: script. (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ ...

Filtering results of SPARQL queries -

i want retrieve 20th century italian novelists' name. i've written this: select ?label where{ ?novelist yago:italiannovelists. ?novelist rdfs:label ?label. filter (langmatches(lang(?label), "en")) } order ?label how can filter results? there several options. here i'd suggest two: use pattern ?novelist dct:subject dbc:20th-century_novelists , if can rely on classification. select ?label where{ ?novelist yago:italiannovelists; rdfs:label ?label; dct:subject dbc:20th-century_novelists. filter (langmatches(lang(?label), "en")) } order ?label define birth range or life-span range. example birth range: select ?label where{ ?novelist yago:italiannovelists; rdfs:label ?label; dbo:birthdate ?date. bind (year(?date) ?year) filter (langmatches(lang(?label), "en")) filter (?year > 1882 && ?year < 1972) } order ?label with option 2 more results depending on range, might ...

Wrong sorted array.Javascript -

i have following javascript array: a=[0, "b", 2, 3, 4, 5, 1, 9, 8, "a", "a", 11010] now want sort , this a.sort() but following: [0, 1, 11010, 2, 3, 4, 5, 8, 9, "a", "a", "b"] which think wrong because 11010 greater 2 , should after 2. if following: a.sort(function(a,b){return a-b;}); i following: [0, "b", 11010, 2, 3, 4, 1, 8, 9, "a", "a", 5] can explain me why happening?thank you your array has both numbers , strings. need supply compare function. a = [0, "b", 2, 3, 4, 5, 1, 9, 8, "a", "a", 11010] a.sort(function(c1, c2) { if(typeof c1 === "number" && typeof c2 == "number") { return c1 - c2; } else { return (c1 + "").localecompare(c2); } );

Hide/change the application screen picture from Recent Apps Android 4.x -

i need hide application screen list of running applications when click recent apps button in android 4.x. data application contains leak sensitive information if have application running in background. still application shown in recent apps, not screenshot. how do this? to exclude application recent apps should following: on activity on manifest android:excludefromrecents="true" and can disable thumbnail on activity containing sensitive data adding flag_secure window: getwindow().addflags(windowmanager.layoutparams.flag_secure);

angularjs - Angular 2 - injecting service into a component that the service created -

i have service, this: constructor(private containerref: viewcontainerref, private resolver: componentresolver) {} create(options: any) { this.resolver.resolvecomponent(testcomponent) .then((factory: componentfactory<testcomponent>) => { let ref = this.containerref.createcomponent(factory); }); } this creates testcomponent , good. problem comes, when try inject same service component. constructor(private service: randomservice) { ... } and here exception: error: uncaught (in promise): typeerror: cannot read property 'query' of null . i can inject other service component, not 1 created it. there way it?