Posts

Showing posts from January, 2010

How do I correctly write the following URL in RegEx -

a non-dev here, need writing regex url - https://example.co.uk/checkout/order-received/210553/?key=wc_order_57960575c7d73 in order track in kissmetrics, far have gotten https://example.co.uk/checkout/order-received/?([ \da-z.-]+)/ but feel stuck, can lend me hand? thanks! the regex want https:\/\/example\.co\.uk\/checkout\/order-received\/\d+\/\?key=wc_order_[\da-z]+ . what match first part of url literal string, order number abitrary string of digits. after that, escapes question mark (as question marks have specific meaning in regex) , matches query string, including end bit ( [\da-z] , of course, refers string composed of both letters , numbers).

Android: how to implement grid with different columns/rows size -

Image
i need implement this: seems staggeredgridlayoutmanager | gridlayoutmanager can not it, how achieve now? gridview has performance? you can achieve kind of recyclerview behavior twoway-view i tested 1.0.0-snapshot version of lib. it's kind of old project (not maintened anymore), can write own recyclerview/layoutmanager. example of layout in recyclerviewadapter need set span logic: @override public void onbindviewholder(recyclerview.viewholder holder, int position) { super.onbindviewholder(holder, position); final spannablegridlayoutmanager.layoutparams lp = (spannablegridlayoutmanager.layoutparams) holder.itemview.getlayoutparams(); final int span1; final int span2; if (position == 0) { span1 = 2; span2 = 2; } else if (position == 3) { span1 = 2; span2 = 3; } else { span1 = 1; span2 = 1; } fina...

python - Fixing different id having same images in a csv column by renaming? -

as new python programmer, i'm having trouble figuring out how accomplish following. given input data csv file: sku image_name b001 a.jpg b002 a.jpg b001 b.jpg b002 c.jpg b003 x.jpg where multiple sku 's might have same image name. when occurs, want rename image name in image__name column concatenating "_" + sku value shown image name in same row. so desired output data be: sku image_name b001 a_b001.jpg b002 a_b002.jpg b001 b.jpg b002 c.jpg b003 x.jpg after should rename images in image folder according image_name column. this have far: import csv #open , store csv file open('d:\\test.csv', 'rb') csvfile: spamreader = csv.reader(csvfile, delimiter=',') ok, you've got quite ways go, should give hints on how proceed (assuming reasonable number of files): import csv os.path import splitext open("/tmp/test.csv", 'rb') csvfile: itemlist = [] ...

ajax - jQuery run one group of functions after another -

i have 2 groups of functions: $(document).ready(function() { var id = $(this).attr('id'); // first group of functions getcountry(id); // second group of functions getresult(id, 'all'); }); within each group, functions ajax calls , chained together. means getcountry() run first , calls getregion() on success ajax property, getregion() calls gettown() on success ajax property , on. these functions used fill form dropdown lists (selects). towns of region of country have selected. i need form lists filled before run getresult() function. i don't want call getresult() inside getcountry() because have call getresult() if user changes selected options after page loaded. in case getresult() take various parameters other 'all' . i'm looking simple way re-write $(document).ready(function() in order say: first: run getcountry() , depending functions then run getresult() , depending functions i'm ...

How to set default values for missing environment variables in maven pom -

is possible have maven provide default values missing environment variables? if so, how? context: i have properties files placeholders environment variables, this: my.property=${env:environment_property} running maven (edit: not mvn ... -denvironment_property=some_value ) if environment variable set in os makes resolve property placeholder given value. if environment variable not exist, value blank. problem: i environment variables have default value. if environment variable not exist should given default value specified in pom or properties file or whatever. important: the property placeholders have point environment variable. the maven resources plugin friend. should run part of build. not filter resources default. have configure that: <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> then configure filter: <build> ... <filters> <...

adding a counter to a column in sharepoint website without using designer -

Image
how can add counter sharepoint column, in image? not allowed use sharepoint designer purpose. have done before not sure how got page click on 3 dots above column names , click on 'modify view' scroll down 'totals' tab @ bottom , click on plus sign. go column want show counter , select 'sum' or 'count' depending on requirement. click 'ok'

powershell - how to write a (unix like) function that accepts pipe or file name input? -

e.g. want head either accepts array piped , select-object -first , or, receives list of file names parameters , outputs first lines of each. cat $filename | head should work head $filename here's i've tried far: function head( ) { param ( [switch] $help = $false, [parameter(mandatory=$false,valuefrompipeline=$true)] [object[]] $inputs, [parameter(valuefromremainingarguments=$true)] [string[]] $files ) if( $help ) { write-host "usage: $($myinvocation.mycommand) [<file>] <numlines>" return } $lines = 0 if ($files -and [int]::tryparse($files[0], [ref]$lines)) { $null,$files = $files } else { $lines = 10 } $input | select-object -first $lines if ($files) {get-content -totalcount $lines $files} } but causes function ignore first parameter: c:\users\idror.tlv-wpvaj> head c:\temp\now.ps1 c:\users\idror.tlv-wpvaj> head c:\temp\now.ps1 c:\temp\now.ps1 f...

azure - Is it possible to asynchronously query DocumentDB for all documents (i.e no paging)? -

is possible, using documentdb .net sdk , make run asynchronous query against db returns matching documents? the answer answer stackoverflow question: querying azure documentdb executenextasync returns fewer maxitemcount indicates that: there limits how long query execute on documentdb. ... if these limits hit, partial set of results may returned. i know it's possible overcome above mentioned limit iterating on paged results so: ( source ) list<family> families = new list<family>(); feedoptions options = new feedoptions { maxitemcount = 1 }; var query = client.createdocumentquery<family>(collectionlink, options).asdocumentquery(); while (query.hasmoreresults) { foreach (family family in await query.executenextasync()) { families.add(family); } } my question - loop necessary? might there more elegant way tell sdk return results available (without paging)? the loop have best way perform enumerating across mult...

angularjs - How to access from parent form to a certain child form generated in ng-repeat without the need to add things like frmChild {{$index}}? -

how access frmparent frmchild ? (without need add things like: frmchild {{$index}} ). <div ng-form="frmparent"> how know frmchild (i.e @ index 3) $pristine value here <div ng-form="frmchild" ng-repeat="item in mct.listofelements"> {{item.name}}: <input type="text" ng-model="item.value" /> pristine: {{frmchild.$pristine}} </div> </div> here working example play i'm talking about. you can use unique names child forms, ex. item.name if it's supposed unique: <div ng-repeat="item in mct.listofelements" ng-form="{{item.name}}"> {{item.name}}: <input type="text" ng-model="item.value" /> pristine: {{frmparent[item.name].$pristine}} </div> and refer required child form it's name: d pristine: {{frmparent.d.$pristine}} please see plunker .

c# - Send keyboard & mouse events to server application -

i have 2 application. 1 written in c# , runs on laptop (the client), , other written in c++ (it's unreal engine 4 application) , runs on amazon web services instance (the server). i have written both applications , have full control of them. i'd direct user input on client device application running on server (ue4 application). record user input events on client, serialize them json, transmit on network, deserialize , map ever function want within ue4 application, cumbersome , in no way ideal, since ue4 has built-in input event listeners... essentially, want control ue4 application (running on server) if running locally (on laptop, client). does here know how can direct keyboard & mouse events client server application? i solved writing application runs on client , listens key down event. key down event sent on network via udp application runs on server (as ue4 application). used method described here pass incoming message target application in case,...

android - Changing fragment with click on imagebutton -

i new android. , trying create app have 3 imagebuttons on top in horizontal line , fragment in below portion can change click of button (same tinder android app). have tried using 2 different fragments, 1 3 image buttons , other below one). tried using gridview images , fragment in below portion. have tried using images , dynamically changing fragments. have got different errors resulting in crashes. want know how can achieve objective in efficient way? edit : codes following when using images without gridview or fragments imagebuttons . package com.psycho.ayush.sahanubhooti_20; import android.support.v4.app.fragmentactivity; import android.os.bundle; import android.support.v4.app.fragmenttransaction; import android.view.view; import android.widget.imagebutton; import android.widget.toast; public class mainactivity extends fragmentactivity { imagebutton ngosbutton, profilebuttton, donatebutton; ngosfragment ngosfragment; profilefragment profilefragment; d...

php - User Access Permissions -

i trying figure out best way configure db / check user permissions give them access site content. our product udemy or other online teaching platform. have multiple instructors can have multiple courses. user signs , gets access courses. way can configure logic user can see courses signed , instructors can see courses teaching. thank you! presumably have database table users , database table courses. add associative tables teaching , student_on relationships. then can along lines of: select course.name, course.id student_on, course (student_on.student_id = ? , student_on.course_id = course.id) ;

Ruby on Rails - Create a form with Multiple instances of the same model -

i have model, namely "bank_accounts", contains many users i want use form list out users (while first name editable), 1 click of "submit" can gather users' first name. -@bank_accounts.each |account| =form_for account |f| =f.text_field :first_name the code above gives <form class="edit_bank_accounts" id="edit_bank_account_1" action="/bank_account/1" accept-charset="utf-8" method="post"> <input type="text" value="123" name="bank_account[first_name]" id="bank_account_first_name"/> </form> <form class="edit_bank_accounts" id="edit_bank_account_2" action="/bank_account/2" accept-charset="utf-8" method="post"> <input type="text" value="456" name="bank_account[first_name]" id="bank_account_first_name"/> </form> but wa...

asp.net - Problems with Formview showing details of Gridview selected row -

i trying have user select row in grid view , have set of details entry display in formview. currently, getting error "invalid column name 's.sprayid' ". have encountered several issues , out of ideas. have posted code below. ideas on how fix or better way it? thanks. <asp:gridview id="gvhistory" runat="server" datasourceid="dshistory" allowpaging="true" allowsorting="true" cellpadding="4" forecolor="#333333" gridlines="none" datakeynames="sprayid"> <alternatingrowstyle backcolor="white" forecolor="#284775"></alternatingrowstyle> <columns> <asp:commandfield showselectbutton="true"></asp:commandfield> </columns> <editrowstyle backcolor="#999999"></editrowstyle> <footerstyle backcolor="#5d7b9d" font-bold="true" forecolor="white...

Where can I find the algorithm used to write each PHP "built-in" function? -

i built php-based application typically requires several (>10) seconds parse target string (>10 seconds because there many thousands of checks on typically 100kb+ string). looking ways reduce execution time. i started wonder how each of php's "built-in" functions written. example, if go strpos() reference in manual ( this link), there lot of info not algorithm. who knows, maybe can write function faster built-in function particular application? have no way of knowing algorithm e.g. strpos(). algorithm use method such one: function strposhypothetical($haystack, $needle) { $haystacklength = strlen($haystack); $needlelength = strlen($needle);//for question let's assume > 0 $pos = false; for($i = 0; $i < $haystacklength; $i++) { for($j = 0; $j < $needlelength; $j++) { $thissum = $i + $j; if (($thissum > $haystacklength) || ($needle[$j] !== $haystack[$thissum])) break; } ...

c# - Setting the file name returned by ASP .NET Web API -

i looking set name of file being returned asp .net web api. returns in name of parameters being passed in url. if need returned abc.json public class newtestcontroller : apicontroller { public string getdetails([fromuri] string[] id) {using (oracleconnection dbconn = new oracleconnection("data source=j;password=c;persist security info=true;user id=t")) { var inconditions = id.distinct().toarray(); var srtcon = string.join(",", inconditions); dataset userdataset = new dataset(); var strquery = @"select * stpr_study stpr_study.std_ref in (" + srtcon + ")"; oraclecommand selectcommand = new oraclecommand(strquery, dbconn); oracledataadapter adapter = new oracledataadapter(selectcommand); datatable selectresults = new datatable(); adapter.fill(selectresults); return jsonconvert.serializeobject(selectresults); }}} i did see in other forums using...

javascript - ng-map only opens remote KML file but not local file? -

Image
i'm using ionic , ng-map . have display different kmls (one @ time , on user request). kml loads on map remote kmls. 1 works: <div style="height: 100%"> <ng-map center="41.876,-87.624" zoom="15" map-type-id="hybrid" style="display:block; width: 100%; height:100%;"> <kml-layer url="http://googlemaps.github.io/js-v2-samples/ggeoxml/cta.kml"></kml-layer> </ng-map> </div> my local kmls in kml folder inside www directory in ionic app. and i'm loading local kml file (same syntax remote kml file): <div style="height: 100%"> <ng-map center="41.876,-87.624" zoom="15" map-type-id="hybrid" style="display:block; width: 100%; height:100%;"> <kml-layer url="./kml/cta.kml"></kml-layer> </ng-map> </div> but kml lines don't show remote kml file. map loaded without line...

angular - angular2 - ROUTER_PROVIDERS is not defined -

i have code in system.config.js when comes importing angular2's old router (the deprecated one). '@angular/router-deprecated': 'npmcdn:@angular/router-deprecated@'+angularversion, i'm getting error: system.src.js:43 uncaught (in promise) error: router_providers not defined(…) this plunkr here how can fix this? your plunker has several problems. at app/index.ts : add imports: import { router_providers } '@angular/router-deprecated'; import { hashlocationstrategy, locationstrategy } '@angular/common'; import { provide } '@angular/core'; not mandatory, should remove .ts extension: import { app } './app2.ts'; should be: import { app } './app2'; at app/home.ts add path templateurl : templateurl: './home.html' becomes: templateurl: './app/home.html' at app/add_developer.ts also add path templateurl : templateurl: './add_developer.html' becomes: ...

angularjs - Angular expressions not working in HTML template -

i working on to-do app using mean stack using different view templates. 1 supposed loaded on request #/home/{task_id} in app.factory wrote: var t = { tasks: [ //{text: 'add first task', note: '', high: true} ] }; t.getone = function(id) { return $http.get('/home/' + id).then(function(res){ return res.data; }); }; the controller declared as: app.controller('tasksctrl',['$scope','tasks','task',function($scope,tasks,task) { $scope.task = task; }]); and in app.config have (using ui-router): $stateprovider .state('tasks', { url: '/home/{id}', templateurl: '/tasks', controller: 'tasksctrl', resolve: { task: ['$stateparams','tasks',function($stateparams,tasks) { return tasks.getone($stateparams.id); ...

c# Generic way to stringify arrays of structs -

i've searched quite time, have not been able find how generically stringify array of structures in c# @ runtime. let's have public enum fieldinfotype { fituint32, fitstruct, fituint32array1d, fituint32array2das1d, fitstruct2das1d, } [attributeusage(attributetargets.field)] public class fieldinfo : attribute { private readonly string _description; private readonly fieldinfotype _type; private readonly int _dim1; private readonly int _dim2; public fieldinfo(string d, fieldinfotype t) { _description = d; _type = t; } public fieldinfo(string d, fieldinfotype t, int d1, int d2) { _description = d; _type = t; _dim1 = d1; _dim2 = d2; } public static void stringtostruct<t>(ref t mystruct, caltextreader tr) { foreach (var field in mystruct.gettype().getfields(bindingflags.instance | bindingflags.nonpublic | bindingflags.public)) { ...

c# - How to disable the gray overlay when the hamburger menu is active in Material Design In XAML Toolkit (WPF) -

Image
here's picture of overlay sample app: here's git page of material design in xaml toolkit (you can download demo project here): toolkit:https://github.com/butchersboy/materialdesigninxamltoolkit this property somewhere in material design in xaml toolkit library , asking if knows how set (or if overlay can turned off). <window x:class="materialdesigncolors.wpfexample.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfexample="clr-namespace:materialdesigncolors.wpfexample" xmlns:domain="clr-namespace:materialdesigncolors.wpfexample.domain" xmlns:system="clr-namespace:system;assembly=mscorlib" xmlns:materialdesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:domain1="clr-namespace:materialdesigndemo.domain" xmlns:mate...

Facebook invite feature not working on my website -

i tried integrate facebook invite feature follow! when clicked on button click here not shows me dialog me ( real shows 0.1 second hiddens) ... can me resolve problem ! thank you! code: <html> <head> <title></title> </head> <body> <script src="http://connect.facebook.net/en_us/all.js"></script> <script> fb.init({ appid:'233108243711708', cookie:true, status:true, xfbml:true }); function invitef() { fb.ui({ method: 'apprequests', message: 'welcome 2my4edge', }); } </script> <a href="#try" onclick="invitef();"> click here </a> </body> </html> you should use send dialog achieve want do. https://developers.facebook.com/docs/sharing/reference/send-dialog

c# - How to fix the below error in the simple chaser program in unity 3d? -

i new unity 3d , c sharp. designing program in sphere chasing cube . tried it's showing error. error in console : assets/chaserr.cs(8,40): error cs0019: operator `-' cannot applied operands of type `unityengine.transform' , `unityengine.vector3' assets/chaserr.cs(11,38): error cs0019: operator `+' cannot applied operands of type `unityengine.vector3' , `float' assets/chaserr.cs(11,27): error cs1502: best overloaded method match `unityengine.transform.translate(unityengine.vector3)' has invalid arguments assets/chaserr.cs(11,27): error cs1503: argument `#1' cannot convert `object' expression type `unityengine.vector3' chaserr.cs using unityengine; using system.collections; public class chaserr : monobehaviour { public transform target; float speed = 8; void update () { vector3 displacement = target - transform.position; vector3 direction = displacement.normalized; vector3 velocity = direction *...

python - Global variables aren't working -

my global variables not working in code. i'm new , can't seem figure out: have set variables (only showing gna this), can manipulated entry field, triggered corresponding button. reason, it's not taking changes within loop. i'm trying make changed variable can graphed well, gives me following error: exception in tkinter callback traceback (most recent call last): file "c:\program files\python35\lib\tkinter\__init__.py", line 1549, in __call__ return self.func(*args) file "g:/python/eulers.py", line 64, in graph v[i + 1] = 1 / c * (gna * f[i] - gk * u[i]) * del_t + v[i] typeerror: ufunc 'multiply' did not contain loop signature matching types dtype('< u32') dtype('< u32') dtype('< u32') here code: gna = 0.9 gnalabel = label(topframe, text="gna = %s" % gna) gnalabel.pack() gnaentry = entry(topframe, justify=center) gnaentry.pack() def gnacallback(): global gna gna =...

Set the value of an object from inside a method in Io -

i'm trying set value of object inside method. here's example: myobject := list(1,2,3,4,5) myobject drop := method( self := list() ) myobject drop myobject println //returns original object what doing wrong? what you've done create new slot inside method , named self . means goes away when method returns. in io self isn't keyword, there no keywords, , doesn't have special meaning. what you're looking use method modifies self. since list written in c, you'd have interface directly written in c, or interfaces written in c, clear contents of list. consider: myobject drop := method( self empty ) what's going on here list has method named empty removes items , returns empty object. talks primitive list method called removeall accomplish this. this bit cut , dry though. in general case, in other circumstances, may want save item want return before remove collection. i.e., mycollection drop := method( result := self a...

Does "break continue" exist in PHP? -

for context question please see recent post . in function below, break continue allow me omit last if condition. (see comment in inner loop) function strposhypothetical($haystack, $needle) { $haystacklength = strlen($haystack); $needlelength = strlen($needle);//for question let's assume > 0 $pos = false; for($i = 0; $i < $haystacklength; $i++) { for($j = 0; $j < $needlelength; $j++) { $thissum = $i + $j; if (($thissum > $haystacklength) || ($needle[$j] !== $haystack[$thissum])) break; // if "break continue" omit // if ($j === $needlelength) // below , write $pos = $i; break; } if ($j === $needlelength) { $pos = $i; break; } } return $pos; } i have seen similar posts such this 1 don't quite answer question. not want refactor function above. don't need bre...

watch framework with healthkit capabilities -

is possible create dynamic watch framework healthkit capabilities? i have created watch framework (file > new target > target > [watchos] watch framework ) suppose healthkit work iincluding starting workout current user heart rate data. aware framework menu not have "capabilities" tab targets nonetheless have enable main target healthkit (with entitlements). healthkit framework , entitlements have newly created framework selected option still below error, suggestions? "missing com.apple.developer.healthkit entitlement."

algorithm - Generating all the combinations of two lists and output them one by one in python -

i have 2 lists [1, 3, 4] [7, 8] i want generate combinations of 2 list starting smallest combinations 17,18,37,38,47,48,137,138,147,148......178,378.... each combination have test it's presence in other place , if found combination present stop combination generation. example if see 17 present not generate other combinations. again if found 48 present not generate later combinations. this pretty ugly algorithm, worked me. it's not super expensive (expect, of course, generating combinations itertools.combinations(a, i)...): import itertools def all_combs(a): to_return = [] temp = [] in a: temp.append(i) to_return.append(temp) in range(2, len(a) + 1): temp = [] j in itertools.combinations(a, i): s = "" k in j: s = s + str(k) temp.append(int(s)) #get values list permutation to_return.append(temp) print(to_return) return to_return def al...

c++ - SIGSEGV on class destructor -

i have following class. header: #include <iostream> #include <vector> #include <regex> #ifndef generation_h #define generation_h class generation { public: generation(int x, int y); ~generation() { } void setcell(int x, int y, bool alive); bool getcell(int x, int y); int surroundinglivingcells(int x, int y); int getx(); int gety(); static std::shared_ptr<generation> parseril(int x_i, int y_i, const std::string& ril); private: int _x; int _y; std::vector<int> _born = {3}; std::vector<int> _starve = {3, 5}; std::vector<std::vector<int>> _data; }; #endif // generation_h cpp: #include <regex> #include "generation.h" generation::generation(int x, int y) : _x(x), _y(y) { _data.resize(y, std::vector<int>(x, 0)); } void generation::setcell(int x, int y, bool alive) { _data[y][x] = alive ? 1 : 0; } bool generation::getcell(int x...

javascript - PHP / Ajax Contact Form Redirecting to PHP File -

i'm in middle of developing contact form portfolio i'm working on , when click submit button send message, instead of displaying bootstrap alert message below form, page redirects php file. i'm receiving email in inbox form after submitting valid details though i'm using ajax i'm still getting redirected. example @ http://nickcookweb.co.uk/#contact . edit: preventdefault(); doesn't seem working @ all. html: <form id="contactform" name="contactform" action="contact.php" method="post"> <input type="text" name="name" id="name" placeholder="full name (required)" required/> <input type="email" name="email" id="email" placeholder="email (required)" required/> <input type="tel" name="tel" id="tel" placeholder="contact number"/> <textarea type="tex...

Excel - function that returns a matrix from a reference to its centre and radius -

Image
i performing matrix operations sumproduct . have convolution kernel apply dataset. however, have field somewhere defines kernel size. now, based on kernel size, have several convolution kernels, think can in way via vlookup . however, that's convolution kernel, it's not data matrix. currently, wrote sumproduct(convolutionkernel!$a$1:$c$3;data!h8:j10) in cell i9 of convolution result. write similar : sumproduct(make_matrix(convolutionkernel!$b$2; 2); make_matrix(data!j8; 2)) (in reality, $b$2 here vlookup thingy). 2 kernel size - make_matrix(xn; 1) should return xn cell, make_matrix(xn, 2) should return x-1 n-1:x+1 n+1 , etc. the offset function this volatile function. ok use long not dealing large number of volatile functions in workbook or volatile function not dealing large amounts of data in calculations. offset composed of 5 parts: offset( a, b, c, d, e) a reference point rest of offset function. not have on same worksheet being cal...

Igraph in R: how to change edge color based on edge attribute -

i trying generate igraph in r. want edge color dependent on edge attribute - department. cannot use ifelse statement because department values can dynamic. can find number of unique departments, not sure how proceed further in creating different edge colors different departments. department= unique(edges$department) department.count=length(department) example code: gg <- graph.atlas(711) v(gg)$name=1:7 gg=set_edge_attr(gg,"department",e(gg)1:10],c("a","b","c","a","e","c","g","b","c","a")) e(gg)$label=e(gg)$department plot(gg) i want have different colors each edge, depending on values of department in edge. 'a' departments in 1 color , b department edges in color , on. kindly help. you should provide small reproducible example when posting. said, should able setting color attribute of edges: e(testgraph)$color <-...

Azure Linux VM and BitBucket -

i have azure linux vm, , bitbucket repository. setup continuous development between two, tutorials find azure web apps, , not linux vm. there no built-in scm integration virtual machines; it's built-in web apps. you'll need set / configure own deployment scheme, pull deployments bitbucket vm. how quite broad , opinion-soliciting topic / discussion, , out of scope stackoverflow.

javascript - Setting up a Promise - Getting "Missing ) after argument list" -

for life of me, cannot find syntax error in bit of code: uncaught syntaxerror: missing ) after argument list promisearray.push( new promise(function (resolve, reject) { runowsls("invoice", beginning2014months[i], closing2014months[i], "no", function (callbackresp) { invoice2014header[i] = callbackresp; resolve(); }); }); ); remove second-to-last semi-colon: promisearray.push( new promise(function (resolve, reject) { runowsls("invoice", beginning2014months[i], closing2014months[i], "no", function (callbackresp) { invoice2014header[i] = callbackresp; resolve(); }); }) ); your original code was, essentially: promisearray.push(new promise();); can better see incorrect on abbreviated one-line here.

javascript - HTML Simple DropDown list and Result -

i trying create simple calculator drop down list , javascript , i'm having trouble getting result. in javascript, wrote code return 1411.21 if setting value office. otherwise should return 500. however, when click calculate button, doesn't anything. this html code. <html> <form method="post"> <td>setting : </td> <select name="setting" id="setting"> <option value="office">office</option> <option value="hopd">hopd</option> </select> <br/> <td>facility : </td> <select name="facility" id="facility"> <option value="100015">mount sinai, 123 main street, new york</option> <option value="100016">nyu medical, 25 north broadway, new york</option> </select> <tabl...