Posts

Showing posts from September, 2011

forms - How convert PDF to ACROFORM type? -

i use pdftk filling forms. , when enter f:\googledisk\projects\comparepdfs>pdftk new/file.pdf fill_form new/b2bf7150aa9de8b2ef8edd20a5677f7f.fdf output new/temp_b2bf7150aa9de8b2 ef8edd20a5677f7f.pdf returned warning: input pdf not acroform, fields not filled. how fix or convert pdf acroform? i decided it. combine files in acrobat - , create new pdf. new pdf good.

Moving child resource to another parent in REST -

i have rest service. and need have functionality move child resources 1 parent another, example move book 1 author another. my variant is: post /api/books/x/moveto/y but how create such architect restful way? from rest point of view, urls should used locate resources rather expressing operations. express operations, existing http verbs should used. looks " move " operation replacing author of book. and put method seems way go: 4.3.4. put the put method requests state of target resource created or replaced state defined representation enclosed in request message payload. [...] so, can have endpoint following: put /api/books/{bookid}/author and request payload contain representation of new author.

VB6 SCGrid Textbox -

within vb6 form, i'm using scgrid object cells editable means of textbox. i suppose grid control creates textbox object user clicks cell. i need reference textbox. in particular, when user presses [left] or [right] key, need current position of cursor within textbox. can call textbox.selstart. does know how control used when editing cell? i figured out myself: ' declaration needed getting current position of cursor private type point x long y long end type private declare function getcaretpos lib "user32" (byref lppoint point) long ' function returns position of cursor within cell being edited textbox ' value expressed number of characters preceeding position private function getcaretposition() integer ' variables dim position point dim result long dim contents string ' position result = getcaretpos(position) ' convert number of characters ' figured out factor 15 trial , error ' don't

gdb - VxWorks debugging without workbench -

is possible debug vxworks task without workbench gdb or free debugger? looking online reported old command gdb (target vxworks id) not work anymore; after vxworks 5.3 has been introduced wdb protocol looks has never been ported gdb except 1 tentative on vetust version , powerpc platforms (i need debug x86 vxworks 6.9)

c++ - GDI Screenshot, results varying on different computer -

Image
i try take screenshot gdi, use in ffmpeg. screenshot works , ffmpeg handle without problem. but, on computer, image not want can see below. here code use init bitmap : //-- mimagebuffer = new unsigned char[mwxhxs]; memset(mimagebuffer, 0, mwxhxs); //-- hscreendc = getdc(0); hmemorydc = createcompatibledc(hscreendc); //-- bi.bmiheader.bisize = sizeof(bitmapinfoheader); bi.bmiheader.bibitcount = 24; bi.bmiheader.biwidth = mwidth; bi.bmiheader.biheight = mheight; bi.bmiheader.bicompression = bi_rgb; bi.bmiheader.biplanes = 1; bi.bmiheader.biclrused = 24; bi.bmiheader.biclrimportant = 256; hbitmap = createdibsection(hmemorydc, &bi, dib_rgb_colors, &mimagebuffer, 0, 0); selectobject(hmemorydc, hbitmap); and here each screenshot : if(bitblt( hmemorydc, 0, 0, mwidth, mheight, hscreendc, mpx, mpy, srccopy | captureblt )) i not have error running application ugly image , on computer. don't know difference causing on these compute

javascript - MeteorJS : How do I check the data fetching from mongoDB on console client? -

we have deploy meteorjs code on ubuntu server. haven't created client access meteorjs service. first wanted verify service running properly. can 1 suggest steps check deployment correct. we install meteor on ubuntu : curl https://install.meteor.com/ | sh monogodb - install nodejs application - working! copy code meteor code server using winscp set mongodb path code : export mongo_url=mongodb://ip:27017/userdb run command start app: sudo nohup meteor --port 3001 --production & thanks.

ios - Unit Code testing of internal functions -

i newbie on testing , stumbling testing internal functionality on code parts. how test privateparseandcheck and/or privatefurtherprocessing functionality different input, dont want public functions? -(bool) publicfunction() { //some stuff network nserror* error; nsdata* data = load(&error); //now got data , parse , check bool result = privateparseandcheck(data, error, ...); if( result ) { privatefurtherprocessing(); } return result; } is re-writing code solution? interested in experiences tips/solutions on xcode server. if there straightforward way test want public methods, so. if not, have choice: can expose method test code. this common practice, not recommend this. inhibits other option… or, expose method completely. if makes feel uncomfortable, there class trying out. extract class (the methods want test , whatever else makes sense go them.) can test class. this helpful when coming different conditions (such different errors) dif

How to click on row element by text instead of xpath using selenium 2 robotframework -

<div class="datatables_scroll"> <div class="datatables_scrollhead ui-state-default" style="overflow: hidden; position: relative; border: 0px none; width: 100%;"> <div class="datatables_scrollbody" style="position: relative; overflow: auto; width: 100%;"> <table id="datatables_table_4" class="datatable no-footer" role="grid" aria-describedby="datatables_table_4_info" style="width: 100%;"> <thead> <tbody> <tr class="odd" role="row"> <tr class="even" role="row"> <td class="center-col multirowselect sorting_1"> <td>group4</td> <td class=" center-col">enterprise open</td> <td class=" center-col">0

Integration test with DBUnit IO Exception Java -

i write integration test on springframework controller have issues data base. not undertand why dbunit can not locate schema.sql file. tried use absolute path did not work too. controllertest @runwith(springjunit4classrunner.class) @contextconfiguration @testexecutionlisteners({ dependencyinjectiontestexecutionlistener.class, dirtiescontexttestexecutionlistener.class, transactionaltestexecutionlistener.class, dbunittestexecutionlistener.class }) @databasesetup(value = "login.xml") public class logincontrollertest { private mockmvc mockmvc; private static final string jdbc_driver = org.h2.driver.class.getname(); private static final string jdbc_url = "jdbc:h2:mem:test;db_close_delay=-1"; private static final string schema_path = "schema.sql"; private static final string user = "sa"; private static final string password = ""; @beforeclass public static void createschema() throws exception

swift - Use Delegate or Notifications? In delegate example label is nil -

i found lot delegates vs notifications. don't understand difference yet. in project have class working in background , update ui. have used notifications that. now created example: when click in firstviewcontroller (fvc) on button1, delegate function starts. when click in fvc on button2, jump fvc secondviewcontroller (svc). can click button1 many times , someday click second button. but label in svc nil. fvc: protocol test { func somefunction(somestring: string) } class firstviewcontroller: uiviewcontroller { var secviewdel: secondviewcontroller = secondviewcontroller() //... @ibaction func clickme(sender: anyobject) { secviewdel.mydelegate = self secviewdel.somefunction("sendastring") } override func viewdidload() { super.viewdidload() //do stuff } } svc: class secondviewcontroller: uiviewcontroller,test { var mydelegate:firstviewcontroller? = nil func somefunction(somestring: string) { print("\(somestring)") //

sql server 2008 - Can SQL query lost due to hard disk crash be recovered? -

i have ran sql query joining many base tables in various steps #tables , final output (which separate table). hard disk crashed. have run query 4 days back. ran local system sql management studio connecting server. i'm having base tables , output table tables in sql have lost query have used arrive @ final table due hard drive crash. can query ran local system sql management studio 4 days recovered logs or other means? 1 of last few queries tried in database in server. select execquery.last_execution_time [date time], execsql.text [script] sys.dm_exec_query_stats execquery cross apply sys.dm_exec_sql_text(execquery.sql_handle) execsql order execquery.last_execution_time desc or in 1 of these locations depending on os. c:\windows\system32\sql server management studio\backup files\solution1 c:\users\yourusername\documents\sql server management studio\backup files

Arraylist<String> to javascript array in jsp -

i having arraylist<string> reportnames sending request.setattribute("reportnames", reportnames); how assign arraylist values javascript array on jsp. var myreports = [<%reportnames%>]; you bellow using jsp c:foreach , javascript push() . sample code: var myreports = []; <c:foreach var="reportname" items="${reportnames}"> myreports.push(${reportname}); </c:foreach>

Matlab slider when Min=Max=Value=1 -

Image
i use slider browse through collection size changes dynamically , can 1. but if i: set(mysld, 'min', 1, 'max', 1, 'value', 1, 'sliderstep', [1 1]) the slider this, so-called thumb half long "trough": which not okay, because if click on left side of slider, value set zero, i.e. out of range, , slider disappears. am using wrong property settings? (of course, set(mysld, 'enable', 'off') whenever min=max=1, feels hack). you can use listener check value against min and/or max: figure; % create uicontrol sl = uicontrol ( 'style', 'slider', 'min', 1, 'max', 1, 'value', 1, 'sliderstep', [1 1]); % create listener check value reset appropriately addlistener ( sl, 'value', 'postset', @(obj,event)set ( sl, 'value', max(sl.min, min(sl.value,sl.max))) );

java - Spring boot doesn't process commit in junit when testing hibernate repository -

hi trying build junit test case @before setup after processing junit class, found no data changed in database , no exception throws well. funny thing can call controller , can save , delete calling service http client. below code, please help. lot. @springapplicationconfiguration(classes = mockservletcontext.class) @webappconfiguration public class userrepositorytest extends abstractbestfirsttest { private mockmvc mvc; @autowired private userrepositoryi userrepo; private void userrepositorytestpreparer() { user user = new user(); user.setemail("markii@gmail.com"); user.setname("tony stark"); userrepo.deleteall(); userrepo.save(user); } @beforetransaction public void setupdata() { userrepositorytestpreparer(); } @before public void setup() { mvc = mockmvcbuilders.standalonesetup(new samplecontroller()).build(); } @after public void teardown() {

vba - Search for messages with a loop -

the end result select start position , end position , keep in between these conditions , delete rest. i.e. messages peter in extract. start: peter@hello.co.za end: end message. there 12 different messages same start , end in pool of 3000 messages. the program keep first out of 12 messages start , condition above, need 12. sub findanddeleteeverythingelse() dim strfind1 string, strfind2 string dim rngdoc word.range, rngfind1 word.range dim rngfind2 word.range dim bfound boolean strfind1 = "you" strfind2 = "directly." set rngdoc = activedocument.content set rngfind1 = rngdoc.duplicate set rngfind2 = rngdoc.duplicate rngfind1.find .text = strfind1 bfound = .execute end if bfound rngfind2.find .text = strfind2 bfound = .execute end if bfound rngdoc.end = rngfind1.start rngdoc.delete rngdoc.start = rngfind2.end rngdoc.end = activedocument.content.end rngdoc.

sql server - Counting records in a subquery -

i have table records holding patrols of guards in sql server 2008r2. whenever duty starts new alert number created , within alert number there patrols starting time. per 12 hours can bill flat rate when @ least 1 patrol has been performed. when under same alert number 12 hour range exceeded, further flat rate has billed. the calculation of 12 hours starts time of first patrol. i tried temp table not solve far. declare @t1 table ( alertno int, starttime smalldatetime, endtime smalldatetime ) insert @t1 (alertno, starttime, endtime) select alertno, starttimepatrol, dateadd(hour, 12, starttimepatrol) tblallpatrols patrolno = 1 select alertno, ( select count(*) [tblallpatrols] inner join @t1 b on b.alertno = a.alertno a.starttimepatrol between b.starttime , b.endtime ) patrols [vwalledatensaetze] group alertno i know not end of story, cannot count numbers of patrols cannot find way solve

Firefox sdk - access popup opened -

i'm working on firefox addon, , wondering if there way access pop-up, in other words window open using javascript function .open(). if access tabs popups not there, if access windows popups windows not there. // var allwindows = window_utils.windows(null); // var tabs = require('sdk/tabs'); (let tab of tabs) console.log(tab.title); if know popup's url can use pagemod detect when loads, url, etc.

javascript - Change clicked element (and all similar) to active / unactive -

i had problem formulation of topic. sorry if duplicate question. i have on dozen containers 2 childs. <div class="some"> <img id="1" class="pointer unactive" /> <img id="2" class="pointer active" /> </div> <div class="some"> <img id="3" class="pointer unactive" /> <img id="4" class="pointer active" /> </div> <div class="some"> <img id="5" class="pointer unactive" /> <img id="6" class="pointer active" /> </div> for example: when click img#3 want change other child ( #1, #3, #5 ) active , clicked element , similes ( #2, #4, #6 ) unactive . let have class tells odd , even : <div class="some"> <img id="1" class="pointer odd unactive" /> <img id="2" class="pointer ac

Using Meteor to create SVG in template works, but not in #each loop -

update: of february 2014, meteor supports reactive svg, no workaround necessary. meteor 0.5.9 i create group of shapes, 1 each document in collection. can create shapes 1 @ time in template, not inside of {{#each loop}}. this works: <template name="map"> <svg viewbox="0 0 500 600" version="1.1"> <rect x="0" y="0" width="100" height="100" fill={{color}}/> </svg> </template> template.map.color = function() { return "green"; }; this not: <template name="map"> <svg viewbox="0 0 500 600" version="1.1"> {{#each colors}} <rect x="0" y="0" width="100" height="100" fill={{color}}/> {{/each}} </svg> </template> template.map.colors = function() { return [{color: "red"}, {color: "blue"}]; } anything try create inside of

Android App using Google Maps -

i developing android app using google maps the problem facing right : google map performance not good. there techniques optimize same? is there way download offline maps application, user can use app if internet connection not available? please can me how resolve problems? as far know android maps not allow caching, cannot used them offline in app. can try openstreetmaps, theese allow offline usage.

python 2.7 - Generating combinations in a list but only in ascending order -

i got list, a=['z','g','b','h'] now when do, for p in itertools.permutations(a,2):print p i get, ('z', 'g') ('z', 'b') ('z', 'h') ('g', 'z') ('g', 'b') ('g', 'h') ('b', 'z') ('b', 'g') ('b', 'h') ('h', 'z') ('h', 'g') ('h', 'b') i need these combinations, ('z', 'g') ('z', 'b') ('z', 'h') ('g', 'b') ('g', 'h') ('b', 'h') and not need following. in reverse order, ('g', 'z') ('b', 'z') ('b', 'g') ('h', 'z') ('h', 'g') ('h', 'b') can please help? thanks late found myself :-) just use combinations instead of permutations. for p in itertools.combi

c++ - Run in R system ('g++ ...') got error 217 -

i trying compile .cpp file created else in r on windows computer running following code: system("g++ c:\\users\\uos\\documents\\r\\win-library\\3.2\\timeshift\\data\\dtw.cpp -o c:\\users\\uos\\documents\\r\\win-library\\3.2\\timeshift\\data\\dtw") and error code 217 i have tried following solutions: use system2 instead of system use setwd(c:\\users\\uos\\documents\\r\\win-library\\3.2\\timeshift\\data) system2('g++ dtw.cpp -o dtw') and both give me error 217 i have checked path dtw , correct installing rcpp package. had on dtw.cpp file , seems ok. not know else do.

.net 4.5 - What is an appropriate strategy for refreshing claims in a passive scenario? -

i have .net 4.5 claims-aware application hosted in windows azure. there web role hosts mvc site , worker role runs jobs in background. users can choose remain permanently logged in. here code claimsauthenticationmanager: public claimsprincipal login(string username, bool rememberme = false) { claimsprincipal principal = authenticate(null, principalfactory.createformsprincipal(username)); setsessioncookie(principal, rememberme ? timespan.maxvalue : timespan.fromdays(1)); return principal; } public override claimsprincipal authenticate(string resourcename, claimsprincipal incomingprincipal) { if (!incomingprincipal.identity.isauthenticated) { return base.authenticate(resourcename, incomingprincipal); } return principalfactory.create(incomingprincipal.identity.name, incomingprincipal.identity.authenticationtype); } private static void setsessioncookie(claimsprincipal principal, timespan lifetime) { var sessionsecuritytoken = new session

wordpress - Contact Form 7 - press button to validate fieldset -

i've used contact form 7 (wordpress plugin) create single form multiple fieldsets. the fieldsets split (using jquery) this: http://thecodeplayer.com/walkthrough/jquery-multi-step-form-with-progress-bar what want validate fields in fieldset (without submitting form) - there way 1) validate fields using validation in contact form 7 manually? 2) specify fields validate (based on in fieldset)? ideally want able flexibility in mind creating 2 or 3 other forms perform same way. edit: validate mean check field is: a) filled in, if it's required field b) valid data (so making sure email address etc). my problem want validate fields manually, without submitting form, can stop them progressing on next step of form filling if they've not completed current fieldset of fields correctly. carl what want validate ? if want validate email address. should write input type = email in email textbox. html validate textbox itself, should in email format. same dig

javascript - Write data into JS file and download it in ZIP file format -

in jsp, have button named "download zip file". when click button, want fetch data database , write js file , keep inside folder , download folder in zip format. using struts2. how can this? one way serve binary data servlet. this: byte[] zipfilebytes = ...;// generate zip file , bytes response.setcontenttype("application/octet-stream"); response.getoutputstream().write(zipfilebytes ); then use standard anchor element download file: <a src="url servlet">download file</a> you might need play little bit match exact use case.

django - DRF: listview get works, detailview returns empty response -

please bear me. i'm doing silly don't know what. i'm adapting/following tutorial django rest framework . i'm using serialization part of tutorial return users (list , detail views). my listview (list users) works perfectly. my detailview doesn't. can see serializer instance being populated user detail view, serializer.data empty. no error returned, empty reply {}. what doing wrong? this works: @csrf_exempt def parentlist(request): """ list parents or create new parent """ if request.method == 'get': theseparents = platformuser.objects.all() serializer = parentserializer(theseparents, many=true) return basejsonresponse(serializer.data) snippet serializer: class parentserializer(serializers.modelserializer): class meta: model = platformuser fields = ('pk', 'email', 'first_name', 'last_name', 'phone', 'hom

function - Java Array List and object passing -

i have list of string in code. passing list of string function , modifying it.( adding/deleting few elements list).but dont want these changes reflected in caller function. changes should reflected in callee function. because objects passed reference, think changes getting reflected in both functions. how can avoid this. please help you can use clone method. caller(arraylist<string> a) { callee((list<string>)a.clone()); } callee(list<string> acloned) { }

javascript - Custom option values depending on the screen size -

the below being used in page. <script id="score" type="text/template"> <select name="scoreselector"> <option value="" disabled selected>your score</option> <option value="0.25">quarter</option> <option value="0.50">half</option> <option value="0.75">three quarter</option> </select> </script> how can set value of each option depending on screen width? example var width = $(window).width(); if (width <= 1023) { //set <option value="0.25">quarter</option> } else { //set <option value="0.35">quarter</option> } you may : var width = $(window).width(); if (width <= 1023) { $('select[name=scoreselector]').val('0.25'); } else { // etc. }

java - Accessing JSF session scoped bean from servlet which is called by applet embedded in JSF webapp -

i need access session scoped bean servlet. tried userbean userbean = (userbean) request.getsession().getattribute("userbean"); as described in post . null result, altough instance of userbean alreay instatiated. annotations/imports use userbean : import javax.faces.bean.managedbean; import javax.faces.bean.sessionscoped; @managedbean @sessionscoped public class userbean implements serializable{ ... } some background why can't rid of servlet : have file upload applet in jsf page. applet expects adress can send it's post request. (i can't edit post request add more fields or something). post method of servlet stores file. job can't done managed bean because servlet has annotated @multipartconfig , can't add annotation jsf managed bean. if returns null , can mean 2 things: jsf hasn't created bean beforehand yet. the applet-servlet interaction doesn't use same http session webapp. given way how described functional require

javascript - Using PHP to retrieve a PDF (with JSON) -

i'm using js , php collect rows of information mysql db. working fine until i'm adding code pdf-blob in same return. var docs; getmini = function() { showminiloading(); var req = new xmlhttprequest(); req.onload = function() { console.log("got it!"); var temp = json.parse(this.responsetext); docs = temp; hideminiloading(); printallmini(); }; req.open("get", "resources/php/newmini.php", true); req.send(); console.log("sent!"); } showpdf = function(id) { (var = 0; < docs.length; i++) { var object = docs[i]; if (object.id == id) { console.log("found it! :d " + i); console.log("content: " + object.pdf); // more stuff here document.getelementbyid("pdf").innerhtml = '<object "data:application/pdf,' + object.pdf + '" type="application/pdf" width="100%" height="1

javascript - Getting child input from div jquery -

i have repeater has usercontrol inside shows me 3 security questions this: <asp:repeater runat="server" id="rptsecurityquestions"> <itemtemplate> <it:textboxcontrol_v2 id="txtquestion" runat="server" showlabel="true" minlength="1" maxlength="64" label='<%# databinder.eval (container.dataitem, "question") %>' regexexpression="" textmode="singleline" cssclass="field field-padding-r metro col-centered securityquestions" isrequired="true" /> </itemtemplate> </asp:repeater> and displays 3 times: <div class="securityquestions"> <span>question 1</span> <input></input> </div> all want inputs child of div. i tried didn

java - Transfer object parameters between controllers -

i have 2 methods inside controller: @controller @requestmapping("/feed") public class feedbackcontroller extends baseaccountcontroller { @requestmapping("/reply") public modelandview replymsg(feedback temp,modelmap modelmap,httpservletrequest request,httpservletresponse response) { ................ feedback fb = new feedback(); fb.setproductid(temp.getproductid()); view.setviewname("redirect:/feed/list.do"); view.addobject("feedback",fb); return view; } @requestmapping("/list") public string list(feedback feedback, modelmap map, httpservletrequest request) { ...... integer productid = feedback.getproductid();//check if feedback object transferred return "/feedback/list"; // .jsp or .ftl file. } } feedback simple java bean.i want transfer object replymsg() list(). but result is: yes,the functioin forwarded list(), feedback.ge

node.js - How should I handle javascript-files in express.js? -

i use express.js create front-end application. want run javascript can't find way handle in docs. there solutions out there merge, compress, gzip , include javascripts? in middleman rubyonrails can include files: //= require vendor/_slideout18 //= require vendor/_flickity //= require vendor/_sprint //= require fastclick //= require reqwest //= require js.cookie //= require utils/utils //= require modules/state //= require modules/navigation_button using koala-app, can prepend js-files other js-files: // @koala-prepend "modules/alts.js" // @koala-prepend "modules/expandable.js" // @koala-prepend "modules/otherquestions.js" is there similar in node? prefer if didn't require external application, grunt. maybe try express static middleware , express compress middleware var express = require('express'); var app = express(); app.use(express.compress()); app.use(express.static(__dirname + '/public')); here 1 sam

javascript - Open selectbox option using jquery -

i want show selectbox option using jquery when page loads. have used .simulate() , .trigger function it's not working, can please suggest solution that. code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="simulate.js"></script> <script> $(document).ready(function(){ $("#test").simulate('mousedown'); // not working $("#test").trigger('click'); // not working //$("#test").attr('size',3); // size not need. want display option dropdown shows. }); </script> <select id="test"> <option value="0">select option</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> please me out problem... try this... $(document).ready(

html - Absolute positioned element on a scrollable parent -

i'm trying have child element (something toolbar) of parent element positiond on bottom edge. bahavior should same using position fixed browser view. i'm using absolute position right now. everyting perfect until parent needs scroll content. toolbar moves along rest of parent's content. could explain me why toolbar moves? possible achieve task without need javascript? * { box-sizing: border-box; } .container { position: relative; width: 100px; height: 150px; overflow-y: auto; border: 1px solid black; } .mock { height: 200px; background-color: red; } .tool-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 40px; background-color: blue; } <div class="container"> <div class="mock"></div> <div class="tool-bar"></div> </div> the toolbar inside scrollable area, that's why scrolled. try code: html <di

c# - How do I find specific matches using regex and put them in a string array? -

i have html file i'm trying extract data from. regex i'm using is "<tr.+?>.+?<td class=\"table_row_col2\"><b>(.+?)&.+?</b>.+?<td class=\"table_row_col5\">(.+?)</td>.+?<td class=\"table_row_col6\">(.+?)</td>.+?</tr>" it works in python not in c#. here's sample data: <tr class="table_row" style="background-color: #d3d3d3;"> <td class="table_row_col1">271</td> <td class="table_row_col2"><b>16/09/2015&nbsp;05:28&nbsp;pm</b></font></small></sup></td> <td class="table_row_col3"><span style="color:#e30613">14.3</span></td> <td class="table_row_col4">-</td> <td class="table_row_col5">8</td> <td class="table_row_col6">-</td> <td cla

angularjs - Angular 2 Observables and Change detection - How to get one component to retrieve a value, set by another component in a service? -

i think i'm overlooking fundamental, , i've been banging head couple of days now. i'm new angular , reactive programming. so, have 1 service , 2 components. in versionservice.ts have helper method allows components set currentversion in _datastore . private _datastore: { currentversion: }; currversionstream$: subject<version>; constructor(public http: http) { this.currversionstream$ = new behaviorsubject<version>(null); this._datastore = { currentversion: null }; } public setcurrentversion(v: version): void { if (v != null) { this._datastore.currentversion = v; this.currversionstream$.next(this._datastore.currentversion); } } then in component select-version.component.ts , through (click) event view/template, use setcurrentversion helper method versionservice.ts store cliked on version. in select.version.template.html : <ul class="dropdown-menu" aria-labelledby="dr

mongodb - Not able to write the query in mongo for array element match? -

i working on project on had make recommendation system users in website.i new mongodb. want retrieve names/id of users have "frnds.type"=1 in below code. { "_id" : objectid("56a9fcc15b4e12369150d6ef"), "name" : "udit", "venue" : { "state" : "rajasthan", "city" : "jaipur", "ll" : [ "26.9000", "75.8000" ] }, "lsv" : [ 0.14, 0.18, 0.24, 0.17, 0.05, 0.17, 0.05 ], "username" : "udit", "frnds" : [ { "id" : "amit", "type" : 1 }, { "id" : "nakul", "type" : 0 }, { "id" : "verma", "type" : 1 } ] } i have written 1 query giving wrong results db.users.find({"username":"udit"},{&quo

node.js - Difference between node and nodejs -

i know confusing. but node --version v5.2.0 and nodejs --version v0.10.25 gives different versions? difference between them? you installed node not-clean installation, , instead of upgrading node version on computer, you've added different version , kept old one. installing 32bit/64bit versions might explain well. if want in order, go add/remove programs, remove node versions, make sure nothing left in program files / program files (x86) , install clean installation.

c++ - Finding if point is inside geometry -

i writing code requires finding if point inside specific geometry. geometry may n sided polygon (not convex) in 2 dimensions or stl geometry in 3 dimensions. can write search code using algorithms available. looking software library can serve such purposes. can part of bigger library. suggestion towards such libraries or codes freely available do. thank you. how wykobi wykobi extremly efficient, robust , simple use c++ 2d/3d oriented computational geometry library.

javascript - Socket.io Chat application Shows EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() -

i using socket.io , node.js plus mysql private chat application , when use socket.on('example', function(data){...}); throws such error code here. node) warning: possible eventemitter memory leak detected. 11 listeners added. use emitter.setmaxlisteners() increase limit. trace @ poolconnection.eventemitter.addlistener (events.js:175:15) @ io.on.eventconnection (/applications/mamp/htdocs/mysite/node/server.js:72:15) @ ping.onoperationcomplete [as _callback] (/applications/mamp/htdocs/mysite/node/node_modules/mysql/lib/pool.js:99:5) @ ping.sequence.end (/applications/mamp/htdocs/mysite/node/node_modules/mysql/lib/protocol/sequences/sequence.js:96:24) @ ping.sequence.okpacket (/applications/mamp/htdocs/mysite/node/node_modules/mysql/lib/protocol/sequences/sequence.js:105:8) @ protocol._parsepacket (/applications/mamp/htdocs/mysite/node/node_modules/mysql/lib/protocol/protocol.js:280:23) @ parser.write (/applications/mamp/htdocs/mysite/node/nod

javascript - Checkbox not getting clicked on clicking label -

the set have pretty straight forward , know what's causing issue me. here fiddle of work: https://jsfiddle.net/ppw9b34u/ its collection of labels within form. when click on 1 of labels, corresponding input gets checked. however, if click @ little faster rate. there high possibility end changing colors of few labels without checking input box. what observe if click drag little on label. colors red , not checks checkbox. have no idea such scenarios. please help i attaching code below html: <div class="diag_options clearfix"> <form action="#" class="diag_options_form pap_answer"> <p> <input type="checkbox" data-value="6" id="test6"> <label for="test6">cardio vascular disease</label> </p> <p> <input type="checkbox" data-value=&q

java - RxJava error handling -

i have method creates , merges 2 observable<t> 's. private observable<string> getdata() { observable<string> observable1 = observable.just("just string") .delay(2, timeunit.seconds); observable<string> observable2 = observable.create(new observable.onsubscribe<string>() { @override public void call(subscriber<? super string> subscriber) { subscriber.onerror(new exception("oops!")); } }); observable<string> merged = observable1.mergewith(observable2); return merged; } the problem error in observable2 emitted earlier data in observable1 . getdata().subscribe(new observer<string>() { @override public void oncompleted() { log.d("rx", "oncompleted"); } @override public void onerror(throwable e) { log.d("rx", &

javascript - wNumb change specific value (add postfix to specific value)? -

i trying make slider 0-2000, 2000 displays "2000+", encapsulating >=2000. my encoder looks this: encoder: function(a) { == 2000 ? = + '+' : null; return a; } however, returns false when a=2000 . take because a needs integer, not string. how can conditionally add postfix, then? just came across issue , solved using wnumb's edit option. not perfect because checks after formatting job. format: wnumb({ prefix: '$', decimals: 0, thousand: ',', edit: function( value ) { return (value == '$2,000') ? '$2,000+' : value; } })

gruntjs - NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack -

i'm trying summarize knowledge popular javascript package managers, bundlers, , task runners. please correct me if i'm wrong: npm & bower package managers. download dependencies , don't know how build projects on own. know call webpack / gulp / grunt after fetching dependencies. bower npm , builds flattened dependencies trees (unlike npm recursively). meaning npm fetches dependencies each dependency (may fetch same few times), while bower expects manually include sub-dependencies. bower , npm used front-end , back-end respectively (since each megabyte might matter on front-end). grunt , gulp task runners automate can automated (i.e. compile css/sass, optimize images, make bundle , minify/transpile it). grunt vs. gulp (is maven vs. gradle or configuration vs. code). grunt based on configuring separate independent tasks, each task opens/handles/closes file. gulp requires less amount of code , based on node streams, allows build pipe chains (w/o re