Posts

Showing posts from September, 2012

postgresql - Network connection between 2 Docker Container (JBOSS/DATABASE) -

i'm trying connection between 2 docker container. first 1 postgres database , second 1 jboss. i'm using ansible , here playbook: --- - hosts: localhost tasks: - name: start postgresql docker: name: mypostgres image: myimage_postgres ports: - 5432:5432 expose: - 5432:5432 state: started env: db_user: "user" db_pass: "pass" db_name: "name" - name: start jboss docker: name: jboss image: myimage_jboss ports: - 1099:1099 expose: - 1099:1099 state: running env: postgres_port_5432_tcp_addr: "172.17.0.2" postgres_port_5432_tcp_port: 5432 hibernate_create_ddl: "" db_name: "name" db_user: "user" db_pass: "pass" if start both docker images, there no connection between database , jboss. there had missed, in configuration? thanks lot, pascal you need link postgres container jbo...

python - Retrieving an ordered set of Objects from MongoDB | Pymongo -

this first post here. encouraged colleague after searching through part of internet. i work on project use mongodb , python. web application. defined document class user comments. furthermore have sorted list of ids correspond comments. want access mongodb in order full list of user comment objects directly ordered in order of our list of ids without ordering on fly command orderby (we imagine might save runtime). @ moment use following command: comment.objects(id__in=ids) where ids list of sorted ids of comment objects. unfortunately order of list retrieving wrong. do have hints? or there no way optimize process? thank in advance!

c - Compile and link in Linux pointing to libraries of other system -

i have arm based computer, linux ubuntu, , have mobile device linux, tizen, bought cpu compatible, if compile in computer, executable should able work if copy mobile device , call terminal. the problem libraries, bought systems have needed libraries in different version numbers. did image of mobile device rom, rootfs.img, idea unpack image , compile code against image libraries. well, code openssh, have autotools , make... i read how link shared library against other shared library in linux? ; not suitable me because openssh should compile throw autotool , make, using directly gcc hell. anyone knows trick force ./configure or make link external libraries? chroot?

java - RMI: thread waiting on server side -

i have following code: public interface rmiserver extends remote{ public string getmessage()throws remoteexception; } public class defaultrmiserver implements rmiserver{ private linkedblockingqueue<string> queue; @override public string getmessage()throws remoteexception{ return queue.take(); } ... } when rmi client calls getmessage() method clear there can 2 situations: there message in queue , method returns there no message in queue , thread waiting what happen in second case rmi call? how long client wait? sun rmi client connection's timout being controlled property sun.rmi.transport.tcp.responsetimeout , default set no timeout (=waits forever). sun.rmi.transport.tcp.responsetimeout (1.4 , later): the value of property represents length of time (in milliseconds) client-side java rmi runtime use socket read timeout on established jrmp connection when reading response data remote method invocation. therefore, p...

html - Height % of Parent div not translating to % of child div -

i asked similar question earlier last week i'm still struggling find solution questionnaire i'm building. currently, have html , body tags set 100% height, , tag .questionnaire-container nested inside set 100%. inside .questionnaire-container there container called .questionnaire-box takes 80% height of .quesionnaire-container , inside have tag called .questions. i'd .questions fill 100% of .questionnaire-box , have overflow text display scroll. the issue i'm having height % isn't being passed way down , overflow isn't being hidden. can't find out life of me causing issue. html, body { min-height: 100%; } .questionnaire-container { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100%; background-color: rgba(0,0,255, .1); } .questionnaire-box { position: relative; width: 80%; min-height: 85%; margin: 20px auto; background-color: #ffffff } .questions...

javascript - Server error 500 in PHP -

so today have small little issue php, causing me server error. see, have javascript function: $.post('script.php', { limit: str }, function(result) { console.log(result); }); which of course makes call php file: require_once("../data/db-settings.php"); require_once("../data/file.php"); global $pdo; $list = array(); $limit = $_post["limit"]; chop($limit, ";"); $stmt = $pdo->prepare("select cust_id, cust_addr project " . $limit . " = cust_id"); $stmt->execute(); while ($row = $stmt->fetch(pdo::fetch_assoc)) { $list[] = $row; } echo $list; the point of php grab information database user can dynamically change , use. issue, i'm assuming, how i'm using pdo, because code i'm using in working order in section. know function call sending data , working properly, because when check send, sends properly. thanks guys. it unobvious error! step step fol...

shell - Printing date range in AIX -

i'm trying print date range in aix. i'm not able use 'date' in aix properly. i've tried solutions suggested in stack overflow. nothing worked. please find error , code below. can't download 'gnu'. #!/bin/ksh startdate=20141030 enddate=20141120 loop_date=$startdate let j=0 while [ "$loop_date" -ne "$enddate" ]; loop_date=`date -j -v+${j}d -f "%y%m%d" "$startdate" +"%y%m%d"` echo $loop_date let j=j+1 done error: date: illegal option -- j usage: date [-u] [+field descriptors] try this; #!/bin/ksh startdate=$1 enddate=$2 loop_date=$startdate currentdate=`date +%y%m%d` let j=0; if [[ $startdate -lt $currentdate && $enddate -lt $currentdate ]];then loop_date=$currentdate while [[ "$loop_date" -gt "$startdate" ]]; loop_date=$(tz=cst+$j date +%y%m%d) if [[ $loop_date -le $enddate ]];then echo $loop_date fi let j=j+24 done ...

Python shell call to exiftool -

i have image, 1.tiff, want copy exif data 2 other images, 2.tiff , 3.tiff. normal shell can write same exif data multiple images typing exiftool -m -overwrite_original -tagsfromfile "1.tiff" {"2.tiff","3.tiff"} for reason, not able form pyton. if execute same shell command python script, i.e. os.system('exiftool -m -overwrite_original -tagsfromfile "1.tiff" {"2.tiff","3.tiff"}') i following error: error: file not found - {2.tiff,3.tiff} it works, however, if call command every single image, written to. i.e. os.system('exiftool -m -overwrite_original -tagsfromfile "1.tiff" "2.tiff"') os.system('exiftool -m -overwrite_original -tagsfromfile "1.tiff" "3.tiff"') but, going call command several thousand times, reading exif data 1.tiff on , on again slow. have suggesting on how copy exif data 1 source image multiple images while reading source image ...

.net - Automatic days count in vb.net -

i trying find way auto calculated no of days between 2 days. example: if create entry let's id 500 on 1st july, 2016 , saved it. again, after 15 days, i.e. opened id 500 on 15th july, 2016 , value field should show "15" including 15th july. in same way, if open id on 20th july, 2016 , should show "20". i tried datediff function not auto calculating. me.txtndays.text = datediff(dateinterval.day, now, metxtdtenter.text) any appreciated. thank in advance well there 14 days between 1st july , 15th july. to calculate can subtract 1 date other result in timespan , find totaldays this: dim originaldate date = #2016-07-01# 'get value database dim testdate date = #2016-07-15# 'this date want compare to. use datetime.now use current date dim daysbetween = (testdate - originaldate).totaldays '14

c++ - Can division by non-zero still create a nan / infinity -

i have number might zeros. divide number want test if it's 0 prevent nan's , infinitys. possible still create nans / infinity because of rounding errors within division? double x; // might 0 double y; if(x != 0) return y / x; edit thanks responses. i'll add subquestions then. 1) assuming neither x nor y nan / +inf or -inf, division results in -inf / +inf result in more cpu cycles or other unwanted behaviour? (could crash?) 2) there way prevent division resulting in infinity? using offsets , on. can division non-zero still create nan / infinity yes. if ieee-754 followed then: if either operand nan, result nan. if both numerator , denumerator infinity, result nan. if numerator infinity, result infinity. if division small denumerator (or large numerator) overflows, result may infinity, depending on current rounding mode. rules of other representations may different. 2) there way prevent devision resulting in infinity this shou...

VBA to Download, Extract and Import Zip File to Excel -

i have simple link, www.example.com/file.zip. it's public server , requires no login. the link zip file. zip file contains tab-delimited text file (20mb). is there all-in-one code download zip file temp folder...extract text file...and import data excel worksheet? each run of macro overwrite previous data new data. i tried apply solution post , can't work. answer other post involved unzipping csv file , saving text file. zipped file contains text file. i'd appreciate help.

javascript - How do I remove a specific element from local storage array in Angularjs? -

here's html: <tr ng-repeat="student in students track $index"> //some code here <button ng-click="remove(student)">delete</button> </td> </tr> and here's .js file code deleting student(not local storage): $scope.remove = function(student) { var index = $scope.students.indexof(student); $scope.students.splice(index, 1); } how access local storage js code , delete particular student local storage. sounds should rephrase question "how access browser's local storage js code?" you can access localstorage in js code localstorage . delete student $scope.students , when finished, set new array item in local storage: $scope.remove = function(student) { var index = $scope.students.indexof(student); $scope.students.splice(index, 1); localstorage.setitem('students', json.stringify($scope.students)); }

java - How to successfully draw background JPanel once and update foreground JPanel constantly? -

i have custom jlayeredpane, , repainting in game loop. there 2 custom jpanels added jlayeredpane. these foreground , background jpanels. how draw background jpanel once, (and repaint when window re-sized or other reason) reduce impact on system resources, while continuing update foreground jpanel constantly. to re-iterate, dont want repaint background jpanel in loop. want repaint when nessessary, background not change. , large. in attempt this, have drawn background once. however. background jpanel not visible. while foreground jpanel updates normal. if foreground jpanel paints ontop of background jpanel, though have both of jpanels set setopaque(false) i have made mvce shows attempt @ drawing background jpanel once, while updating foreground jpanel constantly. the problem code background jpanel not show. now. know if draw show. defeats purpose of i'm trying do. trying draw once, , have seen @ same time my code draws background jpanel once. problem background jpane...

c# - How can I create a code that will automatically apply shaders to the materials of the objects in the model? -

i have code in c# reads materials of tagged object , renders based on shader want use. know if there more easier way this. in model there lot of objects have lot of materials. time consuming create these many scripts , run them on uniy3d. want create script automatically find materials of objects in model , apply shaders them. put on parent gameobject , should work, finds of renderer 's in children of game object , assigns shader. using unityengine; using system.collections; public class assignshaderstochildren : monobehaviour { public shader shader; // should hold shader want use void start() { // create list hold renderers can assign shader list<renderer> renderers = new list<renderer>(); renderers = getcomponentsinchildren<renderer>(); // every renderer in list assign materials shader shader foreach (renderer r in renderers) { r.material.shader = shader; } } } n...

How can replace image in Exisitng PDF using itextsharp c# Assembely -

i have following code using replace image on pdf,the code runs without error, pdf file not change image. how can resolve it.so need adding images in pdf file. pdfreader pdf = new pdfreader("pdf\\111x117.pdf"); pdfstamper stp = new pdfstamper(pdf, new filestream("pdf\\output.pdf", filemode.create)); pdfwriter writer = stp.writer; (int pagenumber = 1; pagenumber <= pdf.numberofpages; pagenumber++) { itextsharp.text.image img = itextsharp.text.image.getinstance("images\\image1.jpg"); pdfdictionary pg = pdf.getpagen(pagenumber); pdfdictionary res = (pdfdictionary)pdfreader.getpdfobject(pg.get(pdfname.resources)); pdfdictionary xobj = (pdfdictionary)pdfreader.getpdfobject(res.get(pdfname.xobject)); if (xobj != null) { foreach (pdfname name in xobj.keys) { pdfobject ...

javascript - React Select - setState of prop -

i trying set state of brandselect prop in reactjs using react select confused how can done? here current code: class vehicleselect extends react.component { constructor(props) { super(props); this.state = { brandselect: ""}; } render() { var options = [ { value: 'volkswagen', label: 'volkswagen' }, { value: 'seat', label: 'seat' } ]; return ( <select name="form-field-name" value={this.state.brandselect} options={options} placeholder="select brand" searchable={false} onchange={} /> ) } }; when option selected want state set option chosen. does know how done react select documentation doesn't cover this? far have tried making function set state attached onchange prop didn't work. you can try add _onchange handler component, handle changes form <select /> component. c...

javascript - How to convert dropdown to radio using jquery -

i have drop down select , want change radio button: html <select id="designation" title="designation" name="designation"> <option value="">choose option..</option> <option value="1">educator</option> <option value="2">student subscriber</option> <option value="3">adult subscriber</option> </select> <div id="r"></div> i try add code display buttons without labels, how can add labels too? jquery jquery("#designation option").each(function(i, e) { jquery("<input type='radio' name='r' />") .attr("value", jquery(this).val()) .attr("checked", == 0) .click(function () { jquery("#designation").val(jquery(this).val()); }) .appendto("#r"); }); you have create separately, ...

database - Can multiple queries be issued in same connection? -

can issue multiple queries in same connection or need issue them 1 query per connection ? all database api's i've seen support multiple queries in same connection. in fact, it's practice keep connection around if have more queries soon.

javascript - ASP.Net MVC Web API JavaScriptSerializer - Byte Array -

i have web api returning info along image (byte array) var result = response.result.content.readasstringasync(); snippet: {"companyname":"mycompany","address":"address1","logo":"ivborw0kggoaaaansuheugaaakaaaabqcayaaacexx40aaaabhncsvqicagifahkiaaaaalwsflzaaaw6gaafuob5y5deaaaabx0rvh0u29mdhdhcmuaqwrvymugrmlyzxdvcmtzientnui8sowaaaawdevydenyzwf0aw9uifrpbwuamdcvmjuvmtzmho7iaaab6hbyvld4no2wyvkdmbcfowkl3mirebov4a/xb6/dztyaw128gujfnsmycrugldrvswdtl83blw1mpr8/vtrrhbuua9v+0zzn1zt9taeu67aut38uaaaaaaaaaaaaaabgibbaaet0t5kv4h+x/vvitf27oyz5d8xvaf9sczcf1vq+0/5vjx9f/q3rjwz/bbtlb9iuealisc4pcv/uchqd+labu5ylliti1u7lj+ttar1couvjekxzvo/cev/emoemugjwpirrwh4nz/eftudp0x8extg4ez9z6p/rt1c3et7vikf/tkan5xw6op3wd+ulxt8kqyvsxrft6z/hwd2ffhgio8m/78ap8ngj7jz+r/qx+c/z/zv1/xe9qv/j65e+/abs+9+k/rvj+qensemdsmrj/y37bvuecfahsodttv/tit5drd8t26fk2f+cb+ohx8wlsy8nbkh/8+lflecyo4sj9e8fydr3adls9pwm9njs+lrdfp4anfadas1dnf/zlvhv7n7/lue+f3e5on+jhlthullknin/c91k88t9l003lh3nb...

javascript - How do I get rid of blank spaces that appear at the end of Tspan elements in svg? -

i'm implementing svg in xslt transformation. part of this, have put url in box. however, box can width, wrote function in javascript word wrapping, since svg doesn't support word wrapping. basically, javascript splitting string 5 sections , putting them in different tspan elements. however, @ end of each tspan element, blank space appearing. makes copying , pasting link impossible, function of info url. how rid of blank space? i'm new svg , xslt. here's javascript word wrapping function: function wrapurltext(url){ var char=""; var urlstring = url; var bufferstring =""; var stringlength = urlstring.length; var bufferstringlength=stringlength; var charcaps=""; var charsize=0; var tempstringsize=0; var i=0; var j=0; while (j<5) { charsize=0; tempstringsize=0; bufferstring=""; i=0; while (i<bufferstringlength) { char = urlstring.charat(i); charcaps =...

sql server - Restore database backup with SQL FileTable to same instance -

how can backup , restore database filetable same sql server instance; filestream enabled; different name? whether through gui or write out scripts so, stuck @ same place: restore new, non-existent database fails "cannot obtain exclusive access database". the issue: have filetables in backup , looks trying restore files on existing database's files. this script i'm using restore: restore database [mydatabase_test] disk = n'd:\backup\mydatabase.bak' file = 1, move n'mydatabase' n'd:\data\mydatabase_test.mdf', move n'mydatabase_log' n'e:\data\mydatabase_test_log.ldf', move n'mydatabase_docs' n'd:\data\mydatabase_test_docs', nounload, stats = 5 -- database has filetable called 'documents' setup \\dbserver\mydatabase\documents. -- how specify files should go \\dbserver\mydatabase_test\documents during restore? this breaks if it's same sql instance being run on. guess i'd need ...

sql - Select Top User over a list of Pages -

i have table containing records of users' internet history. table's structure contains user_id , page accessed , , date accessed of page. example: +==========================================+ |user_id | page_accessed | date_accessed | +==========================================+ |johh.doe | google | 1/1/2015 | |johh.doe | google | 1/1/2015 | |suzy.lue | google | 7/11/2015 | |suzy.lue | wikipedia | 4/23/2015 | |babe ruth| stackoverflow | 9/1/2015 | +==========================================+ i trying use sql query uses: rank() on (partition [page accessed] order count(dateacc)) then use pivot() various sites. after selecting records where (num = 1) pivot() , group [rank], i'm ending resulting query similar to: +=================================================+ |rank | google | wikipedia | stackoverflow | +=================================================+ | 1 | john doe| null |...

docusignapi - DocuSign: Getting envelope info -

i've uploaded test file docusign document id response: 08eebff6-0cbc-4831-b317-c73ba3e2f61d when try read with: https://demo.docusign.net/restapi/v2/accounts/<account_id>/envelopes?from_date=2010-01-01 i empty envelope response: { "resultsetsize": "0", "totalsetsize": "0", "nexturi": "", "previousuri": "", "envelopes": [] } when try read with: https://demo.docusign.net/restapi/v2/accounts/<account_id>/envelopes/08eebff6-0cbc-4831-b317-c73ba3e2f61d/documents i proper response: { "envelopeid": "08eebff6-0cbc-4831-b317-c73ba3e2f61d" } for understanding, expect result in first response such envelope id in example above should in envelopes array in first response. correct or doing wrong here? in first step, assume meant created envelope not document. yes? did send envelope or create it? (a draft) if sent en...

bash - CURL inside script is not working as expected for VCD api's -

i trying curl vcloud director api. works fine when tried terminal, fails when tried inside bash script variable substitution. this script not working: token=" valid token" url="vcdurl" auth_header=\"x-vcloud-authorization:${token}\" curl -i -k -h "accept:application/*+xml;version=1.5" -h "${auth_header}" -x $url/api/vdc/7f252c90-eb3b-43c4-a5ef-458e5bf22c0e > test.txt echo `cat text.txt` error :http/1.1 400 bad request connection: close the following works fine: curl -i -k -h "accept:application/*+xml;version=1.5" -h "x-vcloud-authorization: valid token" -x https://vcdurl/api spent couple of days figure out stuck here. token=" valid token" url="https://vcdurl" auth_header=x-vcloud-authorization:${token} curl -i -k -x \ -h "accept:application/*+xml;version=1.5" \ -h "${auth_header}" \ "$url/api/vdc/7f252c90-eb3b-43c4-a5ef-458e5bf22c0e" ...

entity framework - Update stored procedure in Code First DbMigration -

i have solution stored procedures creation in answer https://stackoverflow.com/a/15171900 . i running sql(properties.resources.create_sp_dosomething); in initial dbmigration. my sql scripts have code first drop existing sp , create new updated sp. whene run sql(properties.resources.create_sp_dosomething); in new dbmigration, , logic inside sp changed works fine. the problem arise when want update stored procedure columns (lets isactive ) added model in later commits, , updating without existing db (so new db created). fails invalid column name 'isactive'. any solution other removing existing calls to sql(properties.resources.create_sp_dosomething); and have in newest dbmigration. separate stored procedures model creation doing stored procedure updates in migration seed() method runs after migrations: context.database.executesqlcommand(sp_dosomething); since runs every update-database, need make script idempotent adding existance ch...

SQL Server 2008 Merge Statement Multiple Match Conditions -

i attempting bring in claim data in incremental manner. matching source , target on system ( varchar ) , claimnum ( varchar ), hash of other columns check changes. i have merge statement (simplified): merge target using source on target.system = source.system , target.claimnum = source.claimnum when matched , target.hashvalue <> source.hashvalue {update claim record data} when matched , target.hashvalue = source.hashvalue {update claim record "checked"} when not matched {insert new claim record} however, can't have 2 matched conditions. how else can accomplish merge statement? this being used on sql server 2008. you use case or iif (sql server 2012) add custom logic: merge target using source on target.system = source.system , target.claimnum = source.claimnum when matched update set column_name = case when target.hashvalue = source.hashvalue ... else ... end when not matched ...

javascript - elasticsearch Full Text Search all fields with start and end time -

i have following query runs, not return correct results. results returned not contain word requested in query(none contain word requested). may have "fields" part of query, shouldn't return nothing if nothing matches? { "fields": ["id", "author", "authorid"], "query": { "bool": { "must": [{ "match": { "content": "dog" } }], "filter": [{ "term": { "sourceoriginator": "twitter" } }, { "range": { "estimateddate": { "gte": "2016-07-24t18:14:36.000z", "lte": "2016-07-25t18:14:38.000z" } } }] } } } the correct way use multi_match { "fields...

Port bind exception in spring XD if spring_profiles_active environment variable is added -

i running weird issue while trying run spring xd admin , xd container on single machine. when don't export environment variable spring_profiles_active xd admin , xd container working expected when add environment variable xd-container throwing port bind exception, please find exception stack trace here . i can see xd-container trying run service on 9393, can change port , make run. understand why not facing issue if don't export spring_profiles_active environment variable. please find container servers.yml file here . try following on container environment export spring_profiles_active=prod,container

ios - Changing specific pixels in a UIImage based on RBG values to a different RBG color in swift -

i making application changes colors on map highlight country. code system 1 country have specific color , if condition allows it, color changed yellow , rest green. similar tagging system highlight specific countries based on users input. have seen post on before , modified use parameters detection color. https://codedump.io/share/gesdbwfbgt3t/1/change-color-of-certain-pixels-in-a-uiimage here modified code: func processpixelsinimage(inputimage: uiimage, r: uint8, b: uint8, g: uint8) -> uiimage { let inputcgimage = inputimage.cgimage let colorspace = cgcolorspacecreatedevicergb() let width = cgimagegetwidth(inputcgimage) let height = cgimagegetheight(inputcgimage) let bytesperpixel = 4 let bitspercomponent = 8 let bytesperrow = bytesperpixel * width let bitmapinfo = cgimagealphainfo.premultipliedfirst.rawvalue | cgbitmapinfo.byteorder32little.rawvalue let con...

java - How to access the data source of a RecyclerView adapter's ViewHolder? -

the constructor of recyclerview's adapter looks like: context context; list<connectionitem> connections; public connectionslistadapter(context context, list connections) { this.context = context; this.connections = connections; } after adapter's declarations, declare static viewholder class recyclerview, handles onclicks of buttons: public static class viewholder extends recyclerview.viewholder implements view.onclicklistener { public context context; public imageview connectionimage; public textview connectionname; public imagebutton startmsg; public viewholder(view itemview, list<connectionitem> connections) { super(itemview); ... startmsg.setonclicklistener(this); } @override public void onclick(view v) { intent intent = new intent(v.getcontext(), chatactivity.class); intent.putextra("name", connections.get(getadapterposition()).getname()); // error because ac...

javascript - How to get poloniex push API data with Wampy -

i want correct data when connect poloniex push api use wamp protocal wampy.js implementation http://wamp-proto.org/implementations/ but got last 2 data types right, first 1 keep gives me "seq": {"seq":76722908} ["btc_eth","0.02027380","0.02027377","0.02027355","0.06151162","29539.50716156","1478656.69569076",0,"0.02097800","0.01865820"] ["trollboxmessage",8755461,"reorx2112","made mill alrdy",9] the official example , http://pastebin.com/dmx7mze0 use autobahn node.js module this code below script src="node_modules/wampy/build/wampy-all.min.js> script> <pre> ws = new wampy('wss://api.poloniex.com', {realm: "realm1"}); ws.onopen = function () { // //subscribe currency pair //this data type not correct //while other data looks normal // ws.subscri...

javascript - How can I get TypeScript to build iterables in ES6 to ES5? -

i trying create unique array of user objects in angular 2 writing in typescript. using short , elegant es6 way create unique array: this.users = array.from(new set(this.users)) i error when build typescript es5: argument of type 'set<{}>' not assignable parameter of type 'iterableshim<{}>'. property '" es6-shim iterator "' missing in type 'set<{}>'. i tried setting this.users : iterableshim<t> iterableshim not acceptable type string. docs string, array, typedarray, map , set built-in iterables, because prototype objects of them have symbol.iterator method. (source: https://developer.mozilla.org/en-us/docs/web/javascript/guide/iterators_and_generators ) there way typescript compile es6 recognizes iterables es5 without errors? using lib option as: "lib": [ "dom","es6" ] the following works fine : let users = [] users = array.from(new set(users)) mo...

python - QPX. How many returns per query? -

i'm looking use api google flights gather flight data project hope complete. have 1 question tho. can see way request multiple dates same route in 1 call? or have multiple requests? have seen suggested possible haven't found evidence:) it possible add more 1 flight request, see google developer tutorial qpx. not sure though how many flights fit in 1 request.

java - double inexing an array without int -

Image
i'm importing historical data many stocks on dates java csv files. goal use program in java built trade (buy , sell) of these tickers on dates. program configured work 1 ticker, want expand work thousands (over thousands of dates). i have 2 tables, 1 containing ticker , when buy/sell, , other (pictured below) price , historical information. using two, if, in table 1 have indication ticker x on y date, want able sell ticker x when price decreases by, say, 80% purchase price. in order facilitate kind of decision making, each ticker might trade, have historical data ten years. have tens of millions of rows in table two. i'd able reference each of columns (market cap, p/e ratio, beta...) using ticker , date identifiers. i'd manipulate data in such way (in java) find minimum , maximum of p/e particular ticker on date range. i thought should create "numeric key" each ticker , date combo. each character in ticker, converted ascii, concatenated, , added ...

javascript - TypeError: authService.isAuthenticated is not a function -

i'm trying call isauthenticated method in controller, telling me not function. below snippet of code. the controller (function() { 'use strict'; angular .module('app') .controller('navcontroller', navcontroller); navcontroller.$inject = ['user_roles','auth_events','authservice','$http']; /* @nginject */ function navcontroller(authservice) { var vm = this; vm.name = ''; activate(); //////////////// function activate() { authservice.isauthenticated().then(function(response){ vm.isloggedin=response; }); } }})(); and in app.js (the main module) includes dependencies angular .module('app', ['admin','app.router','app.auth','app.constants','user']) authservice resides in app.auth.js (function() { 'use strict'; angular .module('app.auth',['localstoragemodule','app.c...

apollo - How to create an enum variable using ApolloStack/GraphQL with a special character? -

i'm trying create graphql enum type using apollostack. nothing seems work. reference, please see example code. enum test { abc dog dog/cat } in example above, dog/cat cause server not work. i not sure using '/' possible when declaring enumeration values. try switching name of 'dog/cat' somthing 'animal'

asp.net mvc - MVC configure using Modal bootstrap -

i using bootstrap modal in header - layout page entire site e.g. original code bootstap <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mymodal"> launch login demo modal </button> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-body"> login information </div> </div> </div> </div> the above code work. i modified button code link <a href="#mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="...

php - Closure How to use instead of the class method? -

how write code works in following example without __get , __set .everything else can. class { // code write here? } $a = new a(); $a->setname = function(a $a, $value) { $a->name = $value; }; $a->getname = function(a $a) { return $a->name; }; $a->setname('vasya'); echo $a->getname1(); friends, solved problem class { public function __call($name, $arguments) { try{ if(property_exists($this,$name) && is_callable($this->$name)){ $arguments = array_merge([__class__=>$this],$arguments); return call_user_func_array($this->$name, $arguments); } else{ throw new exception($name.' not callable'); } } catch (exception $e) { echo $e->getmessage(); exit; } } } $a = new a(); $a->setname = function(a $a, $value) { $a->name = $value; }; $...

How does Solr scale function works? -

solr documentation says scale function: scales values of function x such fall between mintarget , maxtarget inclusive. as example says: scale(x,1,2) values between 1 , 2 inclusive. my question is, how? if give function number 78.3 , try scale between 1 , 2, how translates 1 2 format? it go through documents in index (if read source correctly, works complete set of documents , not current result set), find minimum , maxiumum values, scale value in each document when returning between 2 provided numbers. so if have documents 0, 5, 10 , invokes scale(x, 1, 2) , should 1 , 1.5 , 2 back. the actual implementation source: return (vals.floatval(doc) - minsource) * scale + min;

xml - XSLT null Check -

i have incoming xml payload wanted check null element"ns4:payload" complex type can content data or null.i have given below xslt. how can null check complex type element. please let me know. tried without namespace prefic xslt working. how null check element if coming namespace prefix. please let me know incoming xml: <ns4:eventinteractiontrackingrequest xmlns:ns2="http://example.com"> <ns4:basemessage> <uuid>sample</uuid> <exchangetype>test</exchangetype> <headerversion>1</headerversion> <username>test</username> </ns4:basemessage> <ns4:payload/> </ns4:eventinteractiontrackingrequest> xsl code: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:dp="http://www.datapower.com/extensions" xmlns:ns1="http://example.com" xmlns:xsl="http://www.w3.org/1...

php - Issue with strtotime() and setting timezone -

i how use strtotime , first need set timezone, causing issue: $date = new datetime(); $date->settimezone(new datetimezone('america/new_york')); $idate = $date->format('y-m-d h:i:s'); $fdate=strtotime($idate,"+2 hours"); $idate comes out fine, in correct timezone, in format: 2016-07-25 15:56:24 how can add 2 hours onto , return variable in same format? try this: $fdate=date('y-m-d h:i:s',strtotime($idate."+2 hours"));

How can I get the id of a list item at specific index from a list in JQuery? -

i need retrieve id of list item next list item being clicked. example, consider following list. now, when 'item 1' clicked, need retrieve id of 'item 2'. <ul> <li id="id1">item 1</li> <li id="id2">item 2</li> <li id="id3">item 3</li> </ul> all these id's dynamic. able next list item using following code: $li = $('li').get(ui.item.index() + 1); but when try it's id using following code, doesn't work. $nextid = $li.id; or $nextid = $li.attr('id'); i appreciate if can me issue or suggest alternate solution! you can use next() function: update #1 check second evant listener. every time click on button, random number 1 6 generated. use number list element index (minus 1, because index 0 based). upadate #2 updated first function when user clicks last list element, id of first list element alerted, david thomas mentioned. $(...

java - I'm trying to make a DrawerLayout. The issue is it will only work one time, on one activity -

so stole little guide question on here... sliding drawer appear in activities i have setup, , works on first activity put in. this bodyactivity, default, homepage of app. public class bodyactivity extends draweractivity { private static final string tag = "bodyactivity"; private string email = "null"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_body); } [...] } this draweractivity public class draweractivity extends activity implements navigationview.onnavigationitemselectedlistener { private static final string tag = "draweractivity"; protected relativelayout fulllayout; protected framelayout framelayout; private static actionbardrawertoggle toggle = null; private static drawerlayout drawer = null; private static navigationview navigationview = null; @override pub...

java - Eclipse dead code warning, but what is wrong? -

i've written method checks if string in file, eclipse gives dead code warning. here method: private boolean keypresent(string key){ try{ bufferedreader filereader=new bufferedreader(new filereader(keypath)); while(true){ string s=filereader.readline(); if(s.equals(key)){ filereader.close(); return true; }else if(s==null){ filereader.close(); return false; } } }catch(ioexception e){ e.getstacktrace() return false; } } the else if(s==null) part source of warning. why? if can't find matching result(and coming outputs null), return false. think ok. wrong? and 1 more question. better use? string s; while(true){ s="new value"; .... } or while(true){ string s="new value"; ... } i think garbage collectors consume system resources, first 1 better. however, see m...

How are links from TFS Git commit stored -

how/where links commits on git repos hosted in tfs stored? we have instance of commit can see on repo , if @ commit in web ui points work item. if open work item , @ links same commit not appear. further if @ discussion part of history work items in question can see 5 of 6 commits noted. , further complicate issues there additional commit (by different user) not appear in history there link. does know might happening? can believe user might have deleted 1 of links in work item expect see in history other commit. thanks how/where links commits on git repos hosted in tfs stored? in tfs database. when git commit contains reference work item, , auto-linking work items enabled, when commit pushed server, links created. one-time operation. once it's done, links can freely edited within tfs, changes visible using tfs interface (either web ui or api). commit can no longer edited, editing change hash, no synchronisation can done. further if @ discussion part ...

how to write XOR in assembly(ARM) -

i want xor value of 2 register.but compile return error how write xor in assembly(arm) xor r1,r1,r0; compiler gives error, error: bad instruction `xor r1,r1,r0' the instruction called eor not xor 1 expect. no idea why.

node.js - Javascript unicode to ASCII -

need convert unicode of soh value '\u0001' ascii. why not working? var soh = string.fromcharcode(01); returns '\u0001' or when try var soh = '\u0001' returns smiley face. how can unicode become proper soh value(a blank unprintable character) js has no ascii strings, they're intrinsically utf-16. in browser you're out of luck. if you're coding node.js you're lucky! you can use buffer transcode strings octets , manipulate binary data @ will. won't valid string out of buffer once you've messed it. either way you'll have read more here: https://mathiasbynens.be/notes/javascript-encoding or here: https://nodejs.org/api/buffer.html edit: in comment use node.js, excerpt second link above. const buf5 = buffer.from('test'); // creates buffer containing ascii bytes [74, 65, 73, 74]. to create soh character embedded in common ascii string use common escape sequence \x01 so: const bufferwithsoh...

ios - adding a constraint to a subview makes background color not display -

Image
so using custom function format subview adding uicollectionviewcell . brian voong's public project here: https://github.com/purelyswift/facebook_feed_dynamic_cell_content/blob/master/facebookfeed2/viewcontroller.swift . func addconstraintswithformat(format: string, views: uiview...) { var viewsdictionary = [string: uiview]() (index, view) in views.enumerate() { let key = "v\(index)" viewsdictionary[key] = view view.translatesautoresizingmaskintoconstraints = false } addconstraints(nslayoutconstraint.constraintswithvisualformat(format, options: nslayoutformatoptions(), metrics: nil, views: viewsdictionary)) } what interesting, in uicollectionview add subview single cell, , set background color white. background white when comment out line sets background subview, , no background color set when uncomment out line setting visually formatted constraints subview. here 2 lines clobber each other: func chronicleoneclicked(sender: uibut...