Posts

Showing posts from January, 2010

jboss7.x - JBAS014601 Error booting the container -

when run project on eclipse appears this 21:24:52,883 infos [org.jboss.modules] jboss modules version 1.1.1.ga 21:24:53,056 info [org.jboss.msc] jboss msc version 1.0.2.ga 21:24:53,103 info [org.jboss.as] jbas015899: jboss 7.1.0.final "thunder" starting 21:24:53,442 error [org.jboss.as.controller] jbas014601: error booting container: java.lang.runtimeexception: org.jboss.as.controller.persistence.configurationpersistenceexception: jbas014676: failed parse configuration @ org.jboss.as.controller.abstractcontrollerservice$1.run(abstractcontrollerservice.java:161) [jboss-as-controller-7.1.0.final.jar:7.1.0.final] @ java.lang.thread.run(unknown source) [rt.jar:1.7.0_03] caused by: org.jboss.as.controller.persistence.configurationpersistenceexception: jbas014676: failed parse configuration @ org.jboss.as.controller.persistence.xmlconfigurationpersister.load(xmlconfigurationpersister.java:125) [jboss-as-controller-7.1.0.final.jar:7.1.0.final] @ org.jboss.as....

scala - Complexity estimation for simple recursive algorithm -

i wrote code on scala . , want estimate time , memory complexity. problem statement given positive integer n , find least number of perfect square numbers (for example, 1, 4, 9, 16, ...) sum n . for example, given n = 12 , return 3 because 12 = 4 + 4 + 4 ; given n = 13 , return 2 because 13 = 4 + 9 . my code def numsquares(n: int): int = { import java.lang.math._ def traverse(n: int, ns: int): int = { val max = ((num: int) => { val sq = sqrt(num) // perfect square! if (sq == floor(sq)) num.toint else sq.toint * sq.toint })(n) if (n == max) ns + 1 else traverse(n - max, ns + 1) } traverse(n, 0) } i use here recursion solution. imho time complexity o(n) , because need traverse on sequence of numbers using recursion. right? have missed anything?

angularjs - how to have ui-select placeholder return when ui-select is disabled -

i using ui-select dropdown select follows example demo code closely. ui-select working great. adding angular-material checkbox. intent have checkbox enable/disable dropdown select. setting ng-disabled property of ui-select element state variable use in checkbox. working fine, when uncheck box, dropdown select disabled, when check box, dropdown select enabled. i want default placeholder (when no items have been selected yet) return whenever dropdown select disabled. is, after selecting dropdown item, displayed in ui-select replacing default placeholder. when dropdown select disabled, want placeholder replace selected item. way when dropdown enabled again, starts placeholder. have tried different approached, not conversant enough angular work. if enable clear functionality, 'x' , indeed clear selection , return placeholder, need programatically checkbox callback. so how force placeholder of ui-select element togglesession click callback of checkbox element? i impress...

php - Mysql select from multiple rows in one query -

i have mysql database table (that stores settings app): table name: settings id param_name param_value -------------------------------- 1 ringtone 12.mp3 2 user nick 3 email nick@example.com 4 location athens, greece 5 phone 0123456789 6 time_offset gmt+3 the "id" column auto-incremental , gets value mysql. the column "param_name" has initial values (such as: ringtone, user ...etc) the column "param_value" takes it's values dynamically "settings" form each parameter has it's unique value. i want select these rows 1 query , turn each 1 of them variable such as: $this_ringtone = "12.mp3"; $this_user = "nick"; $this_email = "nick@example.com"; $this_location = "athens, greece"; $this_phone = "0123456789"; $this_time_offset = "gmt+3"; i can multiple queries since rows lot more, prefer single mysqli ...

objective c - iOS Rotation Gesture after animation -

first question take easy! creating simple ios app. have view contains rotating dial (a uiimageview) (rotates through rotation gesture) , uibutton when pressed uses uiview animatewithduration move button 1 of 3 locations. my issue.. rotating dial fine, moving button fine, but.. when move button, rotate dial, location of button "reset" original frame. how can stop rotation effecting location of button / movement of button. viewcontroller.h #import <uikit/uikit.h> #import <avfoundation/avfoundation.h> @interface viewcontroller : uiviewcontroller <uigesturerecognizerdelegate>{ iboutlet uiimageview *lock; iboutlet uilabel *number; iboutlet uilabel *displaynumber1; iboutlet uilabel *displaynumber2; iboutlet uilabel *displaynumber3; iboutlet uibutton *slider; avaudioplayer *theaudio; } @property (retain, nonatomic) iboutlet uiimageview *lock; @property (retain, nonatomic) iboutlet uilabel *number; @property (retain, nonatomic) iboutlet uilabel *...

haskell - Is it really a default practice to make every monad transformer an instance of MonadTrans? -

so real world haskell says: every monad transformer instance of monadtrans but i'm playing scotty , found out base monad transformer scottyt not instance of monadtrans . looking @ release notes seems deliberate design decision: here . quote: the monad parameters scottyt have been decoupled, causing type of scottyt constructor change. result, scottyt no longer monadtrans instance ... i hope understand confusion. nevertheless, try formulate strict questions: why 1 not want monad transformer instance of monadtrans ? how explain aforementioned change in scottyt design? p.s.: understand can define instance of monadtrans scottyt myself, should i? (links questions) scottyt not monad transformer. let's inline (simplified) definition: newtype scottyt' m = scottyt' { runs :: state [ (request->m response) -> request->m response ] } to define lift need, general m a action , such middlewares list, have obtain actual a ...

android - addProximityAlert is not working if Location service is disabled -

i'm using locationmanager#addproximityalert function alert user when enter range of places, if location service enabled works fine , notifications, when location disabled nothing. need receive alerts if location not enabled, here code: locationmanager = (locationmanager) getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.network_provider, minimum_time_between_update, minimum_distancechange_for_update, new locationlistener()); public void preparenotifications() { // nearproductslocs array of locations (int = 0; < nearproductslocs.length; i++) { log.d(tag, "order" + + " " nearproductslocs[i]); // +++++++++++++++++++++++++++++++++++++++++++++++++ // add addproximityalerts location loc = nearproducts[i]; addproximityalert(loc.getlatitude(), loc.getlongitude()); } } private void addproximityalert(double latitude, double longtitude, int productid) { intent inten...

How to reproduce "java.net.SocketException.Connection reset"? -

i trying reproduce "java.net.socketexception.connection reset" exception. wanted know if there program available me simulate it. tried following server , client programs see if simulate not able exception. using java8. server code- import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.net.serversocket; import java.net.socket; import java.net.socketexception; import java.net.sockettimeoutexception; public class simpleserverapp { public static void main(string[] args) throws interruptedexception { new thread(new simpleserver()).start(); } static class simpleserver implements runnable { @override public void run() { serversocket serversocket = null; try { serversocket = new serversocket(3333); serversocket.setsotimeout(0); //serversocket. while (true) { try { ...

coffeescript - How do I get a Slack message's id/timestamp from a Hubot script? -

there doesn't seem timestamp property , id property undefined . here hubot's plugin script code: module.exports = (robot) -> robot.hear /\bclocks?\b/i, (msg) -> msg.http("https://slack.com/api/reactions.add") .query({ token: process.env.slack_api_token name: "bomb" timestamp: msg.message.timestamp # property doesn't exist }) .post() (err, res, body) -> console.log(body) return the response slack api is: {"ok":false,"error":"bad_timestamp"} when log msg.message looks this: { user: { id: 'abc123', name: 'travis', room: 'test-bots', reply_to: 'zyx987' }, text: 'clock', id: undefined, done: false, room: 'test-bots' } how can timestamp or id message triggered listener? i heard slack's team , there newer property called rawmessage have access when upgrade newer ...

java - Unreachable Statement Error Message -

i making simple program. when compile it, bluej says "unreachable statement" , highlights "system.out.println(mystery("deliver"));". i'm unsure do. complete println statement , run in main method, gives me same error. public class test7 { public string mystery(string s) { string s1= s.substring(0,1); string s2= s.substring(1, s.length()-1); string s3= s.substring(s.length()-1); if (s.length() <= 3) return s3 + s2 + s1; else return s1 + mystery(s2) + s3; system.out.println(mystery("deliver")); } } whether if -statement true or false , return, println statement cannot reached. maybe became clearer once corrected bad indentations. cannot answer should do, since haven't declared intention. did intend println statement in separate main method, perhaps?

android - How to use MediaSessianCompat for Media playback? -

i have spent literally whole day trying understand how mediasessioncompat works , does? how different mediaplayer or audiomanager class? honest did not find explanation. info got android docs , codes found on web which, according me not sufficient in case. helpful thing this video ian lake found on youtube. still not able understand how can use in our app. this code found ian lake, , spent quite time on still have lots of doubts. package com.example.remotecontrolclient; import android.app.service; import android.content.componentname; import android.content.context; import android.content.intent; import android.graphics.bitmapfactory; import android.media.audiomanager; import android.os.ibinder; import android.support.v4.media.mediametadatacompat; import android.support.v4.media.session.mediasessioncompat; import android.support.v4.media.session.playbackstatecompat; public class playerservice extends service { private mediasessioncompat mediasession; @override p...

string - Append key data from the GO MAP -

i have map in go of type : var userinputmap = make(map[string]string) the values in : userinputmap["key1"] = value1 userinputmap["key2"] = value2 userinputmap["key3"] = value3 now, how can generate string contains al above keys in comma seprated format? output:= "key1,key2,key3" thanks lot. iterate in loop , append key string: package main import "fmt" func main() { var userinputmap = make(map[string]string) userinputmap["key1"] = "value1" userinputmap["key2"] = "value2" userinputmap["key3"] = "value3" output :="" key,_ := range userinputmap { output +=(key+",") } output = output[:len(output)-1] fmt.println(output) }

Excel - COUNTIF for multi column data set with filterable criterium -

Image
i have 14 column range of survey data presented in 1's, 0's , "null". in column, have company names survey submitted. want count number of 1's (satisfied), 0's (unsatisfied) , nulls (no answer), , average satisfaction rate, each company name. for example, on grand total row of pivot table, counting satisfactory marks =countif(table1[[q1]:[q14]],1) can't figure out how limit count rows specific company name. edit here screenshot of sheet trying describe. http://imgur.com/twwrvov with linga’s countifs suggestion, wrote =countifs(table1[[q1]:[q14]],1,table1[company name],”company1”) , #value error. i believe error because number of cells in 2 ranges don’t align, tried including each q column separate criteria range like: =countifs(table1[q1],1,table1[q2],1,…table1[company name],”company1”). the formula validated count not correct. after seeing snap hope have use sumif formula. please see snap reference first need sum each rows da...

spring - Tomcat Show HTTP Status 400 Error Page During Validation -

i'm learning make bean validation works in spring mvc thymeleaf default view. every valid data can saved properly. when tried invalid data passed, tomcat showed http status 400 error page. in tomcat console showed validation became logging text in tomcat console. here controller saves data (item). @controller @requestmapping("/item") @sessionattributes("item") public class itemcontroller { @autowired private itemservice itemservice; @autowired private colorservice colorservice; @modelattribute("allcolors") public list<color> populatecolors() { return colorservice.findall(); } @modelattribute("allitems") public list<item> populateitems() { return itemservice.findall(); } @requestmapping(value = {"/image/{id}", "image/{id}"}) @responsebody public byte[] showimage(@pathvariable("id") string id) { return itemservice.geti...

c# - Deserialize using DataContractSerializer -

i trying deserialize xml file looks following <?xml version="1.0"?> <test xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns="http://schemas.datacontract.org/2004/07/consoleapplication6"> <values> <string>value 1</string> <string>value 2</string> </values> </test> to object this [datacontract(namespace = "http://schemas.datacontract.org/2004/07/consoleapplication6")] public class test { [datamember(name = "values")] public string[] values; } with var ds = new datacontractserializer(typeof(test)); using (stream stream1 = file.openread(@"c:\projects\test1.xml")) { test rr = (test)ds.readobject(stream1); } however none of values deserializing. see , empty array in test rr. please tell doing wrong. in advance. if need fine control of xml emitted when serializing, should no...

css - Javascript: Taking a specific action on reaching a number -

i'm learning javascript, , decided try out simple guessing game thing. code have @ moment: the html: <!doctype html> <html> <head> <title>guessing game</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="utf-8"> <link href='https://fonts.googleapis.com/css?family=open+sans:400italic' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=roboto' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="guessing_game.css"> </head> <body> <h1>welcome guessing game</h1> <p>you have guess number within 5 attempts, luck!</p> <p>enter number:</p> <input type="text" id="number" placeholder="enter number"></br>...

c# - Deleting Duplicates From An Array -

i have code load text file , save array. array contains list of numbers of numbers being duplicated. in code first loop through array , replace duplicated numbers -1. plan on deleting -1 values array. remaining array values (non duplicates) copied on new array outputted. however keep getting error when attempt delete -1 values array (see code below). don't know why happening if knows please let me know! p.s. school project can use loops , if statements, not things linq or foreach, etc. public partial class form1 : form { //global variable int[] original; public form1() { initializecomponent(); } //exit application private void mnuexit_click_1(object sender, eventargs e) { this.close(); } //load file private void mnuload_click_1(object sender, eventargs e) { //code load numbers file openfiledialog fd = new openfiledialog(); //open file dialog , check if file selected if (fd....

asp.net - Can I move all logic in Load to PreRender? -

we have user control , in user control there many sub-controls. the user control reads database , set visibility , other properties of sub-controls. my friend puts of logic in prerender event , says visibility set in prerender. true? what best practice of choosing load , prerender? problems have if write logic in prerender? i copy statements https://msdn.microsoft.com/en-us/library/ms178472.aspx , know i've read them hundred times. use onload event method set properties in controls , establish database connections. are there problems if establish database connections in prerender? prerender: use event make final changes contents of page or controls before rendering stage begins. why can't use last change rather final minor modification?

json - In Android how can I post this JSONObject to a server? -

hashmap<string,string> list = new hashmap(); list.put("uid",string.valueof(3)); list.put("longitude", "10.13"); list.put("latitude", "20.33"); jsonobject jo = new jsonobject(list); the documentation not entirely clear next. given server url http://example.com/update.php , server able parse json object. i unable use deprecated apache httpclient object post because i'm using api 23 , downgrading api not option there multiple http client libraries available google volley , retrofit , loopj async . prefer volley when working json format. for posting json object via volley this: jsonobjectrequest strreq = new jsonobjectrequest(request.method.post, your_url, yourjsonobject, new response.listener<jsonobject>() { @override public void onresponse(jsonobject jobj) { // these if request successful } }, new response.errorlistener() { @override public void onerrorresponse...

javascript - How to return a http get request from rest api with angular factory? -

i trying return http request rest api url inside factory. it's not returning data instead function. when use console log inside controller show whole function. myapp.factory('userfactory', function($http) { var factory = []; factory.users = function(){ $http({ url: '/test/users', method: 'get' }) .then(function successcallback(response) { factory.users = response; }, function errorcallback(response) { factory.users = response; }); return factory.users; }; return factory; }); i same thing in projects. check out repo here: https://github.com/ahmadabdul3/mean-flappernews/tree/master/public/index/angular the httpservice http handler. can @ postsservice, see getallposts function basically comments say, have return promise , handle in controller so this: function getallposts() { httpservice.baseget(httpurls.posts) ...

autolayout - iOS 9 status bar appears below black bar -

Image
what happening app in xcode 7 / ios 9? the whole screen looks condensed, if iphone 4s app displaying on iphone 6. looks normal in iphone 4s simulator. i thought problem auto layout constraints in main storyboard, deleted apart root view in root view controller (blue screen), , there's still problem it. i tried enabling size classes, thinking problem due being disabled, result same. is else getting problem in existing apps running in ios 9? target>general>launch image source>use asset create new asset named brandasset, place launch images on here. create launchscreen.storyboard if not existing , select target>general>launch screen file.

python - Storing EXIF GPS data as decimal degrees -

i wondering if there's way store gpslatitude , gpslongitude decimal degrees rather default way of degrees, minutes, , seconds (dms). know how convert between two, specific project i'm asked if it's possible encode gps data jpeg exif data decimal degrees. ideas?

import Fabric in android eclipse -

i have latest version of eclipse v23 , have install fabric in eclipse , have faced problem in importing twitterauthconfig cannot resolved type , other thing related fabric can't resolved also. have tried refresh project not work. dose face same problem? eclipse sucks. my library folder this project directory you need set buildpath of kit-libs. below steps : 1) right click on project 2) select build path > configure build path 3) add jar files kit - libs in libraries folder , check jars in order , export tab. this how can resolved problem. hope helps.

image - fabricjs mouse events fail after setSrc() -

when changing selected canvas image larger image using setsrc(), mouse events not recognized on areas of new image lie outside of xy boundaries of original smaller image. conversely, when changing selected canvas image smaller image, mouse events are recognized on areas outside of new image xy boundaries of original larger image. in either case, once new image receive mouse click, things return normal entire image receives mouse events, no more, no less. also, controls appear in correct locations not clickable stated above. is there way correct behavior complete visible image can receive mouse events? http://jsfiddle.net/kamakalama/0ng18cas/10/ html <body> <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <button id="butt">change image</button> <canvas style="border:1px solid silver;" width=500 height=400 id="c"></canvas> </body> javascript $(docu...

html - Styling textarea's "required" attribute with CSS doesn't work -

i have added inputs, name, email etc. required attribute , provided through css, icons signify invalidated/validated status perfectly. however, same styling not insert icons in 2 textareas of form? i have seen should remove whitespace between tags, sure have, didn't solve it. <form id="from"> <table width="742" border="0"> <caption> <h1>your details</h1> <br> </caption> <tr> <td width="117">first name</td> <td width="161"><input class="input-small" type="text" placeholder="" required></td> <td width="29">&nbsp;</td> <td width="242">date of birth</td> <td width="171"><input class="input-small" type="text" placeholder="eg. 01/05/1975" required></td> </tr> <tr> ...

javascript - Can't display array output -

<script type="text/javascript"> function show(){ var word = document.getelementbyid("inp").value; var letters = []; for(i=0; i<=word.length; i++){ letters = word.substring(i,i+1); } document.getelementbyid("div").innerhtml = letters[0]; //setinterval(); } </script> </head> <body> <input type="text" id="inp" /> <button onclick="show()">show</button> <br> <div id="div"></div> </body> the output of "letters[0]" showing undefined. want create array, where, let's if input "hello", then, output like: letters[0] = "h" letters[1] = "e" letters[2] = "l" .... and also, add setinterval() function it, displays letters, 1 one, delay. thanks! use push method add elements in array replace letters = word.substring(i,i+1); by letters.push(word.su...

javascript - How to make ajax call and get results back while typing in input text -

Image
i want implement functionality when enter text in <input path="tags" id="input-search"/> there should appear list of suggested tags after making ajax call. have database query public interface tagrepository extends jparepository<tag, integer> { @query("select t tag t name concat('%', :name, '%')") list<tag> findtagbyname(@param("name") string name); } and controller code @requestmapping(value = "/gettags", method = requestmethod.post, produces = "application/json") public @responsebody list<tag> gettags(@requestbody tag tag, httpservletresponse response) { system.out.println("found " + string.valueof(tagservice.findtagbyname(tag.getname()).size())); return tagservice.findtagbyname(tag.getname()); } javascript ajax $(document).ready(function() { $("#tag-search").autocomplete({ sou...

python - scikit SVM returns ValueError: X.shape[1] = 181 should be equal to 865, the number of features at training time? -

i training svm on combination of string , numeric dataset, below code , test , training set. when running code, throws following error. import numpy np import pandas pd import scipy.sparse sp import sklearn.preprocessing import sklearn.decomposition import sklearn.linear_model import sklearn.pipeline import sklearn.metrics sklearn.feature_extraction.text import countvectorizer sklearn import svm class unirank(object): vect = countvectorizer(ngram_range=(1, 3)) def __init__(self, trained_data_csv, sep=","): df = pd.read_csv(trained_data_csv, sep=sep) sample = df[['name', 'location']] sample = sample.apply(lambda col: col.str.strip()) # convert characters matrix train = sp.hstack(sample.apply(lambda col: self.vect.fit_transform(col))) values = df[['score']] values.to_records() # feature selection , manipulation self.clf = svm.svc(gamma=0.001, c=100) ...

opencv - outline drawing of text using Emgu -

i want annotate camera feed. using these apis image<bgr, byte>.draw(); however depending on lighting text not readable. draw text black border , white fill. how do using emgu? var labeledcameraframe = new image<bgr, byte>(cameraframe.bitmap); var border = new rectangle(0, 0, 200, 40); labeledcameraframe.draw(border, new bgr(color.white), -1); labeledcameraframe.draw(border, new bgr(color.black)); cvinvoke.puttext(labeledcameraframe, "hello, world", new point(10, border.height - 10), fontface.hersheysimplex, 1.0, new bgr(color.blue).mcvscalar);

python - Multiple y axis using matplotlib not working -

Image
i have used following code plot graph using matplotlib 4 parameter x=depth, y1=temp, y2=salinity, y3=velocity value of velocity not display , 2nd , 3rd axes not adjustable(scale value) 1st when zoom has constant scale value, how make adjustable(scale value) ,i mean scale value variable axes when zoom in zoomout. mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist aa import matplotlib.pyplot plt import numpy np if 1: host = host_subplot(111, axes_class=aa.axes) plt.subplots_adjust(right=0.75) par1 = host.twinx() par2 = host.twinx() offset = 60 new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, offset= (offset, 0)) par2.axis["right"].toggle(all=true) # host.set_xlim(0, 2) #host.set_ylim(0, 2) host.set_xlabel("depth") host.set_ylabel("temperature") par1.set_ylabel("salinity...

Amazon S3 download authentication -

i have created bucket in amazon s3 , have uploaded 2 files in , made them public. have links through can access them anywhere on internet. want put restriction on can download files. can please me that. did try documentation, got confused. i want @ time of download using public link should ask credentials or authenticate user @ time. possible? by default, objects in amazon s3 private. can add permissions people can access objects. can done via: access control list permissions on individual objects a bucket policy iam users , groups a pre-signed url as long @ least 1 of these methods granting access, users able access objects amazon s3. 1. access control list on individual objects the make public option in amazon s3 management console grant open/download permissions internet users. can used grant public access specific objects. 2. bucket policy a bucket policy can used grant access whole bucket or portion of bucket. can used specify limits access. exa...

powershell - Get hashtable value by key of group object under strict mode version 2? -

the following script, pivot array list x , y , doesn't work. ( $hashvariable.x not working). how rewrite it? seems it's not easy simple value key in hashtable under strict mode. set-strictmode -version 2 # change 2 1 work $a = @('a','b','x',10), @('a','b','y',20), @('c','e','x',50), @('c','e','y',30) $a | %{ new-object psobject -prop @{"label" = "'$($_[0])','$($_[1])'"; value=@{ $_[2]=$_[3]}} } | group label | % { "$($_.name), $($_.group.value.x), $($_.group.value.y)" # error #"$($_.name), $($_.group.value['x']), $($_.group.value['y'])" # empty x,y } expected result. 'a','b', 10, 20 'c','e', 50, 30 error: property 'x' cannot found on object. make sure exists. @ line:6 char:35 + "[$(@($_.name -split ","...

How to search an index by value in two dimensional array in php -

i have function description of courier , records fetched courier , stored in $couriers . $courier 2 dimensional array since containing rows of table couriers . [ { "id":"1", "name":"dtdc", "description":"automatically inserted application ", "bloked":"false" }, { "id":"2", "name":"ecomm", "description":"nothing", "bloked":"false" }, { "id":"3", "name":"marginprice", "description":"local only", "bloked":"false" } ] now , have fetch decription of courier id given . purpose , must know index of records .. tried using array_search "hard time" . , ask give idea know index of records in array function getcourierdescriptionbyid($id) { global $couriers; if($couriers==null) { loadcourier($id); ...

apache spark - PySpark RDD processing for sum of parts -

i have rdd tuples (datetime, integer). , try rdd of interval summation pyspark. for example, followings (2015-09-30 10:00:01, 3) (2015-09-30 10:00:02, 1) (2015-09-30 10:00:05, 2) (2015-09-30 10:00:06, 7) (2015-09-30 10:00:07, 3) (2015-09-30 10:00:10, 5) i'm trying followings sum of every 3 seconds: (2015-09-30 10:00:01, 4) # sum of 1, 2, 3 seconds (2015-09-30 10:00:02, 1) # sum of 2, 3, 4 seconds (2015-09-30 10:00:05, 12) # sum of 5, 6, 7 seconds (2015-09-30 10:00:06, 10) # sum of 6, 7, 8 seconds (2015-09-30 10:00:07, 3) # sum of 7, 8, 9 seconds (2015-09-30 10:00:10, 5) # sum of 10, 11, 12 seconds please, give me hints? i assume input rdd time_rdd tuples first element datetime object , second element integer. use flatmap map every datetime object previous 3 seconds , use reducebykey total count window. def map_to_3_seconds(datetime_obj, count): list_times = [] in range(-2, 1): list_times.append((datetime_obj + timedelta(seconds = i), co...

Is there any example of using mbind in C/C++ code? -

i trying use mbind() in c++ code in order rearrange virtual pages across 4 numa domains, unfortunately new function: long mbind(void *addr, unsigned long len, int mode, const unsigned long *nodemask, unsigned long maxnode, unsigned flags); currently, have this: mbind(0x0,4611686018424767488,mpol_bind,nodemask,maxnode,mpol_mf_move); from specs it's still unclear me put , how put nodemask , maxnode . nodemask pointer bitmask of allowed numa nodes. bitmask array of unsigned long elements each array element holding many bits size of unsigned long int on particular architecture allows. unless program running on big numa system, single unsigned long variable should suffice. maxnode gives number of significant bits in nodemask . kernel rounds internally size multiple of sizeof(unsigned long) uses maxnode bits. there many examples , libraries around allow create , conveniently manipulate bitmasks without having fiddle bit operations yourse...

lotus notes - Xpage call the agent to export excel -

i found code on website: http://www.botstation.com/code/view2excelweb.php it mentioned agent can export views in excel format, tried use it. i created agent called "agenttest" , paste code inside. i used button call agent perform action. this code set on click event (server side) button: database.getagent("agenttest").run() for agent basics part, set runtime trigger "on event", agent list selection , target "none". for agent security part, checked checkbox "run web user" , choose " 2. allow restricted operations" runtime security level. i saved , run code, did not excel file. i tried find out problem use debug lotusscript tools , nothing happen when click button. grateful advice on issue. thank much. yours faithfully, beginner (edit update) i ask 1 more question base on website http://www.botstation.com/code/view2excelweb.php please. since agent needs call url, website has been given exampl...

ios - UITableViewCellAccessoryCheckmark get vanished after scrolling the tableview -

Image
i'm working on tableview multiple selection, deselect. i'm having 3 table views (the tableview have tag 400 need multiple selection , deselection -> alllmumbaitableview) my issue : when i'm selecting multiple rows, uitableviewcellaccessorycheckmark vanished after scrolling tableview. thing here can see cells still in selected state not showing uitableviewcellaccessorycheckmark . after scrolling table looking this here code @property (nonatomic, strong) nsmutablearray *arrindexpaths; uitableview methods - - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *simpletableidentifier = @"simpletableitem"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:simpletableidentifier]; if(tableview.tag == 100) { cell.textlabel.text = [typearray objectatindex:indexpath.row]; } ...