Posts

Showing posts from January, 2012

c# - How do I decide the `DigestValue`, `SignatureValue` and `RSAKeyValue` for digital signing of XML -

i working on project need verify xml digitally signed or not. getting hard me try , validate xml key values following <signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <signedinfo> <canonicalizationmethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <reference uri=**some uri value**> <transforms> <transform algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> </transform> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestvalue>**some digest value**</digestvalue> </reference> </signedinfo> <signaturevalue>**some signat...

java - XML Parser : How to avoid null pointer exception -

when given key not exist throws npe . string nodevalue = eelement.getelementsbytagname(key).item(0).gettextcontent(); if (nodevalue == null || nodevalue.isempty()) return null; return nodevalue;` try string nodevalue=null; if(eelement!=null && eelement.getelementsbytagname(key)!=null && eelement.getelementsbytagname(key).item(0)!=null ){ nodevalue = eelement.getelementsbytagname(key).item(0).gettextcontent(); } return nodevalue;

eclipse - Giving input to Java through a batch file -

i developing application in users give input in batch file , batch file input given input eclipse , oy run java program(logic) , give output either through batch file or excel. in eclipse can set arguments using run > run configurations > arguments running jar file directly works simple: java -jar somefile.jar port ip whatever else those arguments passed main() method string[] , if want numbers have convert them. public static void main(string[] args) { system.out.println(args[0]); // port system.out.println(args[1]); // ip system.out.println(args[2]); // whatever system.out.println(args[3]); // else }

c++ - OpenCV stitch images by warping both -

Image
i found lot questions , answers image stitching , warping opencv still not find answer question. i have 2 fisheye cameras calibrated distortion removed in both images. now want stitch rectified images together. pretty follow example mentioned in lot of other stitching questions: image stitching example so keypoint , descriptor detection. find matches , homography matrix can warp 1 of images gives me stretched image result. other image stays untouched. stretching want avoid. found nice solution here: stretch solution . on slide 7 can see both images warped. think reduce stretching of 1 image (in opinion stretching separated example 50:50). if wrong please tell me. the problem have don't know how warp 2 images fit. have calculate 2 homografies? have define reference plane rect() or something? how achieve warping result shown on slide 7? to make clear, not studying @ tu dresden found while doing research. warping 1 of 2 images in coordinate frame of other more...

dart - Autostart chrome app on wake up mainly on chromebook to update its data in background -

i new in dart , want create chrome app should work on chromebook. i need data updated @ particular interval if app in background or chromebook has booted/woke up. is there setting or need kind of programming? if want background page active it's more complicated... first have add in permissions "background" else window background page inactive ( declare permissions ) after need keep background page alive , should @ chrome.alarms api , when alarms fired can call server retrieve information

jsf - PrimeFaces custom text on Menubar -

i using <p:menubar> . i've seen can use 'facet' render custom content, shown in showcase. what want now, put text left first menuitem. <h:form> <p:menubar autodisplay="false"> <f:facet name="options"> <p:outputlabel value="my company"/> </f:facet> <p:menuitem value="home" outcome="index.xhtml" icon="ui-icon-pencil" style="float: right;"/> <p:menuitem value="register" outcome="register.xhtml" icon="ui-icon-pencil" style="float: right;"/> <f:facet name="options"> <p:commandbutton action="login.xhtml" value="login" icon="ui-icon-extlink"/> </f:facet> </p:menubar> </h:form> i hope it's clear mean. in case, outputlabel showing on right side of menubar. i...

oracle equivalent of mysql ifnull (no case, no if) -

i looking quick way do select ifnull(columna, columnb) mytable (i have dozens of columns , don't want write case each of them) you can use standard coalesce keyword, allows pass multiple parameters: select coalesce(columna, columnb, ..., columnz) mytable coalesce keyword documentation

Getting duplicate items when querying a collection with Spring Data Rest -

i'm having duplicate results on collection simple model: entity module , entity page . module has set of pages, , page belongs module. this set spring boot spring data jpa , spring data rest . the full code accessible on github entities here's code entities. setters removed brevity: module.java @entity @table(name = "dt_module") public class module { private long id; private string label; private string displayname; private set<page> pages; @id public long getid() { return id; } public string getlabel() { return label; } public string getdisplayname() { return displayname; } @onetomany(mappedby = "module") public set<page> getpages() { return pages; } public void addpage(page page) { if (pages == null) { pages = new hashset<>(); } pages.add(page); if (page.getmodule() != this) { page.setmodule(this); } } @override public boolean eq...

dictionary - Leaflet polyline not moving on drag/zoom -

Image
i'm using leaflet custom crs.simple projection. if draw polyline @ page load more or less drawn ok (although more accurate in firefox in chrome) if drag map polyline remains in same place of browser window, appears shifted respect of background map. example: initial load after drag map, map moves polyline remains in same place to add polyline i'm converting coordinates crs.simple projection. don't think there problem here every other map marker or text appears correctly ..... //initialize leaflet map map = l.map('map', { maxzoom: mapmaxzoom, minzoom: mapminzoom, zoomcontrol: false, crs: l.crs.simple //simple coordinates system }).setview([0, 0], mapmaxzoom); //set bounds of map current dimension var mapbounds = new l.latlngbounds( map.unproject([0, mapheight], mapmaxzoom), map.unproject([mapwidth, 0], mapmaxzoom) ); //load tiles map.fitbounds(mapbounds); l.tilelayer(mapdata.info.tiles+'/{z}/{x}/{y}.png', { ...

sql - How to get sum of multiple records in a column -

i have query this: select tc.f_exhibition_name, t.f_exhibitor_name, tc.f_creditnoteno, tc.f_description, tc.f_price, tc.f_qty, tc.f_cnqty, tc.f_totalamt t_creditnote tc left join t_exhibitor t on t.f_exhibitor_name = tc.f_exhibitor_name tc.f_creditnoteno='cninv100002' the output looks this ---------------------------------------------------------------------------------------------------------------------------------------------------- f_exhibition_name f_exhibitor_name f_creditnoteno f_description f_price f_qty f_cnqty f_totalamt ---------------------------------------------------------------------------------------------------------------------------------------------------- workspace 2015 aep - associacao empresarial de portugal cninv100002 item1 12 5 8 96 workspace 2015 aep...

symfony - DELETE query not working in DQL doctrine Symfony2 -

i delete row based on id, , used query task: $em = $this->getdoctrine()->getmanager(); $query = $em->createquery('delete buss streetbumbapibundle:bussowner buss buss.id = :bussid') ->setparameter("bussid", $bussid); $list = $query->getresult(); but getting error: { "code": 500, "message": "[semantical error] line 0, col 7 near 'buss streetbumbapibundle:bussowner': error: class 'buss' not defined." } what wrong doing? you solve using querybuilder: $em = $this->getdoctrine()->getmanager(); $qb = $em->createquerybuilder(); $query = $qb->delete('streetbumbapibundle:bussowner', 'buss') ->where('buss.id = :bussid') ->setparameter('bussid', "bussid") ->getquery(); $query->execute(); btw: if replace getquery getdql can see how translates dql (or getsql ) w...

C++ Switch Cases -

Image
i doing quiz online based on c++ switch statement. came across question , have fair understanding of how switch statements work 1 question made absolutely no sense me. can please explain? why answer d , not c? case 2: default case or what? quiz can found at: http://www.cprogramming.com/tutorial/quiz/quiz5.html here's how code behaves. x equal 0 so cout<<"zero"; executed. since there's no break; after it, the second case executed: cout<<"hello world"; and since cout<<"something"; doesn't add newline after printing, they're printed single word.

xcode - Parse.com wich shold I choose between ParseFacebookUtilsV4 and ParseFacebookUtils.framework -

parse says here: https://www.parse.com/docs/ios/guide#users-facebook-users to import: #import <parsefacebookutilsv4/pffacebookutils.h> but few lines above, says import parsefacebookutils.framework in docs, said parsefacebookutils.framework ios only. i tried, can't right import you should import parsefacebookutilsv4.framework this framework compatible new facebook ios sdk / api

ruby - testing Rails json API -

i have rails app serves json, , want test code request , process json via http. what's best way test code without stubbing http request-response? i'm thinking of firing webrick serve rails app, technically inept so. pointer code example appreciated. # lib/bam.rb require 'open-uri' class bam def bam host='localhost' hash = json.parse( open("http://#{host}/bam.json) ) # process hash end end # spec/bam_spec.rb rspec.describe 'bam' before(:all) # fire webrick end after(:all) # shutdown webrick end 'bam' hash = bam.new.bam hash.should eq('bam' => 'bam') end end you can use airborne gem https://github.com/brooklyndev/airborne . can compare json structure.

javascript - Java Script Gets Error in IE11 -

i have 2008 chrysler service manual car. used open ok in xp no matter won't run in ie11. here script of itctoc.js error: if (navigator.appname == "microsoft internet explorer") sessiontabnameie(); else if(navigator.appname == "netscape") sessiontabnamens(); it faults out on line error unable find sessiontabname. sure appreciated. thanks, bob. in ie 11, using json display navigator this: { appcodename: "mozilla", appminorversion: "0", appname: "netscape", appversion: "5.0 (windows nt 6.3; wow64; trident/7.0; .net4.0e; .net4.0c; .net clr 3.5.30729; .net clr 2.0.50727; .net clr 3.0.30729; tablet pc 2.0; rv:11.0) gecko", browserlanguage: "zh-tw", constructor: { }, cookieenabled: true, cpuclass: "x86", geolocation: { }, language: "zh-tw", maxtouchpoints: 0, mimetypes: { }, msmanipulationviewsenabled: true, msmaxtouchpoints: 0,...

java - Read multiple csv file with CsvJdbc -

i need bind group of csv file in format "yyyy-mm-dd hh:mm:ss.csv" present in same folder unique table contains data present in files. i need read data java ee application create connection pool inside application server. found csvjdbc driver allows reading of multiple files single entity. starting point this page in section paragraph: to read several files (for example, daily log files) single table, set database connection property indexedfiles. following example demonstrates how this. the example fine me problem not have header word in filename string. corresponding table becames empty string makes impossible query table. how can tell driver map pattern table hasn't header part? p.s. tried use hsqldb frontend csv files not support multiple files. setup csvjdbc read several files described in http://csvjdbc.sourceforge.net/doc.html , use empty table name in sql query because csv filenames not have header before filetailpattern regular express...

php - How to get Facebook Page info using Guzzle -

i'm sure i'm missing but, currently, don't understand what. i'm playing guzzle, , i'm trying page info: <?php /** * example of usage of apiconnect information * facebook page through graph api. */ require('../vendor/autoload.php'); /** set here page */ $page = 'samplepage'; $remoteurl = 'https://graph.facebook.com/' . $page; $client = new guzzlehttp\client(); $res = $client->get($remoteurl); echo $res->getstatuscode(); // "200" echo $res->getheader('content-type'); // 'application/json; charset=utf8' echo $res->getbody(); // {"type":"user"...' this code guzzle documentation shows. now, i'm expecting calling code, returns objects contains, in 1 of properties, following json response, 1 receive if call url directly in browser: { "error": { "message": "an access token required request resource.", "type...

node.js - NodeJS, is console.error synchronous like console.log? -

i noticed while debugging app, console.error not seem execute synchronous while console.log does. wanted try winston see if had same behavior , indeed did. missing here? shouldn't logging synchronous? ran myself. seems there node.js bug causing this: https://github.com/nodejs/node/issues/7743

Using TeeChart PHP with javascript -

i'm trying use teechart php. use laravel 5.1 framework on ubuntu 15.04 machine. far, i've been able include librairy in laravel. put teechartphpopen folder vendor, added tchart.php in composer.json -> autoload -> files, did run composer dumpautoload . also, did install gd extension sudo apt-get php5-gd , did restart web server (still on artisan). i did tests steema's demos on http://www.steema.com/products/teechart/php/demos/features/index.html . here problems: with example using javascript, laravel flag me error : call undefined method imageexport::getjavascript() i looked imageexport file , don't find trace of getjavascript function. i did try example don't use function (the axes/custom one). now, there's gd error thrown : fatalerrorexception in graphicsgd.php line 1275: call undefined function imageantialias() i can comment imageantialias function lines (1275 , 1301) , example works. now, can trick want use javascript a...

c++ - Buffering Bytes - Node.js Addon -

i want receive wav stream node.js (in add-on). implemented this: readablestream.on('data', function(chunk) { var obj1 = addon.buffering(chunk);//my addon }); but want buffer information, , create copy of original wav. far can't populate new file bytes. void buffering(const functioncallbackinfo<v8::value>& args) { isolate* isolate = isolate::getcurrent(); handlescope scope(isolate); local<object> bufferobj = args[0]->toobject(); char *buf = node::buffer::data(bufferobj); if (i == 0){ fp = fopen("copy.wav", "wb"); i++;} fwrite(buf, 1, sizeof(buf), fp); fflush(fp); if (i == 3){ fclose(fp); } i++; local<string> devolve = string::newfromutf8(isolate, "buffering_success");//c++--->js args.getreturnvalue().set(devolve); } i don't understand why, sizeof(buf) small. think because of that. with precious tip of @mat: nodejs: readablestream.on('data', function(ch...

c# - New DataView vs. DefaultView of a DataTable -

why construct new dataview instead of using defaultview of datatable in c#? what scenarios creating new dataview preferable? what advantages , disadvantages of both? var dataview = new dataview(datatable); vs var dataview = datatable.defaultview; the defaultview has advantage of being there default, name implies. additional dataviews have advantage of allowing keep several of them ready , in use in parallel . so can filter , sort 3 of them in different ways , bind 3 different controls, e.g. three datagridviews or dgv , items of comboboxcell them independently . quoting this post : a dataview view on datatable, bit sql view. allows filter , sort rows - binding windows form control. additionally, dataview can customized present subset of data datatable. capability allows have 2 controls bound same datatable, showing different versions of data.

optimization - Why could a SCIPcopy model be infeasible a when original model is feasible? -

i'm new scip, i'm not sure if bug or if i'm doing wrong. i have mip instance solves using scip, when try solve copy of model scip says infeasible. seems more noticeable when presolve turned off. i'm using windows pre-built scip v3.2.0. model has binary , integer variables. the following code outlines attempt: scip* _scip, subscip; scipcreate(&_scip); scipincludedefaultplugins(_scip); scipcreateprobbasic(_scip, "interval_solver")); // create empty problem scipsetpresolving(_scip, scip_paramsetting_off, true); //disable presolving // build model (snipped) scipsolve(_scip); // succeeds , gives feasible solution scip_bool valid = false; scipcreate(&subscip); scipcopy(_scip, subscip, null, null, "1", true, false, true, &valid); scipsolve(subscip); // infeasible something might related (and seems weird me) after solving original problem (and getting feasible solution), checking solution reports infeasible result. i.e...

d3.js - d3 drag works but appear Uncaught TypeError: a.target.className.indexOf is not a function -

i practice use d3 drag svg circle around. it works except following error appeared in console: "uncaught typeerror: a.target.classname.indexof not function" what wrong code? following code: <!doctype html> <html lang="zh-hant"> <head> <title></title> <meta charset="utf-8"> <script src="http://d3js.org/d3.v3.min.js"></script> </head> <body> <p> <svg width="300" height="200"> <circle cx="100" cy="100" r="5" fill="red" /> <circle cx="50" cy="70" r="5" fill="red" /> </svg> </p> <script> var drag = d3.behavior.drag() .on("drag", function () { d3.select(this).attr("cx", d3.event.x) .attr("cy",d3.event.y); }); d3....

objective c - I need to implement the expandable tableView cell in ios 8 -

Image
in project need implement uitableview of tableview cells expandable , of them independent. if expandable cell need indicate '+' symbol.enter image description here. can 1 please me out i have created small demo, https://github.com/haripalwagh/expandabletableviewcell screenshot 1 : before expanding cell screenshot 2 : after expanding cell @interface viewcontroller () <uitableviewdatasource, uitableviewdelegate> { uitableview *tblview; nsarray *cell0submenuitemsarray; bool issection0cell0expanded; } @end @implementation viewcontroller # pragma mark - view life cycle - (void)viewdidload { [super viewdidload]; tblview = [[uitableview alloc] initwithframe:cgrectzero style:uitableviewstylegrouped]; tblview.backgroundcolor = [uicolor clearcolor]; tblview.delegate = self; tblview.datasource = self; tblview.allowsselection = yes; tblview.scrollenabled = yes; tblview.alwaysbouncevertical = yes; [self.view...

Can spring data couchbase be used to access reduced views -

i know there way access reduced view results using couchbase java sdk. unable use spring-data access reduced view. possible? view: view byidgetdatestats = defaultview.create("byidgetdatestats", "function (doc, meta) {" + "if(doc.doctype == \"com.bd.idm.model.daylog\"){" + " emit(doc.userid, doc.date)" +" }}" ,"_stats" ); when attempt use spring-data access view this: query query = new query(); query.setkey(complexkey.of(userid)).setreduce(true).setgroup(true); viewresult result = repo.findbyidgetdatestats(query); error message java.lang.illegalstateexception: failed execute commandlinerunner ... caused by: java.lang.runtimeexception: failed access view ... caused by: java.util.concurrent.executionexception: operationexception: server: query_parse_error reason: invalid url parameter 'group' or 'group_level...

text - C# Console Application: How do I open a textfile maximized? -

hello! (i'm new stackoverflow) i have question concerning c# console . i want open .txt file in same directory. code (the name of text file readme.txt): string path = system.io.directory.getcurrentdirectory() + @"\readme.txt"; string[] filecontents = system.io.file.readalllines(path); system.diagnostics.process.start(path); the code works fine, want text file opened maximized. how make this? by specifying processstartinfo parameters: string notepadpath = environment.systemdirectory + "\\notepad.exe"; var startinfo = new processstartinfo(notepadpath) { windowstyle = processwindowstyle.maximized, arguments = "readme.txt" }; process.start(startinfo);

sql - Table returning multiple rows for single join match -

i have table called "items" itemnumber | material ------------------------------ 1234 | cast 234a | tool plate and table called "material" material | process -------------------------------- cast | anodize tool plate | blah i doing select on tables join: select process,material.material items inner join material on items.material=material.material items.itemnumber = '1234' and return of anodize |cast tool plate| cast 'cast' has match of 'anodize', returning each combination. i've tried every join type know of , produces same results. doing wrong? other typo item.material (it should items.material ), query works fine, assuming have presented facts correctly data. try out demo here: sql fiddle

is there an alternative way to access or view my databases on the backend of my joomla website? -

i'm newbie here in joomla .. there alternative way(except joomla extension directory , joodatabase not free) access phpmyadmin or view databases without logging in on cpanel provided web hosting company? (sorry bad grammar) check url, http://www.templatemonster.com/help/joomla-3-x-how-to-check-database-details-in-the-admin-panel.html follow above steps , let me know.

c# - How to get a date range from a list of fromdate & todate to compare with another date -

i have collection of dates below, var datelist = new list<dateprev> { new dateprev{ fromdate=new datetime(2014,10,1), todate=new datetime(2015,3,1)}, new dateprev{ fromdate=new datetime(2013,2,1), todate=new datetime(2013,10,1)}, new dateprev{ fromdate=new datetime(2010,2,1), todate=new datetime(2011,10,1)} }; this list serves lookup list. have search data below, var newdate = new dateprev { fromdate = new datetime(2015, 2, 1), todate = new datetime(2017, 5, 1) }; i want search inside datelist collection find out whether supplied newdate can inserted inside datelist proper date range. supplied date list's date earlier todate of first row of datelist, should not allow insert. if understand question correctly, you're looking way check if 2 "date-spans" overlap. i, myself, had such problem, , solution rather easy. given 2 dates defined as: date astart , aend date b bstart , bend you can determine if overlap if: !(aend ...

Error:(4, 32) error: package android.hardware.camera2 does not exist -

while using camera2 android build camera preview tectureview api ,i got error : error:(4, 32) error: package android.hardware.camera2 not exist i target sdk 22 minimum sdk 14. my device os android 4.4 change compilesdkversion 17 minimum 21 (recommended 23) in build.gradle file of opencv module. because android.hardware.camera2 added in api 21.

visual studio - Deploying multiple copies of the same site to Azure easily -

i have cms intend use number of websites on azure. i want able create clones of website , have them deployed azure. azure automation suggested 1 possible solution, service fit need? which azure service should use this? if understand question correctly, want deploy multiple copies of single website through azure. two azure services may fit need. web apps supports scaling clones of website. cheaper cloud services , great choice if don't need complete control on vms run web apps, mobile app backends, api apps, etc. cloud services (specifically web roles) cloud services allow deploy asp.net website payload can scale in/out either set amount of instances want, based on traffic demand, or based on queue of work items have more control on os though.

go - Preflight issue with http POST in golang -

i using mux package , have code: func saveconfig(w http.responsewriter, r *http.request) { if origin := r.header.get("origin"); origin != "" { w.header().set("access-control-allow-origin", origin) fmt.println("origin: " + origin) w.header().set("access-control-allow-methods", "post, get, options, put, delete") w.header().set("access-control-allow-headers", "accept, content-type, content-length, accept-encoding, x-csrf-token, authorization") } // stop here if preflighted options request if r.method == "options" { return } body, err := ioutil.readall(io.limitreader(r.body, 1048576)) if err != nil { fmt.println("error: %s\n", err) w.writeheader(http.statusinternalservererror) return } fmt.println("json body:" + string(body)) if err := r.body.close(); err != nil { ...

android - Need to know when my app send a notification -

i have app, have mainactivity(mr.obvious), service , broadcastreceiver. in mainactivity have alarmmanager this: intent myintent = new intent(mainactivity.this, broadreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(mainactivity.this, 0, myintent,0); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); alarmmanager.setrepeating(alarmmanager.elapsed_realtime_wakeup, calendar.gettimeinmillis(), alarmmanager.interval_half_day, pendingintent); in broadcastreceiver have this: public void onreceive(context context, intent intent) { intent service1 = new intent(context, notifyservice.class); context.startservice(service1); } and in service, have this: public int onstartcommand(intent intent, int flags, int startid) { notificationmanager notificationmanager = (notificationmanager) this.getapplicationcontext().getsystemservice(context.notification_service); intent intent1 = new int...

javascript - Slick Carousel - Container width not working -

i have started using slick carousel plugin website working on , reason, if set wrapper around targeted element slick carousel, width not honoured unless set pixels not option when need width grow size of parent element. i using bootstrap in case helps. html <div class="col-md-6 col-xs-12"> <div class="group-filter"> <span class="title">group filter</span> <div class="group-slick-cell"> <div class="group-slick-wrapper"> <div class="group-slick"> <div><button class="btn btn-groups">group 1</button></div> <div><button class="btn btn-groups">group 2 more text</button></div> <div><button class="btn btn-groups">group 3</button></div> <div><button class="btn btn-groups">...

javascript - How to pass current entity Id to my Silverlight webresource? -

i have silverlight webresource in crm 2015 online, open using javascript webresource. web resource through ribbon button of opportunity entity. need pass current opened opportunity silverlight web resource. i've managed opportunityid still can't pass silverlight web resource. my javascript webresource code: function opensilverlightcontrol() { var id=xrm.page.data.entity.getid(); window.open('https://crm.mycrm.com//webresources/new_/mycrmquotetestpage.html',null,500,600); } edit: i tried using querystring produces internal server error. this link: https://crm.mycrm.com//webresources/new_/mycrmopportunityquotetestpage.html?oppid= {7a594863-1c1f-e511-80c8-02e7484a2b2f} also : https://crm.mycrm.com//webresources/new_/mycrmopportunityquotetestpage.html?oppid=7a594863-1c1f-e511-80c8-02e7484a2b2f both give "500 - internal server error" this done using query string variable function opensilverlightcontrol(){ var id=xrm.page...

merge - Inner Join with conditions in R -

i want inner join condition should give me subtraction of 2 columns. df1 = data.frame(term = c("t1","t2","t3"), sec = c("s1","s2","s3"), value =c(10,30,30)) df2 = data.frame(term = c("t1","t2","t3"), sec = c("s1","s3","s2"), value =c(40,20,10) df1 term sec value t1 s1 10 t2 s2 30 t3 s3 30 df2 term sec value t1 s1 40 t2 s3 20 t3 s2 10 the result want term sec value t1 s1 30 t2 s2 20 t3 s3 10 basically joining 2 tables , column value taking value= abs(df1$value - df2$value) i have struggled not found way conditional merge in base r. if not possible base r, dplyr should able inner_join() not aware of package. so, suggestion base r and/or dplyr appreciated editing i have included original data asked. data here https://jsfiddle.net/6z6smk80/1/ df1 first table , df2 s...

unity3d - unity tap mobile issue -

i have simple scene when player taps, ball changes directions 90 degress; code works not perfect, issue "tap" detecting needed use coroutine make pause between taps, pause of 0.25sec big , response time slow in cases, if try reduce pause time runs code fast no longer differ taps; i've tried touch.phase == began , touch.phase.stationary didn't work i want achieve effect when tap, changes direction once, if hold it. does have better solution of detecting taps? using unityengine; using system.collections; public class playercontroller : monobehaviour { public float speed = 2f; public float tappausetime = .25f; rigidbody rb; bool timeron; bool goingright; void awake(){ rb = getcomponent<rigidbody> (); timeron = false; goingright = false; } // update called once per frame void update () { if (input.touchcount == 1 && !timeron && !goingright) { rb.velocity = vector3.zero; rb.angularvelo...

html - Difficulty customizing Bootstrap navbar for responsiveness -

Image
i wish create navbar below. decided use bootstrap easy create responsive navbar using bootstrap. i put in own custom css background transparent, links white in color etc , menu links lie @ center. you can have here - http://107.167.189.78/codeigniter/index.php/web/ problems come when resize screen. the problems - 1) when mobile,the navbar not visible ( since made transparent ) 2) when mobile - navbar button appears in middle( wish button come on exptreme right) the following code make navbar button appears on extreme right on tablet portrait/mobile display , set background color pink instead of using navbar background image .. @media , (max-width: 768px) { .navbar.mynavbar{ background: #db1d94 none repeat-x scroll 0 0; width: 100%; z-index: 9999; } } this should fix problem tested it. it looks : (on tablet portrait/mobile) note: have rid of white border once show again background ...

magento 1.9.1 - Overriding attributes.phtml file from base into custom theme not working as expected -

i copied attributes.phtml file base custom theme change way attributes table displayed. when make changes keeping in base, works fine. copying custom theme removes entire tab entirely beside description tab. since working fine in base version not in custom theme folders, there particular attributes.phtml need keep in mind before copying custom theme folder ? any appreciated. this case of permissions. check , ensure have correct permissions rest of files.

Multiple associations from single table rails -

Image
in attempt expand on this guide creating multiple associations same table came following user class class user < activerecord::base has_secure_password validates_uniqueness_of :email validates_presence_of :email validates_presence_of :name belongs_to :role has_many :clients, foreign_key: 'rep_id' has_many :submitted_jobs, class_name: 'workorder', through: :clients has_many :processing_tasks, class_name: 'workorder', foreign_key: 'processor_id' def has_role?(role_sym) role.name.underscore.to_sym == role_sym end end my goal able refer submitted jobs , processing tasks separately depending on type of user. far processing tasks part works expected , far can rep workorder, when attempt rep.submitted_jobs following error: nomethoderror: undefined method `to_sym' nil:nilclass /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.1.6/lib/active_record/reflection.rb:100:in `_reflect_...

jquery - Buttons in page are not doing anything -

i new programming , have project fix page. www.recargamex.com the problem is, buttons not doing @ all; looked in index.html file errors debbugger not showing being error. don´t know or can causing buttons not work (i see url changes load thing hashtag (recargamex.com/topup#) still don't thing. if me programming , wish learn more, don't want discouraged this, don't know do! the index.html code here http://pastebin.com/3jnkjzee <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function() { $("#buttonid").click(function() { //code in here// }); }); </script> this should work. defined script in body, after code. put in head section.

How to set a PHP variable? -

i need set variable below on page load: if($_get['country'] == 'uk'){ } i thought $country=uk; would work, not? orginal code checks url as: index.php?country=uk i want perfom same, within page & not have variable string @ end of suffix is trying acheive? <?php if((!isset($_get['country']) or ($_get['country']!='uk'))) header('location:index.php?country=uk'); //your code here

java - Reasoning about reals -

i experimenting openjml in combination z3, , i'm trying reason double or float values: class test { //@ requires b > 0; void a(double b) { } void b() { a(2.4); } } i have found out openjml uses auflia default logic, doesn't support reals . using aufnira . unfortunately, tool unable prove class: → java -jar openjml.jar -esc -prover z3_4_3 -exec ./z3 test.java -nointernalspecs -logic aufnira test.java:8: warning: prover cannot establish assertion (precondition: test.java:3: ) in method b a(2.4); ^ test.java:3: warning: associated declaration: test.java:8: //@ requires b > 0; ^ 2 warnings why this? the smt translation (used input z3 ) appears faulty when doubles involved. in program b below, uses doubles instead of ints, constants either call or pre-condition never translated smt . this fault of openjml , not z3 - since z3 need of form (define-fun _jml__tmp3 () real 2345.0) work (see verbose output of program ...

javascript - jquery draggable / droppable change snap -

i attempting create series of drag/droppable divs. once div1 has been dropped, create new div , have snap @ new position. snap position remains same when div1 has been dropped , div2 being dragged: ( http://jsfiddle.net/klpgukkj/2/ ) var trackid = "path0"; var tracktype = "a"; $('.map-track-box').droppable({ tolerance: 'touch', drop: function(event,ui){ // returns home $('#trackdragger').animate({ top: '30px', left: '20px' },500); } }); $('#'+trackid).droppable({ tolerance: 'touch', drop: function(event,ui){ // in position var pos = $('#'+trackid).position(); $('#trackdragger').animate({ top: pos.top, left: pos.left },500,function() { $('#draggerbox').append("<div class='"+tracktype+"' style='z-index:10;position:absolute;top:"+pos.top+"px;left:"+pos.left+"px...

C# Mapping XML Response into Unknown Class -

i'm trying achieve generic solution sending , receiving xml via means(ip, serial textfiles, etc) all appears work fine until response string. what need cast response sting correct class type (loginresponse, logoffresponse, cardpaymentresponse) etc. i cant generic way cast xml object in efficient manner. heres have got far: sample response strings: xml loginresponse: <?xml version="1.0" encoding="utf-8" standalone="no"?> <serviceresponse requesttype="login" applicationsender="possel01" workstationid="1" requestid="1254" protocolversion="000000001234" devicetype="113" swchecksum="ac3f" communicationprotocol="000000000432" model="011" applicatiosoftwareversion="000000000100" manufacturer_id="023" overallresult="success" xmlns="http://www.nrf-arts.org/ixretail/namespace" xmlns:ifsf="http://www...

ios - initiate Google Signin without the GIDSignInButton but programmatically -

is there way launch google signin programmatically without pressing on gidsigninbutton ? i'm trying wrap signal around hitting google api user must log in. sort of : googlesigninsignal().then(getpersonaldatasignal) you can call method instead: gidsignin.sharedinstance().signin() it worked fine me , seems cleaner approach. i hope can same question.

php - how to view complete excel page with formatting while importing data from MySql -

i have created form looks microsoft excel sheet. user entering data in form , submitting it. data getting inserted database mysql. want retrieve data mysql , show echo database values on page in excel sheet grid view. two ways: first use html tables when fetching data. second make simple input boxes & when click submit, save excel file, in temporary folder, php fetch , sql save in database. can have simple upload function upload excel file browser , display in proper grid view. have made before , can assure possible. if still learning php, first option fastest , easiest way.

ms access - Can't open database 'Options' menu -

i using ms access 2013 , when click on file tab, click on "options", options screen not appear. i want place password on database, cannot until open database in exclusive mode , this, need go options. does have idea how can fix this? open microsoft access start menu. go file. under file, click open. click on computer. navigate , select database want open , don't anything. there should small arrow beside open button. click on , select open exclusive option.

ruby on rails - Difference between :destroy and :delete for :dependent in has_one association -

this question has answer here: difference between destroy , delete 5 answers in rails document active record associations , first 2 values of :dependent has_one are: 4.2.2.4 :dependent controls happens associated object when owner destroyed: :destroy causes associated object destroyed :delete causes associated object deleted directly database (so callbacks not execute) my understanding :destroy example, customer has_one address . :dependent => :destroy , if customer deleted, address deleted automatically database after customer deleted database , use :destroy . what's use of :delete ? both same, said almost, because: dependent: :destroy - calls callbacks (before_destroy, after_destroy) in associated objects, , you're able break transactions (raise error in callback). dependent: :delete - doesn't call callbacks (it re...

video - Automate Open - Save - Close with several files in QuickTime -

i have many video files convert in quicktime. process use convert each file following: 1- open file quicktime app (default app) 2- file-->save (cmd+s) 3- accept save dialog box, preserving default file name same original file (intro) 4- close file (cmd+w) start again next file is there way automate procedure using automator or script? thankyou this not appear possible automator, following applescript should work you: set mtsfolder choose folder tell application "finder" set targets every file in folder mtsfolder name extension = "mts" repeat etarget in targets set movname justthename(etarget) & "mov" tell application "finder" set movdestination (etarget's container text) & movname tell application "quicktime player" open etarget alias delay 2 export front document in movdestination using settings preset "720p" -- can set whatever available in quicktime ...

how to loop through dictionary keys and compare to my Integer in swift -

i have quick question how loop through dictionary key , compare key integer, print out corresponding value if key exists. for example, code for(var j = 0; j <= somedictionary.count; j++) { if ( someinteger == somedictionary.keys[j] ) { somedictioanrysvalue = somedictionary.values[j] println(somedictioanrysvalue) } } is there method in dictionary want already? if understand you're trying correctly, you're looking use subscript - no for loops required. let dict = [1: "a", 3: "b", 5: "c"] let myint = 3 if let value = dict[myint] { print(value) } // prints: b if value doesn't exist key supplied, nil returned , code inside if let won't executed. if you're unfamiliar i'd recommend take @ the swift programming language .