Posts

Showing posts from June, 2010

c# - How to update an image on a page in UWP? -

i've got gridviewitem. gridviewitem has background imagebrush. want change imagebrush new source when clicking button. for i'm using: blck.background = new imagebrush(new bitmapimage(new uri("ms-appx:///assets/sensorbg.png"))); it work new image shows whenever click on corresponding gridviewitem. can tell me how update without having click on gridviewitem? i've tried put within block no success: coreapplication.mainview.corewindow.dispatcher.runasync(coredispatcherpriority.normal, () => { blck.background = new imagebrush(new bitmapimage(new uri("ms-appx:///assets/sensorbg.png"))); } ); the best be, if have defined itemclass suitable properties , implement inotifypropertychanged - appropriate binding, every change update ui. here small sample - xaml: <stackpanel> <button content="change background of second item" click="but

angularjs - ngEnter(ngAnimate) class not getting added in ngDialog -

i don't know if there bug in ngdialog side or there missing not able see ngenter/ngleave class getting added. my ngdialog rough html template : <div class ="ng-dialogbg" ng-swipe-right="swiperight()" ng-swipe-left="swipeleft()"> <div ng-show="currentid==2" class="canvas-holder" id={{currentid}}> <avatarcanvas> </avatarcanvas> </div> <div ng-show="currentid==3" class="canvas-holder" id={{currentid}}> <avatarcanvas> </avatarcanvas> </div> </div> css : .canvas-holder.ng-enter{ background-color:blue; } .canvas-holder .ng-leave{ background-color:black; } so testing have used simpler form of code, , don't see ngenter class being added. swipe action changes respective currentid in controller particular div. ps : have used ngswipe, nganimate in project, modules have been added properly. on ngdialog part or miss

javascript - How to count cells with bold text and set a value and background color for another cells based on that in Google Sheets? -

i have poule table here: https://docs.google.com/spreadsheets/d/1wnefubw1rgh_koza_pj7-l9q6cyvrifqpk31spqn0nu/edit?usp=sharing i've used built-in conditional formatting high lighting cells plays against , making score bold if it's higher opponent's. working until column f loser winners game play against winner losers game. there think easiest way find out need play (and high light corresponding cell) checking font weight in other columns. so, every row in column f (actually f6:f12) need check following: if font weight not bold in d6:d12 or font weight bold in e6:e12 set background color of cell x (e.g. yellow). for column g (place) need more complex formula. there want set correct place based on how many cells font weight bold there are. formula g6 should this: if c6 , d6 font weight bold return "i". if c6:f6 bold count = 2 return "ii" if c6:f6 bold count = 1 return "3." if c6:f6 bold count = 0 return "4." the formula

javascript - Passing url from JS to MVC Controller in a form of a string -

so passing string url js file, like "https://....." like this $http.post("user", vm.user) .then(function (response) { $http.get("user/url/" + response.data.url) .then..... now having problems, my controller gets url drops second forward slash, so ends being "https:/....." my controller looks this, [httpget("user/url/{*url}")] public iactionresult get(string url) { try { anyway past ? how make sure string intact when passed ?

javascript - looping through array content with a delay -

this jquery/ javascript problem. have array contains button numbers , outputs buttons onto button result in button being clicked. problem buttons clicked @ once if run loop. instead want output numbers delay buttons pressed after 1 second delay. here link simon game project: https://codepen.io/roger1891/full/vmyqwx/ the problem visible after following 1st button. after that, computer press next 2 buttons @ same time instead of pressing them separately after 1 sec delay. the problem located in loop located in myloop() function: sequencearray.foreach(function(item, index, array){ //click button getting last index of array //$("#btn-"+array[array.length-1]).click(); $("#btn-"+array[index]).click(); console.log(array); }); this full code: //associating buttons sound var soundbutton = function(buttonid, soundid) { $("#" + buttonid).click(function(){ $("#" + soundid).get(0).play(); $("#" + buttonid)

How to implement smooth map width transition of Mapbox GL map? -

i have css3 transition reducing width of map element. have trigger map.resize() when changing map block width update map width programmatically. jumps new width, without transition (what expected) is there way implement animation of map block width transition? except changing map block width js , triggering resize on each frame. another way create block map rendered covering full width, , shrink block overflow:hidden , use offset translate map center point bit. in case wide map, , tiles loaded in background (even part of block hidden) suppose.

Excel/VBA Rows and column if statement -

i'd make function allow me check if of field in row 149 text "mandatory" if it's, check if rows below empty if sth. tried sth this: if ws.rows("149") = "mandatory" if ws.range("c" & chk.topleftcell.row).value but don't have idea how write second check value in each column help guys! thanks! my vba script now: sub checkboxdate() dim ws worksheet dim chk checkbox dim lcold long dim lcolchk long dim lrow long dim rngd range lcold = 0 'number of columns right date set ws = sheets("ma template_vback-end") set chk = ws.checkboxes(application.caller) lrow = chk.topleftcell.row lcolchk = chk.topleftcell.column set rngd = ws.cells(lrow, lcolchk + lcold) select case chk.value case 1 'box checked each chk in ws.checkboxes if ws.range("c" & chk.topleftcell.row).value = vbnullstring chk.enabled = false rngd.entirerow.interior.color = vbgreen end if next chk case e

python - Numpy: Subtract 2 numpy arrays row wise -

i have 2 numpy arrays , b below: a = np.random.randint(0,10,(3,2)) out[124]: array([[0, 2], [6, 8], [0, 4]]) b = np.random.randint(0,10,(2,2)) out[125]: array([[5, 9], [2, 4]]) i want subtract each row in b each row in , desired output of shape(3,2,2): array([[[-5, -7], [-2, -2]], [[ 1, -1], [ 4, 4]], [[-5, -5], [-2, 0]]]) i can using: print(np.c_[(a - b[0]),(a - b[1])].reshape(3,2,2)) but need vectorized solution or built in numpy function this. just use np.newaxis (which alias none) add singleton dimension a, , let broadcasting rest: in [45]: a[:, np.newaxis] - b out[45]: array([[[-5, -7], [-2, -2]], [[ 1, -1], [ 4, 4]], [[-5, -5], [-2, 0]]])

reactjs - PLBuildVersion trowing warning when running React-Native App. -

i have created react-native app. throwing warning when run it. not creating issue warning there in logs. please guide me why occurring. here warning: class plbuildversion implemented in both /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator.sdk/system/library/privateframeworks/assetslibraryservices.framework/assetslibraryservices (0x10f9ea998) , /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator.sdk/system/library/privateframeworks/photolibraryservices.framework/photolibraryservices (0x10f80c880) . 1 of 2 used. 1 undefined.

java - How to reuse the variable used for for loop first level inside for loop second level in nested for loop -

someone can tell me how can reuse rootopt object inside of foreach. there way reuse variable? have following message "can not resolve symbol rootopt" when write rootopt.getchildoptions() inside foreach. please find below did: have tried rewrite loop below using stream. thank you opts.stream() .flatmap(rootopt -> rootopt.getchildoptions().stream()) .foreach(subopt -> { if (subopt.getoptlogic() != null && subopt.getoptlogic().getcant() != null && !"".equals(subopt.getoptlogic().getcant())) { string[] oldchs = subopt.getoptlogic().getcant().split("( )"); optionlist samepricesibs = getsameprices(rootopt.getchildoptions(), subopt); (string ch : oldchs) { option chrootopt = childoptcodetoparentoptmap.get(ch.touppercase()); if (chrootopt != null) {

javascript - Disable Bootstrap from a custom button -

its me. wondering if disable bootstrap resizing button inside of div element. order button , gets invisible if used in mobile device. it link, image (which button). here script it: <div class="buttonimage" style="color:green" style="font-size: 2"> <a href="transaction.html?totalprice=3000"> <img src="img/orderbutton.png" width="15%" height="15%" onmouseover="this.src='img/orderbuttonhover.png'" onmouseout="this.src='img/orderbutton.png'" alt="orderbutton"/> </a> <label class="cash">3000 points</label> </div> is there suggestion not resize button? div element not resized, buttons instead. , also, left button resizes first before middle , right button (there 3 divs horizontal

Arduino WebServer Problems -

i’m trying set arduino web server receive commands pc’s browser not getting results. i’m using webserver example arduino , have changed ip , mac suitable. when upload code , check serial monitor there nothing being reported despite serial.print being included. router have dhcp enabled , have tried different router, no luck. the end goal here try send commands alexa skill arduino, might bear in mind. webserver example here any welcomed.

java - Check if user ever purchased consumable item, + way of consuming items -

i have 2 questions in-app purchases managed google play. 1) how know if user ever purchased consumable app? it's not hard change flag in sharedpreferences when purchase (or when consume right after purchase), when user uninstall app install again, flag lost , don't know if ever purchased or not. 2) right way of using consumables - consumable have usable current installed session of app right? it's ok when user purchase consumable, uninstall app, reinstall , don't have anymore? i've been searching in docs these things missing. thanks reply.

textarea - Weird behavior on event (Html.Events.on) -

i'm making "fluid" textarea, resizes it's height according it's content. i'm trying implement this script. have following code: https://ellie-app.com/vjtvm6yrkwa1/4 the issue when increasing, works no problem, when trying decrease height, doesn't work expected. how reproduce issue: the textarea comes default text. if click on textarea, resize it's height content. delete half of text or entire text. click in textarea again. expected behaivor should resize it's height again,recuding it's height, doesn't. either nothing or reduces height little (making have click lot of times until height ok) i think it's related virual-dom preventing scrollheight change, cache (performance-wise), it's guess. what problem? ps. when trying use other kind of events, "input" or "change", issue occurs. edit 4/20 : ilias on slack channel linked this: https://ellie-app.com/h5x9dc4j9ba1/0 (ellie of pure elm

angular - Add/update/delete products in json file using angular2 with http and observables -

how can add/update/delete products/items in json file using angular2 http , observables. below code, products working fine. please advise others product-list.component export class productlistcomponent implements oninit { pagetitle: string = 'product list'; imagewidth: number = 50; imagemargin: number = 2; showimage: boolean = false; listfilter: string; errormessage: string; products: iproduct[]; constructor(private _productservice: productservice) { } toggleimage(): void { this.showimage = !this.showimage; } deleteitem() : void { this._productservice.deleteproduct(); } ngoninit(): void { this._productservice.getproducts() .subscribe(products => this.products = products, error => this.errormessage = <any>error); } product.service.ts export class productservice { private _producturl = 'api/products/products.json'; private headers = new headers({'content-type': 'application/json'})

utf 8 - Codename One - UTF8 source non-ascii error -

i have problem codename 1 eclipse project. encoded in cp1252, , after setting encoding of whole project utf-8 , replacing non-ascii char, simulator fine, on devices, non-ascii char messed up. i'm not using cn1 localization api, it's planned future release, strings hardcoded. more, retrieve data webservice, , non-ascii char in data showing properly, that's problem hardcoded strings. here 2 screenshot, first cn1 simulator, second android phone (same problem on ios device): simulator screenshot android 6 screenshot any idea of messed ? in eclipse javac called in build.xml , doesn't inherit encoding of project netbeans version does. need edit build.xml , add encoding attribute these javac calls: <javac encoding="utf-8" ... >

Freeze Sheet position in Google Sheets -

i have 2 sheets need 1st , 2nd sheets. 1st "form responses 1" (linked form) 2nd "summary" everytime form filled creates new sheet, when happens "summary" sheets moves down 3rd place , subsequently lower down more new sheets created. how can freeze position of 2nd sheet doesnt move 3rd spot , on. the easiest thing do control new sheet in placed insertsheet(sheetname, sheetindex). sheets 0 indexed, so: var ss = spreadsheetapp.getactivespreadsheet(); ss.insertsheet('my new sheet', 2); would place new sheet after first two. or, use getsheets() , determine last sheet , insert new sheet @ end.

How to use GPU with chainer on ubuntu 16 -

does succeed in using gpu chainer on ubuntu 16.04? how can achieve this? cuda , cudnn correctly installed. keep receiving /home/prime/.local/lib/python2.7/site-packages/chainer/cuda.py:87: userwarning: cudnn not enabled. please reinstall chainer after install cudnn

linux - signals used by the timeout command -

i want run program timeout. i'm doing using timeout command this timeout 5 path/to/program program using time-related signals: blocking, unblocking , raising sigalrm , sigvtalrm. don't know how timeout works, guess uses time signals. should worried signals program interfere timeout , vice versa? by default, timeout send sigterm (unless change -s ). therefore, shouldn't see conflict other signals. fyi, if program exited timeout, have return value of 124 . can force kill (if doesn't die gracefully) using -k seconds give return value of 137 .

linux - What does CFS scheduler does to the waiting process? -

in o(1) waiting processes not kept in active or expired queue. once preempted put separate wait queue. in case of cfs happens waiting processes . i found in 1 of articles of ibm developer works " cfs includes concept of sleeper fairness" . how done?

javascript - Animate object along a path in three.js -

Image
i trying animate cube along path in three.js. code // ellipse class, extends virtual base class curve var curve = new three.ellipsecurve( 0, 0, // ax, ay 16, 21.28, // xradius, yradius 0, 2 * math.pi, // astartangle, aendangle false, // aclockwise 0 // arotation ); //defines amount of points path have var path = new three.path( curve.getpoints( 100 ) ); var geometrycirc = path.createpointsgeometry( 100 ); var materialcirc = new three.linebasicmaterial( { color : 0xff0000 } ); // create final object add scene var ellipse = new three.line( geometrycirc, materialcirc ); ellipse.position.set(0,1,0); this.scene.add( ellipse ); // add box scene this.scene.add(this.box); i have being doing research how done , came across fiddle animate on path method uses three.splinecurve3 method create points box use. my question need conve

java - Google Drive API getting an empty ByteArray when downloading/exporting files -

when trying export files drive pdf stream (from gdoc), empty inputstream byte array (it looks happens large files can't confirm!) : inputstream mediacontent = service.files().export(fileid, mimetype).executemediaasinputstream(); if(!(mediacontent.available()>0)) { throw new ioexception("media content empty, bytes expected"); } no exception thrown. can't see specified limits in documentation ( https://developers.google.com/drive/v3/web/manage-downloads ). there solution problem? known issue? drive api : java client version v3-rev69-1.22.0 edit through google oauth 2.0 playground request works fails (by failing mean returns http code 200 empty content!). when using resumable media download, empty inputstream byte array (chunks of 1mb) : drive.files.export request = service.files().export(fileid, mimetype); request.getmediahttpdownloader().setprogresslistener(new customprogresslistener()); request.getmediahttpdownloader().setchunksize(constants.chun

excel 2010 - Is it possible to have a defined name that applies multiple cells via relative reference? -

i have cell numerous relative references pointing span multiple sheets; possible define name original cell , have apply of other linked cells dynamically? defined name need changed often. need format of aforementioned cells dynamically hoping use name refer of them in formula. using vba isn't option in situation. a defined name can refer to, example: =offset(sheet1!c1,,-2)+offset(sheet2!c1,,-2)+offset(sheet3!c1,,-2) placed in c1 of sheet4 should sum whatever in a1 across sheets1 - 3 both inclusive , a2 across sheets1 - 3 both inclusive if dragged down 1 cell, , forth.

android - CollapsingToolbarLayout inside Viewpager: toolbar acting strange -

Image
i have viewpager fragments, each fragment should include collapsing toolbar + image header. the layout fine have strange behaviour of toolbar, ignores top margin , ends under system bar. happens: on first tab after scrolling tab 3 or more, "first previus tab" it happens on 1 tab @ time (as far can see) also on first tab menu not inflated, despite oncreateoptionsmenu being run , not throwing error. i reviewed code several times , made lots of adjustments but, sake of me, cannot find doing wrong! adding screenshots , code. here a github repository if want run , see in action. help! and happens when scrolling left: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="

regex - Python regular expression to search a string -

i've below code: def ospf_route_type_e2_exists(nbr_output,as_ext_net_list,net_list): match_list=[] if type(as_ext_net_list) not list: as_ext_net_list=[as_ext_net_list] if type(net_list) not list: net_list=[net_list] ext_net,net in zip(as_ext_net_list,net_list): net_prefix=str(net).rstrip(".0") match= re.search(r"o[" "]+e2[" "]+str\(ext_net\)[" "]+\[[0-9]*[0-9]*[0-9]+\/[0-9]+\][" "]+via[" "]+str(net_prefix)",nbr_output) match_list.append(match) if any(item item in match_list): print "as external networks advertised via correct areas" return 1 else: print "as external networks not advertised via correct areas" return 0 the nbr_ouput contain below: show ip route ospf o ia 192.168.42.0/24 [110/2] via 192.168.43.4, 00:00:29, fastethernet0/0 o 192.168.124.0/24 [110/2] via 192.168.43.4, 00:00

julia lang - How can I capture the output of an external program that returns a non-zero exit code? -

prior julia 0.5, run diff = readlines(`diff $oldfile $newfile`) and diff between files. now julia throws exception because diff returns exit code 1, no longer output assigned variable. what intended way of working around problem? diff = readlines(cmd(`diff $oldfile $newfile`, ignorestatus=true))

javascript - html bootstrap dropdown menu getting reset -

i have dropdown menu in 'index.html` like <div id="navbar" class="navbar-collapse collapse"> <form class="navbar-form navbar-right"> <div class="dropdown"> <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">menu <span class="caret"></span></button> <ul class="dropdown-menu"> <li><a href="{% url 'item1' %}">item1</a></li> <li><a href="{% url 'item2' %}">item2</a></li> </ul> </div> </form> </div><!--/.navbar-collapse --> and when click on item2 dropdown menu brifely sets item2 , menu . in item2.html calling index.html like {% extends 'index.html' %} {% block content %} ... {% endblock %} i think a

javascript - Angular Material - Pre-rendered dialog doesn't appear but the background color changes -

i'm trying create pre-rendered modal using angular-material. when click button should fire modal, screen becomes dark gray (the modal background) if modal there actual modal doesn't appear. have copied straight angular material's demo not sure why isn't working. html <md-button class="md-raised md-primary"ng-click="vm.showmodal($event)"> add review </md-button> <md-dialog layout-padding aria-label="mydialog" id="mydialog" class="dialog"> <md-dialog-content> <h2>pre-rendered dialog</h2> <p> pre-rendered dialog, means <code>$mddialog</code> doesn't compile template on each opening. <br/><br/> dialog element static element in dom, visually hidden.<br/> once dialog opens, fetch element dom our dialog , upon close restore element old dom position.

c - FFMPEG how to use functions from libswscale when writing filter for libavfilter -

i trying write filters ffmpeg , use created filters preprocessing planes. how can 1 that? have standard loop plane processing: int p; if (av_frame_is_writable(in)) { out = in; } else { out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { av_frame_free(&in); return averror(enomem); } av_frame_copy_props(out, in); } // processing planes (p = 0; p < filter->nb_planes; p++) { pad_plane(); transpose_plane(); // etc... apply_my_filter(); } if (out != in) av_frame_free(&in); return ff_filter_frame(outlink, out); i believe padding , transposing possible in ffmpeg's other libraries. common way able use them inside mine filter code?

Android not restoring instance state -

i know similar questions have been asked none of solutions questions have been working me. when go ahead , try save state of app, state of edittext views not being saved , restored. went ahead , commented out , put in temporary string save when app loads again, oncreate() method not print 'restoring instance state' package com.fwumdesoft.udppacketsender; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.edittext; import android.widget.toast; import java.io.ioexception; import java.net.datagrampacket; import java.net.datagramsocket; import java.net.inetsocketaddress; /** * posts udp message given data * target address on target port. */ class udppostactivity extends appcompatactivity { private static final string tag = "udppostactivity"; private static final string statetexttargethost = "com.fwumdesoft#targethost"; private static final

UI tests on each Fragment Android -

i'd start implementing ui tests on each of fragments. have math formulas verify in each fragment. let's fragment have go fragment b , fragment c(i want test if each of fragment's c edittext text changes if button gets clicked). don't go throughout of passages arrive fragment c. i've installed espresso using gradle, after? please provide step step implementation. thank in advance. maybe helpful: https://stackoverflow.com/a/27370190/7861694 or/if using espresso recommend second option - add unique id 1 element in fragment layout. https://developer.android.com/reference/android/r.id.html

sqlplus - oracle sql plus script is too long -

select (select sum(t.fees_amount)from unit u, payment p, type_of_fees t u.unit_id = p.unit_id , p.stof = t.stof , u.unit_id '%u1001%' , p.stat = 'not payed') "block 1(not payed)", (select sum(t.fees_amount)from unit u, payment p, type_of_fees t u.unit_id = p.unit_id , p.stof = t.stof , u.unit_id '%u1001%' , p.stat = 'payed') "block 1(payed)", (select sum(t.fees_amount)from unit u, payment p, type_of_fees t u.unit_id = p.unit_id , p.stof = t.stof , u.unit_id '%u1002%' , p.stat = 'not payed') "block 2(not payed)", (select sum(t.fees_amount)from unit u, payment p, type_of_fees t u.unit_id = p.unit_id , p.stof = t.stof , u.unit_id '%u1002%' , p.stat = 'payed') "block 2(payed)" dual; is there other method deal this? you can use conditional aggregation this: select sum(case when u.unit_id '%u1001%' , p.sta

postgresql - MADlib apt install, how to? -

madlib complete, efficient (faster functions) , reliable mathematical library postgresql... @ official download no clues debian or ubuntu "plug-and-play installation". checking other fonts, best (simplest) old 2013's instruction apt-get it . ... lost-script of 2014... comment "can download .rpm packages , install in ubuntu convert package .deb using alien command work". question: secure , simplest way install madlib? today (2017) @ ubuntu 16 lts , postgresql v9.6. note , secondary question: debian stable , ubuntu lts popular linux distributions web-servers, .deb important distribution form... why madlab maintainers refuse see it? why not welcome .deb users? there technical or license problems apt or converted .deb ? edit i have 2 types of sql servers, v9.6 stated, important postgresql v9.5.x (!sorry wayting use v9.6 in servers). situation @ postgresql 9.5.x in ubuntu 16 lts (xenial) psql --version , it, select version()

angularjs - Adding angular-ui-tinymce to JHipster - gulp inject issue -

i have project generated jhipster ( https://jhipster.github.io/ ). i added dependency angular-ui-tinyme via command below. bower install angular-ui-tinymce --save after that, ran gulp inject , following injected index.thml <script src="bower_components/angular-ui-tinymce/src/tinymce.js"></script> however, did not inject following caused usage of tinymce fail. <script src="bower_components/tinymce/tinymce.js"></script> manually adding missing inject works love have automatically injected via gulp. anyone experience in solving similar issues before? looking forward advise. update : per accepted answer below, solution add following override entry jhipster project bower.json file. "tinymce": { "main": [ "tinymce.js" ] } i having same problems installing tinymce on bower. problem lies on fact bower.json file in tinymce package wrong or incomplete: { "name": &quo

javascript - How to return multiple match with regexp? -

this question has answer here: how retrieve matches regular expression in javascript? 7 answers i tried code: /\[\[(.*?)\]\]/g to return multiple matches text this: [[text]] , [[more]] text. instead of text, more , returns text . doing wrong? in advance. the regex ok: var test = "[[text]] , [[more]] text.".match(/\[\[(.*?)\]\]/g); console.log(a); > ["[[text]]", "[[more]]"]

In PHP classes is it possible to create a private variable inside of a function? -

in using php classes have noticed inside class when define variable in function property of class in '$this->variablename way' automatically becomes public variable of class. class example { public function setstring(){ $this->string = "string"; } } so $class = new example(); echo $class->string; outputs: string; however in case wanted create private variables accessible functions inside class, there anyway declare them inside of function setstring()? instead of declaring them private outside of function this. class example { private $string =''; public function setstring(){ $this->string = "string"; } } the reasons might neatness, not have long list of private variables declared @ beggining of class. no , there not way that. in php, typically declare all class/instance properties above functions in alphabetical order self-documenting comments. "neat" , clear

javascript - Why is ionicPlatform.ready works randomly? -

i building ionic app , having problems " ionicplatform.ready " method. i have declared in app.js, @ top : .run(function($ionicplatform,config) { $ionicplatform.ready(function() { if(window.cordova && window.cordova.plugins.keyboard) { // hide accessory bar default (remove show accessory bar above keyboard // form inputs) // don't remove line unless know doing. stops viewport // snapping when text inputs focused. ionic handles internally // nicer keyboard experience. cordova.plugins.keyboard.hidekeyboardaccessorybar(true); cordova.plugins.keyboard.disablescroll(true); } if(window.statusbar) { statusbar.styledefault(); } firebase.initializeapp({ apikey: config.firebase_api, authdomain: config.firebase_auth_domain, databaseurl: config.firebase_db_url, storagebucket: config.firebase_storage, messagingsenderid: config.firebase_storage }); }); }) now,

javascript - show page loading icon while loading table -

i have table in html file <table id="table" class="table table-striped"> , call gettabledata function , dynamically update table using jquery $(document).ready(function(){ gettable(); $(document).ajaxstop(function () { ... }); i using ajaxstop run next functions after table rendered. function gettable(){ $.get("api/table", function(data){ settable(data); } } where settable renders table. how can show loading icon while table data fetched? with jquery can send success callback on $.get() (so when data received) , handle loading css class: function gettable(){ // before call server add loading style $('#table').addclass('is-loading') $.get("api/table", function(data){ // after receiving data remove loading style $('#table').removeclass('is-loading') settable(data); } }

arrays - Swift sequences prefix(while:) return not all elements -

i have issue. testing usage of prefix(while:) , receive not expected result.count of elements after prefix(while:) missing 1 element. code possible see structures name has prefix oleg 5 after prefix(while:) returns 4. example : struct user { let name: string } let users = [user(name : "oleg 1"),user(name : "oleg 2"),user(name : "oleg 3"),user(name : "oleg 4"),user(name : "igor 1"),user(name : "oleg 5"),user(name : "max 1")] print(users.prefix { $0.name.hasprefix("oleg") }.count) //4 from documentation array prefix method: returns subsequence containing initial elements until predicate returns false , skipping remaining elements. when code gets "igor 1" instance, prefix stops , returns first subrange giving result of 4. don't confuse array prefix method , string hasprefix method. used 2 different things. perhaps want use filter . print(users.filter {

java - micro service timeout and transaction -

given micro service architecture, when call service timed out, caller give up. however, request fulfilled , new records inserted. problem caller system determined request failed because of timeout. best way maintain transaction? it impossible guarantee consistency between service consumer , service provider separated network. both request transmission , response transmission can result in errors , in edge cases response message might lost on wire without service provider noticing went wrong. i think might terms "nullipotent" , "idempotent". first refers operations have no effects on service provider (e.g. no change in stored data such reading data), whereas second speaks operations can invoked number of times without changing outcome (e.g. calling delete 1 or ten times still means data gone, if alter calls return exception stating "data gone": data gone after call). finally there operation neither of two, example "add new element

MySQL select statement remove whitespace in WHERE clause -

i'm trying match phone numbers based on last 6 digits. problem numbers in database in various formats, have whitespace within number. select * users trim(phone) '%123456' trim removes leading , trailing whitespace , doesn't find entries clients have entered numbers whitespace between numbers: 123 456, 12 34 56, etc. so how remove whitespace within search? having result without whitespace not enough. updating database replace not option either. use replace() substitute occurrences of ' ' '' within string. mysql documentation replace(str,from_str,to_str) returns string str occurrences of string from_str replaced string to_str. replace() performs case-sensitive match when searching from_str. select * users replace(coalesce(phone,''), ' ','') '%123456' if can't in clause, seems odd me; nest in select. select sub.* (select u.*, replace(coalesce(phone,''), ' ','') ph

sum - Why is this function to add the contents of a table together in Lua returning nothing -

i stuck trying make contese of table (all integers) add form 1 sum. working on project end goal percentage. putting various quantities , storing them in 1 table. want add of integers in table sum. haven't been able find in standard library, have been tyring use this: function sum(t) local sum = 0 k,v in pairs(t) sum = sum + v end return sum however, not giving me after return sum.... , appreciated. a more generic solution problem of reducing contents of table (in case summing elements) outlined in answer (warning: no type checking in code sketch). if function not returning @ all, because missing end statement in function definition. if function returning zero, possible there problem table passing argument. in other words, parameter t may nil or empty table. in case, function return zero, value local sum initialized. if add print (k,v) in loop debugging, can determine whether function has add. try: local function sum ( t ) print( "t&quo

c - Have wrong(unwanted) values in pointer array elemnt -

i have pointer array named ipn_details has type ip_details : typedef struct { char name[64]; char ip[16]; char flags; char mac[17] ; } ip_details; after calling function get_ip_details when print elements of ipn_details contains wrong value element of mac whenever array contains more 1 member. (all other elements have right values expected.) example, when array has 2 member value of mac in first member concatenated of last characters of name of second member. first member: name=mina ip=9.9.9.9 flags=a mac=3f:fd:df:fd akh second member: name=sim akh ip=9.9.9.1 flags=ab mac=3f:gv:hj:fd i have tried debug code using gdb after memcpy line , printed elemnt of mac , contains right value,i have no idea why contains wrong value when print using cout (i call cout after calling function get_ip_details ). printed contents of ipn_details array after memcpy line using gdb . right, think problem not relate function extract_ip . int get_ip_det

Function and Array in C++: Unexpected output -

i need here please. i started learning c++ (coming python background). i'm trying familiarize myself arrays , functions. wrote bunch of functions stated, above each one. however, function supposed sum elements in array , return sum, seem adding 10 result, no matter argument supplied input. doing wrong please, can't seem find out. on general layout of code appreciated. // working arrays , functions #include<iostream> using namespace std; // function instantiate array int of length n. int* array_creator(int n) { static int ary_of_ten[10]; //declare array (int i=0; i<n; i++) //use loop fill { ary_of_ten[i] = i+1; } return ary_of_ten; } //function print array elements void* array_printer(int arr[], int array_lenght) { (int i=0; i<array_lenght-1; i++) { cout << arr[i] << " "; } cout << arr[array_lenght-1] << endl; } //function accepts int arrays , returns array of sq

reactjs - How is scope defined in Higher Order Components in React? -

a class in js still function. understanding when create wrapped1 have 'this' tied app since lives inside of wrapped1 has own scope. can't figure out i'm wrong. let higherordercomp = (component) => class extends react.component{ construstor(props){ super(props); this.state = { count: 0 }; } componentdidmount(){ setinterval(()=>{ this.setstate( count: this.state.count + 1 ); }, 1000) } render(){ return <component {...this.props} {...this.state}> } } class comp1 extends react.component{ render(){ return( <div> <p>comp1</p> {this.props.count} </div> ); } } let wrapped1 = higherordercomp(comp1); class app extends react.component{ constructor(props){ super(props); } render(){ return( <div> <wrapped1/> </div> ); } } reactdom.render(<app/>, document.

String Joiner help needed in Java -

i need in string joiners , want append to_date before string , format after string.. public static stringjoiner inputdatestoquery( list<filesubmtretrlstatus> filesubmtretrlstatus) { stringjoiner joinnames = new stringjoiner(",", "to_date('", "','yyyy-mm-dd hh24:mi:ss')"); // passing comma(,) , square-brackets delimiter (filesubmtretrlstatus status : filesubmtretrlstatus) { joinnames.add(status.getfilesubretdatetime()); } return joinnames; but out put coming below.. to_date('2017-04-13 11:18:16,2017-04-13 11:17:44,2017-04-13 10:16:07', 'yyyy-mm-dd hh24:mi:ss') but should below... to_date('2017-04-13 11:18:16,'yyyy-mm-dd hh24:mi:ss'), to_date('2017-04-13 11:17:44,'yyyy-mm-dd hh24:mi:ss'), to_date('2017-04-13 10:16:07,'yyyy-mm-dd hh24:mi:ss') stringjoiner produces one output string. example code in documentation is:

Cassandra - New node bootstrapped - Not compacting -

i had 21 node cluster (c* 2.2) of m4.2xlarges, each 5 volumes of 1tb ssds. when 50% full (each node @ 500gb * 5 = 2.5 tb), realised needed more space added new node. this new node joined cluster (from uj un), disk usage @ 4.2tb. i figured due compactions lagging behind , waited few days. disk usage did not change though there compactions taking place. new box cpu bound, bumped compute optimised c4.8xlarge box , cranked concurrent_compactions 20 , disabled compaction_throughput throttling done. in mean time stopped writes cluster. # of pending compactions going , , data on disk not going down. what doing wrong? system time looks high. using org.apache.cassandra.db.compaction.sizetieredcompactionstrategy , current compaction thresholds min = 4, max = 32 when strace -f -c -p cassandra-pid > strace_count : % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 49.57 7431.363672 140392