Posts

Showing posts from July, 2010

python - Adding data from csv file to database using django -

Image
i have django model follows: class traxiorelations(models.model): corgemeente = models.charfield(max_length=100, null=true) coradres = models.charfield(max_length=255, null=true) corhuisnr = models.charfield(max_length=10, null=true, blank=true) that model creates table in database id follows: now want add records csv file model. csv file follows: i use copy command follows: copy master_traxiorelations(corgemeente, coradres, corhuisnr) '/path/to/file.csv' csv header delimiter ';' encoding 'iso-8859-1'; and when execute it, error follows: [2017-08-21 15:50:49] [22p04] error: data after last expected column but when add id copy command, copy master_traxiorelations(id, corgemeente, coradres, corhuisnr) and csv file also: then works fine. how can add data file database, without adding id copy command , csv file? i solved adding id model follows: id = models.autofield(primary_key=true) adding id = models.au

java - how to save the messages one by one in jms -

i reading xml jms queue using activemq jms service , saving data database, i'm getting duplicate values in database because multiple xml processed @ time; need save 1 one xml. @messagedriven (name = "testmessagebean", activationconfig = { @activationconfigproperty(propertyname = "destination",propertyvalue = "jmstestueue?consumer.exclusive=true"), @activationconfigproperty(propertyname = "destinationtype",propertyvalue = "javax.jms.queue"), @activationconfigproperty(propertyname = "acknowledgemode",propertyvalue = "auto-acknowledge"), @activationconfigproperty(propertyname = "maxsession", propertyvalue = "1") }) public class favouritesmdb implements messagelistener { @inject @ejb private testslsb testslsb; public void onmessage(message message) { string xmlmessage = ""; if (message instanceof textmessage) { textmes

mysql - Showing a file tree with parent relation with data from a sql query -

i'm working on final project university, unfortunately stopped in part, because tried several things trying pass variable list inside servlet jsp file use in json function project https://gist.github.com/smrchy/7040377 , render tree. right project render directly sql query not ordered , don't show relationship. right now created constructor create array or list values , parameters in java class, when try send through session or parameter doesn't work... protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { httpsession sessao = request.getsession(false); response.setcontenttype("application/json"); try { ficheirodao x = new ficheirodao(); x.imprime(); list<ficheiro> lista = x.getlista(); jsonobject json; jsonarray addresse = new jsonarray(); jsonobject listas = new jsonobject();; try { (int = 0; < lista.size(); i++) { json = new j

Counting total rows and grouping by a column in mysql -

so i've been looking @ 1 while , can't seem figure out. i have mysql table following format , sample data: id, customer, time, error code, duration 1,test1,00:12:00,400,120 2,test2,00:14:00,404,60 3,test1,00:15:00,404,120 4,test2,00:17:00,503,120 5,test1,00:19:00,400,60 6,test1,00:20:00,400,60 7,test2,00:21:00,503,60 i need results have customer name, total number of rows per customer name, error codes per customer, number of errors per customer , sum duration. above results want get: test1, 4, 400, 3, 360 test1, 4, 404, 1, 360 test2, 2, 404, 1, 240 test2, 2, 503, 2, 240 the problem having when group error code, count number of rows , sum of duration grouped error code. need total count of rows , duration customer not total count of rows , duration customer per error code. please let me know if need include else or if i'm super confusing am. thank in advance help! first need group calculated columns select customer, count(*) total_count, sum(d

osx - Minecraft python API not working -

i have been trying minecraft python api work on mac command: from mcpi.minecraft import minecraft mc = minecraft.create() i keep reciving error: traceback (most recent call last): file "<pyshell#1>", line 1, in <module> mcpi.minecraft import minecraft file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/mcpi/__init__.py", line 1, in <module> mcpi import minecraft importerror: cannot import name 'minecraft' what doing wrong? responses wiki

jquery - How to apply animation in sweet alert 2 when closing the modal? -

does know how apply animation sweet alert 2 on close? appears function(dismiss) doesn't seem trick. $.ajax({ method:'post', url:'sql/record.php', data:formdata, contenttype: false, processdata: false, success: function(response){ swal({ title: 'success!', text: "new record has added.", type: 'success', animation: false, customclass: 'animated tada', showcancelbutton: false, confirmbuttontext: 'ok' }).then(function(result){ }, function(dismiss){ swal({customclass: 'animated bounceout'}); } }); ); wiki

ios - Why is the label's text not updating? -

i'm trying pass data forward table view cell button view controller. depending on row button selected in want following view controller label's text set accordingly. however, when try so, labels in following view controller stay blank , don't change. how can change this? i added action tipbutton in table view controller creates segue keyscontroller fyi. code table view cell: class drillstableviewcell: uitableviewcell { var videourl:[url] = [url(fileurlwithpath: "/users/ralphsimmonds/desktop/plainjayne/coolindb/cook.mov"), url(fileurlwithpath: "/users/ralphsimmonds/desktop/plainjayne/coolindb/check.mov")] var video = url(fileurlwithpath: string()) var initialrow = int() var firsttips = ["tip 1: stay hydrated", "tip 1: keep elbow tucked", "x", "tip 1: take quick breaks:", "tip 1: keep head up", "tip 1: don't cross feet", "tip 1: don't more 15 reps"] var player: avpl

My site showing 302 response code redirects -

as using tools pingdom scanning , found main domain showing 2 302 redirect code , while scan internal link shows 20 302 response code. how fix this, tried adding rewriterule (. ) https://% {http_host}%{request_uri} [r=301,l] , rewriterule . https://% {server_name}%{request_uri} [r=301,l] but nothing happens after cleaning web server cache. wiki

linux kernel - Adding a custom (800x480) resolution to an Android port -

i'm trying support non-standard 800x480 resolution in android, part of porting android new device. i have added resolution kernel, reports: mipi dsi driver module loaded mxc_hdmi 20e0000.hdmi_video: detected hdmi controller 0x13:0xa:0xa0:0xc1 fbcvt: refresh rate not cvt standard fbcvt: *800x480@57*: cvt name - not cvt standard - 0.384 mega pixel image mxc_sdc_fb fb@0: registered mxc display driver hdmi console: switching colour frame buffer device *100x30* the 100x30 character cells imply 800x480 resolution (assuming 8x16 pixel font). when android boots, outputs 720x480 display. how android choose screen resolution use? i'm assuming need add 800x480 resolution somewhere in android filesystem, , adding kernel required not sufficient. where add 800x480 resolution android filesystem? wiki

c# - How to setting a model with table don't have any primary key column -

on setting dbcontext , have modelbuilder.entity<person>(app => { app.totable("person"); }); the efcore throws exception: the entity type "person" requires primary key defined but our person table doesn't have primary key column. how avoid ? ef core doesn't support tables without primary keys (aka heaps). reason simple: needs able manipulate individual records, cannot safely achieved without primary key. resolution, can add dummy column/primary key of type int/identity or guid/uniqueidentifier, , ignore it. wiki

oracle - Export SQL result set in UTF-8 in Shell script -

i extracting data set file through shell script. arabic characters coming ??? character. how load these character utf-8 format proper character set result in file. please suggest. first ensure terminal set utf-8 locale charmap or echo $lang the set nls_lang environment variable, example export nls_lang=.al32utf8 wiki

android - Setting up NativeScript on Mac. "The ANDROID_HOME environment variable is not set or it points to a non-existent directory -

i'm trying started nativescript, when try run tns run android , gives me: $ tns run android android_home environment variable not set or points non-existent directory. not able perform build-related operations android. i have setup android_home in ~/.bash_profile $ echo $android_home /users/mb102/library/andriod/sdk this path matches what's in android studio manager, i've downloaded , setup device: $ tns devices connected devices & emulators searching devices... ┌───┬──────────────────────┬──────────┬───────────────────┬──────────┬───────────┐ │ # │ device name │ platform │ device identifier │ type │ status │ │ 1 │ sdk_google_phone_x86 │ android │ emulator-5554 │ emulator │ connected │ └───┴──────────────────────┴──────────┴───────────────────┴──────────┴───────────┘ is there more ought do? the typo in path? $ echo $android_home /users/mb102/library/andriod/sdk should be: $ echo $android_home /users/mb102/library/andr

android - Form does not send data to e-mail -

i'm trying send data of form e-mail, nothing happens. how can fix it? i'm new @ programming language , love guidance! <title>solicitud de vendedor honorario</title> <form action="mailto:erocha@newenergypr.com" method="post"> <table> <tr><td colspan="2" align="center" bgcolor="#ff8000"><h2>solicitud de vendedor honorario</h2></td></tr> <tr><td colspan="2" align="center" bgcolor="#d4d4d4">adiestramiento</td></tr> <tr> <td colspan="2" align="center" bgcolor="#1b4f72"> <select name="yesno" id="yesno" size="1"> <option value="yes">yes</option> <option value="no">no</option> </select> </td> </tr> <tr><td

dovecot - How to replace a character by another in a variable -

i want know if there way replace character in variable. example replacing every dots underscores in string variable. i haven't tried it, based on variables specification , way i'd try approach try match on text before , after dot, , make new variables based on matches. like: set "value" "abc.def"; if string :matches "${value}" "*.*" { set "newvalue" "${1}_${2} } this will, of course, match on single period because sieve doesn't include looping structures. while there's regex match option , i'm not aware of regex replacement sieve extensions. another approach complex mail filtering can dovecot (if need loops , have full access mail server) dovecot-specific extensions vnd.dovecot.pipe allows mail administrator define full programs (written in whatever language 1 wishes) process mail on way through. wiki

Python CSV output two rows instead of two column -

i outputing dictionary, see code below. but, out creates 2 rows. instead of 2 columns. with open("<location of file>"+str(report_date)+".csv", 'w') f: w = csv.writer(f) w.writerow(output_list.keys()) w.writerow(output_list.values()) excel output: col 1 row 1, col 2, row 1, col 3 row 1 col 1 row 2, col2 row 2, col 3, row 2 i see output 2 columns: column 1 way down dictionary keys column 2 way down dictionary values you outputting 2 rows because telling output 2 rows. writerow if call twice. need iterate on individual items if want output 1 row per item: w = csv.writer(f) item in output_list.items(): w.writerow(item) item two-element tuple contains key , value. wiki

javascript - jQuery .click() event not working in Android WebView -

my simple html code: <a href="#" onclick="$('#imageupload').click();return false;">photo upload</a> <input type="file" id="imageupload" multiple accept="image/*"> my android mainactivity class in mainactivity.java: private webview mwebview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mwebview = (webview) findviewbyid(r.id.webview); mwebview.loadurl("http://mywebapp/"); websettings websettings = mwebview.getsettings(); websettings.setjavascriptenabled(true); mwebview.setwebviewclient(new webviewclient()); } @override public void onbackpressed() { if(mwebview.cangoback()) { mwebview.goback(); } else { super.onbackpressed(); } } everything working perfect in chrome desktop , chrome mobile. but there problem @ webview is there simple ,

Android firebase token refresh failed -

android firebase token refresh. if new token generated firebase, call ontokenrefresh , service update token server. is there way check firebase directly server new tokens generated clients old tokens ? if mobile switched off sometime , fire base tried send refresh token failed. how fire base send token in case. keep try until send new token device ? thanks if mobile switched off sometime , fire base tried send refresh token failed. how fire base send token in case. keep try until send new token device ? the firebase servers don't send fresh tokens devices. instead, firebase sdk inside device/app requests new token when detects required. happen when device turned on. wiki

c# - Any other optimal way to update the parent table's columns when a child table is updated? -

i have few table structure below: create table person ( personid int primary key, name nvarchar(255), lastupdatedby int, lastupdateddate datetime ); create table info ( infoid int primary key, personid int, info nvarchar(255), lastupdatedby int, lastupdateddate datetime ); create table setting ( settingid int primary key, personid int, setting nvarchar(255), lastupdatedby int, lastupdateddate datetime ); i face new procedure follow if there updates on info or setting table, need relevant updates person table on columns lastupdatedby , lastupdateddate. what first come mind create sql trigger automatically update person table when info or setting table does. take quick glance through few articles stating sql trigger should avoided it's expensive process when creating it, while people recommends change in application code. example, using (var db = new dbcontext()) { var result = db.info.singleordefault(x =>

excel - Retain combobox value when wb closes -

in continuation following question how store combobox value after workbook closes ? example, if last combobox value may when closed workbook, next time open againg, combobox list value set may. thank you! however, can store data in workbook in excel name object, , can store data in customdocumentproperty object. value want store number, 7. store data in name object: names.add name:="versionnumber", refersto:=7 and change it: names("versionnumber").value = 8 this has advantage name can referred in cell formula (i.e., =versionnumber yield 8 in cell) similarly, create new customdocumentproperty : thisworkbook.customdocumentproperties.add _ name:="version number", _ linktocontent:=false, _ type:=msopropertytypenumber, _ value:=7 and change it: thisworkbook.customdocumentproperties("version number").value = 12 wiki

slurm - sinfo command does not show updated information about allocated nodes -

i wonder why sinfo command shows different information returned squeue . have experienced on several occasions number of allocated nodes returned sinfo did not match allocated nodes showed in squeue . has noticed issue? i'm using version 17.02, in previous versions i've experienced behavior. for instance, i've executed squeue , sinfo @ same moment @ get: thu aug 24 10:12:50 2017 jobid partition name st time nodes nodelist(reason) 57011 dmrtest jacobi-98 r 3:02 4 s07r2b[15-18] 57012 dmrtest cg-99 r 3:02 4 s07r2b[11-14] 57010 dmrtest jacobi-98 r 3:24 32 s01r1b[39,42,45-48],s07r2b[09-10],s09r2b[54-58,63-64,67],s14r1b[61-62,65-67],s14r2b[49,54- 57,61-63,65],s24r2b[57,59] 57008 dmrtest nbody-96 r 3:52 8 s09r1b[53-55,57-59,61-62] 57009 dmrtest nbody-97 r 3:52 4 s10r2b[49-50],s14r2b[69,72] 57007 dmrtest nbody-95 r

javascript - custom validation not working with google recaptcha -

i have added google recaptcha in page. , javascript custom validation too. problem first time validate function gets executed after not getting executed. here code <script src="https://www.google.com/recaptcha/api.js" async defer></script> <script language="javascript" type="text/javascript"> function submitform() { if (validateform() == true) { document.getelementbyid("form_1").submit(); } } function validateform() { if (document.getelementbyid('email').value == "") { alert(false); return false; } else { alert(true); return true; } } </script> </head> <form id="form_1" method="post" action="http://www.google.com" onsubmit="return validateform();"> <div id="divinvisiblecaptcha1" class="g-recaptcha" data-si

python - Generic string comparison with numpy -

Image
if have multiple numpy arrays of different string types, such as: in [411]: x1.dtype out[411]: dtype('s3') in [412]: x2.dtype out[412]: dtype('<u3') in [413]: x3.dtype out[413]: dtype('>u5') is there way can check whether all strings without having compare each individual type explicitly? for example, do in [415]: x1.dtype == <something> out[415]: true in [416]: x2.dtype == <something> # same above out[416]: true in [417]: x3.dtype == <something> # same above out[417]: true comparing str = no bueno: in [410]: x3.dtype == str out[410]: false one way use np.issubdtype np.character : np.issubdtype(your_array.dtype, np.character) for example: >>> np.issubdtype('s3', np.character) true >>> np.issubdtype('<u3', np.character) true >>> np.issubdtype('>u5', np.character) true this numpy dtype hierarchy (as image!) taken numpy documentation. it's

c# - Save value for a Cash sale with a custom segment field -

i'm trying save cash sale in netsuite, have custom segment field called business unit (scriptid = custbody_cseg2) , need put specific value (internal id = 2 in custom segment). i'm using following code pretty same have in netsuite's applied cash sale transaction: selectcustomfieldref selectcustomfieldref = new selectcustomfieldref(); listorrecordref custselectvalue = new listorrecordref(); custselectvalue.internalid = "2"; //custselectvalue.typeid = "286"; <- or whitout doesn't change selectcustomfieldref.value = custselectvalue; selectcustomfieldref.scriptid = "custbody_cseg2"; customfieldref[] customfieldrefarray = new customfieldref[1]; customfieldrefarray[0] = selectcustomfieldref; cashsale.customfieldlist = customfieldrefarray; when run code following error: [code=insufficient_permission] not have permissions set value element custbody_cseg2 due 1 of following reasons: 1) field read-only; 2) associated feature disabled;

python - How do I get random enemies to appear from list? -

i'm trying random car appear list of cars saved in variables. issue seems chooses random car list , doesn't change while game being played. i'd change car each time previous car goes off screen. each time game starts chooses 1 car random list, not change car each time game loop runs. i believe problem lies in bit of code randomcars = [car1, car2, car3, car4, car5, car6, car7, car8] enemy = random.choice(randomcars) i have pasted full code below: import pygame import time import random pygame.init() ############# ############# display_width = 800 display_height = 600 black = (0, 0, 0) white = (255, 255, 255) red = (200, 0, 0) green = (0, 200, 0) bright_red = (255, 0, 0) bright_green = (0, 255, 0) block_color = (53, 115, 255) crash_sound = pygame.mixer.sound("crash.mp3") car_width = 55 gamedisplay = pygame.display.set_mode((display_width, display_height)) pygame.display.set_caption('super racer') clock = pygame.time.clock() gameicon =

c# - ArgumentException when creating driver from service "Requested value 'windows-7-32bit' was not found" -

i'm consistently getting system.argumentexception "'requested value 'windows-7-32bit' not found.'" this happens when creating driver service (which i'm doing keep command prompt hidden) below: pjsdriverservice = phantomjsdriverservice.createdefaultservice(); pjsdriverservice.hidecommandpromptwindow = true; pjsdriver = new phantomjsdriver( pjsdriverservice ); to date i've tried updating , downgrading selenium package (that i've pulled in via nuget) no effect. changing target processor has no effect either. also, whilst it's running on win7 system, it's 64bit, don't know getting windows-7-32bit from. phantomjs.exe in right place. it working fine until recently, have no idea what's broken. wiki

Unable to consume JAVA sdk for Google classroom API's getting PERMISSION_DENIED Request had insufficient authentication scopes -

Image
i trying integrate google classroom in java project using oauth 2.0 server server authentication, example given here official google class room integration doc uses oauth consent screen authentication , altered code server server authentication few changes progress far: created google app enabled google classroom api dashboard. created service account key (.p12) server-to-server authentication(later used in code along application name) public class quickstart2 { private static final string application_name ="my_app_name"; private static final jsonfactory json_factory = jacksonfactory.getdefaultinstance(); private static httptransport httptransport; /** global instance of http transport. */ private static httptransport http_transport; private static final string service_account_email = "id_creaded_on_google_app"; /** global instance of scopes required quickstart. * * if modifying these scopes, delete sav

javascript - mysql Date is returning strange characters -

Image
so have large query working fine until added jobs.deliverydate. query still has no errors when echo out value echoes these strange characters. i'm wondering if has mysql datatype. variable has datatype of date, i'm able pull in datatype of datetime fine. $query = $connect->prepare(" (select jobs.jobid, jobs.jobname, jobs.pdf, jobs.deliverydate, jobstatus.status, rooms.roomid, rooms.roomname, rooms.assemblys, rooms.assemblyf, rooms.assembledf, rooms.assemblyneeded, rooms.woodtype, rooms.finishtype, rooms.finishcolor, rooms.numberofboxes, rooms.isrush, rooms.description, jobnotes.note jobs left join rooms on jobs.jobid = rooms.jobid left join jobnotes on jobnotes.jobid = jobs.jobid left join jobstatus on jobstatus.statusorder = jobs.statusorder (rooms.assemblyneeded = 1) , ((rooms.isrush = 1 , rooms.assemblyf = 0) or (rooms.isrush = 1 , rooms.assemblyf null)) g

javascript - Dynamically load and render react component with input[type=file] -

i'd load react js component dynamically through html file input. essentially, i'd achieve same effect if had done import foo ./foo.js i can read file text after onchange event of html element, don't know it? possible achieve goal? thanks! onchange(e) { var fr = new filereader() fr.addeventlistener('load', f => { window.console.log(f.target.result.substring(0, 500)) // yields: import react, { component } 'react' ... class foo extends component { ... // what? }) fr.readastext(e.target.files[0]) } so, ended getting work babel-standalone . i'm able use stateless, functional components, however, , feel though implementation improved. example, don't how have string.prototype.replace . anyway, here's worked me, might you, too. // filetobeloaded.js const elem = () => <h1>hello, world!</h1> // foo.js import react, { component } 'react' import { transform } 'babel-standalone' cl

css - bug of loading background picture -

Image
i have strange probleme moment. wrote simple website looks like: displays normally. when try refresh it, not often, maybe 1 time 10 freshes, display of background photo bugged like: i'm new frontend design , don't know happened. can me? here html , css code, , bug appears chrome, firefox works well. html code: <!doctype html> <html> <head> <meta charset = "utf8"> <meta http-equiv="pragma" content="no-cache"> <link rel=stylesheet type=text/css href="{{ url_for('static', filename='login.css') }}"> <title> login page :) </title> </head> <body> <div id="div_title"> <span id="title"> welcome wentong's website! </span> </br> <a href="{{ url_for('homepage') }}" id="guestlink">entrance guests here :)</a> </div> {% message in ge

java - How Apache CXF technically integrates with Spring Framework -

i know use apache cxf spring declaring cxf beans, want know how these framework technically integrates each other. does cxf libraries provide service provider interface known spring, spring scans this, instantiates service , takes control of it? or cxf implement other standard mechanism spring integration? if so, standard? or cxf library expose spring annotations / bean declarations participate in spring configuration when in classpath? where can find exact sequence of how spring takes control of cxf having both of these frameworks on classpath , necessary configuration both of them running together? configuration scanned in side, api's called , on. cxf's bus , default implementation springbusfactory scans spring xml bean configuration files. can find more information in http://cxf.apache.org/docs/cxf-architecture.html#cxfarchitecture-bus or looking @ sourcecode: https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/bus/spring/springb

formula to input a comma in excel -

Image
hi have here 60 contacts address. need put comma in street number after street name example: 12 chatswood court, robina 12, chatswood court, robina how can in excel without doing manual because took long me manually ? thank help if address starts street number can use =substitute(a1," ",", ",1) wiki

asp.net mvc - MVC-update takes effect from stored procedure in database side but not from the same sp in c# MVC -

i have following code, run stored procedure after that. in case, grid not updated, if run stored procedure same values in database, grid gets updated. i no errors in either case. possible connection aborted database? [httppost] public void update_grid(turbinedvce frm) { npgsqlconnection con = null; datatable ds = new datatable(); string cn = system.configuration.configurationmanager.connectionstrings["lts"].connectionstring; con = new npgsqlconnection(cn); try { var test_publicip = "null"; var test_devicetype = "null"; var test_modelproducer = "null"; var test_description = "null"; var test_username = "null"; var test_password = "null"; var test_phone = "null"; var test_firmwareversion = "null"; if(frm.publicip != null)

python - Renaming a column in a df without the need of stating the old name -

i have following df: 24/08/2017 tests: ch4 10 h20 9 nh4 4 c02 1 so4 1 how rename unique column name without need of stating old name? the common method know requires state old name of column such as: df = df.rename(columns={'old_name': 'new_name'} how rename column name without need of stating old name ? wiki

How to read multiple JSON objects from one file in Go -

how can read json file there 2 different objects using unmarshal ? json example: this structure corresponding json file. { "mysql": { "address": "127.0.0.1", "port": "3306", "user": "user", "password": "password", "database": "database" }, "postgres": { "address": "127.0.0.2", "port": "3306", "user": "user2", "password": "password2", "database": "database2" } } code snippet: type database struct { address string port string user string password string database string } type mysql struct { database } type postgres struct { database } to this, need wrap mysql , postgres structure configuration structure pass unmarshal function: type configuration struct { m

How to make path a hyperlink with space in path using powershell -

i using powershell script created email user when files received in folder. problem having of folder paths being watched have space in path breaking hyperlink in email body sent. how can include space doesn't break hyperlink. i use pathname: $(split-path $event.sourceeventargs.fullpath) the code add body of email using below: $global:newfiles.add("`n[$(get-date -format hh:mm:ss)]`tnew file named $($event.sourceeventargs.name) arrived in $(split-path $event.sourceeventargs.fullpath) , copied $($dpath)\$((get-date).tostring('yyyy'))\$((get-date).tostring('mmm yyyy'))\$((get-date).adddays(1 + $(1,2 -eq 7 - [int]$formatteddate.dayofweek) ).tostring('mmm d yyyy'))") here how email sent: while ($watcher.enableraisingevents -or $global:newfiles.count -gt 0) { #sleep start-sleep -seconds 60 if($global:newfiles.count -gt 0) { #convert list of strings single string (multiline) $smtpbody = $global:newfiles $smtp.send($smtp

mysql - How can i perform the arithmetic operation in SQL? -

now want perform arithmetic operation through query. so, need output (points[1]+points[2]+points[4]-points[3] = result). example: 50+50+50-150 = 0 points. so how possible via sql query. +-------------+-----+ | points_type | sum | +-------------+-----+ | 1 | 50 | | 2 | 50 | | 3 | 150 | | 4 | 50 | +-------------+-----+ you select sum(sum) - 2 * (select sum tablename points_type = 3) tablename where tablename name of table wiki

reactjs - How to render the children correct in the react tree component? -

i'm using react tree component called rc-tree . i'm trying dynamic/lazy-load children nodes, have problems. my github repo here added readme file on steps import data , run application. first issue: can generate parents (first level of tree), when click on + next parent node, ex 13000000 can generate children nodes parent node , console log them, tree not update children. when comment out line if (level < 1 || curkey.length - 3 > level * 2) return; can display children follow these steps.. , not direct clicking + sign... 1. clicking plus sign on node 2. clicking minus sign on same node 3. clicking on plus sign again on same node. it looks item.children undefined, first time click + sign expand, second time click again item.children populated children nodes. second issue can drill down 1 level, after stops working. for example 13000000 -> can children (13010000,13020000,13030000,13040000,13050000) -> cant 13010100,13010200 , children (ex 130101

node modules - npm link and node_modules folder -

maybe can me current problem. let's have angular (4) root application , module want integrate it. develop them both localy , want test them. 1 solution should taht npm link them... i use 'npm link' in modules folder (let name module 'module') , go angular root application , execute 'npm link module'. in node_modules folder symlink 'module' created , looks fine...but when - dependencies of 'module' not resolved. meands in node_modules folder can find 'module' , in folder find again node_modules folder should not (and webpack has problems it). do have solution problem - except manually deleting node_modules folder , hopping dependcies resolved in root application? thanks every help! wiki

Git bash Error: Could not fork child process: There are no available terminals (-1) -

Image
i have had 8 git bash terminals running @ same time before. currently have 2 up. i have not seen error before , not understanding causing it. any appreciated! picture attached: found similar issue , potential solution here: https://groups.google.com/forum/#!topic/git-for-windows/eo27wwvhx64 i'm not sure if guys still having problem this, found simple fix worked me. opened windows command prompt , ran command $ tasklist it looks though ssh connections had made in git bash shells weren't being closed when windows closed , hanging available git bash shell windows. this may dangerous solution windows command prompt ran $ taskkill /f /im ssh.exe everything appears working again after this. may not have directly been issue of orphan processes, worked @ least me. luck! wiki

node.js - How to avoid "npm fetch GET 200" logs when invoking install in npm 5 -

ever since upgrade npm 5 gazillion of npm fetch 200 ... messages (see below) on build servers despite setting npm config set loglevel warn . there new setting that? [0m[91mnpm info[0m[91m config[0m[91m set "loglevel" "warn" [0m[91mnpm info [0m[91mok [0m[91mnpm[0m[91m info worked if ends ok [0m[91mnpm info using npm@5.3.0 npm info using node@v8.3.0 [0m[91mnpm info lifecycle myapp-client@0.0.1~preinstall: myapp-client@0.0.1 [0m[91mnpm http fetch 200 https://registry.npmjs.org/babel-eslint 98ms [0m[91mnpm http fetch 200 https://registry.npmjs.org/babel-eslint/-/babel-eslint-7.2.3.tgz 23ms [...] docker containers node set env variable npm_config_loglevel info instead of default warn . can set env var or use npm install --loglevel warn override behavior. wiki

java - How can I open files inside a subfolder in my asset folder -

hello community i'm new developer , i'm working on app presents documents user user can open them , modify content if wish so, issue i'm facing these documents numerous , organized in folders, best way me proceed ? store these documents inside app (can put them in asset folder )? how can keep same structure of files in app (same organization in respective folders) you can way. getresources().getassets().open("subfolder/file"); wiki

Convert iOS App Store Purchases to IAP in Another App -

i'm looking combine free , paid (pro) versions of application free version in-app purchases. however, not want neglect user's have purchased pro version of game. apple offer way provide free access iap, or transfer purchase history? related question wiki

c# - Dapper.Contrib - Insert Converting AutoIncrement BIGINT to Int32 -

i have mysql table has bigint column primary key, , auto increment value @ 9888008450 (obviously larger 32 bit number). when call insert function dapper.contrib, throwing exception: value either large or small int32. this issue happening insert function. get, insert , delete functions work fine. here test application: static void main(string[] args) { using (var conn = new mysqlconnection(connstring)) { try { conn.execute("drop table if exists test;"); conn.execute("create table test (accountnumber bigint(20) primary key auto_increment,name varchar(50) not null);"); conn.execute("alter table test auto_increment = " + ((long)int.maxvalue + 1)); var test = new test { name = "test name" }; conn.insert(test); console.writeline(test.accountnumber); } catch (exception ex) { console.writeline(ex.tostring()

jquery - Border Radius Animation -

i building site on squarespace , trying border radius of first page change while scrolling. animation works in squarespace preview if go on computer or in incognito mode on chrome doesn't work. border radius isn't changed remains flat. there conflicting in code? css: #intro{ border-top-left-radius: 0% !important; border-top-right-radius: 0% !important; width: 150vw; overflow: hidden; right: 26vw; height: 800px; } jquery: <script> var hheight = $("html").height(), radius = 100; $(window).scroll(function() { var scrolltop = $(window).scrolltop(), percent = 150 - ((150*scrolltop)/hheight) * 2; $("#intro").css("border-radius", percent + "%"); }); </script> why don't use transition style? #main { background: white; height: 20px; width: 20px; border: 1px solid black; transition: border-radius ease 0.5s; } #main:hover { border-radius: 22px; } <d

Connect Azure SQL Database (PAAS) to SQL Assesment -

i have existing azure sql db (paas solution) in resource group 1. created new oms work space in log analytics resource group 2. want connect sql db in resource group 1 oms work space sql assessment in resource group 2. how can enable connectivity ? i followed article https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-sql-assessment if understand correctly , don't need install agent. how can add sql db sql assessment . currently see no db connected in sql assessment you can't, sql assessment solution designed on premise sql server or sql database (iaas). azure sql database(paas), should use the azure sql analytics solution instead of sql assessment. the azure sql analytics solution doesn't use agents connect log analytics service. wiki

python - I have a table of values that I want to integrate with other functions -

i have table of lot of data points, , want use them function multiply other functions , integrate. i'm not sure how go this. figured out how integrate table using simpsons rule, , tried use numpy.polynomial.plynomial.polyfit best fit curve points values way off here have far: import numpy np scipy import stats, integrate import matplotlib.pyplot plt scipy.integrate import quad import math s=5.670367e-8 a,b=np.array(np.loadtxt('cagn2.txt', skiprows=1, unpack=true)) #change file based on agn want. freq=np.arange(1e12,1e24,7e16) a1=a*2.41798926215e14 def f(nu): return nu**-1 #changed based on want def total(nu): return b * nu* f(nu) """ here want place function describing data points instead of 'b'""" e,err=quad(total,0,np.inf) #print(e) =integrate.simps(total,a1,even='first') #integrates table only, not want #print(i) c1,c2,c3,c4,c5=np.polynomial.polynomial.polyfit(a1,b,4) def y(x): return c1+ c2*x

node.js - cannot pass learnyounode: is the callback function used uncorrectly? -

i trying solve sixth problem of learnyounode needs module file print file list. here 2 files: the main file program.js : var mymodule = require('./module.js'); mymodule(process.argv[2], process.argv[3], function(err, file){ if(err){ console.log(err); return; } console.log(file); }); the module file module.js : var fs = require('fs'); var path = require('path'); var fileext; module.exports = function(dir, ext, callback) { fs.readdir(dir, function(err, files){ if(err){ callback(err); return; } files.foreach(function(file){ fileext = path.extname(file).substring(1); if(fileext === ext){ callback(null, file); } }); }); } but throws error: processors[i].call(self, mode, function (err, pass) { typeerror: cannot read property 'call' of undefined what doing wrong? the instruc

google api - get the title on live video in youtube using API YouTube V3 -

i using api live streaming youtube retrieve list of live chat messages on youtube video using id_video, exits serveral properties appear in resource such snippet.livechatid, snippet.displaymessage can found them ressource, question how can title on live video in channel youtube not me ? thanks you may want check documentation . items[] property return list of live streams match request criteria. { ... }, "items": [ livestream resource ] } the following json structure shows format of livestreams resource : { "kind": "youtube#livestream", "etag": etag, "id": string, "snippet": { "publishedat": datetime, "channelid": string, "title": string, "description": string, "isdefaultstream": boolean }, ... } wiki

Provider not found in the contract using SQLite in android with java -

i want implement provider access sqlite database in java android project using contentprovider class.but when build have error : failed find provider info com.sdnsoft.natemps.natemps.data.natempsprovider this code: the manifest file <provider android:name="natempsprovider" android:authorities="com.sdnsoft.natemps.natemps.data" android:enabled="true" android:exported="false"> <grant-uri-permission android:pathpattern=".*" /> </provider> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundicon="@mipmap/ic_launcher_round" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity" android:label="@string/app_name" android:theme="@style/app