Posts

Showing posts from August, 2013

android - unable to call onclick event only at first page in phonegap -

i'm using cordova phonegap make android app. in first page i'm trying use input elements button: $(document).ready(init()); and: document.addeventlistener("deviceready", ondeviceready, false); input element: <input type="button" id="task_btn" value="button" /> click event: $("#download_btn").click(function() { console.log("index.html >> task button clicked"); } but doesn't work; however, in second page works well. element ids defined correctlly. how solve problem? full code on html page : <!doctype html> <html> <head> <title>home page</title> <meta charset="utf-8"> <link rel="stylesheet" href="js/jquery.mobile-1.3.1.min.css"> <script src="js/jquery-1.9.1.min.js"></script> <script src="js/jquery.mobile-1.3.1.min.js"...

Puppet master policy-based autosign script STDOUT/STDERR not copied to master's log output -

according puppet master documentation here , both stderr , stdout emitted executable referred autosign=[path executable] setting copied puppet master's main log output. however, cannot find output anywere. the relevant bit of puppet.conf: [main] logdir = /var/log/puppet log_level = debug [master] autosign=/usr/lib/ruby/site_ruby/1.8/autosign.rb the source of /usr/lib/ruby/site_ruby/1.8/autosign.rb: #!/usr/bin/env ruby require 'etc' env['home'] = etc.getpwuid(process.uid).dir stderr.puts "inside autosign.rb" stderr.puts "=====================================" stderr.puts "=== env['home'} =====================" stderr.puts "#{env['home']}" stderr.puts "=== stdin ===========================" argf.each |line| stderr.puts line if line =~ /login/ end stderr.puts "=== argv[] ==========================" argv.each |b| stderr.puts b end #require 'puppet' #require ...

subset - R: Subsetting column 1 based on vector of values potentially present in column 2 -

i have dataframe kegglist , pertinent section of show below: > kegglist[131:145,] v1 v2 131 a0avt1 hsa04120 132 a0pjz3 hsa00514 133 a1a4s6 hsa05100 134 a1a4y4 hsa05145 135 a1l167 hsa04120 136 a2rtx5 hsa00970 137 a3kft3 hsa04740 138 a4d0s4 hsa05146 139 a4d0s4 hsa04512 140 a4d0s4 hsa04510 141 a4d0s4 hsa05200 142 a4d0s4 hsa05222 143 a4d0s4 hsa05145 144 a4d2g3 hsa04740 145 a5d8v6 hsa04144 i have vector listx contains some, not all, of ids in v1 of kegglist : > listx [1] a1l167 a2rtx5 a3kft3 a4d0s4 what want subset kegglist$v2 based on ids in kegglist$v1 present in listx . so, in example, result should this: > result [1] hsa04120 hsa00970 hsa04740 hsa05146 hsa04512 hsa04510 hsa05200 hsa05222 hsa05145 please note in real data, not ids in listx found consecutively in kegglist$v1 . thank help. i tried result <- kegglist$v1[kegglist$v2 %in% listx] to no avail. try: kegglist$v2[kegglist$v1 %in% listx] or: kegglist$v2[which(...

matlab - How to convert nifti file to AFNI file? -

i want know how convert nifti file afni file (.head/brik). you can use 3dcopy : 3dcopy myfile.nii myfile will create myfile+tlrc.head , myfile+tlrc.brik (afni can handle nifti files file, though, without them needing in head/brik format).

java - Modifying value in Hashtable -

hello come problem modifying value in hashtable when 2 keys equal. i define hashtable, hashtable<string, integer> hash = new hashtable<string, integer>(); and program fills data .put() method. note: first column represents hex values 08 86 aa 10 ff 330 2a 54 e1 60 i can check string duplicates if(hash.containskey(string x)){} . if want insert data in hashtable, same string hash.put("aa", 77); dont know how add value in hashtable new value , have hashtable no duplikate strings. means have final hastable looking likewise 08 86 aa 87 ff 330 2a 54 e1 60 any suggestions? string yourkey = "aa"; int val = 77; if (hashtable.containskey(yourkey)) val += hashtable.get(yourkey)); hashtable.put(yourkey, val); this checks duplicates , if there is, add original value table

java - Properly handling empty Observable in RxJava -

i have situation creating observable containing results database. applying series of filters them. have subscriber logging results. may case no elements make way though filters. business logic states not error. however, when happens onerror called , contains following exception: java.util.nosuchelementexception: sequence contains no elements is accepted practice detect type of exception , ignore it? or there better way handle this? the version 1.0.0. here simple test case exposes i'm seeing. appears related having events filtered before reaching map , reduce. @test public void test() { integer values[] = new integer[]{1, 2, 3, 4, 5}; observable.from(values).filter(new func1<integer, boolean>() { @override public boolean call(integer integer) { if (integer < 0) return true; else return false; } }).map(new func1<integer, string>() { @overr...

mysql - the path for the folder in my server (PHP) -

i have problem in php code. have form let user upload files server, did not know how write correct path folder in server![enter image description here][1] want files store in, how path specific file download later. the path in server : /public_html/upload_files but keeps tell me : warning: move_uploaded_file(upload_files/project_guidelines.pdf): failed open stream: no such file or directory in d:\sites\dwts.com\public_html\website\creat.php on line 50 warning: move_uploaded_file(): unable move 'c:\windows\temp\php14ac.tmp' 'upload_files/project_guidelines.pdf' in d:\sites\dwts.com\public_html\website\creat.php on line 50 error uploading file code: $len = count($_files['attachment']['name']); for($i = 0; $i < $len; $i++) { $uploaddir = 'upload_files/'; $filename = $_files['attachment']['name'][$i]; $tmpname = $_files['attachment']['tmp_name'][$i]; $filesize = $_files['attach...

javascript - Can someone explain the way this variable is declared? -

i new javascript , trying modify webiste template bought , having little difficulty understanding way variable being declared/used. the template has dynamic content funtions jquery extentions declared such: window.theme = {}; (function(theme, $) { // function }).apply(this, [window.theme, jquery]); then in seperate file initialized example: (function($) { 'use strict'; if ($.isfunction($.fn['themepluginanimate'])) { $(function() { $('[data-plugin-animate], [data-appear-animation]').each(function() { var $this = $(this), opts; var pluginoptions = $this.data('plugin-options'); if (pluginoptions) opts = pluginoptions; $this.themepluginanimate(opts); }); }); } }).apply(this, [jquery]); the bit confusing me is: var $this = $(this), opts; it understanding googling way of assign...

postgresql - How to call a procedure as part of SQL statement using psycopg2 -

how go executing following insert using psycopg2? insert file (name, volume) values ('foo', (select id volume volume.name='bar')); this of course not work : cursor.execute("insert file (name,volume) values (%s,%s)","foo","(select id volume volume.name='bar')") select id volume volume.name='bar' replaced call stored procedure : lookup_vol_id('bar') thanks you use insert...select form of insert , e.g.: insert file (name,volume) select 'foo', (select id volume volume.name='bar'); or if name , column columns in table, in order, can leave out column names entirely: insert file select 'foo', (select id volume volume.name='bar'); either sql string can passed cursor.execute (without semicolon). as aside, looks perhaps volume column should renamed volume_id , since it's id column volume table.

Ruby on Rails choosing wrong controller action -

today came across strange (and inconvenient) ruby on rails behavior persistent combing of net did not yield satisfying answer to. note: translated method , route names easier read in english, , hope did not introduce inconsistencies. situation environment ruby on rails 4.2.0 executing under ruby 2.0 (also tested under ruby 2.2.0) relevant code consider controller these actions, among others: class assignmentscontroller < applicationcontroller def update ... end def takeover_confirmation ... end end routes.rb since use lot of manually defined routes, did not use resources in routes.rb. routes in question defined follows: ... post 'assignments/:id' => 'assignments#update', as: 'assignment' post 'assignments/takeover_confirmation' => 'assignments#takeover_confirmation' ... the relevant output of rake routes : assignment post /assignments/:id(.:format) assignments#update assignments_takeover_conf...

Connecting to Cassandra with Spark -

first, have bought new o'reilly spark book , tried cassandra setup instructions. i've found other stackoverflow posts , various posts , guides on web. none of them work as-is. below far get. this test handful of records of dummy test data. running recent cassandra 2.0.7 virtual box vm provided plasetcassandra.org linked main cassandra project page. i downloaded spark 1.2.1 source , got latest cassandra connector code github , built both against scala 2.11. have jdk 1.8.0_40 , scala 2.11.6 setup on mac os 10.10.2. i run spark shell cassandra connector loaded: bin/spark-shell --driver-class-path ../spark-cassandra-connector/spark-cassandra-connector/target/scala-2.11/spark-cassandra-connector-assembly-1.2.0-snapshot.jar then should simple row count type test on test table of 4 records: import com.datastax.spark.connector._ sc.stop val conf = new org.apache.spark.sparkconf(true).set("spark.cassandra.connection.host", "192.168.56.101") val sc = n...

java - Array result into an array -

i trying put results of array new object array cant seem work out how. i first create chessboard array 10*10 , put word hello elements. i create loop go through elements create 10*10 matrix of array holds, in case "hello". output called result1 i want put elements of result1 object array called rowdata[][]. array of go into jtable jtable table = new jtable(rowdata, columnnames); string [][] chessboard = new string[10][10]; (int row = 0;row<=9;row++){ (int col = 0; col <=9; col++){ chessboard[row][col] = "hello"; } } string result1 = ""; (int row1 = 0;row1<=9;row1++){ (int col2 = 0; col2 <=9; col2++){ result1 += chessboard[row1][col2]; } result1 += "\r\n"; } system.out.format(result1); object rowdata[][] = {the result1 each element of new object array}; you can pass string array -- no need new object[][] : jtable table = new jtable(chessboard, columnnames); an array of s...

interface - Java Multiple Inheritance without Source Code -

i have class called thing , class called robot . thing has public void setblocksexit() . robot has methods desire. i have extended robot want setblocksexit() thing . make interface has setblocksexit() , make class like: public class c extends robot implements blockexit {} the problem don't have access source code thing , robot . using educational package 'becker.jar' , of code compiled can't access extract interfaces. options? your options following: extend thing , have reference robot delegate robot methods to. extend robot , have reference thing object delegate setblocksexit calls to. create fresh class , have reference robot , reference thing , delegate calls these 2 objects. if you're using ide such eclipse can "extract interfaces" , generate delegate methods automatically. option 1: class c extends thing { final robot robot; public c(robot robot) { this.robot = robot; } public int...

cassandra - Load balance solr search -

i trying implement search in datastax cassandra using solr. have 2 nodes running both cassandra , solr. able perform solr search using solrj. have hardcoded solr url of 1 of node. know configuration/code change need change solr nodes can chosen directly. at stage, reading solrurl external file , passing argument httpsolrserver. httpsolrserver solrserver = new httpsolrserver(solrurl); external file contains solrurl solr.url=http://192.168.100.12:8983/solr/ also improvements can existing approach? you can use lbhttpsolrserver (remember: use querying), allows provide several servers solrj use distribute queries. if have solr cloud cluster, can use zookeeper-aware server in solrj queries automagically distributed. third, can set regular http load balancer (such haproxy, varnish, etc.) distribute requests , handle new servers coming online , servers disappearing. you read random line in file instead of 1 specific server, or use separator configuration line , spli...

stream - New to C++ and wondering what getline() and cin are doing in my code -

#include <iostream> #include <string> using namespace std; void computefeatures( string ); int main(int argc, const char * argv[]) { string name; cout<< "please enter full name" << endl; cin >> name; cout << "welcome" << name << endl; cout << "please re-enter full name: "; getline(cin, name); cout << "thanks, " << name << endl; return 0; } the output this: please enter full name john smith welcomejohn please re-enter full name: thanks, smith i guess question why cin print out first name , why getline() print second name. there way print both? cin takes first word it's input , second 1 separated space waiting in input buffer. getline() gets last name automatically , doesn't wait user input. you should use getline(cin,name) if want both first , last name in string variable name.

html - make h2 text underline when hovering over image -

jsfiddle.net/pxojrb1o/ hello, i'm trying make 'retro products' text underline when hover on green picture. if put green picture in h2 tag, misaligns. can help? the html: added class h2 <h2 class="products"><a href="products.html">retro products</a></h2> the css .home-featured-class:hover .products { text-decoration: underline; } http://jsfiddle.net/pxojrb1o/3/ for more information see thread: how affect other elements when div hovered

email - Will one bad address stop delivery to good address when sending to multiple addresses via Mailgun -

i sending emails webapp using javascript->firebase->zapier->mailgun. works. want send same (not customized each recipient) email 2 or 3 addresses. trying decide if should send multiple emails or send 1 email multiple addresses (separated commas) in "to:" field. 1) if send 1 email multiple email addresses, 1 bad email address (properly formatted, not deliverable) prevent other email addresses receiving email? 2) answer different if used multiple email addresses in "bcc:" field? 3) lastly, if 1 bad email address not prevent delivery addresses, there performance reason choose between sending multiple emails or sending 1 multiple addresses in "to:" or "bcc:" field? (i'm not worried few seconds or minutes delay non-time-critical emails, i'm more concerned about being citizen mailgun, i'm free-tier user.) thanks in advance help.

matlab - error while loading shared libraries: libboost_system-mt-1_49.so.1.49.0 -

i'm beginner matlab , c++ user , trying run code provided me. code the error is: /path/folder: error while loading shared libraries: libboost_system-mt-1_49.so.1.49.0: cannot open shared object file: no such file or directory the folder exists , file it's trying call in there. don't understand error saying libboost library? if need provide of code calls folder, let me know. not sure how info provide. i assume have solved problem. see might still useful put hints here see many posts asking similar questions without being answered. the solution add library path system environment variables. unfortunately not set outside matlab (i mean edit .bashrc in ubuntu etc.). the correct way use matlab's functions of reading , setting environment variables: getenv() , setenv(). suppose library file located at: /home/username/lib/ , need write in matlab scripts: setenv('ld_library_path',[getenv('ld_library_path') ';/home/usern...

javascript - ng-click on <tr> doing nothing -

i have consulted these related articles, presented solutions not work: clickable bootstrap row angular adding parameter ng-click function inside ng-repeat doesn't seem work angular ng-click not working in div here plunkr:: http://plnkr.co/edit/kha6makdbtry0xttc6wp?p=preview <body ng-controller="mainctrl"> <table> <caption>troubles ng-repeat , ng-click</caption> <thead> <tr> <th>name</th> <th>occupation</th> </tr> </thead> <tbody> <tr ng-repeat="employee in employees" ng-click="alert('hi')"> <td>{{employee.name}}</td> <td>{{employee.occupation}}</td> </tr> </tbody> </table> var app = angular.module("plunker", []); app.controller("mainctrl", function($scope) { $scope.employees = [ { name: "john doe", occupat...

iOS Storyboard clobbering variables when pushing scenes? Why? How should it be done? -

i have following storyboard configuration in ios project. storyboard1->navcontroller-scenea->stoyboard2/initialview storyboard2->sceneb->scenec -> "show" segue scene loads storyboard , pushes onto navigation controller. scene has controller instances class x. scene b uses default uiviewcontrooler class. scenec has controller instances class y. the implementations both classes follows //classx.h// @interface classx : uitableviewcontroller //classx.m// @implementation classx nsarray* model; //.. @end //classy.h// @interface classy : uitableviewcontroller //classy.m// @implementation classy nsarray* model; //.. @end the problem when try load scene c, tries use field called "model" in implementation– gets field of model scene reason. why , how should correct it? you should make model property of classes rather declaring them do. creating global variables. or declare them inside {} after @implementation make sure varia...

c++ - expected type-specifier before '...' token -

expected type-specifier before '...' token this code template< typename t, int t_nfixedbytes = 128, class allocator = ccrtallocator > class ctempbuffer { public: ctempbuffer() throw() : m_p( null ) { } ctempbuffer( size_t nelements ) throw( ... ) : <---error here m_p( null ) { allocate( nelements ); } ... } now if rid of throw(...) in above statement error resolved.any suggestions on why mingw doesnt throw(...) here ? actually, throw(...) not standard c++ syntax, msvc++ specific extension. means function can throw exception, equivalent having no exception specification @ all, can safely remove it.

wpf - How to bind only to the base of a Path? -

let's assume have binding: <textblock text="{binding mybaseproperty.mysubproperty}" /> is possible tell wpf listen changes mybaseproperty ? , whenever mybaseproperty changes (re-)query mysubproperty of mybaseproperty ? the background behind question is: have view model contains property ( mybaseproperty ) pointing instance of class not implement inotifypropertychanged interface. datacontext textblock implement inotifypropertychanged interface , can therefore inform view changes mybaseproperty . if great if found accomplish kind of base-with-path-binding way can around valueconverters , extending viewmodel inotifypropertychanged -backed property wrappers mysubproperty . this fix you, you can listen mybaseproperty changed event , when happens .. you can force binding updates -- bindingoperations.getbindingexpressionbase(_mytextbox, textbox.textproperty).updatetarget();

asp.net - Dynamically set the WSFederationAuthenticationModule.Issuer and Realm property -

i want avoid having node in web.config , hence set issuer , realm dynamically in onauthenticaterequest event. error "system.argumentexception: id0006: input string parameter either null or empty. parameter name: issuer" i error before onauthenticaterequest event raised. missing here? afaik, need provide configuration before start authenticating. can done in web.config. can tap event federatedauthentication.federationconfigurationcreated += federatedauthenticationonfederationconfigurationcreated; to start providing own configuration.

c# - TDD in the new Visual Studio vNext/2015 -

Image
i trying out new visual studio 2015 ctp 6 , first thing notice new asp.net 5 project there isn't option create test project (it's disable)... now, vs2015 introduced smart unit tests not suitable tdd , idea generate unit tests existing code. probably exists nuget-package implement tdd find weird, believe, it's not longer come out of box. so, how implement tdd in new visual studio 2015 ctp6? update 3/22/2015 here links related unresolved issue: getting started xunit.net , asp.net 5 how can run xunit unit tests vs2015 preview? great question. here settled on. wouldn't call ideal , maybe there better way not aware of. 1) use xunit - if @ aspnet repository on github, see if not tests written xunit. 2) visual studio ide support xunit not yet available aspnet5 based tests. must run them command prompt. link discusses how set , run unit tests aspnet5 http://xunit.github.io/docs/getting-started-aspnet.html 3) complicating matters, relea...

Netty lags for a few seconds before shutting down -

iv been doing network programming while , converted 1 of projects netty. iv been bothered lot fact unlike original program, client freeze 3-5 seconds before closing, enough make me end force terminating everytime because don't want wait it. normal netty? doing wrong? main method: public static void main(string[] args) throws exception { final sslcontext sslctx = sslcontext.newclientcontext(insecuretrustmanagerfactory.instance); eventloopgroup group = new nioeventloopgroup(); try { bootstrap b = new bootstrap(); b.group(group) .channel(niosocketchannel.class) .handler(new networkinitializer(sslctx)); // start connection attempt. ch = b.connect(host, port).sync().channel(); //sends clients name server askname(); //loop simple gl stuff , gameplay updating, posted below while(running){loop(); if (display.iscloserequested()){ running = false; if (las...

MYSQL: update record random 2 fixed char -

i update record on field want fill random either y or n currently using: update table1 set field1=( substring(md5(rand()) y n) which not working update table1 set field1 = case floor(1 + rand()*2) when 1 'y' else 'n' end;

r - Applying functions to vector elements to make rows in a new dataframe -

i've got interesting problem , have no idea begin -- in fact, wasn't sure how title question! want apply functions elements of dataframe , use these make new rows in new dataframe. example, suppose have dataframe df1 gives x , y data various state s: df1 <- data.frame(state=c("al","ak"), x=c(1,3), y=c(2,4)) what start first state al , , make new dataframe df2 with 3 rows, new values of df2$x calculated using 3 different functions give, example: df1$x , df1$x - 1 , , df1$x + 1 . likewise, want similar thing new values of df2$y , in example calculated df1$y , df1$y * 0.5 , , df1$y * 0.5 . then, proceed next state . end result should be: df2 <- data.frame(state=c("al", "al","al","ak","ak","ak"), x=c(1,0,2,3,2,4), y=c(2,1,1,4,2,2)) does know how might approach this? have no idea begin... can imagine kind of loop, i'm hoping there's more elegan...

python - Pyramid get route name by URL (String) -

i trying figure out if possible route name in pyramid url (not request) url string url. lets have request , path /admin/users/manage. know can match route name route_name of request how can route name of /admin , route name of /admin/users? introspector.get('routes', 'admin') works route path of admin route possible work other way around? introspector.get('routes', 'admin/users') basically there way route_objects of routes under admin/ prefix? introspector looked loop thru routes not query specific routes within within path. i had dig pyramid source code solution. also, clarify: solution provide correct route_name supplied route_url . if have my_route route name , /foo/bar url, set following my_url variable "/foo/bar" , returns "my_route" from pyramid.interfaces import iroutesmapper @view_config(...) def call_route_by_url(request): routes = request.registry.queryutility(iroutesmapper).get_rout...

Numpy create boolean array from checking if an array index equal a letter -

i have numpy array of letters 'x' , 'y' . how make boolean array returns true if index == 'x' , false otherwise? in [1]: import numpy np in [2]: = np.array(['x', 'y', 'y', 'x', 'y']) in [3]: == 'x' out[3]: array([ true, false, false, true, false], dtype=bool)

scheme - Why am I getting this body error? -

every time run code, error message: "define: expected 1 expression function body, found 1 part." have tried again , again fix this, haven't found solutions. have idea of how can fix it? sorry long code, figured should include or wouldn't make sense. thanks! (define mt (empty-scene 50 50)) ; polygon 1 of: ; – (list posn posn posn) ; – (cons posn polygon) ; nelop 1 of: ; – (cons posn empty) ; – (cons posn nelop) ; polygon -> image ; adds image of p mt (define (render-polygon p) (local [;polygon -> posn ; extracts last item p (define (last p) (cond [(empty? (rest (rest (rest p)))) (third p)] [else (last (rest p))]))] [;image posn posn -> image (define (render-line im p q) (add-line im (posn-x p) (posn-y p) (posn-x q) (posn-y q) "red"))] [;nelop -> image ;connects posns in p in image (define (connect-dots p) (cond [(empty? (rest p)) mt] ...

javascript - Jquery .ajax() SyntaxError: Unexpected token N -

i have following code displays form , supposed submit form data via jquery .ajax() saved mysql database. on submitting form, error syntaxerror: unexpected token n . mean , how can resolve it? html: <form class="well" id="jquery-submit-ajax" name="jquery-submit-ajax" method="post" action="ajax.php"> <div class="floatleft"> <input type="text" class="span7" name="yourname" placeholder="your name"> </div> <div class="floatleft"> <input type="text" class="span7" name="yournumber" placeholder="your number"> </div> <input class="btn btn-primary" type="submit" value="schedule"> <br /><br /> <div class="alert alert-success hide"> <p>form submitted! data sent below:</p> <div id="success-output" c...

java - Raw data parsing -

i have byte array length 18 following structure: unsigned int a; unsigned int b; unsigned short c; unsigned long d; i know don't have unsigned * data type in java. after searching form web, find should use bigger data type store value. example, should use int store unsigned short variable. i have 2 questions. first 1 how parsing byte array value array variable using. second 1 how handle unsigned long variable? know may biginteger can me not sure how work out. there @ least 2 practical ways decode data. either byte-fiddling manually (assuming little-endian): a = (array[0] & 0xff) | ((array[1] & 0xff) << 8) | ((array[2] & 0xff) << 16) | ((array[3] & 0xff) << 24); // analogously others // "& 0xff"s stripping sign-extended bits. alternatively, can use java.nio.bytebuffer : bytebuffer buf = bytebuffer.wrap(array); buf.order(byteorder.little_endian); = buf.getint(); // analogously others there are, of course, inf...

java - Why is this string timer for delaying not working? -

so have string timer import javax.swing.timer; import java.awt.event.*; public class delay implements actionlistener { public void delay(int time) { timer t = new timer(500, this); t.start(); } @override public void actionperformed(actionevent e) { } } delays 500 ms (there no action performed), however, when call it delay d = new delay(); for(char c : dialogue.tochararray()){ g2.drawstring(string.valueof(c),x,y); d.delay(5000); //here delay x += 10; if (x > 90){ x = 75; y = y + 20; } } there no delay between writing letters. why this? thank you! ...

postgresql - Why postgres function so slow but single query is fast? -

i have function employee in 'create' status. create or replace function get_probation_contract(accountorempcode text, fromdate date, todate date) returns table("empid" integer, "empcode" character varying, "domainaccount" character varying, "joindate" date, "contracttypecode" character varying, "contracttypename" character varying, "contractfrom" date, "contractto" date, "contracttype" character varying, "signal" character varying) $$ begin return query execute 'select he.id "empid", rr.code "empcode", he.login "domainaccount", he.join_date ...

jquery - Right click not working on web2py site -

somehow managed break right click on entirety of site. site powered web2py, have done heavy modifications layout.html extended other views. i don't know start far posting code, i'm looking ideas have broken right click. else appears working fine. right clicking on other sites works fine not mouse... also, when right clicking on <a class"btn"> appears "depress" on right click, onclick not triggered knows not normal click. no exceptions being thrown in js console. i know poor question, ideas? has ever happened before? figured out. after literally stripping view to: <html> </html> and still no right click, figured in web2py. navigating appadmin interface , still having no right click confirmed that. restarting web2py server fixed problem. weird bug. guess downvotes cool too.

Using Javascript In Dynamically Embeded HTML? -

how use, or correctly use, javascript in dynamically embedded pages/content? when event occurrs loading php/html page html element. javascript works fine on outter page, or page content gets loaded into, not work on page being loaded. here request function: function sendservicerequest(file, nvpsenddata, successcallback, failcallback) { $.ajax({ type: "post", url: file, data: nvpsenddata, datatype: 'html' }).success(function(data, status) { console.log(".done"); console.log("return ajax status: " + status); //console.log("success data: " + json.stringify(data)); successcallback(data, status); }).fail(function(data, status, error) { console.log(".fail"); console.log("return ajax status: " + status); //console.log("return data: " + json.stringify(data)); failcallback(data, status, error); });...

Whats the Java EE package naming convention? -

i've been trying grasp better understanding of features belong java ee specification , standard java features of new application i'm working on, , i've noticed package structure seems bit muddled. an example, take packages: import javax.enterprise.context.sessionscoped; import javax.inject.named; both of these enterprise features 1 make s obvious existing in enterprise package. in java ee api specification here notice of features held within enterprise package. my guess of packages around before ee edition of java, kept structure backwards compatibility? still.. seems little odd. some apis in javaee stack not specific javaee , usable in javase. example cdi provides dependency injection, have in question javax.inject.named , can used in javase application well.

java - Is it possible to use JMH as a maven validation check? -

i have performance critical piece of code protect maven build step, i.e. jmh run , check performance hasn't degraded local changes. how can check such degradation using jmh? i've found few related links: perf testing in ci c++ ci perf metrics chapter: perf in ci ci junit , contiperf (uses @required() annotation) i've achieved automated performance testing before (though not java, , not in ci environment). 1 key point note never run absolute, since machine benchmark running on can vary. bogomips or test-dependent type of reference can used relative comparison. benchmark measured multiple of reference time, upper , lower bounds. while typically wary of benchmark slowing (degrading), it's important check upper bound well, may indicate unexpected speedup (better hardware support), should indicate per-system/architecture bound needs checked. i suggest build set of runner options via optionsbuilder , call run on within junit test. while author...

javascript - NameError: name "something" is not defined - Web App using Angular JS and Python -

i developing web application using python , angular js. using bottle python framework web server. my files below: app.py import json import os bottle import run, route, template, static_file, request, redirect, get, post import json #import mysqldb ####################### # static file servers # ####################### rootpath = '' @route('/assets/<filepath:path>') def serve_static(filepath): return static_file(filepath, root='static/') ############## # handlers # ############## @route('/') def root(): return template('index.html') def main(): run(host='0.0.0.0', port=55500, debug=true, reloader=true) if __name__ == '__main__': main() index.html <!doctype html> <html ng-app="astra"> <head> <title> astra db </title> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/a...

algorithm - Partition Frisbees C++ -

we have set f of n frisbee's in 2d. want partition f 2 subsets f1, , f2 no 2 frisbee's intersect in each respective subset. our function takes in input so: (x_j, y_j) centre of j-th frisbee, , rad_j radius of j-th frisbee. output should s_0 s_1 ... s_n-1, s_j = 1 if j-th frisbee in f1 , s_i = 2 if j-th frisbee in f2. if cannot partition f, return 0. ideally, algo should computed in o(n^2) time. i figured should use type type of matrix representation of graph, don't think need need construct graph, think bfs/dfs useful, i'm stuck on how elegantly in o(n^2). coding in c++ way. you on right track graph search. here's c++11, o(v^2), depth first search solution uses o(v+e) space. the dfs o(v+e) in time, generating adjacency lists o(v^2) obvious way. #include <iostream> #include <vector> #include <cmath> using namespace std; struct frisbee { double x; double y; double radius; }; int dfs(const vector< vector<int> ...

Java regex not matching, regex looks OK -

the following returns no matches: string patternstr = "((19\\d{2}|20\\d{2})-([0-2]\\d{2}|3[0-5]\\d)-(([0-1]\\d|2[0-3])[0-5]\\d[0-5]\\d))"; string fullpath = afile.getabsolutepath(); // fullpath should expand this: "/home/user1/2013-023-135159_abcd_001/file.txt" pattern p = pattern.compile(patternstr); matcher m = p.matcher(fullpath); if (m.matches()) { system.out.println("matches found"); } it should match date portion, 2013-023-135159. tested online , regex looks ok. you need use: m.find() instead of: m.matches() as regex matching parts of input string not expected m.matches() regex demo

mysql - How to download a nutrition contents from USDA database -

i doing website in users can add own recipes, want calculate nutrition values added recipes. after searching have found ndb.nal.usda.gov/ provides nutrition details food items, how can download details food items. can me how download database contents in usda. i've taken @ website , opinion. the webpage checking nutrient levels uses simple get request. meaning say, can specify variables in url string , obtain results. for example: http://ndb.nal.usda.gov/ndb/nutrients/report/nutrientsfrm?max=1000&offset=0&totcount=0&nutrient1=255&nutrient2=203&nutrient3=291&subset=0&fg=&sort=f&measureby=m` you can see there variables nutrient1=255 , etc. have loop through different variables values , send necessary queries via curl example. note can conveniently add max=n n number of results want show on page. the next step sieve out useful information in html returned. can consider using tools beautifulsoup you.

excel - Limiting Target to a Range of Noncontiguous Cells -

Image
i have formatted worksheet allows me to: double-click on blank cell , background color turns red , gives value of "not recvd". double-click again , turns orange "partial" value. double-click again , turns green "recvd" value. double-click again , turns blue "na" value. double-click again , goes blank. i able accomplish of tutorials , online searches. want add couple more features spreadsheet haven't been able find/figure these out. features need inserted existing code are: assigning specific cell/range (as opposed every cell on worksheet) ability of changing color/value double-click described above. there 120 cells need designate such. assuming none of cells blank, need insert equation calculates percentage of 120 cells not blue/"na" red/"not recvd"; orange/"partial"; , green/"recvd". these percentages located on same worksheet , know how designate specific cells/range well. i this:...