Posts

Showing posts from January, 2012

Viewing all run parameters of a docker container -

i have running docker container started else using docker run ... . is possible list parameters of docker run of container? i've tried docker inspect <container_id> information of container. i'm not sure how correctly convert results of docker inspect parameters of docker run . you can try nexdrew/rekcod : a simple module reverse engineer docker run command existing container (via docker inspect). pass in container names or ids want reverse engineer , rekcod output docker run command duplicates container. $ npm -g rekcod # single container $ rekcod container-name docker run --name container-name ... of course, matthew adds in comments , docker compose helps specifying exact parameters need containers. or @ least version sources scripts launching container docker run commands (if don't use docker-compose).

meteor app failing when i run "meteor run android" -

my app failing when run "meteor run android". running meteor on fedora 23. think issue emulator because when reaches point of calling emulator, thats when fails. below terminal gives: [root@localhost first-app]# meteor run android [[[[[ /home/karakireronald/meteor-projects/first-app ]]]]] => started proxy. => started mongodb. => errors executing cordova commands: while running cordova app platform android options --emulator: error: command failed: /home/karakireronald/meteor-projects/first-app/.meteor/local/cordova-build/platforms/android/cordova/run --emulator { [error: adb: command failed exit code 126 error output: /root/android/sdk/platform-tools/adb: /root/android/sdk/platform-tools/adb: cannot execute binary file] code: 126 } 'error: adb: command failed exit code 126 error output:\n/root/android/sdk/platf...

node.js - Angular2 rest calls in background -

i created sample application per jhon papa 's example.(quick start program). designed service class json data rest service http://localhost:8081//myserver/rest/heros import { injectable } '@angular/core'; import { http, response , headers} '@angular/http'; import 'rxjs/add/operator/topromise'; import { hero } './hero'; import { code } './code'; import { heroes } './mock-heroes'; @injectable() export class heroservice { constructor(private http: http) { } private heroesurl = 'http://localhost:8081//myserver/rest/heros'; // url web api getheroes() { return this.http.get(this.heroesurl) .topromise() .then( response => response.json() hero[]) .catch(this.handleerror); } gethero(id: number) { return this.getheroes() .then(heroes => heroes.find(hero => hero.id === id)); } private handleerror(error: any) ...

c# - SmartCardReader won't fire CardAdded method? -

i trying microsoft phone fire , event, when nfc tag tapped. method wont fire when tag tapped. cardreader_cardadded should fire when tag tapped, nothing. here code: public mainpage() { this.initializecomponent(); smartcard(); } public async void smartcard() { string selector = smartcardreader.getdeviceselector(); deviceinformationcollection devices = await deviceinformation.findallasync(selector); foreach (deviceinformation device in devices) { smartcardreader reader = await smartcardreader.fromidasync(device.id); reader.cardadded += cardreader_cardadded; reader.cardremoved += cardreader_cardremoved; } } private void cardreader_cardremoved(smartcardreader sender, cardremovedeventargs args) { } private async void cardreader_cardadded(smartcardreader sender, cardaddedeventargs args) { await handlecard(args.smartcard); } private asy...

javascript - Prebid JS integration with Pulsepoint exchange -

i trying integrate prebid.js 3 bidders appnexus, pulsepoint , rubicon. able configure appnexus cannot see bids in developer tools console. tried adding pulsepoint , every time "bid returned empty or error response" response. did wrong or miss in below configuration? var adunits = [{ code: 'div-gpt-ad-1471847819782-0', sizes: [[728, 90]], bids: [ { bidder: 'pulsepoint', params: { cf: '728x90', cp: 558725, ct: 497758 } } ] }];

c++ - Header and source files function definitions -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i have project , project b under 1 solution in visual studio. project needs use function of class of project b, in project b have file contains header file of project b, let's call allheadersofb.h . file included in stdafx.h file of project a, included in each class of project a. i have variable of type y in class x , y class of project b , x class of project a. in x , if try use function of y , function declared in .h file , defined in .cpp file have unresolved external link, if function declared , defined in header file doesn't happen. what doing wrong? including headers not enough. guess project b library, project a needs link library can access implementation of class/function b .

matlab - How to "Align" datasets with missing intervals -

let's have 2 sets of data intervals of 0.5 units apart within range 0.0 - 3.0 dataset 1: x | y1 dataset 2: x | y2 --------- --------- 0.0 5 0.0 2 0.5 3 0.5 6 2.0 7 1.0 9 3.0 1 2.5 1 3.0 4 what efficient way align these data tables can make single table containing both datasets , autofill missing components? ideally end result this: dataset 3: x | y1 | y2 ----------------- 0.0 5 2 0.5 3 6 1.0 0 9 1.5 0 0 2.0 7 0 2.5 0 1 3.0 1 4 since know x looks like, can create output dataset , fill in values y1 , y2 x = 0:0.5:3; data3 = [x', zeros(length(x),2)]; %# "wherever x matches fir...

python - ProtocolError IncompleteRead using requests -

i got wierd error when tried download images using requests quite brief code follows, import requests import stringio r = requests.get(image_url, stream=true) if r.status_code == 200: r.raw.decode_content = true data = stringio.stringio(r.raw.data) # other code deal data then error, protocolerror: ('connection broken: incompleteread(15060 bytes read, 55977 more expected)', incompleteread(15060 bytes read, 55977 more expected)) i googled similar problems, , try force requests using http/1.0 protocol this, import httplib httplib.httpconnection._http_vsn = 10 httplib.httpconnection._http_vsn_str = 'http/1.0' however, server returns me 403 status code. by way, what's more confusing protocolerror not happens every time sometimes. any appreciated! since using stream=true should iterate on response , save file in chunks: with open('pic1.jpg', 'wb') handle: response = requests.get(image_url, stream=true) ...

java - Creating button through class -

i new java , trying create button through class , has method arguments. when create 2 instances of class, shows 1 button i.e., latest one. tell me mistake have done here? my class file public class createbutton { int posx; int posy; int buttonwidth; int buttonheight; public void newbutton(int x, int y, int w, int h) { posx = x; posy = y; buttonwidth = w; buttonheight = h; jframe f = new jframe(); jbutton b = new jbutton("test"); b.setbounds(posx, posy, buttonwidth, buttonheight); f.add(b); f.setsize(400, 400); f.setlayout(null); f.setvisible(true); f.setdefaultcloseoperation(jframe.exit_on_close); } } my file class project { public static void main(string[] args) { createbutton mybutton1 = new createbutton(); createbutton mybutton2 = new createbutton(); mybutton1.newbutton(50, 200, 100, 50); mybutton2.newbutt...

sql - Azure Data Factory pipeline copy activity slow? -

i have pipeline 4 copy activities scheduled. have created 1 copy activity input , output dataset azure sql, source table has more 100 000 records , takes long time copy in destination. copy activity timeout interval 1 hr timeout , records copied on destination 50000. have noticed because of 1 columns "description" column process taking time.

Open new APN setting page through Android app Progrmmatically -

Image
since "android.permission.write_apn_settings" restricted google, though not able modify apn value programmatically. please refer below image in image have apn setting, want open third part of image populated values using code, though user need save these value pressing save button. is possible that, opening 'edit access point ' page along values. or other alternative modify or add new apn setting through coding. thanks in advance

In Python, what happens when you import inside of a function? -

this question has answer here: should python import statements @ top of module? 14 answers what pros , cons of importing python module and/or function inside of function, respect efficiency of speed , of memory? does re-import every time function run, or perhaps once @ beginning whether or not function run? does re-import every time function run? no; or rather, python modules cached every time imported, importing second (or third, or fourth...) time doesn't force them go through whole import process again. does import once @ beginning whether or not function run? no, imported if , when function executed. as benefits: depends, guess. if may run function , don't need module imported anywhere else, may beneficial import in function. or if there name clash or other reason don't want module or symbols module available everywhere , m...

ios - Letter spacing doubles for font-face fonts on iPhone -

i used fontsquirrel download webfonts letter spacing doubles on iphone. tried enabling "remove kerning" in fontsquirrel settings doesn't work. @font-face { font-family: 'fjalla_oneregular'; src: url('../../core/texts/fjallaone-regular-webfont.eot'); src: url('../../core/texts/fjallaone-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../../core/texts/fjallaone-regular-webfont.woff2') format('woff2'), url('../../core/texts/fjallaone-regular-webfont.woff') format('woff'), url('../../core/texts/fjallaone-regular-webfont.ttf') format('truetype'), url('../../core/texts/fjallaone-regular-webfont.svg#fjalla_oneregular') format('svg'); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } .post-header h1 { font-family: "fjalla_oneregular", impact, helvetica neue, helvetica, sans-serif; font-weight: ...

vba - Excel set active Workbook -

Image
i searched forum , couldn't find answer fit problem. pretty new excel vba , having trouble activating workbook opened. directly below part causing me trouble. so press button , brings me file path, , select file open. every week file has different name , not sure until open file path , @ it. once open it, macro manipulate data in file , copy , paste workbook running code. when run macro , open file not activate newly opened workbook , runs rest of macro trying manipulate data in original file. i think either need open file differently workbook opened active 1 or figure out how activate newly opened workbook without knowing file name. thank help. dim filepath string filepath = environ("userprofile") & "\dropbox\on go ordering" call shell("explorer.exe" & " " & filepath, vbnormalfocus) range("a6:e500").select sub on_the_go_button() dim ranker workbook set ranker = thisworkbook dim filepath ...

ios - iOS9 - CNContactPickerViewController : SelectionOfProperty is not working, if user have multiple phone numbers -

selectionofproperty not working if user has multiple phone numbers. i using below code: let picker = cncontactpickerviewcontroller() picker.displayedpropertykeys = [cncontactphonenumberskey] picker.predicateforenablingcontact = nspredicate(format: "phonenumbers.@count > 0") picker.predicateforselectionofcontact = nspredicate(value: false) picker.predicateforselectionofproperty = nspredicate(format: "key == 'phonenumbers'") picker.delegate = self it's working fine when using emailaddresses, not when changed phonenumbers. if have multiple phone numbers set predicateforenablingcontact as picker.predicateforenablingcontact = nspredicate(format: "phonenumbers.@count > 1") set predicate format "phonenumbers.@count > 1"

mysql - Selecting column with opposite value of one given -

i have 2 columns column_a(int) , column_b(int) . want select query gives me value in column not contain value give. example: column_a| column_b 5 | 10 if select (something on here) table column_a = 10 or column_b = 10; result should push out 5 (value in column_a . is possible? note: value of 10 in either columns. lets if 10 in column_a , 5 in column_b , above query should still give me 5 retrieved column_b instead of column_a note 2: both columns never contain same value. in contrived example, use case statement attempt select value 2 columns not match: select case when column_a = 10 column_b else column_a end yourtable column_a = 10 or column_b = 10 -- might optional

android - Commons.io error but working? -

im using code "backup" realm database on first run: try { fileutils.copyfile(new file(realm.getpath()), new file(environment.getexternalstoragedirectory()+"/old_db.realm")); } catch (ioexception e) { e.printstacktrace(); } and receive error , app crash java.lang.exceptionininitializererror @ org.apache.commons.io.fileutils.docopyfile(fileutils.java:1150) @ org.apache.commons.io.fileutils.copyfile(fileutils.java:1091) @ org.apache.commons.io.fileutils.copyfile(fileutils.java:1038) @ com.leifacil.vademecum.atividades.splash.oncreate(splash.java:118) @ android.app.activity.performcreate(activity.java:5047) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1094) @ android.app.activitythread.performlaunchactivity(activitythread.java:2056) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2117) @ android.app.activitythread.access$7...

ruby on rails - No route matches {:action=>"show", :controller=>"forum"} missing required keys: [:id] -

i'm trying route thredded /forum link on nav bar bug holding me back. not sure if installation issue or pathing one. thanks! routes.rb rails.application.routes.draw resources :links mount thredded::engine => '/forum' # creates about_path resources :forum devise_for :users root "pages#home" "about" => "pages#about" end home page / _header.html.erb <nav class="navbar navbar-static-top navbar-default" role="navigation"> <div class="container"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"...

Converting string expression to boolean logic - C# -

i want convert string expression real boolean expression. the expression below input (string): "(!a && b && c) || (a && !b && c) || (a && b && !c) || (a && b && c)" the variables a, b , c have boolean values (true or false). how can transforming string expression, replace logic values , validate using c#? if don't want use available libraries parse string need separate characters , implement logic based on comparison. example have "a || b" , can loop though each character , decide appropriate operation based on char == '|' . more complex situation i'd use stack keep track of each results, 1 can handle && , || without parentheses: public bool converttobool(string op, bool a, bool b) { var st = new stack<bool>(); var oparray = op.tochararray(); var orflag = false; var andflag = false; (var = 0; < oparray.length; i++) { ...

Functional JavaScript, remove assignment -

how can avoid self variable here? function urlbuilder(endpoint){ var status = ["user_timeline", "home_timeline", "retweets_of_me", "show", "retweets", "update", "update_with_media", "retweet", "unretweet", "retweeters", "lookup" ], friendships = ["incoming", "outgoing", "create", "destroy", "update", "show"]; let endpoints = { status: status, friendships: friendships } var self = { }; endpoints[endpoint].foreach(e => { self[e] = endpoint + "/" + e; }); return self; } somewhat better, still assignment statement. return [{}].map(el => { endpoints[endpoint].foreach(e => { el[e] = endpoint + "/" + e; }); return el; })[0]; you cannot really. create object dynamic number of properti...

Rendering Issue with Android Studio -

Image
when try use design view while looking @ "activity_main.xml" have warning says "rendering problems android nougat requires ide running java 1.8 or later install supported jdk" have current version of java on computer. its because compiled sdk versions lower of android n. try changing gradle file to android { compilesdkversion 'android-n' buildtoolsversion 24.0.0 rc1 ... } or change preview api 23

asp.net - Crystal Report display collapse when one field allow can grow -

Image
my crystal report display not in correct format when allow 1 field of "can grow". before allow "can grow" : after allow : so how solve problem? here have set : last edit: or try this. create text object. insert fields in text object base in order. how insert? cut field edit text object paste. then in properties of text object check suppress embedded field blank line. then can check if want can grow of text object this sample output inside textobject and output this cotabato house company name. sinsuat philippines address. numbers contact. they compres because shorten size of textobject execute funtion of can grow your output must this. hmmm your final output must this. no more '[' or ']' can seen inside textobject. data sample

Powershell to get Net Framework version from AD computers? -

i'm trying .net framework version of our domain computers. i run script below without errors output file empty. can please me fix it. get-adcomputer -filter 'name -like "dc*"' | get-childitem ‘hklm:\software\microsoft\net framework setup\ndp’ -recurse | get-itemproperty -name version -ea 0 | { $_.pschildname -match ‘^(?!s)\p{l}’} | select pschildname, version | export-csv c:\temp\ggg.csv i fixed script. see below: get-adcomputer -filter * | foreach { get-childitem ‘hklm:\software\microsoft\net framework setup\ndp’ -recurse | get-itemproperty -name version -ea 0 | { $_.pschildname -match ‘^(?!s)\p{l}’} | select pschildname, version } | export-csv c:\temp\gg.csv

python - Django isn't serving static files -

i'm working existing (and functional) django site. upgraded django 1.8.13 1.10 , our wsgi gunicorn. works fine when hosted development machine, when deployed, static resources (on admin , main site) yield 404's message, directory indexes not allowed here. our settings.py contains following: installed_apps = ( ... 'django.contrib.staticfiles', ... ) debug = true static_url = '/static/' project_dir = os.path.dirname(os.path.dirname(__file__)) staticfiles_dirs = ( os.path.join(project_dir, 'static'), ) static_root = os.path.join(project_dir, 'static_resources') the directory structure looks this: /my-project-name /my-project-name server.py settings.py urls.py wsgi.py ... /static /static_resources manage.py django not serve static files in production mode (debug=false). on production deployment that's job of webserver. resolve problem: run python manage....

ubuntu - How can I build a snap package that runs executable jar? -

i have executable jar program. it's javafx program. runs great on openjdk 8 , higher. want publish snap package in ubuntu's developer portal. have packaged deb file, however, ubuntu doesn't accept those. need submit snap package. that's current hurdle. new snapcraft. read documentation @ http://snapcraft.io gave overview on terminal commands , theory behind snap packages. i still can't seem package program (code snapcraft.yaml) correctly. need openjdk-8-jre dependency included , executable jar. deb package created installs , creates desktop file icon people run menu. there way include in snap package? thank help! in snappy playpen collect examples of snaps. here few which might help: openjdk demo: https://github.com/ubuntu/snappy-playpen/tree/master/openjdk-demo jtiledownloader: https://github.com/ubuntu/snappy-playpen/tree/master/jtiledownloader wallpaperdownloader: https://github.com/ubuntu/snappy-playpen/tree/master/wallpaperdownloader ...

bash - Save sqoop incremental import id -

i have lot of sqoop jobs running in aws emr, need turn off instance. there's way save last id incremental import, maybe localy , upload s3 via cronjob. my first idea is, when create job send request redshift, data stored , last id or last_modified, via bash script. another idea output of sqoop job --show $jobid, filter parameter of last_id , using create job again. but don't know if sqoop offer way more easily. as per sqoop docs , if incremental import run command line, value should specified --last-value in subsequent incremental import printed screen reference. if incremental import run saved job, value retained in saved job. subsequent runs of sqoop job --exec someincrementaljob continue import newer rows imported. so, need store nothing. sqoop's metastore take care of saving last value , avail next incremental import job. example, sqoop job \ --create new_job \ -- \ import \ --connect jdbc:mysql://localhost/testdb \ --username xxxx \ --p...

Get merchant email in Square connect v2? -

square connect v1 has way merchant email: https://docs.connect.squareup.com/api/connect/v1/#get-merchantid is there similar in v2? can't find in docs. this not possible in v2 apis.

r - Using colors in aes() function in ggplot2 -

Image
i new ggplot2 . trying understand how use ggplot . reading wickham's book , still trying wrap head around how use aes() function. in related thread, discussed should try avoid using variables inside aes() i.e. "don't put constants inside aes() - put mappings actual data columns." my objective observe behavior of ggplots when have color inside aes() labeling (as described in wickham's book) , override color print color. i started this: library(ggplot2) data(mpg) ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(aes(colour = "loess"), method = "loess", se = false) + geom_smooth(aes(colour = "lm"), method = "lm", se = false) + labs(colour = "method") this nicely plots graphs , labels them. however, unhappy colors used. so, experimented using overriding colors again: windows() ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(aes(colour = "loess"), method = "...

linux - Why won't this code permute the value Z? -

so trying build simple program in c permutes value of z ( z equal x + y ) every single thing try differently doesn't work. frustrated here. please me understand. source: #include <stdio.h> #include <stdlib.h> int main() { int x, y, z; scanf("%d", &x); scanf("%d", &y); z = x + y; printf("%d", &z); return 0; } you're printing address of z , not stored value, because you're passing printf pointer z rather value. change printf line to: printf("%d", z); scanf returns success value has use way give input. argument you're passing ( &x ) pointer variable want use storage. that's ampersand for. says "use address of variable". printf , on other hand, wants values themselves. doesn't need address. (though, technically, strings passed in pointers. not distinction need worry right now.)

indexing - Formula to create grid from list in Excel -

Image
i have data in 2 columns ( h2:i8 ) , need able work through data , assign values within grid ( b1:e5 ). as can see, there multiple values in first row, using formulas index , match started. next level, used formula: {=if(index($i$2:$i$8,small(if($b2=$h$2:$h$8,row($h$2:$h$8)-row($h$2)+1),column(a1)))=c$1,"yes","no")} -- don't worry #num! now. the trouble small function contains values match, check 3 appears in d3 , want in e3 (and change yes ), whereas d3 should no . but don't know how it... any appreciated!! thanks, chris try array {=sum(if($c2=$h$2:$h$8,1,0)*if(d$1=$i$2:$i$8,1,0))} it gives sum of counts. assume can change 1=true, 0=false value results require afterwards

c - use extern structure variable defined in a library, config with cmake -

main.c #include "test.h" extern struct test_struct my_test_str; // defined in my_test_lib.a int main(int argc, char *argv[]) { return 0; } here my_test_my library file of test.h , test.c compiled my_test_lib.a test.h #ifndef test_my #define test_my struct test_struct { double d1; double d2; double d3; }; void ddd(void); #endif test.c struct test_struct my_test_str; void ddd(void) { int = 0; int c = 1; c = + c; } write cmakelists.txt , use cmake generated makefile cmake_minimum_required(version 2.6) project(tutorial) add_library(my_test_my test.c) add_executable(tutorial main.c) target_link_libraries (tutorial my_test_my) after generate makefiles in out directory, execute make 192:out jerryw$ make [ 25%] building c object cmakefiles/my_test_my.dir/test.c.o [ 50%] linking c static library libmy_test_my.a /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/ranlib: file: libmy_test_my.a(test.c.o) has no s...

Regex to allow only one word followed by a url -

i doing this std::string reg ="^/house/room/section/.*" this allows user pass word after section program picks , uses.however want user able put in 1 word not sentence after section. how can modify (.*) not have space in it. instance /house/room/section/a1343 allowed /house/room/section/a1343 a1002 not allowed because space found inside follow word you use character class disallows spaces, so: [^ ]* or specify non-whitespace characters: \s*

java - How to configure Amazon Elasticache with Hibernate second level cache (Hibernate 5.0.7 & Wildfly 10.0.0) -

i want configure hibernate's second level cache use aws elasticache (currently trying use memcached). i've looked @ things this , can't seem work. in hibernate 5.0 docs, says wildfly automatically configures hibernate's second level cache use inifinispan. there easy way disable this? configuring cache use elasticache (correctly) override this? how can configure cache use memcached in hibernate 5? several places set property "hibernate.cache.provider_class" hibernate 5.0 docs property "hibernate.cache.region.factory_class" needs set determine provider use. old versions of hibernate-memcached (like this ) still usable?

IIS FTP 8.5 DataChannel timeout with a linux client -

i've got strange situation. hope can help. i've got 2 independent iis ftp servers. iis 7.5 runs standalone vm iis 8.5 runs on windows server 2012 r2 vm when connect these ftp servers using filezilla client (or pftp client on ubuntu), both work expected, well. passive mode, no problem. when 1 of customer's linux client connecting, works great on iis 7.5, not work on iis 8.5 it stops after pasv command timeout. linux client running custom app on fedora has ftp functionality embedded in it. for authentication i'm using iis manager users. does have idea of be? or how troubleshoot this?? can test, , see working, except when clients processes entering scene!

activerecord - Rails, get record with has_and_belongs_to_many having more than one value -

given these models modelone has_and_belongs_to_many :model_twos modeltwo has_and_belongs_to_many :model_ones field_one: string how use active record modelones had associated modeltwos field_one equalled "value_1" , "value_2" something modelone.joins(:model_twos).where(model_twos:{field_one: "value_1" , "value_2"}) this indeed tricky, if want use activerecord (i.e. without falling arel). i'm not 100% work or produce desirable sql i'd try this: class modelone < activerecord::base scope :with_model_two_value, -> (val) { joins(:model_twos).where(model_twos: { field_one: val }) } end modelone.with_model_two_value('value_1').merge(modelone.with_model_two_value('value_2'))

python, list compare, ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() -

here python code: def ava_check(nodes_group,child_list): ava_list=nodes_group[:] if nodes_group[1] in child_list: return none else: in nodes_group: if in child_list: ava_list.remove(a) ava_list.remove(nodes_group[nodes_group.index(a)-1]) else: pass the nodes_group list [0.0, (0, 3), 0.0, (0, 2), 0.0, (1, 3)] . child_list list [(0, 1)] . but when run code, there error: valueerror: truth value of array more 1 element ambiguous. use a.any() or a.all() happened in line if in child_list: . have no idea problem here. tried search, said numpy. didn't use numpy here, 2 inout arguments list tuples. could me problem? thanks much. update: everyone's solution. data (not tuples) in list nodes_group numpy array. store data in new list. checked data type of element in new list using type(), , found type numpy.float64 , explains why have error. write loop change type of elem...

Ruby Curly Brackets for "set" value -

what's difference between these 2 variations in ruby set: example1, "/random/string" and set: example2, -> {"random/string"} do both have same effect? although superficially similar they're 2 different things. the first simple string, second proc returns string. many methods in ruby world take both, proc version way of deferring evaluation of until if , when it's needed. the -> { ... } notation shorthand lambda { ... } , it's called stabby-lambda operator.

c# - WinForms N-Tier App with DI, Repository and -

i'm building simple winforms app, i'm using n-tier architecture, dependecy injection (with simple injector), entity framework code first, repository , unit of work patterns. ui layer. forms. business logic layer. business objects "managers" (classes expose business processes). data access layer repositories. database context. basically, know can register objects on container on app's entry point (program.cs), works objects accessible ui, rules out data access layer objects. so, how can register objects business logic layer since it's class library. thanks in advance. you need make distinction between dependency , reference. you're correct in saying ui should not have dependency on dataaccesslayer. means shouldn't hard-wired sql server code (to give example). doesn't mean can't reference project. to solve problem, reference projects ui (which entry point application). the fact if create references this: u...

Python - iterate over JSON results -

in order energy values, trying iterate on json result: [{u'track_href': u'https://api.spotify.com/v1/tracks/7603o589huckpbielnukgu', u'analysis_url': u'https://api.spotify.com/v1/audio-analysis/7603o589huckpbielnukgu', u'energy': 0.526, u'liveness': 0.0966, u'tempo': 92.979, u'speechiness': 0.103, u'uri': u'spotify:track:7603o589huckpbielnukgu', u'acousticness': 0.176, u'instrumentalness': 0.527, u'time_signature': 4, u'danceability': 0.635, u'key': 1, u'duration_ms': 172497, u'loudness': -8.073, u'valence': 0.267, u'type': u'audio_features', u'id': u'7603o589huckpbielnukgu', u'mode': 1},...}] i'm using list comprehension: [x['energy'] x in features] but i'm getting following error: print ([x['energy'] x in features]) typeerror: 'nonetype' object has no att...

Confusion over unexpected Math.cos behavior in Javascript -

this question has answer here: is floating point math broken? 20 answers the cosine of 90 degrees 0. i understand javascript's math.cos takes radians, i've tried: math.cos(90 * math.pi / 180) why yield 6.123233995736766e-17 instead of 0? 6.123233995736766e-17 0 . it's 0.00000000000000006123233995736766 . kind of minor error normal when working ieee floating point numbers. the solution never compare numbers exactly, compare if within range expect. eg. var result = math.cos(90 * math.pi / 180); if ( math.abs( result - 0 ) < 1e-16 ) { // test passed, result 0 } the - 0 nothing, more - x how compare x . trying compare 0 , used - 0 , leave off , same result.

python - How to deal with problematic encoding while webscraping? -

i trying scrape , merge contents of multiple tables each on separate webpage . have read lot encoding , unicode including links, can't figure out if i've missed or if there problem encoding on webpage. in first link, can see date 10/31/2014 brand name column reads "pear’s gourmet", lot of other strings come out funny apostrophes "children’s medical ventures, llc" (instead of "children's...). can see funny apostrophes in ipython, come out in csv file ’. my questions are: am doing wrong encoding apostrophes coming out wrong? if not, how replace wrong characters apostrophe? i have tried make reproducible code below. #import libraries import sys #import ipython print(sys.version_info[0:30]) #python 2.7.11 #print(ipython.version_info) #ipython 4.0.1 import pandas pd bs4 import beautifulsoup #from lxml import html import requests import os cwd = os.getcwd() #generate dataframe , lists df = pd.dataframe() a=[] b=[] c=[] ...

javascript - Show nearby Places in Google Maps in Meteor -

i trying nearby places gym, atm on google maps. have used dburles:google-maps package. followed instructions on google maps api , did following. map generated, , center marker shown not able generate places markers. can point out doing wrong? this js code. template.map.helpers({ examplemapoptions: function() { // make sure maps api has loaded if (googlemaps.loaded()) { // map initialization options var data=test.findone().address.geopoint; var lat=data[1]; var lng=data[0]; console.log([lat,lng]); return { center: new google.maps.latlng(lat, lng), zoom: 14 }; } } }); template.map.oncreated(function() { var self = this; googlemaps.ready('examplemap', function(map) { var marker; // create , move marker when latlng changes. self.autorun(function() { var data=test.findone().add...

Lua Script CSV file to table -

i'm pretty new lua, have troubles reading data csv file table. csv file consist of 4 columns. first column string other 3 double values. want is: open file, read in data , process data. testing want print data screen. later have open other file, robot programm, , pass data programm. i execute script consol command lua script.lua . error message lua: script.lua:22: bad argument #1 ´format´ (number expected, got nil) stack traceback: [c]: in function ´string.format´ script.lua:22: in main chunk [c]: in? can tell me i'm doing wrong? edit: changed scritp little bit. new code local open = io.open local function read_file(path) local file = open(path, "r") -- r read mode , b binary mode --if not file return nil end local coordinates = {} line in io.lines(path) local coordinate_name, coordinate_x, coordinate_y, coordinate_z = line:match("%s*(.-),%s*(.-),%s*(.-),%s*(.-)") coordinates[#coordinates+1] = { coordinate_name=coordina...

nginx - docker repository in artifactory-registry 4.7 -

i trying out registry version of artifactory supports docker repositories. created vagrant vm on mac , ran artifactory registry docker image forwarding ports 8081, 443. here vagrant file vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| config.vm.provision "docker" config.vm.hostname = "docker" config.vm.box = "phusion/ubuntu-14.04-amd64" config.vm.network "forwarded_port", guest: 8081, host: 8081 config.vm.network "forwarded_port", guest: 443, host: 443 # sync project in /vagrant directory inside vm config.vm.synced_folder ".", "/vagrant" end i able access artifactory ui @ http://localhost:8081 based on documentation trying access virtual docker repository @ docker push art.local:6555/ubuntu i host not found error get https://art.local:6555/v1/_ping: dial tcp: lookup art.local: no such host here nginx config shipped image ## add ssl entr...

c# - Encrypt the web.config file -

i trying encrypt connectiostring of web.config file.i ran cmd administrator , gave following commnad c:\windows\microsoft.net\framework\v4.0.30319>aspnet_regiis -pef provantisdataconnection" "c:\inetpub\wwwroot\psoc" encrypting configuration section... the configuration section 'provantisdataconnection' not found. failed! i have web.config file inside c:\inetpub\wwwroot\psoc , th <connectionstrings> section in web.config follows <connectionstrings> <add name="provantisdataconnection" connectionstring="data source=(description =(address = (protocol = tcp)(host = 10.00.00.0001)(port= 4321))(connect_data =(server = dedicated)(service_name = abc))));user id=abcd ;password=abcdd;pooling=true;min pool size=5;max pool size=60" providername="oracle.dataaccess.client" /> </connectionstrings> but still throws failed. when running aspnet_regiis, need indicate name of node want encrypt. can...

makefile - binary size of compiled git 4 times larger than installed one -

i compiled git first time because centos stucks @ 1.8.x. followed these instructions: make configure ;# ./configure --prefix=/usr ;# make doc ;# make install install-doc install-html;# root the compilation worked well, looking @ binaries noticed of them larger installed ones rpm. i.e. centos7 git binary is: by rpm (1.8.3.1) = 1,5mb self compiled (2.9.3) = 9,3mb i looked around didn't find switch compilation reduces size. comparing compiled binaries "ius community project" build (git 2.9.2.1 ~1,5mb), compiled ones 4 times larger. thanks hint, making them smaller ;-) the solution madscientist: strip solution, wasn't aware debug information included default. windows compiler produces debug set flag. it's 1,8 mb instead of 9,3

javascript - Open keyboard android, hidden content phonegap -

Image
i have problem when open keyboard android. i using phonegap make mobile application, works well, when press text box , open keyboard, later when close keyboard leave blank same size keyboard. i 've looked everywhere , can not find solution please me!!! attached screenshots thanks

sql - Get corresponding rows in single line result? -

given following data, how desired result below? timestamp | session id | event | name ------------------------------------------ 08:15 | 89 | login | scott 08:16 | 89 | edit | scott 08:16 | 92 | login | john 08:17 | 92 | refresh | john 08:23 | 89 | logout | scott 08:28 | 92 | logout | john 08:30 | 96 | login | scott 08:37 | 96 | logout | scott desired result (essentially list of session durations): name | login | logout ------------------------ scott | 8:15 | 8:23 john | 8:16 | 8:28 scott | 8:30 | 8:37 edit: extended sample data , results avoid confusion. the query i'm needing develop more complex . thought give me jumpstart on 1 of logic hurdles. since know want know i've tried, here current, embarrassing, iteration actual structure... select sessionid, samldata_organization, (select timecreated ens.messageheader h1,hs...

php - Laravel Session: sessions for subdomain is not setting on the browser -

is possible setup 2 different laravel project on same domain , same server different authentication??.. 1 on maindomain.com , 1 'sub.maindomain.com'. i've been trying setup config/session, config/auth, config/database different drivers/configurations still tokenmismatchexception many times, seems session not persisting or something, here's configuration: 'lifetime' => 120, 'expire_on_close' => false, 'driver' => env('session_driver', 'file'), // tried setting database, redis, file, cookie, 'domain' => env('session_domain', null), // tried setting null, '.maindomain.com', 'sub.maindomain.com', 'cookie' => 'maindomain_session', // subdomain, set 'sub.maindomain.com' i've tried different settings 2 project, keep on getting tokenmismatchexception sub-domain. don't know if set correctly though.. i've checked browser if session set in ther...

angularjs - Uncaught Error: A network error -

after i've tried use firebase authentication service, got uncaught error: network error (such timeout, interrupted connection or unreachable host) has occurred i have tried whitelist related domain-names: <allow-intent href="*.firebaseio.com" /> <allow-intent href="*.firebaseapp.com" /> <allow-intent href="*.google.com" /> <allow-intent href="*.googleapis.com" /> <allow-intent href="*.cloudflare.com" /> <allow-intent href="auth.firebase.com" /> <access origin="*" /> and ask internet user permission: <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> but still - despite code run on web browser, keep showing error on android emulator. try, this. worked me. <allow-navigation href="*.firebaseapp.com" /> ...

dump - Export data types from PostgreSQL schema -

i'd export data types postgresql specific schema. problem is, found way export whole schema , not data types. schema has more 2000 tables, , don't need this. there way export custom data types? this gets list of available datatypes - custom ones need filter first column (nspname): select n.nspname, typname, pg_catalog.format_type(t.oid, null) typefull pg_catalog.pg_type t left join pg_catalog.pg_namespace n on n.oid = t.typnamespace (t.typrelid = 0 or (select c.relkind = 'c' pg_catalog.pg_class c c.oid = t.typrelid)) , not exists(select 1 pg_catalog.pg_type el el.oid = t.typelem , el.typarray = t.oid) , pg_catalog.pg_type_is_visible(t.oid)

ios - Tableview not going bigger if expanding cell -

Image
i've implemented thing click on cell or button , tableview cell expand. problem if expand last cell behind tableview . how can make resize tableview , move cell little? i made constraints , views inside cell. it looks this, blue 1 main 1 , black going expand. i don't know code necessray how make expand. this inside cellforrowatindexpath : if (self.selectedindex == indexpath.row){ self.selectedindex = -1 }else{ self.selectedindex = indexpath.row } self.productstable.beginupdates() self.productstable.reloadrowsatindexpaths([indexpath], withrowanimation: uitableviewrowanimation.automatic) self.productstable.endupdates() } return cell this inside heightforrowatindexpath : if(selectedindex == indexpath.row){ return 210 }else{ return 135 } i tried detect last cell , move not working. check code func reloadchange() { let in...

pandas datetime slicing: junkdf.ix['2015-08-03':'2015-08-06'] not working -

junkdf: rev dtime 2015-08-03 20.45 2015-08-04 -2.57 2015-08-05 12.53 2015-08-06 -8.16 2015-08-07 -4.41 junkdf.reset_index().to_dict('rec') [{'dtime': datetime.date(2015, 8, 3), 'rev': 20.45}, {'dtime': datetime.date(2015, 8, 4), 'rev': -2.5699999999999994}, {'dtime': datetime.date(2015, 8, 5), 'rev': 12.53}, {'dtime': datetime.date(2015, 8, 6), 'rev': -8.16}, {'dtime': datetime.date(2015, 8, 7), 'rev': -4.41}] junkdf.set_index('dtime',inplace=true) why can't datetime slicing described at: python-pandas-dataframe-slicing-by-date-conditions time series datetime slicing junkdf['2015-08-03':] c:\users\blah\anaconda3\lib\site-packages\pandas\core\base.py in searchsorted(self, key, side, sorter) 1112 def searchsorted(self, key, side='left', sorter=none): 1113 # needs coercion on key (datetimeindex already) -> 111...

c# - Postback Issue with Javascript Popup -

i know there lot of questions similar one, don't see quite same. have aspx page , using javascript show confirmation popup. when clicking on button, value click isn't used instead previous value is. if click ok first time cancels. if click ok second time goes ok, if click cancel still goes ok, click cancel once again , goes cancel. i'm sure issue postback, don't know how resolve since i'm not calling javascript on button click, later on. use code behind determine if record duplicate , if show popup letting user know, , giving them option accept or cancel. if there no duplicate script popup doesn't called. how resolve issue? javascript in aspx function confirm() { var confirm_value = document.createelement("input"); confirm_value.type = "hidden"; confirm_value.name = "confirm_value"; if (confirm("duplicate record. want save?")) { confirm_value.value = "yes"; } else { con...