Posts

Showing posts from January, 2012

datetime - Java Joda time Daylight savings time -

i having difficulty using jodatime handle daylight savings time. string time = "3:45-pm"; datetimeformatter formatter = datetimeformat.forpattern("kk:mm-a"); datetime dt = formatter.parsedatetime(time).withzone(datetimezone.forid("america/new_york")); dt = dt.todatetime(datetimezone.utc); startdate = startdate.withhourofday(dt.gethourofday()).withminuteofhour(dt.getminuteofhour()); output code snippet ends being: 2015-04-08 16:46:51.952 info 12244 --- [nio-8080-exec-1] values pulled : 03:45-pm 2015-04-08 16:46:51.952 info 12244 --- [nio-8080-exec-1] values pulled : 08:45-pm currently, time 5 hours off. not handling daylights saving time. how joda time take dls account? this happens because datetime object after parsing set date 01-01-1970 . looks expect set today, isn't. if want time interpreted 3:45 pm today in timezone america/new_york , this: string time = "3:45-

c - Where does the timezone for date and strftime come from? -

im curious because checked on linux host in sydney, australia , date command says est timezone, strftime(tz, sizeof(tz), "%z", &time) when running simple c binary print out. however, know timezone aest . timezone abbreviations truncated? can find out more this? australian time zone abbreviations changed in tzdb 2014f , released in august 2014. you need update time zone data file current version (2015b of writing). on linux, in tzdata package, can update using apt-get , or rpm , or whatever appropriate distro.

php - DISTINCT * is not withdrawing the duplicity (MYSQL) -

i done remove duplicity on database on selecting checkbox on sectio "bairros" utilized array for($m=0; $m<count($_post["bairros"]); $m++){// loop 1 $pesquisar=($_post["bairros"][$m]); //copy bairros(array) , esporte (post) $query = "select distinct * cadastro (esporte1 = '".$_post["esportes"]."' or esporte2 = '".$_post["esportes"]."' or esporte3 = '".$_post["esportes"]."' or esporte4 = '".$_post["esportes"]."') , (bairro1 = '".$pesquisar."' or bairro2 = '".$pesquisar."' or bairro3 = '".$pesquisar."' or bairro4 = '".$pesquisar."') , ativaraparecer='sim' order nomecompleto asc limit 20"; $esporte= new consultar(); $esporte->executa($query); //loops for($l=0; $l<$esporte-&g

Loading bulk records from XML into SQL Server 2008 in ASP.NET MVC 4 -

i have requirement of loading 1000's of records xml file sql server 2008. far browsing , able code doesn't work @ all. can please me out? i tried searching lot same not fix issue. there simple , easier understand achieve same. here have... public actionresult upload() { if (request.files.count > 0) { var file = request.files[0]; if (file != null && file.contentlength > 0) { try { var filename = path.getfilename(file.filename); var path = server.mappath(filename); dataset ds = new dataset(); ds.readxml(path); sqlconnection con = new sqlconnection("data source=server;initial catalog=sampleservice;user id=sa;password=123"); sqlbulkcopy sb = new sqlbulkcopy(con); sb.destinationtablename = "customer";

javascript - Backbone syphon to get array of objects -

i have following html code <div style="display: none"> <input type="text" name="typeid" id="wiz-typeid" value="<%= typeid %>"/> <input type="text" name="dealer" id="wiz-dealer-descr" value="<%= dealer %>"/> <input type="text" name="player" id="wiz-player-descr" value="<%= player %>"/> </div> when backbone syphon, gives me json in following format : "typeid": "dealer": "player": i want in format : "configutation": { "typeid": "dealer": "player": } how encode name tags in html backbone.syphon.serialize gives json in required format <div style="display: none"> <input type="text" name="configuration[typeid]" value="<%= typeid %>"/>

javascript - check / uncheck a single checkbox using jquery -

i have single html page 30+ check boxes ( how configure script remember check box selected (remember 1 checked or unchecked) this script use: $(function(){ var test = localstorage.input === 'true'? true: false; $('input').prop('checked', test || false); }); $('input').on('change', function() { localstorage.input = $(this).is(':checked'); console.log($(this).is(':checked')); }); $('input') matches all inputs. give more specific selector (preferably id of input want remember.

c - Typecasting return value of function to pointer type -

i have following code: #define pll0stat (*((volatile unsigned short*) 0xe01fc088)) // function prototypes void diaplayinrow1withposition(unsigned char* data, unsigned char position); unsigned char convertlowernibbletoasciivalue(unsigned char data); void func1 (void) { unsigned char temp = (unsigned char) pll0stat; // interested in last byte temp = convertlowernibbletoasciivalue(temp); diaplayinrow1withposition(&temp,15); } instead of above code, thought replace last line 1 step , used below statement diaplayinrow1withposition(((unsigned char*)convertlowernibbletoasciivalue(temp3)),15); but code compiles correctly, nothing displayed in lcd. not able makeout reason. typecasting done correctly pointer thought. there other issue? the original code fine. why trying turn unreadable one-liner, have no idea. not gain performance, achieve nothing, obfuscate code. can see need ask question: have made code unreadable yourself. leave code was. the actu

encryption - Can I save passwords securely and retrieve them without asking for a master password? -

i'm trying understand how save passwords used on app securely, user doesn't have remember them @ same time nobody can them looking @ data app. i imagine files containing passwords should encrypted, doub whether user have input "master password" retrieve stored passwords or if there way app can retrieve them without input user. can app retrieve passwords without user needing write master password? how done? on windows best solution use data protection api , used chrome, ie, remote desktop connection, , dozens of other technologies, encrypt data. the virtue data encrypted (in round-about way) user's own windows password. when user types password windows, makes "protected" data available. features: the data encrypted the user doesn't have enter password encrypt data only user can ever decrypt it the user not have enter password decrypt data sample pseudo-code the api want cryptprotectdata , cryptunprotectdata : public

c# - Possible Rendering Performance Optimizations -

Image
i doing benchmarking today using c# , opentk, see how render before framerate dropped. numbers got pretty astronomical, , quite happy outcome of tests. in project loading blender monkey, 968 triangles. instance , render 100 times. means rendering 96,800 triangles per frame. number far exceeds need render during given scene in game. , after pushed further , rendered 2000 monkeys @ varying locations. rendering whopping 1,936,000 (almost 2 million triangles per frame) , framerate still locked @ 60 frames per second! number blew mind. pushed further , framerate started drop, means limit 4 million triangles per frame instancing. i wondering though, because using legacy opengl, if still pushed further—or should bother? for tests load blender monkey model, store display list using deprecated calls like: modelmeshid = meshgenerator.generate( delegate { gl.begin( primitivetype.triangles ); foreach( face f in model.faces ) { foreach( modelverte

excel - Application defined or Object defined error. Copy from worksheet to sheet in another workbook -

i have piece of code checks if file open or not , based on criteria copies , pastes cell information. when program runs error message says "application defined or object defined error". line error thrown commented. ' check if file open ret = isworkbookopen("\\showdog\service\service jobs.xlsm") if ret = false ' open file set wkbdest = workbooks.open("\\showdog\service\service jobs.xlsm") set destsheet = wkbdest.sheets("customer information") 'perform copy set shttocopy = wkbsource.sheets("report") shttocopy.range("a11:j11").resize(xldown).copy 'error on line destsheet.range("a4:j4").cells(xldown).pastespecial application.displayalerts = false wkbdest.save wkbdest.close application.displayalerts = true what doing wrong? here's code started: sub test() dim lastrow integer, lastcol integer, startrow integer dim ws worksheet, newws worksheet set ws = activesheet star

mysql - Query is not joining correctly, how do I fix it? -

i have large query structured this: there bunch of tables main table lt_chc_tours_rsv_cs has t_dt column. there ltr_chc_tours_rsv_price has season value. there tr_season has season value of own (corresponding ltr_chc_tours_rsv_price ) has start_dt , end_dt fields what want in query join has p.season field has correspond a.t_dt date falls in between tr_season start_dt , end_dt , don't know how this. i'm not sure if i'm explaining correctly. tables tr_season season desc start_dt end_dt 1 s1 1/1/2013 12/31/2013 2 s2 1/1/2014 12/31/2014 3 s3 1/1/2015 12/31/2015 ltr_chc_tours_rsv_price season price1 price2 price3 1 4 5 7 1 2 6 8 1 7 5 9 lt_chc_tours_rsv_cs t_dt count 2/5/2013 6 2/7/2014 2 8/2/2015 3 season's matched , counts multiplied pricing. my query (unfinished) select * -- bunch of stuff lt_ch

ios - XCode 6.3 MKPointAnnotation setCoordinate missing -

i updated xcode 6.3 , receiving below error: mkpointannotation not have member named 'setcoordinate'. not sure went, or if supposed use other mk method. appreciated. func refreshlocation(lat:string, lon:string, withoffset:bool = false){ // 1 convert string values can used. let location = cllocationcoordinate2d( latitude: (lat nsstring).doublevalue cllocationdegrees, longitude: (lon nsstring).doublevalue cllocationdegrees ) // 2 setup initial variables. let span = mkcoordinatespanmake( (self.locationlatitudedelta nsstring).doublevalue cllocationdegrees, (self.locationlongitudedelta nsstring).doublevalue cllocationdegrees ) let region = mkcoordinateregion(center: location, span: span) mapview.setregion(region, animated: true) //3 decorate point , add point map. var annotation = mkpointannotation() annotation.setcoordinate(location)

java - Passing data to servlet through button in jsp -

i have database products. when accept 1 of them want pass id servlet. accept or deny them using 2 buttons (accept, deny). how can pass id servlet? don't forget there many products, let's 5 of them. how can sure id send servlet? here part of code: <c:foreach var="product" items="${productlist}" > <div id="box"> <div id="box_info"> ${product.id}<br /> ${product.name}<br /> ${product.category}<br /> ${product.currently}<br /> ${product.currently}<br /> ${product.firstbid}<br /> ${product.numberofbids}<br /> ${product.location}<br /> ${product.country}<br /> ${product.description}<br /> </div> <div id="box_buttons"> <a href="myservlet1"><div id="box_butto

c++ - How control which numa node executes my program -

i have server 4 numa nodes each having 8 cores hyper threading. have 64 logical cpus. i have programs producing data , other programs consuming data. these programs written in c++ (11). want start number of producers , number of consumers programs. to maximize performance control program instances execute. in other words consumer-program should on same numa node corresponding producer. in end need control core program running on. i'm using c++ (11). how can control way programs distributed? edit: maybe should add server running linux. solution linux great solution supporting both linux , windows better. this code should make thread run on specific core or subset of cores -- core 17 , 18 in example; cpu_set_t cpuset; cpu_zero(&cpuset); cpu_set(17, &cpuset); cpu_set(18, &cpuset); if (pthread_setaffinity_np(thread[0], sizeof(cpu_set_t), &cpuset) != 0) throw error"failed set affinity thread"); you can allow thread have affini

php - Retrieve multiple lines within same cell from CSV file -

i trying retrieve data csv file. used following code go through csv: //create array csv file $array_data = array(); $row = 0; if (($handle = fopen("import/pdf_data.csv", "r")) !== false) { // read csv root folder "web/interval/import" while (($data = fgetcsv($handle, 0, ";")) !== false) { if ($row > 0) { $array_data[$row] = $data; } $row++; } fclose($handle); } //loop through feature data array foreach ($array_data $entry_value => $array_column) { foreach( $array_column $value ) { //split data list($col1,$col2,$col3) = explode( ',', $value ); echo "name: ".$col1.", surname: ".$col2.", text: ".$col3."<br/>"; when print columns... col1 , col2 fine have 1 single value in cells. col3 may contain multiple lines. let's example (see below 1 cell of col3): col3 :::::::::::::: text-a in line 1

c# - Office Interop Exception running Interop v15 on Windows XP -

i running .exe pass argument to, using office.interop v15. works fine on dev machine windows 7 office 2013. when move vm running windows xp , office 2010, run time error stating system.runtime.interopservices.comexception (0x80020005): type mismatch. (exception hresult: 0x80020005 (disp_e_typemismatch)) is because interop v15 doesn't support lower version of office? snippet error occurs doc = app.documents.open(filetoprint) /happens here doc.printout(false) doc.close() app.quit() oddly enough runs has runtime error. try this. replace code: doc = app.documents.open(filetoprint) /happens here with (in vb.net) dim s_missing object = system.reflection.missing.value doc = app.documents.open (filetoprint, s_missing, s_missing, s_missing, s_missing,s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing) or (in c#) static object s_missing = system.reflection.missing.value; doc = app.

sorting - python natsort sort strings recursively -

i find natsort.natsorted sorting order changes part-way through string: in [31]: import natsort ns in [32]: ns.natsorted(["01-08", "02-07", "01-06", "02-09"]) out[32]: ['01-08', '01-06', '02-09', '02-07'] in case, behaviour want is: in [33]: sorted(["01-08", "02-07", "01-06", "02-09"]) out[33]: ['01-06', '01-08', '02-07', '02-09'] try this: ns.natsorted(["01-08", "02-07", "01-06", "02-09"], alg=ns.ns.int | ns.ns.unsigned) the problem natsorted interpreting strings incorrectly. manually sets algorithm unsigned ints. otherwise, searches signed ints, , "-" causes problems (if interpret "-08", example, -8, sorting makes sense). this equivalent versorted, shortcut algorithm, think it's better explicitly write you're doing, versorted change more applicable v

matlab - how to put The main diameter in magic(9) with diag in a matrix 3 * 3? -

this code,i want put result of diag in matrix 3*3 in matlab,how create it? a=magic(9); b=diag(a); i want put result of b in matrix 3*3 you can reshaping array: c=reshape(b,3,3)

javascript - Clickable Table Rows in Ruby on Rails -

just getting started rails , trying create clickable table rows in rails using bootstrap tables. have managed this, there seems problem when click on row through show page, press button on page return index view, clickable rows not work anymore. need refresh page work again. i have taken @ rails 3 - how make entire table row clickable using jquery along other answers on site. still not seem work. my code follows index page <tr data-link="<%= source_path(source) %>"> <td><%= source.name %></td> <td><%= source.description %></td> <td><%= link_to truncate(source.url, :length => 40), source.url, :target => '_blank' %></td> <td><%= source.category %></td> <td><%= source.user.name if source.user %></td> </tr> application.js jquery(function($) { $("tr[data-link]").click(function() { window.l

Graph of scikit-learn ExtraTreeClassifier and RandomForestClassifier -

Image
i trying make graphs illustrate difference between randomforestclassifier , extratreeclassifier in scikit-learn. think might have figured out unsure. here code fit , graph iris dataset both: import numpy np sklearn.datasets import load_iris sklearn.externals.six import stringio sklearn import tree import pydot iris = load_iris() x = iris.data y = iris.target clf = tree.extratreeclassifier() clf = clf.fit(iris.data, iris.target) dot_data = stringio() tree.export_graphviz(clf, out_file=dot_data) graph = pydot.graph_from_dot_data(dot_data.getvalue()) file_name = "et_iris.pdf" graph.write_pdf(file_name) clf = tree.decisiontreeclassifier() clf = clf.fit(iris.data, iris.target) dot_data = stringio() tree.export_graphviz(clf, out_file=dot_data) graph = pydot.graph_from_dot_data(dot_data.getvalue()) file_name = "rdf_iris.pdf" graph.write_pdf(file_name) the graphs produces seem correct, et graph "bushier" decision tree graph. am correc

javascript - IE detection: what the heck does this mean? -

i looking @ piece of code detects ie browser: if (false || !!document.documentmode) and not understanding contraption. why necessary or false , use not twice? if loaded below file in ie9, ff or opera, ie tell me document mode there, while later 2 otherwise: <html> <head> <script>function ld() { if (document.documentmode){ document.getelementbyid("p1").innerhtml = 'document mode detected' } else { document.getelementbyid("p1").innerhtml = 'no document mode' } }</script> </head> <body onload="ld()"> <p id="p1"></p> </body> </html> is not sufficient , why? not clear, because if replaced condition 1 in original question, result same. missing? why necessary or false [...] it isn't necessary. || operator , given false 1st operand, will return 2nd operand . // lval || rval (minus

jquery - JavaScript - hide element when click outside not working on mobile phone -

hiding modal windows works fine on desktop computer code $(document).mouseup(function (e){ if ($("#full_window_dim").is(':visible') && !$("#hodnotenie_hl_okno").is(e.target) && $("#hodnotenie_hl_okno").has(e.target).length === 0){ $("#full_window_dim").fadeout(); $('html, body').removeclass('stop-scrolling'); } }); but code not working on mobile phones (i have tried iphone 5 - safari) how can hide element when users taps outside of window on mobile phones ? you can use touchstart phones since devices not understand mouse events. here's code. can include many events want. function hidemodal(){ if ($("#full_window_dim").is(':visible') && !$("#hodnotenie_hl_okno").is(e.target) && $("#hodnotenie_hl_okno").has(e.target).length === 0){ $("#full_window_dim").fadeout(); $('html, bod

java - Does compareTo work with double type? -

i need make program uses compareto, i'm running issues it. double sides1 = 1.0; double sides2 = 1.3; int compared = sides1.compareto(sides2); i run error says cannot invoke compareto(double) on primitive type double what doing wrong, , how fix it? you cannot call methods on primitive values such double s. can call double.compare , compare 2 primitive double s you. int compared = double.compare(sides1, sides2); you can compare primitive double values directly comparison operators == , != , < , <= , > , >= .

javascript - Check if a HTML element exists before append -

i need way check if dynamically created hidden input element exists in document before appending it. i know there similar questions, questions differs them because other questions seem basic appending of elements selectors e.g. if ($('#button').length) checks if element #button id exists. however in code, dynamically creating input elements, name value attributes different. need if whole element exists 1 one in loop before append it. there way in jquery? $('input[type=radio]:checked').each(function(){ //something if($('<input type="hidden" name="data[' + $(this).val() + ']" value="' + $(this).val() + '" />').length) { $('#addcharacters').append('<input type="hidden" name="data[' + $(this).val() + ']" value="' + $(this).val() + '" />'); } }); with jquery, can use .is() function test whether element/sequence of eleme

vba - Count number of values in a column (Values are Number in Text format) -

i've run snag. i'm writing macro pulls values our mainframe. number of values change each run. values numbers in text format. important keep format because used purpose. unfortunately, since work sensitive data unable post code have because on work laptop. basically, code spins through table of values , pulls each value in position. @ end of code i'm wanting put count count number of cells value. remember value change, example in 1st run can pull 100 values, 2nd run pull 1000 values. at end of loop thought putting following, since values on in text format error. application.worksheetfunction.count range("d1:d7000") me.cells(x,x) = application.worksheetfunction.count range("d1:d7000") error message run-time error 1004 application-defined or object defined error i know has format, because when change values text works fine. ideas? counta might need. counts non-empty cells whereas count counts cells containing nu

Endless iterator loop on doubly linked list using Java -

i have created doubly-linked list , implemented own iterator. however, have done wrong , iterator results in endless loop. have been struggling find error, feedback appreciated. in advance. apologise wall of code, think error lies within iterator of way have created node class. my code: import java.util.iterator; import java.util.nosuchelementexception; public class mydoubleendedlinkedlist<t extends comparable<t>> implements iterable<t> { // initialising nodes including 2 sentinal nodes private node<t> head; private node<t> tail; private node<t> current; private int currentsize; mydoubleendedlinkedlist() { head = new node<t>(); tail = new node<t>(); head.setnext(tail); tail.setprevious(head); current = head; currentsize = 0; // methods used loop , iterate through list public boolean isempty() { return (current == head && current == tail); } public boolean endlist() { return (curre

javascript - DataTables warning: table id=table_id - Requested unknown parameter '0' for row 0. For more information about this error, please see -

javascript <script type="text/javascript"> $(document).ready(function() { $('#table_id').datatable({ "processing": true, "serverside": true, "ajax": { "url": $("#show_all_orders").attr('action'), "ordering":false, "data":function ( d ) { d.command = "get_all_orders_ajax"; d.ajax="true"; }, "columns": [ { "data": "statusrepr" }, { "data": "id" }, { "data": "description" }, { "data": "maxloadheight" }, { "data": "maxloadwidth" }, { "data": "maxloadlength" }, { &

function - Why is this returning two values? Easy python beginner -

can please explain why enter method in following class returning 2 values? i'm learning python , in process of creating simple game grasp oop , classes. anyhow need enter method return random snippet snippets list. keep getting 2 snippets instead of one. can explain why? sys import exit random import randint class island(object): def enter(self): pass class loser(island): snippets = ["welcome loser island", "can't win them all", "there's next time"] def enter(self): print loser.snippets[randint(0,len(self.snippets)-1)] loser_test = loser() loser_test.enter() generally, you'll create class , describe behavior , contents of instance of class. instance of class object type class. example, john = person('john', 'doe') create person object, sending 'john' , 'doe' object's __init__ method (a constructor).

Simple jQuery Simple Solution? -

<button type="button" id="overlay-close">close</button> </nav> </div> <div class="container"> <script type="text/javascript"> jquery(document).ready(function($) { $(".overlay").hide(); $('#overlay-menu').click(function(){ $('.overlay').fadein(300); }); $("overlay-close").click(function(){ $('.overlay').fadeout("slow"); }); }); </script> any ideas on getting work? fade in fine, fade out onclick function not fading out. go here see click on hamburger menu toggle http://www.cambrianvacation.co.uk/cyfa overlay-close not element in html. code should this $("#overlay-close").click(function(){ $('.overlay').fadeout("slow"); });

ember.js - How to migrate a grunt project into ember-cli project -

i have js project using ember.js, managed grunt. when ember-cli trend of ember.js management tool, want migrate existing grunt project ember-cli project. according ember-cli manual, tried ember cli migrator , require existing project git version-controlled project, otherwise cannot migrate. there way migrate existing project without git repo? i got it, following operations should proceeded: install git; git init git add git commit -m "anything" that's all.

Diagnostics warning for "Decision Runner Resource Provider" for Business Rules on Bluemix -

when running diagnostics rule execution server business rules instance on bluemix, see following warning: decision runner resource provider warning diagnostic failed run installation wizard create database tables this question answered in ibm developer forum . excerpt link : warning expected business rules service on bluemix, , can safely ignored. see if instance uses version decision server 8.7.0.1. (see section in rule execution server console). hope helps.

android - Lollipop shared element transition on reentering activity with keyboard resize -

i'm working lollipop transitions between 2 activities. have shared element animate transition , activities , b. in activity b keyboard pops , resizes window. animation looks great when going activity b. problem when returning activity shared element transition looks bad because windows size still based on keyboard resized (even though keyboard minimizes automatically when going , window correct size). i have tried manually hiding soft input before leaving activity b , calling finishaftertransition. unfortunately no luck! have tried postponing shared element transition, didn't work well. 1 solution have tiny delay (10ms) when user presses finish activity b in order give window time resize before leaving, feels hacky me. any ideas appreciated!

c++11 - how does the below code output 3? (how does the below code read?) -

the specific part not understand how -a in if statement changes -3 3. can explain how -a changes a = -3 a = 3 ? #include <iostream> int main(){ signed = -3; if (a < 0){ std::cout << -a << std::endl; } else { std::cout << << std::endl; } system("pause"); return 0; } it's example of unary negative , when a=-3 (which less 0 , code enters if block) -a -(-3) 3 .

excel - How to check if a cell that contains text matches two other cells? -

i'm matching names of students scores. example: b c d e f g 1 adam 10 adam 8.5 adam 9 ok 2 luke 10 luke 9 john 9 false 3 john 9 john 8 luke 10 false 4 lucy 8.5 lucy 9 lucy 8 ok columns , b names , scores mathematics. columns c , d names , scores english. columns e , f names , scores history. i need formula check if a1, c1, , e1 contain same text , if fill g1 ok . if 1 of them different, g1 should show false . you can use if , and function: =if(and(b2=d2,d2=f2),"ok","false") in case 3 name in b2, d2 , f2.

Wordpress Error Handling when no menu location assigned -

Image
my menu code <h6><?php $theme_location = 'footer-customers'; $theme_locations = get_nav_menu_locations(); $menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' ); echo $menu_obj->name; ?></h6> <?php $footer_02 = wp_nav_menu( array('theme_location' => 'footer-business' , 'container' => '', 'echo' => false, 'fallback_cb' => '__return_false') ); if ( ! empty ( $footer_02) ) { echo $footer_02; } ?> may know how check if there no menu assigned theme_location in backend setting(/wp-admin)? the error msg follow: how make title become empty or show nothing if menu no

binning - converting activity start and end time into binned data for multiple groups in R dplyr tidyr -

i have data looks this: foo <- data.frame(userid = c("a","a","b","b","b"), activity = factor(c("x","y","z","z","x")), st=c(0, 20, 0, 10, 25), # start time et=c(20, 30, 10, 25, 30)) # end time and want, each user, convert activity data 5 minute time bins. result this: result <- data.frame(userid = c("a", "b"), x1 = c("x", "z"), x2 = c("x", "z"), x3 = c("x", "z"), x4 = c("x", "z"), x5 = c("y", "z"), x6 = c("y", "x")) the following approach works, quite cumbersome , slow. takes 15 minutes on modest-sized dataset. library(dplyr) lib

ruby - How to do a feature test in Rails with Capybara and how to know 500 error? -

i created route in rails application as: scope 'product' '/', to: 'product#sort', as: 'product' end then want test feature capybara as: # spec/features/product_spec.rb require 'spec_helper' feature 'product', type: :feature describe 'main page' context 'before login' 'show product list' visit product_path expect(page).to have_content('product list') end end end end but after run rspec in terminal, showed me: failure/error: expect(page).to have_content('product list') expected find text "product list" in "500 internal server error" why gave me 500 error? happened? how can see error detail? in controller , view, set @product_categories : in controller: # app/controllers/product_controller.rb class productcontroller < applicationcontroller def sort @product_categories = productcategory.all @products = pr

android - App gets stuck on splash screen when running in the emulator -

when running in emulator splash screen gets stuck , never starts next activity. removed splash activity manifest file , made next activity launcher. still, when run app splash screen. have done restarting eclipse, made new avd don't know getting splash screen. don't know why happening. this works fine when running on device, issue occurs when running in emulator. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.kaizen" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.rea

java - can't serialize class org.springframework.data.geo.Point -

i'm trying put aggregation query gps data using spring-data-mongodb 1.6.2. here's looks like: aggregation agg = newaggregation( match(new criteria() .andoperator( criteria.where("eventtime").gte(filterdate), criteria.where("location").nearsphere(p).maxdistance(distance) ) ), sort(direction.desc, "vanid", "eventtime"), group("vanid").first(aggregation.root).as("first") ); return mongotemplate.aggregate(agg,gpsdataentity.mongo_collection, groupedentity2.class);` the problem i'm seeing has due match() portion of query. exception long i've included stack point mongotemplate.aggregate() called in code snippet above: caused by: java.lang.illegalargumentexception: can't serialize class org.springframework.data.geo.point @ org.bson.basicbsonencoder._putobj

php - Delete ROWS from one table and then INSERT into another TABLE in MYSQLI -

i have 2 table names called "message" , "trash" in "message" table, i've data in table format contains (to, subject, msg, date) , applied checkall functionality checkbox using jquery, now want perform when delete row moves row table i.e. "trash" delete query working want modify code... here's code - <form action="delete.php" method="post" name="data_table"> <table class="table table-hover table-striped"> <tbody> <tr style="background-color:#222d32;"> <td><input type="checkbox" id="check_all" value=""></td> <td><input name="submit" type="submit" value="delete" id="submit" class="btn btn-default btn-sm"></td> <td></td> <td></td> </tr> <tr> <td><input type="checkbox" value="<?php

OpenShift idling, rationale - just a service differentiation? -

have found several q&a's related openshift's concept of application idling when there no inbound traffic 24 hours. apart fact there hacks work around it, wondering, effect since openshift claims application brought full live state when incoming request encountered. in case, apart fact http request causes application go idle state live/running state run trifle slower, there other inconvenience missing here ? in experience, first call after idling consistently fails. subsequent calls work then. due timeout, since takes while spin gears. may depend on time application takes activate, meaning specific kind of application. however switched free plan bronze while ago , did not experience problems since then.

javascript - Sencha Touch 2 error: Cannot read property 'apply' of undefined -

i have following sencha touch code. simple list view. { xtype: 'list', itemid: 'stockitemslist', ui: 'normal', flex: 1, onitemdisclosure: false, preventselectionondisclose: false, itemtpl: '<div class="act-list">'+ '<table width="100%">'+ '<tr>'+ '<td width="10%"><img align="left" src="img/icon_check2.png"/></td>'+ '<td width="80%"><b>&nbsp; {materialdesc}</b></td>'+ //'<td width="10%" ><img align="right" src="img/icon_list_disclosure.png"/></td>'+ '</tr>'+ '</table>'+ '</div>' }

AngularJS: JSON array from Filter -

i have quick question. have filter pass array , array: the filter returns json array generated underscore.js library: myapp.filter('thefilter', function () { return function(items){ return _.countby(items, function(num) { return num % 2 == 0 ? 'even': 'odd'; }); }; }); this {{array | thefilter }} outputs json array this: {{ "even":3, "odd":5 }} how can output value of example? thanks , best regards i tried, works perfectly {{(items | thefilter).even}} worked plnkr

hadoop - Unable to run pig script in pentaho -

i’m using hadoop in distributed mode. wanted execute pig script on hadoop cluster through remote machine. achive i’m using pentaho & pig script utility. set parameter such hdfs hostname: hadoop master name hdfs port: 8020 job tracker hostname: slave machine name job tracker port: 8021 pig script path i followed link enter link description here but pig script getting failed below error log 2015/03/27 16:10:20 – repositoriesmeta – reading repositories xml file: c:\users\vijay.shinde\.kettle\repositories.xml 2015/03/27 16:10:21 – version checker – ok 2015/03/27 16:10:45 – spoon – connected metastore : pentaho, added delegating metastore 2015/03/27 16:11:03 – spoon – spoon 2015/03/27 16:11:28 – spoon – starting job… **2015/03/27 16:11:28 – job_pig – start of job execution** 2015/03/27 16:11:28 – job_pig – starting entry [pig script executor] 2015/03/27 16:11:29 – pig script executor – 2015/03/27 16:11:29 – connecting hadoop file system at: hdfs://server_name:8020 2015/03/27

How to auto scroll when image view is dragged to end in Android -

so have 2 horizontal scrollview , take 1 image 1 scrollview another. want second scroll view autoscroll when dragged image reaches either end of horizontalscrollview. cover art in music applications. what i've done attached drag listener second scroll view , whenever event.getx() value crosses threshold, call hsv2.smoothscrollby(value, 0). problem scrolls once. want scrolling smooth , continuous. this demo project 1 of projects. scroller scroll automatically , continously. made show credits screen continously scrolling through list of images. might or give idea. https://github.com/blessenm/slideshowdemo