Posts

Showing posts from March, 2010

javascript - Mixing Index Array with "Associative Array" -

since need access items sometime index , sometime code. idea mix integer index string index? note code, index, amount of items never changes after data loaded. i'm thinking of doing this, same object pushed , set hashtable. function datainformation(code, datavalue) { this.code = code; this.datavalue = datavalue; } var datalist = []; function filldatalist() { addnewdata(new datainformation("c1", 111)); addnewdata(new datainformation("c2", 222)); addnewdata(new datainformation("c3", 333)); } function addnewdata(newdata) { datalist.push(newdata); datalist[newdata.code] = newdata; } then able access object either: datalist[0].datavalue datalist["c1"].datavalue before used loop find item. function finditembycode(code) { (var = 0; < datalist.length; i++) { if (datalist[i].code == code) { return datalist[i]; } } return null; } finditembycode("c1")

java - Can outclass specify inner class with InnerClassNameOuter directly rather than ClassName.InnerClassName -

in inner classes of thinking in java, if want make object of inner class anywhere except within non-static method of outer class, must specify type of object outerclassname.innerclassname, seen in main(). but find use innerclassname directly still works in main. public class parcel2 { class contents { private int = 42; public int value() { return i; } } class destination { private string label; destination(string whereto){ label = whereto; } string readlabel(){ return label; } } public destination to(string s){ return new destination(s); } public static void main(string[] args){ parcel2 q = new parcel2(); /* destionation d = q.to("borneo"); still works.*/ parcel2.destination d = q.to("borneo"); } }

c++11 - How to write the Bayesian network in to files like Hugin format or BNIF? -

any api c++11? writing piece of code generates bayesian network wanted write standard file format hugin, bnif. i tried couldn't documentation well. for shares same query. have found link answers it. further, found implementation well.

Connecting to a GPS Deamon service in c# -

i working on application need location through gpsd service . using c# library (same project), not supported gpsd itself, don't have library. that's why trying create own library (and make nuget package of it). but got stuck following problem. connection gpsd service through sockets, , following data: {"class":"version","release":"3.11","rev":"3.11-3","proto_major":3,"proto_minor":9} so connection working, don't know how gps data itself, there not documentation so, does have experience this, or know how can achieve this? using (var client = connectviahttpproxy(serveraddress, port, proxyaddress, port)) { while (client.connected) { var result = new byte[256]; client.client.receive(result); //_response = encoding.utf8.getstring(result, 0, result.length); _response = encoding.ascii.getstring(result, 0, result.length); var resultclass = j

python - tkinter populate treeview using threading pool -

i'm looking "best" way populate treeview using threads. have multiple mail account i'm checking new emails. my plan use queue store accounts checked using check_mail method. method return list of new mails. can use queue populate new mails , somehow loop while threads alive? is there thread-safe, pattern solve this? your question broad, answer be. generally speaking, tkinter doesn't play multi-threading. can it, must make sure main thread interacts gui. common way use universal widget method after() schedule handling of data going out or being retrieved background threads, typically via queue s, @ regular intervals.

angular - Uncaught TypeError: this.jsonp.request is not a function in Angular2 -

i getting following error. uncaught typeerror: this.jsonp.request not function in angular2. can please me fix that. my code this: requestservice.ts import {component} '@angular/core'; import {jsonp_providers, jsonp,requestmethod, requestoptions, urlsearchparams,jsonp_bindings, baserequestoptions} '@angular/http'; import {injectable} '@angular/core'; import 'rxjs/add/operator/map'; @injectable() @component({ providers: [jsonp_providers] }) export class requestservice { constructor(public jsonp?:jsonp) { this.jsonp = jsonp; } getvalues = (url) => { let _urlparams = new urlsearchparams(); _urlparams.set('contenttype', 'application/jsonp; charset=utf-8'); _urlparams.set('datatype', 'jsonp'); _urlparams.set('timeout', '5000'); this.jsonp.request(url + "&callback=jsonp_callback", { // getting error here contenttype: "application/jsonp;

tcp ip - If IP is connectionless protocol then why does virtual packet switching is connection oriented? -

we ip connection less protocol network layer provides switching facility wherein have packet switching under which, have virtual packet switching connection oriented i.e resources reserved on way. why ip connection less every packet travels in ip datagram? well think network layer has many other protocols might use virtual ckt concept. ip uses datagram service, connectionless. because in datagram service packets go independently without reservation of resources.

android - Why does interval operator in RxJava change the results from flatMap -

i running code: private void concatenatedsets() { observable<string> concatenatedsets = observable.just("1/5/8", "1/9/11/58/16/", "9/15/56/49/21"); concatenatedsets.flatmap(s -> observable.from(s.split("/"))) .map(s -> integer.valueof(s)) .interval(200, timeunit.milliseconds) .subscribeon(schedulers.computation()) .observeon(androidschedulers.mainthread()) .subscribe(new subscriber<long>() { @override public void oncompleted() { } @override public void onerror(throwable e) { } @override public void onnext(long along) { tvcounter.settext(string.valueof(along)); } }); } the expected output be 1 5 8 1 9 11 58 16 9 15 56 49 21 however, endless session of counting 1

Configuring external elasticsearch server with IBM MobileFirst Analytics -

by default, mobilefirst analytics comes in-built elasticsearch. know if there way, can use elastic search cluster configured on different host , point mobilefirst analytics (instead of using out-of-box one) i found article in knowledge center add stand-alone elasticsearch node , couldn't see set host details of external elasticsearch. please advice.thank you. if want mobilefirst platform analytics join cluster machine in different host name need indicate eleasticsearch instance is. can specify jndi property <jndientry jndiname="analytics/discovery.zen.ping.unicast.hosts" value="['yourotherhost:port','otherhost:otherport']" /> operational analytics properties , configurations: https://www.ibm.com/support/knowledgecenter/sshs8r_7.1.0/com.ibm.worklight.monitor.doc/monitor/c_op_analytics_properties.html for more info on es network configurations: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-netw

css - How compatible is float:none? -

i little confused compatibility , useage of float:none;. basicaly using float:left in general stylesheet , want create exception using media query. in query want 'undo' float left. my first thought use 'float:none;' seem find little documentation on how should used , if it's compatible browsers. i checked 'caniuse.com' , gave me 2 different answers same question... when search ' float ' says it's barely supported. , when search ' float:none; ' says it's supported. should using float:none cause and/or there better way 'undo' float? float: none; should fine "undo" floating environment. alternative, can set clear: both; on element, ends floating environment. or in case: clear: left; in general, float (with properties) widely supported browsers. make sure looked @ css property when checking "caniuse": css 2.1 properties (well-supported subset): float (none | left | right)

How to create entries with image element in the RSS Feed using the java ROME API? -

i trying create rss feeds using java rome api. requirement every entry should contain image given below: <?xml version="1.0" encoding="utf-8"?> <rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <channel> <title>sample rss build results</title> <link>http://time.is</link> <description>sample rss build</description> <item> <title>ist feed</title> <link>http://mysampleurl1.com</link> <description>the build successful!</description> <pubdate>mon, 08 aug 2016 10:28:32 gmt</pubdate> <image>http://myimageurl1.com</image> <dc:date>2016-08-08t10:28:32z</dc:date> </item> <item> <title>iind feed</title> <link>http://mysampleurl2.com</link> <des

php - Class 'MongoId' not found in Laradock application -

using laradock (basically set og docker images laravel development), keep getting class 'mongoid' not found fatalthrowableerror errors when calling new \mongoid( $id ) in php. this post class 'mongoid' not found (zend framework mongodb doctrine) suggests reason given error php mongo extension isn't enabled. however, if @ phpinfo() output, can see mongodb section. doesn't mean it's enabled? what else possibly cause error? i assume using php 7 version. in php 7 version new mongodb extension used. so instead of legacy mongoid should use mongodb\bson\objectid

Android styles.xml v14 is not applicable to Android N? -

i have strage issue on beta-build of android n. have styles.xml in values-v14 folder, , reasons not applicable android n. v22 , v23 ok. have no more styles after android v14, nothing should shadow it. maybe had same issue ? simple fix, can not understand reason of it.

c# - Selenium: Drag and Drop from file system to webdriver? -

i have test web-application contains drag , drop area uploading files local file system. test environment based on c#. for automation testing have used selenium, not possible drag files file system. upload area div tag (no input tag). what's best way it? autoit (is possible drop in web browser)? sikuli? it's possible selenium alone, it's not simple. requires inject new input element in page receive file through sendkeys . then, script needs simulate drop sending dragenter , dragover , drop events targeted area. iwebelement droparea = driver.findelement(by.id("droparea")); dropfile(droparea, @"c:\...\image.png"); static void dropfile(iwebelement target, string filepath, int offsetx = 0, int offsety = 0) { if(!file.exists(filepath)) throw new filenotfoundexception(filepath); iwebdriver driver = ((remotewebelement)target).wrappeddriver; ijavascriptexecutor jse = (ijavascriptexecutor)driver; webdriverwait wait

html - Boolearn logic in Python CGI script -

does know how set html check box true or false python. using python file parse xml file list. list want check checkbox if text in xml tag 1 or want remain unchecked if the text in xml tag 0. thsi being done cgi file, don't ask why. is. can't use frameworks device small amount of memory. the list have parses xml file list, part works. <label class="checkbox inline control-label"><input name="l10" value="l10" checked="checked" type="checkbox" <span> l10 &nbsp;&nbsp;&nbsp;</span></label> <label class="checkbox inline control-label"><input name="l05" value="1" type="checkbox" checked/> <span> l5 &nbsp;&nbsp;&nbsp;</span></label> can like: if config_settings.settings[11] == '1': true or put logic html form like: <label class="checkbox inline control-label">

Python multiprocessing pool : How to check if a specific worker has finished -

i want log times multiprocessing.pool workers take individually , i'm creating processes follows p = multiprocessing.pool(processes=4,initializer=initializer,initargs=(arg1,) in initializer function , can log time when each worker starts. i'm looking similar hook/function called when worker finishes, there this?

segment tree - SegmentTree: what are the advantages of using [l, r) (open interval on the right) in the implementation? -

i have seen segmenttree implementation uses [l, r) represent interval, while others use [l, r]. so question: why want use [left, right)? seems adds complexity in code understand if there no obvious advantages? thanks answers in advance!

css - Twitter Embedded Timeline Background Colour -

using following twitter embed method ( https://dev.twitter.com/web/embedded-timelines ) using grid layout, there way control background colour? the issue in context: http://bitly.com/2afuuhj the style love update within class "gridlayouttextonlytweet" inside iframe. you can do: .gridlayouttextonlytweet { background: red; } it shouldn't matter it's in iframe. may need add !important override default styles, try without first.

javascript - Bootstrap tooltip shown instant at second mouseover -

i have html-element has title title ="this tooltip" , class class="tooltips" . in script.js following code (just demonstration of problem): var timeout; $('.tooltips').mouseenter(function(){ var = $(this); if(timeout){ cleartimeout(timeout); } timeout = settimeout(function(){ that.tooltip('show'); settimeout(function(){ that.tooltip('hide'); }, 1000); }, 1000); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> <br /> <br /> <a href="#" title="i tooltip" class="tooltips">hover me</a> what should do: if enter element pointer,

reactjs - What are the conditional operators we can use in react js under render method? -

i want perform logic using switch or or if loop .but cannot use of in render method.right using ternary operator.is there other operators can access in render method? use inline function. demo: https://jsfiddle.net/viviancpy/7v9th3lj/1/ <div id="container"> <!-- element's contents replaced component. --> </div> var hello = react.createclass({ render: function() { return ( <div> {(() => { switch (this.props.name) { case "world": return (<div>oh hello world</div>); default: return (<div>good morning</div>); } })()} </div> ); } }); reactdom.render( <hello name="world" />, document.getelementbyid('container') );

assert - Record Espresso Testcases in Android studio 2.2 -

i using android studio 2.2 , try record espresso test. unable add asserts toast messages, edittext error message or snackbar message. getting below exception snackbar text android.support.test.espresso.nomatchingviewexception: no views in hierarchy found matching: (with id: com.example.root.myapplication:id/snackbar_text , text: "enter email" , child @ position 0 in parent child @ position 2 in parent instance of android.view.viewgroup , displayed on screen user) any appreciated. thanks view hierarchy:

ios - Xcode 7 : Autolayout to UICollectionViewCell that are generated programmatically -

Image
i've collectionview generates 9 collectionview cell @ run-time (set programmatically). there 1 collectionview cell in storyboard. i've question how set constraint cell such appears shown in screenshot. since layout showing there 3 cells per row. need divide collection view width 3 plus space separators. 1 way attached collection view left right top bottom autolayout. , use dummy cell label center. need work programmatically on delegate. - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath { cgfloat screenwidth = collectionviewframe.size.width; float cellwidth = screenwidth / 3.0 - 20; //replace divisor column count requirement. make sure have in float. cgsize size = cgsizemake(cellwidth, cellwidth); return size; }

sql server - SQL add filter only if a variable is not null -

hi have query follows: select route_id [route_id] route_master(nolock) route_ou = 2 , route_query = @l_s_query , lang_id = 1 here, " , route_query = @l_s_query" condition in clause should added when @l_s_query non empty. donot want write if else condition @l_s_query. there way handle in clause directly.thanks. you can translate requirement : select route_id [route_id] route_master(nolock) route_ou = 2 , (@l_s_query null or route_query = @l_s_query) , lang_id = 1 option (recompile) the option (recompile) optional can give better execution plans @ expense of compilation time discussed in canonical article on topic dynamic search conditions in t‑sql or coalesce() avoid or : where route_ou = 2 , coalesce(@l_s_query,route_query) = route_query , lang_id = 1 note: @jarlh said, if route_query nullable, may cause issues becuase of null comparison, may want use first query. another option of 2 separate queries

.net - Read particular depth XML ELEMENTS using XmlReader in C# -

i have xml file nodes @ different depths. need code read specific depth nodes not all, , using xmlreader in c#. can me in this? below xml structure. want read "depth2" nodes. <depth0> <depth1> <depth2/> <depth2/> <depth2/> </depth1> <depth1> <depth2/> <depth2/> <depth2/> </depth1> <depth1> <depth2/> <depth2/> <depth2/> </depth1> </depth0> code: using (var reader = xmlreader.create("d:\\xyz.xml")) { while (reader.read()) { if (reader.depth == 4 && reader.nodetype == xmlnodetype.element) { xmlreader chnode = reader.readsubtree(); additems(chnode); } else reader.movetoelement(); } } you can use descendants function: var result = xdocument.load("data.xml&q

i want so send email from localhost in WAMP server using PHP -

this question has answer here: configure wamp server send email 7 answers i have tried send email localhost in wamp server shows me error: mail(): failed connect mailserver @ "localhost" port 25, verify "smtp" , "smtp_port" setting in php.ini or use ini_set() i have edited php.ini file like: [mail function] ; win32 only. ; http://php.net/smtp smtp = localhost ; http://php.net/smtp-port smtp_port = 25 my php file code : $to = '$rowemail["email"]'; $subject = 'testing sendmail.exe'; $message = 'hi, received email using sendmail!'; $headers = 'from: [memarez@gmail.com' . "\r\n" . 'mime-version: 1.0' . "\r\n" . 'content-type: text/html; charset=utf-8'; if(mail($to, $subject, $message, $headers)) echo

Google Cloud SQL : Change to second generation possible? -

i have working system using google app engine including cloud sql database instance of first generation. possible switch database instance second generation? thanks! on top of previous answer, can facilitate export/import functions available default transfer data. note lot of work required code if transfer second generation.

jmeter - What is the difference between Random Controller and Random order controller? -

please, of you, clear doubt simple example above question? random order controller plays samplers children in random order random controller plays 1 of children samples picking randomly reference documentation here: https://jmeter.apache.org/usermanual/component_reference.html#random_controller https://jmeter.apache.org/usermanual/component_reference.html#random_order_controller

javascript - Receive notifications 24/7 via service-worker.js in Chrome -

i've been doing push notifications, when register page test via curl commands, received notification! however after while (maybe 1-2 minutes), when close tab push notifications scope has been registered, test notifications again, cant receive notifications. happens more in google chrome in mobiles. the workaround did in here need go page of scoped page first, when test notification again, works. though cant have because need clients receive notifications without being on site time. here push event in service worker self.addeventlistener('push', function(event) { var some_api_endpoint = "https://somewhre.com/push_notification_api/service_worker_endpoint"; event.waituntil( fetch(some_api_endpoint, { method: 'post', headers: { "content-type": "application/x-www-form-urlencoded; charset=utf-8" }, body: 'subscript

append on click id from button jquery -

hello friends trying id of button on click whith jquery , append in bottom of href try .append don´t i have <button class="btn1" id="5" type="button">click me</button> <button class="btn1" id="3" type="button">click me</button> <a href="www.example.com/{id]" class="dellink">delete</a> this works need id of botton $("btn1").click(function(){ $(".delllink").attr("href", "http://www.example.com/"); }); you way, if want keep url element. $("button.btn1").click(function() { var url = $("a.dellink").attr("href"); url = url.substr(0, url.lastindexof("/") + 1) + $(this).attr("id"); $("a.dellink").attr("href", url); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquer

Gulp write file if none exist -

how can make gulp write file if there no existing file. the bellow solution works gulp 4.0 in alpha. // when gulp 4.0 releases .pipe(gulp.dest(conf.plugscss.dist, {overwrite: false})) there no exact equivalent in gulp 3.x, can use gulp-changed achieve same thing. gulp-changed used write files have changed since last time written destination folder. can provide custom haschanged function. in case can write function nothing check if file exists using fs.stat() : var gulp = require('gulp'); var changed = require('gulp-changed'); var fs = require('fs'); function compareexistence(stream, cb, sourcefile, targetpath) { fs.stat(targetpath, function(err, stats) { if (err) { stream.push(sourcefile); } cb(); }); } gulp.task('default', function() { return gulp.src(/*...*/) .pipe(changed(conf.plugscss.dist, {haschanged: compareexistence})) .pipe(gulp.dest(conf.plugscss.dist)); });

javascript - Word wrapping is not working -

this created div. , give white-space: normal function word wrapping when type contents. function working in chrome,opera , safari browser. words not wrapping in mozilla firefox , edge browser. , tried word-wrap: break-word function. not working. please give me solution. <div class = "list-name-field" id = "save_list" style = "white-space: normal; width: 240px; min-height: 35px; border-radius: 3px; margin-left: auto; margin-right: auto; background-color: #ccc; margin-top: 5px; " contenteditable = "true" data-placeholder = "add list..."></div> you need add word-break: break-all if need break long word <div class = "list-name-field" id = "save_list" style = "white-space: normal;word-break: break-all; width: 240px; min-height: 35px; border-radius: 3px; margin-left: auto; margin-right: auto; background-color: #ccc; margin-top: 5px; " contenteditable = "true&

javascript - Get the Windows User Language Settings Value -

is there way know client machines language settings? list separator (delimiter) selected. because, in project website (developed using php, javascript, jquery) client can export reports in csv format. @ present creating csv " comma " delimiter. of our clients , when open csv datas showing in 1 column comma separated. i understood because default list separator selected in os control panel configuration may different delimiter comma. however, don't want tell every client change os configuration.. is there other solution this? if generate xls file instead of csv same issue come in future right??? try function function getuserlanguage() { $langs = array(); if (isset($_server['http_accept_language'])) { // break string pieces (languages , q factors) preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_server['http_accept_language'], $lang_parse); if (count($lang_parse[1])) { // create list â??enâ??

java - While saving data to mysql from my android app it removes spaces -

suppose have field in full_name. between firstname , lastname there should space. when enter -- tom cruise ,,, gives error ,, shows . takes tomcruise nicely. here code. dont have trim function. why can not save white spaces. activity_main.xml <textview android:text="full name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> mainactivity.java giving cruicial part. private edittext edittextname; edittextname = (edittext) findviewbyid(r.id.edittextname); string name = edittextname.gettext().tostring(); string urlsuffix = "?name="+name+"&username="+username+"&password="+password+"&email="+email; i sending php site , save it. works fine if remove space between words. just replace space character "%20". name = name.replace(" ","%20");

How can I hide special attributes in excel Slicer from a dimension in excel? -

i have dimension 5 member. dont want show members have information in fact in excel slicer dimension. need hide attributs. how? finally find solution. can add new boolean attribute in dimension , make true or false. add new excel slicer in sheet , connect pivot (table/chart) , select true value. this cause cube unprocessed. rich solution. slicer filtered based on boolean slicer

ruby - How to return the value of the variable in the condition? -

code must return value of variable if value equal 42. have 2 idea. variant choose? # variant if foo == 42 return foo end # variant b if foo == 42 return 42 end if foo==42 foo end this do.

javascript - Pass csv file content from angular js to node js and parse in node js to insert in mongo db -

i have readcsv.js retrieving csv file contents angular js app.get('/index.html', function(req, res) { res.sendfile(__dirname + '/index.html'); }); app.post('/add_event', function(req, res, next) { console.log("node js file1 :" +req); var finaldata = req.body.test;//value undefined console.log("node js file : " + finaldata);//value undefined index.html var myapp = angular.module('myapp', []); myapp.controller('mainctrl', function ($scope,$http) { $scope.showcontent = function($filecontent){ $scope.content = $filecontent; var test= $filecontent; alert(test); }; $scope.submit = function(test){ // $http.post('/add_event', $filecontent) .success(function(){ console.log( "here" +$filecontent); }); } <body ng-controller="mainctrl"> <form ng-submit="submit()"> <div class="test"> <div cla

android - Getting a callback error -

Image
when try run app particular activity:- package com.justforyou.bestnarutosongs; import android.content.context; import android.media.audiomanager; import android.media.mediaplayer; import android.os.bundle; import android.os.handler; import android.support.v7.app.appcompatactivity; import android.view.view; import android.view.windowmanager; import android.widget.adapterview; import android.widget.imagebutton; import android.widget.imageview; import android.widget.listview; import android.widget.seekbar; import android.widget.textview; import java.util.arraylist; public class songslistactivity extends appcompatactivity //implements view.onclicklistener { public imagebutton p_and_p = (imagebutton) findviewbyid(r.id.p_and_p); public imagebutton stop = (imagebutton) findviewbyid(r.id.imagebutton5); public textview named = (textview) findviewbyid(r.id.textview3); public textview rated = (textview) findviewbyid(r.id.textview4); public seekbar seek_bar = (seekbar) findviewbyid(r.id

xaml - Style inheritance - how to refine a custom default style? -

in winrt / uwp app (the problem occurs on both platforms), can define style applies instances of control, omitting x:key attribute, e.g.: <style targettype="button"> <setter property="width" value="400"/> </style> now, i'd apply properties buttons in addition default style : <style targettype="button" x:key="tallbuttonstyle" basedon="..."> <setter property="height" value="100"/> </style> the problem is: fill in basedon attribute, style inherits default style defined above? in wpf, following: <style targettype="button" x:key="..." basedon="{staticresource {x:type button}}"> however, x:type not available on winrt / uwp. this answer suggests, need assign x:key default style in order able inherit it: <style targettype="button" x:key="widebuttonstyle"> <setter property=&q

android - No service of type Factory available in ProjectScopeServices -

apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' // load properties properties properties = new properties() file localpropertiesfile = project.file("local.properties"); if(localpropertiesfile.exists()){ properties.load(localpropertiesfile.newdatainputstream()) } file projectpropertiesfile = project.file("project.properties"); if(projectpropertiesfile.exists()){ properties.load(projectpropertiesfile.newdatainputstream()) } //read properties def projectname = properties.getproperty("project.name") def projectgroupid = properties.getproperty("project.groupid") def projectartifactid = properties.getproperty("project.artifactid") def projectversionname = android.defaultconfig.versionname def projectpackaging = properties.getproperty("project.packaging") def projectsiteurl = properties.getproperty("project.siteurl") def projectgiturl = properties.getpropert

java - What will be the format of the double -

i have 1 function i.e applycredit(double amount ) if calling function applycredit(inputamount) and inputamount in double 2 precision format i.e ####.00 if amount in function got updated several times and question : format of amount 2 precision or may changed of type double as long can "fit in" input can or without decimals public static void main(string[] args) { system.out.println(applycredit(2)); system.out.println(applycredit(2.66)); system.out.println(applycredit(2.72251)); } static private double applycredit(double amount ){ return amount*2; } will print : 4.0 , 5.32 , 5.44502

javascript - horizontal smooth scrolling between div id's -

can please write me javascript smooth scroll horizontally between #id's have ? have looked , previous questions have been answered , copied/pasted answers dont seem work. here relevant html - <div class = option1> <a href="#point1"> <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a> </div> <div class = page2> <div class='land7'> <img src='images/land7.png'> </div> <div class="option2"> <a href="#point2"> <i class="fa fa-arrow-circle-left" aria-hidden="true"></i> </a> </div> <div class='option3'> <a href="#point3"> <i class="fa fa-arrow-circle-right" aria-hidden="true"></i> </a> </div> <d

c# - WCF Operation contract type in case of Push Notification message receiving? -

i have restful wcf service used read data push restful service hosted somewhere on internet. have expose 1 method read json data push other service. [servicecontract] public interface itestservice { [operationcontract] [webinvoke( method = "get", responseformat = webmessageformat.json )] string getdata(string jsondata); } is fine receive push message in method ? push service can send bulk of data @ once. how can restrict server works fine bulk data. regards i have restful wcf service used read data push restful service hosted somewhere on internet. "push" wrong word; it's evocative of server-push, has different meaning way using here. more accurately, have service service call, passing data. is fine receive push message in method ? no, it's not fine. operations pass data on query string only. fine (though quite unusual) short strings made of json, longer strings risk violating maximum size limit query st

Android Wear - Xamarin no system images installed for this target - SDK manager not showing relevant SDKs (Visual Studio) -

Image
i have been looking around try , fix common issue system images not being installed target. questions have answers go sdk manager , install correct stuff... reason not have of sdks needed. i have latest version of xamarin , trying create virtual device android wear square. can fix this? did see answers folder directories far tell eclipse. is able me find sdks/ images? make sure "official add-on sites" enabled in sdk manager: and perform "packages / reload":

import - Polymer: re-using HTML snippet in an element -

i working on set of polymer elements (buttons in particular case) of should re-use same html snippet. structure custom button follows: ... <link rel="import" href="button-base.html" id="content"> <link rel="import" href="styles.html"> <link rel="import" href="behavior.html"> <dom-module id="dg-button"> <template> <style include="button-styles"></style> <!-- here want content of button-base.html --> </template> <script> polymer({ is: 'custom-button', behaviors: [dg.buttonbehavior] }); </script> </dom-module> styles , behavior work should. the problem is: not sure how content of button-base.html specified place of local dom without defining button-base yet element , using <button-base></button-base> . the reasons want avoid converting new element are: i w

javascript - JQuery owlCarousel plugin is not working with Angular 2 -

as new angular2 expecting find out solution following scenario. jquery plugin not working after getting data - http://www.owlcarousel.owlgraphic.com/ i got issues on `var owl = jquery(this.elementref.nativeelement).find('#breif'); owl.owlcarousel();` my full code given bellow angular 2 component: / beautify ignore:start / import {component, oninit , elementref, inject } '@angular/core'; import {form_directives} '@angular/common'; import {carousel_directives} 'ng2-bootstrap/components/carousel'; / beautify ignore:end / import {api} '../../../../services/api'; declare var jquery:any; @component({ selector: 'breif', directives: [carousel_directives], template: require('./template.html') }) export class breifcomponent implements oninit { elementref: elementref; breifs: object; public myinterval:number = 5000; public nowrapslides:boolean = false; public slides:array<any> = []; constr

jsf 1.2 - JSF 1.2 empty <h:selectManyListbox /> validation issue -

i'm kind of new jsf , i'm having trouble understand values jsf renders in form after validation fails. im using websphere 7 , default implementation of jsf, myfaces (i think 2.0). my xhtml looks this: <h:form id="form"> <h:inputtext id="text" value="#{backing.text}" required="true"/> <h:message for="text" /> <h:selectmanylistbox id="options" value="#{backing.options}" required="true"> <f:selectitem itemlabel="1" itemvalue="1" /> <f:selectitem itemlabel="2" itemvalue="2" /> <f:selectitem itemlabel="3" itemvalue="3" /> </h:selectmanylistbox> <h:message for="options" /> <h:commandbutton value="save" /> </h:form> and backing bean this: public class backing { private string text; private st

c++ - Virtual destructor of abstract class fix is fuzzy -

i have abstract class , errors when try delete instance of class. class ccobjectbase { public: ccobjectbase(); virtual ~ccobjectbase(); virtual void createpainterpath() = 0; }; class ctriangle : public ccobjectbase { public: ctriangle(); ~ctriangle(); void createpainterpath(); }; ccobjectbase :: ~ccobjectbase(){} i create object bellow: std::vector<ccobjectbase *> m_objectbaselist; m_objectbaselist.push_back(new ctriangle()); //do stuff m_objectbaselist delete m_objectbaselist.at(index); m_objectbaselist.erase(m_objectbaselist.begin() + index); i retrieve error @ ~ctriangle() "undefined reference ccobjectbase :: ~ccobjectbase()". if delete virtual destructor ccobjectbase warning "deleting object of abstract class type ccobjectbase has non-virtual destructor cause undefined behavior" annoying fix cause more problems. update: kind of stupid tried run qmake -> rebuild , nothing happen when restart app there no er

PHP <a href= click value to cookie -

for site use 1 big php file wich generate pages, use url transfer menu choice , that's want change. <li><a href="index.php?s=i">home<br></a></li> <li><a href="index.php?s=z">about<br></a></li> i want loose ?s=z url , pass value 'z' cookie when clicked , reload php file, read cookie, , generate page "about". i thinking , playing "onclick", didn't work. regards, marco with on question solved problem, it's work around, trick. basicly solution if there var @ end of url. if so, put var in cookie , reload page without url var. after reload, read cookie , execute menu option.

cordova - Converting Web App to Mobile App using NativeScript -

i have read nice blog post https://auth0.com/blog/converting-your-web-app-to-mobile/ i ask: could nativescript same conversion cordova? regards mahmoud nativescript takes different approach cordova. cordova (and frameworks using cordova, ionic) takes web application , runs in small browser-like component called webview. ui not native, html styled css native components. nativescript similar in way writing web application, not using html elements, using nativescript elements mapped real native elements. when build application, have real native application, should give more performance. code runs in js virtual machine, bundled app. in short, yes can similar cordova - reuse web application code mobile apps, build process , resulting app different.