Posts

javascript - Required field only if condition is met -

Image
i have form with, among other fields, picture user upload , hidden field hold id. need picture required if id empty, otherwise user editing, there picture in there. can done html only? maybe done javascript, how show default popup (shown below) appears when set required ? i've checked this , this questions, don't provide expected result. popup: any ideas? to set 'popup', need call htmlselectelement.setcustomvalidity() on element. var foo = document.getelementbyid("foo"); // check condition foo.setcustomvalidity("a custom message popup"); the code found here helped me figure out.

javascript - N/currentRecord module does not exist when uploading User Event script to NetSuite (SuiteScript 2.0) -

i trying upload below script netsuite in order currency conversion purchase order currency usd. i custom field updated usd amount whenever user keys in items purchase order. when upload script, receive following error message: fail evaluate script: {"type":"error.suitescriptmoduleloadererror","name":"module_does_not_exist","message":"module not exist: n/currentrecord.js","stack":[]}** would appreciate guidance. thank you. /** *@napiversion 2.x *@nmodulescope public *@nscripttype usereventscript */ define(['n/currency', 'n/currentrecord'],function(currency, currentrecord) { function pocurrencyconversion() { var fixed_currency = 'usd'; var transaction_currency = currentrecord.getvalue('currency'); var tx_currency_total = currentrecord.getvalue('total'); var rate = currency.exchangerate({ ...

Python email checker script shows only unread messages, but not ones received since the program was opened -

i'm writing program, , part of check new emails every 10 seconds. fine , shows me unread messages when start program, on next loop doesn't show newly sent messages since program opened. there particular reason, or doing wrong? in advanced! edit: yes, i've sent messages account in question after program has started, , let sit few minutes, , still nothing while(1): time.sleep(10) print("\n\nrefreshing....") rv, data = m.search(none, 'unseen') #check new messages, works fine first run print(rv) print(data) if rv != 'ok': print("no messages found!") return num in data[0].split(): print("num: " + str(num)) rv, data = m.fetch(num, '(rfc822)') if rv != 'ok': print("error getting message", num) return msg = email.message_from_bytes(data[0][1...

VBA Excel - Solver in the loop returns error on the reference to changing cells and conditions -

i trying loop solver command vba excel, , getting error message regarding variables , conditions in model. idea of model find range of debt , equity financing cash balance zero, , debt , equity components meet covenants (that work bounds in solver run). here code: sub debt_capital_balancing() application.screenupdating = false dim early_repmnt string, cashbeforesolver variant, ced variant, _ dr variant, cc variant, tw single, nde single, de single, w single k = range("forecast_periods").count range("debt_received, debt_early_repayment, re_distribution, _ cc_apic_change").clearcontents = 1 k cashbeforesolver = abs(range("cash_excess_deficit").cells(1, i).value) ced = range("cash_excess_deficit").cells(1, i).value dr = range("debt_received").cells(1, i).value cc = range("cc_apic_change").cells(1, i).value tw = range("target_wacc").cells(1, i).value nde = range("net_...

How to display data from a SQL Server database on an ASP.NET web page? -

so, here's sql query: select [gender], count(*) [usersdb].[dbo].[vwuser] gender='m' group gender in smss, returns m 5298 i want print out value (5298) in div or header on webpage. so, in index.cshtml tried @using webmatrix.data; @{ var db = database.open("usersdbconnectionstring"); var selectquerystring = "select [gender], count(*) [usersdb].[dbo].[vwuser] gender='m' group gender"; } i ripped off example on w3c schools , worked printing out table not this. this didn't work either: @webmatrix.data @{ var db = database.open("usersdbconnectionstring"); var selecteddata = db.query("select [gender], count(*) [usersdb].[dbo].[vwuser] gender='m' group gender"); var grid = new webgrid(source: selecteddata); } <div> @grid.gethtml() </div> any ideas on how work? ...

node.js - Node Express App debugging with calls from separate client app using WebStorm -

Image
i've looked around , had lot of trouble figuring out. i'm hoping might able point me post or have information on how this. my problem have 2 projects i've made using webstorm: i have 1 application server-side code running on port 3000. it's simple node express app. the second application angular 4 / ionic 3 application running client side on port 8100. i want run server application in debug mode, hits breakpoints data being sent client side app. for example: angular / ionic app sends request clients given customer. customer sent via url parameter. want server code pause when receives request , can see url parameter. simple. the server using grunt build project, , nodemon watch it. i'm using npm scripts make life easy. here scripts: "scripts": { "dev": "set node_env=development && nodemon ./bin/www", "grunt": "grunt", "start": "node ./bin/www" }, nothing fancy. ...

algorithm - Traversing exactly n edges, from source node to destination node, find longest path -

suppose have weighted graph, directed , cyclic . every node has edge directed toward every other node. there no edges connect node itself. now have source node, , destination node. have start @ source node , traverse n edges , end @ destination node. n arbitrary positive integer (possibly greater number of nodes in graph). when traverse edge, add our sum (edge weights positive ). path take reach our destination node can have cycles. how can maximise our sum ? if not allowed cycles problem np-complete - see https://en.wikipedia.org/wiki/longest_path_problem assuming allowed paths can include cycles e.g. a,b,c,b,c for = 1..n compute, each node, length of longest path of length terminates @ node. save length , identity of node before n. case i=0 path of length 0 previous node null every node. work out case i+1 case considering, each node, every edge terminating in node. at end chose node step n longest path terminating @ , use records of previous nodes trac...