Posts

Showing posts from July, 2015

android - JNI: HOWTO FIND 'public interface LocationListener {}' by C -

i want use "requestlocationupdates" , set listener callback. got error "cannot find locationlistener class". pls give me hint. here code: jstring gpsproviderstr = (jstring)(*env)->getstaticobjectfield(env, clazz, providerid); //error: jclass listenerclass = (*env)->findclass(env,"android/location/locationlistener"); //cannot find class jmethodid mlistener = (*env)->getmethodid(env, listenerclass, "<init>", "()v"); jobject listenerobj = (*env)->newobject(env, listenerclass, mlistener); jmethodid mreqlocupdates = (*env)->getmethodid(env, clazz, "requestlocationupdates","(ljava/lang/string;lflandroid/location/locationlistener;)v"); //callback? right? (*env)->callvoidmethod(env, locmgrobj, mreqlocupdates, gpsproviderstr, interval, 0, listenerobj); //set callback locationlistener interface, therefore has definition no constructor. class

boost - Shared memory alignment in C++ -

is there alignment allocated shared memory? if yes, operating system? for example, allocating shared memory in boost: boost::interprocess::shared_memory_object* segment = new boost::interprocess::shared_memory_object( boost::interprocess::create_only, "name", boost::interprocess::read_write); segment->truncate(10000); the shared/virtual memory system allocates , maps memory pages , aligned page size. see list of pages sizes here . page size cpu , os specific. not aware of modern cpus use page sizes smaller 4kb. on posix system can find out page size using sysconf(_sc_pagesize) . in case when huge pages in use, call returns smallest page size.

elixir - Alias multiple names in the same line -

i need alias several models in same file , it's taking lot of visible space in file when doing usual: alias project.model1 alias project.model2 ... alias project.modeln i looked docs , don't think it's possible this: alias (project.model1, project.model2,...,project.modeln) do need this: alias project.model1 alias project.model2 ... alias project.modeln or there alternative? you can use curly braces that: alias project.{model1,model2,model3} see http://elixir-lang.org/getting-started/alias-require-and-import.html#multi-aliasimportrequireuse

java - jackson2 - unexpected field in JSON -

i'm trying write json java object. works fine until write values string using objectmapper. string shows unexpected field in json document called "map". i want this: { "name": [ { "a": "1", "b": "2", "c": "3", "d": "4", "e": "5", "f": "6" } ] } i this: { "name": [ { "map": { "a": "1", "b": "2", "c": "3", "d": "4", "e": "5", "f": "6" } ] } this class i've defined object want convert json: public class someclass{ private list<jsonobject> name; //getters, setters } can me? please notice inside class serializing have parameter called map if c

python - What is the difference between @types.coroutine and @asyncio.coroutine decorators? -

documentations say: @asyncio.coroutine decorator mark generator-based coroutines. enables generator use yield call async def coroutines, , enables generator called async def coroutines, instance using await expression. _ @types.coroutine(gen_func) this function transforms generator function coroutine function returns generator-based coroutine. generator-based coroutine still generator iterator, considered coroutine object , awaitable. however, may not implement __await__() method. so seems purposes same - flag generator coroutine (what async def in python3.5 , higher features). when need use asyncio.coroutine when need use types.coroutine , diffrence?

javascript - .load() not working on ul li click -

here code $(document).ready(function(){ $("#work").click(function(){ $("#container").load("about/work.html"); }); $("#profile").click(function(){ $("#container").load("profile.html"); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul> <li><a id="work" href="">work</a></li> <li><a id="profile" href="">profile</a></li> </ul> <div id="container"></div> when click on work or profile requested page flashes in container div , sometime stays in if run same script on button click loads page without problem. how can make work li ? add event.preventdefault $(document).ready(function(){ $("#work").click(function(event){ event.preventdefault(); //changed here $(&q

php - How to Print to Query Code [PDO] -

try { $dbh = new pdo("mysql:host=$host", $root, $root_password); $dbh->exec("insert test (col1, col2, col3) values (test1, test1, test1)") or die(print_r($dbh->errorinfo(), true)); } catch (pdoexception $e) { die("db error: ". $e->getmessage()); } i used print on screen sql query: $sth->debugdumpparams(); internal 500 error how can print query? almost every line of code snippet wrong. there no $sth debugdumpparams starter. not mention way running query totally wrong. here how should be $dbh = new pdo("mysql:host=$host", $root, $root_password); $dbh->setattribute( pdo::attr_errmode, pdo::errmode_exception ); $sql = "insert test (col1, col2, col3) values (?,?,?)"; $sth = $dbh->prepare($sql); $sth->execute(['test1', 'test1', 'test1']) now can use whatever method echo query, debugdumpparams or echo $sql, neither of because print same h

java - populating alert dialog with list view,JSON -

i trying fill alert dialog son response how ever getting following error : java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.listview.setadapter(android.widget.listadapter)' on null object reference i have inflated list view in oncreate other posts suggest i have included relevant xml , java code <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <checkedtextview android:id="@+id/text1" android:layout_width="match_parent" android:layout_height="?listpreferreditemheightsmall" android:checkmark="?android:attr/listchoiceindicatorsingle" android:gravity="center_vertical" android:

encoding - Set locale in Docker container -

i use image: registry.access.redhat.com/jboss-webserver-3/webserver30-tomcat7-openshift when run container default locale is: lang= lc_ctype="posix" lc_numeric="posix" lc_time="posix" lc_collate="posix" lc_monetary="posix" lc_messages="posix" lc_paper="posix" lc_name="posix" lc_address="posix" lc_telephone="posix" lc_measurement="posix" lc_identification="posix" lc_all= i need change iso-8859-15 how have in dockerfile? i first try @ runtime: # localedef -c -i fr_fr -f iso-8859-15 fr_fr.iso-8859-15 # export lang="fr_fr.iso-8859-15" but when exit container , enter again it's posix. update: tried: from registry.access.redhat.com/jboss-webserver-3/webserver30-tomcat7-openshift:1.2-12 user root run localedef -c -i fr_fr -f iso-8859-15 fr_fr.iso-8859-15 run export lang="fr_fr.iso-8859-15" but when start container , perform lo

scale - Fixed text inside or adjacent to QProgressBar with scaling font size in Qt -

Image
i new qt (using qt creator) , qprogressbar . interested in learning how have fixed text value (not value of progress bar) inside or adjacent left of qprogressbar , have font size scale according size of progress bar. for example: or i have considered using qlabel failed , not find examples online. any code sample illustrating solution me understand , learn appreciated. if label inside progressbar do, here example. might not want, should send in right direction. adjust font size in resize event. in example font size calculated based on size of label, same size progress bar. #include <qapplication> #include <qprogressbar> #include <qwidget> #include <qlabel> #include <qlayout> #include <qtimer> class widget : public qwidget { q_object qprogressbar progressbar; qlabel *label; public: widget(qwidget *parent = nullptr) : qwidget(parent) { progressbar.setrange(0, 100); progressbar.setvalue

node.js - How to get FormData in Express js? -

Image
i'm trying upload file express server. client code looks this: axios.post('localhost:3030/upload/audio/', formdata) and in express server: app.use(bodyparser.urlencoded({ extended: true })); app.use(bodyparser.json()); app.post('/upload/audio/', function uploadaudio(req, res) { let quality = ['320', '128']; let file = req.body; console.log(file) res.send('frick') } however, though mp3 file sent: the req.body empty when logged (note empty object): how can formdata (and file) in express.js? as @tomalak said body-parser not handle multipart bodies. so need use third party module suggest use awesome module multer i tried code, hope can you app.post('/upload/audio/', function uploadaudio(req, res) { var storage = multer.diskstorage({ destination: tmpuploadspath }); var upload = multer({ storage: storage }).any(); upload(req, res, function(err) { if

android - Cannot intercept SSL after installing self-signed certificate -

this , works fluently. i have generated certificate burp proxy , installed on android (android 5.1.1) device in order intercept communication. unfortunatley, recieve warning saying "network may monitored unknown third party", , im not able navigate anywhere ssl on mobile browser. why happening? , lets me intercept fluently... please notice no ssl site working, not specific app implements certificate pinning mechanism.

Add a space after 3 characters in excel by VBA -

Image
is there function add space after every 3 character in excel vba? name of column header "post" what have tried? 1 way go - note : it's check understand code before using it function addspace(rng range) string dim integer dim str string = 1 len(rng.value) step 3 str = str & " " & mid(rng.value, i, 3) next addspace = mid(str, 2) end function for string in cell a1 , use formula =addspace(a1) split string required. example below edit: updated code - tyeler

How to add to String Array from inside recursive function in C -

i trying write c function give me binary representation of number n . function have prints number correctly; string array word updated same data being printed: #include <stdio.h> #include <stdlib.h> #define maxbin 100 void printbitsrec(unsigned n, int n_bits, char *w) { if (n_bits-- > 0) { printbitsrec(n >> 1, n_bits, w); if (n & 1) { printf("1"); *w++ = '1'; } else { printf("0"); *w++ = '0'; } } } void printbits(unsigned n, int n_bits, int ret) { char word[maxbin]; printbitsrec(n, n_bits, &word[0]); word[n_bits + 1] = '\0'; if (ret) printf("\n"); printf("word = %s\n", word); } int main() { printbits(2, 4, 1); } is there more elegant way this? doing wrong in code? here's attempt: #include <stdio.h> #include <stdlib.h> #define m

ios - WebView properties don't work if the app is launched via a Push Notificaiton -

our app uses webview load part of our app. we've stumbled across scenario found webview properties don't work if app has cold start via push notificaiton when application launched normally: react native page , once page done loading alert created in onloadend app launched via remote push notification: when app removed memory double clicking home button , swiping app away, , user clicks on push notification launches app - page loads fine but function onloadend not run. render() { return( <view style={ styles.iospadding }> <webview source={{uri: 'https://github.com/facebook/react-native'}} onloadend={() => { alert("webpage loaded !"); }} /> </view> ); } i've been looking around workaround scenario. need ability know when webpage loaded.

How to stop IMAP notice error in php? -

i'm trying fetching email particular email account. when i'm adding correct email address , password works fine, when giving wrong details returning lots of notice , warning errors. added @ preventing errors, works errors hided not hiding, error not showing line number well. below code $mbox = @imap_open("{mail.b*********n.com:143/novalidate-cert}", $semail, $spwd); $mc = @imap_check($mbox); $result = @imap_fetch_overview($mbox,"1:{$mc->nmsgs}",0); if(isset($result)){ foreach ($result $overview) { //echo "#{$overview->msgno} ({$overview->date}) - from: {$overview->from} //{$overview->subject}\n"; $a = "from: {$overview->from}"; $s = explode('<',$a); if(isset($s[1])){ //echo $s[1].'<br />';

ios - Click on profile from feed - swift -

i have feed showing posts users wanted post something. trying display name of user posted in button (that working). when user pressing button should show viewcontroller name of button user pressed (that semi-working). what happens is, when user pressing name of user post, name showing in other viewcontroller not same name user pressed. i hope understand :-) let me walk through code: first viewcontroller before viewdidload, creating string: var sendname = "no name recieved" further down page code: override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell:updatetableviewcell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! updatetableviewcell let update = updates[indexpath.row] cell.namebutton.settitle(update.addedbyuser, forstate: .normal) sendname = (cell.namebutton.titlelabel?.text)! } my preparef

spring - Dart CORS doesn't work -

hello want make request spring server. i'm getting error because of restricted cors option. added filter because annotations doensn't work: @component public class corsfilter implements filter { public corsfilter() { } @override public void dofilter(servletrequest req, servletresponse res, filterchain chain) throws ioexception, servletexception { httpservletrequest request = (httpservletrequest) req; httpservletresponse response = (httpservletresponse) res; response.setheader("access-control-allow-origin", "*"); response.setheader("access-control-allow-credentials", "true"); response.setheader("access-control-allow-methods", "post, get, options, delete"); response.setheader("access-control-max-age", "3600"); response.setheader("access-control-allow-headers", "content-type, accept, x-requeste

c# - Unable to assign DateTime column's value as String -

facing error: the given value of type string data source cannot converted type datetime of specified target column while inserting data database using sqlbulkcopy only in 1 server, other server , in development environment working fine. using (sqlbulkcopy sbc = new sqlbulkcopy(dbsqlconn)) { dbsqlconn.open(); // inserting data table it000 sbc.destinationtablename = strschema + storedprocedurenames.uploadtablegenerichrit000; // number of records processed in 1 go sbc.batchsize = tbluploaddata.rows.count; sbc.columnmappings.add("txtemployeeno", "txtemployeeno"); sbc.columnmappings.add("txtcompany", "txtcompany"); sbc.columnmappings.add("txtemptypecode", "txtemptypecode");

hdfs - What is the cost of a Spark shuffle? -

data information: your data have n lines; each line b bytes long; each line belongs 1 among g groups, given numeric variable thegroup ; initially, groups randomly sorted accross partitions. cluster information: your sparkcontext has e executors; each executor has n nodes; transferring 1 kb 1 executor costs pingtime (aggregation time included) there's 1 output cable , 1 input cable on each executor. your mission: groupby(thegroup) using spark, iff it's not long do. big problem: what's estimate of how time t operation going take? wild guesses far: imagine t be: increasing in n ( n.e )⁻¹ log( n ( n.e )⁻¹ ) idea: because there n ( n.e )⁻¹ lines on each node , might have sorted first increasing in b , obviously increasing in pingtime increasing in g , have no idea how: perhaps increasing in g ² while g < n decreasing in n i need estimate of magnitude order of t , i'm still missing terms (like relationship between e

saving cookies in Javascript -

hey trying save cookie , load/read again on reload. whenever reload error message mycookie undefined . can me out. var mycookie window.onload = function () { console.log(mycookie); var = document.getelementbyid("style1"); if (mycookie == undefined) { console.log("new"); var mycookie = document.cookie = "common.css"; } else { console.log("old"); } a.href = mycookie; } function change() { var = document.getelementbyid("style1"); if(mycookie=="common.css") { mycookie = document.cookie = "common2.css"; }else{ mycookie = document.cookie = "common.css"; } a.href = mycookie; } you need read more javascript cookies. using unnecessary variable you're declaring again on local scope. when window loads uninitialised variable such var mycookie; will undefined . should start initialling document.cookie var mycookie = document.c

MySQL not picking up symlinked cnf changes in 5.7.13 on Ubuntu 16.04 -

edit: may have found might part of issue, further edit @ bottom. i've got new server setup running mysql seems okay. except whenever use show variables configuration settings can see in .cnf file not being shown , appear general defaults being shown. appear while can use mysql fine, settings defaults. i trying figure out why .cnf not being used. have taken number of steps check being loaded , these laid out below. once sure being loaded @ loss how explain why settings aren't being used. appreciated. the location of cnf file this: /etc/mysql/mysql.conf.d/mysqld.cnf i have attempted verify being used following: sudo /usr/sbin/mysqld --verbose --help | grep -a 1 "default options" default options read following files in given order: /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf /etc/my.cnf not exist /etc/mysql/my.cnf symlink /etc/alternatives/my.cnf /etc/alternatives/my.cnf symlink /etc/mysql/mysql.cnf /etc/mysql/mysql.cnf contains:

python 3.x - Redirect request to different Resource(Falcon) -

i using python3.4 , falcon1.0 . want redirect request resource in falcon api. for example, have 2 resources: class res1(object): def on_get(self, req, resp): print("i'm on resource 1") resp.status = falcon.http_200 class res2(object): def on_get(self, req, resp): print("i'm on resource 2") resp.status = falcon.http_200 and api url format localhost/{id} . want call res1 if id 1 else res2 . exception falcon.httpmovedpermanently(location) you can try or explain more

java - Word count in a string -

ok,now know question has been asked many times , answered too, came across question , wrote this(poor piece of) code without taking clue previous answeres,and although giving me correct output,i can't decide if correct. public class wordcount { public static void main(string[] args) throws ioexception { system.out.println("enter string"); bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string s1= br.readline(); s1 = s1+" "; string ns = ""; int count = 0; for(int = 0; < s1.length(); i++) { char ch = s1.charat(i); if(ch == ' ') { //ns = ns+ch; count++; } /*else { ns = ns+ch; }*/ } system.out.println("there "+count+" words in string"); } } int linecount = yourstring.trim().split("\\s+").length; the split() function returns array c

node.js - How to use $lookup on embedded document field in mogodb -

please have look, appriciated var user = new schema({ name: string, }); var comments = new schema({ title : string , body : string ,user_id : {type: schema.types.objectid, ref: 'user' } , date : date }); var blog = new schema({ author : string , title : string , body : string , date : date , user_id :{type: schema.types.objectid, ref: 'user' } , comments : [comments] }); db.blogs.aggregate([ { $match : { "_id" : objectid("57e3b7f4409d80a508d52769") } }, { $lookup: {from: "users", localfield: "user_id", foreignfield: "_id", as: "user"} }, ]) this returns [ { "_id": "57e3b7f4409d80a508d52769", "author": "tariq", "title": "myfirstpost", "body": "this first post", "user_id": "57e3b763f7bc810c08f9467a",

elasticsearch python client - work with many nodes - how to work with sniffer -

i have 1 cluster 2 nodes. i trying understand best practise connect nodes, , check failover when there downtime on 1 node. from documentation : es = elasticsearch( ['esnode1', 'esnode2'], # sniff before doing sniff_on_start=true, # refresh nodes after node fails respond sniff_on_connection_fail=true, # , every 60 seconds sniffer_timeout=60 ) so tried connect nodes this: client = elasticsearch([ip1, ip2],sniff_on_start=true, sniffer_timeout=10,sniff_on_connection_fail=true) where ip1/ip2 machine ip's (for example 10.0.0.1, 10.0.0.2) in order test it, terminated ip2 (or put non existent if) now, when trying connect, get: transporterror: transporterror(n/a, 'unable sniff hosts - no viable hosts found.') even ip1 exist , up. if trying connect this: es = elasticsearch([ip1, ip2]) then can see in log if client not getting response ip2, move ip1, , return valid response. so missing here something? thought s

c# - Convert the date & time to GMT+10 date & time -

i want convert local time gmt+10 time. using asp.net , website hosted in azure. , in after date & time should set activitydate in below code. timezoneinfo timezoneinfo; datetime datetime; timezoneinfo = timezoneinfo.findsystemtimezonebyid("e. australia standard time"); datetime = timezoneinfo.converttime(datetime.now, timezoneinfo); datetime ausdatetime= datetime.tostring("yyyy-mm-dd hh-mm-ss"); _activityservice.insertactivity(new activitydto { username = httpcontext.current.user.identity.name, activitytype = activityconstants.act_type_usr_mgt, activitydescription = activityconstants.usr_mgt_descr_forgot_pw, activitydate = datetime.now }); i found out answer question. var activitydate = timezoneinfo.converttimefromutc(datetime.now.touniversaltime(), timezoneinfo.findsystemtimezonebyid("e. australia standard time")) });

javascript - If before a certain hour block a day -

i'm trying trigger in code written me cant seem work. what need have date picker block out today , before today if before 11am , block out tomorrow , before if after 11am. trying put if/else on mindate in code below no joy. i assuming can code found in post: var currenttime = new date(); var starttime = new date(); starttime.sethours(00); starttime.setminutes(00); var endtime = new date(); endtime.sethours(11); endtime.setminutes(00); if ((currenttime.gettime() > starttime.gettime()) && (currenttime.gettime() < endtime.gettime()) { mindate: 2 } else { mindate: 3; } but everytime try put code below break it. can please help? .jquery(".dpicker").datepicker( { mindate: 2, onselect: function(datetext, inst) { var date = jquery(this).val(); jquery('#frm_field_263_container').hide(); jquery('#frm_field_263_container').after( '<img id="loading" src="loading30.

How do I extract data from JSON with PHP? -

this intended general reference question , answer covering many of never-ending "how access data in json?" questions. here handle broad basics of decoding json in php , accessing results. i have json: { "type": "donut", "name": "cake", "toppings": [ { "id": "5002", "type": "glazed" }, { "id": "5006", "type": "chocolate sprinkles" }, { "id": "5004", "type": "maple" } ] } how decode in php , access resulting data? intro first off have string. json not array, object, or data structure. json text-based serialization format - fancy string, still string. decode in php using json_decode() . $data = json_decode($json); therein might find: scalars: strings , ints , floats , , bools nulls (a special type of own) compound types: objects , arr

jquery - Javascript - Getting object's keys when object is an array of objects -

i having troubles getting key values in block of code similar following: var somearray = []; somearray.push(objx, objy, objz); //each of these objects pushed in have 1 key/value pair (var = 0; < somearray.length; i++) { switch (object.keys(somearray[i][0])) { //not sure "[i][0]" valid? //now set tags using jquery } } so in above code example passing in array of objects (each object single key/value pair). , want key of each of these can set html tag corresponds each using jquery. thought: [i] sufficient since array of each object's keys every 1? any appreciated!! if each object have 1 enumerable property, can use object.keys(somearray[i])[0] property's name in loop. object.keys returns array of object's own, enumerable property names, , [0] gets first entry it. (and of course, somearray[i][thename] give value of property.) example: var objx = { x: "ecks" }; var objy = { y: "why" };

Debugging C/C++ NDK library in AndroidStudio -

i having problem debugging c++ code in android studio. first bit setup: c++ source code stored in /tmp/pjsip directory, compiled standalone toolchain particular android target. resulting library passed through swig produces libpjsua2.so , has jnis available android project setup in directory , library step #2 copied app/src/main/jnilibs/armeabi-v7a directory , java jni code stored in app/src/main/java/org/pjsip/pjsua2 directory. directory structure follows: if debug android app code tracing ends in set of files stored under app/src/main/java/org/pjsip/pjsua2 directory java jnis code written in c/c++ are. can't debug , go further towards code in c/c++. that's problem. tried modifying android.mk , build.gradle files following hints on internet no luck far. here content of android.mk file: include ../../../../../build.mak local_path := $(pjdir)/pjsip-apps/src/swig/java/android include $(clear_vars) local_module := libpjsua2 local_cflags := $(app_cxxfla

html - Change Image to gif on scroll with jquery -

i trying change couple of images gifs scroll down page. have images changing gifs on scroll, gif resets scroll again. gif continue play if scrolling. here jquery: $(window).scroll(function(){ var top = $(window).scrolltop(); var img1top = $('.wrap').offset().top; if(img1top){ $('.wrap').attr('src','../wrap.gif'); }; var img2top = $('.vest').offset().top; if(top=(img2top)){ $('.vest').attr('src','../vest.gif'); }; var img3top = $('.loop').offset().top; if(top=(img3top)){ $('.loop').attr('src','../loop.gif'); }; }); 1. code resetting src every time page scrolls, , although path may not changing, cause image refresh. you need wrap each src change in conditional updates image if hasn't been updated . 2. if statements using = instead of == , won't work. 3. doing == compare top of window top of elements not best way this

python - pexpect: How to interact() over file object using newer version of pexpect library -

pexpect has gone through big changes since version provided ubuntu 15.04 (3.2). when installing newest version of pexpect using pip3 , minimal program gave terminal emulation on serial console not work more: #!/usr/bin/python3 import serial import pexpect.fdpexpect ser = serial.serial("/dev/ttys0", baudrate=115200) spawn = pexpect.fdpexpect.fdspawn(ser) spawn.interact() the newer api missing interact() method in class pexpect.fdpexpect.fdspawn used there. question: how newer version of pexpect (currently 4.2.1) supposed used provide free manual interaction file object (serial port in case)? alternatively, question/work-around : recognize using bit heavy machinery such simple use case, suggestions other python libraries can same earlier version of pexpect could? code reading: examples use pexpect.spawn(command_str) spawn object has interact() method; pexpect.spawn() same directly creating pexpect.pty_spawn.spawn object has method. on other hand, pex

ios - [AVPlayerLayer superview]: unrecognized selector sent to instance in Swift -

Image
in storyboard put view inside of uiviewcontroller. added necessary parameters there: and connected code: in code have: import avkit import avfoundation @iboutlet weak var yawpvideo: avplayerlayer! override func viewdidload() { let url:nsurl = nsurl(string: videourl)! player = avplayer(url: url) yawpvideo.player = player player.play() } and causes error: *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[avplayerlayer superview]: unrecognized selector sent instance 0x7fe320cb2030' can tell me causes problem , how can fixed? a uiview not calayer , cannot add avplayerlayer storyboard. instead, after view has loaded, programmatically add avplayer's playerlayer uiview's layer. change outlet uiview : @iboutlet weak var yawpvideo: uiview! then, add layer: player = avplayer(url: url) let playerlayer = avplayerlayer(player: player) yawpvideo.layer.addsublayer(playerlayer)

Install Google Play Service 9.6 in Android Studio -

i've got problem google play service under android studio 2.2 in emulator. downloaded every update , installed google play service still version 9.4. wont work install play service via drag-and-drop , original apk-file. can me out this? need work googleapi , tells me version out of date. thanks in advance, j. doe ;) you can update following steps provided in documentation . guide shows sample screenshot understand more steps. here lists of lessons can learn this: how update ide , change channels how update tools sdk manager how edit or add sdk tool sites auto-download missing packages gradle for more information, check so question .

Python, MySQL and cursors that fetch maps -

this question has answer here: python: use mysqldb import mysql table dictionary? 3 answers after executing query statement on mysql database connection, perform: rows = cursor.fetchall() this gives array of arrays. i'd have array of dictionaries, each dictionary takes keys requested column names of table , associates values table. how do this? well, forgot mention mysql library you're using. if using oursql (which recommend, best one), use oursql's dictcursor . example: conn = oursql.connect(...) curs = conn.cursor(oursql.dictcursor) if using mysqldb (why?) use mysqldb's dictcursor . example: conn = mysqldb.connect(..., cursorclass=mysqldb.cursors.dictcursor) curs = conn.cursor() doing give cursor returns dicts each row. remember not have duplicate rownames in query.

c# - Windows Phone 8.1 Runtime - how to make listbox longer length when selecting -

simplified xaml demonstrate problem, listbox.item's added in code behind (but not relevant question): <grid height="200"> <grid.rowdefinitions> <rowdefinition height="60"/> </grid.rowdefinitions> <listbox x:name="lbpurpose" fontsize="28" /> </grid> when listbox tapped, 1 row high (60 pixels set row definition). there property can set allow grow 200 pixels when in focus make scrolling through list easier - return original size when not in focus? it's dificult scroll through when 1 row displayed @ time. thank you! rookie mistake.......... wanted combo box , grid row height should have been auto. thanks!! <grid height="200"> <grid.rowdefinitions> <rowdefinition height="auto"/> </grid.rowdefinitions> <combobox x:name="lbpurpose" fontsize="28"/> <grid>

python - Bind a button already on_press -

i want change function launched when button pressed. python file: class updatescreen(screen): swimbot = {} def swimbot_connected(self): wallouh = list(adbcommands.devices()) if not wallouh: self.ids['text_label'].text = 'plug swimbot , try again' else: devices in adbcommands.devices(): output = devices.serial_number if re.match("^(.*)swimbot", output): self.ids['mylabel'].text = 'etape 2: need update ?' self.ids['action_button'].text = 'check' self.ids['action_button'].bind(on_press = self.check_need_update()) else: self.ids['text_label'].text = 'plug swimbot , try again' kv file : <updatescreen>: boxlayout: id: update_screen_layout orientation: 'vertical' label: id: mylabel text: "etape 1: connect swimbot"

c# - Adding up Multiple Checkbox values to a label, Based on if they are Checked or notC# -

alright have 8-10 check boxes , radio buttons, , need sum double values assigned them. problem want check of boxes not of them. if me out great. pointers on code help double springmix = 2.00; double avocado = 1.50; double beans = 2.00; double cheese = 2.00; double tomato = 1.50; double honeymustard = 2.00; double ranch = 2.00; double italian = 2.00; double bluecheese = 2.00; double foodcost; i'm using if statements see if check boxes checked. need way add them depending on if checked. public double totalordercost() { if (cbspringmix.checked) { foodcost + 2.00; } if (cbavocado.checked) { foodcost + 1.50; } if (cbbeans.checked) { foodcost + 2.00; } if (cbcheese.checked) { i have version solution: private readonly dictionary<checkbox, double> mapping; public mainwindow() {

c# - Should thread-safe class have a memory barrier at the end of its constructor? -

when implementing class intended thread-safe, should include memory barrier @ end of constructor, in order ensure internal structures have completed being initialized before can accessed? or responsibility of consumer insert memory barrier before making instance available other threads? simplified question : is there race hazard in code below give erroneous behaviour due lack of memory barrier between initialization , access of thread-safe class? or should thread-safe class protect against this? concurrentqueue<int> queue = null; parallel.invoke( () => queue = new concurrentqueue<int>(), () => queue?.enqueue(5)); note acceptable program enqueue nothing, happen if second delegate executes before first. (the null-conditional operator ?. protects against nullreferenceexception here.) however, should not acceptable program throw indexoutofrangeexception , nullreferenceexception , enqueue 5 multiple times, stuck in infinite loop, or of other weird t

apache - How to password protect a subdomain? -

i have proxy server on website password protected. located @ www.domain.com/proxy (/var/www/html/proxy) set new subdomain (proxy.domain.com) , configured apache serve (/var/www/html/proxy) not password protected when accessing throught subdomain, through directory on main domain. how can go making work? im running apache 2 on ubuntu 16.04