Posts

Showing posts from September, 2011

optimization - CPlex coding logic -

the professor in charge of industrial engineering design course faced problem of assigning 28 students 8 projects. each student must assigned 1 project , each project group must have 3 or 4 students. students have been asked rank projects, 1 being best ranking , higher numbers representing lower rankings. a) formulate opl model problem. b) solve assignment problem following table of assignments: ed ez g h1 h2 rb sc allen 1 3 4 7 7 5 2 6 black 6 4 2 5 5 7 1 3 chung 6 2 3 1 1 7 5 4 clark 7 6 1 2 2 3 5 4 conners 7 6 1 3 3 4 5 2 cumming 6 7 4 2 2 3 5 1 demming 2 5 4 6 6 1 3 7 eng 4 7 2 1 1 6 3 5 farmer 7 6 5 2 2 1 3 4 forest 6 7 2 5 5 1 3 4 goodman 7 6 2 4 4 5 1 3 harris 4 7 5 3 3 1 2 6 holmes 6 7 4 2 2 3 5 1 johnson 2 2 4 6 6 5 3 1 knorr 7 4 1 2

javascript - web audio api: multiply waves -

Image
the web audio api lets me create constant sine wave in specified frequence signal this: var actx = new audiocontext(); var osc = actx.createoscillator(); osc.frequency.value = 500; osc.connect(actx.destination); osc.start(); how can multiply wave wave in order "shape" it. example how multiply sine wave of 200 hz. like so: try like var osc1 = context.createoscillator(); var osc2 = context.createoscillator(); var gain = context.creategain(); osc1.frequency.value = 500; osc2.frequency.value = 20; osc1.connect(gain); osc2.connect(gain.gain); gain.connect(context.destination); osc1.start(); osc2.start();

javascript - Does React.js have a basic Flux implementation? -

i new react.js , enjoying lot. came across flux architecture while reading react.js documentation. understand flux pattern , there many flux implementations out there – including facebook's own. know react.js can used without flux implementation. my question is: safe react.js has own (small) flux implementation embedded within it? in opinion, don't see other way react.js achieve uni-directional data-flow without having own flux implementation – is, of course, replaceable other flux implementations. flux pattern handling application state , react view library. don't have use flux react , it's preferred way. most popular flux implementation seem redux nowadays.

ios - Updating Height of Self-Sizing Table View Cell With Text View -

Image
i have table view similar "compose" screen in mail, 1 of cells used text input. i'd cell resize automatically constraining contentview of cell uitextview subview using auto layout. table view's rowheight set uitableviewautomaticdimension , , estimatedrowheight set 44. additionally, text view's scrollenabled property set false reports intrinsiccontentsize . however, find cell not update height lines of text entered user, though text view update intrinsic content size. far know, way request manually table view call beginupdates() , endupdates() . height of cell correctly updated, causes re-layout of entire table view. here's (someone else's) sample code demonstrating problem . how can reflect changes in cell's text view without laying out entire table view? throttled solution the trouble reloadrowsatindexpaths uitextfield resignfirstresponder since cell, in essence, reloaded: i.e. destroyed . conversely, beginupdates() &am

authorization - ASP.NET JSON Web Token "401 Unauthorized" -

i'm using decoupled resource , authentication servers. when json web token, check jwt.io , ok token format , it's secret. request authorization header: authorization: bearer token_here response "401 unauthorized": { "message": "authorization has been denied request." } here startup.cs resource server using microsoft.owin; using microsoft.owin.cors; using microsoft.owin.security; using microsoft.owin.security.jwt; using newtonsoft.json.serialization; using owin; using system.web.http; using test.database; using test.infrastructure; using microsoft.windowsazure.serviceruntime; [assembly: owinstartup(typeof(test.api.startup))] namespace custodesk.api { public class startup { public void configuration(iappbuilder app) { app.createperowincontext(() => applicationdbcontext.create(roleenvironment.getconfigurationsettingvalue("sqlconnectionstring"))); app.creat

Android xml shapes different from API 16 to API 23 -

Image
i create drawable object (without blue borders): api 23 for api 23 correct. but for: api 22 , api 16 are not correct. drawable code: <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:height="100dp" android:width="100dp" android:gravity="center"> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="90" android:todegrees="90"> <shape android:shape="line"> <stroke android:width="1dp" android:color="#000" /> </shape> </rotate> </item> <item android:height="100dp" android:width="100dp" android:gravity="center">

Returning an array element from an array created within the function in C? -

is proper thing in c ? char *func1() { char *str[3] = { "so", "is", "amazing" }; return str[1]; } the char *func1() returns pointer, pointing location in memory string stored. when func1() returns won't str array go out of scope , not returning pointer object not exist? dangling pointer (is right name?) so have 2 solutions make str global never goes out of scope , pointer pointer valid memory address, seems dirty. the other solutions char *func2() { char *str[3] = { "so", "is", "amazing" }; int str1len = strlen(str[1]); char *ret = (char *)malloc(str1len) ; // create block of mem hold str[1]. strncpy(ret, str[1], str1len); return ret; } is correct ? proper way func1() or func2() ? or there better way? i have been using func1() time , has not created problems me, mean func1() doing right thing? , func2() unnecessary? in first function, there no problem r

php - Params missing when POSTed to Fat Free Framework -

i've got angular front end calling rest service authenticate user provided fat free server. when use postman can see parameters passed in post in f3 route, so: function authenticate(\base $f3) { $logger = new \log('app-events.log'); $logger->write('authenticate called.'); $logger->write('username:' . $f3->get('post.username')); $logger->write('username:' . $f3->get('param.username')); will log username. but when call same service angular front end parameters empty. my server running version 5.6.17 , i've set always_populate_raw_post_data=-1. i stumped , appreciate insights. thanks matt

extract data from javascript multidimentional arrays -

Image
i'm having ajax call returns nested arrays success: function(data, el){ console.log(data); here's data i need extract [name] value [metas] i've tried data[1][0][3] but result 'undefined' associative array, try: data['metas'][0]['name']

javascript - How to set any jQuery chart data with PHP -

Image
i'm using template jquery charts values in these charts being set jquery want fetch own values database , set them instead of these values jquery sets with. know not possible nest php in jquery, should do? it looks use morris.js library. i'd suggest echo out javascript part, this: <?php if($condition){ echo "<script> morris.donut({ element: 'donut', resize: true, data: ["; foreach($value $m){ //your foreach here $value got fetching data database via mysqli or pdo $c = count($value); $amount = $m['amount']; //just example things if($c != 1){ echo "{label: '".$type."', value: $amount"."},"; } else { echo "{label: '".$type."', value: $amount"."}"; } unset($value['0']); } echo" ] }); </script>"; } else {

for loop - C - error after for() cicle -

i've been coding in c solve problem in rosalind's website. code simple, , because it's simple, it's hard correct error.(i guess) here code: /* string ordered collection of symbols selected alphabet , formed word; length of string number of symbols contains. example of length 21 dna string (whose alphabet contains symbols 'a', 'c', 'g', , 't') "atgcttcagaaaggtcttacg." given: dna string s of length @ 1000 nt. return: 4 integers (separated spaces) counting respective number of times symbols 'a', 'c', 'g', , 't' occur in s. */ #include <stdio.h> int main(){ char nt; int na, nc, ng, nt; for(int = 0, na = nc = ng = nt = 0; < 1000; i++){ nt = getchar(); if(nt == 'a'){ na++; }else if(nt == 'c'){ nc++; }else if(nt == 'g'){ ng++; }else if(nt == 't'){ nt+

sql - Full Outer Join - Save Output in new table -

i have 2 tables i'm trying join one. i ran following code successfully. select * combined left outer join isbn_price on combined.isbn13 = isbn_price.isbn; my question how save output new table? or append joined columns isbn_price onto combined table? thanks! to create table on fly: select * newtable combined left outer join isbn_price on combined.isbn13 = isbn_price.isbn;

Equivalent of Matlab in Python -

i have code want reference elements of m in matlab: nnanm = sum(isnan(m(:))); how tell python reference elements of m? if understand code correctly, count nan elements in matrix. if so, can equivalent thing in python using numpy following code: import numpy np np.count_nonzero(np.isnan(m)) if insist on sum function, work: np.sum(np.isnan(m))

amazon web services - IAM Roles and instance profile -

i have question application access dynamo db tables. if create role allow application access dynamodb tables, can associate role application instances referencing instance profile? you assign instance profile ec2 server @ time server created. application running on server have correct role access dynamodb tables. note can not assign role ec2 instance has been created. can modify role after server has started.

Why does MathNet.Numerics.Control.UseManaged require Cuda? -

Image
i'm trying test asp api controller in turn calls out dll uses mathnet.numerics.linearalgebra. first call mathnet.numerics.control.usemanaged(); however call fails error exception thrown: 'system.notsupportedexception' in mathnet.numerics.dll additional information: cuda native provider not found. why cuda required when i'm explicitly telling mathnet use managed not native? it not fail, exception handled internally. can continue debugging. the exception not thrown within usemanaged call internally @ static construction of control class, first time being accessed , initializes default providers (which includes probing whether of known native providers available). of course, cuda not required when using managed providers. this indeed small usability issue when debugging "break on exceptions" enabled. may able avoid throwing exception small refactoring. maybe should open github issue track this?

python - 'method' object is not subscriptable. Don't know what's wrong -

i'm writing code create unsorted list whenever try insert list using insert method 'method' object not subscriptable error. not sure how fix it. thanks. class unsortedlist: def __init__(self): self.thelist = list() def __getitem__(self, i): print(self.thelist[i]) def insert(self, lst): x in lst: try: self.thelist.append(float(x)) except: print("oops") mylist = unsortedlist() mylist.insert[1, 2, 3] you need use parentheses: mylist.insert([1, 2, 3]) . when leave out parentheses, python thinks trying access mylist.insert @ position 1, 2, 3 , because that's brackets used when right next variable.

C# Windows Form - How do I assign a double value to a combo box string to then be displayed in a text box? -

i've been having trouble of finding solution coding problem of assigning double value combo box item double value displayed , added text box. for instance, beverages combo box contains: soda, tea, coffee, milk, juice, etc. "soda" give value of $1.95 displayed in "subtotal:" text box. every time item selected in combo box, soda, juice, , coffee, every time item selected add previous subtotal value in text box. sorry if isn't clear great, i've blanked out , been trying come solution while , been struggling. thank you! this perfect use of custom type. in case create drink class description property , price property. override .tostring() method display description. class drink { public string description { get; set; } public decimal price { get; set; } public override string tostring() { return description; } } from instantiate new drink, populate description , price , add object combobox. combobox display &q

javascript - jQuery quizz with radiobuttons misbehaving -

i writing simple online quizz. there 4 radiobuttons choices. initially, script populates choices first question. after that, user should choose next 1 , click button. if answer matches correct one, total increments. else, next question loaded. when 10th question submitted, results loaded. questions loaded array ten objects called "pitanja". quno question number, opt1 opt 4 option texts , corrno correct option number. but if user hasn't chosen anything, there condition, won't work. quizz moves on , each time sets fourth choice. if other chosen, next 1 still 4 default. maybe one, too... additionally, says success rate 30%, corresponds 3 of 10 correct d's... i know not complex @ all, i'm confused here... have gone wrong? $(document).ready(function() { var pitanja = [{ "quno": 1, "opt1": "a", "opt2": "b", "opt3": "c", "opt4": "d",

javascript - Angular2 + Angular1 + ES5 syntax component subscription -

first of let me still using es5, because writing frontend of google apps scripts application , didn't have time/patience make typescript work. i using method in order upgrade angular1 app angular2: http://www.codelord.net/2016/01/07/adding-the-first-angular-2-service-to-your-angular-1-app/ i have overlayloaderservice service show loading spinner in overlay div simple functions , set loading state, , overlayloader component show div itself. service: var overlayloaderservice = ng.core. injectable(). class({ constructor: function() { this.loading = false; this.statechange = new ng.core.eventemitter(); }, setstate: function(state) { this.loading.value = state; this.statechange.emit(state); }, getstate: function() { console.log(this.loading); } }); upgradeadapter.addprovider(overlayloaderservice); angular.module('gojira').factory('overlayloaderservice', upgradeadapter.downgradeng2provider(overlay

python - Pygame, trying to erase sprite -

Image
i making pygame app with app, can place blue dot around screen mouse right click. middle mouse supposed erase dot, feature isn't working.... any idea ? # -*- coding: utf-8 -*- import pygame pygame.locals import * def func_circle(x,y): cercle=pygame.sprite.sprite() pygame.sprite.sprite.__init__(cercle) cercle.image=pygame.surface((500,500)) cercle.image.fill((0,0,0)) cercle.image.set_colorkey((0,0,0)) pygame.draw.circle(cercle.image,(0,0,255),(cercle.image.get_rect().centerx,cercle.image.get_rect().centery),25,0) cercle.image.convert_alpha() cercle.rect=cercle.image.get_rect() cercle.rect.centerx=x cercle.rect.centery=y return cercle pygame.init() fenetre = pygame.display.set_mode((640, 480)) background = pygame.surface(fenetre.get_size()) background = background.convert() background.fill((250, 250, 250)) liste_des_sprites = pygame.sprite.layeredupdates() continuer = 1 while continuer: event in pygame.event.get(

How to solve error: ';' expected in Java? -

i have error: ';' expected issue java code below. don't know how solve it? sortthread , mergethread have been created class, , compiled well. the problem sortthread t1.join() = new sortthread(a); sortthread t2.join() = new sortthread(b); mergethread m.start() = new mergethread(t1.get(),t2.get()); these 3 line codes has error: ';' expected issues. in main, create 2 array, , b. m array merge a&b, , main display m. any hints or solutions helpful me. import java.util.random; public class main{ public static void main(string[] args){ random r = new random(system.currenttimemillis()); int n = r.nextint(101) + 50; int[] = new int[n]; for(int = 0; < n; i++) a[i] = r.nextint(100); n = r.nextint(101) + 50; int[] b = new int[n]; for(int = 0; < n; i++) b[i] = r.nextint(100); sortthread t1.join() = new sortthread(a); sortthread t2.join() = new sortthread(b); mergethread m.start() = new mergethread(t1.get(),t2.get());

ecmascript 6 - Javascript destructuring to populate existing object -

this question has answer here: is possible destructure onto existing object? (javascript es6) 8 answers i'm using object destructuring syntax of es6. want use in order populate existing object. i got 2 objects: let $scope = {}; let email = { from: 'cyril@so.com', to: 'you@so.com', ... }; i want assign email object properties $scope object. for now, i've end doing so: ({ from: $scope.from, to: $scope.to } = email); in real life use case have more 2 properties assigned. so, know other way improve , avoid repeating $scope in left assignation part? you correct, can this: object.assign($scope, email); however not immutable, altering $scope object (which fine in case). if want immutable operation this: $scope = object.assign({}, $scope, email); that return brand new object. also, if have object rest spread fea

ios - NSDataBase64DecodingOptions always returns nil -

there lot of similar questions non of them helped me out don't know ask. how encode uiimage: let data: nsdata = uiimagepngrepresentation(imageresized)! let base64string: nsstring = data.base64encodedstringwithoptions(.encoding64characterlinelength) and decoding (as suggested here ): if let range = base64.rangeofstring("data:image/png;base64,", options: .anchoredsearch) { base64.removerange(range) } let decodeddata = nsdata(base64encodedstring: base64, options: nsdatabase64decodingoptions(rawvalue: 0)) if let decodedimage = uiimage(data: decodeddata!) { self.imagelist.append(decodedimage) } but app crashes when initializing decodeddata , can't figure out why. checked base64 string here , returns picture. appreciated! try this: if let decodeddata = nsdata(base64encodedstring: base64, options:nsdatabase64decodingoptions.ignoreunknowncharacters){

java - How to get several buttons' text at once in Javascript? -

i have following code, it's part of java servlet, html, javascript/jquery web app. <table border=1> <tr> <td><button id=current_1 type=button></button></td> <td><button id=current_2 type=button></button></td> <td><button id=current_3 type=button></button></td> <td><button id=current_4 type=button></button></td> <td><button id=current_5 type=button></button></td> <td><button id=current_6 type=button></button></td> </tr> </table> what can on java servlet side text in each of buttons, i'm thinking having submit button when it's clicked, jquery gets buttons , loop through them each button's text. the text in buttons have nothing, during app user can click , change values, @ end need give user way save content on buttons , pass them servlet, what's

audio - Swift function playAtTime() Does Not Add Delay -

i'm trying play 2 audioplayers, 1 after other has finished playing. i'm using swift function playattime() create delay second, follows: var audioplayer1 = avaudioplayer() var audioplayer2 = avaudioplayer() let soundpatha = nsbundle.mainbundle().pathforresource("a", oftype: "m4a") let soundurla = nsurl.fileurlwithpath(soundpatha!) let soundpathb = nsbundle.mainbundle().pathforresource("b", oftype: "m4a") let soundurlb = nsurl.fileurlwithpath(soundpathb!) var notea = sound() notea.url = soundurla var noteb = sound() noteb.url = soundurlb self.audioplayer1 = try!avaudioplayer(contentsofurl: soundurla) self.audioplayer2 = try!avaudioplayer(contentsofurl: soundurlb) let duration : nstimeinterval = audioplayer1.duration self.audioplayer1.play() self.audioplayer2.playattime(duration) however, no delay occurs. issue here? the playattime function not start play @ given time. instead plays immediately, given time in sound pl

c# - Teamcity Nunit 3.0 Console Runner not working -

Image
i trying use nunit 3.0 console runner teamcity. here confiuration. when run configuration, following error > run unit tests (nunit) (1s) [10:44:03][step 3/3] ##teamcity[buildstatisticvalue key='buildstageduration:buildsteprunner_3' value='0.0'] [10:44:03][step 3/3] starting: c:\teamcity\buildagent\work\e6cc09e5f0da4a07\libs\nunit.console.3.0.1\tools\nunit3-console.exe c:\teamcity\buildagent\temp\buildtmp\o1yaiplezg1cm2nfztd88h0nb2q14zof.nunit --work=c:\teamcity\buildagent\work\e6cc09e5f0da4a07 --noresult --noheader [10:44:03][step 3/3] in directory: c:\teamcity\buildagent\work\e6cc09e5f0da4a07 [10:44:03][step 3/3] runtime environment [10:44:03][step 3/3] os version: microsoft windows nt 10.0.10586.0 [10:44:03][step 3/3] clr version: 4.0.30319.42000 [10:44:03][step 3/3] [10:44:03][step 3/3] test files [10:44:03][step 3/3] c:\teamcity\buildagent\temp\buildtmp\o1yaiplezg1cm2nfztd88h0nb2q14zof.nunit [10:44:03][step 3/3] [10:44:04][step 3/3] [10:4

php - Laravel Route Filters in Laravel 5 -

does laravel 5 has route filters laravel 4 , or removed in version 5? directory in laravel 5, in version 4 in app/filters? filters in middleware .

php - How to properly implement an email tracking pixel -

i current using php output 1x1 pixel include in e-mails. before output image, run couple of scripts (i.e. increment view count etc...). however, i've noticed clients gmail & outlook download image before serving user and, of course, counts view, because image being viewed. send e-mail , before opening response in server tracking pixel has been viewed , when open e-mail, second response. my question is, within tracking pixel, how can tell when user has opened e-mail , not when client gmail or outlook downloading image? what check amount of times gmail, outlook, etc. opens requests pixel without showing user , substract total times pixel viewed. if total times pixel views greater 0, user opened it. for example: test email sent gmail account tells pixel requested gmail 2 times , haven't opened email yet. 2 total requests - 2 gmail server requests = 0 (email not viewed) user opens email 1 time... 3 total requests - 2 gmail server requests = 1

How to trap when student is already log in or log out of the event, using Vb.net 2008 -

this code button private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click user = 1 if textbox1.text <> "" dim namemo string = "" executequery("select * tbl_student id='" & textbox1.text & "'") if reader.hasrows try while reader.read namemo = reader.item("lname") & ", " & reader.item("fname") & " " & reader.item("mi") & "." end while catch ex exception end try call disconnectdb() 'for logging in if logstatus = 1 executequery("select * tbl_log studid='" & textbox1.text & "' , eventid=" & realid) if reader.hasrows call disconnectdb()

How can I remove HTML elements with JqLite or javascript -

how can remove following text 'search:' jqlite or original javascript? <label> search:<input type="text"> <label> update i didn't explain question clearly. html elements created angular directive can manipulate dom jqlite or js maybe. , attributes of input may change can't replace child nodes of label new input please try this <html> <body onload="remove()"> <label> search: <input type="text" id="search"> </label> </body> <script type="text/javascript"> function remove() { document.getelementbyid('search').remove(); } </script> </html>

How to create a solr query that searches by multiple keywords in all fields -

i want perform solr query on fields multiple keywords. example, want search word "dog" , word "cat". so far, i've tried this: q=dog cat or like: q=dog,cat however, think queries doing or instead of and. your question default operator (and/or) , want search in "all fields". for parsers can use parameter q.op change default parser (e.g. standard query parser , dismax query parser ) or can use defaultoperator in schema.xml or schema api . be aware search in default field . if want search in "all fields" have copy fields 1 field (and use default field) or have list fields in dismax qf-parameter . results not same: in second case "and"-search must match 1 of fields (with special tokenizer), in first each term in different fields match (because in end terms in default field).

angular - How to pass an object from parent component to child component which is created using DCL loadintolocation()? -

i loading component using dcl.i want pass object component.. have made plunker demo http://plnkr.co/edit/qklmnnjfrt8pyvngdjg4?p=preview appcomponent parent , object want pass information = {name:"abhi", place:"banglore"}; export class somecomponent { public childform: controlgroup; constructor(fbs: formbuilder) { this.childform = fbs.group({ 'name': ['', validators.required], 'place':[''] }); } } this child component...when ever new component loads want display object passed in input box of child component.i have no idea how pass data parent child in dcl...somebody please me guys... the componentref provides reference created component it's instance getter loadintolocation(...).then(ref => { ref.instance.somefield = somevalue; } see similar question how call event in parent component child component loaded using dcl loadintolocation()

java - Mybatis If statements using include properties -

i'm trying create generic sql include in mybatis apply comparator given particular value. idea reuse sql code snippet across several mappers. issue i'm having when using string substitution in if statement inside of include. currently xml looks this: <select id="get" parametertype="servicemodelqueryhelper" resultmap="servicerecordmap"> select * service <if test="name.isapplicable()"> service.name <include refid=comparatormapper> <property name="comparator" value="${name.comparator}"/> <property name="value" value="${name.value}"/> </include> </if> </select> <sql id="comparatormapper"> <if test="${comparator} == 'equals'"> = ${value} </if> <if test="${comparator} == 'contains'"> ~ ${value}

delphi - Encodeing results are not working -

Image
i have program written in delphi 4 , trying convert delphi xe10. 1 part not understand this. cmd[0] := 2; // number of equipment talk cmd[1] := 22; // device address cmd[2] := 0; mresults.lines.add('reciving...'); refresh(); srlen := high(recbuff); ret := gplisten(@cmd, @srlen, @recbuff); // gets returned value if checkret('gplisten', (ret , $ff), csbuf) = 0 begin recbuff[srlen] := chr(0); // ?? mresults.lines.add(recbuff); // returned //csbuf := format('????', [srlen]); ////?some error?? end; the issue recbuff (recbuff:array[0..9999] of char;) starts off full of #0 so: but ret := gplisten(@cmd, @srlen, @recbuff); is ran recbuff looks this: alot of japan char. how encode onto memopad correctly. try changing recbuff:array[0..9999] of char; to

filesize - executable size compiled by gcc -

hello experts please answer following query. size of binary file 'test' used following commands in linux fedora , compiled gcc compiler. $ll -h test -rwxrwxr-x. 1 user user 4.3m feb 8 11:17 test $size test text data bss dec hex filename 891714 244788 26664 1163166 11bf9e test my question right command know size of executable file 'test'? why 2 commands shows different results ? the ls program gives file size, 4.3m (actually, 4.5m because -h uses wrong prefix… not relevant). the sizes program gives section sizes. not sections included, why smaller. program has debug information included, not printed out sizes .

apache - Ant command not found in bash (windows 32bit) -

i installed apache ant using link http://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/ i trying build files in git bash. shows following error when type ant: bash:ant:command not found i want use cd build command. check path when in bash session. echo $path don't forget that, after updating path mentioned in link (through environment variable control panel), need open new cmd session , launch git-bash.exe in order session inherit modified path. cd c:\path\to\git git-bash.exe echo $path the op confirms in comment path now: d/users/h169717/bin:/mingw32/bin:/usr/local/bin:/usr/bin:/bin/:/mingw32/bin:/us‌​‌r/bin:/d/users/h169717/bin: /c/program files/apache-ant-1.9.6/bin :/c/program files/java/jre1.8.0_72/bin:/c/program files/apache-ant-1.9.6/bin:/usr/bin/vendor_perl:/usr/bin/core_perl and ant working.

c# - Read XML using SelectSingleNode -

i using following code read specified xml <?xml version=\"1.0\" encoding=\"utf-8\"?> <feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"> <title>gmail - inbox xxxx@gmail.com</title> <tagline>new messages in gmail inbox</tagline> <fullcount>1</fullcount> <link rel=\"alternate\" href=\"https://mail.google.com/mail\" type=\"text/html\" /> <modified>2016-02-07t12:11:21z</modified> <entry> <title>access less secure apps has been turned on</title> <summary>access less secure apps has been turned on hi buddy, changed security settings so</summary> <link rel=\"alternate\" href=\"https://mail.google.com/mail?account_id=agl.testauto@gmail.com&amp;message_id=152bb8ccd28d824b&amp;view=conv&amp;extsrc=atom\" type=\"text/html\" />

Babylonian Algorithm with C++ unable to get loop to run -

is refusal program produce result consequence of unable loop? please find below code more information. #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { double x, squareroot, oldsquareroot, counter=0; cout << "enter positive number: " ; cin >> x ; { (oldsquareroot = x/2; abs(squareroot-oldsquareroot) >= 1e-9 && abs(squareroot - oldsquareroot)>=(1e-8*x);counter++ ) { squareroot = (squareroot+x/squareroot)/2; } } cout << setprecision(15); cout << "the value of squareroot is:" << squareroot << endl; cout << "the number of interations required computation is:" << counter << endl; return 0; } there mistakes. works fine. #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { double

javascript - Load handlebars js partial with different data -

is there way use partial include different data in it? or in other words, can include template handlebars template in template? basically this: <script id="countries-nav" type="text/x-handlebars-template"> {{#each this}} <li class="item"><a href="#/countries/{{iso}}">{{country}}</a></li> {{/each}} </script> <script id="countryspecifics" type="text/x-handlebars-template"> {{#each this}} <div class="country__title"> <h2>{{title}}</h2> </div> {{> countries-nav}} {{/each}} </script> this basic functionality of blaze: <template name="countries-nav"> {{#each this}} <li class="item"><a href="#/countries/{{iso}}">{{country}}</a</li>

c# - How to hide the auto generated delete button in GridView -

how hide auto generated delete button in gridview. unable make delete button invisible. while making invisible of delete button cancel button not getting invisiable. cancel button getting invisible <asp:gridview id="gvcompanies" runat="server" cssclass="mydatagrid" pagerstyle-cssclass="pager" headerstyle-cssclass="header" rowstyle-cssclass="rows" allowpaging="true" onpageindexchanging="gvcompanies_pageindexchanging" autogeneratecolumns="false" emptydatatext="no records found" onrowediting="gvcompanies_rowediting" autogenerateeditbutton="true" onrowupdating="gvcompanies_rowupdating" onrowcancelingedit="gvcompanies_rowcancelingedit" onrowdeleting="gvcompanies_rowdeleting" autogeneratedeletebutton="true" onrowdatabound="gvcompanies_rowdatabound" > <columns>

.htaccess - Java app loads single url only after deployed -

i have tested java app in local developed using jsp , servlets. i have domain , copy war in domain. able access app http://mdomain.com:8080/myapp without issues. now, want make app available while hitting http://mdomain.com . so, configured .htaccess file domain follows, rewriteengine on rewritecond %{http_host} ^mydomain.com rewriterule ^(.*)$ http://mdomain.com:8080/myapp/ [p] now, able see home page when hittng http://mdomain.com . while hitting submit button, page loading home page , no respective pages displayed. i using apache tomcat7. put war in webapps. what missing here? may copy myapp folder public_html folder. if mod_proxy enabled can use: rewriteengine on rewritecond %{http_host} ^mydomain\.com$ [nc] rewriterule ^(.*)$ http://mdomain.com:8080/myapp/$1 [p] note use of $1 back-reference of captured value in rewriterule

java - Check for connections and eventually reconnect using dropwizard 0.9.2 and JDBI -

i'm using drowizard 0.9.2 jdbi connect mysql server. happen mysql database not active if app starts due async deployments. want app loop , check each 5 secs or whether can reach database. how possible framework mentioned above? just fyi, i've found solution works me. this method checks connection. if returns false, i'll enter synchronous loop checks (and establish connection) when possible.. public boolean checkforconnection() { handle handle = null; try { jdbi = factory.build(environment, config.getdatabasefactory(), "postgresql"); handle = jdbi.open(); } catch (exception e) { logger.error("error while checking postgres connection."); return false; } { try { if(handle != null){ handle.close(); } } catch (exception e){ logger.error("error trying close connection"); return false; } } return true; } unfortunately, can't use connectionfactory private member of dbi.

url - cleaning untrusted inputs that build os commands in PHP? -

how remove untrusted inputs build os commands url in php? when running automatic testing zaproxy, getting alert of p1 inputs building os commands. want know how clean commands. use escapeshellarg() , escapeshellcmd() escape data usage shell command or argument. // escapes single argument // sample input: "/foo/bar/" $argument = escapeshellarg($userinput1); exec("ls $argument"); // escapes special characters [];{} usage in command line // sample input: "ls -l; rm -rf /" $command = escapeshellcmd($userinput2); exec($command); you should use both commands prevent users executing arbitrary commans on server. documentation: http://php.net/manual/en/function.escapeshellarg.php http://php.net/manual/en/function.escapeshellcmd.php

javascript - angular2 - skip first item in ngFor -

i want skip first item ngfor : <li *ngfor="#m +1 of [1,2,3,4]">{{m}}</li> the output should be: 2,3,4 what best way in angular2? you can start second (or arbitrary offset) items of collection of slice pipe : <div *ngfor="#m of [1,2,3] | slice:1">{{ m }}</div> // print 2 , 3

java - CouchDB4j/ mvn dependencies are missing -

i having trouble setting connection local couchdb programmatically. i using couchdb4j- , things seem good, until run , try connect db. my console throwing following error: exception in thread "awt-eventqueue-0" java.lang.noclassdeffounderror: org/apache/http/params/httpparams [...] caused by: java.lang.classnotfoundexception: org.apache.http.params.httpparams since small application not finding class, i've checked dependencies- should fine. have: <dependency> <groupid>org.apache.httpcomponents</groupid> <artifactid>httpcore</artifactid> <version>4.0-beta3</version> </dependency> <dependency> <groupid>commons-httpclient</groupid> <artifactid>commons-httpclient</artifactid> <version>3.1</version> </dependency> which should include necessary http specific .jar (especially first 1 should include httpparams binaries; source: http://mvnreposito

php - Error and exception handling in php7 -

recently moved php7. following error occurs: argument 1 passed myclass\throwable::exceptionhandler() must instance of exception, instance of error given and respective class namespace myclass; class throwable { public function exceptionhandler(\exception $exception) { //logic here } } as stated in docs most errors reported throwing error exceptions. does mean have provide instance of error or more general throwable exception handler? errors , exceptions both extend throwable errors not extended exception . therefore, exceptionhandler must accept object of type throwable in order accept errors . simplest fix this, though may want rename $exception make clear. namespace myclass; class throwable { public function exceptionhandler(\throwable $exception) { //logic here } } note: new error class should not confussed errorexception has classicly been used device turning php 5 errors exception objects syman

php - Symfony2 elasticsearch in production returns 500 -

in development works. when switch production , try search 500 error. there no errors written in logs dont understand can wrong? when going http://localhost:9200/_plugin/head/ . see products saved in index app_dev. however there not index related app. why that? why not creating indexes in prod? config.yml: fos_elastica: default_manager: orm clients: default: { host: localhost, port: 9200 } indexes: app: index_name: app_%kernel.environment% types: product: mappings: id: type: integer admintitle: type: string base: type: double created_at: type: date persistence: # driver can orm, mongodb, phpcr or propel # listener , f

javafx - Select first/last clears anchor information - MultipleSelectionModel -

i have table table.getselectionmodel().setselectionmode(selectionmode.multiple); . need implement go last/first row of tableview . used table.scrollto(ind); table.getselectionmodel().clearandselect(ind) . scroll first row , select it. if try select numerous rows (using mouse right button + shift) doesn't select range of rows between first row , 1 pressed set anchor @ selected row. what i've observed far: from pseudoclass css information. first row selected,focused - exprected. table.getselectionmodel().selectedindexproperty() table.getselectionmodel().getselectedindices() shows 0 , [0] respective - expected row not selected - table no longer focused got grey not blue row. if call table.requestfocus() @ time , use platformutil.runlater() doesn't change anything. assume has nothing table focus. any ideas howto (from code) select first row , make such situation after pressing mouse button on other row shift got multiple selection? sample application. see cre