Posts

Showing posts from August, 2012

angular - how can I pass data from html to component(angular2) -

this question has answer here: rendering js jinja produces invalid number rather string 1 answer in index.html can print these (keys,name,email)values <body> {{keys}} {{name}} {{email} </body> <component-app></component-app> these flask this return render_template("index.html",keys=my_keys,name=my_name,email=my_email) i want pass keys,name,email data component-app, should do? or can pass data flask angular2's component?? the short answer: no, can't. can create global js variables <body> <script type="text/javascript"> keys = '{{keys}}' name = '{{name}}' email = '{{email}' </script> </body> then in component public keys = window['keys']); and in angular html {{ keys }}

rabbitmq - How to use Rabbit inside a gitlab-ci.yml file? -

i want test gitlab-ci.yml rpc nameko server. i can't succeed make work rabitt inside .gitlab-ci.yml :: image: python:latest before_script: - apt-get update -yq - apt-get install -y python-dev python-pip tree - curl -i http://guest:guest@rabbitmq:8080/api/overview mytest: artifacts: paths: - dist script: - pip install -r requirements.txt - pip install . - pytest --amqp-uri=amqp://guest:guest@rabbitmq:5672 --rabbit-ctl-uri=http://guest:guest@rabbitmq:15672 tests # - python setup.py test - python setup.py bdist_wheel look: stage: deploy script: - ls -lah dist services: - rabbitmq:3-management the rabbit start correctly:: 2017-04-13t18:19:23.436309219z 2017-04-13t18:19:23.436409026z rabbitmq 3.6.9. copyright (c) 2007-2016 pivotal software, inc. 2017-04-13t18:19:23.436432568z ## ## licensed under mpl. see http://www.rabbitmq.com/ 2017-04-13t18:19:23.436451431z ## ## 2017-04-13t18:19:23.436468542z #########

vb.net - Is format ####0.000000 different to 0.000000? -

i working on legacy code @ moment , have come across following: foostring = string.format("{0:####0.000000}", foodouble) my question is, format string here, ####0.000000 different 0.000000 ? i'm trying generalize return type of function sets foodouble , checking make sure don't break existing functionality hence trying work out # add here. i've run couple tests in toy program , couldn't see how result different maybe there's i'm missing? from msdn the "#" custom format specifier serves digit-placeholder symbol. if value being formatted has digit in position "#" symbol appears in format string, digit copied result string. otherwise, nothing stored in position in result string. note specifier never displays 0 not significant digit , if 0 digit in string. display 0 if significant digit in number being displayed. because use 1 0 before decimal separator 0.0 - both formats should retur

sql vs python approach to check duplicates -

hello have 2 files this: (with millions lines) (1º) aaa bbb ccc (2º) aaa ccc ddd so should faster if want check lines in first file not in second file? should put these data table , make query or should let python this? this output want: (3º file) aaa bbb ccc ddd thank all! in python can use set , perform set operations on such adding them up, getting intersection , things that. i use set in python result. following give result mentioned. first =set(['aaa','bbb','ccc']) second = set(['aaa','ccc','ddd']) third = first.union(second) print(third) as question faster, depends on data. if fits in memory python-only way faster.

ios - Can i only display text in tab bar item and change the style and position -

Image
i add tab bar in storyboard, , not want set image tab bar item, , following: how can change font , position title of bar item in storybord? first select tab bar item in storyboard, in attributes inspector set system item , title position custom, able change position of title setting values horizontal , vertical boxes. finally, change font, in viewdidload() , include: uitabbaritem.appearance().settitletextattributes([nsfontattributename: uifont(name: "avenir-blackoblique", size:20)!, nsforegroundcolorattributename: uicolor.blue], for: .normal) nsfontattributename allow change font style , nsforegroundcolorattributename allow change font color.

Bootstrap Typeahead.js creates confusing situation in near 2 inputs -

Image
hello guys? have 2 typeahead autocomplete inputs in 1 page. shown in picture. problem when focusing on first input second 1 focused or activated. creates confusing situation. should do? how disable focusing or close second input? appreciated! thanks.

python - object has no attribute 'loads' in UnitTest class -

im trying run tests in python. im using unittest framework. the test "test_processjson" uses test json, dictteststring, , checks if has 1 or more elements. script "testing.py" import json import starter#the code im trying test import unittest class mytests(unittest.testcase): def test_processjson(json): dictteststring = '{"city":"barcelona"}' jtest = json.loads(dictteststring) dictprocess = starter.processjson(dicttest) self.assertequals(dictprocess["city"], "barcelona") if __name__ == '__main__': unittest.main() the problem comes when run test error: traceback (most recent call last): file "testing.py", line 16, in test_processjson jtest = json.loads(dictteststring) attributeerror: 'mytests' object has no attribute 'loads' i'm new python, i've been looking answer of mistakes i've seen im not

spring - Elasticsearch doesn't work after create repository No qualifying bean of type 'java.lang.Class<org.springframework.data.repository.Repository<?, ?>>' -

hello have problem spring data elasticsearch can connect elasticsearch after create repository program stop working code. thank in advance solve problem @configuration @enableelasticsearchrepositories(basepackages = "com.storyworld.repository.elastic") public class elasticsearchconfig { private static final string property_elastic_host = "localhost"; private static final int property_elastic_port = 9300; private static final string property_elastic_cluster_name = "elasticsearch"; @bean public elasticsearchoperations elasticsearchtemplate() throws exception { return new elasticsearchtemplate(client()); } @bean public client client() throws exception { settings essettings = settings.settingsbuilder().put("cluster.name", property_elastic_cluster_name).build(); return transportclient.builder().settings(essettings).build().addtransportaddress( new inetsockettransportaddress(inetaddress.getbyname(property_elastic_host)

GitHub project deployment failed on azure -

Image
i want deploy .net project github repository azure server. in deployment options getting building failed error. here screen shots of deployment details , logs 1- deployment details: 2- activity log: according description , logs, found have error in msbuild step. the error shows files not found in project. suggest exclude related files in csproj file or make sure related files in project. besides, suggest firstly clone project local , test , make sure project build without error publish github , deploy azure. update: i write test demo on computer , reproduce error. error image: i think in project have inclued bin , obj folder project , push project github. like below: after push project github, csporj file include bin , obj references. like below: this reason msbuild fail. so suggest uninclude bin , obj folder in local , push github again. work well.

javascript - making the profile photo upload popup ONLY AFTER varifying the form -

in form, have done varification of password , works properly, added pop profile photo upload meant popup after form has been varified, doesnt happen, pops if 2 passwords arent same. this html code <p class="smedia"> <a href="" class="fb sign">sign facebook</a> <a href="" class="google plus">sign google+</a> </p> <p class="or"> or </p> <label for="name"> name </label> <input type="text" id="name" name="user_name" required="required" /> <label for="mail"> email </label> <input type="email" id="mail" name="user_email" required="required" placeholder="mymail@example.com" /> <label for="password"> password</label> <input type="password

sharepoint - CAML Query SPException -

i'm trying execute caml query, have spexception every time. here query : <where> <and> <eq> <fieldref name='user' /> <value type='computed'> " + foo + " </value> </eq> <and> <eq> <fieldref name='title' /> <value type='computed'> " + bar + " </value> </eq> <eq> <fieldref name='month' /> <value type='computed'> " + xyz + " </value> </eq> </and> </and> </where> here use. var query = new spquery { query =

meteor - how to write if is not equal in blaze -

i have in js file: isadmin: function() { if (meteor.user().roles[0] == "admin") { return true; } else { return false; } }, in html want if admin ==false.how it? this true condition : want false {{#if isadmin}} ... {{/if}} is posible this? {{#if !isadmin}} ... {{/if}} i guess looking is {{#unless isadmin}} ... {{/unless}} have here @ docs. btw, if using alanning:roles package, includes handy little helper blaze. {{#unless isinrole 'admin'}} ... {{/unless}} hope helps.

mysql - Time Dependent Joins -

i have 2 tables have start , end date each each on both tables , need join them record valid dates on both tables table 1 empid startdate enddate 1 1/2/2017 12/31/9999 1 8/10/2016 1/1/2017 1 10/11/2015 8/9/2016 1 2/10/2014 10/19/2015 table2 jobid empid startdate enddate j1 1 1/2/2017 12/31/9999 j2 1 8/10/2016 1/1/2017 j3 1 2/10/2014 8/9/2016 result set should empid startdate enddate 1 1/2/2017 12/31/9999 j1 1 8/10/2016 1/1/2017 j2 1 10/11/2015 8/9/2016 j3 1 2/10/2014 10/19/2015 j4 thanks in advance sri you can test query this: select t1.* ,t2.jobid table1 t1 left join table2 t2 on t1.empid = t2.empid , t1.startdate = t2.startdate , t1.enddate = t2.enddate;

razor - How to call a jQuery function which in same project but different folder in ASP.Net MVC 5? -

i trying call function linkwallet () function named customernew () linkwallet () in file named walletdetails . cshtml while customernew () in file named create . cshtml the problem while both these files in same project, in different folders under mvc's views section. create . cshtml in views/customer/create.cshtml walletdetails . cshtml in views/customerwallet/walletdetails.cshtm l how can call stated function 1 class anther? don't rewrite , googling didn't help. we not call views, actions! calling action different controller need call proper url it. example if want call action walletdetails controller customerwallet , url in jquery load function or ajax function should /customerwallet/walletdetails/{id}.

php - Why submit transaction every row is so slow? -

Image
the table empty @ first . when commit transaction after 20000 row ,it cost less 1 second . $stmt = $conn->prepare("insert iptable (ip) values (?)"); $stmt->bind_param("i", $ip); $conn->query('begin'); for( $count = 0 ; $count < 20000 ; $count ++){ $ip = rand(1,10000000); $stmt->execute(); } $conn->query('commit'); $stmt->close(); $conn->close(); with time command time php test.php real 0m0.785s user 0m0.220s sys 0m0.096s but when commented out $conn->query('begin'); $conn->query('commit'); , run more 20 minute , don't know how time have wait finish .i have stop ctrl-c . $stmt = $conn->prepare("insert iptable (ip) values (?)"); $stmt->bind_param("i", $ip); //$conn->query('begin'); for( $count = 0 ; $count < 20000 ; $count ++){ $ip = rand(1,10000000); $stmt->execut

c++ - How to read spaces from .txt file in QT -

i trying load sample text file 8488 characters (including spaces) can organise words in text file alphabetical order in gui (to create dictionary essentially). the .txt file loads text can not read spaces file, shows of words no spaces between i have class dictionary , within dictionary.cpp source file attempt load , read text file shown below. void dictionary::loadfile(const char *filename) { char value; ifstream f_in(filename); if (!f_in) { cerr << "\nerror loading file!" << endl; exit(1); } else { cout << "file loaded successfully\n" << endl; } (int = 0; < 8488; i++) { f_in >> value; memory[i] = value; cout << memory[i]; } } can explain may have went wrong? i'm quite new working classes, particularly in qt creator. issue has been fixed. i used f_in >> noskipws; to acknowledge white

swift - how to make an SKSpriteNode follow another SKSpriteNode -

running trouble code. i'm trying make zombies follow player around following code: class gamescene: skscene, skphysicscontactdelegate { func enemies() { enemy = skspritenode(imagenamed: "spaceship") enemy.size = cgsize(width: 50, height: 50) enemy.color = uicolor(red: 0.9, green: 0.1, blue: 0.1, alpha: 1.0) enemy.colorblendfactor = 1.0 //physics enemy.physicsbody = skphysicsbody(rectangleof: enemy.size) enemy.physicsbody?.isdynamic = true enemy.physicsbody?.affectedbygravity = false enemy.name = "enemy" enemy.position.y = -frame.size.height/2 let positionx = arc4random_uniform(uint32(frame.size.width)) enemy.position.x = cgfloat(positionx) addchild(enemy) } override func didmove(to view: skview) { enemytimer = timer.scheduledtimer(timeinterval: 0.5, target: self, selector: #selector(gamescene.enemies), userinfo: nil, repeats: true

javascript - Force page to refresh after a POST angularjs -

i tried put $ state.reload in controller after post request, not refresh page. therefore, after register form, data not updated on page .. obliged refresh manually shows me right data. .controller('editctrl', function($scope, $stateparams, $state, appservice) { $scope.infos = appservice.getobject(); console.log($scope.infos); appservice.user($scope.infos).then(function(response){ $scope.user = response; console.log($scope.user); }); $scope.save = function (currobj) { appservice.edituser($scope.form,$scope.infos).then(function(response){ appservice.addobject(currobj); console.log(currobj); $state.reload('menu.infosuser'); $ionicloading.hide(); $state.go('menu.infosuser',{reload: true}); }); }; }) i reply possible proposals :) if want reload page use location.reload() reloading page like .controller('editctrl', function($scope, $stateparams, $st

Regex to capture email id which start just after some special string -

i have many thunderbird exported file. need collect email id each file. emails bounced email id, thats why need remove them our system. the string reporting-mta: dsn; a27-19.smtp-out.us-west-2.amazonses.com action: failed final-recipient: rfc822; mrinalkantighosh005@gmail.com diagnostic-code: smtp; 550-5.1.1 email account tried reach not exist. please try every email id start final-recipient: rfc822; mrinalkantighosh005@gmail.com so format final-recipient: rfc822; email_id_here can guys please let me know regex extract email id. thanks in advance. update: able extract email ids. regex selecting email ids:- (?:[a-z0-9!#$%&'+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]‌​+)*|"(?:[\x01-\x08\x‌​0b\x0c\x0e-\x1f\x21\‌​x23-\x5b\x5d-\x7f]|\‌​[\x01-\x09\x0b\x‌​0c\x0e-\x7f])")@(?:(‌​?:[a-z0-9](?:[a-z0-9‌​-]*[a-z0-9])?\.)+[a-‌​z0-9](?:[a-z0-9-]*[a‌​-z0-9])?|[(?:(?:‌​25[0-5]|2[0-4][0-9]|‌​[01]?[0-9][0-9]?)\.)‌​{3}(?:25[0-5]|2[0-4]‌​[0-9]|[01]?[0-9][0

html - Removing Border / Background using Custom CSS -

Image
i have custom 404 page. example of same can found @ http://www.techquark.com/123123 i need make box border go away , background white. for pasted below css : .status-msg-border {border: 0;} .status-msg-body {background-color: #ffffff;} .status-msg-wrap {width: 100%; margin: 0px auto;} .status-msg-bg {background: transparent;} but it's not working , box still has border , color. below 404 page code : <div class='status-msg-wrap'> <div class='status-msg-body'> <div style="text-align: center;" trbidi="on"> <h2> 404 page not found</h2> sorry page looking cannot found. <br/><br/> if you're in denial , think conspiracy cannot possibly true, please try using search box below or <a href="http://www.techquark.com/p/contact-us.html" target="_blank">contact me</a>. <br/><br/> <form action="/search" id="searchthis" method="get&q

angular - Extension for window.Node in Typescript -

i'm trying add new method window.node interface node { mymethod(selector: any): } node.prototype.mymethod = (selector) => { //some code } and use in code, method not defined. can understand after running "ionic serve" code not included in build version. my tsconfig.json file "compileroptions": { "allowsyntheticdefaultimports": true, "declaration": false, "emitdecoratormetadata": true, "experimentaldecorators": true, "lib": [ "dom", "es2015" ], "module": "es2015", "moduleresolution": "node", "sourcemap": true, "target": "es5" }, "files": [ "src/app/customextensions/extensions.ts" //file new method ], "include": [ "src/**/*.ts" ], "exclude": [ "node_modules" ], "compileonsa

go - Runtime structure using reflection -

assume have data model written in sort of yaml file. schema: human type: object properties: name: type: string surname: type: string i parse it, , generate structure: type human struct { name string `db:"name"` surname string `db:"surname"` } is possible generate runtime go struct using reflection? yes, can reflect.structof : stype := reflect.structof([]reflect.structfield{ {name: "name", type: stringtype, tag: reflect.structtag(`db:"name" json:"name"`)}, {name: "surname", type: stringtype, tag: reflect.structtag(`db:"surname" json:"surname"`)}, }) sv := reflect.new(stype) svi := sv.interface() b, err := json.marshal(svi) fmt.printf("%s %v", b, err) prints {"name":"","surname":""} <nil> playground: https://play.golang.org/p/u4n3bbj5n8 . but others have said, it's better generate

c++ - How to print out a struct pointer? -

i'm trying print out structs have made inside function, , since these must available outside of function have used pointers. have declared struct , functions in header file: struct car{ double wheeldiam; int numberofwheels; string brand; }; void makecars(); ostream & operator<<( ostream & out, const car & elem ); void printcar( car car); the function makes cars looks this: void makecars(){ car *astonmartin; car *volvo; car *audi; audi->numberofwheels = 4; audi->wheeldiam = 20.0; audi->brand = "audi"; volvo->numberofwheels = 4; volvo->wheeldiam = 23.0; volvo->brand = "volvo"; astonmartin->numberofwheels = 5; astonmartin->wheeldiam = 25.0; astonmartin->brand = "aston martin"; } and have made function prints out struct (overloaded operator=): ostream & operator<<( ostream & out, const car & elem ){ out << elem.brand<

javascript - Is there any way to send multipart form request to graphql in reactjs with apollo client -

i new react graphql. i want upload .pdf file server via network interface. all need write graphql query using apollo client sends multipart form data server. i tried search on google did't found proper solution. mutation createuser($user: myfile) { createdata(myfile: $user) { id name email } } graphql doesn't deal multipart data or file uploads, if writing server can create custom request type has more fields query , , make work. this guy did here . this rather roundabout way go @ give lots of headaches. recommend being less stubborn single endpoint, , use different server manage upload. after all, there lots of tested libraries dealing "the devils details" surrounding uploads.

Multiple Service Layer and Repository Pattern managed with Events -

i know topic regarting service layer , repository pattern, "i still haven't found i'm looking for" ( u2 docet ... ) i'm working complex application dozen of services , repositories; pattern, show example, this: controller $return = $this->getuserservice()->findall(); class userservice public function findall() return $this->getuserrepository()->findall(); class userrepository /** * * @return collection of usermodel */ public function findall(){ $sql = "select * `user` "; return $this->fetchall($sql); } so, every table in database, there these entities: {entity}service {entity}repository {entity}model in controller, have collection of usermodel objects, returned repository layer through service layer. all sounds good, until work single table; how work if have work multiple services/repositories? 1) question number 1 let want send email after operation , increase stats; in controller, probabply in service laye

plsql - How can I convert this SAS datastep to oracle sql for a conditional counter column? -

i apologize generalness of question. i'm trying create column groups rows based on time between current , previous observation. code below code i' wrote works correctly in sas. because of way data step runs vs how oracle sql runs can't figure out how in oracle sql. appreciated! data group; set lag1; customer_key; if (time_btw>5 or time_btw=.) journey=0; journey+1; if first.customer_key group=0; if journey=1 group+1; run; it looks defining groups based on time_btw . seem want analytic function. think code this: select t.*, sum(case when time_btw > 5 1 else 0 end) on (partition customer_key order ??) grp t; note in sql (unlike sas), tables represent unordered sets. means need column specifies ordering.

gcc - Compiling x86 and c with makefile -

i've been writing c 2-3 years , picked assembly use windows i've never needed use make files before i've used visual studio. i'm trying use cygwin , i686 cross compiler compile c , assembly files, , link them binary file representing operating system. new make files don't know how properly. i've got far makefile : cc = i686-elf-gcc cc_flags = -c -std=gnu99 -ffreestanding -o2 -wall -wextra -i./include = i686-elf-as ld = i686-elf-gcc -t linker.ld -o myos.bin ld_flags = -ffreestanding -o2 -nostdlib -lgcc o_files = $(wildcard src/*.o) all: $(o_files) $(ld) $(ld_flags) $(o_files) src/%.o: src/%.c $(cc) $(cc_flags) -o $@ $< src/%.o: src/%.asm $(as) -o $@ $< i'm getting error stating linker can't find entry symbol _start nothing compiling. how fix this? my src/linker.ld file defines _start entry point is: entry(_start) sections { . = 1m; .text block(4k) : align(4k) { *(.multiboot)

pandas - How do I plot the output of numpy.fft in bins? -

Image
i wrote python code plots fast fourier transform of pandas dataframe called res , contains 2 columns of data ("data" , "filtered"): fft = pd.dataframe(np.abs(np.fft.rfft(res["data"]))) fft.columns = ["data"] fft["filtered"] = pd.dataframe(np.abs(np.fft.rfft(res["filtered"]))) fft.index=np.fft.fftfreq(len(res))[0:len(fft)] fft.plot(logy=true, logx=true) the res dataset contains original randomised datapoints in "data" column along same data after passing through filter. output looks reasonable me; while plot correct, it's not useful at. how can organise data smaller number of discrete frequency bins make easier understand?

php - Array_Key_Exists... 0 != 0 / Working local, not working on server? -

i wrote script supposed create repeater array based on name key in $globals array. dons't work. the script says, name wasn't found. can see name i'm looking @ bottom of page: debug.txt at beginning can see array in search key. , can see, names exists key i'm looking for... names printed @ bottom of name needles script working with. so, tried to check if method array_key_exists(...) getting key 0. also, method doesn't found key in array... can see in last line of debug.txt file... i'm checking this: if(array_key_exists(0, $globals["productsxml"])){ fwrite($myfile, "\n\n ja! 0 = 0"); }else{ fwrite($myfile, "\n\n nein! 0 != 0"); } and check names use 1 search keys: function searchforgamexml($title){ if(array_key_exists($title, $globals["productsxml"])){ return true; }else { return false; } } the $title needle @ bottom of page can see. don't get, why

x3d - Volume rendering with color and light in x3dom -

how colorize volume in x3dom. there few examples out there , can't work. some code tried ( full example on codepen ): <volumedata id='brainvolume' dimensions='192 228 192'> <imagetextureatlas containerfield='voxels' url="https://i.imgur.com/3ydy8cq.jpg" numberofslices='193' slicesoverx='14' slicesovery='14'></imagetextureatlas> <shadedvolumestyle lighting='true' shadows='true'> <material diffusecolor='1.0 0 0' specularcolor='1 0 0' ambientintensity='0.4'/> </shadedvolumestyle> </volumedata> when add light scene doesn't render (just uncomment line on codepen example). never found example light source added.

Stanford NLP training documentpreprocessor -

does stanford nlp provide train method documentpreprocessor train own corpora , creating own models sentence splitting? i working german sentences , need create own german model sentence splitting tasks. therefore, need train sentence splitter, documentpreprocessor . is there way can it? no. @ present, tokenization of european languages done (hand-written) finite automaton. machine learning-based tokenization used chinese , arabic. @ present, sentence splitting languages done rule, exploiting decisions of tokenizer. (of course, that's how things now, not how have be.) at present have no separate german tokenizer/sentence splitter. current properties file re-uses english ones. sub-optimal. if wanted produce german, great have. (we may @ point, german development not @ top of list of priorities.)

amazon web services - AWS (SNS) Platform EndPoint is disabled itself apple device (Not publishing anything) -

i using aws sns working fine stop working , when try publish message aws console, says end point "endpoint disabled (service: amazonsns; status code: 400; error code: endpointdisabled; request id: 27a183ab-2940-54b0-8ad3-d2c1fd5ba0c0)" we used different token , assuming can device token issue. no luck. can resolve.

Batch - Emoji Colors -

this question has answer here: how have multiple colors in windows batch file? 13 answers i'm making sport game in batch , need: 1 of emoji people blue, , other emoji people red. how can possibly that? thinks can maybe this: set (emoji)=color 04 i hope understood me. please , ask questions if don't need. some of asking code: @echo off :start title sport game echo pick team: echo. echo 1. blue echo 2. red set /p start= if %start%== 1 goto blue if %start%== 2 goto red echo plase give me number.. pause goto start :blue cls echo on blue team! pause :red cls echo on red team! pause you can try cecho.exe . put .exe file windows directory (%windir%) , can use normal command. usage cecho.exe {04}text in red{#} text in original color{\n} {xx} color code {#} revert

javascript - How do I make a save button that will make a .html file? -

i making code tester , wondering how make save button code tester. intent make save .html file in "u" directory on site shows them link saved code. example: http://jswebsite.co.nf/u/1.html . here code: <iframe src="menu-bar.html" height="45" width="1300" align="right" scrolling="no" frameborder="0"></iframe> <br /> <br /> <br /> <!-- code tester starts --> <div class="center-page"> <!-- code tester scripts starts --> <script src="http://jswebsite.co.nf/code-tester-javascript.min.js"></script> <!-- code tester scripts end --> <p>if press ctrl + enter, code open in new tab. if press "test html code" button, code open in new window if using chro

json - KeyError: 0 in Python -

i'm trying values of first object's direction , station returned in json, i'm getting following error keyerror: 0 here's code: print(json.dumps(savedrequest, indent=4)) savedstation = savedrequest[0]['station'] saveddirection = savedrequest[0]['direction'] and it's returning in print: { "-bas": { "email_address": "dd3@gmail.com", "direction": "southbound", "station": "place-har" }, "-bus": { "email_address": "dd4@gmail.com", "direction": "southbound", "station": "place-su" } } i don't know -bas or -bus going when gets returned, need select first object in array. your json decoded "object" (called dict in python), it's not array. such, has no particular "order". think &qu

c# - Format a date so it can be written into Oracle ("Not a valid month" error) -

having trouble finding proper syntax this. here's field on asp side: <input type="text" id="ei_open_auditstartdt" class="datepicker" runat="server" name="ei_open_auditstartdt" value='<%#eval("audit_start_date") %>' style="width: 100px" /> here's part of code-behind in c#: htmlinputtext ei_open_auditstartdt = (htmlinputtext)datagrid_open.rows[e.rowindex].findcontrol("ei_open_auditstartdt"); textbox ei_open_transcit = (textbox)datagrid_open.rows[e.rowindex].findcontrol("ei_open_transcit"); string startdt = string.format("{0:dd-mmm-yyyy}", ei_open_auditstartdt.value); string transcit = ei_open_transcit.text; datagrid_rootcauses.editindex = -1; oracleconnection conn = getconnection(); try { using (oraclecommand cmd = new oraclecommand("cst_amr_write_openstatus", conn)) { cmd.commandtype = commandtype.storedprocedur

sapui5 - how to get 1 item from a data binding in the controller? -

i have table filled data via data binding. , in controller i'm trying loop on items of databinding. have far can't work. colorrows : function(otable) { var items = otable.getbinding("items"); var rowcount = items.length; //number of visible rows var currentrowcontext; (var = 0; < rowcount; i++) { currentrowcontext = items[i].getvalue(); //this won't work } } so need value item index matches i. edit: i'm using sap.m.table as keshet mentioned, depends on table using. here exapmle sap.ui.table.table . first context of each row , can access data saved on row (btw, there no such thing rowvalue): colorrows: function(otable) { var arows = otable.getrows(); var currentrowvalue; (var = 0; < arows.length; i++) { var orowcontext = otable.getcontextbyindex(i); if (orowcontext) { var orowobject = orowcontext.getobject(); // or can use getproperty method var osinglevalue = orowcontext.getproperty("

visual studio - Sort output of Get-Migrations ascending? -

by default, get-migrations command, when run in visual studio package manager console, returns list of entity framework migrations have been applied target database in descending order. is, list sorted have recent migrations first. is there way make get-migrations return list of migrations in ascending order, is, oldest migrations first, instead? what i've tried far: piped output sort-object cmdlet, e.g. get-migrations [my params] | sort-object -property name (i'm not sure property name specify, or if applicable?). of these attempts silently failed (no error message displayed, no change in get-migrations output). looked @ powershell get-migrations ( get-help get-migrations ) , searched web see if get-migrations has parameter controls output sort order. couldn't find one. output of get-migrations command i'm getting: pm> get-migrations [my arguments...] retrieving migrations have been applied target database. 201704121534436_somemigration999 20170

c# - WPF PasswordBox hint not working -

Image
i'm trying style passwordbox in wpf can show hint . i'm doing using following code in resourcedictionary: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:budgetbuddy.styles"> <style x:key="pbhintstyle" targettype="{x:type passwordbox}"> <setter property="background" value="{dynamicresource {x:static systemcolors.windowbrushkey}}"/> <setter property="borderbrush" value="#ffabadb3"/> <setter property="foreground" value="{dynamicresource {x:static systemcolors.controltextbrushkey}}"/> <setter property="borderthickness" value="1"/> <setter property="keyboardnavigation.tabnavigation" value="no

c - Unexpected output after linking -

i have 2 c files: main.c #include <stdio.h> int sum(int n); double array[2] = { 0.001, 1.0001 }; int main() { int val = sum(2); printf("%d\n", val); return 0; } sum.c extern int array[2]; int sum(int n) { int i, ret = 0; (i = 0; < n; i++) { ret += array[i]; } return ret; } i compile , link files , run executable, getting unexpected output: 306318409 why happening? c standard section 6.2.7/2 says all declarations refer same object or function shall have compatible type; otherwise, behavior undefined. so have happened. that's when lie compiler.

From 3D accelerometer to tilt angle +180/-180 - Android -

i'm trying obtain tilt angle of device using accelerometer. cheap android phone i'm using not support type_magnetic_field i'm trying use formulas on raw accelerometer values. i thought had find answer on thread: 3d accelerometer calculate orientation i left comment on there maybe needs own thread. the voted answer there is: roll = atan2(y, z) * 180/m_pi; pitch = atan2(-x, sqrt(y y + z z)) * 180/m_pi; at first worked great until increased pitch towards 90 degrees while keeping other axis steady. passed 70 degrees of pitch, roll surged , time @ 90 degrees of pitch, roll indicated on 100 degrees of tilt , kept progressing 180 kept moving pitch past 90 degree limit. the workaround found far , it's not solution me change roll formula to: atan2(y, sqrt(x x + z z)) * 180/m_pi; with formula, roll angle behaves regardless of pitch range restricted +90/-90 degrees instead of +180/-180 need. any ideas on how modify formula allow range of 180 , address pitch pro

Saving binary content of pdf file to javascript variable -

is possible save binary content of pdf javascript variable? have webpage url saving pdf file , need save pdf file javascript variable. guess should binary data. you can use xhr response type blob : var oreq = new xmlhttprequest(); oreq.open("get", "/myfile.pdf", true); oreq.responsetype = "blob"; oreq.onload = function(oevent) { var blob = oreq.response; // `blob` contains pdf content }; oreq.send(); source: sending , receiving binary data, mdn

ionic framework - iOS10.3.1 - <Cordova/CDVViewController.h> file not found - After Upgrade -

i running ionic app successfully, when upgraded ios10.3.1 , xcode 8.3.1 whenever create new project , build error <cordova/cdvviewcontroller.h> file not found how fix this. how downgrade lower versions. cordova cli: 6.5.0 ionic cli version: 2.2.1 ionic app lib version: 2.2.0 ios : 4.3.1 in xcode 8.3.2 solved running: ionic resources ionic platform remove ios ionic platform add ios src: https://forum.ionicframework.com/t/cdvviewcontroller-h-file-not-found/89548

elixir - How can I use IEx.pry without mix -

i know can breakpoint using iex.pry when run application iex -s mix . i working on elixir exercises not use mix. run using elixir myfile.exs . how can run file using iex can use iex.pry breakpoints inside application? edit: here files: # hello_world.exs defmodule helloworld @doc """ greets user name, or saying "hello, world!" if no name given. """ @spec hello(string.t) :: string.t def hello(name \\ "world") "hello, #{name}!" end end # hello_world_test.exs if !system.get_env("exercism_test_examples") code.load_file("hello_world.exs", __dir__) end exunit.start exunit.configure exclude: :pending, trace: true defmodule helloworldtest use exunit.case test "says hello no name" assert helloworld.hello() == "hello, world!" end end outputs: ➜ hello-world elixir hello_world_test.exs excluding tags: [:pending] helloworldtest * test says hello

java - Floating Action Button over Scrollview? -

Image
i'm revamping app follow more "material design-ey", have run trouble fab. have scrollview 2 floating action buttons: when scroll bottom, fabs cover content. want able scroll little past bottom fabs can align_parent_bottom without overlapping anything: (should able scroll little more fabs aligned below) (before scrolling down) how create space @ bottom of app after scrolling down max fabs rest? <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#68d9cc"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <relativela

mongodb - Why is my mongo migration with Wired Tiger 10x slower than MMAP? -

i have pretty simple data migration, we're splitting embedded documents out of 1 collection own collection. have 140,000 records create. in testing on local mongo 3.4 mmapv1 migration took 20 minutes run. in production, migration took on 4 hours run! i did experiments, switched local storage wt , imported data , ran migration again, took 4 hours, difference being wt storage configuration (with defaults including snappy compression). loading initial dataset fast mmap or wt, suspect compression not issue, curious if knows why such drastically different result between 2 data storage mechanisms

Eclipse Hanging on Scanner File Redirection (java) -

i working on program involved taking input stdin intention of having input redirected file. method of doing use scanner class read line, , perform string operation. i doing in eclipse neon. using run configurations > common > input file option automate redirection on running program , letting output print console. what finding every time run program, code hangs on last line of file, , not terminate until signal eof ctrl+z (windows). went , opened old projects , noticed same trend , confident didn't have problem before , haven't changed code. below code example: import java.util.scanner; public class main { public static void main(string[] args) { scanner sc = new scanner(system.in); string s; string = ""; while(sc.hasnextline()){ s = sc.nextline(); everything.concat(s); system.out.println(s); } system.out.println(everything); sc.close(); }} it seems hasnextline() blocking waits input, ter