Posts

Showing posts from August, 2010

android - How to make a texField open with click of a button? -

i new android programming , there few things don't quite know how yet. doing course on udemy , trying put have learned point. trying have user click on button (i have 12) , have bring textfield can enter 2 numbers. want able user's 2 numbers , i'm pretty sure can figure out rest ( hope). don't understand how go doing this. appreciated. want able have user click on 1 of 12 buttons , asked enter 2 values, take values , perform calculation on it. your xml this: <?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="vertical" > <button android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/b_ok" android:text="click me"/...

Kill, abort, stop, cancel a previous call/queue to a javascript function -

i have function take time run on click event. following merely example , settimeout there simulate time may take run it. how can ensure when user click on item previous running function(s) is(are) cancelled , latest onclick function fired? i.e. if user clicked on 10 times. want execute 10th click not 9 clicks before. i hoping pure/vanilla js solution... not jquery (function () { var nav = document.queryselector('.nav__toggle'); var togglestate = function (elem, one, two) { var elem = document.queryselector(elem); elem.setattribute('data-state', elem.getattribute('data-state') === 1 ? 2 : one); }; nav.onclick = function (e) { settimeout(function(){ togglestate('.nav ul', 'closed', 'open'); }, 5000); e.preventdefault(); }; })(); fiddle: http://jsfiddle.net/6p94p48m/ you need debounce click handler. var button = document.getelementbyid(...

java - I do not understand this error 'Syntax error on token ";", { expected after this token' -

currently have error syntax error on token ";", { expected after token , in code shown below: public class findkey { private final static arraylist<integer> listofprimes = new arraylist<>(); //number of primes want private final static int n = 224; (int candidate = 2, count = 0; count < n; ++candidate) { if (isprime(candidate)) { ++count; listofprimes.add(candidate); } } // simple isprime() function // miller-rabin algorithm added reference private static boolean isprime(int num) { if (num == 2 ) { return true; } if (num % 2 == 0) { return false; } (int = 3; * <= num; += 2) { if (num % == 0) return false; } return true; } public static int convertkey (string input) { int result; char[] chararray = input.tochararray(); (int = 0; < chararray.length; i++){ result *= listofprimes.get(convertint(chararray[i])); } return result; } private s...

ruby on rails - nestled resources and form_for -

i have form inside of project view allows user give money project. have set nestled resources associate each payment appropriate project. having trouble submitting form correct path. in routes.rb have this: resources :projects resources :payments, only: [:new, :create, :show] end the form looks this: <div class="container"> <div class="row row one"> <div class="col-sm-12 col-md-10"> <%= form_for [@projects, @payments] , method: 'post' %> <%= label_tag("first name") %><br> <%= text_field(:user, :first_name, class: 'form-control', :required => true) %><br> <%= label_tag("last name") %><br> <%= text_field(:user, :last_name, class: 'form-control', :required => true) %><br> <%= label_tag("card number") %><br> ...

Autoform with CollectionFS for meteor -

i'm using aldeed:autoform aldeed:collection2 cfs:autoform cfs:standard-packges cfs:gridfs daycares = new mongo.collection('daycares'); daycares.attachschema(new simpleschema({ daycarename: { type: string, label: "daycare name", max: 100 }, address: { type: string, label: "address", max: 100 }, position: { type:[number], optional: true, decimal: true }, yib: { type: number, label: "years in business" }, contactname: { type: string, label: "contact name", max: 100 }, phone: { type: number, label: "phone number" }, licensed: { type: boolean, label: "licensed?" }, description: { type: string, label: "description" }, website: { type: string, label: "website", }, imageid: { type:string }, userid: { type: string, optional: true, autovalue: function () { ...

c# - Selenium not Clicking Link -

i want reset modem selenium. facing problem. trying click no click operation has been done. modem click zyxel. <li style="cursor: pointer;" class="subitem" id="maintenance-reboot"><span class="arrow">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a>reboot</a></li> i tried driver.findelement(by.linktext("reboot")).click(); i tried id "maintenance-reboot" nothing work me. then try go directly link. http://192.168.1.1/pages/maintenance/reboot/reboot.html page came no frame reboot page , clicked button nothing change. think mainframe required reboot. try 3 things: driver.findelement(by.xpath(".//li[@id='maintenance-reboot']/a")).click(); or driver.findelement(by.xpath(".//a[contains(text(),'reboot')]/..")).click(); or driver.findelement(by.xpath(".//a[contains(text(),'reboot')]/../..")).click();...

Converting string to java.util.date -

i trying convert string in java.util.date having following errors: helloworld.java:10: error: incompatible types: date cannot converted string return formatter.parse(date); ^ helloworld.java:16: error: incompatible types: string cannot converted date ...

c++ - Speeding up Oracle database interface in Qt (QOCI) -

i have project involves integrating oracle database qt desktop app. since qt has easy use interface database interaction, compiled qoci driver support oracle connections. everything works fine, processing time queries incredibly slow. how can improve performance? my code processing arbitrary query looks this: qlist< qlist<qstring> > dbwrapper::executequery(qstring const& querystring) { qlist< qlist<qstring> > results; if (_db.isopen()) { qsqlquery qry(querystring); if(qry.exec()) { while(qry.next()) { qlist<qstring> row; results.append(row); for(int = 0; < qry.record().count(); ++i) { results.last().append(qry.value(i).tostring()); } } } else { qdebug() << querystring; qdebug() << "failure: cannot handle query."; qdebug() << " > ...

regex - Information Extraction from a document, with not much training set -

what want do: extract basic biographic information text document. (relation extraction specific) explanation: have n text documents containing biographies of n different people. want extract information corresponding names, age, qualifications, affiliations , interests. what able do: used stanford ner extract name, age , organization in cases. however, there many false positives false negatives-specially "organization" tag. why difficult: biographic document, contains text associated concerned person. can't use other documents training classifier things totally different person. yes, surely can write rules. however, restricting domain considerably. example, wrote rules extract qualification..simple ones being: if of degrees (in pre-specified dictionary) present in sentence, can extract entities sentence , try find relation. my question: there way of making task automatic? since analyzing 1 document each time, please don't suggest me use bootstrapping bas...

Editing a specific text on a specific line txt batch -

so title allready says mean okay mean: here have text: login: demo password: demo world: demo script: demo status: online login: demo password: demo world: demo script: demo status: online login: demo password: demo world: demo script: demo status: online so want edit batch: login: demo password: demo world: demo script: demo status: online login: demo password: demo world: demo script: demo status: offline login: demo password: demo world: demo script: demo status: online and keep text allready posted! i've allready made script creates line's status online! need script can this: set /p login=please enter login name: set /p status=please enter status: ::here must code change's status echo account status changed!! thank :) nevermind made allready!! here solution: :start cls @echo off setlocal enabledelayedexpansion set counter=1 /f "delims=" %%x in (accounts.txt) ( set "bot_!counter!=%%x" set /a counter+=1 ) set /a numli...

rust - Borrowing reference and guard together from a Mutex -

i'm trying encapsulate code avoid repeating it, relating borrowing data out of mutex , further operations thereupon (which leave off of question out of scope, motivating factors). the following sample code complains guard not live long enough. precisely why i'm returning guard in structure designed expressly purpose. is limitation of borrow checker? suggestions on working around this? use std::sync::{mutex,mutexguard}; use std::ops::derefmut; pub struct innerdata { count: i32 // sample } pub struct data { pub inner_data: mutex<innerdata> } pub struct borrowedinnerdata<'a> { pub inner_data: &'a mut innerdata, guard: mutexguard<'a,innerdata>, } impl data { pub fn borrow_inner_data<'a>(&'a mut self) -> borrowedinnerdata<'a> { let guard = self.inner_data.lock().unwrap(); borrowedinnerdata { inner_data: guard.deref_mut(), guard: guard, ...

javascript - How to write an array with three indices in JS? -

i have series of equal cubes in 3d space known centers. given cube center, can give rest of information cube. in fact, each center's coordinates in 3d represents sort of id corresponding cube. in program in javascripts, each cube object. has properties such center, color, vertices, etc. can have array such "allcubes" can store cubes in 1 place , recall them "allcubes[0]", "allcubes[1]",... . however, want write program in way when give center coordinates cube i'm pointing at. of course, can make loop , use comparison find out not efficient when number of cubes high. looking array accepts 3 arguments, example if write "allcubes[i,j,k]" can cube pointing @ or may use dynamic object naming , assign each cube name based on center coordinates don't know how this. i appreciate if me out. thanks! javascript doesn't have multi-dimensional arrays. instead, make arrays of arrays 2 dimensions, arrays of arrays of arrays 3 ...

javascript - Ember Hello Word - Test Error in http://localhost:4200/tests but not in command line -

i trying build hello world ember.js app following this tutorial ...i have gotten part test link page. my setup is: qunit 1.18.0; mozilla/5.0 (macintosh; intel mac os x 10_10_3) applewebkit/537.36 (khtml, gecko) chrome/44.0.2403.157 safari/537.36 ember version: 1.13.8 node: 0.12.7 npm: 2.13.4 os: darwin x64 my router.js is: import ember 'ember'; import config './config/environment'; var router = ember.router.extend({ location: config.locationtype }); router.map(function() { this.route('about'); }); export default router; my application.hbs is: <h2 id="title">welcome boston ember</h2> {{link-to 'about' 'about'}} {{outlet}} my about.hbs is: <h3>about</h3> <p>boston ember monthly meetup awesome people to awesome ember related things! my about-page-test.js is: import ember 'ember'; import startapp 'bostonember/tests/helpers/start-app'; var app; module(...

actions on google - Increase timeout from Webhook response in API.ai -

i trying make multiple api calls response webhook. so, api calls taking more 5 secs getting response. i have gone through document api.ai , found set timeout 5secs intent request. there way can increase timeout webhook response api.ai? the timeout not configurable. nature of interaction user conversational , therefore user expects response in timeous manner. long delays confuse users , make them think app unresponsive. if operation takes longer timeout, consider changing design of conversation, either have user come later or gather other information user while operation completing.

3d - ST_ApproximateMedialAxis with TIN input -

i want determine medial axis of 3d tin using st_approximatemedialaxis in postgis. however, empty multilinestring result. need change medial axis instead of empty result? my code: create extension if not exists postgis_sfcgal; alter table tin add column medial_axis geometry; set postgis.backend = sfcgal; update tin set medial_axis = st_approximatemedialaxis(geom); a dump of tin table can found here: https://docs.google.com/document/d/1drgt_05oa29a_af3snizs89c3lvixsbgiuiytx6yjcs/edit?usp=sharing my postgis full version: "postgis="2.3.2 r15302" geos="3.6.1-capi-1.10.1 r4317" sfcgal="1.3.0" proj="rel. 4.9.1, 04 march 2015" gdal="gdal 2.1.3, released 2017/20/01" libxml="2.7.8" libjson="0.12" raster"

css - Use Skrollr on Mobile when HTML height is 100% -

i attempting use skrollr in website. works fine except on mobile. on mobile cannot scroll down page. i have determined because have set both html , body tags have height: 100% . if remove css mobile version works fine. although css critical main website need in there. possible have keep css , have mobile version scrolling work properly? jsfiddle note: know make sections fixed wont work in website because there static sections in website aswell. <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <style> html, body { margin: 0; padding: 0; height: 100%; width: 100%; } section { padding: 5%; height:100%; background-color: red; width: 100%; min-height: 100%; overflow: hidden; display: -ms-flexbox; ...

java - com.tivoli.mts.PDPrincipal.implies(com.tivoli.mts.PDPermission) deprecated -

i using below code authorizatin checks. pdprincipal whoisit = new pdprincipal(userid,configurl); pdpermission whattheywant = new pdpermission(objectspacename,"tbva"); boolean haveaccess = whoisit.implies(whattheywant); however implies method on com.tivoli.mts.pdprincipal has been deprecated , has been replaced implies method new pdprincipal class different package. com.tivoli.pd.jazn.pdprincipal the new method follows. public boolean implies(javax.security.auth.subject subject) the new method takes subject. can please let me know how can change code use new method? how construct subject or can subject somewhere? thanks, rohit i able work out solution hence sharing here else facing same issue can use code. i found new com.tivoli.pd.jazn.pdpermission class has method implies takes in pdauthorization context , com.tivoli.pd.jazn.pdprincipal object same authorization checks previous class com.tivoli.mts.pdprincipal use do. mentioned below how s...

How can we use iReport parameter in sql query column -

in ireport i'm using parameter in sql query, parameter field not showing in data set. have fee structure table 12 months columns amount, i'm trying desire month passing parameter column, parameter column not showing in data field. here query, i'm passing feestructure.$p!{months} parameter column. select studentinformation.id, classs.class, parents.parents, feecatagory.feecatagory, feestructure.$p!{months} studentinformation inner join classs on studentinformation.[c/class] = classs.id inner join parents on studentinformation.parentid = parents.id inner join feestructure on classs.id = feestructure.classid , parents.id = feestructure.parentid inner join feecatagory on feestructure.catagoryid = feecatagory.id class = $p{classid} , parents = $p{parent} , studentinformation.id = $p{studentid} order feecatagory plz check this. $p!{months} parameter give month name default value and use aliasing ...

javascript - Is it possible to get es6 class constructor arguments list? -

i write services , controllers in app (angularjs - 1.6.3) using es6 classes. i want simplify piece of code don't know whether it's possible , how es6 class constructor arguments list. example of piece need simplify prevent duplication: class myservice { constructor ( $q, $translate, ) { this.$q = $q; this.$translate = $translate; } } angular .module('app') .service('myservice', myservice); is there way add dependencies given context automatically? know in angular2 there decorators helps not duplicate dependencies add them in current scope (or other way)

java - Is it a nice way to declare common attributes in a super class and later extend it in other classes...? -

i have attributes createddate, createby, modifieddate, modifiedby, deleteddate, deletedby common in of pojo's. can declare these attributes in super class , later extend in other classes...?? as explained valid inheritance view. since have added hibernate tag, intention columns in database? need these attributes present in common parent table or want add these attributes in each individual table. need choose right inheritance strategy using @inheritance(strategy=inheritancetype) or can consider having mapped super class without own database table. can annotate such class @mappedsuperclass annotation. regards asheesh

xml - xmlns : android parsing -

i trying parse below xml data. need d:messageid , d:serialnumber. <feed xmlns="http://www.w3.org/2005/atom" ...> <script id="tinyhippos-injected"/> <id>...</id> <title type="text">viewerror</title> <updated>2015-08-25t01:41:55z</updated> <author>...</author> <link href="edi_viewerror" rel="self" title="edi_viewerror"/> <entry>...</entry> <entry>...</entry> <entry> <id> serveraddress </id> <title type="text">viewerror('abcdefg')</title> <updated>2015-08-25t01:41:55z</updated> <category term="viewerror" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="viewerror('gstu7417706')" rel="edit" title=...

javascript - Identifying the element moused over in an onmouseover function -

i'm attempting create 1 function change class of 1 of 3 elements when mouse goes on particular element (and element). however whenever mouse on element, class changes three. why? here's did: <-- html --> <p class="font1" id="change4_1" onmouseover="q4()"> menu1</p> <p class="font1" id="change4_2" onmouseover="q4()"> menu2</p> <p class="font1" id="change4_3" onmouseover="q4()"> menu3</p> /* css*/ p.font1 { color:blue; white-space:nowrap; display: inline-block; } p.font2 { color:#2e2e2e; white-space:nowrap; display: inline-block; } // javascript // function q4() { var name1 = document.getelementbyid("change4_1"); if (name1.mouseover = true) { name1.classname = "font2"; } var name2 = document.getelementbyid("change4_2"); if (name2.mouseover = true) { ...

algorithm - K-way merge operation for merge sort -

i have k sorted arrays, each n elements, , need combine them single sorted array of k*n elements. how implement merging procedure merge sort, starting first 2 , next 1 , on? this have far. // implementing function merge arrays (merge procedure merge sort) public int[] merge(int[][] array){ int k = array.length; int n = array[0].length; // final merged array int[] mergedarray = new int[k*n]; return mergedarray; } public static void main(string[]args){ merge obj = new merge(); int[][] data= new int[][]{{2, 9, 15, 20}, {6, 8, 9, 19}, {5, 10, 18, 22}, {8, 12, 15, 26}}; int[] mergedarraytest = obj.merge(data); //printarray(mergedarraytest); } instead of merging sub-arrays 2 @ time, can merge k @ once. make array of indices each sub-array. each index zero. on each 1 of k*n iterations fill merged array, cons...

php - Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1044] When I uploaded it online -

this question has answer here: sqlstate[hy000] [1045] access denied user 'username'@'localhost' using cakephp 3 answers when i'm using xampp localhost system working when upload in cpanel other page not working. other page working login in view , edit page gets error. i got error: fatal error: uncaught exception 'pdoexception' message 'sqlstate[hy000] [1044] access denied other page: connection failed: sqlstate[hy000] [1044] access denied user my connection: <?php $db_host = 'localhost'; $db_user = 'xxx'; $db_pass = 'xxx'; $db_database = 'xxx'; $db = new pdo('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass); $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); ?> if changed connection approach <?php mysql_...

Bootstrap Issue with Rounded Border around Columns -

i've never been more livid in life after spending close 3 hours trying format 3 columns. i'm starting using html , have no clue why i'm having trouble columns. can't seem ever them want them be. trying have 3 columns text in them each have border rounded edges around them. should same size, text margine centered etc. , planned have them change color when scrolled over, though can't first part. i found this: http://jsfiddle.net/6nvdt/ the code should linked it's kind of long which kind of similar want, , when copy paste it different. have no idea i'm doing wrong. copy paste , in attempts text terribly uncentered, boxes different sizes, don't take whole area. please me. you're missing css. to example working put css in style tag in html file. http://www.w3schools.com/css/css_howto.asp <style> /*css goes here*/ </style>

android - libmproxy and mitmproxy documentation -

i new mitmproxy world. need write python script log requests made app on genymotion emulator. now, learned mitmproxy can helpful requirement. have set mitmproxy , able monitor traffic http/s app on gennymotion through mitm client. however, want : the app explored manually user , there should python script running log requests being made while user exploring app. i have tried going through github examples of mitmproxy apis, have not been able understand them. please point me more detailed explanation/usage guide these apis ? through more digging, figured out need similar https://github.com/mitmproxy/mitmproxy/blob/master/examples/flowbasic not understand happening inside script in above resource. what f.reply() ? flow.state() ? m.run() ? flow.flowmaster ? and more importantly, there place can learn these various methods , others used in above ? similarly, found : get "raw" request\response mitm proxy can please explain how or call reque...

ios-webkit-debug-proxy gets disconnected from ipad while running tests -

i trying run test on physical ipad. using appium , webkit-ios-debug-proxy. ios-webkit-debug-proxy gets disconnected when try run tests. gives error - invalid message _rpc_applicationupdated: <dict> <key>wirapplicationidentifierkey</key> <string>pid...</string> <key>wirisapplicationproxykey</key> <false/> <key>wirapplicationnamekey</key> ... </dict> disconnected i found forums, mentioned run command - .bin/ios-webkit-debug-proxy-launcher.js -c udid -d from appium folder, when run command, error - "module.js: ..throw err error: cannot find module 'underscore' @ function.module_resolvefulename (module.js:336:15) .... so solution not work me either. the command above in question [.bin/ios-webkit-debug-proxy-launcher.js -c udid -d ], worked me eventually. it wasn't working downloading ios-webkit-debug-proxy-launcher.js again github instead of looking .js file in current installa...

php - How to insert multiple image into one mysql database row? -

Image
okay briefly whats problem code have. code below uploads image data mysql database beautifully except 1 barrier. on form have, people can upload 4 images. now, code below inserts 4 different rows. each image 1 row. title 4 rows same because belongs same post. there anyway can comma delimited insertion 4 images single post in 1 row? <?php if(isset($_post['submitting'])) { if(isset($_files['file_array'])) { $user = $_session['user_id']; $pname = $_post['product_name']; $proprice = $_post['product_fee']; $n_array = $_files['files_array']['name']; $tmp_name_array = $_files['files_array']['tmp_name']; $type_array = $_files['files_array']['type']; $size_array = $_files['files_array']['size']; $error_array = $_files['files_array']['error']; for($i = 0;...

ios - Firebase error reading fsCachedData -

i have 2 apps different bundle ids (com.myapp.debug , com.myapp.release) installed on phone. , got following error sometimes. don't know exact steps reproduce it. doesn't happen if have 1 flavor of app installed. , seems happen when in have both flavors , install/uninstall of apps frequently. , error happens when i'm running debug version of app , somehow tries read fscacheddata in wrong app (release version instead of debug version) error message indicates. *** info: fetch-response unable open file /private/var/mobile/containers/data/application/d8041c7a-fe4a-49d1-a3ba-9e3a51f8ecd5/library/caches/com.myapp.release/fscacheddata/49409173-05e8-4291-b22e-6859d4026657. errno: 1 any idea why happening , how rid of it?

php - Get the from and to object from p2p_id in WordPress - WP Posts to Posts Plugin -

i'm using wp posts posts plugin in wordpress. and made links between posts , posts, users , users, or posts , users. and in 3 cases above, want more p2p plugin. for example, may fetch p2p_id first: $users = get_users( array( 'connected_type' => 'multiple_authors', 'connected_items' => $post ) ); foreach($users $user) { $p2p_id = $user->p2p_id; // ********** attention ********* // here, got p2p_id of p2p object // in general purpose, want // , object p2p_id } so, how can , object via p2p_id? i've found on documentation, seemed no effective ways. no other answers. found answer myself source code: file: /wp-content/plugins/posts-to-posts/vender/scribu/lib-posts-to-posts/api.php notice there function: p2p_get_connection($p2p_id) then call function known p2p_id , stdclass object returned, below: object(stdclass)#2509 (4) { ["p2p_id"]=> string(1) "8" ["p2...

android - Managing Auth Token using RxJava -

i've been wondering what's best way tackle issue of token refresh. i'm connecting api supplies me auth-token, if sometime time during calls invalid_auth need re-authenticate. naive implementation did this @suppresswarnings("unchecked") @override public observable<user> getusers() { return runcommandandrefreshauthifnecessary(new requestcommand() { @override public observable create() { return createservice(usersapi.class).getusers(); } }); } private observable runcommandandrefreshauthifnecessary(final requestcommand command) { return command.create() .onerrorresumenext(new func1<throwable, observable<?>>() { @override public observable<?> call(throwable throwable) { return handlerefreshtoken(command); } }); } private observable<?> handlerefreshtoken(final requestcommand command) { return refreshtoken().flatmap(new func1<bool...

nunit - NullRefernceException when calling Setup -

Image
i'm trying simple setup on mocked object, nullrefernceexception coming setup line: what mistake doing here? your setup incorrect because confusing moq .tostring() in it.isany<string>().tostring() . because of moq cannot generate correct matcher , throws exception. it easy fix this, remove .tostring() : [test] public void test() { mockdatabase = new mock<idatabase>(); dataset ds = new dataset(); mockdatabase.setup(m => m.dbquery(it.isany<string>())).returns(ds); var sut = new businessclass(mockdatabase.object); sut.somemethod(); }

python - Values of a dict in a dropdown django -

my models.py follows: class sellermarketplaces(models.model): id = models.integerfield(db_column='id',primary_key=true) # field name made lowercase. seller_id = models.foreignkey('sellerdetails',db_column='seller_id') # field name made lowercase. mk_id = models.foreignkey('marketplace',db_column='mk_id') # field name made lowercase. username = models.charfield(db_column='username', max_length=100, blank=true, null=true) i have following code in views def marketplaces(request): seller = request.get.get('seller', '') allmarketplaces = sellermarketplaces.objects.filter(seller_id = seller).values('mk_id__marketplace') print allmarketplaces through i'm getting following output: [{'mk_id__marketplace': u'flipkart'}, {'mk_id__marketplace': u'snapdeal'}] i want display values i.e., flipkart , snapdeal in dropdown i'm unable access values, when i'm writing ...

cocos2d x - Why does SimpleAudioEngine behave differently on each platform, and is there a way to configure it? -

i using simpleaudioengine play sound effects on app. works on windows phone 8.1 (universal), android, , ios. noticed following behaviour not consistent: in ios, if listen music on apple music app, , launch game, music silenced. in android, music google play continued played after launching app. can hear sound effects game. in windows phone behaviour same android. why different ios, , there way can configured ? i using cocos2d-x v3.7 (c++) on ios, simpleaudioengine uses different codebase, , default settings in cdaudiomanager play effects , music (only if no other music playing). if edit cdaudiomanager code can change default settings of simpleaudioengine, or alternatively, use cdaudiomanager on ios.

Fetching all the Module name, class name and method names from directory in python -

if directory contains multiple .py files say, a.py , b.py, c.py how can fetch module name , class name , method names of corresponding class, contaned in directory to filter files in directory can use('.' refers current directory): from os import listdir,chdir default_path = r'c:\dev\python' modules = [ fl fl in listdir(default_path) if fl.endswith('.py') ] to classes , methods know can use inspect though can't use without importing module: e.g. from inspect import getmembers, isfunction, ismethod, isclass your_module = __import__(modules[0].split('.')[0]) class_funcs = {} funcs = [ obj obj in getmembers(your_module) if isfunction(obj[1]) ] classes = [ obj obj in getmembers(your_module) if isclass(obj[1]) ] cls in classes: class_funcs[cls[0]] = [ obj obj in getmembers(cls[1]) if ismethod(obj[1]) ] print funcs [('function1', <function your_module.function1>), ('function2', <function your_modu...

redirect - Reference Redirection in PHP -

this question has answer here: redirecting previous page after login? php 16 answers i've redirected user if directly try access web pages without login. directly want open page after login, user has tried open before login. suppose user has tried open reports.php without being logged in, first redirected login page, after login want redirect user directly on reports.php, tried open. code should implement in php files? once see user anonymous , redirect him login page - add additional parameter script/page name. after successful login redirect user page. for example, user wants access profile.php secured. make header("location: http://example.com/login.php?redirect=profile.php"); die(); at login.php make him go with: header("location: http://example.com/".$_get['redirect']); die();

java - how to write date using tokenizer? -

the following code here returns date in form "day, date, month, year". date entered in return saturday 28 dec 2013. however, want tokenize , print 4 parts out on 4 separate lines, starting month, date, year, day. what's best way this? import java.text.simpledateformat; import java.util.date; class day{ public static void main( string[] args ){ simpledateformat newdateformat = new simpledateformat("dd/mm/yyyy"); try { date mydate = newdateformat.parse("28/12/2013"); newdateformat.applypattern("eeee dd mmm yyyy"); string isdate = newdateformat.format(mydate); system.out.println(isdate); } catch (exception e) { system.out.println("error. date in wrong format."); } } } use split() method : string []myformat=isdate.split(" "); system.out.println(myformat[2]); system.out.println(myformat[1]); system.out.println(myformat[3]); system.out.pr...

mapreduce - Node server is not responding to the Http requests made while MongoDb Map Reduce job is in process -

i developing application in mean stack. there heavy calculation required in application done using map reduce in mongodb. map reduce takes 20 sec calculation. if other user sends http request node server, gets stuck till mr completes. question is. blocking server responding? is because of node thread busy during mr operation? does mongoose performing job during mr? here code var mapfunction = function() { var key = this.id; emit(key, 1); }; var reducefunction = function(key, values) { return values*5; }; var finalizefunction = function (key, reducedval) { var calcdata; calcdata = calculationfn(reducedval); return calcsdata ; }; motors.mapreduce({ map: mapfunction, reduce: reducefunction, finalize: finalizefunction, out : {replace : "search_results"} //out: { inline: 1 } }, function (err, results) { var output = []; console.l...

javascript - AngularJs - Open url in new tab -

i have application public page , admin page. open admin page in new tab after login. i've tried this, after login successful, no effect. public page (where login is) being reloaded: var url = $state.href('/admin/overview'); $window.open(url, '_blank'); any tips appreciated. thank you. here working jsfiddle , have inject $window before can use it: js: angular.module('myapp', []) .controller('dummy', ['$scope', '$window', function ($scope, $window) { $scope.redirecttogoogle = function () { $window.open('https://www.google.com', '_blank'); }; }]); html: <div ng-app="myapp" ng-controller="dummy"> <a ng-href="" ng-click="redirecttogoogle()">hello</a> </div>

swift - Show reminder(alarm) like custom alert and perform user action on that alert in IOS -

i want show reminder alert user in particular time . , perform action on alert view . used local notification show reminder showing badge style message when app running in background . need alternate solution . thank in advance... in appdelegate should write ( app , example, use code according app ) func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { let completeaction = uimutableusernotificationaction() completeaction.identifier = "complete_todo" // unique identifier action completeaction.title = "complete" // title action button completeaction.activationmode = .background // uiusernotificationactivationmode.background - don't bring app foreground completeaction.authenticationrequired = false // don't require unlocking before performing action completeaction.destructive = true // display action in red let remindaction = uimutableusernoti...

javascript - How to add contacts in node xmpp roster? -

Image
i'm using node-xmpp-server xmpp server chat application.as client i'm using spark.i want add contacts roster.how can this?i've run on ejabbberd , iti work need implement code.thanks advice! my server code: var startserver = function(done) { // sets server. server = new xmpp.c2s.tcpserver({ port: 5222, domain: 'localhost' }) // on connection event. when client connects. server.on('connection', function(client) { // that's way add mods given server. // allows developer register jid against want client.on('register', function(opts, cb) { console.log('register') console.log(cb); cb(false) }) // allows developer authenticate users against want. client.on('authenticate', function(opts, cb) { //console.log('server:', opts.username, opts.password, 'authenticating') if (o...

numpy - spline interpolation between two arrays in python -

i trying spline interpolation between 2 arrays in python. data set looks this: | 5 15 -------+-------------------- 1 32.68 29.16 2 32.73 27.20 3 32.78 28.24 4 32.83 27.27 5 32.88 25.27 6 32.93 31.35 7 32.98 27.39 8 33.03 26.42 9 33.08 27.46 10 33.13 30.50 11 33.18 27.53 12 33.23 29.57 13 33.23 27.99 14 33.23 28.64 15 33.23 26.68 16 33.23 29.72 and trying spline interpolation between 2 points , produce values 10, (but spline interpolated): | 10 -----+-------- 1 30.92 2 29.965 3 30.51 4 30.05 5 29.075 6 32.14 7 30.185 8 29.725 9 30.27 10 31.815 ...

angularjs - How to write a directive to change isolate scope value of another directive -

i want extend directive's functionality. here template: <input type="text" color="ctrl.color" color-changer="" /> and color directive is: app.directive("color", [function() { return { scope: { color: "=" }, link: function(scope, ielement, iattrs) { scope.$watch("color", function(){ ielement.css("background-color", scope.color); }); } }; }]); i want write directive (named color-changer ) change color value of other directive when focus on input . how can write directive. ps: don't want recompile of element. works slow. ps: want change value bound color attribute trigger $watch soemthing should work: myapp.directive("colorchanger", [function() { return { scope: { colorchanger: "=" }, template: '<input type="text" ng-model="colorchanger">' }; }]); see h...

javascript - How to scroll content horizontally left or right when you swipe it with your finger -

i developing mobile application , want swipe image inside div when user swipe finger, div should scroll. here in example entire page scrolling scroll of div . want div scroll " http://smoothtouchscroll.com/ " ` jquery smoothtouchscroll <!-- css smooth touch scroll --> <link rel="stylesheet" type="text/css" href="../css/smoothtouchscroll.css" /> <!-- styles specific scrolling content --> <style type="text/css"> #touchscroller { top:70%; width:100%; height: 30%; /* position: relative; */ position:absolute; background-color:red; } /* replace last selector type(s) of element(s) have in scroller. if have images use #touchscroller div.scrollablearea img, if have div's use #touchscroller div.scrollablearea div, if hav...

dictionary - Get the value of particular key from all dictionaries Python -

i have list of dictionary this, a = [{'segmentname': 'fico high', 'cohortmonthyear': '01-01-2015', 'drivervalue': '0.921996823602789', 'monthsonbooks': '1', 'cohortquarteryear': 'q1 2015', 'portfolioid': '55dc0e48c95a8a1a2ffb836e', 'drivername': 'active rate'}, {'segmentname': 'fico high', 'cohortmonthyear': '01-01-2015', 'drivervalue': '0.9123400335106416', 'monthsonbooks': '2', 'cohortquarteryear': 'q1 2015', 'portfolioid': ('55dc0e48c95a8a1a2ffb836e'), 'drivername': 'active rate'}, {'segmentname': 'fico high', 'cohortmonthyear': '01-01-2015', 'drivervalue': '0.9024207736261439', 'monthsonbooks': '3', 'cohortquarteryear': 'q1 2015', 'po...