Posts

Showing posts from September, 2013

c# - Returning multiple related entity types from raw SQL queries in Entity Framework -

noodling around raw sql queries in entity framework. right in thinking given these 2 related ef classes: public partial class campaign { public int campaignid { get; set; } public virtual icollection<quote> quotes { get; set; } } public partial class quote { public int quoteid { get; set; } public int campaignid { get; set; } public virtual campaign campaign { get; set; } } the tables joined foreign key, , objects generated db first entity framework. i can't issue raw query campaigns , related quotes? i've tried this: string sqlquery = "select * campaign c join quote q on q.campaignid = c.campaignid"; var meh = entities.database.sqlquery<campaign>(sqlquery); which brings campaigns without quotes. i'm guessing it's not feasible wanted check i'm not doing wrong? i couldn't find definitive answer in documentation. , older related question fetching complex objects raw sql query in entity framework has

WCF domain-specific contract, service and DTO separation -

we have multiple wcf services different domains/scopes (application-specific data, users, management etc.). automap entities dtos, here encounter first design issues. how could, , should, separate services, contracts , dtos? this tricky if need different views on same data - i.e. user might able read data himself, should not associated management-data since outside of scope. my initial approach have been put dtos , contracts separate assembly each domain, or rather each service (e.g. corecontracts , ordercontracts etc.). makes separation of different views on same data harder, if don't want add new services serve data these views. example (omitting attributes): public class userdto { public int userid {get; set;} public string username {get; set;} public string email {get; set} public string address {get; set;} public bool examplemanagementflag {get; set;} } this example , not how implemented the examplemanagementflag user, himself or services on behal

braintree - Rails 4 : Active record collection looping or iteration -

in rails customer controller there active record collection object: 1. @pay_invoices = invoice.where(customer_id: @pay_cus_id) #<activerecord::relation [#<invoice id: 37, customer_id: 53, paid_amount: 960, devicemodel_id: 2, transaction_id: "6drv3s", created_at: "2016-01-04 05:29:03", updated_at: "2016-01-25 12:16:14">, #<invoice id: 70, customer_id: 53, paid_amount: 80, devicemodel_id: 2, transaction_id: "2mr93s", created_at: "2016-01-28 09:02:43", updated_at: "2016-01-28 09:02:43">]> also in controller using transaction_id: column value find out transaction details in braintree payment gateway using following braintree api call: @tid = @pay_invoices[0].transaction_id @transaction = braintree::transaction.find(@tid) this works fine me, transaction details of first transaction_id: @pay_invoices collection can retrieved using code, want iterate through @pay_invoices collection , each time

groovy - Java class for script parameters -

i'm working on java motor groovy. want make class can stock parameters needed execute groovy script. what best way stock parameters, thought make list of list contain "type", "name" , "value" think i'm on wrong way ? i searched haven't maybe basic.

ajax - React child component seems not to be rendered when parent state is updated? -

i have (probably stupid) question workflow in react did not yet understand. i have parent component fetches data server through ajax call. 1 of return values boolean passed child component property. child component again fetches data server (ajax) according property value. somehow parent component it's changes accordingly child not re-render? doing wrong? parent component: var l5fmmodal = react.createclass({ getinitialstate : function() { return { initrunswitch : false, data : [] }; }, componentdidmount: function() { this.loaditems('l5fm/setstate', null); }, loaditems : function(url, modalstate) { $.ajax({ url: url, contenttype: 'application/json; charset=utf-8', data: {modalstate : json.stringify(modalstate)}, datatype: 'json', cache: false,

c# - Is ist ok to throw a HttpException(401) in custom AuthorizeAttribute? -

i have custom authorizeattribute: public class myauthattribute:authorizeattribute { protected override bool authorizecore(httpcontextbase httpcontext) { return currentuser.roles.contains(this.roles); } } now return currentuser.roles works fine. if returns false, browser displays 401. but want add additional information roles asked for. instead of return throw exception myself: throw new httpexception(401,string.format("user should have been in 1 of following roles: {0}",this.roles); is ok throw 401-exception inside authorizeattribute instead of returning false? or there other (better) ways information browser? if going send 401 send normal 401 www-authenticate header (if aren't using form of authentication uses www-authenticate 401 inappropriate). if want give information in body of custom html response goes 401 (it shown if user cancels out of authentication prompt). for other case something, choosing not allow particular user so, use 40

lazarus - How to apply multiple filters on TSQLQuery -

singular filter on column works, example: sqlquery.filter := 'columnname="some_filtered_text"'; // ok but how apply filter many columns? for example doesn't work: sqlquery.filter := 'columnname1="some_filtered_text1", columnname2="some_filtered_text2"'; // exception it raises exception: "tapplication.handleexception operator/function missing".

Building a dynamic form using PHP -

i have laravel based admin. i'm looking php library me build dynamic forms. by dynamic forms - mean example, when user checks radio button - new options appear. i can build 1 form using basic laravel form builder , jquery. thing - may have hundreds of such forms, don't want build each 1 of them manually. storing them in kind of model translated form i'm looking for. can think of php lib me achieve i'm looking for? there other practices ? form builders i've found basic static forms. many thanks. amir this not done php. work javascript because don't want reload page every click. can use framework angularjs or simple ajax. ajax tutorial : http://www.w3schools.com/ajax/ angularjs tutorial: http://www.w3schools.com/angular/

tfs - Why does my PBI not show on the Kanban if it has child PBIs/Bugs? -

Image
we're still fine-tuning our alm process using tfs 2015 update 1 on-prem. using standard scrum template , display bugs on backlog, along requirements. bugs reported business , go through same level of analysis pbis in contain child tasks: now pbis, when tester testing pbi , discovers bug (which needs fixed part of sprint), create bug child pbi. keeps them on task board. 1 pbi may have many bugs , these may worked on different people. these child bugs have child tasks. the process works on kanban board, child bugs shown, parent pbis not. why not? , how can work-around this? can link them differently want them stay on boards. thanks it feels you're mixing , matching 2 supported scenarios here. personally prefer not create bugs part of sprint (to me they're not bugs if haven't made out of iteration) , it's used communication mechanism instead of dev & test working closely together. if want on board under pbi/bug, use task work item (or

jquery - When to use closures in javascript? -

i came across custom filter used in angularjs returning function logic custom filter. here i'm not able understand when should using closures. tried return function in jquery call function, control doesn't go inside function body, control goes inside angularjs custom filter. can me understand concept. angularjs custom filter code, control goes inside anonymous function: app.filter('myfilter', function () { return function (curitem, txtsearch) { var results = []; if (txtsearch && curitem) { (i = 0; < curitem.length; i++) { // logic filter } return results; app.filter('myfilter', function () { return function (curitem, txtsearch) { var results = []; if (txtsearch && curitem) { (i = 0; < curitem.length; i++) { alert(curitem[i].name);

R Shiny for loop -

i have problem r shiny code. don´t know how create double loop in shiny values typed in user. says: "error in <-: incompatible types (from closure double) in subassignment type fix" btw: shiny right package me when want create app user inputs? shinyserver( function(input, output){ sum1 <- reactive(input$sum1) weight1 <- 0.7 weight2 <- 1-weight1 asset1 <- reactive({sum1()*weight1}) asset2 <- reactive({sum1()*weight2}) counter1 <- reactive(input$counter1) counter2 <- reactive(input$counter2) (j in 1:counter1) { start <- reactive(sum1()) (i in 1:counter2) { start <- reactive({asset1()*asset2*rnorm(1, mean <- 0, sd <- 1)}) value1[j] <- start } result1 <- quantile(value1, c(0.01)) output$result1 <- value1 } ) library(shiny) shinyui(fluidpage( titlepanel(title = "simulation"), sidebarlayout( sidebarpanel(("data"), numericinput("sum", "sum:", 0,

How to export excel data into Mysql tables -

Image
how can export excel data mysql table . there plugin in excel converting data mysql table or in other methods? convert excel csv first import in phpmyadmin. number of columns in csv should equal number of columns in table, if have auto increment first column leave first column of csv blank. if dont use phpmyadmin this or this out import.

How to launch shell script from awk command -

i novice in ksh scripting , highly appreciate help. need parse data file looks this: $ cat data.txt p1`/tmp/s1.ksh p2`/tmp/s2.ksh p3`/tmp/s3.ksh here p1, p2, p3 parameter names, followed script names, calculate values parameters. dummy scripts this: $ cat s1.ksh !/bin/ksh echo "v1" at end, need launch scripts , concatenate results parameter names , produce string looks this: p1=v1 p2=v2 p3=v3 i try use awk this. understood, system() should launch scripts , print output resulting string. $ awk -f\` '{ printf("%s ",$1); system("eval \"$(cat "$2")\"") }' /tmp/data.txt but prints parameter names p1 p2 p3 i checked if parsed data.txt correctly $ awk -f\` '{ printf(" %s=",$1); printf("eval \"$(cat %s)\"", $2) }' /tmp/data.txt the output is p1=eval "$(cat /tmp/s1.ksh)" p2=eval "$(cat /tmp/s2.ksh)" p3=eval "$(cat /tmp/s3.ksh)" so, expec

angularjs - Implement React code in Angular feasibility questions -

i have app written in react i'm considering moving angular. when started designing same functionality in angular got stuck thought got messy, maybe i’m missing since don’t know angular. can describe if i’m trying achieve easy , can done in tidy way in angular? i have asynchronously loaded combo boxes, depending on state show/hide different buttons. the combo box options depend on inputs 1 or more other asynchronously loaded combo boxes , other forms of data. asyncronously loaded combo boxes , dependencies on page, asynchronously loaded combo boxes provide views available user, , views have input options. overall view basically there lot of interconnected components. then when every input gathered subviews , other combo boxes it’s sent server , results come asynchronously. is there neat , tidy way of doing above in angular?

javascript - select 2 add additional parameters to select options -

i need additional parameters <option></option> tag generates select2 ajax data. my ajax params select2(coffee): ajax: url: '/moysklad_warehouse_items/find_warehouse_item' datatype: 'json' delay: 500 data: (query) -> { q: query.term } processresults: (data) -> { results: data } resulted data structure: [{id: 1, text: 'one', price: 100, weight: 10}, {id: w, text: 'two', price: 200, weight: 12}] by default select2 provide id , text parameters , select looks this: <select> <option value="10" selected="selected">one</option> <option value="11" selected="selected">one</option> </select> i want add additional data(price , weight), like, parameters take part in calculations , text tag if insufficiently <option value="11" selected="selected" price="12" weight="100">one</option

c++ - Saving output using hex adds white spaces? -

i have code int main() { ifstream fin; ofstream fout; string filename = "x64-mk10game.ini"; fin.open(filename.c_str(),ios::binary); fin>>noskipws; fout.open("modded.ini"); unsigned char x; while(fin>>x) { fout<<x; } return 0; } the thing code file this: [main] options the output i'm getting [main] options can me that? the problem you're reading fin in binary mode, writing fout in text mode. in binary mode, no reinterpretation of end-of-line characters done. in text mode on windows, reading pair \r\n returned character \n , , writing character \n causes \r\n written output stream. so, since fin opened in binary, hold of characters \r , \n . since fout opened in text, writing \r produces \r , , writing \n produces \r\n , duplicating carriage-return character. the solution open fout in binary mode well. , since you're apparently interested in binary i/o, might want use unromatted i/o func

html - placing object under other object in a responsive page -

i have responsive page has header container image , text change size when resizing browser window. code goes this: <!doctype html> <html> <head> <title></title> <meta charset="utf-8" /> <script src="script.js"></script> <link href="style.css" rel="stylesheet" /> <link href="http://fonts.googleapis.com/css?family=bree+serif" rel="stylesheet" type="text/css"> </head> <body> <div id="header"> <img src="city.png" /> <span>weather website</span> </div> </body> </html> and css following: * { padding: 0; margin: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body { font-family: arial; font-size: 14px; } /*img { width: 100%; }*/ #header { text-align: center;

How I can display some category on page load with jquery? -

i have list of items <div class="cat1">item 1</div> <div class="cat2">item 1</div> <div class="cat3">item 1</div> <div class="cat2">item 1</div> <div class="cat3">item 1</div> how can display "cat3" on page load jquery? first set div 's display none , in document ready display whatever class want to <div class="cat1" style="display:none;">item 1</div> <div class="cat2" style="display:none;">item 1</div> <div class="cat3" style="display:none;">item 1</div> <div class="cat2" style="display:none;">item 1</div> <div class="cat3" style="display:none;">item 1</div> $(document).ready(function(){ $(".cat3").show(); })

php - ZF2 Restful hierarchical routes -

i'm trying use hierarchical resource in zf2 restful api. resource should looks clients/1/addresses . i've tried this 'clients' => array( 'type' => 'segment', 'options' => array( 'route' => '/clients[/:id]', 'constraints' => array( 'id' => '[0-9]+', ), 'defaults' => array( 'controller' => 'api\controller\clientcontroller', ), ), 'may_terminate' => true, 'child_routes' => array( 'addresses' => array( 'type' => 'segment', 'options' => array( 'route' => '/addresses[/:address_id]', 'constraints' => array( 'address_id' => '[0-9]+', ),

javascript - How to connect rows from different tables -

Image
i have 2 tables , need allow user connect rows 1 table rows another, such as: and later when user clicks on submit button, need information connections in such way: [ {left: "pera lozac", right: "eve jakson"}, {left: "mika mikic", right: "jill smmith"}, {left: "zika zivac", right: "joh doe"}, {left: "dezurni krivac", right: "joh doe"}, ] how should go using html/javascript ? check snippet below usage : select(click) number of rows left table , select 1 row right table, click add connection, connection added , displayed below on page in form of javascript object. note : selected rows highlighted in grey , highlighting removed when row unselected. snippet $(document).ready(function() { var temp_color = '#dddddd'; $('tr').on('click', function() { current_background = $(this).css('background-color');

c# - compare string from db to posted string -

i have db want part of (a name) not duplicated. i'm trying check if exist , if not save part, saving regardless if exists or not. code: var reviewsubject = c in db.subject select c.subjectname.tostring().tolower(); var match = reviewsubject.firstordefaultasync(stringtocheck => stringtocheck.equals(model.sub.subjectname.tolower())); model.rev.created = datetime.now; if (modelstate.isvalid) { if ((model.sub.subjectname.tolower()).equals(match)) { //do nothing } else { model.sub.gbu = model.rev.gbu; db.subject.add(model.sub); } } you not using await keyword on result reviewsubject.firstordefaultasync returns task<t> . therefore checking if task equal string, false. the correct usage be: var match = await reviewsubject.firstordefaultasync(stringtocheck => stringtocheck.equals(model.sub.subjectname.tolower()));` if don't want use async method use synchronous 1 such: var match = reviewsubject.f

bash - tar command execution from java does not work as expected -

tar command execution java not work expected. below lines of code same. tar file getting created, empty, though there matching files in directory tar. not sure issue. inputs helpful. note: same command when execute on terminal works fine, tar ball having intended files. string cmd = "tar -cvzf /tmp/logs.tar.gz /home/test/log/status.*" try { process p1 = runtime.getruntime().exec(cmd); p1.waitfor(); } catch (ioexception e) { e.printstacktrace(); } obviously expansion status.* not work. try without it. alternative resolve input files/directories within java code. use java.nio this. as gyro gearless mentions in comments possible wrap tar command in script , execute java code.

c# - How could i get names and values within json string i have -

how names , values within json string have: { "accyearslist": [ { "start_date": 1453766400 }, { "end_date": 1485302400 }, { "start_date": 1454198400 }, { "end_date": 1485734400 }, { "start_date": 1382400 }, { "end_date": 32918400 }, { "start_date": 1382400 }, { "end_date": 32918400 }, { "start_date": 1382400 }, { "end_date": 32918400 }, { "start_date": 1382400 }, { "end_date": 32918400 }, { "start_date": 1382400 }, { "end_date": 32918400 }, { "start_date": 1382400 }, { "end_date": 32918400 }, { "start_date": 1382400 }, { "end_date": 32918400 }

Is it possible to guarantee delivery of messages using UDP on Node.js? -

how possible guarantee delivery of messages using udp on node.js? example, resend packet if failed - there way identify when failed? also, how common loss of packet? if you're wondering "how detect lost packets"? general technique have receiver send acknowledgement each packet sent. if transmitter not receive acknowledgement must resend packet. if receiver gets duplicate packets should discard duplicate. the basic scheme this: tx rx \ data `-----------------------------> ack / <-----------------------------' \ data `-------------------- - - - loss of data packet . . . timeout . \ data retransmit `-----------------------------> ack / <-----------------------------' \ data `-----------------------------> ack

What's the best practice for testing public methods that use private variable? -

so have class 2 public methods init() , dostuff(). init() sets private variable $_myprivvar. dostuff() method uses variable. when writing unit tests dostuff() what's best practice setting $_myprivvar? presumably don't want use init() unit test testing 2 units of code? this contrived version of real world scenario. first unit in unit test not 1 method - can class or whatever well. but more importantly: if have function depends on 1 argument (your $_myprivvar ) please implement function takes value input. if make dependencies inputs (aka making pure function) see 1 testable. you can wrap later if want - 1 argument ... don't bother the other way provide public setter variable - languages have compiler variables/symbol/whatever call it (for example c# , #if ...) can use remove setters release version later.

css - How to specifically/conditionally target Yahoo and AOL within HTML emails for client specific fixes? -

that code should targeting outlook clients came before '15' , outlook.com doesn't seem work well. <!--[if (lte mso 15)|(office365) ]> <style type="text/css"> .client-fix{ display: none!important; } </style> <![endif]--> anyways need able target yahoo , aol far haven't found reliable information on how so. please help i've seen yahoo solutions online, haven't gotten them work. able target aol applying class , selecting following code: .aolreplacedbody .bullet { styles here }

python 2.7 - How can I merge two or more dictionaries in a list? -

is there nice pythonic way of merging dictionaries within list? what have: [ { 'name': "jack" }, { 'age': "28" } ] what like: [ { 'name': "jack", 'age': "28" } ] here's method uses dict.update() . in opinion it's readable solution: data = [{'name': 'jack'}, {'age': '28'}] new_dict = {} d in data: new_dict.update(d) new_data = [new_dict] print new_data output [{'age': '28', 'name': 'jack'}]

php - How to integrate hipchat in a website? -

i trying integrate hip chat website. hip chat doc i go through above doc.but able understand how start. saying create add on , many thing. using api able post , data of 1 user. want integrate hip chat chat server in website don't how start , how implement that. if 1 have example or demo plz me. below code tried: // getting room information // rooms "https://api.hipchat.com/v2/room?auth_token=xxxxxx" //message room https://api.hipchat.com/v2/room/2068981/notification?auth_token=xxxxxx //message history https://api.hipchat.com/v2/room/2068981/history?auth_token=xxxxxx&max-results=1000&reverse=true this code working fine .but working 1 user want work of user . , not able generate access token every user automatically. tried access token : curl -d '{"username":"abc@rediff.com","grant_type":"password","password":"xxxx"}' -h 'content-type: application/json' https://domain.hipc

asp.net - AJAX Callback using POST method -

i require assistance. using jquery cause ajax callback: function testingcallback(controlid) { if (controlid == 'drpcontrol') { var options = { type: "post", url: "main.aspx", data: { drpcontrol: $(".drpcontrol").val() }, //contenttype: "application/json; charset=utf-8", //cache: false, success: function (data) { }, complete: function (jqxhr, status) { formdata = $("#form1").serialize(); window.location = "main.aspx?" + formdata; showloadingbar(); return false; } }; var resp = $.ajax(options); } } and backend data so: request.form["drpcontrol"] , works well. but add line callback options : cont

java - getting invalid date/time exception when getting events from google calender -

hi iam retrieving events based on datetime . when iam passing datetime query getting events google calender getting below exception. private static void daterangequery(calendarservice service) throws serviceexception, ioexception { dateformat dateformat = new simpledateformat("yyyy-mm-dd-hh:mm"); //get current date time date() date date = new date(); system.out.println(dateformat.format(date)); //get current date time calendar() date dt = calendar.getinstance().gettime(); //system.out.println(dateformat.format(cal.gettime())); // system.out.println(cal.gettime()); datetime starttime = datetime.parsedatetime(dateformat.format(dt)); calendar cal2 = calendar.getinstance(); cal2.add(calendar.minute, 20); system.out.println(dateformat.format(cal2.gettime())); system.out.println(cal2.gettime()); datetime endtime =

qt - Adding custom properties to QML type -

i new qml , seasoned c++. have been trying go through qml examples try , learn it. i playing around tumblercolumn control (from examples) , trying set model set year. goes like: tumblercolumn { id: yearcolumn width: charactermetrics.width * 4 + tumbler.delegatetextmargins model: listmodel { component.oncompleted: { (var = 2000; < 2100; ++i) { append({value: i.tostring()}); } } } oncurrentindexchanged: tumblerdaycolumn.updatemodel() } now, made change like: tumblercolumn { id: yearcolumn width: charactermetrics.width * 4 + tumbler.delegatetextmargins property int startyear: 2000 property int endyear: 3000 model: listmodel { component.oncompleted: { (var = startyear; < endyear; ++i) { append({value: i.tostring()}); } } } oncurrentindexchanged: tumblerdaycolumn.updatemodel() } this returns error: refere

javascript - Converting a jQuery plugin to an es6 module -

evening all, is there simple way convert existing jquery plugin use es6 import/export syntax. for example: import $ 'jquery'; import cycle 'plugins/jquery-cycle'; thanks i tried solutions thread jquery plugin( autocomplete ), , works. although have manually change umd js file es6-ish module. if third part libraries complicated or there many of them, don't think approach gonna work well. that being said, can give other tools shot depends on structure of project. example, use jspm , systemjs thread mentioned. or use amd-to-es6 convert file format(although plugin doesn't seem work umd js file now). if using rollup bundle es6 files, can add rollup plugin in rollup config(but still have issue umd files).

Linux bash know the script path which includes library script -

this question has answer here: how know script file name in bash script? 19 answers i have library script named , script b, c includes . ../../../a the problem how can know time run ./b.sh or ./c.sh , example: if(run ./b.sh) echo "b (file path) calling" else echo "c (file path) calling" you can use $0 determine command executed: a.sh: echo $0 b.sh: . ./a.sh when run: $ sh b.sh b.sh $ sh a.sh a.sh it give command executed, not arguments: $ sh b.sh 1 2 3 b.sh

tvOS UITextField blank after editing -

Image
editing uitextfield in tvos shows new view user can enter in text, , when text entry done, user returned previous view. however, have found when return text editor, text edit not show in text fields. what's going on? tvos version 9.1 the reason why isn't working because uitextfield using non-default background color. apparently in tvos, background color rendered layer after text has been rendered (interestingly enough, not affect placeholder text). happens in interface builder. bug report has been sent apple.

java - Can an Android create SurfaceTexture based on Unity Texture2D? -

my question related to: can android (java not c/c++) plugin alter unity textures? . seems guy bothering same question myself. i've created plugin allows launch stream on android devices, couldn't manage how show video frames on unity interface element (meshrenderer, rawimage). my unity code: private void initandroidstreamerobject() { androidstreamerobj = new androidjavaobject("makeitbetter.figazzz.com.vitamiousing7.androidstreamer"); int androidint = androidstreamerobj.call<int>("androidint"); debug.log("androidint = " + androidint); } public void startstream() { //"http://dlqncdn.miaopai.com/stream/mvaux41a4lkuwlobbgugaq__.mp4"; //"rtmp://live.hkstv.hk.lxdns.com/live/hks"; string streamlink = "rtmp://live.hkstv.hk.lxdns.com/live/hks"; system.intptr ptr = _inputtexture.getnativetextureptr(); debug.log("ptr on unity side = &quo

regex - Get PHP to stop replacing '.' characters in $_GET or $_POST arrays? -

if pass php variables '.' in names via $_get php auto-replaces them '_' characters. example: <?php echo "url ".$_server['request_uri']."<p>"; echo "x.y ".$_get['x.y'].".<p>"; echo "x_y ".$_get['x_y'].".<p>"; ... outputs following: url /spshiptool/php/testgeturl.php?x.y=a.b x.y . x_y a.b. ... question this: there any way can stop ? cannot life of me figure out i've done deserve :-( php version i'm running 5.2.4-2ubuntu5.3. here's php.net's explanation of why it: dots in incoming variable names typically, php not alter names of variables when passed script. however, should noted dot (period, full stop) not valid character in php variable name. reason, @ it: <?php $varname.ext; /* invalid variable name */ ?> now, parser sees variable named $varname, followed string concatenation operator

node.js - How to use batch insert in node jdbc module with teradata -

i trying insert huge data teradata database node.js application. have array of insert statement. need insert them batch. please help. note: looking below used in java program statement.addbatch(query); statement.executebatch(); but couldn't find in jdbc npm module. i had similar need , looked @ jdbc , nodejdbc packages, , neither offered support jdbc's batch update methods. ended-up adding them promise-based nodejdbc package , submitted pull request changes. update nodejdbc maintainer accepted pr, , batch support part of package! example (es6 used): thedb.getconnection().then(conn => { return conn.preparestatement('insert test values (?,?)') }).then(pstmt => { (let i=0; i<10; i++) { pstmt.setint(1, i); pstmt.setstring(2, `num${i}`); pstmt.addbatchsync(); } return pstmt.executebatch(); }).then(rowsupdated => { console.log('rows update:', rowsupdated); }).catch(error => console.error('error o

filter - Access: Keep Only Rows with a Blank -

Image
i have report i'm developing company. have 8 departments associates might work in during course of day. stay in 1 department, others move around , on given day can change. have report , running , well. however... seeing major problem people not clocking departments travel (we see work in department have no time logged). understand it's training issue, have been tasked creating report show people miss clock in when changing departments. i not access guru, have moderate experience it. i'm struggling though come way show these people in given date range. might clock 3 departments, work in 5 need see didn't have time in 2 departments there work in work field. thoughts? ideas? thanks input! :) example:

amazon web services - load balancer act weird -

i have created 2 instances website , connected them amazon load balancer. have placed dns name of load balancer cname people can view website domain: *.domain.com and www.domain.com now people can visit website , works. problem if people go domain.com load balancer shows first instance, if people go www .domain.com load balancer switches between instances perfect. why happen , how fix it? using cname record in zone apex not supported under dns standard , can cause no end of issues downstream caching dns servers doing unexpected things result. can't confirm 100% certainty causing issue reasonably sure , if isn't practice bring dns configuration standard. in route 53 configuration zone apex record leave record set name blank, set type "a", , select alias radio box "yes", click on alias target , populate list of supported endpoints under account, choose load balancer shown under "elb load balancers". aws doesn't best

jquery - Datatables export additional text -

i have requirement add additional text table excel (and pdf) export. it's string in model containing information parameters used run report. using datatables , here code snippet document ready function: $('#npsoverallsummarytable').datatable({ "aasorting": [], "scrollx": true, "colreorder": true, "fixedheader": true, "searching": false, "paging": false, select: true, dom: 'bfrt', buttons: [ { extend: 'copy', text: 'copy clipboard' }, { extend: 'excel', text: 'excel' }, { extend: 'pdf', text: 'pdf', orientation: 'landscape',

xml - Selecting specific entries in a for-each loop? -

i have following xsl script: <xsl:for-each select="$assignhistory/assignmenthistory/*[name()=$week]/studentitems/item"> student (or assistant): <xsl:value-of select="name"/><br /> </xsl:for-each> the actual xml studentitems have varied number of items in it. either: 1 7 14 21 if there 7, want show list content this: 1 2 / 3 4 / 5 6 / 7 if there 14: 1 2 / 3 4 / 5 6 / 7 8 9 / 10 11 / 12 13 / 14 finally, if there 21: 1 2 / 3 4 / 5 6 / 7 8 9 / 10 11 / 12 13 / 14 15 16 / 17 18 / 19 20 / 21 at moment getting varied "list" of names (understandably) can above? example xml content: <studentitems> <item> <name counsel="10">matthew 1</name> <type>bible reading (main)</type> </item> <item> <name counsel="44">john 2</name> <type>#1 student (main)</type&g

c++ - Type No return, in function returning non-void -

my c++ code looks this: int f(int i){ if (i > 0) return 1; if (i == 0) return 0; if (i < 0) return -1; } it's working still get: warning: no return, in function returning non-void even though obvious cases covered. there way handle in "proper" way? the compiler doesn't grasp if conditions cover possible conditions. therefore, thinks execution flow can still fall through past if s. because either of these conditions assume others false, can write this: int f(int i) { if (i > 0) return 1; else if (i == 0) return 0; else return -1; } and because return statement terminates function, can shorten this: int f(int i) { if (i > 0) return 1; if (i == 0) return 0; return -1; } note lack of 2 else s.

ios - Done button of UIPickerView doesn't work -

i'm trying put done button picker view because, when slide choose item uipickerview automatically select slided row, prefer have button done: @iboutlet var tfprojet: uitextfield! var pvprojetdata = ["-choisir-", "rachat de crédits", "renégociation de crédits"] override func viewdidload() { super.viewdidload() let pickerview = uipickerview() if devicetype.is_iphone_4_or_less { pickerview.frame=cgrectmake(0, 200, view.frame.width, 100) } else if devicetype.is_iphone_5 { pickerview.frame=cgrectmake(0, 200, view.frame.width, 200) } else if devicetype.is_iphone_6 { pickerview.frame=cgrectmake(0, 200, view.frame.width, 200) } else if devicetype.is_iphone_6p { pickerview.frame=cgrectmake(0, 200, view.frame.width, 250) } else if uidevice.currentdevice().userinterfaceidiom == .pad { pickerview.frame=cgrectmake(0, 200, view.frame.width, 300) } // pickerview.backgroundcol

javascript - Why do I need CORS header to request a downloadable link? -

i have link allows me download file when click on it. instead of downloading, trying access simple request having cors problems. not have access server side, , therefore have tried far have failed. if understand correctly, suggestions have found far needs me have control on server (i might mistaken, far see server side needs have cors header including domain or have jsonp function envoked). does mean unable read , parse file downloadable? if yes, how make sense since file public , downloadable when click link. since manually able file, shouldn't possible access code? suggest me solution or give can work on? why code below not work manual click on browser would? var urlstring = "http://abc.def.com/download?fileid=123&amp;entity_id=123&amp;sid=123"; $.get(urlstring, function(data, status){ alert("data: " + data + "\nstatus: " + status);}); you able download external script manually clicking on link because, well, manually clicked

How to use multiple paperscopes on a single canvas in paperjs? -

i'm trying create multiple canvases each it's own scope. i've hit few problems didn't encounter when working single canvas , scope. i have array of scopes , try switching between them using scopearray[n].activate(); seems not initiate paperscope.project , can't assign layers or draw. any in solving appreciated. i set canvases based on size of array , store them in object: paper.install(window); ... var paperpad = {}; var layers = { 'back': 0, 'draw': 1, 'control': 2, 'front': 3 } function setupcanvas(){ // init canvas , calculate width/height/centre for(var c in canvaslist){ var el = document.createelement("canvas"); var id = '' + canvaslist[c][0] + '' + canvaslist[c][1] + '' + canvaslist[c][2]; el.width = canvaswidth; el.height = canvasheight; el.setattribute('id', id); el.setattribute('class', 'padcanvas'); document.body.appe

Combine 2 Radiogroups in Android -

i have 2 radiogroups. first 4 buttons , second 3 buttons. need solution update timer in textview depending on checked in both radiogroups. in first radiogroup user chooses size , in second user chooses shape. gives 12 combinations. far have figured out how update textview field 1 radiogroup. in code below have shown 2 values first radiogroup (rg1). should change depending on chosen in radiogroup 2 (rg2) i have found solution , updated code. hope can others. public class mainactivity extends activity implements radiogroup.oncheckedchangelistener { textview timer; radiogroup rg1; radiogroup rg2; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.activity_main); timer = (textview) findviewbyid(r.id.softtimer); rg1 = (radiogroup) findviewbyid(r.id.myradi

c# - Unhandled exception not caught by `Application.ThreadException`? -

we have big application, , ensure our customers don't have message "xxx has stopped working", added handler(in logs errors , other stuff). it working fine, solved lot of issues this(by analysis logs after exception arrived). recently, managed "xxx has stopped working" message anyway. currently have following implementation: application.threadexception += handleunhandleexception; application.setunhandledexceptionmode(unhandledexceptionmode.catchexception); appdomain.currentdomain.unhandledexception += handleunhandleexception; which done @ beginning of our application. my question: see case can have exception display mentionned popup("xxx has stopped working") without coming in handler? what mean "the start of our application"? i have found on rare occaision, appdomain , application handlers can still fail in main function. 1 workaround put them in static constructor of same class entry point, preempts main . some

html - Adaptive width layout just with css3? -

Image
i having lot of trouble figuring 1 out, have 3 columns: navbar (dark gray), main content (dark red) , sidebar (dark green) navbar can expanded , shrinked , sidebar can slide out , slide in (so change width 0 , 0). , want keep of responsive. idea shrink main content accordingly when or both navbar , sidebar expanded. unfortunately way can think change width of main content width: calc(100% - navbar width - sidebar width) verbose when need check if sidbar expanded or navbar, or both not expanded etc... here image illustrating how main content shrinks: i assume flexbox used here somehow, not able figure out. let example marku be <nav> </nav> <main> </main> <aside> </aside> note: nav , aside need 100% height of page , fixed in place. you can use flex-box this. simple approach follows: http://codepen.io/anon/pen/pgvvjb you can change classes see how changes layout. note: using classes change width of columns use javascript or

login - Vertical Elastic Query Azure Database unable to authenticate -

i did create external datasource, identical guide described here .the process pretty simple, illustration. create master key encryption ... create database scoped credential ... not covered in article how create login , user. on master database did execute create login <externaldbname> password = '<somepassword1>'; create user externaldbname login externaldbname; and on externaldb create user externaldbname login externaldbname; then continued guide create external data source ... create external table .. all executed successfully. when try select external database, error raised msg 46823, level 16, state 2, line 10 error retrieving data 1 or more shards. underlying error message received was: cannot open database externaldb requested login. login failed. login failed user externaldbname. i able login given credential externaldb if using visual studio. there special permission needs granted or might wrong? issue resol