Posts

Showing posts from September, 2010

python - How to specify video dimensions in a video with opencv -

this program determines when there dramatic change in pixels in video , prints out @ frame , @ millisecond change occurred. using millisecond value in program save image of instant in video analyze image determine height of person in video. problem video resolution small. video length spans along whole screen when played in media player height 3 inches. when save image based on millisecond value image pitch black because above , below small video frame. change video size video seen across entire screen , when save image video based on millisecond value not black. crucial part of project. please me. thank much. i getting error: typeerror: expected cvcapture argument 'capture' this how have gone changing height , width of video: width = cv.setcaptureproperty(capfile, cv.cv_cap_prop_frame_width, 1280) height = cv.setcaptureproperty(capfile,cv.cv_cap_prop_frame_height, 720) import sys import cv2 import cv import numpy np # advanced scene detection parameters inte

jsf - How to localize a dynamic menu using PrimeFace? -

i'm trying build international application can change locale dynamically on page. i'm trying build dynamic menu labels , values change when locale changes dynamically. tried: menumodel = new dynamicmenumodel(); defaultsubmenu inofficemailbox = new defaultsubmenu("#{msg['inofficemailbox']}"); defaultmenuitem activeitem = new defaultmenuitem( "#{msg['activeissues']}"); activeitem.setcommand("#{mainmenumb.loadcontent('activeissues')}"); inofficemailbox.addelement(activeitem); defaultmenuitem resolveditem = new defaultmenuitem("#{msg['resolvedissues']}"); resolveditem.setcommand("#{mainmenumb.loadcontent('resolvedissues')}"); inofficemailbox.addelement(resolveditem); menumodel.addelement(inofficemailbox); but menu item come out literals "#{msg['blahblah']}". msg localization variable. el not evaluated localization doe

php - Should I use Postgres's roles system for a web app's user management? -

postgres has featured user management system. why should duplicate functionality , use 1 on top of that? , think right place manage users & groups allows fine-grained control. wrong? there php libraries have done that? should add app in question not public web-site, corporate app working in private network. i advocate application designers make use of postgresql's users , role system ... number of reasons having 1:1 mapping of app users database users not practical. postgresql roles shared across all databases (though don't have granted rights on except one) you can't have foreign key reference normal application table postgresql user table there's no function or other interface authenticate user password. have make new connection authenticate password. breaks connection pooling. instead, advise use couple of roles in database: a database owner role. user/role owns database , tables within it. scripts change database structure ("migra

vb.net - Click-once SQL Server Express deployment -

we developing small application needs have local database installed on each users computer sync main database, via web services etc... anyways when deploy application on users computer want use clickonce deployment. have used before not attaching sql server database. know can go prerequisites in clickonce properties , click sql server express. now question is, when have created .mdf database file including stored procedures , - how attached , setup automatically in local database installed through clickonce? also once finished in future may want run updates database on clients machines. use clickonce publish database updates. don't want overwrite database , publish latest updates based on if have database or not , version have. how achieved using clickonce? thanks

How to append a 1 to the end of each single digit element within an array, list, or dataframe in Python Pandas? -

i found difficult array, whatever output method fine me. want take column dataframe has single digits numbers , double digits numbers. items integers, can converted str or bool , whatever necessary task. i want add 1 end of single digits example, if first digit 2 , want return 21 . lastly, once these operations complete, need split digits in half , create 2 columns. example col['a'] = [3, 22, 23, 2, 1] so output should like: col['a'] = [31, 22, 23, 21, 11] then, col['b'] = col['a'][0:] [3,2,2,2,1] and col['c'] = col['a'][:1] [1,2,3,1,1]. >>> df 0 3 1 22 2 23 3 2 4 1 df['aa'] = df.apply(lambda row: row['a']*10+1 if 0<=row['a']<=9 else row['a'], axis=1) >>> df aa 0 3 31 1 22 22 2 23 23 3 2 21 4 1 11 df['b'] = df.apply(lambda row: divmod(row['aa'], 10)[0], axis=1) df['c'] = df.apply(l

twitter bootstrap - Console-msg: "Parsley's pubsub module is deprecated; use the corresponding jQuery event method instead" -

trying display error-msgs in bootstrap-popup, found solution thedude , have adjusted event-names ps2.1: $.listen('field:error', function (fieldinstance) { arrerrormsg = parsleyui.geterrorsmessages(fieldinstance); errormsg = arrerrormsg.join(';'); fieldinstance.$element .popover('destroy') .popover({ container: 'body', placement: 'right', content: errormsg }) .popover('show'); }); $.listen('field:success', function (fieldinstance) { fieldinstance.$element.popover('destroy'); }); this works wonderfully, i'm getting msg in js-console: " parsley's pubsub module deprecated; use corresponding jquery event method instead ". there few hits msg in google, , i'm afraid i'm not (yet) sufficiently versed parsley understand , fix problem - appreciate make code future-proof :-) sorry, impatient , started lo

typescript - Angular2 pass attribute to class constructor -

how pass attributes parent component child components' class constructor in angular 2 ? half of mystery figured out, attributes can passed view without problem. /client/app.ts import {component, view, bootstrap} 'angular2/angular2'; import {example} 'client/example'; @component({ selector: 'app' }) @view({ template: `<p>hello</p> <example [test]="someattr" [hyphenated-test]="somehyphenatedattr" [alias-test]="somealias"></example> `, directives: [example] }) class app { constructor() { this.someattr = "attribute passsed component"; this.somehyphenatedattr = "hyphenated attribute passed component"; this.somealias = "attribute passed component aliased"; } } bootstrap(app); /client/example.ts import {component, view, attribute} 'angular2/angular2'; @component({ selector: 'example', properties: ['te

laravel - Paginate merged queries -

i have 2 queries: $posts = post::all(); $comments = comment:all(); which later merge: $merge = $posts->merge($comments); $all = $merge->sortbydesc(function($result) { return $result->created_at; }); how can paginate result of merge? doing $all->paginate(25) not work. laravel 5: in laravel 5 can done instantiating paginator: $paginator = new illuminate\pagination\paginator($all, $perpage, $currentpage);

javascript - Fix mouseover feature only show one value D3 -

alright i've been working on trying stacked area chart show value on mouseover, , got work (miracle) shows 1 value, no matter move mouse. when go of 5 different colors, shows 1 value whole color, no matter mouse is. fixing this?? here's code: var t = 0; var n = 40; var dnsdata = getdns(); var connectdata = getconnect(); var ssldata = getssl(); var senddata = getsend(); var serverbusydata = getserverbusy(); var receivedata = getreceive(); function getdns() { var time = 0; var arr = []; for(var i=0; i<bardata.length; i++){ var obj = { time: i, value: bardata[i].aggs.dns.avg }; arr.push(obj); } t=time; return arr; } function getconnect() { var time = 0; var arr = []; (var = 0; < bardata.length; i++) { var obj = { time: i, value: bardata[i].aggs.con.avg + bardata[i].aggs.dns.avg }; arr.push(obj); } t = time;

html - What is causing this white line between the top banner and navigation and how to remove it? -

this question has answer here: remove white space below image [duplicate] 9 answers the code located @ link. generated using template , data. have tried using several things, firebug , dragonfly in opera. http://archives.subscribermail.com/msg/87a4a85001714fa385b5eb6f30de375e.htm just add style display: block banner img

html - fixed position div below relative position -

there many questions on stackoverflow, of ones checked asked exact opposite of question. have fixed position div , relatively positioned span: <div class="head-wrap"> ... </div> .... <span class="img-desc" id="main">html lesson - part 1</span> css: .img-desc { position:relative; background:rgba(5,1,20,.8); color:yellow; padding:15px; } #main { top:-150px; left:8px; font-size:2.4em; z-index:2 !important; } .head-wrap { z-index:50; } from have read, fixed-position div supposed pass on relative-positioned span. doesn't! how can make div pass on span, instead of other way around. fiddle .

issue in getting dex file while adding google play service and osm jar android -

i m implement osm app google play store add below jars. when run project getting below error error code:2 output: unexpected top-level exception: com.android.dex.dexexception: multiple dex files define lcom/google/api/client/googleapis/notifications/json/gson/gsonnotificationcallback; @ com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:596) @ com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:554) @ com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:535) @ com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:171) @ com.android.dx.merge.dexmerger.merge(dexmerger.java:189) @ com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:454) @ com.android.dx.command.dexer.main.runmonodex(main.java:303) @ com.android.dx.command.dexer.main.run(main.java:246) @ com.android.dx.command.dexer.main.main(main.java:215) @ com.android.dx.command.main.main(main.java:106) build.gradle apply plugin: 'com.android.application' android { c

ruby - Writing a negative test by using exception handling -

let have login method that's working swimmingly. it's used in quite number of places , saves plenty of lines of retyped code. intents , purposes, not make sense make method shorter. is proper write negative test using exception handling? example, if wanted ensure disabled user not able log system, awkward write like: begin login(username, password) fail rescue exception page.should have_text('sorry, account disabled!') end if login succeeds, test should fail. , if reach exception, find our error message , test passes. i'm wondering if "clever" , may cause confusion. what's best way of handling negative test case here? you testing expected behavior there no rescuing within specs. in case, want disable account in before caluse , ensure exception raised when attempt perform operation (login, etc.). testing generic exception bad idea - want specific expected exception different issue cause specs pass. the code like

osx - Different behavior in go1.5beta2 on MacOS and Linux -

the example taken "a tour of go": https://tour.golang.org/concurrency/1 obviously, program output should have 10 rows: 5 "hello" , 5 "world". but have on: linux - 9 rows macos - 10 rows linux output (9 rows): $ go run 1.go hello world hello world hello world world hello hello macos x output (10 rows): $ go run 1.go hello world world hello hello world hello world hello world can explain - why ? linux uname -a : linux desktop 3.16.0-4-amd64 #1 smp debian 3.16.7-ckt11-1 (2015-05-24) x86_64 gnu/linux macos x uname -a : darwin 14.5.0 darwin kernel version 14.5.0: thu jul 9 22:56:16 pdt 2015; root:xnu-2782.40.6~1/release_x86_64 x86_64 source code tour: package main import ( "fmt" "time" ) func say(s string) { := 0; < 5; i++ { time.sleep(1000 * time.millisecond) fmt.println(s) } } func main() { go say("world") say("hello") } from th

java - How to parse received json data in action -

i sending json array data jsp action class have included struts2-json-plugin . want parse receive arraylist elements. code in jsp: $.ajax({ url: "updatenotification", datatype: "json", data: {ids: json.stringify(ids)}, success: function(data) { alert("success " + data.st); } }) in action: public class test extends actionsupport { arraylist<string> ids = new arraylist<string>(); public arraylist<string> getids() { return ids; } public void setids(arraylist<string> ids) { this.ids = ids; } public string updatenotification() { system.out.println("id " + getids()); (string : getids()) { system.out.println("data " + a); } } } on running showing data id [["25","2

predict - Simple Way to Combine Predictions from Multiple Models for Subset Data in R -

i build separate models different segments of data. have built models so: log1 <- glm(y ~ ., family = "binomial", data = train, subset = x1==0) log2 <- glm(y ~ ., family = "binomial", data = train, subset = x1==1 & x2<10) log3 <- glm(y ~ ., family = "binomial", data = train, subset = x1==1 & x2>=10) if run predictions on training data, r remembers subsets , prediction vectors length of respective subset. however, if run predictions on testing data, prediction vectors length of whole dataset, not of subsets. my question whether there simpler way achieve first subsetting testing data, running predictions on each dataset, concatenating predictions, rbinding subset data, , appending concatenated predictions this: t1 <- subset(test, x1==0) t2 <- subset(test, x1==1 & x2<10) t3 <- subset(test, x1==1 & x2>=10) log1pred <- predict(log1, newdata = t1, type = "response") log2pred <- predict(

android - AlarmManager doesn't trigger a WakefulBroadcastReceiver -

i'm trying launch intent service using alarmmanager , wakefulbroadcastreceiver. can launch service using sendbroadcast() , works should, can't launch alarmmanager. the code launching this: @override protected void onpause() { super.onpause(); alarmmanager = (alarmmanager)getsystemservice(alarm_service); intent = new intent(this, notifier.class); pendingintent pi = pendingintent.getservice(this, 0, i, 0); am.set(rtc_wakeup, system.currenttimemillis(), pi); } the notifier class this: public class notifier extends wakefulbroadcastreceiver { @override public void onreceive(context context, intent intent) { log.i("notifier", "onreceive()"); componentname comp = new componentname(context.getpackagename(), notifierservice.class.getname()); startwakefulservice(context, (intent.setcomponent(comp))); } } and notifierservice this: public class notifierservice extends intentservice { pr

angularjs - how to refresh ui-grid before apply data sorting -

i need sorting ui-grid table rows ascending , descending in base 1 column selection. problem when call api give me last 100 results, if try show 100 littlest results need send new request api , refresh table data. what best way refresh table data when user click on sorting button , before apply sorting function?

service - How can i get current playing song in Android programmatically -

i new android. working on music player. can load playlist , can play song until app running how can temporary playlist , current song detail when app restarted after closing. use shared preferences or sqlite store lists , retrieve them whenever required. need use of persistent storage save play list or data , need fetch when app starts again.non persistent data gets destroyed once app gets killed.

javascript - Binding mouse events to dynamically created select -

i have created select tag dynamically in jquery function. want bind mouse events it. have dynamically created selct tag function loadvalues() { var sel='<select id="flavor_slct'+index+'" class="popper" data-popbox="pop1" onclick="alert()">'+flavor_fetched_string+'</select>'; $("#attach").append(sel); } i have tried using .on() jquery function. still events not triggered. $("body").on("hover","select",function() alert("hovered"); )}; how should bind events dynamically created elements.? there no hover javascript event triggered. looking mouseenter . you have incorrect syntax defining function i've rectified: $("body").on("mouseenter", "select", function(){ alert("hovered"); });

how can i change activity to other activity with specific fragment in android? -

i have 2 activities , 1 navigation drawer in second activity.in first activity have container replace fragment when click drawer item changing fragment in container.now want doing in second activity: when click on items in second activity change activity first activity , show me specific fragment(for example favorite fragment) in fragment container.i can change second activity first activity intent can't replace fragment when intent. 1 case of items: case 2: intent intent2 = new intent(lietneractivity.this, mainactivity.class); startactivity(intent2); fragment = new favoritefragment(); break; you can put bundle in intent, contains tag of fragment want show. , when first activity oncreate(), tag , make fragmentmanager create or show fragment.

Spray.IO Stop http server with Http.Unbind -

i have app built on spray 1.3.3 , i'm trying stop http server sending message. official documentation says: stopping. explicitly stop server, send http.unbind command httplistener instance (the actorref instance available sender of http.bound confirmation event when server started). here how start server: (io(http) ? http.bind(httplistener, interface = iface, port = port)).map { case m: http.bound => println(s"success $iface:$port") case fail : http.commandfailed => println(s"bad try :(") } i tried send message http.unbind httplistener no success. seems it's not actor may need extract somehow sender ref of http.bound message? how? here httplistener's head: class myhttplistener extends httpserviceactor { import context.dispatcher def receive = runroute( path("shutdown") { { actors.httplistener ! http.unbind complete("stopping server") } } anyway, want se

ruby - how to avoid installing rails as a system gem by using bundler and expect -

i'm trying make new rails application intent not install gems system gem possible. @ first installed bundler system gem, made gemfile specified rails , executed 'bundle install'. (in opinion, bundler ok system gem...) mkdir -p /opt/rails/rails_app cd /opt/rails/rails_app gem install bundler bundle init cp gemfile /tmp sed 's/#gem rails/gem rails/' /tmp/gemfile > gemfile bundle config build.nokogiri --use-system-libraries bundle install --path vendor/bundle rails installed 'local gem' limitted within /opt/rails/rails_app. then tried make rails application 'rails new'. bundle exec rails new . --skip-bundle this caused replacing gemfile, message shown this. overwrite /opt/rails/rails_app/gemfile? (enter "h" help) [ynaqdh] usually should done type 'y'. however, time, want automatically making vagrant's provision script. so tried expect never worked. results either timeout or syntax error: expect -c " s

android - FloatingActionButton not showing fully in screen -

Image
i have used floatingactionbutton in application not showing in screen. have used latest android design support library. below have paste xml. <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app1="http://schemas.android.com/apk/res/com.hsp.inventory" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:fitssystemwindows="true" > <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" > <android.support.v7.

c# - iOS:OCMapper: Deserialize date from json -

i have integrated ocmapper converting json string custom model object.i cannot able deserialize date object. example have 1 json nsstring* sampleoutput=@"{\"usertype\":\"admin\",\"testdate\":\"/date(1438545600000+0400)/\"}"; nsdata* sampledate= [sampleoutput datausingencoding:nsutf8stringencoding]; nsdictionary *logindictionary = [nsjsonserialization jsonobjectwithdata:sampledate options:nsjsonreadingallowfragments error:&responseerror]; mymodel* loginresponse= [[objectmapper sharedinstance] objectfromsource:logindictionary toinstanceofclass:[mymodel class]]; my model class structure `@interface mymodel : nsobject @property(nonatomic,strong) nsstring* usertype; @property(nonatomic,strong) nsdate* testdate; @end` but got nil value testdate object. kindly provide me best way so. if json nsstring* sampleoutput=@"{\"usertype\":\"admin\",\"testdate\":\"2015-08-05\"}";

NoSuchMethodError for "list.toMap" in spark-submit -

when ran spark-submit following simple spark program of: import org.apache.spark.sparkcontext._ import org.apache.spark.sparkconf import org.apache.spark.rdd.rdd import org.apache.spark.sparkcontext import org.apache.spark._ import sparkcontext._ object test2{ def main(args:array[string]) { val conf = new sparkconf().setappname("test") val sc=new sparkcontext(conf) val list=list(("aa",1),("bb",2),("cc",3)) val maps=list.tomap } } i got java.lang.nosuchmethoderror line of "val maps=list.tomap". in spark-shell or scala, has no problem: scala> val list=list(("aa",1),("bb",2),("cc",3)) list: list[(string, int)] = list((aa,1), (bb,2), (cc,3)) scala> val maps=list.tomap maps: scala.collection.immutable.map[string,int] = map(aa -> 1, bb -> 2, cc -> 3) so use "tomap" method, missing in spark-submit? use "sbt package" compile program , without problem. thank

osx - open file with particular application where spaces in application name -

i want open ex1.py in terminal. if go: open ex1.py file opens in textwrangler. but want use sublime. tried this: open -a sublimetext ex1.py unable find application named 'sublimetext' open -a sublime text 2 ex1.p files /users/macuser/documents/pyleo/text , /users/macuser/documents/pyleo/2 not exist. when control click sublime > show in finder name "sublime text 2". presumably spaces causing issue. how can open ex1.py in sublime text 2 using terminal? wrap application name in single quotes: open -a 'sublime text 2' ex1.py

javascript - Event in extended sap.m.Table not triggering -

i trying extend sap.m.table control following this article working fine. control rendering , displaying content correctly. but event not fired. missing? have hook on different event? thought can override onitempress event of sap.m.table control , enhance way want, since don't need original functionality. any pointers solution appreciated. before trying extend control tried hook on onitempress event using .addeventdelegat() , did not work either. my extended control: sap.m.table.extend("collapsablegrouptable",{ metadata:{ events:{ "groupcollapse" : {} } }, onitempress : function(evt) { this.firegroupcollapse(); }, renderer : {} }); my instance of control: var otable = new collapsablegrouptable({ columns : [ <some columns> ], items : { path: "<somepath>", sorter : <somesorter>,

visual studio 2013 - How do I kill a process that doesn't have any windows in VB.net? -

i new vb.net , trying write forms app works autodesk inventor. unfortunately, every time close inventor, "inventor.exe" process still stays. didn't realize while debugging , realized when checked task manager after whole system started lag. killing every process same name simple, issue end user might have separate documents open in inventor window. need write function kills inventor processes don't have window open. public class form1 dim _invapp inventor.application dim _started boolean = false public sub new() ' call required designer. initializecomponent() ' add initialization after initializecomponent() call. try _invapp = marshal.getactiveobject("inventor.application") catch ex exception try dim invapptype type = _ gettypefromprogid("inventor.application") _invapp = createinstance(invapptype) _invapp.visible = true

how can I quickly check to see if a wmic product exists using batch? -

i trying uninstall software using: wmic product name="xxxxxxx" call uninstall how can check see if wmic product exists batch file without querying products, can take time batch execute? thanks! reg query arguably fastest method, not reliable, theoretically. reg query hklm\software\microsoft\windows\currentversion\installer\userdata /f "exact product name" /s /d /e|find "displayname">nul if errorlevel 1 reg query hklm\software\wow6432node\microsoft\windows\currentversion\installer\userdata /f "exact product name" /s /d /e|find "displayname">nul if errorlevel 1 echo "exact product name" not found in registry to find exact product names containing microsoft : reg query hklm\software\microsoft\windows\currentversion\installer\userdata /s /v "displayname" | find "microsoft"

GCC 4.8.4 Error on Ubuntu 14.04 VM: -std=c++11 flag isn't being detected -

i've looked everywhere online , can't seem find solution issue. have tried -std=c++11, -std=c++0x, , -std=c++1y flags in makefile , env file, of have no effect on following errors: 'to_string' not member of 'std' range based 'for' loops not allowed in c++98 mode i trying run c++ program built on top of repasthpc, running on ubuntu 14.04 virtualbox vm. both makefile repasthpc , env file c++ code contain flag. env file used in makefile c++ code, isn't missing there. # repast hpc # environment definitions mpicxx=/home/repasthpc/repast_hpc-2.1.0/installation/mpich-3.1.4/src/env/mpicxx -std=c++11 -d use_cpp11 -stdlib=libc++ boost_include=-i/usr/local/include/ boost_lib_dir=-l/usr/local/lib/ boost_libs=-lboost_mpi-mt-s -lboost_serialization-mt-s -lboost_system-mt-s -lboost_filesystem-mt-s repast_hpc_include=-i/usr/local/include/ repast_hpc_lib_dir=-l/usr/local/lib/ repast_hpc_lib=-lrepast_hpc-2.1 tissue_include=-i/users/repasthpc/desktop/hpc

php - show all array before and after my index sign -

could give me advice problem ? the output is word no 0 = word no 1 brother = word no 2 see = predicate word no 3 = word no 4 moon = my question how sign word, if before predicate call subject , after predicate object word no 0 subject word no 1 brother subject word no 2 see predicate word no 3 object word no 4 moon object this code <?php $a = "my brother see moon"; $b = explode(" ",preg_replace("/(\.|\"|,|;|\(|\)|'|)+?/i","",$a)); for($ulangkata=0;$ulangkata<count($b);$ulangkata++) { $kata_kerja = 'see'; $huruf_kecil = strtolower($a); $fungsi_replace = preg_replace("/(\.|\"|,|;|\(|\)|'|)+?/i","",$huruf_kecil); $pecah_untuk_kata = explode(" ",$fungsi_replace); $pecah_kata = $pecah_untuk_kata[$ulangkata]; echo "kata ke - ".$ulangkata." ".$b[$ulangkata]."<br>"; } echo "<br>"

c# - .NET Installer - Target Directory is empty -

we trying figure out why our assemblies not being installed gac. have assembly attribute set .net specify gac installation defined here. http://wixtoolset.org/documentation/manual/v3/xsd/wix/file.html this output our log file - installfiles: file: myassembly.dll, directory: , size: 108544 any idea why directory null/empty/not set instead of being set c:\windows\assembly? we looking because myassembly.dll not being installed anywhere application can find (not local application bin or gac).

java - Request handling in struts and spring. Difference? -

struts 2 actions initiated every time when request made, whereas in spring mvc controllers created once, stored in memory , shared among requests.so, spring web mvc framework far efficient handle requests struts 2. i have read these sentences in blog. though understand partially, have clear understanding on above. way of handling requests in spring similar servlets, initialization done once upon first request , threads spawned every request??? correspondingly, how achieved in struts 2??

java - Hibernate : JDBC Vs Hibernate Performance in bulk records -

description : loadoutoperatingsession represents particular time period , belongs loadoutid . there can lot of loadoutoperatingsession objects same loadoutid before inserting new session, check had performed overlappings. below model object have designed. public class loadoutoperatingsession extends entity implements serializable, comparable<loadoutoperatingsession>{ private long loadoutid; private date effectivefromdate; private date effectivetodate; private string sessionstarttime; private string sessionendtime; private string isschedule; /** * compares given session current 1 , return 1 if session greater given session, * -1 if session less given session , * 0 sessions overlapping. * * @param session1 * first session * * @param session * second session */ @override public int compareto(loadoutoperatingsession session) { if (session.geteffectivetodate().gettime() < this.geteffectivefromdate().gettime()) {

android - How to start Application main activity with Animation -

how can show object on activity translate animation when oncreate() method called?? i called method after setcontentview() on oncreate() doesn't work! me please , don't give me negativ point please! public void startanimation(){ linearlayout header=(linearlayout) findviewbyid(r.id.layout_main_header); linearlayout onoff=(linearlayout) findviewbyid(r.id.layout_main_onoff); linearlayout social=(linearlayout) findviewbyid(r.id.social_layer); linearlayout netwo=(linearlayout) findviewbyid(r.id.network_layer); animation in_1=animationutils.loadanimation(getapplicationcontext(),r.anim.in_1); animation in_2=animationutils.loadanimation(getapplicationcontext(),r.anim.in_2); animation in_3=animationutils.loadanimation(getapplicationcontext(),r.anim.in_3); animation in_4=animationutils.loadanimation(getapplicationcontext(),r.anim.in_4); header.startanimation(in_1); onoff.startanimation(in_2); social.startanimation(in_3); netwo.sta

java - Focus to previous jframe -

i creating supermarket billing application.when user press enter on product text field new frame table come. can select particular product , press enter on selected row , previous frame should come old values. tried various tricks focus not coming first frame. for(frame frame : frame.getframes()){ if(frame.gettitle().equals("welcome")){ system.out.println("frame located"); welcome w=(welcome) frame; w.setfields(code, name, rate); w.setvisible(true); } } i solved problem. tofront() method helps focus frame

android - GetPostiosion method giving array out of bounds error -

ok somewhere in getposition method webview messing , getting array out of bounds exception. want app cycle through array list when done. if 'reloadtime' on item in array list has not passed, skip next item. if cycles through items in array list , none passed displays blank screen. everythign works except array still goes out of bounds somewhere. private int getposition(int binary){ log.e("tree","getposition run"); //if positions right if (binary==1){ //make sure count doesnt go on array size out of index int placeholder; if (position==urls.size()-1) placeholder = position+1%(urls.size()-1); else placeholder = position+1; while (system.currenttimemillis()<urls.get(placeholder).getreloadtime()) { placeholder=placeholder+1%(urls.size()-1); if (placeholder==position) { displaynone(); break; } } if (

Error in simple spark application -

i'm running simple spark application 'word vector'. here code (this spark website) import org.apache.spark._ import org.apache.spark.rdd._ import org.apache.spark.sparkcontext._ import org.apache.spark.mllib.feature.{word2vec, word2vecmodel} object simpleapp { def main(args: array[string]) { val conf = new sparkconf().setappname("word2vector") val sc = new sparkcontext(conf) val input = sc.textfile("text8").map(line => line.split(" ").toseq) val word2vec = new word2vec() val model = word2vec.fit(input) val synonyms = model.findsynonyms("china", 40) for((synonym, cosinesimilarity) <- synonyms) { println(s"$synonym $cosinesimilarity") } // save , load model model.save(sc, "mymodelpath") } } when running it gives me following error message exception in thread "main" org.apache.hadoop.mapred.invalidinputexception: input path not exist: hdfs://gxydevvm:8020/user/h

javascript - Ctrl select multiple items and access via form post -

i have form has list of days shown - user clicks on day , use jquery populate hidden field value can reference in post array. i allow users select more 1 item using ctrl+click , able access selected options in post array not sure how go it? i have figured out how allow selecting multiple items cant figure out how access via post current code contains last clicked item in hidden field. here using currently: var multiple = false; $(document).on('keyup keydown', function(e) { multiple = e.ctrlkey; }); $(document).ready(function () { $(document).on('click', '[name="day"]', function () { if (multiple) { $('[name="date"]').val($(this).text()); $(this).addclass('selected'); } else { $('[name="day"]').removeclass('selected'); $('[name="date"]').val($(this).text()); $(this).addclass('selected

java - Once I've finished using a working copy with SVNKit, how can I remove it? -

i have created class perform commits subversion repository using svnkit. when i've completed commits want destroy temporary directory using working copy. the way i'm creating working copy directory follows: path svnworkingcopydirectory = files .createtempdirectory("svn-working-copy-directory-" + string.valueof(system.currenttimemillis())); logger.debug("created svn working copy directory: " + svnworkingcopydirectory); svnworkingcopydirectory.tofile().deleteonexit(); however, directory not deleted on exit. there way in svnkit mark directory no longer working copy? or method remove directory? file.deleteonexit() works file.delete() , files.delete() in respect fact if argument denotes directory, directory must empty removed in case not. so if want delete directory on exit must register shutdown hook , in method have iterate recursively through directory depth first remove files , empty directo

java - Using Stanford NLP lib in C# , While trying to get sentiment (positive/negative) it always returns -1! Any idea why? -

i trying check if statement positive or negative using stanford core nlp. i found few references online in java , able convert/code in missing pieces c#. while trying sentiment score - -1 return value. i think because not able convert tree tree = sentence.get(sentimentcoreannotations.annotatedtree.class); to .net equivalent. java.lang.class treeclass = new edu.stanford.nlp.trees.treecoreannotations.treeannotation().getclass(); tree tree = (tree)sentence.get(treeclass); here complete code: var jarroot = @"d:\core nlp files\stanford-corenlp-full-2015-04-20\stanford-corenlp-full-2015-04-20\stanford-corenlp-3.5.2-models"; // text processing var text = txtinp.text; // annotation pipeline configuration var props = new java.util.properties(); props.setproperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); props.setproperty("sutime.binders", "0"

java - RestyGWT + Jersey Error 500 when sending a not null or empty List -

say have jersey resource similar this: @path("/test") public class testresource{ @post @consumes(mediatype.application_json) @produces(mediatype.application_json) public response test(list<jsonrepresentation> json){ //some logic gives different responses, strings } } and restygwt service consumes this: @path("api/test") public interface testservice extends restservice{ @post public void test(list<jsonrepresentation> json, methodcallback<string> callback); } the thing that, when try access resource using service, if list isn't null or empty internal server error doesn't have server code because can't debug test method logic. however, when list null or empty, resource's logic should , can debug without problems. the contents of jsonrepresentation don't seem matter problem. i have no idea why happening , couldn't find similar questions around, appreciated. if want send strings

xcode - Error using Pod Install command on Podfile in Terminal -

Image
i have installed cocoapods, , created podfile using atom containing following lines: pod ‘parse’, ‘~> 1.7.1′ pod ‘parseui’, ‘~> 1.1.3′ upon placing file xcode project root directory, , running 'pod install' in terminal. following shown: [!] podfile has had smart quotes sanitised. avoid issues in future, should not use textedit editing it. if not using textedit, should turn off smart quotes in editor of choice. /library/ruby/gems/2.0.0/gems/cocoapods-core-0.38.2/lib/cocoapods-core/standard_error.rb:87:in `message': incompatible character encodings: ascii-8bit , utf-8 (encoding::compatibilityerror) /library/ruby/gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:367:in `handle_exception' /library/ruby/gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:315:in `rescue in run' /library/ruby/gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:303:in `run' /library/ruby/gems/2.0.0/gems/cocoapods-0.38.2/lib/cocoapods/command.

Facebook tab review is missing -

the reviews tab missing https://www.facebook.com/almogspa i need add reviews tab here https://www.facebook.com/uniqueitworld/reviews?ref=page_internal i have tried change "local business" , change address not worked thanks you have reviews tab in page. since there can 4 tabs visible @ time, placed inside more section. click on more , manage tabs . there can rearrange tabs , bring reviews tab towards top.

facebook - currentUser fetched in Authentication with Torii? -

trying change torii authenticator return account id response, it's available in session fetching account. in trying adapt example torii authenticator, have starting point (obviously wrong, hitting on js knowledge limits): import ember 'ember'; import torii 'simple-auth-torii/authenticators/torii'; import configuration 'simple-auth-oauth2/configuration'; export default torii.extend({ authenticate: function(credentials) { return this._super(provider).then((authresponse) => { return new ember.rsvp.promise(function(resolve, reject) { ember.$.ajax({ url: configuration.servertokenendpoint, type: 'post', data: { 'auth_code': authresponse.authorizationcode } }).then(function(response) { ember.run(function() { // properties promise resolves // available through session resolve({ access_token: response.access_token, account_id: response.

python - type error in sqlalchemy/flask query -

i wondering if on error have app making flask-sqlalchemy , postgres database. have list of years (ints). elements of list depend on year user selects. list make query below searching results in database have fiscal years matching years in list: @main.route('/searchresults') def yearresults(): entries = db.session.query(post).filter(post.fiscalyear.in_(list)) return render_template('yearsearch.html', entries=entries) when run this, however, get typeerror: 'type' object not iterable the error occurs on line of query (db.session.query(post).filter...) i know code works when query 1 specific year, i'm trying work multiple unknowns. wondering if sees solution or better way this. thanks in advance! list in code python built-in object list (type). please provide actual list object there.

jsp - resources configuration mapping in the servlet -

the problem addressed i'm trying add javascript file use in page in project, built project 1 servlet , many controllers using annotations , reflection. i set 2 url-mappings: <servlet-mapping> <servlet-name>servletmanager</servlet-name> <url-pattern> *.* </url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>servletmanager</servlet-name> <url-pattern> / </url-pattern> </servlet-mapping> the first 1 mapping resources , second 1 mapping http request (note: project has 1 servlet , many controllers)

How to call bootstrap modal dialog from SSJS in XPages -

edit added after </xp:this.action> and appeared work couple times, has quit. don't know if have solution or not: further edit make sure have 2 xp:attr 's or not work. <xp:this.oncomplete> var id = "#{id:panelmodal}" xsp.partialrefreshget(id,{ oncomplete: function(){ $('#mymodal').modal('show'); } }); </xp:this.oncomplete> i have created test code below call -- if comment out link , show button modal window displays correctly. however, when set attrs toggle-data , toggle-target can't modal display. <xp:panel id="panelmain"> <xp:link text="create document" id="buttonlink1" styleclass="btn btn-default"> <xp:this.attrs> <xp:attr name="data-toggle" value="modal"> </xp:attr> <xp:attr name="data-target" value="createdi