Posts

Showing posts from September, 2014

sql - Unable to drop default constraint in oracle. Tried the below code but doesn't work -

sql> alter table customers modify age int default 10; table altered. sql > alter table customers alter column age drop default; error @ line 2: ora - 01735 : invalid alter table option. you alter statement wrong , cannot use 2 alter command in 1 statement. , never drop default value instead set null . if column has default value, can use default clause change default null, cannot remove default value completely. if column has ever had default value assigned it, data_default column of user_tab_columns data dictionary view display either default value or null. alter table use following sql command drop default. alter table constomers modify age default null;

iis 7.5 - Can We deploy Microsoft bot Application in IIS for hosting without Azure? -

is possible deploy microsoft bot application in iis without azure. we have created sample bot application , running fine emulator in local environment. we move application production , don't have azure account , details. can deploy bot application in iis in windows server 2012 r2 how deploy webservices or wcf services ? possible without host in iis without azure ? of course possible. need deploy bot code iis server, , copy-paste url of api endpoint bot settings on dev.botframework.com. for example, url this: https://yourserver.com/api/messages one caveat must use https, may need take care of own ssl certificate. on other hand, azure account free , according experience, can handle thousands of users daily within free quota.

node.js - Electron / Nw.js slow startup time (2 minutes!) on Windows -

Image
downloading latest version of electron (1.4.5) windows, experience unacceptable startup time (around 2 minutes). i've tried both 32 , 64bit versions. i'm trying run default demo app, untouched. this happens on specific computer, hp elite x2. computer brand new , quite performant. system specs: os: windows 10 enterprise (version 1607) cpu: intel core m5-6y54 cpu @ 1.10ghz ram: 8 gb i don't think it's hardware issue. on less performant windows system works right. i've tried running nw.js , has same problem. visual studio code (built on electron) won't start. seems there's wrong (possibly software of configuration-wise) whole node/javascript environment don't know solution. thanks this may due windows automatic proxy detection, causes 21 second network timeout delay remote requests. hit windows key, search "internet options," , hit return . alternatively, in google chrome, click ... in upper right corner, select settings,

android - Cordova geolocation not working on android5 -

i'm using cordova geolocation plugin. added geolocation plugin app. when run application see white page. app doesnt work. tried emulator , on device result not different. tried device again result white page. before looked questions , tried different solving way not working. please me. want solve problem. Ä°t index.html <!doctype html> <html> <head> <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">

php - Convert Lower Case Special Character to UpperCase -

i have ñ special character. it's uppercase equivalent Ñ . want convert lowercase special character uppercase. tried code below: strtouppercase('ñ'); ucfirst('ñ'); ucwords('ñ'); but code above not convert anything. shall convert special character? ascii value 'ñ' 241. difference between uppercase , lowercase characters 32 can use like: echo mb_convert_encoding(chr(241-32), "utf-8"); to print desired character Ñ i hope helps.

multithreading - Basic Threading in C++ Program Issue -

#include <stdlib.h> #include <iostream> #include <thread> using namespace std; int threshold = 20; __m128i set1 = _mm_set1_epi8(1); __m128i set0 = _mm_set1_epi8(0); __m128i set2 = _mm_set1_epi8(2); #define capture_perf(x) x = capturetime(); static unsigned long capturetime() { double curtime = 1000 * (double)clock() / clocks_per_sec; return (unsigned long)curtime; } void threadfunc1(unsigned char *threshold_tab ,int start , int end ) { (int = start;i < end;i += 16) _mm_storeu_si128((__m128i *)(threshold_tab + + 255), set1); } void threadfunc2(unsigned char *threshold_tab ,int start , int end ) { (int = start;i <= end;i += 16) _mm_storeu_si128((__m128i *)(threshold_tab + + 255), set0); } void threadfunc3(unsigned char *threshold_tab ,int start , int end ) { (int = start;i <= end;i += 16) _mm_storeu_si128((__m128i *)(threshold_tab + + 255), set2); } int main() { int i; unsigned long int star

node.js - Malware in redis keys -

i using open source version of prerender cache links of website. links stored using redis keys. website , prerender servers deployed in google compute engine. recently, while going through cpu usage of server, observed 80-90% usage. so, checked dbsize , keys in redis , got lot of links http://adserver.adtechus.com/addyn/3.0/10125.1/4264818/0/170/adtech;loc=100;target=_blank;misc=1478214490384 i googled , got know sort of malware. tried following: stopping prerender server , deleting keys redis , starting server again. malware comes start server. changed ip of prerender server google cloud, , malware links stopped appearing in redis keys. i want understand have caused problem , how can avoid in future.

node.js - Grunt EACCES: Permission denied @ rb_sysopen - How to set permissions on ubuntu? -

i did fresh digital ocean droplet creation. have latest - , getting eaccess error when run grunt. grunt script runs grunt-contrib-sass v1.0. i've used grunt script before - works in other environments. have sass 3.4.22 installed don't know how debug this. grunt env production running "sass:dist" (sass) task errno::eacces: permission denied @ rb_sysopen - public/builds/style.css use --trace backtrace. warning: exited error code 1 use --force continue. aborted due warnings. execution time (2016-11-08 08:47:40 utc) what rb_sysopen , why complaining when run sass?

App store rejection iPhone app for iOS 10.1.1 on iPad -

i have updated iphone app workig in . after updating apple has rejected following issue. performance - 2.4.1 we noticed app did not run @ iphone resolution when reviewed on ipad running ios 10.1.1. specifically, app loads white screen , not displays on ipad. we've attached screenshot(s) reference. i have checked in simulator 10.0 looks . don't have xcode 8.1 can not able reproduce issue. does 1 has idea issue. you should test app on real device because in cases kind of storage techniques work on simulators not on devices.

c# - returning file after saving it on disk in mvc -

i have problem in returning file after saving on disk !! pleaaase note:the function "downloadfile" work when call directly . public actionresult exportreport(ienumerable<student> user_list) { reportdocument rd = new reportdocument(); rd.load(path.combine(server.mappath("~/reports"), "crystalreport2.rpt")); rd.setdatasource(user_list); rd.exporttodisk(exportformattype.portabledocformat, @"d:\reports\file.pdf"); return redirectpermanent("http://localhost:21104/home/downloadfile"); } public actionresult downloadfile() { string filename = "file.pdf"; string filepath = @"d:\reports\" + filename; byte[] filedata = system.io.file.readallbytes(filepath); string contenttype = mimemapping.getmimemapping(filepath); var cd = new system.net.mime.contentdisposi

php - mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 to be resource or mysqli_result, boolean given -

i trying select data mysql table, 1 of following error messages: mysql_fetch_array() expects parameter 1 resource, boolean given or mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given this code: $username = $_post['username']; $password = $_post['password']; $result = mysql_query('select * users username $username'); while($row = mysql_fetch_array($result)) { echo $row['firstname']; } the same applies code $result = mysqli_query($mysqli, 'slect ...'); // mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given while( $row=mysqli_fetch_array($result) ) { ... and $result = $mysqli->query($mysqli, 'selct ...'); // call member function fetch_assoc() on non-object while( $row=$result->fetch_assoc($result) ) { ... and $result = $pdo->query('slect ...', pdo::fetch_assoc); // invalid argument supplied foreach() foreach( $result $row ) { ... and

c++ - Why is (a % 256) different than (a & 0xFF)? -

i assumed when doing (a % 256) optimizer naturally use efficient bitwise operation, if wrote (a & 0xff) . when testing on compiler explorer gcc-6.2 (-o3): // type code here, or load example. int mod(int num) { return num % 256; } mod(int): mov edx, edi sar edx, 31 shr edx, 24 lea eax, [rdi+rdx] movzx eax, al sub eax, edx ret and when trying other code: // type code here, or load example. int mod(int num) { return num & 0xff; } mod(int): movzx eax, dil ret seems i'm missing out. ideas? it's not same. try num = -79 , , different results both operations. (-79) % 256 = -79 , while (-79) & 0xff positive number. using unsigned int , operations same, , code same. ps- commented they shouldn't same, a % b defined a - b * floor (a / b) . that's not how defined in c, c++, objective-c (ie languages code in question compile).

python - logging.raiseExceptions = True does not re-raise an exception -

i trying have following functionality in code: log info , error messages , exceptions console and/or file, without interrupting program flow (i.e., swallowing exceptions, kind of run mode ) get development mode , exceptions raised, setting develop = true flag currently, using python3 logging module, (according this ) should have functionality built-in. flag logging.raiseexceptions = true . however, not getting work in mwe: exception throwing not re-raised, whatever setting of flag is. # mwe.py import logging import logging.config if __name__ == '__main__': # configure logging , set flag raise exceptions logging.config.fileconfig('log.conf') logging.raiseexceptions = true logger = logging.getlogger('root') logger.info('started') # test whether exceptions raised try: raise runtimeerror("ooops.") except runtimeerror: try: logger.exception('there oops.')

google apps script - removeFolder doesn't work -

i'm not sure wrong script. var foldertodelete = driveapp.getfoldersbyname('foldername').next(); driveapp.removefolder(foldertodelete); it doesn't show errors , folder not removed it's sure folder name 'foldername' exists thanks! works fine me, searching or using items view? maybe have multiple folders same name. removefolder removes folder root of drive. form documentation : removes given folder root of user's drive. this method not delete folder or contents, if folder removed of parents, cannot seen in drive except searching or using "all items" view . are looking settrashed() ? foldertodelete.settrashed(true)

node.js - Nodejs nexpect: Get all output lines -

i have simple case want use nexpect list files in folder, , add expect() functionality later. nexpect.spawn("ls -la /etc") .run(function (err, output, exit) { res.send(output); }); as result, 1 line: lrwxr-xr-x@ 1 root wheel 11 oct 2 21:42 /etc -> private/etc my expectation of /etc, since output defined "output {array} array of lines of output examined" ( https://github.com/nodejitsu/nexpect ). as side question: nexpect recommendable of today (since hasn't been updated in year)? it's because on mac, , /etc symlink. try adding / : nexpect.spawn("ls -la /etc/") .run(function (err, output, exit) { res.send(output); });

angularjs - how to assign default values to dropdown from backend response -

i have local $scope.countries in html populate country state city , instead of select default values in dropdown , need show country state city values coming backend default.for example , afganistan , badhakshan . plunker code here. http://plnkr.co/edit/dpoofrkgxo28tdxzge5b?p=preview <html lang="en-us"> <head> <meta charset="utf-8"> <link href="css/custom.css" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> </head> <body ng-controller="mainctrl"> <form action="#" role="form" class="form-horizontal" id="location" method="post" accept-charset="utf-8">

entity framework - How do I consolidate migrations using EF Core? -

i have these migrations: 00000000000000_first 20161101000000_foo 20161102000000_bar // ...many many many more 20161108000000_baz i want consolidate foo baz 1 new migration. know how in ef, not in ef core. i tried this: dotnet ef update database 00000000000000_first // delete other migration classes dotnet ef migrations add consolidated dotnet ef update i expect new consolidated migration contain changes model. up() , down() methods empty. what doing wrong? you're missing 1 step. because of new model snapshot, after manually delete migration files, you'll need run dotnet ef migrations remove (or remove-migration in pmc) in sync. instead of manually deleting files, run dotnet ef migrations remove multiple times, it's smart enough detect manually deleted migrations.

regex - How could I delete sql functions format in awk? -

i've got sql query looks this: select test1(func1(myfield)), test2(max(myfield), lower("nope")), test3(max(myfield), 1234), avg(test1(test2(myfield, func1(4)))), func2(upper("stack")) substr(myfield, 2, 4), test2(min(myfield), substr(lower(upper("nope")), 1, 7)), substr('func1(', 2, 4) mytable; then i'm trying remove functions called: test1 test2 test3 func1 func2 but preserving avg, max, upper, substr ... , native functions. so desired output be: select myfield, max(myfield), max(myfield), avg(myfield), upper("stack") substr(myfield, 2, 4), min(myfield) substr('func1(', 2, 4) mytable; i want remove lower of second line because, argument of 1 of functions delete, in case test2, has 2 parameters. if delete function, should delete params well. i've tried way in awk: { print gensub(/(test1|t

java - Do not read the file in the package .jar -

this code reads firmware upgrade file jar package , send post request device: closeablehttpclient client2 = httpclients.createdefault(); httppost post = new httppost("http://" + ip + "/moxa-cgi/uploadfirmwarefile.cgi"); inputstream stream = main.class.getresourceasstream("vport364a_v1_5.rom"); byte b[] = new byte[stream.available()]; stream.read(b); multipartentitybuilder builder = multipartentitybuilder.create(); builder.addbinarybody("uploadfile", b, contenttype.application_octet_stream, "vport364a_v1_5.rom"); post.setentity(builder.build()); httpresponse response2 = client2.execute(post); for unknown reasons, code stopped working execute jar package: firmware upgrade file send nulls. on line: stream.read(b); only nulls already. if run code in ide netbeans, works.why?

oracle - SQL Aggregate on Two tables -

table has millions of records 2014, using oracle id sales_amount sales_date 1 10 20/11/2014 1 10 22/11/2014 1 10 22/12/2014 1 10 22/01/2015 1 10 22/02/2015 1 10 22/03/2015 1 10 22/04/2015 1 10 22/05/2015 1 10 22/06/2015 1 10 22/07/2015 1 10 22/08/2015 1 10 22/09/2015 1 10 22/10/2015 1 10 22/11/2015 table b id id_date 1 22/11/2014 2 01/12/2014 i want sum of totals 6 months 1 year id 1 taking starting date table b 22/11/2014 output sales_amount_6months sales_amount_6months 1 70 130 shall use add_months in case? yes, can use add_months() , conditional aggregation : select b.id, sum(case when a.sales_date between b.id_date , add_months(b.id_date,6) a.sales_am

android - show images from internal storage in Recyclerview -

i'm saving images camera , gallery(multi-select) folder in internal storage. want display images in horizontal recyclerview. in row layout, there close button along imageview. want delete image(file) internal storage when close button clicked. i've 2 problems: problem 1: when select images(single or multiple) gallery, images saving correctly in recyclerview, image gallery shown in position i.e. if there 2 images in folder , select 1 image gallery, in recyclerview 3 positions have image gallery only. problem 2: how delete images folder when close button clicked? //recyclerview adapter public class recycleimageadapter extends recyclerview.adapter<recycleimageadapter.viewholder> { private list<string> itemlist; private context mcontext; public recycleimageadapter(context context, list<string> itemlist) { this.itemlist = itemlist; this.mcontext = context; } @override public recycleimageadapter.vie

Android TV lib makes app crashes on Notifications registration -

i'm developing android tv version of app. the problem is, when add android tv dependency, got error on notification part in main app. the dependency : compile 'com.android.support:leanback-v17:24.2.1' the line app crash : instanceid instanceid = instanceid.getinstance(this); the app , notifications worked fine before this, guess there conflict between leanback library, don't find how resolve.

arrays - Sorting opening hours in PHP -

i have array opening hours structured this: array:7 [ "mon" => array [ "open" => null "close" => null ] "tue" => array [ "open" => null "close" => null ] "wed" => array [ "open" => "09:00" "close" => "20:00" ] "thu" => array [ "open" => null "close" => null ] "fri" => array [ "open" => "14:00" "close" => "17:00" ] "sat" => array [ "open" => "12:00" "close" => "15:00" ] "sun" => array [ "open" => "12:00" "close" => "15:00" ] ] i create structure this: array [ array [ "mon" => array [ "open" => null

css - border-style: ridge doesn' work on Chrome -

Image
i've got css style border of table: border-right-width: 3px; border-bottom-width: 3px; border-right-style: solid; border-bottom-style: solid; border-right-color: #558fa6; border-bottom-color: #558fa6; border-style: ridge; it works fine in firefox but ignored chrome: i checked similar answer, not work me. need similar css code works in chrome.

reporting services - Display only two items in legend -

Image
how go showing 2 items in legend in stacked chart? i've got 2 stacks on each bar, each showing 2 individual items in legend. need 2 of removed. here picture of how looks (see green box): i need remove 2 items "0 - outstanding" , "1 - outstanding" . i'm using code display "late issue": =iif(count(iif(fields!outstanding.value = 1, 1, nothing)) > 0, "late issue", nothing) and "not finished": =iif(fields!outstanding.value = 0, "not finished", nothing) outstanding binary value working boolean value (1 being true , 0 being false). in series group properties, group on property use: =iif(fields!outstanding.value=0, "not finished", "late issue") this leave 2 series groups late issue , not finished . let me know if helps.

objective c - upload any Document in iOS -

in application, creating functionality in require upload document of type (pdf/xls/doc/image). after uploading document document name should show in screen , on click of document show document have selected. how implement functionality, best practise this. plz provide feedback. you can create file using below code. here txt file. nsstring *stringtowrite = @"this string"; nserror *error; nsstring *filepath = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject] stringbyappendingpathcomponent:@"filename.txt"]; [stringtowrite writetofile:filepath atomically:yes encoding:nsutf8stringencoding error:&error];

mysql - How to print (export) to MS-Word search result (PHP) -

i'm trying export ms word search result using php code not working. here code: <?php error_reporting(0); include("configsample.php"); ?> <html> <title>home</title> <head> <meta charset="utf-8"> <title>flat login form</title> </head> <body> <form class="login-form" method="post" action="viewstucon.php"> <select class="s" id="course" name="course"> <option value="">select course</option> <option value="bachelor of secondary education"<?php if (!(strcmp("bachelor of secondary education", $_post["course"]))) {echo "selected=\"selected\"";} ?>>bachelor of secondary education</option> <option value="bachelor of science in automotive technology"<?php if (!(strcmp("bachelor of science in automotive technology", $_p

r - Multilevel in shiny input -

i have, multilevel in shiny ui input region , province , school . library(data.table) selectinput("region","region",c("golfe","maritime","kara","savanes")) selectinput("province","province", as.character(sort(unique(dt[,region])))) selectinput("school","school",as.character(sort(unique(dt[,province])))) how can link region -> province -> school. thank you need on server side, using updateselectinput function.

r - Tool Tip Shiny renderDataTable for only one column name -

i have table in shiny , want add 1 tooltip column name "species", i.e. other columns should not have tooltip. have manged add tooltip of them, don't know how can set content specific columns. shinyapp( ui = fluidpage( fluidrow( column(12, datatableoutput('table') ) ) ), server = function(input, output) { output$table <- renderdatatable(iris, options = list( pagelength = 5, initcomplete = i("function(settings, json) { $('th').each( function(){this.setattribute( 'title', 'test' );}); $('th').tooltip(); }"))) } ) i have modified code tooltip 4th column name ie "species". library(shiny) shinyapp( ui = fluidpage( fluidrow( column(12, datatableoutput('table')

angular - Using @ngrx/store in Angular2 -

i working on sample application using angular 2 , @ngrx/store(for state management) when execute below code not getting error , expected output not displayed. // employeestate.ts export interface employee { id: number; name: string; isactive: boolean; } // feature module es.module.ts import { ngmodule } '@angular/core'; import { routermodule } '@angular/router'; import { storemodule } '@ngrx/store'; import { commonmodule } '@angular/common'; import { employeecomponent } './employee.component'; import { employee } './employeestate'; import { empreducer } './employeereducer'; @ngmodule({ imports:[ routermodule.forchild([ {path:'emp' , component: employeecomponent} ]), storemodule.providestore([{employee: empreducer}]),

opencv - Deformable part model implementation C++ -

has implemented dpm in opencv? found 1 implementation: http://www.cnblogs.com/louyihang-loves-baiyan/p/4913164.html but detects entire person, ie root filter. wanted know how detect different parts. tried going through dpm detector class in opencv opencv documents don't elucidate concept well. so, appreciate help!

Need to insert header information in wsdl -

i insert soap header information in wsdl, can suggest me or provide me code snippet how do. have wsdl not have soap header. want write program insert header information , copy content of wsdl , generate new wsdl. need transform wsdl new soap header. please me . my old wsdl this: <wsdl:input> <soap:body parts="parameters" use="literal"/> </wsdl:input> i want this: <wsdl:input> <soap:header message="tns:soapheader" part="info" use="literal"/> <soap:body parts="parameters" use="literal"/> </wsdl:input>

excel - VBA Printing in Groups of 4 Rows -

i have pretty specific spreadsheet contains wages/bonuses of employees. each employee has 4 rows (salary / bonus / salary % delta / bonus % of salary). problem i'm having managers have employees cutoff if goes multiple pages switched fit 1 x 1 condensed. there way have macro print in groups of 4 rows? or perhaps make prints 4 rows each employee on same page (salary/bonus/salary % delta/bonus % of salary) thank in advance! private sub commandbutton1_click() dim sel_manager string 'specify headers repeated @ top activesheet.pagesetup .printtitlerows = "$5:$10" .printtitlecolumns = "$b:$m" .orientation = xllandscape .zoom = false .fittopageswide = 1 .fittopagestall = 1 end 'manager selection through simple inputbox sel_manager = combobox1 'insert autofilter worksheet cells.select selection.autofilter 'select manager defined in inputbox activesheet.range("b10", range("m10"

c# - dataview rowfilter not working as expected -

please go easy on me this, i'm totally self taught c# , chance play in spare time! i have datatable contains 1 column of boolean type. binding table datagridview , using boolean type display column of empty checkboxes, user can check box next number of rows. have "show checked rows" checkbox on form which, when checked, filters datagridview show checked rows, code looks this: filling datagrid: public void filldatagridview() { dtmembers.columns.add("print", typeof(bool)); dtmembers.columns.add("contact id", typeof(string)); dtmembers.columns.add("membership number", typeof(int)); dtmembers.columns.add("first name", typeof(string)); dtmembers.columns.add("last name", typeof(string)); dtmembers.columns.add("current application type", typeof(string)); dtmembers.columns.add("email address", typeof(string)); dtmembers.columns.add("membership type", typeof(st

c++ - How to retain 0s after decimal point, after converting string to double -

this question has answer here: how print double value full precision using cout? 10 answers correct use of std::cout.precision() - not printing trailing zeros 3 answers #include <iostream> using namespace std; int main() { string str="-1.2300"; double d = stod(str); cout<<d<<"\n"; } output: -1.23 i expecting output following -1.2300 if want, need use formatted output precision specifier: printf("%.4f\n", d); or specify precision cout: cout.precision(4); cout << fixed << d << "\n";

python 2.7 - Python2.7 How do I check if a response is json (and parse it if it is)? -

i have 'requests.models.response' object parse. calling response.json() on response makes 'unicode' object. primarily - how check whether response json? secondarily - can parse json 'unicode' object bs4? my code follows: import requests post_hdrs = { 'type': 'regulated', 'url': 'node/17' } r = requests.post( url='https://www.gfsc.gg/fetch-records-for-companies-table', data=post_hdrs, ) json_data = r.json() the content type in headers: >>> r.headers['content-type'] 'application/json' after getting json data, parse beautifulsoup. example: import requests bs4 import beautifulsoup post_hdrs = { 'type': 'regulated', 'url': 'node/17' } r = requests.post( url='https://www.gfsc.gg/fetch-records-for-companies-table', data=post_hdrs, ) print r.headers['content-type'] print data = r.json() soup

python - Is there any way to scrape Values from web irrespective of URL -

i have huge list of journal names , issn numbers. trying scrape impact factors. not find way scrape using google search or search matter ? i have tried bs4 needs url , dont have of them. input in data frame title,issn 3dtv-conference,2161-203x aace international transactions,1528-7106 aacl bioflux,1844-9166 ab imperio,2164-9731 abstract , applied analysis,1085-3375 academic psychiatry,1545-7230 academy of banking studies journal,1939-2249 academy of management annals,1941-6067 acarina,2221-5115 accounting education,1468-4489 accounting historians journal,2327-4468 accounting history,1749-3374 accounting history review,2155-2851 use or both columns search , pull impact factors web scrapping. appreciate help.. in advance

javascript - Masking sensitive information in node -

i want mask/hide json values not keys. ex:- myobject = {"name":"value1","phoneno":"545454545445"} output should below: myobject = {"key1":***** ***,"key2":*****} can please tell me, how can in nodejs? thanks. how about: let myobject = { "name": "value1", "phoneno": "545454545445" }; let output = {}; function mask(value: string) { let maskedvalue = ""; (let = 0; < value.length; i++) { maskedvalue += "*"; } return maskedvalue; } object.keys(myobject).foreach(key => { output[key] = mask(myobject[key]); }); console.log(output); // object {name: "******", phoneno: "************"} ( code in playground )

bash - subprocess popen Python -

i executing shell script starting process background option &. shell script called python script hangs. shell script: test -f filename -d & python file cmd =["shellscript","restart"] proc = subprocess.popen(cmd, stdout=subprocess.pipe, stderr=subprocess.pipe, stdin=subprocess.pipe, **kwargs) pid = proc.pid out, err = proc.communicate() returncode = proc.poll() python file hangs , won't return out of python process. python process automated one. the call proc.communicate() block until pipes used stderr , stdout closed. if shell script spawns child process inherits pipes, exit after process has closed writing ends of pipes or exited. to solve can either redirect output of started subprocess /dev/null or logfile in shell script, e.g.: subprocess_to_start >/dev/null 2>&1 & use subprocess.devnull or open file object stderr , stdout in python script , drop communicate() call if don&#

android studio - Launching app Error while waiting for device: Timed out after 300seconds waiting for emulator to come online -

see below info understand problem c:\users\hafiz\appdata\local\android\sdk\tools\emulator.exe -netdelay none -netspeed full -avd nexus_5_api_25 emulator: warning: crash service did not start init: not find wglgetextensionsstringarb! hax enabled hax ram_size 0x20000000 hax working , emulator runs in fast virt mode. emulator: listening console connections on port: 5554 emulator: serial number of emulator (for adb): emulator-5554 launching app error while waiting device: timed out after 300seconds waiting emulator come online. and event log file is 6:53:03 pm gradle sync started 6:54:06 pm gradle sync completed 6:54:10 pm executing tasks: [:app:generatedebugsources, :app:mockableandroidjar, :app:preparedebugunittestdependencies, :app:generatedebugandroidtestsources] 6:54:16 pm gradle build finished in 9s 558ms 6:56:52 pm executing tasks: [:app:clean, :app:generatedebugsources, :app:mockableandroidjar, :app:preparedebugunittestdependencies, :app:generatedebugandro

php - MySQL - Group by for UNION query -

Image
i've been trying find solution problem couple of hours , can't come right query. have 2 tables, stocktake_scans , stocktake_items. need select data both tables , group them together. query have @ moment this: select a.department_description, a.sub_department_description, a.total_cost, a.total_retail, sum(a.qty) qty, a.total_vat, a.vat_rate ( select (case when trim(ifnull(sp.department_description, '')) = '' 'n/a' else sp.department_description end) department_description, (case when trim(ifnull(sp.sub_department_description, '')) = '' 'n/a' else sp.sub_department_description end) sub_department_description, sum(sp.unit_cost_price * ss.quantity) total_cost, sum(sp.unit_retail_price * ss.quantity) total_retail, sum(ss.quantity) qty, (sum(sp.unit_cost_price*ss.quantity)) * (sv.vat_rate/100) total_vat, sv.vat_rate vat_rate stocktake_scans ss inner join stocktake_product

c# - A design for a Foo/TryFoo method pair that has the best performance? -

i have common scenario of needing write pair of methods: one gets result , throws exception if fails, and a try -variant of same method attempts result out param, , returns bool indicates success status. here 2 examples illustrate 2 approaches considering. of these approaches provides best performance? also, 1 approach easier maintain other? open suggestions other ways implement pair of methods. method 1: foo() master public string getanswer(string question) { string answer = null; if(!this.trygetanswer(question, out answer)) { throw new answernotfoundexception(); } return answer; } public bool trygetanswer(string question, out string answer) { answer = null; //business logic return answer != null; } method 2: tryfoo() master public string getanswer(string question) { //business logic if(!answerfound) { throw new answernotfoundexception(); } return answer; } public bool trygetanswer(string ques

Exception thrown when calling Workbook.SaveAs() in Excel.Interop and C# -

we experiencing production issue whereby call excel workbook's saveas method password. exception thrown is: the remote procedure call failed. (exception hresult: 0x800706be) the call done follows, _excelpassword workbook's generated password , exceloutputpath location on disk file should written to: workbook.saveas(exceloutputpath, xlfileformat.xlopenxmlworkbook, _excelpassword, _excelpassword, false, false); there no issue if file saved without password though. what missing please? so solution ended save workbook without password, reopen again, set password on workbook object , save again. tedious, know, fixed remote procedure call failed issue getting

Is google experiments API available in analytics.js? -

we try set google experiments work our backend setup , found there api letting ga know variation have selected show user through function: cxapi.setchosenvariation(chosenvariation, opt_experimentid); when visit official docs: https://developers.google.com/analytics/devguides/collection/gajs/experiments says that: "ga.js legacy library. if starting new implementation recommend use latest version of library, analytics.js. exisiting implementations, learn how migrate ga.js analytics.js. " we use analytics.js. does mean functions present in ga.js in analytics.js , not need worry using function?

c++ - Can't finish the do-while loop by pressing enter key -

i want finish do-while loop when pressed enter key. have idea solve problem? tried check ascii code enter key didn't work out. do{ for(int dongu=0;dongu<secimsayi;dongu++) { cout<<"-"; sleep(1); if(dongu==secimsayi-1) { cout<<">"<<endl; } } for(int dongu2=0;dongu2<secimsayi;dongu2++) { cout<<" "; } for(int dongu3=secimsayi;0<dongu3;dongu3--) { cout<<"-\b\b"; sleep(1); if(dongu3==1) { cout<<&q

oop - C++ HLS Synthesis Warnings -

when try sythnise using vivado hls, errors same line: critical warning: [synchk 200-43 ] pcd_triangulation/pcd_triangulation.cpp:156: use or assignment of non-static pointer 'current.0.i.reg2mem' (this pointer may refer different memory locations). critical warning: [synchk 200-11] pcd_triangulation/pcd_triangulation.cpp:156: constant 'start' has unsynthesizable type 'lass.triangle.2.28.31 = type { [3 x �lass.triangle.2.28.3...' (possible cause(s): pointer pointer or global pointer). critical warning: [synchk 200-11] pcd_triangulation/pcd_triangulation.cpp:156: constant 'start' has unsynthesizable type '^lass.triangle.2.28.31 = type { [3 x �lass.triangle.2.28.3...' (possible cause(s): structure variable cannot decomposed due (1) unsupported type conversion; (2) memory copy operation; (3) function pointer used in struct; (4) unsupported pointer comparison). critical warning: [synchk 200-42] pcd_tri

php - Handling database table entries with backslashes? -

we're running weird edge case trying store json blob in table in our database, , blob needs able contain \ character. user enter in \test needs come that, instead coming tab followed "est" as far can tell, whats happening when user enters , submits "\test" gets evaluated "\ \test" (remove space, cant put 2 backslashes in here , have display right?) client , entered table. can verify in sql gets called against table there 2 backslashes. when @ in table after step "\test" . when client loads again gets evaluated tab followed "est". we under impression second backslash necessary first backslash escaped , not evaluated maybe causing issues? sort of assume when query runs 1 of backslashes gets escaped anyway i'm not sure that. there out our database handling backslashes need looking out for? there way handle haven't considered? it's postgres database if that's helpful. i'd i'm beginner intermediate on

database - Ansible mysql grant -

i want grant privilege on db( test_db ) user( test_user ) using ansible. command shown below. grant privileges on <test_db>.* <test_user>@'localhost'; how execute command using ansible. you this: - name: set mysql user privileges mysql_user: name=user_name priv="dbname.*:all" state=present of course can interpolate variables, username, db name, etc...

performance - Android SVG and installed APK szie -

i have app apk size 4 mb after install grows 50 mb. the app has: - svg files - dagger 2 , other di libraries. i know apk has compressed files i'm trying find out why difference big. does use of svg files increments size of app ones has been installed? does line use reduce size? vectordrawables.usesupportlibrary = true

php - Creating an apache server -

i want create apache server can accessed ip address hosting resources app , using xampp v3.2.2 so. server hosts fine when access webpage hosted machine connected same network(or local network i.e. of server) via server's local ip can accessed via control panel -> network , sharing center -> local area connection status (the server runs windows 7) same doesn't hold true when accessed via machines on different network via global/public ip address of server can acquired using websites " http://checkip.dyndns.org/ ". tried mentioning apache port on address (like 163.199.215.28:80 http , 163.199.215.28:443 https) result no different. can please me how configure xampp host resources globally/publicly via public ip? in advance. edit: the following configurations of xampp apache: httpd.conf: # # main apache http server configuration file. contains # configuration directives give server instructions. # see <url:http://httpd.apache.org/docs/2.4/> detail