Posts

Showing posts from January, 2014

haskell - Why is there not a funtion `quit = fail ""` for MaybeT? -

looking @ source code of fail in maybet instance of monad : instance (monad m) => monad (maybet m) fail _ = maybet (return nothing) it's clear argument of fail not used. why isn't there cleaner function quit :: maybet m () saves typing fail "" everytime? or missing something? that mzero is maybet 's monadplus instance (except type more general 1 gave: maybet instance, have mzero :: monad m => maybet m a ).

jquery - Switch row on second click -

i have table persons , want sort them manually, without drag , drop. want select person clicking on row, select person clicking on them , 2 should switch positions. i´ve no problem select 1 row, im stucked @ how select second one. think swichting rows possible jquery replacewith. $(document).ready(function(){ var selections = new array(2); $("tr").click(function() { var selected = $(this).attr('id'); //highlight selected row $(this).toggleclass("marked"); }) }); i´ve created fiddle here: http://jsfiddle.net/zlz929xy/3 any or hints great. i made changes, illustrates how without bothering arrays , looping or of that. we'll ever have 1 row marked "marked", there's no need iterate or check classes when removing "marked" class. also, since we're switching entirety of rows, can grab of html instead of splitting separate bits of information track , operate on. $(document).ready(funct

excel - Open various text files and copy columns into master workbook -

i looking write efficient macro save lot of time when working research data. goal create 1 master workbook consolidated data. here situation: i have 40 research subjects have output file titled subject number in format "subject 1_output.txt" (where "1" in example ranges 1 40). within each of these output text files, there ~30 columns of subject-specific data... , column headers same, , in same order, between 40 subject files (ex: column titled "outputdataobject1" in subject 1's file, subject 2's file, etc.). ultimate goal: create 1 master excel file has tab named each column header subject files (ex: outputdataobject1, outputdataobject2, etc.) , within each tab, column each subject data listed within column. therefore, each tab have apples-to-apples data 40 subjects on 1 tab. logic macro: open each subject txt file (subject #1 through subject #40) copy each column subject txt file tab on master workbook same name data object.

image - (UWP) XAML Canvas to stream -

i've been looking way save canvas' (windows.ui.xaml.controls) datacontext image or stream. i'm using drawing on image , want save image drawn lines. maybe i'm doing wrong, please enlighten me! :-) on uwp suggest use inkcanvas. you can store strokes this: var savepicker = new filesavepicker(); savepicker.suggestedstartlocation = windows.storage.pickers.pickerlocationid.pictureslibrary; savepicker.filetypechoices.add("gif embedded isf", new system.collections.generic.list<string> { ".gif" }); storagefile file = await savepicker.picksavefileasync(); if (null != file) { try { using (irandomaccessstream stream = await file.openasync(fileaccessmode.readwrite)) { await myinkcanvas.inkpresenter.strokecontainer.saveasync(stream); } } catch (exception ex) { generateerrormessage(); } } source: https://blogs.windows.com/buildingapps/2015/09/08/going-beyond-keyboard-mouse-and-touch-with-natural-input-10

javascript - Bootstrap Tooltip with angular not working -

i using tooltip boostrap, not make working in angular code, tough angular code like: :{{o.client_name}}, :{{o.client_name}} work in code, it's not working, know why? angular code: <div class="col-md-4" ng-repeat="o in form.users" ng-show="form.users.length"> <div> <p><b>title</b>:{{o.title}}</p> <p><b>client name</b>:{{o.client_name}}</p> <p><b>description</b>:{{o.description}}</p> <p><b>dev tool</b>:{{o.primary_develop}}</p> </div> <div class="base_image_div"> <img ng-src="/images/{{o.thumbnail}}" class="img-responsive base_image" alt="{{o.description}}"> </div> </div> my tooltip code angular: <div class="container"> <a

sql - how to insert multiple row in single query in PostgreSQL -

i have variable holds multiple data, , want insert multiple data postgresql database using single query. the field on table this: stud_tbl(id,fname,lname) and variable holds multiple data; variable = (123,ron,lum),(234,nald,bay),(345,rol,lumz) my query: str = "insert stud_tbl values ('" & variable & "')" when execute query error , can't identify error. to expand on @patrick's comment: variable = "(123,'ron','lum'),(234,'nald','bay'),(345,'rol','lumz')" the query: str = "insert stud_tbl values " & variable though usual warnings ( how can prevent sql injection in php? ) not being best practice apply.

javascript - How to convert millisecond into the correspond time? -

i'm trying convert dynamic value milliseconds this: 1800000 into correspond time, should 30 minutes. code: var time = new date(milliseconds); console.log("time => " , time); var m = time.getminutes(); console.log("m => ", m); time => thu jan 01 1970 08:00:00 gmt+0100 (ora solare europa occidentale) m => 30 this correct if try milliseconds value => 25200000 m return => 0 there's correct way return correspond minutes? date() objects overkill here. it's division: var minutes = milliseconds / (1000 * 60); or, if don't want fractional minutes, var minutes = math.floor(milliseconds / (1000 * 60)); in example, you're turning milliseconds date -- date/time milliseconds ms past 1/1/1970. after hour has passed, getminutes() return 0 again, hours have incremented, etc.

How to use PHP to access MySQL shell? -

currently have shell script within application depending on argument pass it, log either live or development mysql database shell. works fine, no problem there. the issue/challenge having if in case mysql credentials (host / port) change either live or development database manually have edit shell script, updating new arguments. problem is, have done before never want have again. what have php script (mysql.sh.php) when executed, depending on argument passed log either live or development database shell. how differ shell script pull current credentials (and host , port) php configuration class , pass arguments shell command log respective database. below gives illustration of attempting. #!/usr/bin/php <?php include ('common.php'); //pull info php class right here exec("mysql --host={$myhostnotyours} --user={$myusernotyours} -p{$mypassnotyours} {$thedatabase}"); what expect or mysl> however, command hangs , not presented mysql she

security - Secure Gateway: Limit access to Bluemix app -

from bluemix want access application in customers data center using secure gateway service. want give access destination (the customer application) bluemix application only. in secure gateway dashboard under advanced options of gateway or destination definition network option can specify ip address or address range plus port or port range. text says: " set destination private allow access specific ips , ports. " looking for. but: how can use bluemix app? don't know ip address of bluemix app. aware can figure out not static, moment stop , restart app on bluemix, ip address may change. setting of network option have done api call bluemix application itself. possible? if not, why have function @ all? in form ip address can specify hostnames. try provide hostname of bluemix app. in tests did not succeed , had entire connections cut off. cannot recommend trying restrict connections right now. by binding secure gateway app or, better, utilizing user-provi

android - alarm manager fails notifying -

i have simple code setup notify users @ specific time interval. although getdate method returns future time, still triggers right away! intent notificationintent = new intent(act, notificationpublisher.class); notificationintent.putextra(notificationpublisher.notification_id, idtt); notificationintent.putextra(notificationpublisher.notification, notification); pendingintent pendingintent = pendingintent.getbroadcast(act, idtt, notificationintent, pendingintent.flag_update_current); alarmmanager alarmmanager = (alarmmanager) act.getsystemservice(context.alarm_service); date dd = getdate(datett); calendar calendar = calendar.getinstance(); calendar.settimeinmillis(system.currenttimemillis()); calendar.set(calendar.month, dd.getmonth()); calendar.set(calendar.year, dd.getyear()); calendar.set(calendar.day_of_month, dd.getday()); calendar.set(calendar.hour_of_day, dd.gethours()); calendar.set(calendar.minute, dd.getminutes()); alarmmanager.set(alarmmanager.elapsed_realtime_wakeup,

How does Maven decide what version of a plugin to use, when you don't specify any? -

i recognized maven not uses latest version of plugin. for example org.codehaus.mojo:sonar-maven-plugin version 2.7 has beed released on 19th of october on 23th of october, 2.6 still used maven ( mvn sonar:sonar ). i remember plugins, latest version several minor releases above version maven decided use. is there (central) index/list/database maven looks version use? if yes, can accessed manually? as far know, link answer question. automatic plugin version resolution when plugin invoked without explicit version given in pom or on command line, maven 2.x used pick latest version available latest version either release or snapshot. sake of stability, maven 3.x prefers latest release version on latest snapshot version. given threat of non-reproducible builds imposed automatic plugin version resolution, feature scheduled removal far plugin declarations in pom concerned. users of maven 3.x find output warning when missing plugin versions de

python - Django : How to create a form that asks for phone number with a drop down country field? -

i have been learning django week now. i want create contact form asks phone number country code. the form ask phone number in 2 fields: 1. user needs select dropdown fields of country code 2. user enter rest of phone number (see image below) what simple way in django? examples great. mockup of intended form you can make use of following code create required form: class contactform(forms.form): first_name = forms.charfield(max_length=32) last_name = forms.charfield(max_length=32) email = forms.emailfield() country = forms.choicefield( choices=( ('1','usa (+1)'), ('some other country','some other country'), ... ... ) ) phone_number = forms.charfield(max_length=32) now can use form , format per in html , save per data models.

regex - PHP Parse Number From Complicated String -

i looping through array, , have multiple entries returned this. llll-aaaa-dddd.zzzz-124 xxd98sss-61 fff.sss-ddx-74 i need way in php parse out last number after last dash on every iteration, can use on function call. these entries can possibly have other dashes, other numbers, etc... last number have hyphen , number. need complete last number after hyphen. any regex gurus out there able lend hand? it's simple regular expression, hardly requiring guru. preg_match('/-(\d+)$/', $line, $match); $num = $match[1]; \d+ matches sequence of digits, , $ matches end of string. parentheses define capture group, , $match[1] contains contents of group.

c++ - Namespace + functions versus static methods on a class -

let's have, or going write, set of related functions. let's they're math-related. organizationally, should i: write these functions , put them in mymath namespace , refer them via mymath::xyz() create class called mymath , make these methods static , refer mymath::xyz() why choose 1 on other means of organizing software? by default, use namespaced functions. classes build objects, not replace namespaces. in object oriented code scott meyers wrote whole item effective c++ book on topic, "prefer non-member non-friend functions member functions". found online reference principle in article herb sutter: http://www.gotw.ca/gotw/084.htm the important thing know that: in c++ functions in same namespace class belong class' interface (because adl search functions when resolving function calls). namespaced functions, unless declared "friend," have no access class' internals, whereas static methods have. this means, examp

linux - Permission Denied error while ssh into datanode during setup of hadoop 1.2.1 multi-node cluster on centOS -

Image
i learning setup hadoop multi-node cluster on centos , not able ssh datanodes. i have tried copying public key namenode datanodes using root user. when login using user other root , try ssh datanodes gives permission denied error.following copy of etc/host file for cluster setup , working, hadoop needs able establish secure shell connections without passing passphrase. main steps involved in setting password-less access configuration are: step-1) generate public private keys on namenode(s) , jobtracker/resourcemanager ssh-keygen -t dsa -p '' -f ~/.ssh/id_dsa step-2) combine public keys these hosts , combine authorized_keys file. step-3) copy authorized_keys file in ~/.ssh/ on hosts in cluster. scp authorized_keys user@192.168.1.100:~/.ssh/ scp authorized_keys user@192.168.1.101:~/.ssh/ scp authorized_keys user@192.168.1.102:~/.ssh/ . . scp authorized_keys user@192.168.1.xxx:~/.ssh/ here user example user , 192.168.1.100--xxx ips of server

ios9 - iOS Universal link not working -

my server returning content that's supposed in route apple-app-site-association correct teamid + bundleid , path /app/myresource/34 i enabled associated domains , added both staging , production server's domain this: applinks:production.com , applinks:project.staging.com when go http://project.staging.com/app/myresource/34 on simulator's safari, doesn't deep link. did miss something? ps: json contained in http://project.staging.com/apple-app-site-association not ssl signed, read since ios 9 beta 2 don't need sign, have security transport allowing http connections , i'm able retrieve data staging server no ssl. ps2: json, in case: { "applinks": { "apps": [ ], "details": { "my-team-id.my.bundle.id": { "paths": [ "/app/myresource/*" ] } } } } this must format of json: { "

Filling a shape of visio with color in c# -

Image
hi creating shapes of visio2013 using c# .now need fill shape colors using c# tried below codes nothing makes sense :( :( visio.cell cqellname; cqellname = shape.get_cellssrc( (short)visio.vissectionindices.vissectionobject, (short)visio.visrowindices.visrowfill, (short)visio.viscellindices.visfillbkgnd); cqellname.formulau = "rgb(255,0,0)"; above code throws error cell guarded. shape.get_cellssrc((short)visio.vissectionindices.vissectionobject, (short)visio.visrowindices.visrowfill, (short)visio.viscellindices.visfillbkgnd).formulaforceu = "rgb(" + r + "," + g + "," + b + ")"; tried above, doesn't throw exceptions nothing changed in shape. i tried solution from stackoverflow , not working i can able see value assigned me in shapesheet fillforegnd , fillbkgnd , shape not filling color gave . can 1 please tell me how this..?? as

visual studio - C# TopShelf Service runs great with debugging; Incredibly slow without debugging -

edit: still issue program not running slow service, running slow whenever not debugging. running diagnostics withotu debugging produced same slowness. peak cpu usage 3%. being said, why application run slower without debugging incredibly helpful google down answer :) using c# , nuget'd topshelf, have made filewatcher/mover. there instance of filesystemwatcher performs long set of logic against text document (between 100 kb > 8 mb). reads text document (on unc network location) move lines 1 of 2 output files. while run application through visual studios 2015 community in debug mode or release mode, file actions , movement instant can get. satisfied, installed application service on same local machine. turn on service, key trigger, , starts moving text files.... 50 kb every couple seconds. 1 mb file taking few minutes parse through when took whopping 10 seconds when run through visual studios. service logged in me, same user in visual studio. any ideas? have

html - Javascript programming, function not defined error -

here code. sorry improper indentation. <%@ page language="java" contenttype="text/html; charset=euc-kr" pageencoding="euc-kr"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>게시판</title> <script type="text/javascript" src="../js/jquery-1.5.2.min.js"></script> <script type="text/javascript" src="../js/jquery.cookie.js"></script> <script type="text/javascript" src="../js/addscript.js"></script> <script type="text/javascript" src="../js/jquery.popupwindow.js"></script> <script type="text/javascript" src="../js/infobee.common.js"></script> <script type="text/javascript"> var html = '<table width="100%" cellpadding=&qu

java - Method returning wrong value -

i'm creating program receives current date , s tomorrow's date. working fine when tried entering day 30 4th month, instead of taking last day of month , going next month, added 1 more day , returned 31. later found out method sets maximum day each month returning maximum day 0. when try putting code method actionperformed it works fine in method made keeps returning maximum day zero, i've tried using different variables , other things nothing's working. here's code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class tomorrow extends jframe implements actionlistener { jlabel dayl; jlabel monthl; jlabel yearl; jtextfield dayt; jtextfield montht; jtextfield yeart; jbutton enter; public static void main(string[] args) { tomorrow frame=new tomorrow(); frame.setsize(400, 400); frame.setlocation(500, 300); frame.creategui(); frame.setvisible(true); frame.settitle("enter current date"); } void crea

jQuery: Identify a value of declared variable is the same as the value within a list of keys in an array -

i have set of array in json followed: {"status":200,"success":true,"result": [{"id":"0","name":"user1","type":"mf","message":"bonjour user1"}, {"id":"1","name":"user2","type":"ff","message":"hello user2"}, {"id":"2","name":"user3","type":"mm","message":"konnichiwa user3"}, {"id":"3","name":"user4","type":"mf","message":"ni hao user4"}, {"id":"4","name":"user5","type":"ff","message":"high 5! user5"}]} i ask how identify if value of declared variable (eg. "getname" value of "user1") same value within list of "name" keys in arra

Why does this trigger comma-dangle rule in eslint? -

this looks correct me, why eslint show rule violation, missing trailing comma comma-dangle @ end of last property "credentials"? dispatch({ type: login_user, payload: credentials }); .eslintrc { "extends": "airbnb", "globals": { "__dev__": true }, "rules": { "react/jsx-quotes": 0, "jsx-quotes": [2, "prefer-double"] } } based on airbnb config rule setup comma-dangle: [2, "always-multiline"] . acoording this, expected code is dispatch({ type: login_user, payload: credentials, }); it expects , @ end. more info on rule: http://eslint.org/docs/rules/comma-dangle

time - How to change only date in @timestamp using logstash date filter? -

i using date filter. want update date , want keep time is. i using following date filter: date{ timezone => "utc" match => [ "my_timestamp", "dd.mm.yy" ] } but when match date, date matched , time resets zero. there way update date while keeping time is? help me out seems odd thing do, but... grab time @timestamp , date log, merge them add_field, , feed date{}. certainly can time portion ruby{} filter, , might possible copy @timestamp field mutate->add_field , mutate->gsub{} off date.

ios - How to clear notification badge count when reinstall the app -

i have integrated apple push notification ios app. problem when reinstall app, previous notification badge count showing before log in app. how can solve problem? please me. have tried killing app multitasking menu , launching again?, call here - (void)applicationdidbecomeactive:(uiapplication *)application { application.applicationiconbadgenumber = 0; } else it'll cleared on launching app. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [[uiapplication sharedapplication] setapplicationiconbadgenumber:0]; return yes; } choice -2 - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { if (launchoptions != nil) { nsdictionary* dict = [launchoptions objectforkey:uiapplicationlaunchoptionsremotenotificationkey]; if (dict != nil) { nslog(@"launched apns: %@", dictionary); [self

c++ - Understanding why there is an Segmentation Fault -

i have code , try figure out, why i'm getting segmentation fault here: i add speedeffect effectstack , works quite well. if try remove 1 of effects (which on stack) have call effect.removeeffect() . causes segmentation fault. if try call effect.removeeffect() teststack() function, works (and prints expected "speed effect removed" on console) void test::teststack() { story* st = new story; //<-- needed initialization of effect veins::tracimobility* mob = new veins::tracimobility; //<-- needed initialization of effect speedeffect = speedeffect(1.0, st, mob); a.removeeffect(); //<-- 1 works quite (&a)->removeeffect(); //<-- clearly, works effectstack s; s.addeffect(&a); //<-- adds effect effect stack assert(s.geteffects().size() == 1); s.removeeffect(&a); //<-- try remove effect stack } the stack , effect implemented following: class effect { public: effect(story* story, veins:

Jquery Ajax with Leaflet and MarkerCluster Errors out -

i have application loading markers dynamically looping through dataset. for (var = 0; < data.length; i++) { var plateno = data[i].plate_number; var permitno = data[i].permitinfoid; var popup = '<h5>eps</h5>' + 'plate:' + plateno + '<br/>' + ' permit: <a class=\'link\' href=' + url + '>' + permitno + '</a>' + '<p style=\"color:blue\">' + '' + '<a class=\'link\' href=' + url + '>' + 'import' + '</a>' + '<br/>' + '<a class=\'link\' href=' + url + '>' + 'duplicate' + '</a>' + '<br/>' + '<a class=\'link\' href=' + url + '>' + 'removed' + '<

android - Memory Leak when refresh Activity -

i have problem ! for refresh activity use code : intent i=getintent(); finish(); startactivity(i); the problem memory increasing, when run many times opertion, , app crash outofmemory. how can resolve ? solutions? please me this logcat you can try add in manifest android:nohistory="true" for activity

php - Why sending email is not working in codeigniter? -

i sending email using codeigniter version 2.2.1 . giving me error . please tell me why ? here php code . $config = array( 'protocol'=>'smtp', 'smtp_host'=>'ssl://smtp.googlemail.com', 'smtp_port'=>465, 'smtp_user'=>'xxx@gmail.com', 'smtp_pass'=>'xxx' ); $this->load->library('email',$config); $this->email->set_newline("\r\n"); $this->email->from('xxx@gmail.com', "my name"); $this->email->to($to); $this->email->subject($subject); $this->email->message($message); $this->email->send(); return $this->email->print_debugger(); but when send . giving me error . please why ? tried many ways . not working . why ? 220 smtp.gmail.com esmtp ci2sm13227458pbc.66 - gsmtp hello: 250

docusignapi - Changing email body on completion of envelope -

i using templates in docusign , want able send custom email bodies not when creating envelope also completion emails. is there way change body of emails sent docusign both signing , completion emails? yes, there on 35 different email templates/events can customize: https://www.docusign.com/supportdocs/cdse-admin-guide/content/account-admin/branding.htm . however, have 1 opportunity provide dynamic/custom content when generating envelope, emailblurb property. can re-use emailblurb in various email templates.

Error from com.google.android.gms -

i found exception device emulator. coming com.google.android.gms . 1116-31507/com.google.android.gms e/cursorleakdetecter﹕ possiblecursorleak:content://com.google.android.gms.common.stats.net.contentprovider/networkrawreport,querycounter:5 android.database.sqlite.databaseobjectnotclosedexception: application did not close cursor or database object opened here @ android.content.contentresolver.query(contentresolver.java:399) @ android.content.contentresolver.query(contentresolver.java:316) @ com.google.android.gms.common.stats.net.networkreportservice.a(sourcefile:141) @ com.google.android.gms.gcm.am.run(sourcefile:129) either you're calling getreadabledatabase() method twice or make sure close cursor before closing database.

c++ - Should Eigen dense matrix * dense vector multiplication be 7 times slower than GSL? -

the answer this question of mine made me expect (for matrices 1/4 of non-vanishing entries) in eigen product dense matrix * dense vector should outperform sparse matrix*dense vector. not see opposite, both outperformed gsl factor of 7 , 4 respectively. am using eigen incorrectly? timing carelessly? startled. my compile options read: ludi@ludi-m17xr4:~/desktop/tests$ g++ -o eigenfill.x eigenfill.cc -l/usr/local/lib -lgsl -lgslcblas && ./eigenfill.x my code reads: #include <iostream> #include <stdio.h> #include <stdlib.h> #include <eigen/sparse> #include <eigen/dense> #include <gsl/gsl_matrix.h> #include <sys/time.h> #include <gsl/gsl_blas.h> #define helix 100 #define rows helix*helix #define cols rows #define filling rows/4 #define reps 10 using namespace eigen; /*-- declarationes --*/ int fillsparsematrix(sparsematrix<double> & mat); int filldensematrices(matrixxd & mat, gsl_matrix *tes

How to test a Meteor call in a client unit test in Jasmine? -

i'm using meteor 1.2.1 , sanjo:jasmine@0.20.2 . expect test (running on client side) fail, looks it's never executed. describe('compresslistofintegers', function () { it('should return string', function (done) { meteor.call('compresslistofintegers', [1,2,3,4,5,6,7,8,9], function(err, data) { expect(data).toequal(jasmine.any(number)); done(); }); }); }); how can test meteor.call? added bonus: should test meteor methods client? alternatives?

How to get the latest drawn point coordinates in TeeChart for Javascript/HTML5? -

i need know latest drawn point coordinates , draw figures there. saw function calcposvalue somewhere didn't see java script. thanks in advance. in teechart javascript calcposvalue functions called calc . see demo here , , documentation here .

Elasticsearch significant terms on nested objects -

for masterthesis using elasticsearch measure significance of sentences, paragraphs , documents rest of index. i've used 3 different indexes enable fast querying. works fine, want evaluate if possibe same nested objects or parent child relationships. here try set , query significant terms nestd objects: put /test_nested { "settings": { "analysis": { "filter": { "german_stop": { "type": "stop", "stopwords": "_german_" }, "german_keywords": { "type": "keyword_marker", "keywords": [""] }, "german_stemmer": { "type": "stemmer", "language": "light_german" }, "shingle_bigram": { &

c++ - error C2079: 'Toto::a' uses undefined class 'foo' -

this question has answer here: when can use forward declaration? 12 answers i have error c2079 on compiling following code , dont understand why. class foo declared later (forward declaration). class foo; //template <typename datatype> class toto { foo a; //c2079 }; class foo { public: int x; }; and strange in issue, if uncomment "template line" (before class toto declaration), error disapear. use workaround, don't understand happen here. following first feedback got, tried following code : class foo; //template <typename datatype> class toto { foo *a; // solve c2079 void otherfunc() { a->myfunc(); // c2027 } }; class foo { public: int x; void myfunc() { }; }; so replacing "foo a" pointer "foo * a" solve compilation error. adding function it's i

elasticsearch: How to reinitialize a node? -

elasticsearch 1.7.2 on centos we have 3 node cluster has been running fine. networking problem caused "b" node lose network access. (it turns out c node had "minimum_master_nodes" 1, not 2.) so poking along node. we fixed issues on b , c nodes, refuse come , join cluster. on b , c: # curl -xget http://localhost:9200/_cluster/health?pretty=true { "error" : "masternotdiscoveredexception[waited [30s]]", "status" : 503 } the elasticsearch.yml follows (the name on "b" , "c" nodes reflected in node names on systems, also, ip addys on each node reflect other 2 nodes, however, on "c" node, index.number_of_replicas mistakenly set 1.) cluster.name: elasticsearch-prod node.name: "prod-node-3a" node.master: true index.number_of_replicas: 2 discovery.zen.minimum_master_nodes: 2 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["192.168.3.100", &q

ios - Automated Push Notification Testing with XCTest -

i'm attempting automate testing of push notifications using xctest , continuous integration xcode server. as far can tell, have correctly configured push notifications, receive them correctly when app running. issue is, when run test (even on physical device) don't receive notification. have confirmed on both sending device backend push notification has been sent. far know, cannot receive push notifications on ios simulators, running test on actual device, assuming different. obviously can check manually see if information consistent through sending device, backend , receiving device, hoping automate entire process. thanks help. while there no way deal pns on simulator apple-provided instruments, there magic 3-rd party toolset on it: https://github.com/acoomans/simulatorremotenotifications simulatorremotenotifications library send mock remote notifications ios simulator. the library extends uiapplication embedding mini server listen udp packets c

c++ - Compile-time lookup table for enum -

i have list of enums defined follows: enum pinenum { kpininvalid, kpina0, kpina1, kpinb0, kpinb1, kpinc0, kpinc1, } each of these enums needs associated 2 other values, port , pin number. currently, i'm accessing these through run-time functions: gpio_typedef * pingetport(const pinenum pin) { switch (pin) { case kpina0: case kpina1: return gpioa; case kpinb0: case kpinb1: return gpiob; case kpinc0: case kpinc1: return gpioc; default: return null; } } uint16_t pingetpin(const pinenum pin) { switch (pin) { case kpina0: case kpinb0: case kpinc0: return gpio_pin_0; case kpina1: case kpinb1: case kpinc1: return gpio_pin_1; default: return 0; } } in particular, i'm doing because not want large lookup table taking ram @ runtime (code s

c++ - creating and instantiating instances in the heap memory -

what missing here class a{ private : string name; int seatno; public : void setname(string n){ name=n; } void setnumber(int number){ seatno=number; } }; int main( int argc, char ** argv ) { *a1=new a[10](); *a1[0].setname("name1"); return 0; } i'm getting error error: void value not ignored ought be

Relational Algebra Division -

i'm dealing relational algebra division issue. have following 2 relations: | b | c b --|---|-- --- 1 | 2 | 3 2 relation r = 1 | 2 | 6 relation t = 4 | 2 | 2 4 | 5 | 6 now i'm doing following operation: r ÷ t when calculate this, result follows: | c --|-- 1 | 3 r ÷ t = 1 | 6 4 | 2 for me because division @ tuples in r present in combination tuples in t . when use relational algebra calculator, such relax returns | c --|-- r ÷ t = 4 | 2 where did make mistake? in advance help. is there can help? performing division on these schema not understand how operator works. definitions of operator not clear, , operation replaced combination of othe

java - Tokenizing and Indexing many files -

i have read several files , and index each word in files. while indexing have follow format: requirement ==> word , {d1,tf1,d2,tf2,d4,tf4} , someothervalue explanation : 1)word = word in files 2)d1,d2,d4... fileid 3) tf1,tf2,tf4....are number of times word appears in d1,d2,d4 respectievly i created class "token" contains words different files 'string token' , name of file belongs 'string fileid' , frequency in file 'int count'. i can check various words in 1 file , update count. used arraylist so. when same word appears in file how can append fileid , count while indexing. i create a class refcount { string fileid; int count; refcount( fileid ){ this.fileid = fileid; count = 1; } void increment(){ count++; } // more... } and class token should be class token { string word; list<refcount> references; ...

Hide R namespaces for testing purposes -

i'm developing r package can optionally use third-party packages, specified in "suggests" field of description file. functions may optionally use suggested third-party packages check availability via requirenamespace function. these functions behave differently depending on presence or not of suggested packages. while implementing tests theses functions, test case optional packages not present. question is: possible temporarily hide namespace testing purposes, such requirenamespace function returns false when searching it?

php - Updating WooCommerce cart after adding a variable product (AJAX) -

i overriding ajax function add product using woocommerce can send attributes cart (which doesn't work out of box). i followed instructions on update woocommerce cart after adding variable product via ajax - want - doesn't work completely. everything when logged out. when log wordpress php override doesn't work/gets ignored. no errors , no product added cart. tried many different approaches, nothing helps. function ajax_add_to_cart_script() { $vars = array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ); wp_enqueue_script( 'wc-variation-add-to-cart', get_template_directory_uri() . '/js/jquery.add-to-cart.js', array( 'jquery' ), null, true); wp_localize_script( 'wc-variation-add-to-cart', 'wc_variation_add_to_cart', $vars ); } add_action( 'wp_enqueue_scripts', 'ajax_add_to_cart_script' ); add_action( 'wp_ajax_nopriv_woocommerce_add_variation_to_cart', 'so_27270880_add