Posts

Showing posts from June, 2013

linux - When does a variable add $ in bash -

i'm learning bash , confused when variable add $ . find code like: i=1 while [ $i -le 10 ] echo "$n * $i = `expr $i \* $n`" i=`expr $i + 1` done the $ substitutes variable. writing $i insert value of i , no matter write it. if want assign variable, makes no sense.

netsuite - How to get Vendor object with Suitetalk Java API -

how vendor list objects using suitetalk java api. tried 1 vendor object string internalid = _console.readln(); // invoke get() operation retrieve record recordref recordref = new recordref(); recordref.setinternalid(internalid); recordref.settype(recordtype.vendor); readresponse response = _port.get(recordref); vendor vendor = (vendor) response.getrecord(); but if don't know internalids, there way vendors i don't know java api well, think you'll need create search returns vendors. you'll have list can process , extract internal ids from.

Auto-provision new hosts with docker swarm -

how can automatically provision new machines when docker swarm detects there not enough resources schedule services? i use setup rancher , docker swarm scheduler, , if there not enough resources, service creation fails: exit status 1: creating stresstest2_workerb1_1 creating stresstest2_workerb2_1 no resources available schedule container i can poll status , call docker machine when needed, rancher not attempt re-schedule missing services. wonder if there more integrated solution, maybe hook within docker swarm can used dynamically call docker-machine create or remove machines. i'm deciding between rancher docker 1.11 + docker swarm or docker 1.12 in swarm mode, solution fine. are using new docker swarm mode came in 1.12? there isn't hook in docker swarm this. swarm mode, use docker remote api collect events trigger instead of polling.

javascript - JS jQuery each loop filter append list -

i making ajax call grabs data looks this: { "cars":[{ "id":"654", "type": "ford", "active": "1" },{ "id":"650", "type": "fiat", "active": "0" }] } i use data populate selectbox code: $.ajax({ url: 'myurlhere', method: 'get', async: false, success: function(result) { $.each(result, function(result, value) { $('#myselect').append($('<option>').text(value.id).attr('value', value.id)); }); } }); my problem want populate select data have active = "1" (for data) so i've done this: $.ajax({ url: 'myurlhere', method: 'get', async: false, success: function(result) { if (value.active = 1) { $.each(result, function(result, value) { ...

java - Unable to change text of TextView inside of a Fragment from same activity -

i trying change textview give status of bluetooth connection within fragment, nothing seems happen when msgreceived.settext(string) called. how go doing this? here java file fragment: package dleedesign.dubcommunicationstestapp; import android.app.fragment; import android.bluetooth.bluetoothadapter; import android.os.bundle; import android.os.handler; import android.os.message; import android.support.annotation.nullable; import android.view.layoutinflater; import android.util.log; import android.view.view; import android.view.viewgroup; import android.widget.button; import android.widget.textview; public class secondfragment extends fragment implements view.onclicklistener { view myview; public final string tag = "main"; private bluetooth bt; public button sendcommand; public textview msgreceived; @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { myview = inflater.inflate(r.layout.second_lay...

linux - Can I intercept network packets with a raw socket (not only sniff)? -

this first time using raw sockets (yes, need use them must modify field inside network header) , documentation or tutorials read describe solution sniff packets not need. need create script intercepts packet, process , sends further destination, i.e. packets should not reach destination unless script decides to. in order learn, created small prototype detects pings , prints "ping". expect ping not work intercept packets , don't include logic send them destination. ping working (again, seems sniffing/mirroring packets). goal ping packets "trapped" in script , don't know how that. in current python script (i avoid writing how decode simplicity) sock = socket.socket(socket.af_packet, socket.sock_raw, socket.ntohs(0x0003)) sock.bind((eth0, 0)) packet = sock.recvfrom(65565) decode_eth(packet) decode_ip(packet) if (ipheader.ip_proto == 1): print("\nping") can explain how can achieve goal or point me right documentation? yo...

call multiple powershell scripts from a single powershell script -

how call multiple powershell scripts single powershell script? i have web search - file "folderwatchermain.ps1" contains code: $externalmethod = "d:\a\folderwatcher1.ps1" .$externalmethod $externalmethod = "d:\a\folderwatcher2.ps1" .$externalmethod this isn't working. suggestions dear members. thank you. it this $psscriptroot="d:\a" $externalmethod = $psscriptroot + ".\folderwatcher1.ps1" .$externalmethod $externalmethod = $psscriptroot + ".\folderwatcher2.ps1" .$externalmethod

javascript - How to save several data sets into array? -

i try write plugin krpano in javascript. the actual problem have store several datasets right way can accessed later on. i have number of rendered panoramic images (changes project project, 1-10max) can have variations of it. there can variations other flooring, other colours of kitchen, @ daytime , on. don't know in beforehand how many panoramic images there , how many variations have. my thought use prompt(); information needed user , go loop create needed variables. var panocount = prompt("how many panos have?"); (var = 0; < panocount; i++) { panooptions[i+1] = prompt("how many options have " + (i+1) + ". pano?"); } let's have 1 panoramic image 2 different floors, 2 different types of furniture , 2 different daytimes. total amount of 8 pictures (2*2*2). in case, get: how many panos have? -> 1 (store panocount) how many options have 1. pano? -> 3 (floors, furniture, daytime) now want prompt();...

sql - How to get an errored message in Talend in order to send it by email? -

Image
does possible know how errored message in talend? i have tmssqlinput ==> tmssqloutput . (see schema below). if error thrown, i'd in mail body, , send it, instead of sendind message default. i found : globalmap.put("errorcode", input_row.message); "the message is: "+(string)globalmap.get("errorcode") but dont know, place first line. somewhere inside tmssqloutput . where? thank y'all in advance. most talend components including tmysqloutput has error messages (after) available once component has failed or succeeded. can access value in these variables post component in next component tmysqloutput --->(oncomponentok)---->tjava ...in tjava can see there in tmysqloutput component using below expression - system.out.println((string)globalmap.get("tmysqloutput_1_error_message")); you can store error message in global variable , use global variable in tsendemail component. assign value global variable use...

mongodb - Compare consistency models used in mgo -

mongodb servers queried multiple consistency rules. in mgo , setmode of session object changes consistency mode session. 3 types of consistency modes available: eventual, monotonic, , strong. e.g. session, err := mgo.dial("localhost") if err != nil { panic(err) } defer session.close() //switch session monotonic behavior. session.setmode(mgo.monotonic, true) i reading different consistency models in https://en.wikipedia.org/wiki/consistency_model but relations between 3 models used in mgo ? is correct strong implies eventual , , eventual implies monotonic ? thanks. these 3 consistency models mongodb claims support: strong consistency: accesses seen parallel processes (or nodes, processors, etc.) in same order (sequentially). monotonic reads: if process reads value of data item x, successive read operation on x process return same value or more recent value. eventual consistency: if no new updates made given data item, accesses item r...

Deep copy a list in Python -

i have problem list copy: so after got e0 'get_edge' , make copy of e0 calling 'e0_copy = list(e0)' . here guess e0_copy deep copy of e0 , , pass e0_copy 'karger(e)' . in main function. why result of 'print e0[1:10]' before loop not same after loop? below code: def get_graph(): f=open('kargermincut.txt') g={} line in f: ints = [int(x) x in line.split()] g[ints[0]]=ints[1:len(ints)] return g def get_edge(g): e=[] in range(1,201): v in g[i]: if v>i: e.append([i,v]) print id(e) return e def karger(e): import random count=200 while 1: if count == 2: break edge = random.randint(0,len(e)-1) v0=e[edge][0] v1=e[edge][1] e.pop(edge) if v0 != v1: count -= 1 i=0 while 1: if == len(e): break ...

php - Language selection working locally but not on server -

Image
i'm building multilingual website starting 2 languages - portuguese , english - , works on local server not on actual server. on website have 2 buttons, 1 each language, this: the code buttons follows: <form action="{{ url::route('language-chooser') }}" method="post"> <input id="locale_pt" type="submit" name="locale" class="<?php echo lang::locale() == 'pt' ? 'active' : '' ?>" value="pt"/> <span>|</span> <input id="locale_en" type="submit" name="locale" class="<?php echo lang::locale() == 'en' ? 'active' : '' ?>" value="en"/> </form> then have controller looks this: class languagecontroller extends basecontroller { public function chooser() { session::set('locale', input::get('locale')); return r...

javascript - Ionic - navigator.geolocation returns empty error object -

i building small app relies on geolocation. use following code current location device: var options = { maximumage: 3000, timeout: 300000, enablehighaccuracy: true }; navigator.geolocation.watchposition(function(result) { console.info(result); }, function(error) { console.error(json.stringify(error)); }, options); however, always call error callback empty error object : 1 123317 error {} there no code nor message, empty object. interesting error callback called immediately , no matter set timeout. my androidmanifest.xml looks this: <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_location_extra_commands" /> the result same weather run in emulator or directly on phone. if has idea on how fix this, hints appreciated. use following code var o...

ruby on rails - What is the purpose of a `transient do` block in FactoryGirl factories? -

what purpose of transient do in factorygirl factories? i've seen lot of factories begin below. factory :car owner nil other_attribute nil end ... i've found information on blog: http://blog.thefrontiergroup.com.au/2014/12/using-factorygirl-easily-create-complex-data-sets-rails/ but still don't understand how , why this. experience factorygirl minimal. could experience using factorygirl share insight? transient attributes allow pass in data isn’t attribute on model. say have model called car following attributes: name purchase_price model you want capitalize name of car when create car model in factory. can is: factory :car transient # capitalize not attribute of car capitalize false end name { "jacky" } purchase_price { 1000 } model { "honda" } after(:create) |car, evaluator| car.name.upcase! if evaluator.capitalize end end hence, whenever create car factory , wa...

Selenium Google Places Autocomplete Java -

i trying automate google auto suggestion , selecting random suggestion using selenium. webelement element = driver.findelement(by.xpath("//input[@id='id_address']")); element.sendkeys(“whi”); how select random suggestion list of google suggestions ? first need find matching elements represent auto-complete suggestion options. since appearance of auto complete suggestions asynchronous, need wait them appear using loop or webdriverwait . line gets list<webelement> list keep trying find elements match given selector , return when list (from driver.findelements call wraps) not empty. if doesn't find non-empty list in given timeout ( 10 seconds in case webdriverwait constructor) throw timeoutexception . then, once have list of suggestions, it's simple matter of selecting random 1 list , clicking on it. driver.get("https://www.google.com"); driver.findelement(by.name("q")) .sendkeys("whi"); list<web...

javascript - Cordova Capture Image in Background Base64 -

how capture image in background continuously cordova , getting result base64? i want capture image continuosly without opening default camera apps or other camera apps, it's i'm making custom camera apps itself. i need able output base64 , clean memory of previous output prevent memory overflow. i need make custom camera capture. thank you

javascript - Multiple google analytics to track AJAX request -

i updating page on website using ajax reason google analytics not registering page visit. need google analytics update same? i have checked in stackoverflow same of them using single tracking ids. not getting how can use multiple tracking? i have 7 tracking ids: ua-xxxxxxxx-(1-7) need update depending on value returned ajax query. i using latest ga code: <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-xxxxxxxx-x', 'auto'); ga('send', 'pageview'); </script> what need track properly? if implementing multiple trackers on same site, on same pages, need make sure distinguish each tracker...

swift - Access <li> elements inside HTML -

i trying parse html in swift project stuck. i trying access info inside of <li> , example: li source="page/external" size="3.244 mb" rate="128 kb/s" link="13770751aje0" song="on run (mount remix)" singer="kytes" file_id="3ddqom328a" duration="212" how access info size in swift? i using kanna. xpath is: "/html/body/div[2]/div[3]/div[2]/div/div[3]/div[1]/div/div[2]/ol/li" use attribute axis, like: /html/body/div[2]/div[3]/div[2]/div/div[3]/div[1]/div/div[2]/ol/li/@size

php - Object of class ORM could not be converted to string <img src -

so i'm new lot of this. php , idorm. searched far , wide i'm not seeing answer specific problem. object of class orm not converted string. the slim error pops @ php code $picture. this in html view <div class="profile-left"> <div class="profile-image"> <img src="<?= empty($picture) ? '/static/images/profile-default.png' : $picture ?>"/> <i class="fa fa-user hide"></i> </div> <div class="m-b-10"> <button class="btn btn-warning btn-block btn-sm" type="button" id="change_picture" data-toggle="modal" href="#change-picture-modal">change picture</button> </div> </div> this route $picture in file $picture = orm::for_table('picture') ->where('picture_gallery_id', $user->account_id) ->where('name', $user->account_id . ':prof...

linux - Debian installation from USB stick -

Image
i have copied debian iso usb stick , tried boot system system starts grub screen image : but when use virtual box shows me menu select install , graphical install etc. should now, new linux. system intel "i7" windows 10 on it. to install debian (and others linux distributions ) it's recommended use win32diskimager described here : the win32diskimager utility can used under other operating systems copy image. important image must written whole-disk device , not partition, e.g. /dev/sdb , not /dev/sdb1. not use tools unetbootin alter image. you can visit official website of ubuntu more informations , because grub-rescue appear after failed installation of ubuntu os.

c# - Getting a negative number from DateTime.Subtract -

this question has answer here: calculate difference between 2 dates (number of days)? 15 answers my sysadmin has failed expire passwords in ad , password expiry warning system starting count instead of showing negative days. i'm expecting remainingdays negative number test account ( 5 days pseudo-expired) following code, hoping can show me why i'm losing negative. i've read on msdn, datetime.subtract can return negative values. datetime today = datetime.now; foreach (user user in users) { datetime expirydate = user.pwdlastreset.adddays(180); //pwd expires every 180 days int remainingdays = int32.parse(expirydate.subtract(today).tostring("%d")); //snipped code send warnings @ different days remaining. } datetime.tostring("%d") return day of month represented. example, following code: datetime prev = datetime.now.su...

Excel 2003, intermitent VBA error -

i have script inserts vba controls sheet, script started clicking on button. script runs without error , runs 100% correctly. sometimes script stops before completion , "microsoft visual basic" error displayed: run-time error '-2147319764 (8002802c)': method 'name' of object 'imdccheckbox' failed all buttons excel 'end' , disabled. i have no idea why erroring , runs ok. the script looking through 43 rows inserting on each row 2 checkboxes, 1 label , combo box, controls named according type index appended name starting @ 1 , running 43. here routine, sorry bit large: public sub btngetinfo_click() if false errhandler: resume next end if dim objcolumns collection dim objtables collection dim objrs adodb.recordset set objcolumns = new collection set objtables = new collection set objrs = objexecutesql() 'removed checkboxes , labels...

node.js - Node function works but is undefined when run via Mocha -

i've set working function using twilio's api. function works when enter parameters through ui, when run test in mocha fails stating function undefined. have 1 other test in mocha runs before test , first test passes. twilioclient.js: var config = require('./config'); var client = require('twilio')(config.accountsid, config.authtoken); sendsms = function(to, message) { client.messages.create({ body: message, to: to, from: config.sendingnumber // mediaurl: 'http://www.yourserver.com/someimage.png' }, function(err, data) { if (err) { console.error('could not notify administrator'); console.error(err); return 'could not notify administrator'; } else { console.log('administrator notified'); return 'administrator notified'; } }); }; module.exports.sendsms = sendsms; my indexspec.js file: var chai= require('chai'); var expect = require('chai...

javascript - options for displaying notifications in the browser header? -

i need modern option displaying notification header user. implementation needs cross-browser compatible , lightweight possible. manager recommended use of vanillajs vanillajs plugin ideal if can make case better different solution can pass along manager. also, intent of solution display notification in wide variety of websites across enterprise. ux perspective think design may better implemented popup? i'm wondering if may appear less shoehorned displaying modern notification header in app older ui design. you can use screamer.js, written in vanillajs https://github.com/willianjusten/screamer-js

java - Spring Boot Project cannot run by IntelliJ IDE -

this question has answer here: run spring-boot's main using ide 7 answers edit: here's webapplication file: @springbootapplication @enableasync @enableautoconfiguration public class webapplication extends springbootservletinitializer { public static void main(string[] args) { springapplication.run(webapplication.class, args); } @override protected springapplicationbuilder configure(springapplicationbuilder application) { return application.sources(webapplication.class); } } i using intellij(15.0.2) run spring boot project, it working when execute java -jar spring-boot-sample.war unfortunately failed run ide , complained unable start embeddedwebapplicationcontext due missing embeddedservletcontainerfactory bean the error details follows: [2016-07-25 12:32:46.979] boot - 5719 error [restartedmain] --- springappli...

Setting up loop in Excel VBA to repeatedly sum up specific range -

i have spreadsheet i'm trying repeatedly populate column k specific data various similar points (80 cells down each iteration) in column e. so k2 should example display total of e25 + e35 + e42 + e56 + e63. then k3 should display total of e105 + e185 + e122 + e136 + e143. i have written macro first step (and works), follows: sub disctoptest() dim source range dim destination range dim total long set destination = range("k2") set source = range("e25") total = worksheetfunction.sum( _ source.value + _ source.offset(10, 0).value + _ source.offset(17, 0).value + _ source.offset(31, 0).value + _ source.offset(38, 0).value) destination.select destination.value = total set source = nothing set destination = nothing end sub then inserted loop repeat operation entirety of database, whenever run added macro excel either freezes or refuses work. code i'm using loop: sub disctop() dim source range dim destination range dim total long set destina...

javascript - How to get HTML code compatibility for old / modern browsers -

i using material icons font, angularjs, cordova android/ios app. problem is, android 4.x versions, have use "old" way display icon, (code documentation) : <!-- modern browsers. --> <i class="material-icons">arrow_back</i> <!-- ie9 or below. --> <i class="material-icons">&#xe5c4;</i> so now, think have find every icons in project, , update icon text hexa one, before have questions : questions : is safe (or bad practice) only use old way ( &#xe5c4; ) display icons, modern browsers ? compatibility dropped in few years modern browsers ? is there way (in angularjs, pure js or html, if possible) detect if browser dosen't support modern way, , then, replace icon text hexa ( arrow_back -> &#xe5c4; ) when use hexadecimal solution, works, pain when read html, have found other solution : generate icons via classname. it works great, created repository if had same problem : material...

python - Theano is claiming computation graph does not need the most important variable -

prediction = t.argmax(t.nnet.softmax(w2.dot(t.tanh(w1.dot(x))))); cost = ((prediction - y)**2).sum(); dw1 = t.grad(cost, w1); dw1 = dw1.eval({ w1 : w1, x: data, y : labels }); i error: unusedinputerror: theano.function asked create function computing outputs given inputs, provided input variable @ index 1 not part of computational graph needed compute outputs: y. this ridiculous. y part of computation graph. why theano doing this?

regex - Comparing two version of the same string -

i write function compare 2 string in r. more precisely, if have data : data <- list( "first sentence.", "very first sentence.", "very first , 1 sentences." ) i output : [1] "very" " , 1 sentences" my output built substring not included in previous one. example: 2nd vs 1st, remove matching string - "first sentence." - 2nd, result "very". # "first sentence." # "very first sentence." # match: ^^^^^^^^^^^^^^^ now compare 3rd vs 2nd, remove matching string - "very first" - 3rd , result " , 1 sentences". # "very first sentence." # "very first , 1 sentences." # match: ^^^^^^^^^^ then compare 4th vs 3rd, etc... so based on example output should be: c("very", " , 1 sentences") # [1] "very" " , 1 sentences" here's tidyverse a...

android - How to make language preference be applied immediately? -

i've managed create switch preference allowing me enable , disable language, cannot apply changes after option has been selected. <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android"> <preferencecategory android:title="language"> <switchpreference android:title="@string/setting_enable" android:key="checkbox_lang" android:summaryon="@string/settings_sum_en" android:summaryoff="@string/settings_sum_dis" android:defaultvalue="false"/> </preferencecategory> </preferencescreen> the code below used change language settings. private void loadpreferences(){ //allows preferances screen in application sharedpreferences sharedpreferences = preferencemanager.getdefaultsharedpreferences(this); boolean isengchecked = sharedpreferences.getboolean("checkbox_lang",false); if (...

angularjs - Best practice using angular architecture with components -

i'm trying wrap mind arround angular components, understand components better i'm developing simple todo crud using component architecture. the problem think makes sense put operations of crud in single controller respecting single responsibility principle @ same time practice (i think) split views (one list todos , delete create/update todos). i know multiple views single controller can achieved using 2 separate components registering same controller , ng/ui-route magic, using blows encapsulation proposal components try offer. so, has figured out solution problem? i think have consider modularity, can use create service handle crud , api operations , can reused other controllers , directives. here example of how did in our project. git repo of on of partners. https://github.com/leog/epsilon

validation - Validate and encode urls containing unicode characters in Java -

i working on application in need validate urls , check if started http ( if not, prepend 'http') , encode them. problem urls receive can contain types of things - invalid / valid not starting http / encoded / valid containing spaces or unicode characters. using urlvalidator class, not validate spaces or unicode chars. following code: if (url != null && !url.trim().isempty()) { url = urldecoder.decode(url, "utf-8"); if (!url.matches("^(https?)://.*$")) { url = "http" + url; } urlvalidator validator = new urlvalidator(); if (url.contains("(")) { if (validator.isvalid(url.substring(0, url.indexof("(")))) { return getencodedsiteurl(url); } return null; } if (validator.isvalid(url)) { return getencodedsiteurl(url); } } but code filters out valid urls contain space / unicode chars. don't think should use urlvalidator looking @ types of urls get. can please / guide me? thank you. ...

Neo4J node traversal cypher where clause for each node -

i've been playing neo4j geneology site , it's worked great! i've run snag finding starting node isn't easy. looking through docs , posts online haven't seen hints @ maybe isn't possible. what pass in list of genders , list follow specific path through nodes single node. in context of family: i want mother's father's mother's mother. have id start there , traverse 4 nodes mine. so pseudo query be select person (follow childof relationship) starting node me firstnode.gender == female , secondnode.gender == male , thirdnode.gender == female , fourthnode.gender == female focusing on general solution: match p = (me:person)-[:is_child_of*]->(ancestor:person) me.uuid = {uuid} , length(p) = size({genders}) , extract(x in tail(nodes(p)) | x.gender) = {genders} return ancestor here's how works: match starting node id match variable-length paths going ancestor constrain length of path (i.e. number of relations...

Calling methods in java and C# -

i have code: public class e{ int k; int m; int c; public method(int a,int b,int c){ k=a; m=b; c=c; } } can call method in java or c# without parameters separated commas: e object=new e(); object.method(,,); can call method in java or c# without parameters separated commas: no can't. according method's signature there expected 3 integer literals. being said, can't call way. regarding c#, define a , b , c optional int, below: public void method(int = 0, int b = 3, int c = 2) { // ... } and call method below: object.method() or as: object.method(1); etc. regarding feature, please have here .

generics - Abstracting Common Behavior with Traits in Scala -

i have trait following: trait mytrait[t] { def dosomething(elems: seq[t]) } i have factory create instances of implementations of trait: object mytrait { def apply(): mytrait = { new stringtrait() } } now concrete implementation looks this: class stringtrait extends mytrait[string] { def dosomething(elems: seq[string]) = { // generic logic here // specific logic here (this code bit depends on type of implementation) // generic logic here } } how make stringtrait such pass in specific behavior , having generic logic defined in abstract class? 1 way pass in behavior thunk, wold mean have modify dosomething(...) method take additional parameter prefer avoid. you have few options, sake of illustration i'll assume type specific behaviour seq[t] => t (i.e. take sequence of t , produce t result): inheritance based: trait mytrait[t] { def dotypespecificstuff(a: seq[t]): t def dosomething(elems: seq[t]): t = { // generic co...

javascript - Attempting to route a URL with a dot leads to 404 with webpack dev server -

i'm using webpack's dev server ease of local development. i'm working on single page app, i've enabled historyapifallback : common.devserver = { outputpath: path.join(__dirname, 'www', outdir), historyapifallback: true }; however, whenever try browse url contains period (such /ui/alerts/map.postplay ), get cannot /ui/alerts/map.postplay how can convince webpack-dev-server let me use these urls? update: can set historyapifallback to: historyapifallback: { disabledotrule: true } (thanks benr fixing this!) the trouble lies not in webpack-dev-server historyapifallback config (technically, webpack uses connect-history-api-fallback ). there's known bug relating urls periods. you can update config historyapifallback rewrite urls containing periods: historyapifallback: { rewrites: [ {from: /\./, to: '/'} ] } since operates on req.url , should fine if you're doing local dev on other localhost via...

asp.net mvc 5 - MVC POST requests losing Authorization header - how to use API Bearer Token once retrieved -

i have spent last week creating api existing mvc application, , attempting secure api along reworking mvc side security needed. currently, mvc application set use application cookie via owin/oauth/identity. have attempted incorporate bearer token web api set generate whenever making calls restricted api methods, have had little success far - requests work fine, post requests losing authorization header when received api. i have created sdk client being used mvc app make calls api, , have tried total of 3 methods of setting authorization header given call api, of seem work fine requests, fail post requests need make... i can set request header in mvc controller: httpcontext.request.headers.add("authorization", "bearer " + response.accesstoken); (where response.accesstoken token retrieved api) can set request header via extension method on sdk client: _apiclient.setbearerauthentication(token.accesstoken) or can set request header manually ...

javascript - getElementsByTagName does not seem to work -

Image
can please explain why code not working !! when element id works fine. same method getelementsbytagname() not. also if use queryselector(), works. if use queryselectorall() same error returns. test.html:15 uncaught typeerror: cannot set property 'color' of undefined here code: <doctype! html> <html> <head> </head> <body> <h1>hello world</h1> <p id="par">hello world</p> <script> var par = document.getelementbyid('par'); par.style.color = "red" var heading = document.getelementsbytagname("h1"); heading.style.color = "red" </script> </body> </html> as can see document,getelementsbytagname returns array of elements, not single element. so have follow proper indexing otherwise throw exception in case.

In JMeter, can you specify variables to fill in for an HTTP Request Default? -

Image
i'd able read value out of csv file, or more ideally .properties file jmeter, , use in multiple test plan s in http request defaults server name or ip , , port number / i wanted set way folder of different test plans can run, , there can single point of modification of tests can run. ${} variables don't seem populate in http request defaults . you can user-defined properties. values user-defined properties can controlled file. in following example, controlling environment script needs run against user defined property called env. and then, using in http request defaults. can property want to

Android spinning wheel (pizza) -

Image
i trying create circle wheel divided in fixed number of sections. each section should clickable. how approach this? should make image , set background or there way draw parts in java? shortly: create .png pizza. create new widget, extending view. override ondraw() , draw canvas rotation. optionally can draw lines java if it's margeritta not pepperoni. if necessary - change rotation call invalidate() redraw view add ontouch() listener, position ot tap, calculate sector touched.

c - Freed memory not causing page fault -

in experimenting reserving , committing virtual memory process, allocated 64k bytes of memory virtualalloc , memcpy 'd test string it, printf 'd string, freed memory virtualfree mem_release flag, , printf 'd again. reason, no page fault triggered. why this? #include <stdio.h> #include <windows.h> int main(dword argc, lpstr argv[]) { system_info info; dword dwpagesize; dword dwmemsize; lpvoid lpvmem; getsysteminfo(&info); dwpagesize = info.dwpagesize; dwmemsize = 16 * dwpagesize; lpvmem = virtualalloc((lpvoid) 0x00f00000, dwmemsize, mem_commit | mem_reserve, page_readwrite); if (!lpvmem) { printf("error allocating virtual memory\n"); return 1; } printf("lpvmem = 0x%08x\n", (uint32) (uint64) lpvmem); if (!memcpy(lpvmem, "i love foxes \\(^o^)/", 21)) { printf("error copying memory (error code 0x%08x)\n", getlasterror()); return 1;...

json - Find and modify python nested dictionary (key, value) -

i have json file need update. converting python dict (nested) update it. here input, dept. i'm sure there better way this, don't know. ultimatley want able perfom create/delete action in addition update. here script , input file. # find target value in nested key value chain # replace old value newvalue import json pprint import pprint d1 = open('jinputstack.json', 'r') d1 = json.load(d1) def traverse(obj, path=none, callback=none): """ traverse python object structure, calling callback function every element in structure, , inserting return value of callback new value. """ if path none: path = [] if isinstance(obj, dict): value = {k: traverse(v, path + [k], callback) k, v in obj.items()} elif isinstance(obj, list): value = [traverse(elem, path + [[]], callback) elem in obj] else: value = obj if callback none: ...