Posts

java - HashSet is empty -

why hashset<circle> empty? latlng currentlocation = new latlng(mcurrentlocation.getlatitude(),mcurrentlocation.getlongitude()); googlemap googlemap = msupportmapfragment.getmap(); hashset<circle> circles = new hashset<>(); if (!circles.isempty()) { (circle circle : circles) { toast.maketext(getactivity(), "" + circles.size(), toast.length_short).show(); if (!circle.getcenter().equals(currentlocation)) { circle.remove(); circles.remove(circle); } } } log.d(tag_map, "" + circles.isempty() + " " + circles.size()); circle circle = googlemap.addcircle(new circleoptions() .radius(constant.radius) .strokecolor(color.parsecolor(constant.radius_color)) .strokewidth(constant.radius_border) .center(currentlocation)); circles.add(circle); i mean added circle object it. don...

javascript - "TypeError: t.start is undefined", in fullcalendar.min.js while using on my website for google calender functionality -

i getting below error while using fullcalender on website... "typeerror: t.start undefined" , in fullcalendar.min.js while using on website google calender functionality typeerror: t.start undefined ... == t.allday && (t.allday = !(t.start.hastime() || t.end && t.end.hastime())), t... fullcal....min.js (line 713, col 44) my fullcalender js code is $('#calendar').fullcalendar({ header: { left: 'prev,next,today', center: 'title', right: 'month,basicweek,basicday' }, googlecalendarapikey: 'aizasya6cw8v_mpsgbqzta66cw0yvckug8le2uo', events: [ { googlecalendarid: 'ashish.raj189@gmail.com' }, ], }); }); could tell me should fix typeerror ? i using gcal.html library file of fullcalendar-2.3.1, downloaded http://fullcalendar.io...

Why does Bruce Eckel says that only objects can be passed into a method in Java? -

here's quote bruce eckel's book "thinking in java": the method argument list specifies information pass method. might guess, information—like else in java—takes form of objects. so, must specify in argument list types of objects pass in , name use each one. i don't it. think can pass primitives method (e.g. int) , primitives aren't objects. example: public static int multiply(int x, int y){ return x * y; this method , there primitives in it, no objects @ all. the author doesn't only objects can passed methods. quote comes in context of chapter called "everything object" . aims highlight object-oriented aspect of language, includes section on primitives explains special case. nevertheless, method taking primitive types still correct implicitly covered "special case: primitive types" section.

Export (native) module documentation as Python source code -

to make python autocompletion possible, use jedi-vim parses python modules. script parses python modules , extracts interfaces , documentation strings them. gdb has python scripting interface , unfortunately not classes (for example gdb.breakpoint ) available through public interface (the interfaces provided under /usr/share/gdb/python/ ). other classes provided native c code in gdb . as workaround, export stub python script contains public properties, classes , functions including documentation (if available). i have tried execute inspect.getsource(gdb) in gdb shell ( python print(...) ), throws ioerror: not find class definition error. inspect module provides interfaces facilitate in code generation, perhaps there exists module or script purpose of code generation provide documentation? no existing application seems able generate code documentation attached. until now... hereby present pystubgen ( pystubgen @ pypi )! pystubgen generates python sour...

HTML/CSS How to apply CSS to "a" with custom data attribute? -

i know how apply css custom data attributes in case doesn't seem work. don't want select class data-store attribute. html <a data-store="{&quot;dialoguri&quot;:&quot;\/messages\/compose\/dialog\/&quot;}" href="#"></a> css [data-store=" {&quot;dialoguri&quot;:&quot;\/messages\/compose\/dialog\/&quot;}"]{ position:fixed!important; bottom:0px!important; } but doesn't seem work. appreciated. the &quot; s see in html attribute character references double quotes. represented in css attribute selector literal double quotes, not html entities, since html entities pertain html only. since value contains double quotes, use single quotes delimit value in attribute selector don't have escape double quotes in value. the backslashes in attribute value need escaped, \ becomes \\ . there wayward leading space in attribute selector should removed. hence: [data-store='{...

angularjs - Showing an empty as first option in select tag -

my app showing empty select field first entry. have read other solution given , tried still not working. my controller code is: .controller('usercreatecontroller', function(user,profile,auth) { alert("hello"); var vm = this; vm.type = 'create'; profile.all() //this service fetch profiles shown in select field .success(function(data){ vm.profile = data; }); vm.userdata.profile = vm.profile[0]; //here have set default value select field and html page is: <label class="col-sm-2 control-label">profile</label> <div class="col-sm-8"> <select ng-model="user.userdata.profile" ng-options="person._id person.profilename person in user.profile"> </select> </div> hierarchy of vm.profile { "_id": 46, "profile": objectid("5516498e95b84548156db754"), "isactive": true, "password": "$2...

javascript - xScale and yScale in Canvas -

Image
i have question regarding xscale , yscale when drawing column chart canvas, here code: <html> <head> <title>bar graph</title> <style>#canvas{background: #ffffff; box-shadow:5px 5px 5px #ccc; border:5px solid #eee; margin-bottom:10px;}</style> <script type="text/javascript"> var canvas ; var context ; var val_max; var val_min; var sections; var xscale; var yscale; var y; // values of each item on graph var itemname = [ "red", "blue", "green"]; var itemvalue = [ 12144,12179, 12144 ]; function init() { // intialize values each variables sections = 3; val_max = 13000; var stepsize = 1000; var columnsize = 50; var rowsize = 60; var margin = 10; var header = "counts" // canvas = document.getelementbyid("canvas"); context = canvas.getcontext("2d"); context.fillstyle = "#000000;" yscale = (canvas.height - columnsize - margin)/ 13000 ...

C -printf casting -

i want play overflow of signed short integer variable. declare variable a1 short, , give greater positive value, 0 'considered' positive, maximum value of signed integer (be short, int, long or long long) must exp2(8*sizeof( variable )-1)-1, mustn't it? #include<stdio.h> #include <math.h> int main() { int short a1=2; a1=exp2(8*sizeof(a1)-1)-1; printf("the last value not overflow in integer \'signed short\' (%i bytes) %hi.\nif define variable equal value value in variable %hi.\n",(unsigned char) sizeof(a1), (short) exp2(8*sizeof(a1)-1)-1, a1);/*key word short "(short) exp2(8*sizeof(a1)-1)-1"*/ a1=exp2(8*sizeof(a1)-1);/*warning-overflow: "warning: overflow in implicit constant conversion [-woverflow]"*/ printf("the 1st value overflows in integer \'signed short\' (%i bytes) %i.\nif define variable equal value instead value in variable %i.\n",(unsigned char) sizeof(a1), (int) exp2(8*sizeof(a1)-1), ...

visual studio 2013 - Azure API App proxy generation error -

i able create test api , host in azure. when try create proxy client, receive following error. [fatal]error generating service model: operation 'get' has body parameter, did not have supported mime type ('application/json') in consumes property. exception: there error during code generation when trying add client microsoft azure api app generating client code , adding project failed i checked swagger file , contains node empty. when change to "consumes": [ "application/json", "application/xml" ] the proxy creation works. why did auto-generated swagger json not have contains property set? went default swaggerconfig when created api app. missing configuration? appreciated. as found out comments, solution to remove httprequestmessage parameter of action. enable api app client generate code ok. if need mock object, please follow documented way here or example he...

node.js - cookie in redirected response -

Image
as shown in image below, trying set-cookie in first redirect#1 response. i succeed response request module setting followredirect false in request options, still not set-cookie header. a similar discussion here: https://github.com/request/request/issues/1502 anyone has managed use other module cookie redirected response? lot in advance! response.headers['set-cookie'] should return values want.

spring mvc - Jetty HttpChannel timeout error for embedded video in web page -

i have embedded video playing in background of web page, pretty how in www.airbnb.com <div class="fullwidthbanner"> <video id="#myvideo" loop="loop" muted="muted" autoplay="autoplay"> <source th:src="@{/videos/cignme.mp4}" type="video/mp4" /> </video> </div> however after initial play of may 10 seconds or so, video blacks out , page goes unresponsive, , see following logs 2015-03-28 17:17:33.854 warn 5109 --- [tp1590404373-40] org.eclipse.jetty.server.httpchannel : /videos/cignme.mp4 java.io.ioexception: java.util.concurrent.timeoutexception: idle timeout expired: 30002/30000 ms @ org.eclipse.jetty.util.sharedblockingcallback$blocker.block(sharedblockingcallback.java:234) @ org.eclipse.jetty.server.httpoutput.write(httpoutput.java:133) @ org.eclipse.jetty.server.httpoutput.write(httpoutput.java:347) @ org.springframework.util.streamutils....

ios - How to convert UTC time to local time -

i'm new programming. how convert string local time in swift? var string = "7:55:26 pm" thanks! this how format string in nsdate , deploy following code var dateformat : nsdateformatter = nsdateformatter() dateformat.dateformat = "yyyy-mm-dd hh:mm:ss" var string = "2015-03-27 07:55:26" let date : nsdate = dateformat.datefromstring(string)!

d3.js - conflict of version 3 of d3.min.js with jquery (e.g., jquery.1.10.2.min.js) in some machines -

i followed example @ http://bl.ocks.org/wizicer/f662a0b04425fc0f7489 draw skill sunburst , worked fine in local machine. however, when deployed same code dev machine, gave following error. error went away when removed d3.js. uncaught syntaxerror: unexpected token ! jquery-1.10.2.min.js:4 (anonymous function) jquery-1.10.2.min.js:4 x.extend.globaleval jquery-1.10.2.min.js:6 x.ajaxsetup.converters.text script jquery-1.10.2.min.js:6 onjquery-1.10.2.min.js:6 k jquery-1.10.2.min.js:6 x.ajaxtransport.send.r jquery-1.10.2.min.js:6 x.ajaxtransport.send jquery-1.10.2.min.js:6 x.extend.ajax jquery-1.10.2.min.js:6 x.extend._evalurl jquery-1.10.2.min.js:5 x.fn.extend.dommanip jquery-1.10.2.min.js:5 x.fn.extend.append jquery-1.10.2.min.js:5 (anonymous function) jquery-1.10.2.min.js:4 x.extend.access jquery-1.10.2.min.js:5 x.fn.extend.html jquery-1.10.2.min.js:6 (anonymous function) jquery-1.10.2.min.js:4 x.callbacks.c jquery-1.10.2.min.js:4 x.callbacks.p.firewith jquery-1.10.2.min.js:6 k jqu...

datepicker - Is it possible to give custom date format for jQuery datapicker -

i want date format jan 5, 2015 using datepicker plugin. but, right can after referring documentation give format dd-mm-yy . possible display in above mentioned format(jan 5, 2015) when selects date in ui with andreas help, found following date formats can used datepicker : mm/dd/yy yy-mm-dd (positions of dd, mm, yy can altered diff o/p) d m, y d mm, y dd, d mm, yy more here hope helps else too.

java - MongoDB Geolocation using with Spring MVC -

i try implement gps tracking service application. i've service push geolocation data mongodb works well. problem each vehicle must send data in each 20 seconds. as requirement should show latest 24 hours data in google maps makes problem receive huge data set. (4320 1 vehicle). there best practice in mongo or google maps receive less data , show line history? (response "json") i assume json looks this: { id: 42, car_id: 102, coordinates: [ { lat: ..., lon: ..., timestamp: ... }, { lat: ..., lon: ..., timestamp: ... }, { lat: ..., lon: ..., timestamp: ... }, ... ] } if use json, there 4 ways reduce size: remove unused data you remove duplicate entries list. if car stands still hour, have 180 identical entries in row. keep single one, because drawn line on map won't different. remove timestamp if don't need it. if array ordered, might not need timestamp sorting. shrink data representation each character makes d...

adding two vectors or lists in R -

i have 2 list or vectors following in r: vector 1 d1 d2 d3 d4 2 0.75 1 0.25 0 vector 2 [1] "1" "3" i need add values of vector 1 considering values of vector2, mean in example add values of d1 plus d3 because vector 2 has indexes. considering in using loop traverse vector 2 , adding values of vector1, not other more direct way perform operation? remember can used converting indexes in t, f values, frankly quite don't remember. try: sum(vector1[match(vector2, gsub("d", "", names(vector1)))]) [1] 1

"Session expired" not working in Wicket -

when user of wicket application loses session (e.g. session expires), links on pages seeing, , form submissions, show user startpage. instead, if right result cannot displayed, expect wicket show "session expired" error message. for example, startpage displays data. enter query search field, , click on submit button. expect see either filtered results, or error (session expired), instead wicket silently creates new session , shows startpage, results without filter. looks bug ("filter doesn't work!"). for example, if go page https://login.firstbird.eu/ , delete jsessionid cookie, , click on "forgot password" link, you'd expect "forgot password" page displayed instead startpage displayed again. (i know solved bookmarkable link, there other situations rely on session , page information can't solved bookmarkable link.) there no serialization errors in log, think wouldn't matter anyway. there still going times when session ex...

shell - vi over netcat session -

is possible use vi on netcat? server: mkfifo tun; sh tun | netcat -l 4444 > tun client: netcat server_ip 4444 will gave me remote shell, it's problem send special hot-keys, example can't push esc enter " normal mode " in vi . or best choice sed ? this command runs input nc script, , fail same reason why script won't edit file: #!/bin/sh vi file 42g dd :wq you can instead, ironically, use script avoid running script, , instead terminal session interact with: server$ mkfifo tun; script -q < tun | netcat -l 4444 > tun (some netcats require -p before port above) additionally, should disable local echo , line buffering keys pass through connection rather when pressing enter: client$ stty -icanon -echo; nc localhost 4444 you should able edit files in vi . this neat proof of concept only. non-root users want provide robust shell access on network should use sshd .

java - mvn tomcat7:run command thrown SEVERE: A child container failed during start -

Image
i create maven-based java web application eclipse , have inserted apache maven tomcat plugin pom.xml. when enter command mvn tomcat7:run always through below error: here pom.xml : <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.example</groupid> <packaging>war</packaging> <version>1.0.0</version> <name>javawebappdemo maven webapp</name> <url>http://maven.apache.org</url> <artifactid>javawebappdemo</artifactid> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <build> <finalname>javawebappdemo</finalname> <plu...

sql - Is it possible to use 'case' with and in 'count'? -

is possible use case , in count select branches.name agence, count( case loanstatus when '1' , datepart(month,loanaccount.issuedate)= 2 1 else null end )as nombre_de_credits_demande , count( case loanstatus when '2' datepart(month,loanaccount.chargeoffdate)= 2 1 else null end )as nombre_de_credits_approuve please me you can use count() . prefer sum() : select branches.name agence, sum(case when loanstatus = '1' , datepart(month, loanaccount.issuedate) = 2 1 else 0 end ) nombre_de_crédits_demandé , sum(case when loanstatus = '2' , datepart(month, loanaccount.issuedate) = 2 1 else 0 end ) nombre_de_crédits_approuvé the issue code not count() versus sum() mixing of 2 different case syntaxes. when...