Posts

Showing posts from July, 2015

rxjs - In what order is the observable code called? -

in following code, having hard time understanding order of chained calls are: function registerdomain(casewebsiteurl) { return this._adminservice.registerdomain(casewebsiteurl.url) .concatmap(registerid => observable.interval(5000) .mergemap(() => this._adminservice.getchange(registerid)) .takewhile((info) => info.changeinfo.status.value !== 'insync') ) } registerdomain.subscribe(res => console.log('res:'+res)); i trying understand above code, having hard time understanding order. easier me understand when see more simple example this: function registerdomain() { return register() .concatmap(registerid => rx.observable.interval(5000) .mergemap(() => getchange(registerid)) .takewhile((info) => info === 'pending') ); } registerdomain().subscribe(x=>console.log(x)); function register() { return rx.observable.of("registerid"); ...

javascript - Element value set by modal button action is not working in jquery? -

my code jquery is: (this trigger on modal button click) $(document).on('click', '.js-modal-remove-button', function () { $('#code-output').attr('da-url',"1111"); }); my code html is: <input type="hidden" name="problemcode" id="code-output" da-url=2/> problem there button in page, on button click modal opens , in modal there button contains class js-modal-remove-button on action of need set main page(on modal opening button present) da-url value just , class button , use jquery html <button class="js-modal-remove-button model_button_class"></button> jquery $(document).on('click', '.js-modal-remove-button .model_button_class', function () { $('#code-output').attr('da-url',"1111"); }); here .model_button_class class . thing you.

Bitbucket and Jenkins remote build trigger -

Image
what trying achieve trigger build bitbucket when pr created using remote trigger option in jenkins. created job in jenkins , configured trigger build remote api. in bitbucket created webhooks trigger build following url structure http://jenkins_server_ip:port/job/job-name/build?token=<t1> i getting following error <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <title>error 403 no valid crumb included in request</title> </head> <body> <h2>http error 403</h2> <p>problem accessing /job/android-sample/build. reason: <pre> no valid crumb included in request</pre> </p> <hr> <a href="http://eclipse.org/jetty">powered jetty:// 9.4.z-snapshot</a> <hr/> </body> </html> digged internet , says need use cru...

outlook - VBA to move email folders & contents -

i stumped work on script move email folder (& contents) different parent folder. folder no under parent inbox. have basic, self-taught understanding of vba. eg. thisoutlooksession/[foldera] move thisoutlooksession/inbox/[foldera] ive found lots of examples move emails not folders. thanks in advance assistance. edit: private sub importfolder() <br> ''''''''' '' assume example im not overloading code have created csv im drawing data from, opened in excel & macro running outlook ''''''''' dim xlwkb object ' workbook dim xlsht object ' worksheet set xlsht = xlwkb.worksheets(1) 'set active being first worksheet dim irow integer dim chilcol integer dim parentfoldername irow = 1 'set start row1 chilcol = 1 'set start cola 'set parent static nomination in head macros while xlsht.cells(irow, 1) <> "" 'while parent not blank if chilcol <...

concatenation - Excel / DAX Averaging Issue -

Image
thank taking time @ question. dax doesn't allow durational values, in order work out average value list of durational values, i've split durations component 'hour', 'minute' , 'second' values. each of these have been averaged , concatenated of workaround. here's confusion: in excel, when divide duration-in-seconds value 86400 (and consequently format in [h]:mm:ss), individual values tally precisely (e.g. 10:49:12 derived duration-in-seconds value , individual 'hour', 'minute' , 'second' values match - 10, 49 , 12 respectively) - yet when average duration-in-seconds column, receive different value of averaging component time values , concatenating them (separated colon). i'm sure simple, i'm hoping 1 of great minds on here able put me out of misery , provide concise explanation...it's tiny mind is; sleep deprivation notwithstanding! thank in advance, rob i have no issue replicating calculat...

proxy - How to change nodes in Tor -

i'm using tor proxy java appliaction have 1 issue.after ammounts of requests server application sends,i error code 429.so resolved problem using tor proxy,but still have 1 issue.everytime when 429 need restart tor can continue working.this code in torrc: # file generated tor; if edit it, comments not preserved # old torrc file renamed torrc.orig.1 or similar, , tor ignore maxcircuitdirtiness 150 datadirectory c:\users\steva\desktop\tor browser\browser\torbrowser\data\tor geoipfile c:\users\steva\desktop\tor browser\browser\torbrowser\data\tor\geoip geoipv6file c:\users\steva\desktop\tor browser\browser\torbrowser\data\tor\geoip6 how can set tor change nodes/ips while application still runnnig , don't have restart tor time? in advance

LinearLayout is getting cut off inside ScrollView Android -

i have activity in app user able vertically scroll content contained inside linearlayout in turn inside scrollview . here summary of layout xml activity looks like: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <scrollview android:layout_width="fill_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="20dip" android:orientation="vertical"> <!-- bunch of standard widgets, omitted brevity --> <!-- renders starting in textview --> <!-- content begins truncated --> <textview ...

java - Adding JComponent to JLabel dynamically -

i'm new in java , i'm trying draw graph dynamically in swing. the window, has show first node automatically, hard coded this: lienzo = new lienzografos(this); lienzo.setbounds(0, 0, 800, 200); lienzo.anadircirculo(0, 50, 50); pizarra.add(lienzo); pizarra white jlabel, lienzo jpanel class put nodes , arcs. anadircirculo draw node in lienzo. variable n number shows @ side of node, , 2 others x , y coordenates. to part, works perfect, run main code , have node waiting add others. if set mouse listener add new nodes each click, works fine too, can add want, , set arcs between them, not idea. i'm trying put new node, calling function public void graficarrelacion(int x, int y){ int respuesta = joptionpane.showconfirmdialog(null, "desea relacionar " + x + " con " + y + "?" ); if(respuesta == joptionpane.yes_option){ lienzo.anadircirculo(x, 400, 200); pizzara.add(lienzo); test.reva...

java - How to acknowledge rabbitmq message manually using spring intergration -

i have created bean inbound channel acknowledge property manual, , chain method publishing output message , <int-amqp:inbound-channel-adapter channel="inputchannel" queue-names="input" connection-factory="connectionfactory" concurrent-consumers="1" message-converter="converter" acknowledge-mode="manual" prefetch-count="5"/> <int:chain input-channel="inputchannel" output-channel="outputchannel"> <int:transformer method = "transform" > <bean class="com.sampleconverter" /> </int:transformer> <int:service-activator method="transform"> <bean class="com.transformer" /> </int:service-activator> <int:object-to-string-transformer /> </int:chain> can please me way acknowledge messages processed manual acknowledge mode, thanks in...

c# - Angular4 client can't send requests to a server with ValidateAntiForgeryToken -

i have angular4 client can send requests correctly asp.net core server. but implemented [validateantiforgerytoken] in every controller , put in configureservices: services.addantiforgery(options => options.headername = "x-xsrf-token"); and badrequest(error 400) in every request send server.

sql order by - Sort MySQL query ASC or DESC depending on value of other table -

i got query , want wort sort result depending on database. this query: select a.`name` `article` left join `container` b on b.`id` = a.`container` a.`container` = '1' order b.`sort` asc; this works fine, sorts result ascending. bute want ist sorted depending on value in container table. article table id | container | name | gender ---|---------------------|--------- 1 | 1 | michael | male 2 | 1 | joe | male 3 | 2 | karen | female 4 | 2 | andrew | male 5 | 3 | jessica | female container table id | sort | order ---|--------|---- 1 | name | asc 2 | name | desc 3 | gender | asc 4 | name | asc 5 | gender | desc how can change query order container table? i expect result: id | container | name | gender ---|---------------------|--------- 2 | 1 | joe | male 1 | 1 | michael | male you can't in 1 query. a given sql query must fixed @ time ...

php - include result array inside good language -

i trie include array result inside id language. problem result in double. $n = sizeof($_post['user_question']); // 3 questions $m = sizeof($languages); // 2 language ($i=0; $i<$n; $i++) { ($j=0; $j<$m; $j++) { $language_id = $languages[$m]['id']+1; if (!is_null($_post['user_question'][$i + $j * $n]) ) { $empty_array = (bool)array_filter($_post['user_question'][$i + $j * $n], create_function('$a','return preg_match("#\s#", $a);')); if ($empty_array == true) { $toto[] = $_post['user_question'][$i + $j * $n]; } } } } the result var_dump($toto); array(6) { [0]=> array(1){ [1]=> string(9) "test_en_1" } [1]=> array(1) { [1]=> string(9) "test_en_1" } [2]=> array(1) { [1]=> string(9) "test_en_1" } [3]=> array(1) { [2]=> string(9) "test_fr_1" } [4]=> array(1) { [2]=...

jquery - .animate() query not working -

i wanted implement "scroll top" button in static html site, i've done million times before. added code: (first part making button appear after time, don't worry that) $( document ).ready(function() { $(window).scroll(function() { var scroll = $(document).scrolltop(); var wheight = $(window).height(); var hheight = wheight / 2; if(scroll >= hheight) { $('#scroller').css({'opacity': '1'}); } else if (scroll <= hheight) { $('#scroller').css({'opacity': '0'}); } }); $('#scroller').click(function() { alert("click works!"); $('html, body').animate({ scrolltop: 0 }, 500); }); }); the appearing , disappearing of button works , alerts "click works" if click button. scrolling won't work. lost. read somewhere shouldn't use height: 100% in css , use height: auto; min-h...

jquery - Passing data to bootstrap modal Django template -

the view passes list of elements template, example list of movies, , rendered in table. , each element has detail , 1 specific element has list. content of list wanna put them inside modal. i'm doing 2 loops following: <table> <thead> <tr> <td>title</td> <td>description</td> <td>hours</td> </tr> </thead> <tbody> {% key in movies %} <tr> <td>{{ key.title }}</td> <td>{{ key.description }}</td> <td> <!--this button calls modal--> {% hour in key.hours %} <li>{{ hour }}</li> {% endfor %} <button type="button" class="btn btn-default" data-toggle="modal" data-target="#mymodal"></button> </td> </tr> {% endfor %} </tbody> </table> my modal under table...

golang: go run is always running old code even after changes -

i have weird issue golang. run command (like everytime): go run main.go then made change code , run again: go run main.go but executed code old version of code. tried stuff: reboot computer delete temporary binaries temp folder reinstall go delete , put code remove file but still running old version of code. didn't find solution issue, , few post doesn't give solution ( here , here ). about configuration following: raspberry pi running raspbian (updated) go version 1.8.1 i hope can me ! thank in advance! best regards, i think gopath pointing wrong folder. please, run go env make sure pointing right directory. if not set location go files are. please, take account go run not need file specification , if have list defacto files of app main.go depends upon. have `` here

asp.net mvc - Cell formating in csv -

i exporting generated serial code in 3 formats (with c# asp.net mvc): .txt, .csv , .xls. thing in .txt , .xls code in right format. in .csv loses leading 0 if starts 0 , example: 183531982165 is shown like 1,83532e+11 this code snipped use fill file: public static byte[] createfile(sericalcodemodel scobj, mydb db) { using (system.io.filestream fs = new system.io.file.create(filepath)) { using (system.io.textwriter wr = new system.io.streamwriter(fs)) { list<list<string>> filelines = db.get<serialcode>().getserialcodeoutdatatofile(scobj); // db records foreach (list<string> fileline in filelines) { wr.writeline(string.join(";", fileline)); } } } } this error occurs when open file excel, otherwise, other editor notepad shown how is! why , how can fix error?

android - How to inflate Button to LinearLayout progmatically in this case? -

my task generate several amount of buttons fixed width , height.i decided store these buttons in arraylist use in future. how it: for(int = 1 ; i<=n; i++) { button place = new button(this.context) ; place.settextcolor(contextcompat.getcolor (this.context,r.color.background_color)); place.settypeface(typefaceforplaces); place.setid(i+0); place.setbackgroundresource(r.drawable.real_place_background); place.setlayoutparams(new linearlayout.layoutparams(65,65)); places.add(place); } but problem here place.setlayoutparams(newlinearlayout.layoutparams(65,65)); here,width , height set in pixels. need dp . know code converts dp pixels, not think solution. now,i have idea create layout , store there button's shape. here layout called place_button.xml : <?xml version="1.0" encoding="utf-8"?> <button xmlns:android="http://schemas.android.com/apk/res/android" android:id=...

sql - Querying database to find potential duplicates based on multiple columns -

i have table in database have 100k clients , erroneous system in place quite time coming find out might potentially have thousands of duplicate records, should not have been duplicates. this basic structure of table... clientid fname lname dob sysemid ---------------------------------------------------------------------- 123 janette marukan 1/2/1990 111111s 478 jannete maruckan 1/2/1990 111111s these not fields in system goal able use columns above in search query. i'm trying take first 2 or 3 letters of first , last names, dob sysemid , find records potential duplicates. as can seen above in table have 2 clients, names different - in fact 2 clients both same, saved in system two. there way me somehow query whole tables , find that? i don't have 1 specific client in place - it's more of general kind of query show me potential duplicates of clients same 2 or 3 ...

console application - C++ - Repeat std::getline() as user integer input? -

how repeat std::getline() user number input method: std::string num; std::cout << "how many subjects want sum: "; std::getline (std::cin,num); then take user number input , repeat std::getline() many times input sum subjects marks user input them after first questions. prefer not use std::getline inputting numbers. you need standard pattern: int quantity = 0; std::cout << "enter quantity of subjects sum: "; std::cin >> quantity; int sum = 0; (int = 0; < quantity; ++i) { int value; std::cin >> value; sum += value; } a common data input format specify quantity first number on single line. the data follow on subsequent lines, 1 number per line. the operator>> skip whitespace (including newlines). edit 1: using getline if must use getline , remember reads in strings (characters). if want numbers, have convert text representation internal representation. int quantity; std::string ...

angularjs - $routeprovider resolve Function Causing Infinite Loop -

i using resolve function in route provider re-route different types of users different home screens when go / page. code works on first page load. resolve looking @ user status , taking them correct screen. however, when re-load / page, infinite loop. in console see enter else statement , re-enter controller. browser keeps loading my controller until browser crashes. here's code myapp.config(function($routeprovider){ $routeprovider.when('/', { templateurl: "views/index.html", resolve:{ "check":function($location){ if(vm.status === 0){ console.log('in if statment'); $location.path('/create-new-user'); return 200; } else if(vm.status === 2){ console.log('in else if statment'); $location.path('/devices'); return 200; } else{ console.log('in e...

css - Modal window content scroll without height hardcode -

Image
we have modal window, has header, body , footer. restrict window max height 100vh. when content become large, want add scroll bars content only, not whole window (when scroll header , buttons should fixed). there uggly solution this: .content { // 210 = header + footer height max-height: calc(100vh - 210px); overflow-y: auto; } there hardcode header , footer height , not nice. header or footer can change , break layout, until fix 210 new calculated value. i hoped, flex can solve this, looks ie breaks all: flexbox children overflow parent max-height specified on ie does solved problem without hacks , hardcode in 2017? tested in ie 11, works fine: * { box-sizing: border-box; } html, body{ margin: 0; height: 100vh; font-family: open sans; } body { padding: 10px; } .modal { border: 10px solid #333; height: 100%; position: relative; display: flex; flex-direction: column; } .modal-header, .modal-footer...

html - page-break-before: always is freezing print dialog box -

i have html page generates bunch of tables. need see page on screen able print it. when print, want make sure each table begins in new piece of paper. to accomplish using page-break-before: always css rule h4 tag. however, causing print dialog freeze before loading preview , way out close tab. does know why may happening , how around it. if there better approach printing something, i'd know well. thanks! here code: show.html.erb <html> <html> <head> <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.datatables.min.css"> <link rel="stylesheet" type="text/css" media="print" href="print.css"> </head> <body> <!-- table page --> <% @reports.each |report| %> <% next if report[1].empty? %> <div class="page-tables"> <!-- table --> ...

Randomize Parallel Recipe Execution Order In Makefile -

i have makefile has ton of subsystem , able build -j flag goes faster , builds different recipes in parallel. this seems working fine not sure if missing needed dependencies , "getting lucky" order these being built. is there way can randomize order recipes run while still following dependencies have defined? you can control number of jobs make allowed run asynchronously -j command line option. way can "randomize" recipes being executed simultaneously , catch issues in makefiles.

csv - Simplest method to edit password in text file Python -

i have following code, goes through stages of reading file in line line, converting list, editing field in list, last stage rewriting original file, edit included. i interested in answers suggest easiest/simplest fix (without use of pandas/numpy etc) , using original code provided. my current algorithm includes having create new file records, except 1 linked username, , writing in list it. seems arduous , unnecessary. solutions gratefully received! the task explained more in comments: code """ ==============task allow user change or edit password 1. search given username 2. edit password field given username 3. save new updated username , password file / updated """ import csv def main(): #1. code snippet asks user username , allows them change password record updatedlist=[] open("fakefacebook.txt",newline="") f: reader=csv.reader(f) print("chan...

php - Saving multiple embedded forms using Symfony's Formbuilder, multiple entrees work fine 1 level deep, goes wrong 2 levels deep. (1-to-many), -

the problem have regarding symfony's (3) formbuilder. have 3 entities created 3 formtypes. see below; actual question below code. i have following entities: documentbaldoc 1 -> * documentbaldocconnectionpoint 1 -> * documentbaldocaccount i try achieve following. want create form documentbaldoc, want create multiple forms documentbaldocconnectionpoints , want create multiple forms documentbaldocconnectionpointaccounts. when saved these need stored in database relation (fk). i have following class documentbaldoc (form) namespace foobundle\form\documents\baldoc; use foobundle\entity\documents\baldoc\documentbaldoc; use symfony\component\form\abstracttype; use symfony\component\form\extension\core\type\submittype; use symfony\component\form\formbuilderinterface; use symfony\component\optionsresolver\optionsresolver; use symfony\component\form\extension\core\type\collectiontype; class documentbaldoctype extends abstracttype { /** * {@inheritdoc} */ ...

reactjs - Listing in one container different type of objects in react -

i have array of objects so: [{ "message": { "from": "one", "body": "lorem" } }, { "message": { "from": "two", "body": "ipsum" } }, { "point": { "topic": "lorem", } }] how should render them objects in order , between appropriate or while message objects coming, inserted ul sequentially when point object comes, opens ul , adds point objects until again message objects coming , forth... this how render code looks now, , don't know how make work out explained above: render: function() { var dmessages = sections.map(function(section, i) { if (section.hasownproperty('message')){ return <message key={i} id={i} message={section.message} />; } if (section.hasownproperty('point')){ return <point key={i} id={i} point={section.p...

mysql - How to combine multiple nric and make them into a joined account ? Using Java-EE -

Image
i trying merge individual nric 1 user have registered website , after combine them 1 single account, user can have family account created. using java ee codes , faced issue , appreciate help! how works: 1) user keys in different nric , data stored table in mysql database 2) unique code generated , stored table in table each successful account created 3) system retrieve info , there create joined account. here's snippet of code: calling servlet public familyaccountservlet() { super(); // todo auto-generated constructor stub } /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub } /** * @see httpservlet#dopost(httpservletrequest request, httpservletresponse response) */ protected void dopost(httpservletrequest request, httpservletresponse response) throws servl...

javascript - KnockoutJS : Create binding handler to change value to enum -

i have knockout custom binding takes value , returns enum. user readability. problem when passing in parameter binding, comes blank. i've tried passing in parameter observable, ex: purchaseorderstatus[status()]. the view: <td style="vertical-align: top"> <label>status</label><br /> <span data-bind="text: purchaseorderstatus[status]"></span> </td> the javascript : purchaseorderstatus = function() { }; purchaseorderstatus.prototype = { closed: 67, deleted: 68, finalized: 70, open: 79} purchaseorderstatus.registerenum('purchaseorderstatus', false); the way should work if value 70, user sees finalized. how this. function model() { var self = this; this.purchaseorderstatus = ko.observable({ '67': 'closed', '68': 'deleted', '70': 'finalized', '79': 'open' }); ...

javascript - Angular 4 style overriding addons -

while developping angular 4 app using angular-cli + sass, have problem multiple plugins. here scenario: i have main style.scss file import other styles files ..., if want modify plugin style, let slider component styles, create slider.scss , import main style.scss file, problem imported component css injected browser after main css file. when want modify need add !important rule. here snapshot of chrome inspect css tool: element.style { left: 100%; } <style>…</style> .noui-marker-horizontal.noui-marker-large { height: 15px; } <style>…</style> .noui-marker-horizontal.noui-marker { margin-left: -1px; width: 2px; height: 5px; } <style>…</style> .noui-marker-horizontal.noui-marker-large { height: 10px !important; } my custom css last one. i want know if there way load css style file after components css file, can use precedence rule make work, want know if there more clean way.

css - Webpack 2 duplicate declaration when redefine a style inside reactjs -

i error: error in ./src/data/js/component/mdldropdown.jsx module build failed: d:/programming/src/data/js/component/mdldropdown.jsx: duplicate declaration "selectfield" when use webpack 2 config: const path = require('path'); const appcfg = require("./app.config.js"); var packg = require("./package.json"); var webpackuglifyjsplugin = require("webpack-uglify-js-plugin") //babel loader const babelloader = { test: /\.jsx$/, exclude: /node_modules/, include: [path.resolve(__dirname, "./src/data/js")], loader: 'babel-loader' }; let wp = { entry: { mainapp: appcfg.entrypointjs, //mainapp.bundle.js vendor: object.keys(packg.dependencies) //vendor.min.js }, output: { filename:"[name].bundle.js", path: path.resolve(__dirname, appcfg.outputdir) }, module: { rules:[ babelloader, { test: /\.css$/, use: [...

java - Run-time error on usage of Integer.parseInt() -

i trying solve problem flip 2 input integers , add resultant. obvious way taking modulo , getting each digit , reconstructing back, wanted convert integers string, rendering easy flipped, , reconverting int, adding , returning answer. code: import java.util.*; class testclass { public static void main(string args[] ) throws exception { /* * read input stdin , provide input before running * use either of these methods input //bufferedreader bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string line = br.readline(); int n = integer.parseint(line); */ //scanner scanner s = new scanner(system.in); int n = s.nextint(); string num1= " "; string modnum1= " "; string num2= " "; string modnum2= " "; int s1=0; int s2=0; while (n!=0) { int x=s.nextint(); int y=s.nextint(); //system.out.println(x+" ...

SSAS (looking for mdx measure) count distinct customer in a category at a date -

i have implement ssas structure deals customer , newsletter subscription. i'm dealing kind of simple issue not solve @ now.. here simple extract of 1 of fact table : date | cat | contact 201401 | nosub | paul 201403 | multi | paul 201602 | mono | jean 201604 | mono | paul 201604 | multi | paul 201609 | nosub | jean 201703 | multi | paul i want measure (contactnumber) gives me how many contact there within category @ time of request.. i create measure : (dc_contact count distinct of contact) [measures].[contactnumber] = aggregate( null : [period].[per quarter].currentmember ,[measures].[dc_contact]) but when check in 201703, gives me nosub = 2 (excepted 1) multi = 2 (excepted 1) mono = 2 (excepted 0) and in 201604 have nosub = 2 (excepted 2) multi = 1 (excepted 0) mono = 1 (excepted 0) it's quite difficult has lack of details regarding structure of cub...

java - spring mvc upload a file and invoke a invoke a method async -

i got requirement upload file contain questions, need invoke 3rd party api , answers write file , provide link user download it. problem there can n number of question , user not wait, instead can come later see if process got finished. thinking upload file , invoke method async method has got other issues. please let me know if there way solve in spring mvc. thanks nibin issac you can call 3rd party api async. try following this tutorial this tutorial contains adding support async in project configuration , achieving async outcome through future . hope helps.

python - How to properly create dynamic table email? -

assume have defined dataframe. make sense? there way can define create_email() saved 1 string instead of writing message_body = create_email() .. have feeling not proper way it. import smtplib import pandas pd def create_email(): print('<html><body>') print('<table><tr><th>security</th><th>ticker</th><th>yesterday</th><th>currency</th></tr>') index, row in df.iterrows(): print('<tr><td>' + row['a'] + '</td>') print('<td>' + row['b'] + '</td>') print('<td>' + str(row['c']) + '</td>') print('<td>' + row['d'] + '</td></tr>') print('</table>') print('</html></body>') class gmail(object): def __init__(self, email, password, recepient): se...

python - Redirect output to file after os.exec* -

i have python script, output piped log file. can restart file within os.exec call, if that, new process doesnt write output log file. how can keep output redirection after restarting process? my script start: python3.6 script.py >> home/pi/log/telegram_bot.log 2>&1 & my restart line: import os import sys os.execv(sys.executable, [sys.executable] + sys.argv) i can't reproduce problem. here's first.py : import os import sys os.execv(sys.executable, [sys.executable, "second.py"]) here's second.py : print("hello") here's how run , check result. can see, works fine: $ python first.py >> logfile 2>&1 & [1] 3098 $ wait $ cat logfile hello

python - Fixed digits after decimal with f-strings -

is there easy way python f-strings (pep 498) fix number of digits after decimal point? (specifically f-strings, not other string formatting options .format or %) for example, want display 2 digits after decimal place. how do that? a = 10.1234 f'{a:.2}' out[2]: '1e+01' f'{a:.4}' out[3]: '10.12' = 100.1234 f'{a:.4}' out[5]: '100.1' as can see "precision" has changed meaning "number of places after decimal point" case when using % formatting, total digits. how can always 2 digits after decimal, no matter how big number have? include type specifier in format expression: >>> f'{a:.2f}' '10.12'

ios - Firebase Notification To Device with FCM Token Says Sent but not received -

Image
i attempting send simple push notification firebase notification console specific device using fcm token. firebase notification console shows notification sent device not receive it. have tried sending notification , waiting see if console logs didreceiveremotenotification , notification takes long (hours) shown sent in firebase console (even when set priority high ). app delegate import uikit import firebase import firebasestorage import firebasedatabase import firebasemessaging import coredata import usernotifications @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate, unusernotificationcenterdelegate { var window: uiwindow? func application(_ application: uiapplication, didfinishlaunchingwithoptions launchoptions: [uiapplicationlaunchoptionskey: any]?) -> bool { // override point customization after application launch. // use firebase library configure apis firebaseapp.configure() ///// // fireba...

C++ initializing pointer/reference/copy nuances -

context : embedded programming , initializer list nuances, 1 think should invoke copy constructor. question : instantiation of class in class's initializer list initialize value-held member variable invoke copy constructor? example provided below testclasscopy has member variable testmember held value opposed pointer or reference. cppreference page not seem cover sufficiently in examples provided. bonus question : copy constructor invoked in initializer list produce time/space perf impact? seems compiler should able optimize away if c++ spec allows. here's code (build tested vs2015 toolchain): testmember.h (not showing testmember.cpp space reasons) #pragma once #include <stdint.h> class testmember { public: testmember(uint8_t); private: uint8_t m_value; }; testclasscopy.h #pragma once #include "test_member.h" class testclasscopy { public: testclasscopy(); virtual ~testclasscopy(); private: testmember m_member; }; ...

python - NumPy not properly installing -

i've been trying work numpy , libraries require numpy, same error when running code. there no errors in code however. error: importerror: importing multiarray numpy extension module failed. trying import failed build of numpy. if you're working numpy git repo, try `git clean -xdf` (removes files not under version control). otherwise reinstall numpy. original error was: dll load failed: specified procedure not found. i have numpy installed. have windows 10 64 bit running python 3.6.what error mean, , how fix it? i've uninstalled, reinstalled, , done many other things no avail. used pip install install anaconda link download anaconda . have required libraries pre installed it. best option if wanna work data analysis tools.