Posts

Showing posts from September, 2015

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

c# - Save and read settings value in Windows Phone 8.1 -

i have page in windows phone, user has chose 1 value (a string) in combobox item. after presses button, value should stored in settings preference. how can this? also, value should read in other page/class in windows phone 8.1 application. tried code, doesn't work: private void save(object sender, routedeventargs e) { var applicationdata = windows.storage.applicationdata.current; var roamingsettings = applicationdata.roamingsettings; // create simple setting roamingsettings.values["surname"] = surnamesbox.selecteditem; } the problem try save selecteditem object itself. convert string: roamingsettings.values["surname"] = surnamesbox.selecteditem.tostring();

java - how to use Arraylist (for-loop) in Jfreechart piechart? -

i started on collecting data in database, wrote code retrieves information, name(language) , amount of times language has been counted, arraylist. data wanted make piechart. i have tried jfreechart does know how use data in arraylist piechart createdataset code jfreechart , since attempts resulted in failure(empty piechart) while using loop in the method ,createdataset, since data in arraylist changes , therefore dont want hardcode values , names. for loop attempt(everything else left default): public piedataset createdataset() { defaultpiedataset result = new defaultpiedataset(); for(language l: languagelist){ result.setvalue( l.getname(), l.getcount()); } return result; } if loop possible doing wrong or has change tom make work, if i'm off want know. --edit-- public piedataset createdataset() { defaultpiedataset result = new defaultpiedataset(); int count = 0; for(language l: languagelist){ result.insertvalue(count++, l.ge

progress 4gl - how to calculate total balance per state per country using accumulate function in openedge -

i have tried code. define variable totalbalance decimal no-undo. define frame f1 centered three-d size 100 50. each customer no-lock break country frame f1: accumulate balance(total country). if first-of(customer.country) display customer.country. display customer.state customer.balance. if last-of(customer.country) do: display skip fill("-", 25) @ 50 format "x(25)". display accum total customer.balance @ 51. display skip fill("-", 25) @ 50 format "x(25)". end. end. it gives total balance per country want display total balance per state. you not have "break state" nothing state. something (not tested): define frame f1 centered . each customer no-lock break country state frame f1: accumulate balance( total country ). accumulate balance( sub-total state ). if first-of( customer.country ) display customer.country.

javascript - fullpage JS animation on section -

i' m making fullpage js website , have animations in evry sections of page, , want animation play when i'm on section, know have after render option in plugin dont know how syntax make css animation play there code ( in example i'm trying animation of line of section2 play when i' m on section2) var smallcircles= ['top','right','bottom','left','top']; $(document).ready(function() { $('#fullpage').fullpage({ anchors: ['firstpage', 'secondpage', '3rdpage', '4thpage', 'lastpage'], scrollingspeed: 1000, }); }); body { height:100%; margin:0; padding:0; overflow:hidden; } .fp-section { position: relative; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; text-align:center; } .fp-section.fp-table, .fp-slide.fp-table { display: table; table-layout:fixed

java - Ambiguous column using JDBC but query works fine in database -

i connecting sqlite database through java using jdbc. schema: workinfo(id, job, salary) person(id, name) this query below runs fine in database, when try jdbc: resultset rs = statement.executequery("select * person join workinfo on (person.id=workinfo.id)"); while(rs.next()){ system.out.println("id: " + rs.getint("person.id")); //column not exist system.out.println("name: " + rs.getstring("name")); //works fine output: if using person.id: no such column: 'person.id' without specifying: ambiguous column name 'id' i've tried using both workinfo , person , using aliases keeps throwing same ambigious column name (if left id) or column not exist. it's practice explicitly retrieve columns want. change query be: resultset rs = statement.executequery("select info.id, info.job, info.salary, " + "person.id, person.name person person join workinfo info " +

php - Why do I get HTTP 501 errors for certain requests? -

i've written simple webapp myself able edit files on server, when i'm @ place allows http , https ports... but encountered weird problem it. normally these headers exchanged when save file (confidential info removed): https://example.com/? post /? http/1.1 host: example.com user-agent: mozilla/5.0 (windows nt 6.1; rv:36.0) gecko/20100101 firefox/36.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: hu-hu,en-us;q=0.8,hu;q=0.5,en;q=0.3 accept-encoding: gzip, deflate dnt: 1 referer: https://example.com/?path=/home/csirmazd/public_html/[...]/fs/view/login.php&view=preview cookie: [...] connection: keep-alive content-type: application/x-www-form-urlencoded content-length: 644 [...] http/1.1 303 see other date: sat, 28 mar 2015 14:57:40 gmt server: apache/2.2.29 (unix) mod_ssl/2.2.29 openssl/1.0.1e-fips mod_bwlimited/1.4 x-powered-by: php/5.4.36 expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-reval

javascript - Unable to parse JSON string to object -

so trying retrieve data web server (url: https://api.uwaterloo.ca/v2/codes/subjects.json?key=6eb0182cf11ca581364ccceee87435f4 ). made sure valid json data using json validator , was. what trying values of subject key in data array. however, when first try parse response json object, doesn't let me. here code snippet var req = https.request('https://api.uwaterloo.ca/v2/codes/subjects.json?key=6eb0182cf11ca581364ccceee87435f4', function(res) { //res.setencoding('utf8'); res.on('data', function(d) { //console.log(object.prototype.tostring.call(d)); //jsonstring = json.stringify(d); //console.log(jsonstring); fs.writefile("./test.txt", d, function(err) { if(err) { return console.log(err); } console.log("the file saved!"); }); jsonobject = json.parse(d); // console.log(typeof(jsonobject.count)); // (var key in jsonobject) // { // if(jsonobject.hasownpropert

android - why would it throw an java.lang.NullPointerException -

this main activity; package com.example.sendsms; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } public void findcontact(view view ){ intent intent = new intent(this,readcontect.class); startactivity(intent); } } package com.example.sendsms; import java.util.arraylist; import java.util.list; import com.example.sendsms.domain.person; import android.content.contentresolver; import android.content.context; import android.database.cursor; import android.net.uri; public class getcontect{ public static list<person> getcontectinfo(context context){ contentresolver cr = context.getcontentresolver(); list<person> persons = new arraylist<