Posts

Showing posts from April, 2015

javascript - Render Extjs 4.2 app inside Div tag -

i want render viewport inside div tag. if change "ext.container.viewport" other container, works in development mode not in build mode. in build mode displays nothing. found similar question on stackoverflow render ext.application in div answer in question suggest use different container, in case if replace viewport container, nothing displaye din build mode(empty console log). here code of viewport : ext.define('pfalzkomapp.view.viewport', { extend: 'ext.container.viewport', requires:[ 'ext.layout.container.fit', 'papp.view.popupwindow' ], type: 'fit', renderto: ext.element.get("rea_tasklistentry"), items: [{ xtype: 'app-popupwindow' }] }); can me? thanks time.

regex - Antlr4 how to avoid syntax errors with anything between quotes rule? -

i'm trying build own dsl in order create custom rules match given json object. for purpose i've created far 2 kind of rules following grammar: grammar rulegrammar; def: 'def(' jsonrule ')'; jsonrule: regex|composite; regex: '"' code '"'; composite: '[' jsonrule ('&&'jsonrule)* ']'; code: any+; any: ( '\\"' | .); ws: [ \t\r\n]+ -> skip(); this grammar fails syntax error when "code" of regex contains characters '[' or ']', such as: def("[a-za-z0-9]+") line 1:5 extraneous input '[' expecting i see has definition of composite rule, has ']' in it. is there way avoid syntax error without escaping brackets in code? regex , code should lexer rules. besides, code greedy, it'll consume input. write regex rule instead: regex: '"' ('\\' ["\\] | ~["\\\r\n])* '"'; i

Javascript function return always undefined -

new js i'm expecting bug easy fix. so i've go function in users.js file : exports.authenticate = function(user){ user.findone({ 'username':user.username, 'password':user.password, },'username', function (err, dbuser) { if (err) return handleerror(err); console.log(boolean(dbuser)); return boolean(dbuser); }); } so return value of dbuser boolean : true if exists, else false. quite simple no ? there come trap.. var userclass = require('./users.js'); var myuser = userclass.create('xxazeddax','azezaeazeazeaz','mazeazeazezaeaze'); var authent = userclass.authenticate(myuser); console.log(authent); here i'm expecting boolean value because it's thing authenticate() can return.. not , got undefined. please, did got wrong ? your function(user) a.k.a authenticate not return other function function (err, dbuser) callback function means executed when request com

gnuplot - Filling with z-axis when using splot -

is possible fill z instead of x-axis when using splot? when use 1 of these options: splot 'file.dat' using 2:(0):2 w filledcurves splot 'file.dat' using 1:(0):2:(0) pm3d the filling performed respect x-axis. seems illegal perform: splot 'file.dat' using 2:(0):2 w filledcurves z is there way fill z-axis?

getchar example from K&R C does not work properly -

i wondering what's happening in code k&r c: #include <stdio.h> int main() { double nc; (nc = 0; getchar(); ++nc) { ; } printf("%.0f\n", nc); } when run code (os x el capitan), for loop doesn't finish , can't printf statement. the getchar() returns obtained character on success or eof on failure. reference here . try this for (nc = 0; getchar() != eof; ++nc) { } note that, enter doesn't means eof , means newline or '\n' . look @ header stdio.h , says, #define eof (-1) here can see how simulate eof. windows: ctrl+z unix : ctrl+d so long story short, can put condition in for loop, for (nc = 0; getchar() != '\n'; ++nc) { } // break loop if enter pressed (nc = 0; getchar() != 'c'; ++nc) { } // break loop if c pressed . . .

iphone - Swift PageViewController share data between views -

i building application runkeeper ( http://www.raywenderlich.com/73984/make-app-like-runkeeper-part-1 ). please forgive me if using incorrect language describe trying learning swift, , new iphone development :-). i planning on using uipageviewcontroller 3 pages. on first page, show running timer, start, pause, finish, lap, etc buttons. once timer running, when user press 'lap' button on first page, lap log information shown in table on second page. system should not switch pages unless user swipes page. on third page should map gps. want take information gps (on third page), , perform processing on data, , show results on second page. my question is, how share or pass information first, , third page second page without page changing second page? note: app should not switch pages when data goes first, third page second. should switch pages if user swipes. second question is, once data available second controller, can execute functions while page still on first or third p

Pentaho Report Designer for MongoDB -

Image
i downloaded pentaho business analytics try reporting features on windows 8 machine. i'm trying use report designer create report mongodb datasource, following guidelines book, i'm using these steps: select data tab. right click on data sets item. select mongodb menu. click on plus button create query and point things differ book, because form: according book, should able enter host name, port, , have option select collection, form doesn't allow me that. face issue, or know how fix it? the options hidden; stretch window!

ruby on rails - Exclude 'nil' row from ActiveRecord query with a HAVING clause where no results are returned -

i'm building series of methods in model use scopes. when 1 of these uses having clause , query returns no results, instance of model returned fields nil, , breaks code i'd use these scopes in. the below highly simplified example demonstrate issue. class widget < activerecord::base attr_accessible :name has_many :components def without_components joins(:components).group('widgets.id')having('count(components.id) = 0') end def without_components_and_remove_nil without_components.select{|i| i.id} # return objects i.id not nil end end calling widget.without_components if widgets have components assigned returns non-desirable: [{id: nil, name: nil, user_id: nil}] but if call widget.without_components_and_remove_nil converts activerecord::relation object returned array , can't chain other scopes need do. is there way of changing scopes either nil row excluded if appears, or there modification made activerecord query all

ruby on rails - Test Error Expected at least 1 element matching "login_path" -

i have integration test isn't working. seems straight forward why won't work tried fix 2 hours , can't. seems straight forward. can't see whats wrong this. clues? the error when run rake test 1) failure: userslogintest#test_login_with_valid_information_followed_by_logout [/users/josephkonop/documents/safsy/website/safsy/safsy/test/integration/users_login_test.rb:32]: expected @ least 1 element matching "a[href="/login"]", found 0.. expected 0 >= 1. the test. line 32 assert_select "a[href=?]", login_path test "login valid information followed logout" login_path post login_path, sessions: { email: @user.email, password: 'password' } assert is_logged_in? assert_redirected_to @user follow_redirect! assert_template 'users/show' assert_select "a[href=?]", login_path, count: 0 assert_select "a[href=?]", logout_path assert_select "a[href=?]&q

javascript - Load JQuery where it's needed in AngularJS project -

i have animated 404 error page created using jquery. the make work angularjs project if had jquery.min.js, 404.js, 404.min.css , javascript script tag in index.html however, creates unnecessary loading on other pages , slows down website. i found https://github.com/manuelmazzuola/angular-ui-router-styles looks it's designed css stylesheets or can use include js files too? how should load js, css files on partials, 404.html file , not on index.html? i think looking lazy loading. normally, javascript pertains web page or application loaded during page load. lazy loading loading code once user needs it. if have button on page show different screen user once pressed, require js serve purpose , clean. take @ below code project $('#somebutton').on('click', function() { require( ['every', 'javascript', 'dependency', 'for', 'other', 'screen'], function(ev, js, dep, fr, othr

c# - How can I consume 2 web services with one class method? -

i'm creating .net application consume soap apis. i downloaded 2 partner wsdl files 2 instances(production , sandbox). think difference of 2 apis endpoints. i added web references single application. when write method consume apis, don't want duplicate code same thing(insert,update...). how can design code maybe can pass parameter let method know target instance should talk to? thank you! if services same , endpoint differs, should able use generated client's endpoint property change endpoint. var client = new servicereference1.webservice1soapclient(); client.endpoint.address = new system.servicemodel.endpointaddress("http://localhost:2850/webservice1.asmx");

sql server - Manually type sql to map to c# object just like .Include("") method -

to make simple here example models. models consist of teacher many students. public class teacher { public int id { get; set; } public string name { get; set; } public list<student> students { get; set; } public teacher() { students = new list<student>(); } } public class student { public int id { get; set; } public int teacherid { get; set; } [foreignkey("teacherid")] public teacher teacher { get; set; } public string name { get; set; } } using entityframework teachers , students using linq context.teachers.include("students"); however, if working large model set need include many child properties query can take time. my sub question if chain linq statement , select new viewmodel teacher properties need , select students student view model properties need , on.. efficient writing sql manually? entityframework add overhead

objective c - Getting data from multiple UIPicker components -

i'm trying gather selected data in picker field. have 3 components. how can call specific component? i've been trying datedata[component][row] returns last selected component. there way datedata[component:1] ? (i know doesn't work). thanks! the uipickerview has instance function call retrieve selected row given component: - (nsinteger)selectedrowincomponent:(nsinteger)component; this how function call if pickerview instance name: [pickerview selectedrowincomponent: 0]

html - How to default to browser 'Reader View' mode via CSS or Javascript? -

all modern web browsers have 'reader view' mode available. possible, via css and/or javascript, tell browsers automatically use 'reader view' version on mobile devices have 480px screen width? i don't want create mobile version of site since 'reader view' version works perfect on mobile devices (that have 320px-480px screen width). ps. i'm not looking information when reader view icon triggered - want force reader view mode on mobile devices have less 480px screen width. besides, reader view mode available in other browsers (not in firefox).

c# - Is there a similar method to HttpResponse.ApplyAppPathModifier? -

i need run code on application_start uses httpresponse.applyapppathmodifier method. i'm using iis7 + integrated mode , there no httpresponse object by design . since can't hand on httpresponse object during application_start , i'd glad find similar method httpresponse.applyapppathmodifier .

spring mvc request not available error -

@bean public viewresolver viewresolver() { internalresourceviewresolver resolver=new internalresourceviewresolver(); resolver.setprefix("web-inf/views"); resolver.setsuffix(".jsp"); resolver.setexposecontextbeansasattributes(true); return resolver; } @requestmapping(value="/events/{id}") public string showevent(@pathvariable("id") int id) { return "/events/show"; } o/p: when use url: http://localhost:8080/tracker/events/1 http status 404 - /tracker/events/web-inf/views/events/show.jsp type status report message /tracker/events/web-inf/views/events/show.jsp description requested resource not available. apache tomcat/7.0.56 i using spring 4.1 java configuration , annotations. there thing wrong configuration?

Keyboard Shortcut for Error message tool tip for Red underline in SQL Server? -

Image
this may silly question me know keyboard shortcut viewing red underline error messages in ssms. normally, if mouse over, know tool tip message. is there keyboard shortcut this? below example (click enlarge): the message you're looking in ui tooltip; there's no keyboard shortcut display tooltips. imo, you'd wise turn on error list view (view > error list, or ctrl + \ , ctrl + e ). show list of errors, syntax or otherwise, in easy read format.

How to Start Incremental Timer in Android -

before asking question let me tell question has been answered many time didn't resolve problem. tried this questions answer not helpful. so problem creating mastermind game in android , want start timer 00:00 when user enter first pin on until user hit last pin or when user click on new game timer reset , not start until user enter first pin again. so here try handler timerhandler = new handler(); runnable timerrunnable = new runnable() { @override public void run() { long millis = system.currenttimemillis() - starttime; int seconds = (int) (millis / 1000); int minutes = seconds / 60; seconds = seconds % 60; timertextview.settext(string.format("%d:%02d", minutes, seconds)); timerhandler.postdelayed(this, 500); } }; function start or stop timer @override public void onpause() { super.onpause(); timerhandler.removecallbacks(timerrunnable); timercheck = true; } when user hit first pin

What are the possibilities to debug a docker swarm? -

i'm trying create container's cluster using docker swarm engine , following official documentation: https://docs.docker.com/swarm/install-w-machine/ . unfortunately till without success. on documentation's step information swarm, 2 containers displayed (the ones swarm-master) instead of four. here output i'm getting: $ docker info containers: 2 images: 7 storage driver: aufs root dir: /mnt/sda1/var/lib/docker/aufs backing filesystem: extfs dirs: 11 dirperm1 supported: true execution driver: native-0.2 logging driver: json-file kernel version: 4.0.5-boot2docker operating system: boot2docker 1.7.0 (tcl 6.3); master : 7960f90 - thu jun 18 18:31:45 utc 2015 cpus: 1 total memory: 996.2 mib name: swarm-master id: m4z4:6zbe:lv53:nhs3:7ct6:hnwm:glq4:5wpy:3czr:hvaz:gpp2:g7i3 debug mode (server): true file descriptors: 20 goroutines: 33 system time: 2015-06-29t15:36:40.543771252z eventslisteners: 0 init sha1: init path: /usr/local/bin/docker docker root dir: /mnt/

php - Session variables resets on the refresh of the page -

i`m trying create mock login website whenever try save username in session, when page reloads, resets session 1. put on session.auto_start on thinking session_start issue it's still happening my header.php <?php if($_session['user'] != 1){ $user = $_session['user']; ?> <input type='submit' id='accedit' value='edit account'/> <label class='clicklog'>welcome: <?=$user?></label> <?php }else{ ?> <input type='hidden' id='accedit' value='edit account'/> <p id="clicklog">login?</p> <?php } ?> the function case "login": $user = $_post['user']; $pass = $_post['pass']; if($user = "cody" && $pass = "1234"){ $_session['user'] = $user; echo "ye

java - Spring : Google drive not opening window on live server -

i working on spring-mvc application in working on google drive integration. tested on localhost, , works fine. when uploaded code on server , trying authenticate, browser url wont automatically opened opened in localhost user give permissions. doing wrong. here authentication code : controller code : @requestmapping(value = "/authorizeuser") public string testgoogledrive(){ try { this.drivequickstart.authorize(); return "redirect:/dashboard"; } catch (ioexception e) { return "redirect:/denied"; } } drivequickstartimpl : @override public credential authorize() throws ioexception { inputstream in = drivequickstartimpl.class.getresourceasstream("/client_secret.json"); googleclientsecrets clientsecrets = googleclientsecrets.load(json_factory, new inputstreamreader(in)); googleauthorizationcodeflow flow =

Javascript in PHP file which outputs JSON -

is there way use javascript code inside php file uses header('content-type: application/json'); output in json format? edit: i'm trying change color of css class when $est = 'crest' but javascript code printed along. javascript part inside comment /*here*/ <?php header('content-type: application/json'); $vs=array(); $vs1=array(); include("json/connectorcl.php"); if ((isset ($_get['ty'])) , (isset ($_get['est']))){ $nprocesso = $_get['ty']; $est = $_get['est']; if ($est == 'crest') { $query2 = "select * patern crest='1'"; $result2 = oci_parse($connect, $query2); oci_execute($result2); /*here*/ echo "<script type='text/javascript'> $('.time-title').css({'color':'blue'});</script>"; /*here*/ } else { $query2 = "select * patern"; $result2 = oci_parse($connect, $query2); oci_execute($result2); } whil

android - Using saveinstancestate for saving a lot of checkbox states -

i know there lot of documentation using save instance state confused on how implement case. have custom action bar activities custom buttons take previous , next pages. when navigate via these buttons, want able save state of of checkboxes. i'm 90% sure i'm doing wrong , wonder if there better way considering amount of lines i'm using. code in first activity , when clicked custom next button , previous button return it, it's not saving state: boolean bprearrival_1, bprearrival_2, bprearrival_3, bprearrival_4, bprearrival_5, bprearrival_6, bprearrival_7, bprearrival_8, bprearrival_9, bprearrival_10, bprearrival_11, bprearrival_12; @override public void onsaveinstancestate(bundle savedinstancestate) { super.onsaveinstancestate(savedinstancestate); savedinstancestate.putboolean("prearrival_1", checkboxlist.get(0).ischecked()); savedinstancestate.putboolean("prearrival_2", checkboxlist.get(1).ischecked()); savedinst

amazon ec2 - I can't access the desktop of ec2 G2 instance -

i try using nx remotely connect aws ec2 instance in cloud. os ubuntu 14.04. following tutorial enter link description here , can access login page of ubuntu. i use new created username , password login. stuck because everytime type usename , password , press 'enter', nothing happened except throw login page again. i ensure usename , password correct. have no idea now. suggestion? the guide following works nx 3. nx 4 uses different protocol (nx native protocol) uses different ports ssh. by default nx 4 protocol uses port 4000. make sure open ports on ec2 security group. ps: don't think nx 4 going work expect since won't able create virtual desktop. try following guide , use nx 3.

python - Non-linear system of equations Julia -

Image
i'm trying solve large number (50) of non-linear simultaneous equations in julia. moment i'm trying make work 2 equations syntax right etc. however, i've tried variety of packages/tools - nlsolve, nsolve in sympy , nlopt in jump (where ignore objective function , enter equality constraints)- without luck. guess should focus on making work in one. i'd appreciate advice on choice of packages , if possible code. here's how tried in nlsolve (using in mcpsolve mode can impose constraints on variables solving - x[1] , x[2] - unemployment rates , bounded between 0 , 1) : using distributions using devectorize using distances using statsbase using numericextensions using nlsolve beta = 0.95 xmin= 0.73 xmax = xmin+1 sigma = 0.023

c++ - OpenCV convexity defects drawing -

i have stored defects using convexity defects in 4 element vector integer array using vec4i. my convex hull array in hull element , contours in contours; want draw line start point of convexity defect end point of one. need access element start index present in vec4i of defects vector! how do this?? #include <opencv\cv.h> #include <opencv2\highgui\highgui.hpp> #include<opencv\cvaux.h> #include<opencv\cxcore.h> #include <opencv2\imgproc\imgproc.hpp> #include <iostream> #include<conio.h> #include <stdlib.h> using namespace cv; using namespace std; int main(){ mat img, frame, img2, img3; videocapture cam(0); while (true){ cam.read(frame); cvtcolor(frame, img, cv_bgr2hsv); //thresholding inrange(img, scalar(0, 143, 86), scalar(39, 255, 241), img2); imshow("hi", img2); //finding contours vector<vector<point>> contours; vect

git - SourceTree thinks the whole file has changed when I change single lines -

this question has answer here: what's best crlf (carriage return, line feed) handling strategy git? 9 answers source tree marks file modified 1 answer sourcetree mac i'm using as3 project not track changes in class files. more accurately speaking, treats them more single line of code rather sequence of lines. so, when change something, version control shows whole file has changed. doesn't happen in as3 projects, in of them, i'm guessing has project git settings. how can fix this?

Groovy Array of Strings -

i know curly brackets not used initialize array in groovy have noticed 1 peculiar thing. why groovy doesn't give compiler error when initialize array this. string emailaddress = "test@gmail.com"; string [] var = {emailaddress}; println var[0]; output: com.test.examples.groovytest$_main_closure1@12e4860e when try declare error: string [] var = {"a","b"}; can explain this? when do: string [] var = {emailaddress}; that creates closure returns string emailaddress , , crams closure string array (by calling tostring() on it), that's told ;-) so var equals ['consolescript0$_run_closure1@60fd82c1'] (or similar, depending on you're running things) when do: string [] var = {"a","b"}; the right-hand side not valid closure, script fails parse. what want is: string[] var = ['a', 'b'] or: string[] var = [emailaddress]

c# - NHibernate Sqldatetime must be between 1/1/1753 and 12/31/9999 -

i'm using nhibernate in mvc project. problem is, while m trying update object m getting following error. sqldatetime overflow. must between 1/1/1753 12:00:00 , 12/31/9999 11:59:59 pm. in debug mode see date property not null. set datetime nullable on mapping. i'm still getting sqldatetime error. public class entitybasemap<t> : classmap<t> t : entitybase { public entitybasemap() { id(x => x.id).generatedby.identity(); map(x => x.isdeleted).not.nullable(); map(x => x.createdat).nullable(); map(x => x.updatedat).nullable(); map(x => x.random).formula("newid()"); references(x => x.status).column("statusid"); where("isdeleted=0"); } } datetime properties not null on save. public int saveorupdatepage(pagedto pagedto) { var page = pagedto.id > 0 ? byid<page>(pagedto.id) : new page(); var status = pagedto.status.id > 0

node.js - How does NodeJS handle multi-core concurrency? -

currently working on database updated java application, need nodejs application provide restful api website use. maximize performance of nodejs application, clustered , running in multi-core processor. however, understanding, clustered nodejs application has own event loop on each cpu core, if so, mean, cluster architect, nodejs have face traditional concurrency issues in other multi-threading architect, example, writing same object not writing protected? or worse, since multi-process running @ same time, not threads within process blocked another... i have been searching internet, seems nobody cares @ all. can explain cluster architect of nodejs? much add on: clarify, using express, not running multiple instances on different ports, listening on same port, has 1 process on each cpus competing handle requests... the typical problem wondering is: request update object base on given object b(not finish), request update object again given object c (finish before first request

How does Spark in Java compare two Keys when doing a join or groupWith? -

i trying following, javapairrdd<jsonobject, jsonobject> rdd1 = .. javapairrdd<jsonobject, string> rdd2 = .. javapairrdd<jsonobject, tuple2<iterable<string>, iterable<jsonobject>>> groupedrdd = rdd1.groupwith(rdd2); but i'm not sure how spark compare 2 jsonobject keys. more generally, how keys compared when doing join or groupwith? it uses java .equals() method. the thing equals() not implemented in jsonobject . use default java implementation compares object references. the equals method class object implements discriminating possible equivalence relation on objects; is, non-null reference values x , y, method returns true if , if x , y refer same object (x == y has value true).

javascript - Headroom.js options with Enquire.js -

i need have different offset in headroom.js depending on screen size. enquire.js should trick, can't work properly. loads 1 offset setting per page load, though it's right 1 on load, doesn't switch setting when resize screen. enquire.register("screen , (max-width: 48rem)", { // required // triggered when media query transitions // *unmatched* *matched* match : function() { headroom.options = { offset : 0, }; }, // optional // triggered when media query transitions // *matched* *unmatched* unmatch : function() { headroom.options = { offset : 137, }; }, // optional // triggered once upon registration of handler setup : function() { }, // optional // defaults false // if true, defers execution of setup function // until first media query matched (still once) defersetup : true });

c# - While the application is open -

i trying implement card game(similar bridge). there bunch of classes represent suit,player,cart,team,etc. in each round each player throws 4 cards , once 13 cards each player’s hand thrown, can calculate points each team of 2 players collected. i need tell main form somehow end (better term start new round ) when 52 cards thrown. i trying implement following pseudo algorithm while(not cards played) { continue game } calculate each player’s score according collect hand not sure put while loop. not in form_load. your question general, here primary reccommendation: don't put business logic in view class . view should react via method calls/events changes in underlying state. unfortunately, easier in tech built around mvvm/mvc pattern (like wpf). that being said, create "gamecontroller" class manages game state , holds rules such this. every time card played run through method like: void checkroundend() { if (cardsplayed == 52)

javascript - What does the following snippet do with num? -

i read other's code, there piece of code below. wondering method num? formatnumber: function (num, digit) { var pow = math.pow(10, digit || 5); return math.round(num * pow) / pow; } btw when running formatnum(11.267898, 5), gave me 11.2679, ok? essentially, function returns number precision. precision digit , 5 if not provided. the return part brings many values (equal digit ) decimal right left , discard rest , divides again original value reduces precision of digit . regarding btw edit - the value obtained correct. see details below when call formatnum(11.267898, 5) , you're asking number round 5 digit precision , number has 6 digit precision - precision digits after dot. now when call num * pow number becomes 1126789.8 , when round number, rounds closest integer 11.26790 . when divide pow ( 100000 ), number becomes 11.2679, discarding last 0 trailing 0 in precision pointless.

How to read the specific set elements from an array - PHP -

i have array, trying store first element(15) in 1 array(xaxis) , second element(42) fifth(23) in array(yaxis) , again want store sixth element(15) in array - xaxis , later 4 elements in yaxis. have more hundred elements in source array , want follow pattern store in arrays. array ( [0] => 15 [1] => 42 [2] => 55 [3] => 42 [4] => 23 [5] => 15 [6] => 38 [7] => 40 [8] => 53 [9] => 10 [10] => 15 ) thanks. use loops : $array = array ( [0] => 15 [1] => 42 [2] => 55 [3] => 42 [4] => 23 [5] => 15 [6] => 38 [7] => 40 [8] => 53 [9] => 10 [10] => 15 ) $x = {}; $y = {}; $step = 0; ($i=0; $i < count($array); $i = $i){ if ($step == 0){ array_push($x, $array[$i]); $i = $i + 1; } else { array_push($y, $array[$i]); array_push($y, $array[$i+1]); array_push($y, $array[$i+2]); array_push($y, $array[$i+3]); $i = $i + 4; } } dont f

javascript - Animate a Canvas Diamond Shape to Draw when scrolled to -

Image
i'm attempting draw shape on screen canvas. i have referenced example draws circle: http://jsfiddle.net/loktar/uhvj6/4/ ,but cannot figure out. appreciated. i'm new canvas. var canvas = document.getelementbyid('mycanvas'); var context = canvas.getcontext('2d'); var x = canvas.width / 2; var y = canvas.height / 2; var radius = 75; var endpercent = 85; var curperc = 0; var counterclockwise = false; var circ = math.pi * 2; var quart = math.pi / 2; context.linewidth = 10; context.strokestyle = '#ad2323'; context.shadowoffsetx = 0; context.shadowoffsety = 0; context.shadowblur = 10; context.shadowcolor = '#656565'; function animate(current) { context.clearrect(0, 0, canvas.width, canvas.height); context.beginpath(); context.arc(x, y, radius, -(quart), ((circ) * current) - quart, false); context.stroke(); curperc++; if (curperc < endpercent) { requestanimationframe(function () { animate(curperc / 100) }); } } a

java - I am getting the error when I run applet in HTML page even after I have signed all the jar files -

both videoplayer , html contains external jar files in library jna-3.5.2.jar,platform-3.5.2.jar , vlcj-2.4.1.jar. both videoplayer , html page in different projects in netbeans , have included external jar files mentioned above in both projects. this code of videoplayer class. package player; import com.sun.jna.nativelibrary; import java.awt.borderlayout; import java.awt.color; import uk.co.caprica.vlcj.component.embeddedmediaplayercomponent; import uk.co.caprica.vlcj.runtime.runtimeutil; public class videoplayer extends javax.swing.japplet{ public embeddedmediaplayercomponent mediaplayercomponent; @override public void init() { try{ nativelibrary.addsearchpath(runtimeutil.getlibvlclibraryname(),"./src"); nativelibrary.addsearchpath(runtimeutil.getpluginsdirectoryname(),"./src"); setbackground(color.red); setsize(500,500); mediaplayercomponent = new embeddedmediaplayercomponent();

webrtc - Live Streaming form a webpage using user camera -

i need stream live event using user camera web page. idea use getusermedia() video user camera , send rtmp point, it's possible? or there way it? its possible have detail knowledge encoder , decoders. of developer trying same thing after flash support drop firefox , chrome. yes, possible wowza media server doing same thing check here

c++ - constructing a pair(string, *node) to insert into an unordered_map -

typedef unordered_map<string, relationnode*> relationmap; using relation_entry = relationmap::value_type; void insertnode(string category, relationnode* node) { relation_entry insertpair = make_pair<string, relationnode*>(category, node); } causes error of "cannot convert 'category' (type 'std::string(aka std::basic_string(char))') type 'std::basic_string(char)&&" , error of "cannot convert 'node' (type 'relationnode*') type 'relationnode*&&". i planning make pair insert unordered_map. i using "g++ -g -o0 -wall -wextra -std=gnu++11" compile code. appreciated. just write: relation_entry insertpair = make_pair(category, node); this work and more concise (in fact, that's reason use std::make_pair instead of calling constructor directly in first place). you should know backward-compatibility issue c++11 . consider piece of c++98 code (i replaced

ios - Braintree vault not storing payment methods -

my sandbox account doesn't store payment methods customer in vault. creating customer object using: def create_customer result = braintree::customer.create( :first_name => params[:first_name], :last_name => params[:last_name], :email => params[:email], :phone => params[:phone] ) if result.success? render :json => {'result' => result.customer.id} else render :json => {'errors' => result.errors}, :status => 400 end end and storing customer_id in database later use. when creating client_token sending same customer_id api. here code creating client_token: def client_token token = braintree::clienttoken.generate( :customer_id => params[:customer_id] ) render :json => {"token" => token} end i work @ braintree. if have more questions integration, can get in touch our support team you need create payment method nonce receive client: result = braintree::p

android - Taking a picture then check its orientation, then rotate it then save it -

i've tried create application (with unity3d) uses intent take photo , save it. my issue saving picture checking orientation rotate if needed , saving again, long. i think that's due fact i'm using tools. do have tips reduce process time? here's (edited) code, in advance : package com.falsename.my; import java.io.file; import java.io.ioexception; import java.text.simpledateformat; import java.util.date; import android.app.activity; import android.content.context; import android.content.intent; import android.content.pm.activityinfo; import android.content.pm.packagemanager; import android.net.uri; import android.provider.mediastore; import android.util.log; public class photoplugin implements myandroidplugin { private boolean cantakephotos; private string mcurrentphotopath; private static photoplugin instance; private myactivity activity; private file photofile; static final int request_image_capture = 1; private file creat