Posts

Showing posts from April, 2014

javascript - no click event in (some) Internet Explorers -

Image
i have problems jquery-click-events on button-elements not firing in internet explorers. this not related submitting forms, found many questions regarding problems this, no duplicate question. i made simple example illustrate problem: it test-button, colored red prove jquery works , click handler colouring blue , showing alert. here jquery code : $('#foo').on('click', function(){ $('#foo').css('color', 'blue'); alert('test'); }).css('color', 'red'); here html code : <html> <body> <button id="foo">test</button> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> </body> </html> the problem is, click event not fire on pcs in internet explorer. on other pcs works in ie , on pcs in other browsers. here screenshot of not working ie: i searched through options , compatibility modes , did not find solution/reason t

sql - How to connect my local postgresql with my local ip address -

my question is, install postgresql in mac, want connect postgresql local ip address. for example, local ip address is: 10.xxx.xxx.xxx, want command as psql -u username -d dbname -h 10.xxx.xxx.xxx instand of command psql -u username -d dbname -h 127.0.0.1 . i has added ip address pg_hba.conf , , changed listen_address in postgresql.conf listen_address = '*' , not worked. thanks answer. add local ip in /etc/hosts file , try again. below: 127.0.0.1 localhost 10.xxx.xxx.xxx localhost

stdout - How can work output using python? -

i made script modify text. but can't make result. below script. begin study python. i think script didn't work because f = open('find_c_volume_show.txt', 'w') please me. import sys itertools import islice def next_n_lines(file_opened, n): return [x.strip() x in islice(file_opened, n)] field_line = 1 num = 0 n = 9 split_line = field_line / n strings = ("vserver", "volume name", "used size", "available size", "volume size", "aggregate name", "space saved storage efficiency") f = open('find_c_volume_show.txt', 'w') line in open("c_volume_show.txt"): if any(s in line s in strings): field1,field2 = line.strip().split(':') field_line += 1 f.write(field2 + '\n') f.close() f = open('find_c_volume_show.txt', 'w') f.write("vserver,volume name,aggregate name,volum

php - Last uppercase word from String -

i want uppercase word string worda - wordb - wordc - failure occurring verified if wordd worde linked failure. the expected output want above string : wordd worde try : <?php $a= "worda - wordb - wordc - failure occurring verified if wordd worde linked failure."; $b= '/([a-z|\s\0-9]+)[a-z|\w\|0-9]*$/'; preg_match($b, $a, $c, preg_offset_capture); print_r($c[1][0]); ?>

c# - ASP.net SignalR server without knowing the client -

we trying setup websockets server using signalr connect our devices. project hosted in web app published on azure. but have 3 issues : - devices going send device name @ end of url. if url ws://url:port/myservice , devices send message ws://url:port/myservice/devicename and device name different each device. should configuration of routes hub ? we'd save name in clients list of signalr able call ones. we don't know name of function called, requests clients send json object parameter. how can configure hub redirect requests newmessage(string json) ? we've managed messages devices using : websocket socket = context.websocket; while (true) { var url = context.requesturi; arraysegment<byte> buffer = new arraysegment<byte>(new byte[1024]); websocketreceiveresult result = await socket.receiveasync(buffer, cancellationtoken.none); if (socke

javascript - dot is not working in webpack dev server url after refresh -

i have following url: about/myfile.php?.. it's working fine when coming page myfile.php . now, refreshing page. after refresh getting: cannot /about/myfile.php as suggested here https://github.com/fabric8-ui/fabric8-ui/pull/1391/files , have made changes in webpack.config.js file: devserver: { historyapifallback: { disabledotrule: true, }, }, but, it's not working on refresh.

php - LinkedIn API: Preventing CSRF attacks -

i integrating linkedin api website retrieve user data linkedin clients of website. api documentation advises pass parameter each request called state random string of characters prevent csrf attacks . developing in php. documentation isn't elaborate how generated. there pre-defined function in php so? can include best practices related preventing csrf attacks , generating such strings new working apis , not aware of best practices.

android - EditText SetText getting null value. Retrieving value via php from sql -

i've tried comes mind, i've researched 2 days now. new android. final cry turning masters on stackoverflow. guide me. background.java protected string doinbackground(string... params) { string update_id = params[1]; try { url url = new url(update_url); httpurlconnection httpurlconnection = (httpurlconnection) url.openconnection(); httpurlconnection.setrequestmethod("post"); httpurlconnection.setdooutput(true); outputstream os = httpurlconnection.getoutputstream(); bufferedwriter bufferedwriter = new bufferedwriter(new outputstreamwriter(os,"utf-8")); string data = urlencoder.encode("id","utf-8") + "=" + urlencoder.encode(update_id, "utf-8"); os.write(data.getbytes()); bufferedwriter.flush(); os.close(); inputstream = httpurlconnection.getinputstream();

botframework - Bot send dynamically created, downloadable CSV using Microsoft Bot Framework (C#) -

goal: dynamically create csv file information sql server query (don't want save file) , send user in bot response on slack. user clicks on link download file computer. i have created file information in memorystream, having trouble sending in bot response. c# pseudocode , code inspired this : public async task useselectedupc(idialogcontext context, iawaitable<object> item) { var upc = await item; // use upc query sql server , obtain information // use information create memorystream result in format of csv file reply.attachments = new list<attachment>() { new attachment() { contenttype = "text/csv", content = $"data:text/csv; base 64, {convert.tobase64string(result.toarray())}", name = "sample.csv" } }; reply.text = "resu

ibm bluemix - IBM Watson Knowledge Studio 2.0 - deploying a rule-based model is experimental. What does that mean? -

when building rule-based model in watson knowledge studio, reminder appears saying:- the rule-based model build here can deployed , used other watson services experimental purposes only. in online documentation, @ beginning of chapter "deploying rule-based annotator ibm watson discovery", similar mention appears:- attention: experimental feature of service. i started building application based on wks custom rule-based model deployed in discovery , want sure solution not jeopardized @ point in future release of either wks or discovery. what experimental means in context? there chance in future version of wks or discovery rule-based modeling won't available anymore? i'm offering manager wks. an example of official definition of experimental/beta ibm can found here: http://www.ibm.com/software/sla/sladb.nsf/pdf/6605-11/$file/i126-6605-11_06-2017_en_us.pdf my interpretation of official ibm policy follows: experimental/beta provides

php - Laravel - Group By error on query that works on phpmyadmin with results -

Image
the query is: $last_topics = topics::orderby('date', 'desc')->groupby('section')->get(); and error: so on error can see query is: select * from topics group by section order by date desc but can see same query in phpmyadmin works great, , have result so what's wrong? i addition can without groupby in query inside laravel doesn't alert error, like: $last_topics = topics::orderby('date', 'desc')->get(); but said in phpmyadmin same query groupby works great ok mode in database being used within database config /config/database.php . laravel not adding columns group by. 'connections' => [ 'mysql' => [ // work 'strict' => false, // wont work 'strict' => true, ] ]

node.js - Docker-Compose publishing ports on Host computer Nodejs + Express -

i have built docker-compose file , want access nodejs app on localhost:3000 host computer publishing ports doesn't seem working. when run compose-up seems working fine , confirmation listening on port 3000 . when go localhost:3000 browser curl not found or timeout response. am missing here? my nodejs server: var server = app.listen( process.env.port || 3000, function(){ console.log('listening on port ' + server.address().port); }); my docker-compose.yml file: version: "3" services: api: image: baum-test:v0 ports: - "3000:3000" networks: - webnet mongodb: image: mongo:latest ports: - "27017:27017" volumes: - ./data:/data deploy: placement: constraints: [node.role == manager] networks: - webnet networks: webnet: if running using docker stack deploy command can "constraints: [node.role == manager]" i

The remote name could not be resolved: 'api.nuget.org' -

i having problem installing nuget package using package manager console in visual studio 2017. following if full details of error: install-package : unable load service index source https://api.nuget.org/v3/index.json. error occurred while sending request. remote name not resolved: 'api.nuget.org' @ line:1 char:1 + install-package selenium.webdriver -version 3.0.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (:) [install-package], exception + fullyqualifiederrorid : nugetcmdletunhandledexception,nuget.packagemanagement.powershellcmdlets.installpackagecommand i checked status of each nuget servers here , seem operational. found similar posts them old enough. tried reset router still same. hope helps me. emailed support did not reply yet. i encountered issue time ago still want post reason others. seems error details correct: the remote name not resolved: 'api.nuget.org' i found out next da

python - Combine data from multiple lists of different length -

i have db query returning 3 sets of data. comes in format. year = (('adison', '355', 4), ('windsor windham', '455', 6), ('windham', '655', 2), ('btown', '233', 5)) month = (('adison', '355', 2), ('windham', '655', 1)) week = (('btown', '233', 8), ('adison', '355', 9)) the year list longest values. need take last value each element in month , week lists , append them year list in proper spot, based on town. if there not corresponding value in month or week, need append 0. ideally making this: year = (('adison', '355', 4, 2, 9), ('windsor windham', '455', 6, 0, 0), ('windham', '655', 2, 1, 0), ('btown', '233', 5, 0, 8)) i have tried putting 2 lists in loop , using if in conditional check values think overlooking , getting index errors. tried this: for each in year: part in month

python - How can I create a list of records groupedby index in Pandas? -

i have csv of records: name,credits,email bob,,test1@foo.com bob,6.0,test@foo.com bill,3.0,something_else@a.com bill,4.0,something@a.com tammy,5.0,hello@gmail.org where name index. because there multiple records same name, i'd roll entire row (minus name) list create json of form: { "bob": [ { "credits": null, "email": "test1@foo.com"}, { "credits": 6.0, "email": "test@foo.com" } ], // ... } my current solution bit kludgey seems use pandas tool reading csv, nonetheless generates expected jsonish output: #!/usr/bin/env python3 import io import pandas pd pprint import pprint collections import defaultdict def read_data(): s = """name,credits,email bob,,test1@foo.com bob,6.0,test@foo.com bill,3.0,something_else@a.com bill,4.0,something@a.com tammy,5.0,hello@gmail.org """ data = io.stringio(s) return pd.read_csv(data) if __name__ == "

Way to sort results from AtTask / WorkFront API? -

is there way sort or order results attask / workfront web api? didn't see way in api documentation. you can sort results api appending _sort=asc. example if want sort name can pass following parameter in query. name_sort=asc

angular - Set a default value to select -

i trying set default value ion-select option, on radio button "no" been clicked. <ion-select class="brand" name="selectbrand" [(ngmodel)]="selectbrand" required> <ion-option *ngfor="let brand of brand;" [value]="brand.val">{{brand.name}}</ion-option> </ion-select> <ion-col> <ion-list radio-group name="checkbox" [(ngmodel)]="automanufacturers"> <ion-item> <ion-label>yes</ion-label> <ion-radio [value]="true"></ion-radio> </ion-item> <ion-item> <ion-label>no</ion-label> <ion-radio (ionselect)="radiochecked()" [value]="false"></ion-radio> </ion-item> </ion-list> so when click on "no" in radio button need default array [1] place. brand = [ {

In a Netlogo network, how can turtles "see" properties of other turtles? -

i trying build model in turtles decide change colour depending on environment in network. the approach "check" colour of surrounding turtles , set if statement turtle in question switch colour (there 2 colours). specifically know how can turtle "see" or check other turtles' colour (or other properties). if possible create slider "how many links away" can turtles see neighbouring turtles' (or neighbours of neighbours, etc) colour. i new both netlogo , stackoverflow, please let me know if should make modifications model and/or question. thanks! carlos welcome stack overflow! typically you'll want stick single question per post, both simplicity , benefit of future users similar questions. well, in cases applicable should try include code show you've tried far, setup necessary- want make minimal, complete, , verifiable example . in case, think you're okay since questions clear , explained, if have more complex quest

git pull without updating remote -

suppose have run git fetch , , want run git pull , bring local mybranch up-to-date origin\mybranch . but!! in mean time, after running fetch , internet connection has dropped :( now, when run git pull fails, because can't see remote . i'd still local portion of pull. is there way tell git pull run without doing initial git fetch ? note: git reset --hard update mybranch . git pull doesn't that. i guess way phrase question "what second command satisfies: git pull = git fetch + git ??? "? in fact depends on configuration. in default configuration, if you're on my_branch has upstream origin/my_branch , git pull can considered as get fetch merge origin/my_branch configuration (or command line arguments) can change merged. configuration can change 2nd step merge rebase. when "what second command satisfies: git pull = git fetch + git ???"? there's no 1 answer ??? is, by default merge.

python - PyOpenCL Multidimensional Array -

i have code multidimensional array addition using pyopencl. problem result wrong first dimension. have been consulting link . from __future__ import absolute_import, print_function import numpy np import pyopencl cl n = 4 a_np = np.random.rand(n,n).astype(np.float32) b_np = np.random.rand(n,n).astype(np.float32) ctx = cl.create_some_context() queue = cl.commandqueue(ctx) mf = cl.mem_flags a_g = cl.buffer(ctx, mf.read_only | mf.copy_host_ptr, hostbuf=a_np) b_g = cl.buffer(ctx, mf.read_only | mf.copy_host_ptr, hostbuf=b_np) prg = cl.program(ctx, """ __kernel void sum( __global const float *a_g, __global const float *b_g, __global float *res_g) { int = get_global_id(1); int j = get_global_id(0); res_g[i,j] = a_g[i,j] + b_g[i,j]; } """).build() res_g = cl.buffer(ctx, mf.write_only, a_np.nbytes) prg.sum(queue, a_np.shape, none, a_g, b_g, res_g) res_np = np.empty_like(a_np) cl.enqueue_copy(queue, re

javascript - Sort div by content item -

is possible sort div content item? example have 1 div has 3 child div .in each child div exists different numbers of span elements. can sort div ? <div id="mydiv"> <div> <span>1</span> <span>2</span> </div> <div> <span>1</span> <span>2</span> <span>3</span> <span>4</span> </div> <div> <span>1</span> </div> </div> you can convert nodelist array, , use sort: var mydiv = document.getelementbyid("mydiv") var elements = [].slice.call(mydiv.children); var sorted = elements.sort(function(a, b) { return a.children.length - b.children.length; }) console.log('sorted', sorted) to apply sorting dom, reappend these elements: sorted.foreach(el=>mydiv.appendchild(el)); in action

ios - How to check whether iPhone and apple watch are connected and their distance? -

i realize question has been asked before answers 2015 , had no success tips. i'm trying achieve functionality lookout app notifies when leaving iphone behind. i've tried using corebluetooth can detect watch if watch screen turned on. wcsession check reachability file transfers check not achieve functionality. any suggestions? thanks

sap - Data Services ETL Script Job name ID not being pulled -

i have job keeps failing saying job not defined in control job table. job name in control table different etl name i've updated in our control table reflect correct etl job name still failing. print statement showing job name same job name in control table, no spaces or in it. in our job control script within etl job, value of job_name() assigned variable $g_jobname. it set this: $g_jobname = job_name() ; i assuming procedure/function pulling etl job name , comparing job control table. both job names match in script not getting job id using job name scalar value? print out job id empty. the script thus: $g_job_id = sql('data_source_job_control','select jobid job_ctrl_tbl ltrim(rtrim(upper(job_name))) = ltrim(rtrim(upper({$g_jobname}))) ') ; print('diprint: $g_job_id: ' || $g_job_id) ; the id used further processing or fail out depending on if null or not. thanks andrew

c# - Unable to remove hyperlink from dynamic generated HTML during export to excel -

i want remove hyperlink dynamic generated html during export excel. tried lot googling still not find solution. code string companyname = string.empty; companyname = session["companyname"].tostring(); companyname = companyname.replace(" ", "_"); string filename = companyname.trim() + "-weekly_cashflow_statement_" + datetime.now.tostring("ddmmyyyyhhmmss") + ".xls"; httpcontext.current.response.appendheader( "content-disposition", "attachment; filename=" + filename); httpcontext.current.response.charset = ""; httpcontext.current.response.contenttype = "application/ms-excel"; this.page.enableviewstate = false; system.io.stringwriter tw = new system.io.stringwriter(); system.web.ui.htmltextwriter hw = new system.web.ui.htmltextwriter(tw); tblcashflow.rendercontrol(hw); httpcontext.current.response.write(tw.tostring()); httpcontext.current.response.end(); i cha

rsa - Whether Network Admin will be able to see my request even in the TLS configured area -

i have configured web application tls 1.0. requests going in encrypted format through out channel, secured man in middle attack. tls working on rsa mechanism, doubt if network admin (having private key) able decrypt request or not. first, system or network admin not have access private key if add hsm , configure web server use (see https://en.wikipedia.org/wiki/hardware_security_module ). secondly, many pfs cipher suites available tls 1.0 (see https://security.stackexchange.com/questions/74270/which-forward-secrecy-cipher-suites-are-supported-for-tls1-0-protocols ), if accept such cipher suites on web server, can capture communications , knows rsa private key not able decrypt content of channel: cipher key used protect channel ephemeral, not rsa private key.

jquery - Alternate Slide/Un-slide of Images -

could me issue. want make each image show alternate, time 2 images showing. sample code here . thanks in advance. $(document).ready(function() { var count = -1; function slideimg() { var imgs = $('.img'); var imglength = imgs.length - 1; count < imglength ? count++ : count = 0; imgs.addclass('slide').eq(count).removeclass('slide'); } setinterval(slideimg, 5000); }); .img-wrapper { position: relative; width: 200px; height: 300px; border: 1px solid #d9d9d9; overflow: hidden; } .img { position: absolute; right: -100%; -webkit-transition: 2s; transition: 2s; } .slide { right: 0 !important; -webkit-transition: 2s !important; transition: 2s !important; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="img-wrapper"> <img class="img" src="https://unsplas

Base64 decoding error in coldfusion -

i'm trying decode base64 string #tostring( tobinary( stringtodecode ) )# , coldfusion gives error saying parameter must base-64 encoded string. string comes third party, , supposed pdf file. here part of it: jvberi0xljukjeljz9mkmsawig9iago8pc9uexbll1hpymply3qvumvzb3vyy2vzpdw+pi9tdwj0 exbll0zvcm0vqkjvefswidagmtuundqgmtuundzdl01hdhjpecbbmsawidagmsawidbdl0xlbmd0 acaymi9gb3jtvhlwzsaxl0zpbhrlci9gbgf0zurly29kzt4+c3ryzwftck9lhxbaedxzpio1a/gj mguxqdw3qkgkzw5kc3ryzwftcmvuzg9iagoyidagb2jqcjw8l1r5cguvwe9iamvjdc9szxnvdxjj zxm8pd4+l1n1ynr5cguvrm9ybs9cqm94wzagmcaxns40ncaxns4xov0vtwf0cml4ifsxidagmcax idagmf0vtgvuz3roidiyl0zvcm1uexblidevrmlsdgvyl0zsyxrlrgvjb2rlpj5zdhjlyw0ktdn8 nkukyx04gj8v9lfobogvn9vrigplbmrzdhjlyw0kzw5kb2jqcjmgmcbvymokpdwvvhlwzs9yt2jq zwn0l1jlc291cmnlczw8pj4vu3vidhlwzs9gb3jtl0jcb3hbmcawide1ljq0ide1ljcyxs9nyxry axggwzegmcawidegmcawxs9mzw5ndgggmjivrm9ybvr5cgugms9gawx0zxivrmxhdgvezwnvzgu+ what had thought spaces problem, did replace replace " " "" , st

python - Not Found Error in Pytesser3 -

import pytesser3 import image = image.open("c:\\users\\dell\\desktop\\test.png") b = pytesser3.image_to_string(a) print(b) i tried make simple ocr program whenever run following error. have uninstalled pytesser3 , reinstalled nothing has changed. doing wrong? traceback (most recent call last): file "c:/users/dell/desktop/crossword.py", line 4, in <module> b = pytesser3.image_to_string(a) file "c:\users\dell\appdata\local\programs\python\python36-32\lib\site- packages\pytesser3\__init__.py", line 30, in image_to_string call_tesseract(scratch_image_name, scratch_text_name_root) file "c:\users\dell\appdata\local\programs\python\python36-32\lib\site- packages\pytesser3\__init__.py", line 20, in call_tesseract proc = subprocess.popen(args) file "c:\users\dell\appdata\local\programs\python\python36-32\lib\subprocess.py", line 707, in __init__ restore_signals, start_new_session) file "c:\users\dell\appdata\

python - What's the Pythonic way to report nonfatal errors in a parser? -

a parser created reads recorded chess games file. api used this: import chess.pgn pgn_file = open("games.pgn") first_game = chess.pgn.read_game(pgn_file) second_game = chess.pgn.read_game(pgn_file) # ... sometimes illegal moves (or other problems) encountered. pythonic way handle them? raising exceptions error encountered. however, makes every problem fatal, in execution stops. often, there still useful data has been parsed , returned. also, can not continue parsing next data set, because still in middle of half-read data. accumulating exceptions , raising them @ end of game. makes error fatal again, @ least can catch , continue parsing next game. introduce optional argument this: game = chess.pgn.read_game(pgn_file, parser_info) if parser_info.error: # appears quite verbose. # can @ least make best of sucessfully parsed parts. # ... are of these or other methods used in wild? actually, are fatal errors -- @ least, far being able repro

sql server - How to use stuff on entire columns of the table: -

i executed below query , executed :- select table2id, stuff((select char(13) + table1name table1 table1id=table2.table2id xml path (''), type ).value('.', 'varchar(max)') , 1, 1, '') table2 table2id=117 group id; but when using count(*) , in below query :- select table2id, stuff((select char(13) + count(*) table1 table1id=table2.table2id xml path (''), type ).value('.', 'varchar(max)') , 1, 1, '') table2 table2id=117 group id; i getting below error: msg 245, level 16, state 1, line 19 conversion failed when converting varchar value ' ' data type int. now how can stuff columns in table1 ? ! i want result below:- table2id | table1name | table1id | table1color ------------------------------------------------------ 117 | jon, jack | 117,117 | blue,red ( adding sample data table1 , table2 ) :- table1: table1id | table1name | table1color | table1city | table1animal |...(

save refferer header at 301 redirect from http to http -

i have https site on nginx. if sent http request on domain, redirects https version. exept 1 url, send 301 redirect http domain. my goal add in browser's header field referrer , when redirects through 301 redirect domain http part of site. know, security rules drop referrer header, when browser goes https http . http http must work fine, isn't it? if go http http page through hyperlynk, save refferer on same browsers, used test 301 redirect. to add referrer https http <meta name="referrer" content="origin">

Cannot build Xamarin.iOS with Microsoft Solver Foundation -

Image
i've added microsoft solver foundation via nuget xamarin ios project fails build message: build failed. mtouch : warning mt5215: references 'gdiplus' might require additional -framework=xxx or -lxxx instructions native linker mtouch : warning mt5215: references 'gdi32' might require additional -framework=xxx or -lxxx instructions native linker mtouch : warning mt5215: references 'user32' might require additional -framework=xxx or -lxxx instructions native linker mtouch : warning mt5215: references 'libx11' might require additional -framework=xxx or -lxxx instructions native linker mtouch : warning mt5215: references 'winspool' might require additional -framework=xxx or -lxxx instructions native linker mtouch : warning mt5215: references 'libcups' might require additional -framework=xxx or -lxxx instructions native linker mtouch : warning mt5215: references 'kernel32' might require additional -framework=xxx or -lxxx inst

xcode - Why is clang recompiling all C++ files including a header file if the recent change does not impact most of them? -

i have constants header file included of source files. if change constant in there used ~2 source files, clang still recompiling ~300 source files include header file. is there way recompile source files influenced change made without having split constants file many tiny parts? speed compilation process after small changes. since build system , environment seems matter: i'm using xcode 8.3.3 on osx, compiling c++ code ios.

html - The Favicon is not showing on my wordpress website especially on Chrome -

i have uploaded favicon on wordpress website not showing on chrome. http://babygearsmalaysia.com can me please? the correct way add favicon without shortcut , instead of <link rel="shortcut icon" href="yourpath/favicon.png"> you should use <link rel="icon" href="yourpath/favicon.png"> even better leave out tag , use favicon.ico file in root directory. further reading

python - Why does this function change my dictionary to None? -

i'm writing practice program add items list existing dictionary def addtoinventory(inventory, addeditems): in addeditems: inventory[i] = inventory.get(i,0) + 1 stuff = {'gold coin': 42, 'rope': 1} loot = ['gold coin', 'dagger', 'gold coin', 'gold coin', 'ruby'] stuff = addtoinventory(stuff, loot) why stuff changed none after running this? in fact code have 1 mistake. dictionary in python mutable when modify in fonction modifying 1 pass argument. because function not return when write: stuff = addtoinventory(stuff, loot) you assign stuff none. you have 2 choice: return dictionary @ end of function: def addtoinventory(inventory, addeditems): in addeditems: inventory[i] = inventory.get(i,0) + 1 return inventory or not reassign stuff: addtoinventory(stuff, loot)

c++ - How to make statifier work on 32-bit system? error loading libc.so.6 -

i've jun fresh new 32-bit ubuntu distribution , installed statifier usual(make all, make install). after tried statify compiled(on device) program. after it, i've got error message: /lib/ld-linux.so.2 --library-path /lib /bin/ln -s /lib/libc-2.5.so /lib/libc.so.6 what actions should make statifier work in case? here additional error code: ld_assume_kernel=4.10.0 statifier async_record_test async_record_static /usr/lib/statifier/32//elf_symbols: can't open '/lib/ld-linux-armhf.so.3' file. errno = 2 (no such file or directory) /usr/lib/statifier/32//elf_data: can't open '/lib/ld-linux-armhf.so.3' file. errno = 2 (no such file or directory) /usr/lib/statifier/32//elf_data: can't open '/lib/ld-linux-armhf.so.3' file. errno = 2 (no such file or directory)

swift3 - html swift 3 uikit link inside webview -

i have build simple intro page external links. , dont know how write external links, i'm trying on code below not working. secondly how can add more css. thanks! import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var mywebview: uiwebview! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let webview = uiwebview() mywebview.loadhtmlstring("<html><body><center><img src=\"logo.png\"><h1 style=\"font-family: helvetica\">faithway center</h1><h2 style=\"font-family: helvetica\"><a href=\"https://www.myhealthmatters.co.uk\">test</a></h2></body></html>", baseurl: nil) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }

r - What is -c and nrow doing in body of function -

can please explain me what bdf <- by(bdf, bdf$serial_number, function(sn, k) { sn[-c(1:k, (nrow(sn)-k+1):nrow(sn)),] }, k = 10) is doing? by() splits data frame bdf second argument serial_number , applys function function(sn, k) in third argument. don't understand body of function. c() creates vector. - makes numbers in vector negative. vector in "row" position of [ , omitting rows 1 k , , nrow(sn) - k + 1 end of data frame. it's chopping off first k , last k - 1 rows of data frame.

android - Firebase serialization names -

Image
i created object send data firebase. example, use firebase user example: public class user { public string username; public string email; public user() { // default constructor required calls datasnapshot.getvalue(user.class) } public user(string username, string email) { this.username = username; this.email = email; } } i want encode property names sent firebase. keys sent using variable names. want encode keys useraname , email , gson doing. don't want change variable names. @serializatename("username") public string username; @serializatename("username") public string email; i used @serializatename() , not working. same @propertyname used firebse, not working. can use in order serializare custom keys? update 1 public class pojo { @propertyname("guid") public string guid; @propertyname("name") public string name; public string getpojoguid() { retu

c# - Cross-Origin Requests WebApi -

i reading https://docs.microsoft.com/en-us/aspnet.... security prevent ajax requests domain , makes me wonder, if enable this, able make request android client? cu'z seems outside of domain, can't requested. it? thanks! would like: context.owincontext.response.headers.add("access-control-allow-origin", new[] { "*" }); using (iuserrepository _repository = new userrepository(new data.datacontexts.oauthserverdatacontext())) { var user = _repository.authenticate(context.username, context.password); if (user == null) { context.seterror("invalid_grant", "the user name or password incorrect."); return; } } if making request domain need set access-control-allow-origin header. can use * if aren't concerned security it's best specify domains know need access. non-browser-based clients may not send origin header (e.g

google spreadsheet - copy cell range and paste below -

i have google sheet names "queue tracker" , in tab named "compiled dispositions". auto select , copy multiple ranges (which contain formulas) , paste "n" number of rows below. n can 100 or 1000 or 3000. the ranges select , copy : b3:k3, m3:v3, x3:ag3, ai3:ar3, at3:bc3, be3:bo3, bq3:bz3, cb3:ch3, ck3:cp3, cs3:cx3, da3:df3 i don't believe it's possible access multiple range selections google apps script. using active selections won't work. treats selected ranges 1 range in null out unwanted columns. not planning on copying areas populated dated. haven't tested can use starting point. give chance know our script editor , debugger. function copyyourrowtorange(row, numrows) { var leaveblank=['0','11','22','33','44','55','67','78','86','87','94','95','102','103']; var ss=spreadsheetapp.getactive(); var sht=s

Is it possible to use the third party plugins or modules which feature or plugins are not available in Nativescript official plugins? -

is possible use third parties plugins features not avail in nativescript official plugins. like angular-trix angularjs- " http://sachinchoolur.github.io/angular-trix/ " if possible means how should achieve? thank reading, looking forward reading responses! this bit of crosspost https://discourse.nativescript.org/t/can-i-use-non-nativescript-specific-third-party-plugins/2054/2 , here's duped answer well: usually answer yes, in specific case, according github account library angular 1 - not supported nativescript.

haskell - How do `do` and `where` mix? -

from book have following code snippets mutableupdateio :: int -> io (mv.mvector realworld int) mutableupdateio n = mvec <- gm.new (n + 1) go n mvec go 0 v = return v go n v = (mv.write v n 0) >> go (n - 1) v mutableupdatest :: int -> v.vector int mutableupdatest n = runst $ mvec <- gm.new (n + 1) go n mvec go 0 v = v.freeze v go n v = (mv.write v n 0) >> go (n - 1) v like hindent indents them. want introduce braces , semicolons, whitespace isn't relevant more. because curious. the second example suggests, where belongs whole runst $ ... expression, first example suggests, somehow part of go n mvec statement. reading in haskell report chapter 2.7 tried introduce braces , semicolons in first example like mutableupdateio :: int -> io (mv.mvector realworld int) mutableupdateio n = { mvec <- gm.new (n + 1); go n mvec; { go 0 v = return v; go n v = (mv.write v n 0) >> go (n - 1) v; } ;

polymorphism - TypeScript declaration for polymorphic decorator -

Image
i’m in process of writing ambient declaration react-tracking . exposes track decorator can used on both classes and methods. a simplified example taken docs: import track 'react-tracking' @track({ page: 'foopage' }) export default class foopage extends react.component { @track({ action: 'click' }) handleclick = () => { // ... } } in ambient declaration file expected able following , have typescript choose right overload: declare function track(trackinginfo?: any, options?: any): <t>(component: t) => t declare function track(trackinginfo?: any, options?: any): export default track while works component classes, fails methods following error: [ts] unable resolve signature of method decorator when called expression. looking @ typing ts chooses application of decorator indicates it’s not falling signature should match anything, instead component class one. is possible type polymorphic decorator @ all? and, if so, doin

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -

Image
struggling find exact wording need use images. i have model called statements , want change way admin page editing or submitting statement looks. particularly field statement has called statement-contexts . right now, doesn't accurately represent field supposed , doesn't accomodate multiple entries. statement-contexts draws many-to-many relationship model called context . context consists of 2 fields pair 2 words: word field , keyword field draws many many relationship model keyword , pool of keywords in database. this drop down menu doesn't accomodate submitting pair of words that's supposed comprise statement-contexts , beyond selecting 2 words (which hope indicate context 's word field , keyword field respectively. it isn't user friendly since people have submit many pairs of contexts , keywords. more 1 drop down menu needed, , way see many different pairs of words need add. so need figure out how change interface. i looking @ creating

.net - ASP.NET Viewstate bug - updating some controls (incorrectly) and not others -

i have combobox which, when select different options, triggers updatepanel containing gridview refresh new data depend on combobox selected item, via ajax postback. all works fine, except if i: select different entry in combobox 1 selected on page load (which first one). triggers gridview refresh. hit refresh. the refreshed screen loads first entry in combobox selected, , appropriate content first item in gridview. combobox changed entry selected in step 1 above - presumably restored viewstate. gridview not updated - shows data default combobox selection - 2 out of sync. if click in browser url box , hit enter, plain get of url, resets correctly. i tried adding add enableviewstate="false" viewstatemode="disabled" on combobox, still, when refresh, gridview resets, combo returns non-default value. in fact seems make things worse - if load page, select different combobox item, , hit refresh - selecting default combo item calls postback, receives 200 re

vue.js - Extend vueJs directive v-on:click -

i'm new vuejs . i'm trying create first app. show confirm message on every click on buttons. example: <button class="btn btn-danger" v-on:click="reject(proposal)">reject</button> my question is: can extend v-on:click event show confirm everywhere? make custom directive called v-confirm-click first executes confirm , then, if click on "ok", executes click event. possible? i recommend component instead. directives in vue used direct dom manipulation. in cases think need directive, component better. here example of confirm button component. vue.component("confirm-button",{ props:["onconfirm", "confirmtext"], template:`<button @click="onclick"><slot></slot></button>`, methods:{ onclick(){ if (confirm(this.confirmtext)) this.onconfirm() } } }) which use this: <confirm-button :on-confirm="confirm" confirm-te

How to set android camera2 preview and capture size? -

i using surfaceview show preview capture. want use width=1080,height=1920 preview. can set size of preview? i googled answer, camera version one. using android.hardware.camera2. private void takepreview() { try { final capturerequest.builder previewrequestbuilder = mcameradevice.createcapturerequest(cameradevice.template_preview); previewrequestbuilder.addtarget(msurfaceholder.getsurface()); mcameradevice.createcapturesession(arrays.aslist(msurfaceholder.getsurface(), mimagereader.getsurface()), new cameracapturesession.statecallback() // ③ { @override public void onconfigured(cameracapturesession cameracapturesession) { if (null == mcameradevice) return; mcameracapturesession = cameracapturesession; try { previewrequestbuilder.set(capturerequest.control_af_mode, capturerequest.control_af_mode_continuous_picture); previewrequestbui

arraylist - Java Array returns Null -

so when use pick string of random events returns null: public static list<string> picknrandom(list<string> lst, int n) { list<string> copy = new linkedlist<string>(lst); collections.shuffle(copy); return copy.sublist(0, n); } static list<string> randomp; public list<string> items(){ list<string> teamlist = new linkedlist<string>(); teamlist.add("team1"); teamlist.add("team2"); teamlist.add("team3"); teamlist.add("team4"); teamlist.add("team5"); teamlist.add("team6"); list<string> randompicks = picknrandom(teamlist, 3); randompicks = randomp; return randompicks; } public static void store() { random rand = new random(); int people = rand.nextint(50) + 1; list<string> itemsin = randomp; system.out.println("people in store: "+people + "\nitems in store: "+itemsin); } public s

php - Error: "Illegal characters found in URL" - Code: 3 -

i want info api , code like: <?php $curl = curl_init(); $authorization = "authorization: token token='xxxxxx'"; $header = curl_setopt($curl, curlopt_httpheader, array($authorization)); curl_setopt($curl, curlopt_url, "https://customr.heliumdev.com/api/v1/customers/xxxx"); $result = curl_exec($curl); if(!curl_exec($curl)){ print_r('error: "' . curl_error($curl) . '" - code: ' .curl_errno($curl)."<br>"); } curl_close($curl); print_r(json_decode($result)); ?> and got error error: "illegal characters found in url" - code: 3 the origin curl should curl https://customr.heliumdev.com/api/v1/customers/xxxx --header "authorization: token token="xxx"" , idear illegal characters? i not reproduce problem. however, suggest avoid unnecessary double-execution of curl_exec , use $result instead... ... $result = curl_exec($curl); if (!$result) { ...

python - AssertionError when trying to assert return value from two dictionaries with py.test -

i'm testing text-based game i've been making learn python. last few days have been busy finding solution problem keep encountering. have tried multiple test methods, end giving me same error. the problem following assertionerror (using py.test ): e assertionerror: assert <textgame.waffle.winefields object @ 0x03bdecd0> == <textgame.waffle.winefields object @ 0x03bd00d0> obviously, object ( textgame.waffle.winefields ) correct, location different. don't care location. assume because i'm using 2 separate dictionaries same contents. however, prefer keep using dictionary if possible. the minimal working example of test looks follows: import textgame.waffle def test_change_map(): roomnames = { "the wine fields" : textgame.waffle.winefields(), } room = "the wine fields" next_room = roomnames[room] assert textgame.waffle.map(room).change(room) == next_room the textgame.waffle game i'm