Posts

Showing posts from February, 2011

shell - keep expanding a bash variable -

imagine have n months, here n=3 i keep adding integer 1, 2, 3 shell variable called $test: so when do cat $test it return 1 2 3 any idea? just find solution: for ((i=1;i<=3; i++)); test1="${i}" test+="$test1 " done

matlab - Struggling to index into a column vector produced using the eval function -

i have several tables, each massive amount of data (20mb each). let's call them table_1, table_2, table_3, etc. structure of these tables similar, identical column headers (but varying number of rows). let's attribute_a, attribute_b, etc. i interested in performing calculations on attribute_b each table. these calculations involve looping through attribute_b. i start creating master list of table names. table_list = [table_1, table_2, ... table 10]; now can iterate through , perform calculations. doing single calculations works fine using eval , concatentation of column vector name function of value of current_table: for current_table = table_list peak_value = max(eval(strcat(current_table,"attribute_c"))); i run trouble when perform calculations require iterating through column vectors. instance, following fails. for current_table = table_list = 1:length(eval(strcat(current_table,".attribute_b") x = x + eval(strcat(current_

python - An external increment? -

i trying create file "varstore.dat" (that not exist prior running this) should contain value 0. every time execute script, want increment value 1. so trying create file 1 time, read file, , rewrite(or overwrite) file upon each execution. however, problem each time run program, initialize 0 , output 1. trying rewrite varstore.dat , new value become old value next time execute script. def get_var_value(filename="varstore.dat"): open(filename, "a+") f: val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val your_counter = get_var_value() print("this script has been run {} times.".format(your_counter)) you need f.seek(0) before val . def get_var_value(filename="varstore.dat"): open(filename, "a+") f: f.seek(0) val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val the

python - How to redirect in django while using django-hosts? -

i'm using django-hosts package manage content that's supposed set in various different subdomains. started making view in form used change something. once form validated , processed, user supposed redirected other page. looking through documentation there's easy way render(): settings_url = reverse('settings', host='dashboard') return render(request, 'dashboard/settings.html', {'settings_url': settings_url}) however, there's no mention of redirect(). how go redirecting somewhere else, instead of usual return redirect("dashboard:settings") myapp/hosts.py : host_patterns = patterns('', host(r'www', settings.root_urlconf, name='www'), host(r'dashboard\.myapp\.com', 'dashboard.urls', name='dashboard'), ) dashboard/urls.py from .views import home, websitesettings urlpatterns = [ url(r'^$', home, name='home'), url(r'^settings/$',

scala - How can I queue REST requests using Apache Livy and Apache Spark? -

i have remote process sends thousands requests humble spark standalone cluster : 3 worker-nodes 4 cores , 8gb identical master-node driver runs that hosts simple data processing service developed in scala. requests sent via curl command parameters .jar, through rest apache livy interface this: curl -s -x post -h "content-type: application/json" remote_ip:8998/batches -d '{"file":"file://path_to_jar/target/my_jar-1.0.0-jar-with-dependencies.jar","classname":"project.update.my_jar","args":["c1:1","c2:2","c3:3"]}' this triggers spark job each time, the resource scheduling cluster dynamic can serve @ 3 requests @ time, when worker goes idle, queued request served. at point in time, requests kills master node memory if in waiting state (because spark register jobs served), hangs master node , workers loose connection it. is there way can queue requests preventing spark

javascript - How to dynamically generate different google maps -

here issue have. have many businesses , want show google maps each business (all in 1 html page). for each business have: the latitude , longitude (always). the address not street number. question. how can insert google map each business using lat/long or business using google map api? difficulties -using id each business not ideal. -how can pass latitude/longitude javascript function insert map? here general idea of want do. assume have array of businesses contains information each business. foreach($businesseslist $businessname =>binfo) { list($about, addresstext, $lat, $long) = $binfo <div> $businessname</div> <div> $about</div> <div class='map'> //insert google maps inside div each business using $lat, $long , google maps api. </div> } i dont experience javascript , jquery work php i can set array containing google maps embed code , embedded code each busines

ios - do you want to add a stub? SwiftWebViewProgress 0.3 in Xcode 8.3.3 -

i have build error swiftwebviewprogress 0.3 in xcode 8.3.3 protocol requires function 'webviewprogress(_:updateprogress:)' type '(webviewprogress, float) -> ()'; want add stub? when click fix-it, xcode write code below, don't know hot next class browserviewcontroller: uiviewcontroller, uitextfielddelegate, uiwebviewdelegate, actionviewcontrollerdelegate, webviewprogressdelegate { func webviewprogress(_ webviewprogress: webviewprogress, updateprogress progress: float) { <#code#> } i have found solution this. class browserviewcontroller: uiviewcontroller, uitextfielddelegate, uiwebviewdelegate, actionviewcontrollerdelegate, webviewprogressdelegate { func webviewprogress(_ webviewprogress: webviewprogress, updateprogress progress: float) { progressview.setprogress(progress, animated: true) }

cuda - lattency of GMEM for write -

streight doubt: so, if kernel not read gmem (only reads @ begin), , uses gmem storage storage only, writing gmem stall warp reading gmem do? background: the kernel sweep across set of partiotioning patterns can predicted , managed. single pattern may use lot of sem , registers calculated , advanced. if statistical value of specific parttern higher previous highest value among processed values in warp, highest value replaced , pattern has saved. kernel carries on evaluationg alternative patterns until end. number of alternative patterns high , necessary recover alternative pattern of highest statistical value @ kernel end , every warp should elect 1 winning pattern (every warp can have own space in gmem) , can keep highest value in register. using more sem store best pattern reduces pattern lenght or number of threads in block, may work to... indeed initial problem little computing in warp call each pattern (poor performance)... thanks in advance

php - why fetch_assoc work on while? -

#1 code $row = $result->fetch_assoc()); while ($row) { // code here } #2 code while ($row = $result->fetch_assoc());) { // code here } why #1 code , #2 code give different result? because in #1 execute fetch_assoc() once, while in #2 execute on every loop iteration. in other words, in #2 fetch_assoc() keep on returning rows long there rows available in result set. #1 enter infinite loop if there @ least 1 row available.

angular material how to show spinner during an synchronous intensive task -

i want show spinner during execution of synchronous task. set showspinner = true before task starts , showspinner=false after finishes. however, spinner doesn't show. think because expensive task block dom update *nfif="showspinner shows spinner. how fix this? thinking of using lifecycle hooks not sure how to. updateimagedata() { if (this.cropsizechanged) { this.showspinner = true; var imgdata = this.cropper.getcroppedcanvas().todataurl(); //**expensive** this.editedimage = imgdata; this.cropsizechanged = false; this.showspinner = false; } console.log("updated imagedata"); if(this.istaggableimage) { settimeout(() => {this.croppedimageboundingrect = this.croppedimageref.nativeelement.getboundingclientrect();}, 100); } } the reason why spinner not showing setting false straight away after making expensive call. can try 2 following things if expensive call returns callback or pr

Android error : java.lang.NullPointerException: Attempt to invoke virtual method -

this question has answer here: nullpointerexception on button.findviewbyid() 1 answer what nullpointerexception, , how fix it? 12 answers trying go next activity on button click.also data passed intent.i have error in android : 08-18 07:03:52.979 10587-10587/? e/androidruntime: fatal exception: main process: com.example.anjana.crmapp, pid: 10587 java.lang.runtimeexception: unable start activity componentinfo{com.example.anjana.crmapp/com.example.anjana.crmapp.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'android.view.view android.widget.button.findviewbyid(int)' on null object reference

javascript - Datatables ajax auto reload when parse error -

i using datatables ajax load data server side, know how stop/disable reload when parse error happen. this sample code in laravel. $(function () { $('#users-table').datatable({ dom: 'lfrtip', processing: false, serverside: true, autowidth: false, ajax: { url: '{{ route("admin.access.user.get") }}', type: 'post', data: {status: 1, trashed: false}, error: function (xhr, err) { if (err === 'parsererror'){ console.log(1234) // location.reload(); } } }, columns: [ {data: 'last_name', name: '{{config('access.users_table')}}.last_name'}, {data: 'first_name', name: '{{config('access.u

rest - Why do API's have different URLs? -

why api's use different urls? there 2 different interfaces on web server? 1 processing api requests , other web http requests? example there might site called www.joecoffee.com use url www.api.joecoffe.com api requests. why different urls being used here? we separate ours couple of reasons, , won't apply. separation of concerns. we write api code in 1 project, , deploy in 1 unit. when work on api worry , don't worry page layout. when web work, that's separate different authentication mechanisms. the way tell user log in quite different how tell api client it's not authenticated. different scalability requirements it might api lot of complex operations, while web-server serves more or less static content. might want add hundreds of api servers around world, have 10 web servers. different clients you might have api web client , separate api mobile client. or perhaps public 1 , private / authenticated one. might not apply example

python - Is tf.gradients thread-safe? -

i have several calls tf.gradients each take time, concurrently call tf.gradients . however, receive 1 of several errors when try in graph. suspect not thread-safe, have not been able reproduce error mwe. tried using both pathos.pools.threadpool , pathos.pools.processpool in both mwe , real code - real code fails. here mwe tried: from pathos.pools import threadpool, processpool import tensorflow tf import numpy np xs = [tf.cast(np.random.random((10,10)), dtype=tf.float64) in range(3)] ys = [xs[0]*xs[1]*xs[2], xs[0]/xs[1]*xs[2], xs[0]/xs[1]/xs[2]] def compute_grad(yx): return tf.gradients(yx[0], yx[1]) tp = threadpool(3) res = tp.map(compute_grad, zip(ys, xs)) print(res) here's partial traceback encountered when trying real code. threadpool version. file "pathos/threading.py", line 134, in map return _pool.map(star(f), zip(*args)) # chunksize file "multiprocess/pool.py", line 260, in map return self._map_async(func, iterable, mapsta

javascript - Update a controller variable with ajax in rails? -

i trying update variable in view after clicking on table row. right have javascript function: $("#mytable tr").click(function(){ var rowdata = $(this).children("td").map(function() { return $(this).text(); }).get(); var id = $.trim(rowdata[0]); $.ajax({ ... }); }) i want pass variable "id" controller can update in view. don't know go inside ajax call. don't know go inside controller know need use respond_to not sure else. you have write code: $.ajax({ type: "post", url: <%= path_of_controller_action %>, data: { data want send }, beforesend: function() { $form.find(':input').prop('disabled', true); $form.find('.ajax-in-progress').removeclass('hidden'); return daisy.ajax_loader(true, 'waiting', 'small'); }, success: function(data) { return location.reload();

javascript - how to make a fast NOT anti-aliasing HTML5canvas basic drawing function? -

i trying anti-aliasing drawing function in canvas. super answers on site canvas , aliasing. here's demo: https://jsfiddle.net/garciavvv/eu34c8sy/12/ here's line js: function linexy(mousex, mousey, mousexx, mouseyy){ var x0= mousex; var y0= mousey; var x1= mousexx; var y1= mouseyy; var coordinatesarray = []; // translate coordinates // define differences , error check var dx = math.abs(x1 - x0); var dy = math.abs(y1 - y0); var sx = (x0 < x1) ? 1 : -1; var sy = (y0 < y1) ? 1 : -1; var err = dx - dy; // set first coordinates coordinatesarray.push([x0,y0]); // main loop while (!((x0 == x1) && (y0 == y1))) { var e2 = err << 1; if (e2 > -dy) { err -= dy; x0 += sx; } if (e2 < dx) { err += dx; y0 += sy; } // set coordinates coordinatesarray.push([x0,y0]); // return result } for(var i=0;i<coordinatesarray.length;i++) { aliasedcircle(ctx, coordinatesarray[i][0], coordinatesarray[i][1], 100); } } what m

node.js - How to change environment variable such as 'process.env.NODE_ENV' in client side using webpack? -

i have javascript client side built webpack. using stats.js monitor frame rate. don't want show stats window in production mode. have tried of following: use defineplugin of webpack: new webpack.defineplugin({ 'process.env.node_env': json.stringify(process.env.node_env || 'development') }), in javascript file, use variable detect if in development mode or production mode. const isdevelopment = process.env.node_env !== 'production'; then if isdevelopment true, use stats dom. if (isdevelopment) { const stats = require('stats.js'); stats = new stats(); document.body.appendchild(stats.dom); } pack client side in production mode: webpack -p --progress run app in production mode (this server side): node_env=production port=8899 node server.js but these settings, supposedly run app in production mode, not stop client side displaying stats window on browser. clue wrong? never mind. fixed putting node_env

javascript - Why is my fixed navbar becomes transparent on scroll down? -

i have header, navbar , cover photo. whenever user scrolls down, header becomes hidden , navbar stays @ top, way wanted be. however, when navbar passes cover photo navbar becomes disappears appears when passes content. have set script make navbar fixed on top if user scrolls down. working fine if remove cover photo html code. wrong it? below code: <!--header --> <div class="header-page"> <a class="navbar-header" href="#"> <img src="images/logo/logo.png" width="300px" height="150px" /> </a> <a href="" class="navbar-header-text">login</a> | <a href="" class="navbar-header-text">create account</a> </div> <!--navbar --> <div class="menu"> <nav class="navbar navbar-default"> <div class=&q

Excel sumifs with part of criteria field -

i wondering there way sum on part of criteria field. i.e. beginning in a1 have as 100 dc 200 ax 300 ak 130 how sum if cells in column start "a"? tried these formulas, not complain syntax, none of them return desired result. need sumifs in real life have multiple criteria. =sumifs(b1:b4,a1:a4,left(a1:a4,1) & "=a") =sumifs(b1:b4,a1:a4,"=" & left(a1:a4,1)="a") thanks tips. the excel sumif function supports wildcards text fields, can use "=a*" condition.

sql - How to write a query against one table which gives unique value from "pm_process_guid" -

i write query against 1 table gives unique value "pm_process_guid" 1 ticket, along associated values in assigned group, assigned user , time on column wise. how can write query in order output below? pm_process_guid assign serial number assigned group assigned user time 2e2a9a43-9607-4fcb-b3a7-550440823b20 1 apac ram 3/23/2016 15:06 2e2a9a43-9607-4fcb-b3a7-550440823b20 2 raj 3/23/2016 15:06 2e2a9a43-9607-4fcb-b3a7-550440823b20 3 apac sree 3/23/2016 15:06 i‌ need output below, --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pm_process_guid totalassign count 1st group 1st user time 2nd group 2nd user time 3rd group 3rd user time 2e2a9a43-9607-4fcb-b3a7-550440823b20 3

javascript - how to group objects in an array -

i have array of objects , want group objects on basis of 2 keys var arr = [ {"name": "apple", "id": "apple_0","c":'20'}, {"name": "dog", "id": "dog_1","c":'10'}, {"name": "apple", "id": "apple_0","c":'30'}, {"name": "dog", "id": "dog_1","c":'10'}, ]; and expecting result as var final = [ {"name": "apple", "id": "apple_0","c":'50'}, {"name": "dog", "id": "dog_1","c":'20'} ]; the scenario - want group object on basis of name , id . if name , id found in final array make sum of c . i tried this: var final = []; for(var = 0; i<arr.length; i++){ var obj = {}; obj = arr[i]; for(var j = 0; j<

cocoa touch - iOS, how to localize an app into Chinese, with numbering? -

Image
my app shows numbers of buttons, number symbols. can ios produce localization of number symbols based on language selection, if how? i'm outputting string, guess need kind of regional formatting functionality? first , make project support chinese: second , add localizable.strings file translated text like: third , make file localized chinese: finally , able use translation like: self.hellolabel.text = nslocalizedstring(@"hello!", @"a text saying hello label"); the "你好!" displayed if iphone's language chinese. for number converting: nsstring *localizedstring = [nsnumberformatter localizedstringfromnumber: @(1314) numberstyle: nsnumberformatterspelloutstyle]; nslog(@"formatted string:%@",localizedstring); //formatted string:一千三百一十四 (if system region china) if want directly convert number symbols: - (nsstring *)getnumbersymbols:(nsinteger)number { nsarray *symbols = @[@"零",@&

chat - Quickblox frequent crash in Android -

i have been working quickblox sdk past few weeks , have developed applications features of one-to-one, group chat webrtc too. using 3.0 version of sdk due of requirements , not able change it. there 1 crash facing in app in no specific screen. have reported quickblox did not much. the crash log below : java.lang.nullpointerexception: @ com.quickblox.chat.model.qbchatdialog.initchat (unknown source) @ com.quickblox.chat.model.qbchatdialog.initchatfromrest (unknown source) @ com.quickblox.chat.model.qbdialogdeserializer.deserialize (unknown source) @ com.quickblox.chat.model.qbdialogdeserializer.deserialize (unknown source) @ com.google.a.v.b (unknown source) @ com.google.a.b.a.l.b (unknown source) @ com.google.a.b.a.b$a.a (unknown source) @ com.google.a.b.a.b$a.b (unknown source) @ com.google.a.b.a.i$1.a (unknown source) @ com.google.a.b.a.i$a.b (unknown source) @ com.google.a.f.a (unknown source) @ com.google.a.f.a (unknown source) @ com.google.a.f.a (unknown source) @ com

Use API and get access of client's Google account -

i want make google drive application linux desktop. application access of client's google account , able manage user's google drive files. searched on https://developers.google.com/api-client-library/php/auth/service-accounts couldn't understand it. so want know how can use google drive api , access users google account?

javascript - How to mark attendance timeout on browser close? -

i new in development , developing attendance system in core php.... want know how store attendance timeout in database @ time when closes browser should logout well. you can using window.onbeforeunload event. also, suggested in comments, sendbeacon experimental function used.

java - best approach to use in multimodule maven project -

i have sevral modules a b c and each module has core module 1 of dependency a+core b+core c+core and i'm supposed package a,b,c in d managed exclude core modules b , c , kept core module in a d |+ a-core |+ b-removed core |+ c-removed core what best thing in situation, bad practise ? you may have more 1 dependency pulls core dependency in d pom.xml so, exclusion not required. important thing here a , b , c depends on same version of core dependency otherwise d packaging include version of core rather one. may compile without error, generate exceptions @ runtime if use of these 2 versions not compatible between them. so focus on using unique version of core in a , b , c . using parent pom or creating dependency aggregating common dependencies tools ease that.

file uploader plugin using pure JavaScript without 3rd party libraries -

i want build simple file uploader can used other applications plugin or module. uploader should have following features: configurable upload url , param name. show live preview on browser if file image. customize file extensions allowed. example: [‘image/png’, ‘image/jpg’] ability send data when uploading file. example sending user_id each file. please note: make sure code written using pure javascript , not make use of 3rd party libraries.

javascript - BrightCove with DTM in Dynamic Tag Management -

Image
i facing issue bright cove video events. bright cove video events – able log video events in console unable map adobe analytics. please see screenshot below shows events logged console when action has been taken user on video highlighted in yellow: also, in dtm have created tag same under page load -trigger rule- onload - open editor below mention code have shared. try{ if(videojs('te-brightcove-trigger-video_html5_api')){ videojs('te-brightcove-trigger-video_html5_api').on('play',function(){ var myplayer = this; console.log('play'); var whereyouat = myplayer.currenttime(); var vidduration = myplayer.mediainfo.duration; console.log('log'+ whereyouat); console.log('log11'+ vidduration); if(whereyouat==(vidduration/4)){ } _satellite.notify("video - play - "+myplayer.mediainfo.name + ", "+whereyouat, 3); var c = s_gi(_satellite.getvar("settings_aa_reportsuite")).media; })

javascript - app script for locking cell after data was inputted -

i making reservation calendar , want locked cell after inputted information on specific columns. more or less 10 columns have function. need help. thanks. this right out of documentation here . var ss = spreadsheetapp.getactive(); var range = ss.getrange('a1:b10'); var protection = range.protect().setdescription('sample protected range');

android - moving from other activity to navigation activity -

i want go navigation activity other activity when click on textview , application crashed down, dont know whats problem it, have ? here manifest file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" package="com.example.nabeel.ask"> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.read_external_storage" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundicon="@mipmap/ic_launcher_round" android:supportsrtl="true" android:theme="@style/apptheme"> <meta-data android:name="com.facebook.sdk.applicationid" android:value=&quo

css - How to center a layout with a fixed sidebar? -

i need centered layout vertical fixed menu on left side of container, using bootstrap 3. on small screens menu inserted left side. have solution sidebar, snippet somewhere. works fine layout not centered (menu , content should centered in typically bootstrap container). if use container div wrapper whole thing, menu no longer fixed. html: <div class="navbar navbar-fixed-top visible-xs"> <div class="navbar-header"> <button type="button" class="navbar-toggle"></button> </div> </div> <div class="row-offcanvas row-offcanvas-left"> <div id="sidebar" class="sidebar-offcanvas col-sm-4"> <div class="col-md-12"> <ul class="nav"> <li><a href="#">link</a></li> </ul> </div> </div> <main class="col-sm

MySQL/PHP merge rows by row values -

i need little mysql select in sql or php. situation: have sql table this id | organization_id | investment | investment_curr | paid | paid_curr | effective_from | effective_to 1 | 195001 | 5000 | eur | null | eur | 2010-06-23 | null 2 | 195001 | null | eur | 5000 | eur | 2010-06-23 | null 3 | 195001 | 2000 | skk | null | skk | 2007-08-01 | 2010-06-22 4 | 195001 | null | skk | 2000 | skk | 2007-08-01 | 2010-06-22 now have php select (joomla), when select values organization_id $query_rpo_organization_equity_entries = $db->getquery(true); $query_rpo_organization_equity_entries ->select(array('organization_id', 'investment_amount', 'investment_currency', 'paid_amount', 'paid_currency', 'effective_from', 'e

"python setup.py egg_info" failed with error code 1 for packages like sys, os, urllib -

i new python , i'm trying install few additional packages pip install webbrowser pip install re pip install collections but getting error like: "no matching distribution found xx" also other challenge faced is: pip install sys pip install os pip install urllib getting error: "python setup.py egg_info" failed error code 1 in c:\users\rishabh

android - How to resume an application from another application? -

actually, know how launch application application. the problem application restarts instead of resuming when launch application after launching home screen. (i mean application running first pressing shortcut home screen) for example, there 2 applications : a, b launch 2 applications home screen first. launch application again b application. a application restarts instead of resuming. how resume it? doing below. intent intent = getpackagemanager().getlaunchintentforpackage(package); intent.setaction(action); intent.setflags(intent.flag_activity_new_task|intent.flag_activity_single_top); startactivity(intent); action custom action. please help. you can check intent.category_launcher category , intent.action_main action in intent starts initial activity. if 2 flags present , activity not @ root of task (ie.. app running), call finish() on initial activity. exact solution may not work you, similar should. here in oncreate() of initial/launch activity: i

html - Is it possible to config up and down buttons for input[type="number"] have different step than input validation? -

i want number input which: accept integer values in range [0, 1000], (e.g. 42 valid value) reject non-integer values, (e.g. 3.14 invalid value) when / down button pressed, value increase / decrease 10 (or increase nearest n * 10) it seems step attribute config both input form validation , behavior of / down button. possible me make input have described behavior? here go, working example: <input type="number" name="quantity" min="0" max="1000" step="10"> you can specify range using min , max attributes, , specifying how add or decrease on arrow click, can set step attribute.

android - mipmap and drawable folders -

i new. have 2 questions: if put image in drawable assumed in mdpi if app runs in xxhdpi device app stop happend? to solve 1. put image in mipmap/xxhdpi (only in xxhdpi folder) , not problem xxhdpi device in hdpi tablet (too big) image looks wrong (ugly) can solve problem? this how looks in tablet enter image description here add .png images 1. drawable-hdpi 2. drawable-mdpi 3. drawable-xhdpi 4. drawable-xxhdpi it automatically suits devices run!

javascript - Angular 2: bootstrap-sweetalert not showing popup for success -

Image
im using npm bootstrap-sweetalert library displaying popup success. https://github.com/adeptoas/sweet-modal admin\src\index.html <!doctype html> <html> <head> <!--importing library here!!--> <link rel="stylesheet" href="../node_modules/sweet-modal/dist/min/jquery.sweet-modal.min.css" /> <script src="../node_modules/sweet-modal/dist/min/jquery.sweet-modal.min.js"></script> </head> in .ts file: swal("good job!", "you clicked button!", "success") my folder str : project/admin/node_modules/sweet-modal/dist/the js , css files but there no popup , tick animation shown in library : you mixing jquery , angular. should really alternative, angular friendly. see https://ng-bootstrap.github.io/#/components/modal/api

android - FusedLocationProviderClient getLocationAvailability needs a delay to give a correct result -

i'm trying last location checking first if gps enabled, ask user go settings enable if it's not, , when go settings app, after enabling gps location, , check if gps available, it's not enabled, after delay (1-2 seconds) is. why there delay in fusedlocationproviderclient.getlocationavailability() method? how can solve it? here's code: @inject fusedlocationproviderclient fusedlocationproviderclient; @override public void onviewcreated(view view, @nullable bundle savedinstancestate) { super.onviewcreated(view, savedinstancestate); checkandgetlastlocation(); } @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == gps_enable_request) { checkandgetlastlocation(); } else { super.onactivityresult(requestcode, resultcode, data); } } @suppresswarnings("missingpermission") private void checkandgetlastlocation() {

pointers - Why is http.Client{} prefixed with &? -

i learning go , reading go's official documentation net/http , , write following code doc test: package main import ( "net/http" "fmt" ) func main() { client := &http.client{} resp, _ := client.get("http://example.com") fmt.println(resp) } http.client strut, not know why there & pointer prefixed, think create http.client reference not necessary, , why client variable have get method? reading source code of "net/http", defined client struct below: type client struct { transport roundtripper checkredirect func(req *request, via []*request) error jar cookiejar timeout time.duration } the client struct did not have get method defined, why client variable have get method? i take go tour feeling of language , basic syntax first. the type declaration quoted contains fields of struct, not methods . methods defined elsewhere, functions receiver added designates type bel

couchdb - Why are there two ways to update documents? -

as couchdb beginner i'm having hard time understanding how update documents. when read docs find quite confusing me: 1) updating existing document to update existing document must specify current revision number within _rev parameter. source: chapter 10.4.1 /db/doc 2) update functions update handlers functions clients can request invoke server-side logic create or update document. source: chapter 6.1.4 design documents could please tell me way prefer update documents? edit 1: let's data structure simple car document basic fields. { "_id": "123", "name": "911", "brand": "porsche", "maxhp": "100", "owner": "lorna" } now owner changes, still use option 1? option 1 has quite downside, because can't edit 1 field. need retrieve every fields first, edit owner field , send whole document. tried , find quite long-winded. hmm

c# - Proper way of injecting different set of componenets based on some flag in Windsor -

i working legacy application. in spear time, want make clean components initialization , move of them windsor (which our company di framework of choice). unfortunately, in old days, 1 decided use windsor via xml configuration files, complicating things... ok, straight problem. want inject different set of implementation depending on flag or root component implementation, example, let's have flowa , flowb , want have hierarchy injected: flowa: somefactorya : ifactorycomponenet someservice1a : iservice1 someservice2 : iservice2 someservice3 : iservice3 flowb: somefactoryb : ifactorycomponenet someservice1b : iservice1 someservice2 : iservice2 someservice3 : iservice3 basically, of components have single implementation, have different. have few implementations of services, legacy mode, new flow, other special variants of flow. the thing came mind wrap staff in factory, have feeling removing di framework in way , loosing flexibility of individual component

lambda - Zappa Deployment error for django application -

i have application using django, django-rest framework running perfect local machine. facing below error while deploying same using zappa in both below ways. (drf-angular) e:\projects_edrive\aws\serverless\zappa\drf_sample\server>zappa deploy dev packaging project zip... [error 3] system cannot find path specified: 'e:\\projects_edrive\\aws\\serverless\\zappa\\drf-angular\\lib\\python2.7\\site-packages/*.*' =========================================================================== (drf-angular) e:\projects_edrive\aws\serverless\zappa\drf_sample\server>python manage.py deploy dev packaging project zip... traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "e:\projects_edrive\aws\serverless\zappa\drf-angular\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line utility.execute() file "e:\projects_edrive\aws\serverles