Posts

Showing posts from January, 2011

Index out of range in multidimensional array in Swift -

this question has answer here: swift 3 2d array of int 2 answers var tri = [[int]](); tri[0][0] = 321; this code causes error: fatal error: index out of range what's wrong? you're accessing first element of first subarray of array. array doesn't contain subarrays, crashes.

javascript - Two clicks - different actions (same div) -

hope help! have divs (using bootstrap) like: <div class="container"> <div class="row" id="r2"> <div class="col-lg-8"> <div class="block-in-div"></div> </div> <div class="col-lg-4"> <div class="col-lg-12"> <div class="block-in-div"></div> </div> <div class="row"> <div class="col-lg-12"> <div class="col-lg-4"> <div class="row"> <div class="col-lg-12"> <div class="block-in-div"></div> </div> </div> <div class="row">

RxJS proper way to merge 3 arrays into one, as an Observable -

hi have 3 subjects ( observables ) const arr1$ = new behaviorsubject([]) const arr2$ = new behaviorsubject([]) const arr3$ = new behaviorsubject([]) let's these subjects contain data arr1 = ['1','2'], arr2 = ['3','7'], arr3 = ['4'] i want create observable (mergedobservable) combines latest these 3 observables, merges them 1 array, result 1 array this: ['1','2','3','7','4'] so can achieve this.mergedobservable.subscribe( mergedarray => { console.log(mergedarray) }) // ['1','2','3','7','4'] i struggling how make 'mergedobservable'. have tried combinelatest(arr1$,arr2$,arr3$) , still need 'chain' more functionality merge 3. thanks! combinelatest takes optional project function can used modify combined value. you can specify project function uses array.prototype.reduce flatten arrays single array:

javascript - Parsing JSON objects in an array using jQuery -

i'm trying print out value of "title" each object, delay before next title replaces current one. json: {"articles":[ "author":"author1", "title":"title1", "description":"description1" }, { "author":"author2", "title":"title2", "description":"description2" } ] } and code $(function getnews(){ $.getjson( "https://newsapi.org/v1/articles?source=google-news&sortby=top&apikey=",function out(json){ shownews(json) }); function shownews(json){ arr =[]; $.each(json.articles, function(index, value) { arr.push(value.title); }); for(k =0; k< arr.length; k++){ console.log(arr[k]); } settimeout(function(){getnews()},4000);}}); what i'm getting for-loop running once, , printing values of array @ same time. appreciated. let array = [ { &qu

ios - Firebase permissions: Sign up with username and password -

i'd have users sign unique username , password (rather email + password). have working i: sign up check if provided username exists if not, use firauth.auth()?.createuserwithemail , store username in db email, e.g. users qzqfzwxpdmfc0xmyiq5idar1bzr2 credentials email: "myemail@gmail.com" username: "myusername" rjasdfasfasdad3dadaewdsdkdq3dk credentials email: "another@gmail.com" username: ""another sign in query db user associated username , use email address , use firauth.auth()?.signin(withemail: withemail log in while approach work, i'm wondering how work firebase permissions? in order email address associated username, i'm going have let all users access email address / username data, e.g. { "rules": { ".read": true, ".write": "auth != null" } } does mean 'hacker' email addresses of users have registered app? if so, ther

android - Read different inputs from InputStream JAVA -

i'm writing code send encrypted file client server first client send encrypted message digest of file server , send name of file , @ end send bytes of encrypted file, in server side read these variables 1 variable digest , and when server trying decrypt digest throws illegal block size exception question here how can server read , save them in different variables ?? client // set mode encrypt aescipher.init(cipher.encrypt_mode, key); dataoutputstream toserver = new dataoutputstream(socket.getoutputstream()); // digest of file messagedigest md = messagedigest.getinstance("md5"); byte[] hash = md.digest(bytes); // encrypt digest , write file byte [] encryptedhash = aescipher.dofinal(hash); toserver.write(encryptedhash); // write file name server toserver.writeutf(filename); //encrypt file byte[] encrypt

c# - asp-for="Property" and @Model.Property values are not the same for the same object -

i have cshtml file has section of similar below code below: <div id="entries" class="records-table"> @if (model.entries != null) { foreach (var entry in model.entries) { @html.partia("../partials/_partialentry", entry) } } </div> and in _partialentry file have code similar below: <input asp-for="somemodelvalue" /> <div class="@(model.somemodelvalue == "special":"hidden":string.empty)">...</div> the issue having given entry somemodelvalue properties between asp-for="somemodelvalue" , @model.somemodelvalue not same. @model.somemodelvalue returns somemodelvalue of previous entry. try , provide example below. lets me model.entries had values below: [{somemodelvalue = "special", ....}, {somemodelvalue = "someothervalue", ....} {somemodelvalue = "special", ....}, {

require once - PHP require_once throwing errors on local server, but not live server -

i've pulled site backup, set locally, , when testing on local server i'm getting following error when referencing in php file require_once('http/request.php'); here's error: fatal error: require_once() [<a href='function.require'>function.require</a>]: failed opening required 'date.php' (include_path='.:/applications/mamp/bin/php/php5.2.17/lib/php') in /site_root/doctor_login/reports.php on line 23 oddly, works fine on live server , i'm unable find http/request.php file on either live server or local server. happening few other files. idea issue is?

java - Maven package:mvn package -

i have maven project, father , son structure, perform mvn package in parent structure @ same time want specify sub-project pom.xml file profile id you can define sub-project module in parent pom file profile below: <profiles> <profile> <id>all-deps</id> <modules> <module>sub-project</module> </modules> </profile> </profiles> now can use following maven commands include sub-project parent mvn package --activate-profiles all-deps

reactjs - How to defer this.props.onClick() until after a CSS animation is complete? -

i calling custom nanobutton component page along onclick instruction route page: // page.js import { component } 'react'; import router 'next/router'; class page2 extends component { render() { return( <nanobutton type="button" color="success" size="lg" onclick={() => router.push('/about')}>about</nanobutton> ) } } when button ( nanobutton component) clicked, want execute internal code before moving on onclick coming in props. through internal code, trying simulate material-design ripple effect lasts 600 milliseconds. how it: import { component } 'react'; import { button } 'reactstrap'; class nanobutton extends component { constructor(props) { super(props); this.onclick = this.onclick.bind(this); } onclick(e) { this.makeripple(e); this.props.onclick(); } makeripple(e) { const elements = e.target.getelementsbytagname('div'); whil

ios - Auto Layout using layout anchors programmatically not working -

Image
i trying add stack view containing uilabel @ top , uicollectionview underneath. trying constrain stack view takes full view, anchoring sides. when run app uilabel appears , slice of collection view appears. collection view says width , height both zero. appreciated, thank you. var collectionview: uicollectionview! var titlelabel: uilabel! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. self.view.translatesautoresizingmaskintoconstraints = false let margins = self.view.layoutmarginsguide let layout: uicollectionviewflowlayout = uicollectionviewflowlayout() layout.sectioninset = uiedgeinsets(top: 20, left: 10, bottom: 10, right: 10) collectionview = uicollectionview(frame: self.view.frame, collectionviewlayout: layout) layout.itemsize = cgsize(width: self.collectionview.frame.width / 4, height: self.collectionview.frame.width / 4) layout.minimuminteritemspacing = self.collectionview.fram

segmentation fault - rstan causing segfault error -

i have following code in rstan 2.16 running on cluster gcc 6.3.0 compiler, being used in loop different inputs each time. however, in random iteration rstan code causes segfault error. data{ int<lower=0> n; //number of points int<lower=1> d; //dimension int<lower=1> j[n]; //number of observed features each sample int i[d,n]; //observed features matrix[d,n] x; cov_matrix[d] lambda; real<lower=d-1> nu; cov_matrix[d] b; vector[d] m; } parameters{ vector[d] mu; //mean cov_matrix[d] sigma; //covariance } model{ //prior sigma ~ inv_wishart(nu,lambda); mu ~ multi_normal(m,b); //likelihood (i in 1:n){ x[i[1:j[i],i],i] ~ multi_normal(mu[i[1:j[i],i]],sigma[i[1:j[i],i],i[1:j[i],i]]); } } this error: * caught segfault * address 0x2afb9e459c60, cause 'memory not mapped' traceback: 1: .external(list(name = "cppmethod__invoke_notvoid", address = , dll = list(name =

Can I create additional axes/dimensions in Premake? -

premake 5 gives 2 functions separate independent configuration variables in projects: configurations , platforms . example, might have: configurations { "debug", "release" } platform { "windows", "linux" } the documentation refers these axes, way describe them, since can have independent settings each axis: really, platforms set of build configuration names, providing axis on configure project. but if want axis? example, data types used particular calculations: calctypes { "long", "default", "short" } can create new axis, , if so, how? i think tags (a new feature due released in next alpha build) might you're looking for. here example pull request implemented: workspace 'foobar' configurations { 'release-std', 'debug-std', 'release-blz', 'debug-blz' } filter { 'configuration:*-std' } tags { 'use-std' } fil

node.js - Why does my export stop updating when the array it references is sliced? -

i've been using node.js few years , believed understood how exports worked, edge case today has left me bit confused. code when simplified, behaved following: a.js var history = [] var = 0 exports.updatehistory = function(){ history.push(i) i++ if(history.length > 10){ history = history.slice(5) } } exports.history = history b.js var = require('./a') setinterval(function(){ a.updatehistory() console.log(a.history) }, 200) i expected output of following: [ 0 ] [ 0, 1 ] [ 0, 1, 2 ] [ 0, 1, 2, 3 ] [ 0, 1, 2, 3, 4 ] [ 0, 1, 2, 3, 4, 5 ] [ 0, 1, 2, 3, 4, 5, 6 ] [ 0, 1, 2, 3, 4, 5, 6, 7 ] [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] [ 5, 6, 7, 8, 9, 10 ] [ 5, 6, 7, 8, 9, 10, 11 ] [ 5, 6, 7, 8, 9, 10, 11, 12 ] [ 5, 6, 7, 8, 9, 10, 11, 12, 13 ] [ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ] [ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ] [ 10, 11, 12, 13, 14, 15 ] [ 10, 11, 12, 13, 14, 1

go - exit program when all goroutines finish -

i have 2 go routine functions, 1 creates data , 1 adds data database. when i'm done creating data want finish adding data don't know how many times i'm going call function. for { select { case c <- datachan: go func() { if data == false { return // keeps program running never exits } createdata(c.data) // sends data datachan until data == false } go func() { adddata(c.data) // need keep program running until these goroutines finish } } } createdata() creates , sends data datachan , based on variables set data false , cause program held open returning on , on again , stops creating more data, feel there should cleaner way allows me exit when adddata() goroutines finish. have seen people use channel don't know how many times i'm going call function. update: working code var wg sync.waitgroup { select { case c <- datachan: wg.add(1) go func() { if data == false { wg.

excel - Concatenate a column of data (ignoring blanks) and separating data with line break -

Image
looking concatenate data in column column c shown in attached image. (note: column c hard-coded) any appreciated, thanks. use textjoin() =textjoin(char(10),true,a1:a6) text join introduced office 365 excel. if not have put code in module attached workbook , use formula described above: function textjoin(delim string, skipblank boolean, arr) dim d long dim c long dim arr2() dim t long, y long t = -1 y = -1 if typename(arr) = "range" arr2 = arr.value else arr2 = arr end if on error resume next t = ubound(arr2, 2) y = ubound(arr2, 1) on error goto 0 if t >= 0 , y >= 0 c = lbound(arr2, 1) ubound(arr2, 1) d = lbound(arr2, 1) ubound(arr2, 2) if arr2(c, d) <> "" or not skipblank textjoin = textjoin & arr2(c, d) & delim end if next d next c else c = lboun

java - Best way to initialize beans in Spring context after application started? -

i need init beans in spring context after application has started, init beans in class annotation @configuration this: @configuration public class appconfig { @inject @bean public beana init(param1, param2, etc...) { --- code construct bean --- } @inject @bean public beanb init(param1, param2, etc...) { --- code construct bean b --- } } but beans need init after application startup approach create class listen applicationreadyevent event in spring , put code init beans in class. @configuration class applicationstartinglistener implements applicationlistener<applicationreadyevent>{ ---- code init bean here ---- @override public void onapplicationevent(applicationreadyevent event) { --- if put init bean code in here, correct? ---- } } does best way? or there other better approaching solutions? thanks. i enumerate other approaches in order init beans, grouped approach in standard approach , spri

c++ - Sort vector based on value outside of class -

i have std::vector<mystruct> , simple version of struct this: struct mystruct { glm::vec3 position; }; the above struct declared in class: class myclass { private: struct mystruct { glm::vec3 position; }; std::vector<mystruct> structvector; glm::vec3 outsideposition; }; but issue i'm having how sort structvector based on distance between structvector.position , outsideposition . i've tried using std::sort this: std::sort(this->structvector.begin(), this->structvector.end(), this->sortfunction); where sortfunction declared as: glboolean myclass::sortfunction(mystruct const &x, mystruct const& y) { glfloat dist1 = glm::length(this->outsideposition - x.position); glfloat dist2 = glm::length(this->outsideposition - y.position); return dist1 < dist2; } but compilation error stating there's no overloaded method std::sort . going wrong here? errors: error

IPython only work for one version of Python in Anaconda(Win), how to solve? -

i use anaconda prompt install version of python3 , jupiter qtconsole , ipython image shows . works 1 version; ones 'py36' don't work when clicked on. answer if possible. enter image description here

email - Auto Reply to Gmail apps for business outside of office hours -

i have created following scripts based on above answer emails mon - fri before 9am , after 5pm in our gmail apps business. for whatever reason can't see has not been successful. tips. says executes, has 0sec run time, api's gmail enabled. i can't think has gmail apps business tested on private gmail , worked fine. the first script weekdays before 9am , after 5pm is function autoreply() { var interval = 5; var date = new date(); var day = date.getday(); var hour = date.gethours(); if ([1,2,3,4,5].indexof(day) > -1 || (day == [1,2,3,4,5] && hour < 9) || (day == [1,2,3,4,5] && hour >= 17)) { var timefrom = math.floor(date.valueof()/1000) - 60 * interval; var threads = gmailapp.search('is:inbox after:' + timefrom); (var = 0; < threads.length; i++) { if (threads[i].isunread()){ threads[i].reply("thank reaching out us. our customer suppo

Android Volley: Send JSONObject as parameter and to receive JSONArray as response -

i'm learning volley library in android. i'm using jsonobjectrequest passing jsonobject request parameters, , i'm getting response jsonarray in error listener code jsonobjectrequest check line no.84 in image error in logcat . can me regarding this, how jsonarray response passing jsonobject request parameter. use jsonarrayrequest capture array in response jsonarrayrequest jsonarrayrequest = new jsonarrayrequest( request.method.post, "http://lanes-dev.cloudapp.net/api/diarytweetlineapi/loaddiarytweetlinesbyuser", obj, new response.listener<jsonarray>() { @override public void onresponse(jsonarray response) { } }, new response.errorlistener(){ @overri

Bootstrap Animated Progress Bar -

i tired create animated progress bar in boostrap image below progress bar needed output but unable proper output , have added html code, javascript code & css code html code <p class="progress-text">html5</p> <div class="progress"><div class="progress-bar" data-present="95%"></div></div> <p class="progress-text">css3</p> <div class="progress"><div class="progress-bar" data-present="90%"></div></div> css code .progress-text{ text-transform: uppercase; color: #333; margin-bottom: 5px; line-height: 18px; font-size: 12px; } .progress{ background-color: transparent; border-radius: 0; box-shadow: none; height: 3px; margin-bottom: 15px; overflow: visible; } .progress:last-child{ margin-bottom: 0; } .progress .progress-bar{ background: #3f51b5; background: transparen

Java.awt.Robot not working on Android emulator running on PC -

i have written java program using java.awt.robot try play video game me. game called magic tiles 3, , it's similar piano tiles. in essence, goal tap black tiles once reach bottom of screen. and, since i'm lazy, decided let computer work. i set android tablet emulator called bluestacks on windows 10 pc , loaded game onto it. ran code below try identify point mouse cursor , click. code searches black tiles , uses robot click on them. when run code, can see robot moving mouse cursor onto tiles, , can see left-clicking correctly (i opened black background in paint, chose orange paintbrush, , made orange dots tiles should be). can verify left-clicking on tiles mouse works properly. however, reason, clicks not register correctly on android emulator. causing this? public class main { public static void main(string[] args) throws awtexception, ioexception, interruptedexception { // todo auto-generated method stub robot perfectrunner = new robot();

Object 'cannot be cast' using Hibernate in Play for Scala -

i'm running hibernate 5.x in play scala 2.5. hibernate accesses sap hana database. problem happens when touch code , play compiles automatically. right after code compiles, when run application, if code invokes hibernate function exception below admin.dates.datehib cannot cast admin.dates.datehib datehib hibernate annotated class. note don't change neither hibernate objects nor functions use hibernate objects. still, when run code after editing cannot cast error. the workaround restart play, cannot restart play everytime touch code. i'm not sure has problem, i'm running in same application slick 3.1 accessing mysql. any ideas? this code fails: def findlastdayholiday (month: int, year: int) = { val session = hibernateutil.sessionfactorybank.opensession try { val query = session.createquery("from datehib month=:month , year=:year") query.setmaxresults(1) query.setparameter("year", year)

Make facebook app page posts visible to the public -

we have several facebook community pages , app updating them. using restfb update pages. on privacy have set public per: https://www.quora.com/how-can-i-make-my-facebook-timeline-visible-to-the-public https://faq.buffer.com/article/267-how-do-i-adjust-the-visibility-of-my-facebook-posts when login , check posts privacy icon on right shows each of posts public. however, none on the posts have visible public. any idea? it appears posts facebook app public app must in production/live mode: load apps page - http://developers.facebook.com/ select app used (from drop down on top left) click 'app review' on left side change app 'development' 'live' under 'make ... public?' after posts made app facebook becomes viewable public.

macros - How do I create this case statements in proc sql and append when tables are overwritten? -

i have spent several months data mining , creating technique find out information company. having trouble putting data appropriate , valuable presentation on how summarize information in sas. have 3 questions. 1)how in proc sql " if matched_by_t2 > b2_c2 add in new column "no bueno" 2)is there way have "(bc_c2/ original_count) %" how insert percent sign 3) if run query multiple times list of datasets how new tables named same "e_data_unmatched" append each time new table created , overwritten in imgur show 2 rows each timie program runs tables overwritten want ensure each time loop runs new records append table rather overwrite. 1 http://imgur.com/bzlefxy thank you! proc sql; create table wanted select t1.occurences original_count ,t2.occurences matched_by_t1 ,t3.occurences matched_by_t2 ,t2.occurences+t3.occurences b2_c2 ,t4.occurences not_matched ,t5.occurences matched_by_t2 (select count(*) occu

ssl - how to generate a pem certificate with Openssl using 'TLS1_ECDHE_RSA' ciphers for fips platform -

i want generate ' .pem' certificate openssl using 'tls1_ecdhe_rsa_ ' ciphers fips platform. also, using elliptic curve 'sec384r1'. the certs using on non-fips platform not working on fips platform though size of key 2048 bits. i using load balancer between client , server. here configuration: using curl on client: curl -v -o ssl_ecdhe.txt -tls1.2 http://30.1.1.101/ssl_ecdhe.txt using openssl on server: /usr/local/ssl/bin/openssl s_server -accept 443 -cert /root/2k.pem -key /root/2k.key -tls1_2 -named_curve secp384r1 -www -msg configuration on load balancer: slb template server-ssl srvssl cipher tls1_ecdhe_rsa_aes_128_sha ec-name secp384r1 version 33 33 ! slb server main-server 20.1.1.1 port 443 tcp health-check-disable ! slb service-group main-service-gp-ssl tcp member main-server 443 ! slb virtual-server main-vip 30.1.1.101 port 80 http service-group main-service-gp-ssl template server-ssl srvssl ple

hadoop - Delete folders from HDFS in dd-MM-yyyy format for a year -

how delete bunch of directories in hadoop year? folder created daily. name scheme "dd-mm-yyyy". how delete folders of particular year? tried getting list of folders hadoop fs -find / "*1995" unable delete them piping them rm command. hadoop cli supports both recursive rm (needed delete directories) , wildcards: hadoop fs -rm -r -f /path/*-1995

How can I use tensorflow serving for multiple models -

how can use multiple tensorflow models? use docker container. model_config_list: { config: { name: "model1", base_path: "/tmp/model", model_platform: "tensorflow" }, config: { name: "model2", base_path: "/tmp/model2", model_platform: "tensorflow" } } built docker image official tensorflow serving docker file then inside docker image. /usr/local/bin/tensorflow_model_server --port=9000 --model_name=model_name --model_config_file=/serving/models.conf here /serving/models.conf similar file yours.

javascript - Node api preflight failed in postman -

when calling api https://mywebsite.com/api/register through browser , returns correct response server { "error": false, "message": "hello world" } if hit same request postman returns html content please enable javascript view page content. below node side code: var express = require("express"); var app = express(); var bodyparser = require("body-parser"); var router = express.router(); var fs = require('fs'); var https = require('https'); var cors = require('cors'); app.use(cors()); app.use(bodyparser.json({limit: '50mb'})); app.use(bodyparser.urlencoded({ limit: '50mb', "extended": false })); var privatekey = fs.readfilesync('key.pem'); var certificate = fs.readfilesync('cert.pem'); var passphrase = 'testphrase'; var credentials = {key: privatekey, cert: certificate, passphrase:passphrase}; router.get("/", function (req, res) { r

Run delta-import and full-import in solr parallerly -

i have dih core. where, there 2 entities 1 delta-import via full-import , other delta-import handle deletes. i'm using delta-import via full-import because delta-import taking longer time full-import . now, i'm applying cron job so, imports automated. in case, possible run both imports simultaneously. such 1 takes care of updates , other takes care of deletes. is possible run delta-import , full-import simultaneously @ once? not if have single endpoint...but can this: duplicate dih configuration (in solrconfig.xml add second /dataimport2, points db-data-config2.xml put 1 of entities in one, , other in other now can call them both simultaneously

vb.net 2010 - Text box to accept only numeric values -

text box accepts numeric values. have text box bank account number. want text box accept numeric values. `private sub data_keypress(sender object, e keypresseventargs) handles data.keypress if (not e.keychar = chrw(keys.back) , ("0123456789.").indexof(e.keychar) = -1) or (e.keychar = "." , data.text.tochararray().count(function(c) c = ".") > 0) e.handled = true end if end sub `

jquery - J query: Stop fade Out 'message' on mouse over(hover) which is fade in -

<script> $(document).ready(function () { var messages = [ <?php foreach ($offer $off) { ?> [ '<?php echo $off->id; ?>','alert-success-notify_btn','<?php echo $off->description; ?>' ], <?php } ?> ]; for(i=0;i<messages.length;i++){ var message = messages[i]; $('.notify-message').append('<div id="'+message[0]+'" class="alert '+message[1]+' notify2"><button type="button" class="close">×</button>'+message[2]+'</div>'); $('#'+message[0]).delay(i * 1 ).fadein( "slow"); $('#'+message[0]).delay(i * 3000 + 2000).fadeout( "slow"); } $(document).on('click', '.close', function () {$(this).parent().hide();}); }); </script> in code message automatically fade in seconds , automatically fade out after sec

Anti-forgery validation fails when using Azure AD auth -

we implementing html.antiforgerytoken() in our aad authenticated application. login working fine when click button on home page needs call controller action. failing call controller action below exception. idea resolve issue? error: [httpantiforgeryexception (0x80004005): provided anti-forgery token meant user "xyz@microsoft.com", current user "".] html: using (html.beginform("externallogin", "account", new { returnurl = model.returnurl })) { @html.antiforgerytoken() <div id="loginlist"> <p> @foreach (authenticationdescription p in loginproviders) { <md-button type="submit" class="btn facebook-theme-background" id="@p.authenticationtype" name="provider" value="@p.authenticationtype" title="log in using @p.caption account">login @p.authenticationtype</md-bu

ios - How many certificates required to submit my app using local notification onto App Store? -

i using local notification reminder app. trying certify app. in app id in developer account, checked push notification option app, cannot find resources explaining how certify local notification function. thanks in advance! local notifications not same thing (remote) push notifications (which require push notification certificates , capabilities) . need app store provisioning profile submit app incorporating local notification store. apple has great introductory overview document. both local , remote notifications, users have give app permission .

java - Remove a specific fragment by tag from the stack -

how can remove specific fragment stack? for example, these fragments , in f right know. a-> b -> c -> d ->e ->f from f want remove c stack, when press button stack this: f-> e -> d -> b ->a i have tried this: fragment fragment = context.getfragmentmanager().findfragmentbytag("c"); if (fragment != null) { context.getfragmentmanager().begintransaction().remove(fragment).commit(); } which removes fragment stack still retained because when press frag d, able see frag b have press twice on frag b go frag a. seems fragment removed stack still retained.

java - Android SDK to be used (hosted) by other Android App to capture user journey -

what should design approach? develop android sdk used (hosted) other android app capture user journey. high level requirements : sdk should capture user interactions within hosting app. sdk should able take screenshot of views. sdk should able create video out of these screenshots. sdk should upload video created backend. sdk should work in aspect oriented way, gesture capturing, screenshot , video creation code must not called manually app developer in activity or fragment.

android - Error: Cardview Rounded corners -

this question has answer here: error: error parsing xml: unbound prefix in xml 2 answers when added following line current project using cardview got error follow. card_view:cardcornerradius="8dp" error: error:(2) error parsing xml: unbound prefix. not allow background xml file too. my xml: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/card_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="15dp" card_view:cardusecompatpadding="true" android:elevation="100dp"> <relativelayout andro

How do I pass values from a ruby back-end to a jquery confirmation dialog? -

i'm building web application ruby back-end (mostly sinatra, not rails). application manage institutions, people , subscriptions. i wanted have custom confirmation dialog boxes when user deletes something. example: if user deletes institution named "company a", want say: are sure want delete company a if delete person named "john doe", want say: are sure want delete john doe? if delete subscription, called "subscription a", john doe, want say: are sure want delete subscription john doe i have jquery-based delete confirmation dialog looks this: $('a.delete-action').click(function(event) { if (confirm("are sure want delete this?")) { return true; } return false; }); the associated html , erb are: <p><a class="action-link delete-action" href="/institutions/<%= @institution.id %>/remove">remove <%= @institution.name %></a></p> how pass in

java - How to restrict JtextField from putting extra spaces in database? -

Image
whenever add values in database through jtexfield saves spaces in sql database there way restrict wide spaces , save text added in textfield? try { string query = "insert items (item_name, category_id, item_price, item_description, stock) values (?,?,?,?,?) ;"; preparedstatement pst = con.preparestatement(query); pst.setstring(1, textfield_1.gettext()); pst.setstring(2, textfield_2.gettext()); pst.setstring(3, textfield_3.gettext()); pst.setstring(4, textfield_4.gettext()); pst.setstring(5, textfield_5.gettext()); pst.execute(); joptionpane.showmessagedialog(null, "data saved"); pst.close(); } catch (exception e) { e.printstacktrace(); } spaces trim function eliminates leading , trailing spaces: using string's trim() method textfield_1.gettext().trim(); using regex textfield_1.gettext().replaceall("^\\s+|\\s+$", "");

How to set Spring component scan in the Spring YML configuration file? -

i can see can component scan , restrict packages scanned using xml file. <beans> <context:component-scan base-package="com.mycompany"/> </beans> how can same in yml file? yml load properties, refer spring documentation . 24.6 using yaml instead of properties yaml superset of json, , such convenient format specifying hierarchical configuration data. springapplication class automatically support yaml alternative properties whenever have snakeyaml library on classpath. this explained here . you can use yaml ('.yml') files alternative '.properties'. so cannot define/configure beans using yml.

ruby on rails - uninitialized Twilio::REST::LookupsClient -

i'm using ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] rails: rails 5.1.3 i have action in check phone number if valid or not , action send message. message action working error when try check number. action def check_phone_number account_sid = rails.application.secrets.twilio_sid auth_token = rails.application.secrets.twilio_token @lookup_client = twilio::rest::lookupsclient.new(account_sid, auth_token) response = @lookup_client.phone_numbers.get("# {params[:phone_number]}") begin response.phone_number render json: {'response' => 'ok'} rescue exception => e if e.code == 20404 render json: { 'error' => 'invalid number' } else render json: { 'error' => 'invalid number' } end end end the error uninitialised twilio::rest::lookupsclient how can solve it? twilio developer e

user interface - I cannot format the date in the way I want in sap.m.DatePicker -

Image
i have couple of weird problems sap.m.datepicker. do, searched topics via google, helped me, not entirely. what want achieve: have sap.ui.table.column in sap.ui.table.table , column should have template: new sap.m.datepicker() date formatted dd.mm.yyyy . what have done far: using sap.ui.model.odata.v2.odatamodel() populate sap.ui.table.table odata service. went until decided have dates in corresponding column displayed in prefered format. @ first, using these properties, related formatting in datepicker's constructor: displayformat: "dd.mm.yyyy", valueformat: "yyyy-mm-dd", //... value = "{" + fieldname + "}" in way, dates displayed in following format: sun aug 06 2017 03:00:00 gmt+0300 (fle daylight time) (i don't know how express using format string). remember yesterday reading in documentation, when have binding, displayformat ignored, me ... don't understand why that. anyway, found solution, gives advice set v