Posts

Showing posts from March, 2015

android - Checking for google play services -

it drives me crazy how important documentation overlooked in google docs. have plucked out hair if wasn't bald already. private void checkgoogleplayservices() { int errorcode = googleapiavailability.getinstance().isgoogleplayservicesavailable(this); boolean iserrorresolvable = googleapiavailability.getinstance().isuserresolvableerror(errorcode); if (iserrorresolvable) { googleapiavailability.getinstance().geterrordialog(this, errorcode, request_code_google_play_services).show(); } else { if (errorcode == connectionresult.success) { launchapplication(); } } } the above code displays dialog box says has button reading get google play services : @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == request_code_google_play_services) { } } now should here ? how should direct user play store update playservices? deem geterrorr

multiple inheritance in python with super -

this question has answer here: how python's super() work multiple inheritance? 11 answers class parent1(object): def foo(self): print "p1 foo" def bar(self): print "p1 bar" class parent2(object): def foo(self): print "p2 foo" def bar(self): print "p2 bar" class child(parent1, parent2): def foo(self): super(parent1, self).foo() def bar(self): super(parent2, self).bar() c = child() c.foo() c.bar() the intention inherit foo() parent1 , bar() parent2. c.foo() resulting parent2 , c.bar() reulting error. please point problem , provide solution. you call methods directly on parent classes, providing self argument manually. should give highest level of control , easiest way understand. other points of view might suboptimal though. here&#

ios - Want to change the position of the cancel button of the UISearchBar -

Image
i want change place cancel button appears instead of appearing on right side in image want appear on left side of search bar. you cannot change position of default searchbar , search display controller. for requirement, need create own custom search bar cancel desire. hope helps..

ruby on rails - How do I add values in an array of arrays? -

i have array of arrays 4 integer elements this: arrays = [[a1,b1,c1,d1],[a2,b2,c2,d2],[a3,b3,c3,d3]] i want add these 3 arrays. result should in 1 array like: result = [a1+a2+a3,b1+b2+b3,c1+c2+c3,d1+d2+d3] i tried not able this. >> arrays = [[1,2,3,4],[2,3,4,5],[3,4,5,6]] => [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6]] >> arrays.transpose.map { |xs| xs.inject :+ } => [6, 9, 12, 15]

c# - CurrentMotion is not change in Distance Sensor at Microsoft Band -

i new microsoft band app development. trying detect when user running or walking. listen distance sensor under sensormanger . distance sensor send currentmotion has 5 state : idle jogging running unknown walking i idle state when walking or running. all other values : speed, pase, totaldistance update well. my question : when microsoft band change currentmotion or how can detect user running or not ? i trying following code : var pairebands = await bandclientmanager.instance.getbandsasync(); var bandclient = await bandclientmanager.instance.connectasync(pairebands[0]); bandclient.sensormanager.distance.readingchanged += async (o, e) => { debug.writeline(e.sensorreading.currentmotion.tostring()); debug.writeline(e.sensorreading.speed.tostring()); debug.writeline(e.sensorreading.pace.tostring()); debug.writeline(e.sensorreading.totaldistance.tostring()); debug.writeline(e.sensorreading.distancetoday

web services - how can i get data from webservice in jsp -

this part of view.jsp: <form action="some_test_url" method="get"> <input type="hidden" name="operation" value="sumoketos_sumos" /> <input type="text" name="kodas"> <input type="submit" value="ieškoti" /> </form> im getting result in new page: {"id":"102061","metai":"2015","suma":"-2627.3"} how can put data table on same view.jsp page? you use resourceurl , perform action in ajax. in response, use javascript place information in table.

How to add directory in CVS -

i have cvs server. want add new directory in existing directory. how can this? cvs add command adds files in existing directory. want know how add sub folder in cvs folder. create directory in local workspace. cvs add <dirname> . that's it. note unlike adding files, require subsequent cvs commit , when adding directory add happens on server you've done cvs add make sure choose right directory name.

java - How to implemenet correct interaction between Controller and Service layer in Spring MVC -

i have designed web app spring mvc, spring security , hibernate. have controller interacts service layer: @controller @requestmapping(value="/") public class initcontroller { @autowired private userservice userservice; @autowired private studentservice studentservice; @initbinder public void initbinder(webdatabinder databinder){ databinder.registercustomeditor(string.class, "studentgroup", new studentnameeditor()); } @requestmapping(value = "/login", method = requestmethod.get) public modelandview getloginform(){ return new modelandview("login"); } @requestmapping(value = "/registration.html",method = requestmethod.get) public modelandview getregistrationform(){ return new modelandview("registration"); } @requestmapping(value = "/students.html",method = requestmethod.get) public modelandview getgroupform(){ return

java - Dagger 2 - what's the proper way to use the components and modules? -

after playing around dagger 2 , managed inject dependencies dependent objects, not sure right way of doing it, , want proper way. the way did it, have one component includes multiple modules , injection in top class, , dependencies "seep" in. proper way? app component: @singleton @component(modules = {appmodule.class, servicemodule.class, callalarmmodule.class}) public interface appcomponent { void inject(healthcheckerapplication app); void inject(settingsactivity activity); void inject(alertcreator alertcreator); void inject(healthservice service); inotificationdatafactory providefactory(); } modules: @module public class appmodule { healthcheckerapplication app; alertcreator alertcreator; public appmodule(healthcheckerapplication app) { this.app = app; this.alertcreator = new alertcreator(app); } @provides @singleton public sharedpreferences providesharedprefs() { return preferencem

android - Google maps API v2 not working on device -

currently working on google maps , creating followed instructions in android developers site. cant load map in device, can point various places , all. device support google api v2? there way view map on device? device version 2.3.3. i have working googlemaps v2 application , had same issues describe. problem in case api key used not matching certificate used sign application (debug/dev development phase , release play released app). application working on android versions 10 , on (so works on 2.3.3). log error sssems may having connectivity issue. did declare appropriate uses permissions? should be: <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location"/> here short snippet of main map code: public class locationactivity extends mapactivity { private mapcontrol

android - gridview overlap horizontally in pre lollipop device -

i used hacky gridview because need gridview wraps content in scrollview used custom gridview this site . in prelollipop version ok in lollipop there no border content of grid view. set vertical spacing below. <bazit.utils.wrapcontentheightgridview android:id="@+id/four_items_gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:numcolumns="3" android:gravity="center" android:stretchmode="columnwidth" android:verticalspacing="@dimen/home_category_items" android:horizontalspacing="@dimen/home_category_items"> </bazit.utils.wrapcontentheightgridview> and using cardview image in after cards overlap in pre-lollipop version device. , cardviews shift right little. overlapping cardviews i used margin cardview not working. i find answer. container view set rtl(right left). change ltr , fixed problem.

mysql - how to select where entire field is uppercase in sql -

this question has answer here: select fields contains uppercase letters 6 answers i need select of rows company name upper case. field called company. using sqlyog community - mysql gui v12.2.1 (64 bit). select * table_name column_name collate latin1_general_cs_ai=upper (column_name)

javascript - Trying to sort an array of objects but splice is not a function? -

the global picture trying remove duplicates array of objects. objects same advertid , leadboxid considerd duplicates testing purposes checking advertids i getting array sessionstorage , removing duplicates. var testsort = function () { var events = []; events = sessionstorage.events; console.log("events unsorted"); console.log(events); (var = 0; < events.length; i++) { (var x = + 1; x < events.length; x++) { if (events[x].advertid == events[i].advertid) { events.splice(x, 1); --x; } } // add } the console prints out events array such: [{"module":"slick_module","eventtype":"swipe","leadboxid":"1565","advertid":"5653","length":"length of event","time":1462783354789,"posted":"postedstatus"},{"module":"slick_module&qu

multithreading - java recommended way for shutting down multiple user sessions -

we want disconnect our clients server. so sent out messages sessions, include commands "close yourself"l so in general this: for (session session : sessions) { closesession(session); while(!verifyclosed(session)){ closesession(session); retries++; if(retries==10){ retries = 0; break; } }; } now give seconds (let's 5) each session closed before doing sigterm kill methods. so preferred way: doing loop maximum of 5 seconds delay each session close procedure. or start each session thread procedure sessions should closed @ same time. for (session session : sessions) { startclosingthread(session); } update: i notice users falsly hung on word "session", problem not sessionhandling @ all. if send closing message or disconnect socket not matter. not problem. you replace word session userthread. the problem need advice is:

php - Mysql group by fetch last row -

select * conversation_1 left join conversation_2 on conversation_1.c_id = conversation_2.c_id left join user on conversation_2.user_id = user.user_id left join message on conversation_1.c_id = message.c_id conversation_1.user_id=1 group message.c_id conversation_1 conversation_2 c_id user_id c_id user_id 1 1 1 2 2 1 2 3 3 2 i have message db build in mysql i make 4 tables user, conversation_1, conversation_2, message when user try open message box, fetch out conversations(conversation_1) than join user conversation_2 , use conversation_2 find out user than join message. c_id user_id user_name message 1 2 alex hi user_1, user_2 2 3 john hi user_3, user_2 don't talk me it works fine, want display message last row group by currently display 1st row in group. ps.conversation_1.c_id auto increment , c_id insert conversation_2 has join conv

UglifyJs JavaScript API for JSON minification? -

so looping through files in directory via node , want minify them uglifyjs. the api dead easy javascript files: var uglifyjs = require("uglify-js") // looping here uglifyjs.minify(listofallfiles[i]) however, files need minify json files, producing eval error. in command line, if minifying json, pass --expr , evaluate single expression. idea how pass options object of javascript api? cheers. if you're not dead set on uglifyjs, solve plain javascript, because json can't uglified much. remove whitespace, do json.stringify(json.parse(listofallfiles[i])) to remove whitespace. (assuming listofallfiles[i] json string.)

jquery - Troubles getting value from bootstrap-slider -

i using bootstrap slider forecasting tool building. have following function: function updatecontractconcern () { showloader(); var funcid = "call_chart_contract_concern" var forecastperiod = $('#forecastslider').data('slider').getvalue(); //var forecastperiod = 4; console.log('forecastperiod') var jqxhr = $.getjson('functions/getfunctions.php', { "forecastperiod":forecastperiod, "funcid":funcid}).done(function(datachart) { hideloader(); if (datachart == null) { bootbox.alert("er geen data voor deze selectie aanwezig"); } else { setbasicpropertiesaveragescorechart(); averagescorechart.dataprovider = datachart; averagescorechart.categoryfield = "organisatie"; averagescorechart.validatedata(); } }) .fail(fun

python - django 1.9 slug field is not working for foreign language -

i building post app, automatically creates slug post title. if there foreign language in title, slug not getting generated. i have gone through of answers here, it's not helping much. missing in below ? class post(models.model): title = models.charfield(max_length=120) slug = models.slugfield(unique=true, allow_unicode=true) content = models.textfield() def create_slug(instance, new_slug=none): slug = slugify(instance.title) if new_slug not none: slug = new_slug qs = post.objects.filter(slug=slug).order_by("-id") exists = qs.exists() if exists: new_slug = "%s-%s" %(slug, qs.first().id) return create_slug(instance, new_slug=new_slug) return slug def pre_save_post_receiver(sender, instance, *args, **kwargs): if not instance.slug: instance.slug = create_slug(instance) added below in settings.py : allow_unicode_slugs = true you need tell slugify should allow unicode, t

jasper reports - How to display rich text editor value? -

i'm new jasperreports . in database saved rich text editor value in particular column. value contains raw html. want display value in jasperreports 's report without markup language have set properties 'markup' html. in output table , header didn't come actual format.

c++ - How to add existing cpp codes to an objective-c project? -

i have class written in c++, declaration , implementation seperated .h , .cpp files. , want invoke in ios objective-c project xcode. changed suffix of *.m file *.mm , compilation ok, failed in linking step. ld: symbol(s) not found architecture arm64 it seems compiler did not discover *.cpp file of implementation of class. when move implementation it's *.h files, program works codes ugly. can help?i have tried change suffix of cpp mm, no success.

matlab - Windowed subtraction of vectors that are not same size and then finding the mean of results -

good day, i have question want achieve without loop if possible. title says need windowed subtraction of vectors not same size , finding mean of results. as example, let have vector = [2 3 4 5 6] , vector b = [1 2]. program have move window smaller numbers of elements (in example vector b) on bigger 1 (vector a) , make operations on way starts in first 2 elements in vector , make subtraction vector b , sum results , find mean. in example make calculation of subtraction 2-1 = 1, 3-2 = 1, summing results 1+1=2 , divide them 2 (because vector b size). final result 1. move window on second elements of vector (value 3 , 4 there, or index 2 , 3) , repeat process last elements of vector a. final result need vector c consist of elements [1 2 3 4] example. possible without looping because have data sets on 10k of size. in advance i can solve 1 loop, iterating through "b" (two loops in example). declare vectors (as columns! needed matlabs computations work) a =

html - confirmation on button not working -

for reason, confirmation function not working. here code: <tr> <td align ="right" style ="width: 50%;"> <asp:button id="button1" runat="server" text="confirm order" onclick="button1_click" onclientclick="confirm();" /> <script type="text/javascript" language="javascript" > function confirm() { if (page_clientvalidate()) return confirm('confirm order?'); } </script> &nbsp; </td> <td align ="left" style ="width: 50%;"> <asp:button id="button2" runat="server" text="cancel order"

java - What is a Node and a Property in content repository? -

i reading content repositories , reading jcr specification , documentation found on apache jackrabbit. however, still don't understand going store in node's , properties. i know actual data goes in properties. don't understand "semantic", how intended used. explain node , property? what role have? a way think jcr content model "fractal filesystem on steroids". you can start organizing content in macro tree, , see various content items micro trees own structures, independent of general content tree structure. in team's projects use macro tree structure that's similar of unix system, folders /content, /var, /etc, /tmp etc. provide familiar , clear structure. then, node might web page, subfolders images, comments, content , properties title, description, tags. storing actual content ordered set of nodes in content folder under page node makes sense, each of these content sub-nodes plays specific role in content, article header

ruby on rails - Rspec2 + Rails4: Testing for displayed model fields in form partial -

question i'd write tests check model fields displayed in "show" , "form" partials. succeeded "show", not "form". main constrain: solution must able loop through array contains each names of model fields. i believe case can interesting trying shorten test script files, while having many fields, , having complete control on what's displayed , what's not, i'll put efforts trying find solution, if please :) form view nothing fancy = form_for @user |f| = f.select :field_1, options_from_collection_for_select ... = f.text_field :field_2 ... actual situation i found easy way "show" partial, here how spec file looks like: def user_fields_in_show_view [:field_1, :field_2, ..., :field_n] end 'display fields' user_fields_in_show_view.each |field| user.any_instance.should_receive(field).at_least(1).and_call_original end render end this works well. - but exact same technique not

java - Converting date from UTC to CET -

this question has answer here: convert date/time given timezone - java 14 answers i convert date given in utc format date in cet format. the problem need add or subtract hours accordingly. example: date = "2015-07-31 01:14:05" i convert german date (adding 2 hours): 2015-07-31 03:14:05" my code: private static long convertdatefromutctocet(string publicationdate) { //"2015-07-31 01:14:05" simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); //simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd"); date date = null; try { date = simpledateformat.parse(publicationdate); } catch (parseexception e) { e.printstacktrace(); } calendar calendar = calendar.getinstance(timezone.gettimezone("utc")); calendar.sett

apache - Django Broken INTERNAL link on otherIPAddress -

why " broken internal link on xyz ", xyz not ip address of server website hosted? to more specific: website address ' myexample.com ' , there ip address let's call ' anotherexample '. 'broken internal link on anotherexample'. referrer 'http://anotherexample/somephpfile.php' , requested url of course '/somephpfile.php' .

mysql - Hibernate java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap -

every time i'm trying refresh database scheme hibernate reverse engineering file unhandled event loop exception: hibernate reverse engineering file java.lang.noclassdeffounderror: org/apache/commons/collections/multimap @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(unknown source) @ java.lang.class.privategetmethodrecursive(unknown source) @ java.lang.class.getmethod0(unknown source) @ java.lang.class.getmethod(unknown source) @ org.jboss.tools.hibernate.runtime.common.util.invokemethod(util.java:41) @ org.jboss.tools.hibernate.runtime.common.abstractoverriderepositoryfacade.addtablefilter(abstractoverriderepositoryfacade.java:31) @ org.hibernate.eclipse.mapper.editors.reverseengineeringeditor.getlazydatabaseschema(reverseengineeringeditor.java:219) @ org.hibernate.eclipse.mapper.editors.reveng.typemappingformpart$1.dorefreshtree(typemappingformpart.java:57) @ org.hibernate.eclipse.console.wizards.treetotablecomposite$6.wid

ruby - AWS - get autoscaling names for use with Capistrano -

i trying setup remote deployment capistrano on amazon cloud. the idea : ssh random machine of autoscaling group , want deploy other machines there. in order need names of other instances can define capistrano servers want deploy to i have installed ruby sdk cannot figure out best way retrieve instances names (taking advantage on vpn). i have 2 possibilities : either find instances tags (i have tagged them "production") or id of autoscaling group. i don't want use other "big guns" chef, etc. after reading documentation two strategies : retrieve dns names autoscaling group or tags by tags ec2 = aws::ec2::client.new instances_tagged = ec2.describe_instances( dry_run: false, filters: [ { name: 'tag:environment', values: ['production'], }, { name: 'tag:stack', values: ['rails'], } ], ) dns_tagged = instances_tagged.reservations[0].instances.map(&:private_dns

angular - Difference between ViewProviders and Services in Angular2? -

consider code: var searchresultcomponent = ng.core.component({ selector: "search-result", directives: [ng.router.router_directives, formcomponent], viewproviders: [ng.http.http_providers], templateurl: "componenttemplates/searchresult.html" }).class({ constructor: [ng.http.http, function( http) { this.http = http; }], ngoninit: function(){ } }) here provided viewproviders ng.http.http_providers , service injected ng.http.http. what's difference between them. why need viewproviders. providers used angular's dependency injection (di) resolve dependencies. providers , services not "either or", "as as" if component or service has dependency (like ng.http.http , in example), di looks providers tree , returns instance first provider finds. if providers or viewproviders of component doesn't have provider requested type or token registered, di checks parent components providers

python - down to zero hackerrank getting time exceeded -

trying solve hackerrank problem . you given q queries. each query consists of single number n. can perform 2 operations on n in each move. if n=a×b(a≠1, b≠1), can change n=max(a,b) or decrease value of n 1. determine minimum number of moves required reduce value of n 0. i have used bfs approach solve this. a. generating prime numbers using seive b. using prime numbers can avoid calculating factors c. enqueue -1 along factors zero. d. have used previous results not enqueue encountered data. this still giving me time exceeded. idea? added comments in code. import math #find out prime numbers primes = [1]*(1000000+1) primes[0] = 0 primes[1] = 0 in range(2, 1000000+1): if primes[i] == 1: j = 2 while i*j < 1000000: primes[i*j] = 0 j += 1 n = int(input()) in range(n): memoize= [-1 in range(1000000)] count = 0 n = int(input()) queue = [] queue.append((n, count)) while len(queue): data, count = queue.pop(0) if data <= 1:

Clojure Pedestal Dataflow Model - correct steps -

here in pedestal docs talks following steps in pedestal dataflow: transform effect combine continue emit here in significant project one of authors of pedestal - see following elements transform continue derive effect emit my question - derive undocumented feature of dataflow? new name combine? matter of pedestal docs being out of date? as far know, yes, it's matter of docs being out of date. pedestal authors updated dataflow quite version 1 version 2. most of existing documentation refers version 1 (which has steps mention), , last time checked, documentation version 2 still in progress. however, there comprehensive pedestal tutorial available now, uses version 2 of dataflow (including derive ). in addition this, taylor sando did useful write up beginners

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

i getting error when run spring application: exception in thread "main" org.springframework.context.applicationcontextexception: unable start embedded container; nested exception org.springframework.context.applicationcontextexception: unable start embeddedwebapplicationcontext due missing embeddedservletcontainerfactory bean. @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.onrefresh(embeddedwebapplicationcontext.java:124) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:476) @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:109) @ org.springframework.boot.springapplication.refresh(springapplication.java:691) @ org.springframework.boot.springapplication.run(springapplication.java:320) @ org.springframework.boot.springapplication.run(springapplication.java:952) @ org.springframework.boot.springa

vbscript - Running VBS script from PHP to convert ppt into pdf not saving file into design target -

i have vbs script convers .ppt file .pdf file (script shown below). , have 2 shared network drives. 1 need load input data , second wana save output file. first tested in basic command line command this cscript ppt2txt.vbs \\149.223.22.11\cae\04_knowledge-base\20110414-br231-cii45he-320x24-pad-chamfer.ppt \\sjabcz-vyv-bck\cae\out.pdf and everythings works well. moved next step, run via php on server (serves located ot network drive wana save output file). made simple php line of code looks this echo exec("cscript ppt2txt.vbs \\\\149.223.22.11\\cae\\04_knowledge-base\\20110414-br231-cii45he-320x24-pad-chamfer.ppt \\\\sjabcz-vyv-bck\\cae\\out.pdf"); but shows output file: \sjabcz-vyv-bck\cae\out.pdf and no file created. im curious can bad here, if in command line everythings works charm, php short it. and vbs code option explicit sub writeline ( strline ) wscript.stdout.writeline strline end sub ' http://msdn.microsoft.com/en-us/library/off

node.js - Node, Express 3: Track last user visit when req.session loaded from cookieSession -

i'm using nodejs , express 3. "permanently" remember user's login i'm setting non-expiring cookie this... app.configure(function(){ .. app.use(express.cookiesession({cookie:{path:'/',httponly:true,maxage:null},secret:'mysecrettt'})); }); this works fine, , req.session automatically created when user returns. however, i'd detect date/time when user return track last visit. how can accomplish this? thanks. can't store last visit in session: app.all('*', function findlastvisit(req, res, next) { if (req.session.visited) req.lastvisit = req.session.visited; req.session.visited = date.now(); next(); }); this retrieve previous last visit , store current date (that next last visit). can decide when consider user starts new visit (not on routes in example). hope helps

javascript - How to change the child content of a div? -

i ran issue , unable "reach" child of div: <style type="text/css"> div#memory_board{ background:#ccc; border:#999 1px solid; width:800px; height:540px; padding:24px; margin:0px auto; } div#memory_board > div{ background: url(http://image.png) no-repeat center; border:#000 1px solid; width:71px; height:71px; float:left; margin:10px; padding:20px; font-size:64px; cursor:pointer; text-align:center; } </style> what trying change background of div#board > div button. i tried this: function imagechange(){ document.getelementsbytag("memory_board").style.background="url(http://image.png)"; } but of course, doesn't work. tried various combinations nothing seems work. tips? (i have button calls function later that's not problem!) this full code: https://jsfiddle.net/o72z8dqv/ update: solved, thanks! here updated working code. you can use

java - Declaring class level variable in scala -

i have started playing scala code bit java-ish. below code : object typeparam extends app{ class param1[t](val elem: t*){ val elems : list[t] = elem.tolist def toprint(): unit ={ elems.foreach(print) } } @override def main(args : list[string]): unit ={ val x= new param1[int](1,2,3,4,6,7) x.toprint() } } what expecting elements printed in realty not getting output. i know can print list through foreach learning trying blend things up. could explain why not getting output,so in scala not have class level variable can set ? by using below syntax not overriding main method app trait, hence not see output. @override def main(args : list[string]): unit ={ use below syntax override main method: override def main(args: array[string]) { note use of override keyword. in scala, it's mandatory use override when overriding concrete method.

limit - Move files from the import directory into archive using Apache Camel -

i have requirement move files import directory monitored camel directory. used move , movefailed options of camel in route. i have maxfilesallowedinarchive parameter in properties files , if file limit exceeded, oldest file has deleted. how can make custom move , movefailed control number of files moved , keep latest files in archive? camel doesn't have component operates off of filesystem meta data (such counts , dates), can implement using customer processor uses new java paths , files api's. create timer/quartz route calls customer processor. in customer processor, list files in "move" , "movefailed" directory count contents (and sort date). if maxfilesallowsinarchive exceeded, delete x number of files folders.

scala - Elasticsearch connector works in IDE but not on local cluster -

i trying write twitter stream elasticsearch 2.3 index using provided elasticsearch2 connector running job in intellij works fine when run jar job on local cluster following error: 05/09/2016 13:26:58 job execution switched status running. 05/09/2016 13:26:58 source: custom source -> (sink: unnamed, sink: unnamed, sink: unnamed)(1/1) switched scheduled 05/09/2016 13:26:58 source: custom source -> (sink: unnamed, sink: unnamed, sink: unnamed)(1/1) switched deploying 05/09/2016 13:26:58 source: custom source -> (sink: unnamed, sink: unnamed, sink: unnamed)(1/1) switched running 05/09/2016 13:26:59 source: custom source -> (sink: unnamed, sink: unnamed, sink: unnamed)(1/1) switched failed java.lang.runtimeexception: client not connected elasticsearch nodes! @ org.apache.flink.streaming.connectors.elasticsearch2.elasticsearchsink.open(elasticsearchsink.java:172) @ org.apache.flink.api.common.functions.util.functionutils.openfunction(functionutils.java:38)

c# - How to complete request before redirecting -

using c#/asp.net i have application goes out web service. on return there's couple of things happen: void cleanup(response response) { // web service takes 30 seconds // method called // send email var email = saleemail.create( response.id datetime.now, "a sale made!"); email.send(); // redirect response.redirect(response.redirecturl, false); context.applicationinstance.completerequest(); } the idea is, on completion of web service email sent, page redirected. previously, used normal redirect - result 90% of emails never sent. i've changed redirect pattern, it's still not perfect - i'm guessing 25% of emails still not coming through. anyone advise improvements pattern have? email code: public static void send(mailmessage message) { guard.argument.notnull(() => message); var c

javascript - jQuery iterate through loop delete elements -

i have javascript array of objects: each object contains key/value pairs. i'm trying iterate through array, , delete object value particular key (say "industry") fails match given value. here code, reason it's not looping through whole array, , think has fact when delete item loop counter botched somehow: var industry = 'testing'; var = 0; (i = 0; < assets_results.length; i++) { var asset = assets_results[i]; var asset_industry = asset['industry']; if (industry != asset_industry) { assets_results.splice(i,1); } } any ideas? in advance. this because when splice 1 element, size of array decreases one. elements after splice shift 1 position beginning of array , fills space of spliced one. code misses 1 element.try code. var industry = 'testing'; var = 0; (i = 0; < assets_results.length; i++) { var asset = assets_results[i]; var asset_industry = asset['industry']; if (industry != asset_

Android Listview's Items expansion and contraction -

i have items in listview.when click item,it expands(i make layouts visible in setonitemclicklistener() method). now want when click on someother items,the previous 1 should return original state. i have done conditional checking , has made work.but whenever scroll down , list recycles shows deviation desired outcome. note : know can done expandablelistview.but can tell me how listview keeping recycling parameter in view.

c# - stackoverflow exception on System.Data.Linq.dll -

Image
i'm working on asp.net web application. use linq sql orm data access layer (dal). in specific case of queries faces stackoverflow exception on clr level. i use filter expression generator specific data (such load specific constrient) send more 1500 parameters store procedure. note : consider rpc (remote procedure calling) limitation that's 2100 parameters in sql server default setting. but don't know why face stackoverflow exception? it's interesting know problem occur on iis , no problem in asp.net web development server. and i'm find out problem caused large number of parameters. i grateful me? public list<hsepersonnelcomplexpaging> selecthsepersonnelpaging(pagingpropertiesdto pagingprops, out int reccount) { using (hrpaidtimeoffdatacontext db = new hrpaidtimeoffdatacontext(dbhelper.getconnectionstring())) { expression<func<hsepersonnelcomplexpaging, bool>> expr = predicatebuilde

spring - Hibernate CURRENT_TIMESTAMP and multi-entity transactions in MySQL -

i have 2 different entities (a & b) declared jpa , persisted hibernate (mysql 5.6.30, hibernate 3.6.8 , spring 4.2.1) in same transaction. both entities contains column: `created_at` datetime(6) default current_timestamp(6) when create & b in same transaction created_at different & b. my test using spring , defined this: @autowired private transactiontemplate intx; @test public void test() { intx.execute(__ -> { arepository.add(a); brepository.add(b); return null; }); } i'm quite sure entities in same transaction since add metod in both arepository , brepository defined annotated this: @transactional(propagation = propagation.mandatory) i've tried changing test this: @test public void test() { intx.execute(__ -> { arepository.add(a); thread.sleep(1000); brepository.add(b); return null; }); } and yields result this: java.lang.assertionerror: [a , b should have same tim

python - PySpark reading Avro file with a map complexe type. Exception while getting task result: java.io.InvalidClassException -

i share problem when use code example avro_inputformat.py schema = open('test_schema_without_map.avsc').read() conf = {"avro.schema.input.key": reduce(lambda x, y: x + y, schema)} avro_image_rdd = sc.newapihadoopfile( input_file, "org.apache.avro.mapreduce.avrokeyinputformat", "org.apache.avro.mapred.avrokey", "org.apache.hadoop.io.nullwritable", keyconverter="org.apache.spark.examples.pythonconverters.avrowrappertojavaconverter", conf=conf ) output = avro_image_rdd.map(lambda x: x[0]).collect() k in output: print "image filename : %s" % k and when running spark-submit --driver-class-path /opt/spark-1.6.1/lib/spark-examples-1.6.1-hadoop2.6.0.jar read_test_avro_file_with_map.py i following error job aborted due stage failure: exception while getting task result: java.io.invalidclassexception: scala.collection.convert.wrappers$mutablemapwrapper; no valid constructor when reading

ffmpeg cannot open a simple microsoft wav file exported with Audacity -

i have exported sound file microsoft wav using audacity. trying open file ffmpeg : ffmpeg -i steps-stereo-16b-44khz.wav /tmp/test.ogg and here's ouput : fmpeg version 1.2.1 copyright (c) 2000-2013 ffmpeg developers built on jun 12 2013 13:46:11 apple clang version 4.1 (tags/apple/clang-421.11.66) (based on llvm 3.1svn) configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 l