Posts

Showing posts from July, 2011

ruby on rails - Ajax call triggering base URL in Apache + Passenger integration mode -

i trying configure multiple rails apps through httpd configuration file. working fine ajax calls triggering wrong url, example if application configured http://localhost/helloapp/ , has ajax call "/say_hello" trying "localhost/say_hello" instead of "localhost/helloapp/say_hello". below httpd configuration file located @ '/etc/httpd/conf/httpd.conf '. using centos. <virtualhost *:80> servername localhost <directory /var/www/html > allow options -multiviews # uncomment if you're on apache >= 2.4: #require granted </directory> alias /helloapp /var/www/html/hello_application/public <location /helloapp> passengerbaseuri /helloapp passengerapproot /var/www/html/hello_application </location> <directory /var/www/html/hello_application/public> # multiviews must turned off. allow options -multivi

javascript - jquery dialog widget not work with onclick button in row table -

Image
i have table image bellow create query databases, each row have button want when onclick prompt dialog box (i use jquery dialog widget) this php code create table while ($fetch_dbsi_mhsw=mysql_fetch_array($query_dbsi_mhsw)) { $no++; echo" <tr> <td>$no</td> <td>$fetch_dbsi_mhsw[nim]</td> <td>$fetch_dbsi_mhsw[name]</td> <td style=\"text-align: center;\"><input name=\"bt_tambah_calon_wisudawan\" id=\"bt_tambah_calon_wisudawan\" type=\"image\" src=\"buttontambah.png\" alt=\"tambah\" align=\"middle\" width=\"20\" height=\"20\" /></td> </tr>";} and jquery code $(document).ready(function(){ $("#bt_tambah_calon_wisudawan").click(function(){ var value1 = $(this).closest('tr').find('td:eq(1)').text(); var value2 = $(this).closest('tr').find('td:eq(2)').text(); // he

javascript - How to fix this calculate script which has "NaN" in cost box? -

i have calculate script cost, have little problem when try empty price box, there "nan" in cost box. i not know problem. have made following changes: digitsval=isnan(digitsval)?0:digitsval; became var digitsval=isnan(digitsval)?0:digitsval; , first code working, second try empty in cost box, there still "nan" in cost box. how fix calculate script ?. there solution script? example : <!doctype html> <html> <head> <meta charset="utf-8"> <title>berkelilingkesemua.info</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> </head> <body> <script> $(document).ready(function() { var price=$('#price'), phone=$('#phone_number'), digits=$('#digits'), sum=$('#sum'); function calculatesum() { var digitsval=parseint(phone.val().substr(-2)); digitsval=isna

jquery - replace text between rangy position -

i have keyup event editor.on('keyup', function(e) { selection = rangy.getselection() start = selection.anchoroffset; end = selection.focusoffset; // start , end give position consider (2, 4) // 2 start position // , 4 end position }); i replace text between position 2 , 4. how can make possible through rangy. editor contenteeditble container. consider following example this testing text now caret position after th want replace at instead of is . have positions in hand (3,4)

java - Sort arraylist of objects by one of their properties (double value) -

this question has answer here: how sort arraylist of objects using 1 common property 2 answers sorting double value of object within arraylist 3 answers i'm attempting sort arraylist of bountyobject s property .getamount() returns double .. i've looked @ similar question on here , it's not pointing me in right direction, explain how sort this: list<bountyobject> sortedlist = new arraylist<bountyobject>(); (bountyobject bo : bounties) // bounties original list of unsorted objects { // sort them sorted list bo.getamount() - highest lowest value } any appreciated, thank you using collections, can collections.sort(bounties, new comparator<bountyobject>() { @override public int compare(bountyobject bo1, bountyobject bo2)

Ansible get_url fails to download a protected by basic auth -

i'm trying download protected file using http remote server get_url module username password not seem passed in request , task therefore fails. i'm using ansible 1.9.2 here get_url definition i'm using: - name: downloading artifact get_url: url: "http://myserver/somefile.tar.gz" dest: "/home/jdoe/somefile.tar.gz" url_username: "jdoe" url_password: "mysecret" mode: 0600 here error get: failed: [myserver] => {"dest": "/home/jdoe/somefile.tar.gz", "failed": true, "response": "http error 403: forbidden", "state": "absent", "status_code": 403, "url": "http://myserver/somefile.tar.gz"} msg: request failed fatal: hosts have failed -- aborting now, tried download file using curl , works. any appreciated i've struggling 2 days. you can use uri module: ---

angularjs - Angular filter by array of values -

i trying filter list of items using array of values. far i've been able filter numerous fields in table, haven't been able filter using numerous values within 1 column of table. plunker shows filter object being used $scope.filters = { user:{ name:"john" }, status:{ name: "approved" } }; however, trying accomplish generate filtered list based off filters object: $scope.filters = { user:{ name:"john" }, status:{ name: ["approved", "for review"] } }; basically want list of johns status name either "approved" or "for review". is possible accomplish using angular's "filter" filter, or job custom filter? you need use custom filter this. or filter status array separately filtering user name: $scope.filtered = $filter('filter')($scope.users, {user: $scope.filters.user}).filter(function(user) { return $scope.filters.status

r - Error in eval(expr, envir, enclos) in apply(boxcox) -

i have matrix of 650 columns , each column want find optimal lambda boxcox transformation. want use function boxcox mass package, outputs 2 lists: $x$ list of possible lambdas, $y$ list of log-likelihood values given lambdas. optimal lambda 1 scores highest likelihood. i thought following piece of code work: library(mass) optimal.lambda1 <- apply(mymatrix, 2, function (d) { boxcoxlist <- boxcox(lm(d~1), lambda=seq(-5,5,by=.1), plotit=f) p <- boxcoxlist$x[which.max(boxcoxlist$y)] return(p) } ) unfortunately same error: error in eval(expr, envir, enclos): object 'd' not found a similar error occours if try lapply version of it: library(mass) optimal.lambda1 <- lapply(1:ncol(mymatrix), function (d) { boxcoxlist <- boxcox(lm(mymatrix[,d]~1), lambda=seq(-5,5,by=.1), plotit=f) p <- boxcoxlist$x[which.max(boxcoxlist$y)] return(p) } ) also, tried isolate object function optimal.lambda2 <- function (d) { boxcox

.net - C# Enum deserialization with Json.Net: Error converting value to type -

i'm using json.net serialize/deserialize json apis. the api response have integer values map enum defined in application. the enum this: public enum myenum { type1, type2, type3 } and json api response has following: { "name": "abc", "myenumvalue":"type1" } sometimes api returns value myenumvalue field that's not defined in enum, this: { "name": "abc", "myenumvalue":"type4" } that throws exception: error converting value "type4" type 'myenum' is there way handle error assigning default value or avoid application crash? let's have following json string: [ { "name": "abc", "myenumvalue": "type1" }, { "name": "abcd", "myenumvalue": "type2" },

string formatting - Matlab textscan introducing additional rows with zeros or NaNs -

i'm trying read .dat file containing tens of thousands of rows, each of them looks like: 1.9681968 0 0 19.996 0 61 100 1.94e-07 6.62e-07 2.330233 0 0 19.996 0 61 100 1.94e-07 6.62e-07 2.6512651 0 0 19.997 0 61 100 1.94e-07 6.62e-07 3.5923592 0 0 19.998 0 61 100 1.96e-07 6.62e-07 now example, i'm trying read with data = textscan(fid, %.9f%*f%*f%.9f%*f%*f%*f%.9f) where string format depends on column want read. when reading big files, first column of cell array 'data' become 1.96819680000000 0 2.33023300000000 2.65126510000000 0 3.59235920000000 0 and rest of columns show nans instead of zeros. additional rows many rows in data file, arrays factor 2 larger. i guess has errors when reading doubles, since this problem doesn't occur if try read file strings . but if possible, not read strings , have convert doubles. any ideas? i think is

Which weblogic.xml file should I edit? -

i'm trying fix problems web app running on weblogic 12c, , i've seen many users give advice edit file called weblogic.xml this seems easy enough, except there multiple files called weblogic.xml in directories. 1 supposed edit? specifically, i'm trying fix in this question . the weblogic.xml file found under web-inf directory along side web.xml file.

javascript - Create array of available time slots between two dates -

i weak on front end work , need little here. i developing basic form gives users available schedule options booking appointment during next 3 days inclusive. so have far written: var today = new date(); var lastday = new date(today); lastday.setdate(today.getdate() + 4); var daterange = getalldays(today, lastday); function getalldays(today, lastday) { var s = new date(today); var e = new date(lastday); var = []; //this gets start time days while (s < e) { //if day saturday hours change if(s.getday() == 0) { //if sunday skip } else if (s.getday() == 6) { //push start onto array a.push(setworkinghours(s, '10')); //push end onto array a.push(setworkinghours(s, '20')); } else { //pus

python - Google Cloud Storage - PUT Fails on Development Server -

on dev server, google cloud storage fails save files during put command. this same command works fine on production. response headers (see below) have little debug information. have plenty of space on hard-drive, , have been running dev server administrator, should have necessary permissions. any ideas? below relevant traceback (i changed bucket name): info 2015-08-07 14:14:41,415 module.py:809] default: "put /_ah/gcs/bucket/ipr2013-00219%2c%20no.%2016%20institution%20decision%20-%20decis_2015-08-07%2018-14-25.100000.pdf?upload_id=encoded_gs_file%3azg9ja2v0ywxhcm0tzgv2l0lqujiwmtmtmdaymtksie5vliaxnibjbnn0axr1dglvbibezwnpc2lvbiatierly2lzxziwmtutmdgtmdcgmtgtmtqtmjuumtawmdawlnbkzg%3d%3d http/1.1" 500 - traceback (most recent call last): file "project\libs\cloudstorage\storage_api.py", line 794, in __exit__ self.close() file "project\libs\cloudstorage\storage_api.py", line 787, in close self._flush(finish=true) file "project\

svn - Temporarily ignore subversion ignore settings -

i have bunch of files want ignore have file extensions listed in global ignore on folder properties ignore list. however, have one-time need see unversioned files in working copy, want ignore. can't figure out easy way without clearing out global ignore, , removing ignore folder properties, doing check, , adding ignore property , global string in. is there easy way see list of (and commit) unversioned files in working copy no matter if should ignored or not? why don't use --no-ignore flag while doing svn add ? --no-ignore : disregard default , svn:ignore property ignores try doing like: svn add --force --no-ignore . note have careful files added.

debian - Paho-mqtt.client can connect to digital-ocean mqtt server but cannot subscribe -

please me this. have spent 2 days on no success. i using paho-mqtt python client example. have hivemq mqtt server on digitalocean debian server. client example code in python can connect , subscribe digitalocean server if run on laptop or on linux debian machine. but. here but. when run client on digitalocean server (where hivemq mqtt server is) can connect , not subscribe! used both localhost , server ip, still no luck. however same client code running on digitalocean server (along hivemq mqtt server) can connect , subscribe external servers such m2m.eclipse.org. how know doesn't subscribe connects? well, returns rc:0 on connect callback, not return on subscribe callback. (it should return 'subscribe: 1' etc) in conclusion: clinet can connect cannot subscribe when running on same machine server. the problem seems sub.py example (from here: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.python.git/tree/examples/sub.py ) seems incorrect. not execute

Simple PHP Form Not Working - 500 Internal Server Error - Parallels Plesk Panel 9.5 -

i'm stumped why contact form returns 500 internal server error. 99% sure code immaculate. i using parallels plesk panel 9.5 hosting admin control panel. have found log manager, , checked in both access logs , error logs. in error logs there entries [error] [client 162.247.90.74], [error] [client 184.164.146.26] file doesn't exist, , [error] [client 216.21.233.2] says cannot create or spawn child process. my html form on contact.html: <form class="form-horizontal" method="post" action="mailer.php" class="form-horizontal" role="form"> <div class="form-group"> <label for="name" class="col-sm-2"><small>name</small></label> <div class="col-sm-10"> <input type="text" class="form-control" id="inputname" name="inputname" placeholder="enter full name" requir

django - Horizon fails to start -

i've followed guide: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/identity_management_- keyrock -_installation_and_administration_guide when run server get: traceback (most recent call last): file "manage.py", line 23, in <module> execute_from_command_line(sys.argv) file "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() file "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 261, in fetch_command commands = get_commands() file "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 107, in get_commands apps = settings.installed_apps file "/usr/lib/python2.6/site-packages/django/conf/__init__

python - ImportError: No module named base in Spyder IDE -

i using spyder ide. running script once , ok. run second time , appears error. in script use following packages: from __future__ import division import numpy np import matplotlib.pyplot plt import scipy.optimize import cprofile sympy import solve,exp sympy.abc import y pil import image import dicom bisect import bisect_left,bisect_right import math import os import seaborn sns import scipy import pandas i don't know if has packages cannot fix it. here traceback: traceback (most recent call last): file "<ipython-input-5-a431862ce876>", line 1, in <module> runfile('/users/dkoimt0/spyder/swse.py', wdir='/users/dkoimt0/spyder') file "/applications/spyder-py2.app/contents/resources/lib/python2.7/spyderlib/widgets/externalshell /sitecusto mize.py", line 588, in runfile__umr__.run(verbose=verbose) file "/applications/spyder- py2.app/contents/resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py",

javascript - how to call python command from html page? -

i want call python command html page . code : <form class="form" action="" method="post" name="new-service" enctype=multipart/form-data> <div class="control-group"> <div class="controls"> <input id="search" name="search" type="text" placeholder="search.. eg: moto g" class="form-control input-xlarge search-query center-display" required=""> <!-- here want call python command or function --> </div> </div> </form> and python command : $ python main.py -s=bow here bow input box . use jquery send request python script on server handled cgi/fast cgi script or through wsgi (mod_wsgi apache) or mod_python (for apache too). your python script receive input using query strings. client side example: <html><head><title>tes

javascript - Creating multiple sessions with each new tab with chrome extension -

i'm trying create new session each new opened tab. if call "chrome.tabs.create" , hit same url create new session. example if hit 1 page , use cookies store cart when call "chrome.tabs.create" second time retrieves previous session , both tabs same thing. there way this? no, not really, not extension. you can open incognito tab, gives second session, can't open "another" incognito context until close first one. a chrome app can use webviews different partitions effect, cannot interact normal browsing. webview not yet available extensions , it's unclear when change. if need badly can try manipulating cookies chrome.cookies api.

javascript - How to filter information from an output that consists of "X": "Y", -

i'm working nodered , using twitter node. i'm trying figure out how reply users if tweet 'x'. the output consists of load of information comma separated , consist of "x": "y", as in "user": "sanderschaeffer", "tweet": "this tweet", "date": "01-02-2015", etc. how filter, preferably javascript or json, information contained "user"? output 'sanderschaeffer'? or bottom-line: how reply user nodered? :) apologies inconvenient title, don't know name of way of information output you can use node-red switch node filter. you can set act on msg.payload value , use contains option , enter text want match on box. this should allow tweets match through. want use function node craft suitable response. edit: to sending user id access within function node follows: msg.tweet.user.screen_name

bash - Linux reverse sorting giving wrong results -

i have data of following format: diplomat 9.35003521034e-07 golden 0.0 projection 5.75975635192e-06 harvey 9.25224016662e-08 omelianchuk 8.77038876791e-08 stern 6.23335680688e-08 insecurity 0.0 century 0.000814828405418 karadzic 0.0 vernon 5.56509185654e-08 music 0.0 therefore 0.000486949687357 diabetes 0.0 yahoo 0.0 meteorologist 6.80717342684e-08 aynsley-green 0.0 intake 0.0 morally 0.0 locker 0.0 colombia 0.0 mahela 1.08371146396e-07 i want sort data according values in second column. used linux command sort -r -g -t $'\t' -k2,2 i used -g generic sorting. still not giving me correct output. getting result out of order. the output got was: yahoo 0.0 vernon 5.56509185654e-08 therefore 0.000486949687357 stern 6.23335680688e-08 projection 5.75975635192e-06 omelianchuk 8.77038876791e-08 music 0.0 morally 0.0 meteorologist 6.80717342684e-08 mahela 1.08371146396e-07 locker 0.0 karadzic 0.0 intake 0.0 insecurity 0.0 harvey 9.25224016662e-08 gol

sql - Is there a faster alternative to "group by" aggregation in Netezza? -

this minimal query statement want execute. select count(*) temper_300_1 group onegid; i have "where" clauses go along though. trying build histogram query , determine number of elements particular "onegid". query takes 7 seconds on 800 million rows. suggest faster alternative or optimization. i trying plot heatmap spatial data consisting of latitudes , longitudes, have assigned grid id each elements, "group aggregation" coming out pretty costly in terms of time. you're not going faster group by , though current query won't display group item associated each count. make sure table distributed with select datasliceid, count(1) temper_300_1 group onegid; the counts should equal. if they're not, dba needs redistribute table on better distribution key. if is, ask dba create materialized view on specific column, ordered column. may see performance gains.

java - JBoss start stuck on Weld service -

after began using oci, jboss stuck when starting weld service. 15:28:14,948 info [org.jboss.weld.deployer] (msc service thread 1-4) jbas016008: starting weld service deployment abena-ear.ear 15:32:59,961 warn [com.arjuna.ats.arjuna] (transaction reaper) arjuna012117: transactionreaper::check timeout tx 0:ffff7f000101:-430b779d:55c4b259:d in state run 15:32:59,965 warn [com.arjuna.ats.arjuna] (transaction reaper worker 0) arjuna012095: abort of action id 0:ffff7f000101:-430b779d:55c4b259:d invoked while multiple threads active within it. 15:32:59,966 warn [com.arjuna.ats.arjuna] (transaction reaper worker 0) arjuna012108: checkedaction::check - atomic action 0:ffff7f000101:-430b779d:55c4b259:d aborting 1 threads active! 15:32:59,967 warn [com.arjuna.ats.arjuna] (transaction reaper worker 0) arjuna012121: transactionreaper::docancellations worker thread[transaction reaper worker 0,5,main] canceled tx 0:ffff7f000101:-430b779d:55c4b259:d 15:32:59,970 warn [com.arjuna.ats.arjun

makefile - Make error: missing separator -

i getting following error running make : makefile:168: *** missing separator. stop. what causing this? as indicated in online manual , common cause error lines indented whitespaces when make expects tab characters. correct target: \tcmd where \t tab wrong target: cmd

java - Reading with InputStream while using Scanner -

i want read client's inputstream in 2 different ways: 1: use scanner on inputstream read strings. 2: use inputstream object read file buffer. at first, want read text, gives me name , size of file, in case: "file:name:...", "file:size:...". when have information, inputstream should read file. problem is, try read file in " scanner.hasnextline() "-loop inputstream object causes inputstream.read() method return -1 or eos. have brought problem minimal size have answer me question: why read-method return -1 here: if (scanner.hasnextline()) { system.out.println(inputstream.read()); } as oracle documentation scanner.hasnextline() states, method does not advance scanner . means perpetually looking @ first line of file scanner , while advancing inputstream . means though scanner has next line, inputstream may not. appear walking off end of file inputstream . if not advance scanner along input stream, cannot k

c++ - Cuda error illegal memory referenced in devicesync and cudamemcopy -

in code create host variable h4_in = (double*)calloc(2 * countlog, sizeof(double)); h4_out = (double*)calloc(23 * countlog, sizeof(double)); coountlog variable denotes row size of 2d array(which implementing 1d array) //send data host in stat2 calculations (int count = 0; count < countlog; count++) { h4_in[count * 2 + 0] = prc[count]; h4_in[count * 2 + 1] = h_stat1out[count * 6]; } here how call cuda in main program //free cuda memory previous call cudafree(d3_in); cudafree(d3_out); cudastatus = cudadevicereset(); if (cudastatus != cudasuccess) { fprintf(stderr, "cudadevicereset failed :%s\n", cudageterrorstring(cudastatus)); } //send data host in stat2 calculations (int count = 0; count < countlog; count++) { h4_in[count * 2 + 0] = prc[count]; h4_in[count * 2 + 1] = h_stat1out[count * 6]; } //query device parameters cudaoccupancymaxpotentialblocksize(&mingridsize, &threadsperblock, calcstats2, 0, countlog); // round according a

android - Gridview: Detail page having different screens -

in gridview when selecting each item going same same page. need go different pages according icon name here java class rowview.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { intent intent = new intent(context, secondactivity.class); //add position intent used in second activity. intent.putextra("position", position); context.startactivity(intent); } }); what changes should make ? instead of onclicklistener ,you have try onitemclicklistener . find position of listview item. code:- rowview.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview arg0, view arg1, int position, long arg3) { intent intent = new intent(context, secondactivity.class); //add position intent used in second activity.

php - Set::combine Cakephp, creating multi dimensional array using single dimensional array -

i have array having multiple values same values array of same keys eg. array( [0] => array( 'name' => "bob", 'age' => 20, 'marks'=> 50 ) [1] => array( 'name' => "ryan", 'age' => 20, 'marks'=> 57 ) [2] => array( 'name' => "allen", 'age' => 23, 'marks'=> 70 ) [3] => array( 'name' => "duke", 'age' => 23, 'marks'=> 67 ) [4] => array( 'name' => "matt", 'age' => 24, 'marks'=> 85 ) ) i want convert

c# - How to use Parallel.ForEach with dataTable -

this question has answer here: parallel foreach on datatable 3 answers how can use parallel.foreach datatable works fine list , array cant working datatable shows error "cannot inferred usage. try specifying type arguments explicitly" parallel.foreach(dt.rows , row=> { //code here }); the answer need cast row asenumerable() extension method: parallel.foreach(dt.rows.asenumerable() , row=> { //code here });

apache - Best choice for 5k request spikes on dynamic server -

i building backend supposed handle 5k request spikes. application photo sharing app uses sql database, php handle requests , x-sendfile send images user. best setup server wise? have build haproxy load balancer 2 apache servers have shared folder access images , database server. 4 servers in total. may install memcached save processing. hold? setup? have suggestions on improvements or better solutions?

logging - Tomcat localhost_access_log files cleanup -

we have solr running on tomcat 8. having issues in our different environments localhost_access_log files filling servers. these files created access valve log in server.xml configured - <valve classname="org.apache.catalina.valves.accesslogvalve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> from i've read, there no ootb way in tomcat clean old log files. can implement clean old access log files? you can have log rotation , choose logs files delete <valve classname="org.apache.catalina.valves.accesslogvalve" directory="logs" prefix="localhost_access_log" suffix=".txt" rotatable="true" renameonrotate="true" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> as rotation set true default should have it. can exemple delete logs older 5 days: to delete log

Conditional iterations in Google cloud dataflow -

i looking @ opportunities implementing data analysis algorithm using google cloud dataflow. mind you, have no experience dataflow yet. doing research on whether can fulfill needs. part of algorithm contains conditional iterations, is, continue until condition met: pcollection data = ... while(needsmorework(data)) { data = doastep(data) } i have looked around in documentation , far can see able "iterations" if know exact number of iterations before pipeline starts. in case pipeline construction code can create sequential pipeline fixed number of steps. the "solution" can think of run each iteration in separate pipelines, store intermediate data in database, , decide in pipeline construction whether or not launch new pipeline next iteration. seems extremely inefficient solution! are there ways perform kind of additional iterations in google cloud dataflow? thanks! for time being, 2 options you've mentioned both reasonable. combine 2 app

java - Create all combinations of mappings of characters to truth values -

i have set of characters {'p', 'q', 'r', ...} , want call run() (not important does) on permutations of mappings characters boolean values. example, if set of characters {'p','q','r'} , naively went through every permutation manually, this: private static void runmaps(){ hashmap<character,boolean> m = new hashmap<>(); m.put('p', true); m.put('q', true); m.put('r', true); run(m); m = new hashmap<>(); m.put('p', true); m.put('q', true); m.put('r', false); run(m); // ... // 8 permutations } it's bugging me because know can (and should able to) use recursion here i'm struggling. edit : after while managed working. there's added stuff in code below general idea shown. private static boolean runmaps(syntaxtree formula, arraylist<string> chars, hashmap<string, boolean> map, int index) { if (i

r - Add rows by groups -

i observe frequencies (eff) of different characters (code) in population @ different dates (date2). datas <- data.frame(date2 = rep(seq(sys.date() - 2, sys.date(), = "day"), each = 2), date1 = sys.date(), code = rep(letters[1:2], 3), eff = c(50, 30, 20, 10, 20, 20), total = 100) > datas date2 date1 code eff total 1 2015-07-25 2015-07-27 50 100 2 2015-07-25 2015-07-27 b 30 100 3 2015-07-26 2015-07-27 20 100 4 2015-07-26 2015-07-27 b 10 100 5 2015-07-27 2015-07-27 20 100 6 2015-07-27 2015-07-27 b 20 100 for each dates2 add code "fill" difference between sum of frequencies day , total population observed day (total). for example, output i'm expecting : date2 eff date1 total code 1 2015-07-25 50 2015-07-27 100 2 2015-07-25 30 2015-07-27 100 b 3 2015-07-25 20 2015-07-27 100 ko 4 2015-07-26

r - Fill target array with dynamically shifted source array -

what way shift array number given per column? i have following method filling full size array ("o") values of different array ("p", dimnames(p) exist in "o"). # empty target array o <- array(dim=c(6,3),dimnames=list(c(1:6),c(1:3))) # partially filled source array p <- array(c(10:16),dim=c(2,3),dimnames=list(c(2:3),c(1:3))) > p 1 2 3 2 10 12 14 3 11 13 15 # fill target array p o[(match(names(p[,1]),names(o[,1]))),(match(names(p[1,]),names(o[1,])))] <- p > o 1 2 3 1 na na na 2 10 12 14 3 11 13 15 4 na na na 5 na na na 6 na na na now rewrite matching array call shift each column value in column header (only simplification picked 1:3). in example, shift first column 1, 2nd column 2 , on). the result this: 1 2 3 1 na na na 2 na na na 3 10 na na 4 11 12 na 5 na 13 14 6 na na 15 is there way solve without going manual looping? i have tried in direction o[(match(names(p[,1]),as.integer(name

spring - Eclipse Mars + Wildfly 9 + deployment not working -

i have java spring application, configured in eclipse mars , running wildfly 9 within eclipse. using wildfly-maven-plugin deploy server. these steps follow: start server eclipse , maven build deploys application server. can see whole lot of logs on server of "successful deployment"and can access application in browser. creates folder under "/standalone/data/content" no war or exploded war under "standalone/deployments" if change code , save in eclipse, (i have checked automatically publish check box , build on save), server logs says: replaced deployment "myapp.war" deployment "myapp.war" content removed location "standalone\data\content..." and see prev folder created during step 1 removed , myapp.war added deployment folder. can not access application in browser. auto-deploy-exploded="true" that in section of standalone.xml .

android - libusb on lollipop - fails to get devices list -

few days ago i've tested app on android lollipop , stops working. after debugging i've found libsub fails devices list: struct libusb_device **devs; int devs_count = libusb_get_device_list(ctx, &devs); i've continues dig sources , found next failure (linux_usbfs.c): dir *buses = opendir(usbfs_path); // '/dev/bus/usb', correct struct discovered_devs *discdevs = *_discdevs; int r = 0; if (!buses) { usbi_err(ctx, "opendir buses failed errno=%d", errno); return libusb_error_io; // case! } usbfs_path correct ( /dev/bus/usb ) , device /dev/bus/usb/003/002 . how can work usb device using libusb in android lollipop? previously i've iterated on devices, found device using pid , vid, requested it's endpoints , worked usual. can't struct libusb_device **devs; using libusb_get_device_list , stops everything. can having device path , opened connection file descriptor android? ps. testing on nexus 9 android 5.1.1 pps. can&#

java - wait until a download completes before calling a function in clojure -

i using webdriver navigate webpage , download json file. need wait completion (or failure, @ give user message) file download before can call function pull in data program. there can use in clojure or java ecosystem allow me this? (defn web-driver [] (taxi/set-driver! {:browser :chrome} "https://website.net") (taxi/quick-fill-submit {"#user_email" "myemail@something.com"} {"#user_password" "password"} {"#user_password" taxi/submit}) (taxi/click "a[href*='/admin/...../export']") (taxi/wait-until #(taxi/exists? {:xpath"/html/body/....})) (taxi/click {:xpath "/html/body/...."}) (taxi/click {:xpath "/html/body/...."}) (taxi/click {:xpath "/html/body/...button"})) (defn find-file [] (let [file-name (for [file (me/list-dir "/users/.../downloads") :let [s (.tostring file)] :when (.contains s &qu

xcode6 - Particle Emitter not acting consistently -

i'm using same particle emitter in multiple scenes, , i'm noticing in scenes when run app on phone emitter isn't appearing when supposed to. changes different scene next time open app it's inconsistent. thought creating different emitter each scene seems pointless if 1 emitter can used across scenes. saw question related: spritekit particle emitter not appearing in xcode editor but no answers, wondering if else has same problem? problem sourced z position of emitter node, set equal background can assume caused act strangely when set z position higher stopped.

How to disable wysiwyg editor for body field in PyroCMS 2.x? -

i disable ck wysiwyg editor in pyrocms 2.x can enter plain html code without switching each time source view. possible , how can solved? depending on version have, can following: go pages modules , open "page types" section create new page type (klick on button on top right) set you're page type giving proper name (e. g. html default) , make sure uses correct theme layout open "layout" tab , insert {{ html_body }} click "save" in next window, you'll have add field new page type click "+ new field" in upper right corne choose "html body" name , make sure, slug set "html_body" set field "required" choose "textarea" set "content type" "html" click "save" you're set use new page type "html default". choose page type when adding new page, , you'll getting simple textarea instead of wysiwyg editor.

mysql - Update in SQOOP Export not working -

i using hadoop 2.5.0 , sqoop 1.4.5. i trying update in mysql following sqoop export command: sqoop export --connect "connect_string" --username "user" --password "pass" --table "table_name" --columns "a,b,created_dtm,d,e" --export-dir "export_dir" --input-null-string "" --input-null-non-string "" --input-escaped-by \\ --input-fields-terminated-by "," --input-lines-terminated-by "\\n" --update-key --update-mode "allowinsert" -m 1; a defined unique key in table structure. but getting below exception , job hangs: org.apache.sqoop.mapreduce.asyncsqloutputformat: got exception in update thread: java.sql.batchupdateexception: unknown column 'created_dtm' in 'field list' @ com.mysql.jdbc.preparedstatement.executebatchserially(preparedstatement.java:1819) @ com.mysql.jdbc.preparedstatement.executebatch(preparedstatement.java:1281) @ org.apache.

javascript - A Store of Actions for optimistic updates is a good approach in Redux/Flux? -

i've been working optimistic updates in react+flux application , saw 2 things: what happens if user attempts close window when exists uncompleted actions. example in facebook, message appears in wall if wasn't persisted (this optimistic updates does, more responsive application user). but, if user post in wall , close application (on logout or window close), post fail , not alerted. i don't idea of stores managing own entities (for example messages) , situation of action triggered persiste message (loading, succesfull, failed?). mixes things. so work on , create actionstore manage state of actions triggered components. here is source code , here is live demo. it works more or less this: the root of components hierarchy (container in redux) fetch nextid of new action , pass childs props (this ugly). a child component fires action: keeps actionid ask store after , call action creator. the action creator creates new action , returns function middleware.

function - why declaration of methods in different style different results in scala -

Image
below 2 methods declared in different style. both doing same work. wondering, why different syntax required check type of function (yellow block) different syntax required call function (green block) declaration of both methods on scala repl gives different results (red block) also, please suggest, 1 preferred way declare methods or there special use cases both styles of method declaration? edit 1: below commands screenshot :- welcome scala version 2.11.7 (java hotspot(tm) 64-bit server vm, java 1.7.0_79). type in expressions have them evaluated. type :help more information. scala> def add(x:int, y :int): int = {x+y} add: (x: int, y: int)int scala> def sum = (x:int, y:int) => {x+y} sum: (int, int) => int scala> :t add <console>:12: error: missing arguments method add; follow method `_' if want treat partially applied function add ^ scala> :t add(_, _) (int, int) => int scala> :t sum (int, int) => int

algorithm - Python while loop never stops even though it should -

i've been going through exercises book on algorithms (with emphasis on python), , strange behavior when try solve problem. exercise straightforward , goal generate random integer k range(n) , , locate number through sequence of "yes / no" questions. following code works long n isn't large, when infinite loop. shouldn't happen because in worst case step_size equal 1 , position crawl towards value of k until position == k . when print both step_size , position seems position isn't updating when gets large, i'm guessing has value getting approximated , truncated (this why tried explicitly cast long, may not in fact doing anything). minor parts of code unnecessary, wanted have work general n . ideas what's going on (you have increase n behavior i'm talking about)? from random import randrange math import ceil n = 10**15 k = randrange(n) success = false step_size = ceil(n / 2.0) position = long(ceil(n / 2.0)) print(k) while suc

javascript - Crop Cover Photo like Google Plus using js & PHP? -

i've seen few demos not google+ in google+ if upload cover photo made restrict minimum croppable area depend on uploaded image size , aspect ratio after can't make smaller. have idea how minimum width , height according below points. first of aspect ratio of uploaded image user. then minimum width , height in pixel allow croppable area after area user not able make small area cropping cover photo want restrict based on image size & ratio. for more information please have google+ cover photo cropping style. below few demos i'm looking for. http://deepliquid.com/projects/jcrop/demos/tutorial5.html http://picturecut.tuyoshi.com.br/ thanks in advance help!. after long waiting applied logic , works me aspected. var min_crop_width = (original_width / 100) * 83.5; // minimum percentage var min_crop_height = (min_crop_width / 5) * 1; // standard ratio... min_crop_width = (min_crop_height * 5) / 1; // standard ratio... thanks!

c# - my Gridview still freezes in backgroundworker Dowork while using this.invoke(MethodInvoker)delegate -

i want update gridview gradually while retrieving data i've backgroundworker work function follows private void backgroundwrkr_dowork(object sender, doworkeventargs e) { datatable dtinstant = new datatable(); (int = 0; < allfiles.count; i++) { if (backgroundwrkr.cancellationpending) { e.cancel = true; return; } myapp.processfile(allfiles[i]); this.invoke((methodinvoker)delegate { mygrdvw.datasource = myapp.dtresults; }); backgroundwrkr.reportprogress(100 * (i + 1) / allfiles.count); } backgroundwrkr.reportprogress(100); } and report progress function private void backgroundwrkr_progresschanged(object sender, progresschangedeventargs e) { progressbar.value = e.progresspercentage; } and backgroundwrkr complete private void backg