Posts

Showing posts from February, 2012

python - How to assign weights to a set of variables based on pdf? -

Image
this continuation of previous question had doubt , asked ask new question! here goes. say have array of size 100. how calculate probability of each of value in array? my understanding far: import numpy np import scipy.stats scipy import stats import matplotlib.pyplot plt def getdistribution(data): kernel = stats.gaussian_kde(data,bw_method=0.07) class rv(stats.rv_continuous): def _rvs(self, *x, **y): return kernel.resample(int(self._size)) #random variates def _cdf(self, x): return kernel.integrate_box_1d(0,max(x)) #integrate pdf between 2 bounds (-inf x here!) def _pdf(self, x): return kernel.evaluate(x) #evaluate estimated pdf on provided set of points return rv(name='kdedist') data = np.random.random(100) sorted_data = np.sort(data) dist = getdistribution(sorted_data) pdf = dist.pdf(sorted_data) plt.plot(sorted_data,pdf_data,'-o') plt.hist(sorted_data,normed=true) plt.show()

How to escape special characters in xml attribute using python -

i wondering how possible escape special characters in xml. the following example fails sadly: xml ="""<?xml version="1.0" encoding="utf-8" ?> <render value="a &lt b"/> """ import xml.etree.elementtree et p = et.fromstring(xml) output: parseerror: not well-formed (invalid token): line 2, column 28 what easiest way round problem? wrong escaping! try <render value="a &lt; b"/> and works fine!

javascript - Why does my iOS application using cordova using excessive memory? -

Image
i have ios application build using cordova framework angularjs, html , javascript. noticing debug inspector while application usage, memory been used excessively whenever there ajax service call. also tried profiling using instruments , noticed allocations keeps on increasing in debug inspector. i sure @ point of time app may crash. how solve situation? any suggestions welcome?

javascript - AngularJS: scroll inside div/ul and what not -

so, have directive: app.directive("scroll", function ($window) { return function(scope, element, attrs) { angular.element($window).bind("scroll", function() { if (this.pageyoffset > 50) { console.log(true); } else { console.log(false); } scope.$apply(); }); }; }); it works fine when user scrolls browser window. need, directive work inside ul-element max-height: 300px . so, function must respond, when user scrolls inside ul-element . something works fine inside ul-element : app.directive("scroll", function () { return function(scope, element, attrs) { angular.element(element).bind("scroll", function() { console.log(true); scope.$apply(); }); }; }); and have "true" in console, how can use pageyoffset here if works $window? thanks lot. the answer - use plain

sql - Subquery for max ID numbers -

i have query trying filter report. each addressid can have multiple jobs , each job can have multiple elements it. basically trying maximum jobid each addressid, want each element of job. the current query results are: +-----------+-------+--------+ | addressid | jobid | cost | +-----------+-------+--------+ | 326 | 328 | £52.50 | | 327 | 329 | £55.13 | | 328 | 330 | £57.88 | | 329 | 331 | £60.78 | | 329 | 331 | £63.81 | | 330 | 332 | £67.00 | | 330 | 332 | £70.36 | | 330 | 332 | £73.87 | | 330 | 332 | £77.57 | | 330 | 333 | £57.75 | | 330 | 333 | £60.64 | | 330 | 333 | £63.67 | | 330 | 333 | £66.85 | | 331 | 334 | £70.20 | | 331 | 334 | £73.71 | | 331 | 335 | £77.39 | | 331 | 336 | £81.26 | | 331 | 336 | £85.32 | | 331 | 336 | £89.59 | +-----------+-------+--------+ and trying get: +-----------+-------+--------+ | addr

arrays - Can't flush DataOutputStream in Java -

i want put double array datainputstream , print dataoutputstream in console. tried convert byte array first. can't flush() dataoutputstream, gets printed in console. system.out.print(c) works. double[] b = { 7, 8, 9, 10 }; //double[] byte[] byte[] bytes = new byte[b.length * double.size]; bytebuffer buf = bytebuffer.wrap(bytes); (double d : b) buf.putdouble(d); inputstream = new bytearrayinputstream(bytes); datainputstream dis = new datainputstream(is); dataoutputstream dos = new dataoutputstream(system.out); int c; try{ while( (c = dis.read()) != -1){ //system.out.print(c); dos.writeint(c); } dos.flush(); } catch(exception e){ system.out.println("error: " + e); } output system.out.print(c), want achieve: 642800000064320000006434000000643600000000000000000000000000000000[...] writing bytes console may cause control characters( can not printed) , cause unexpected result. if absolutely need see text representation, con

angularjs - how can i use angular js into google charts -

i want customize bar chart user's data, , redraw accordingly on run time. user should give details on both axis , values. code should write ? can angular variables choice doing ? <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodatatable([ ['year', 'sales', 'expenses'], ['2004', 600, 400], ['2005', 1170, 460], ['2006', 660, 1120], ['2007', 1030, 540] ['2008', 2000, 250] ]); var options = { title: 'company performance', vaxis: {title: 'year', titletextstyle: {color: 'blue'}} }; var chart = new

python - I am using unittest.TestCase if i have more than 1 test case it will not run. Only 1 test case runs -

i automating our website. using python, webdriver, unittest.testcase . i had 1 test method defined in login page class test valid user log in. works fine. now adding 2nd test method called test_login_invalid_user test invalid user log in. browsing log in page start see if 2nd test method gets called when run test. when run code following error: traceback (most recent call last): file "c:\users\riaz.ladhani\pycharmprojects\selenium webdriver\clearcore \loginpage_testcase.py", line 40, in test_login_invalid_user login_page = page.login(self.driver) attributeerror: 'module' object has no attribute 'login' can not have more 1 test method in unit test? doing wrong way? my unit test class code snippet follows: import unittest selenium import webdriver import page import time class loginpage_testcase(unittest.testcase): def setup(self): self.driver = webdriver.ie("c:\qa\automation\python_projects\selenium webdriver\iedriverserver

c# - Unable to get data from DateTime column in SQLite -

Image
i using sqlite db c#.net . connecting db, have used system.data.sqlite.dll . i facing problem when trying data db table type of column datetime. this.sqlcommand.commandtext = query; sqlitedatareader datareturned = this.sqlcommand.executereader(); while (datareturned.read()) { (int inx = 0; inx < datareturned.visiblefieldcount; inx++) { if (columns[inx].columnname.contains("date")) { // checking datetime dt = datareturned.getdatetime(inx); } else { // store in other way } } } query returns below row when run code, below exception please !!

json - Retrieving details from multiple tables using SpringMVC -

i developing shopping application, in application have table tenant , in tenant table have have column binary_id primary key in binary table in database. when making request tenant table getting tenant table fields json. have @manytoone relation binary table tenant i.e tenant can have multiple records in binary. so, while making call postman client instead of getting tenant details, need binary records related tenant json. now getting json follows when making call http://localhost:8080/sportsmvc/rest/tenant postman client [ { "id": 2, "binaryid": "1002", "name": "altisarena" }, { "id": 9, "binaryid": "1001", "name": "agon" } ] but need responce json below: [ { "id": 2, "name": "altisarena", "listofbinary": [ { "tenant_id": 2, "location&

javascript - Trigger by suffix from same element class -

i want make every button have suffix class -dummy (let's call "dummy") trigger button have same class without suffix (call "real button"). <button class="btn-submit hidden"> triggered <button class="btn-submit-dummy"> <button class="btn-edit hidden"> triggered <button class="btn-edit-dummy"> <button class="btn-delete"> triggered nothing since there no element class btn-delete-dummy each real button need triggered click on dummy. my script far : /** if define manually on each button **/ $(".btn-submit-dummy").click(function() { $(".btn-submit").trigger("click"); }); $(".btn-edit-dummy").click(function() { $(".btn-edit").trigger("click"); }); ... ... ... /** end of defining button **/ my idea if written in jquery , human language (sorry ugly way) following : $("button[class$='-dummy'

Page Analytics: Google Analytics orange tags not appearing -

i have got following code in webpage not showing page analytics not displaying google analytics orange tag: <a href="http://player.vimeo.com/video/60376261" onclick="_gaq.push(['_trackevent', 'home page', 'play', 'why us', 100]);"> <img src="/images/play-video-home.jpg" alt="guests love dark rome" width="700" height="380" /> </a> on same page have similar code virtually identical displaying google analytics (orange) tag: <div class="leftboxlabel"> <a href="/official-vatican-museum-partnership" onclick="_gaq.push(['_trackevent', 'vatican partner', 'click', 'vatican partner']); "> <img src="/images/vaticanp.png" alt="" style="padding-left: 60px; margin-bottom: 80px; margin-top: 20px;" /> </a> </div> why orange tag not appear when select pag

java.lang.IllegalArgumentException from log4j -

my client facing problem , has sent me log file. log file contain few crashes written below. log4j:warn failed set property [maxfilesize] value "10mb". java.lang.illegalargumentexception: object not instance of declaring class @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ... log4j:warn failed set property [file] value "../logging/servicecontainer2100.log". java.lang.illegalargumentexception: object not instance of declaring class @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ... log4j:warn failed set property [maxbackupindex] value "10 ". java.lang.illegalargumentexception: object not instance of declaring class @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ... enclosed log4j configuration file: # set root logger level , appenders. log4j.rootlogger=info, a1, r # appender a1 log4j.appender.a1=org.apache.log4j.consoleappender # layout a1 log4j.appender.a1.layout=org.apache.log4j.p

r - Bar graph and geom_line in ggplot -

i trying draw geom_line on bar chart, bars filled year. code is: library(ggplot2) library(plyr) library(reshape) df <- data.frame(decl.indicators=c("finland", "finland", "germany" ,"germany","italy","italy"), year=c(2009,2010,2009,2010,2009,2010), expval=c(2136410,1462620,371845300,402397520,357341970,357341970), impval=c(-33668520,-37837140,-283300110,-306157870,-103628920,-105191850)) net <- ddply(df, .(year,decl.indicators), summarise, net = sum(expval + impval)) df.m <- melt(df, id.vars = c("year", "decl.indicators")) ggplot(df.m,aes(x=decl.indicators,y=value, fill=factor(year)))+ geom_bar(stat="identity",position="dodge",colour="darkgreen") last_plot() + geom_line(data = net, aes(decl.indicators, net,group = 1), size = 1) + geom_hline(yintercept = 0,colour = "grey90") pro

android - AndEngine : Music isn't working properly -

i'm using following code in onscenetouchevent : if(audiocontrolbutton.contains(pscenetouchevent.getx(), pscenetouchevent.gety()) && pscenetouchevent.getaction() == touchevent.action_down) { togglevolume(); } and works fine, method invoking when has to. togglevolume() has implementation : if(levelmusic.getvolume() != 0f) { levelmusic.setvolume(0f); } else { levelmusic.setvolume(100f); } all of condition seems work, issue comes here: if levelmusic.setvolume(0f) ivoked music volume disables should be, if levelmusic.setvolume(100f) invokes still can't hear music note : i've tried pause() , resume() , it's not working well my levelmusic variable: music levelmusic; //field in scene class levelmusic = data.getlevelmusic(); levelmusic.play(); in onresourcesloadingfinished edit : i've tried set value 60 instead of 100 , 0,9f(if max malue 1f), it's not working too if have problem : use levelmusic.setvo

c# - Castle.Windsor IoC-container specific configuration -

i have chosen castle.windsor ioc container app. first ioc expirience need advice configuring it. the root class of app scheduler . plans , performs different kinds of "jobs". each job implements iworker interface, decided inject list<iworker> scheduler . there many kind of "jobs" later, there two: cleaner , writer . scheduler needs single instance of cleaner , default singleton lifestyle ok. need inject number of writer s depends on count of xml files in folder. optimal pattern achieve in case? configuring container: var container = new windsorcontainer(); // ilist injecting container.kernel.resolver.addsubresolver(new listresolver(container.kernel, true)); // registering scheduler container.register(castleregistration.component.for<ischeduler>().implementedby<scheduler>); // registering workers container.register(castleregistration.component.for<iworker>().implementedby<writer>()); container.register(castleregistration.co

android - Not able to customize the actionbar manually -

ide used=eclipse juno api level=14 device's os=4.2.2 jelly bean i've been trying change background color , text font , font color of action bar using xml file. referred this tutorial , tried got message "unfortunately, myappname has been stopped" the code using change background is: res/values/themes.xml <?xml version="1.0" encoding="utf-8"?> <resources> <style name="mytheme" parent="@android:style/theme.holo.light"> <item name="android:actionbarstyle">@style/myactionbar</item> </style> <style name="myactionbar" parent="@android:style/widget.holo.light.actionbar"> <item name="android:background">#6845db</item> </style> </resources> after changed app theme in manifest as:- android:theme="@style/mytheme" i beginner android development. error log cat is:- 0

preg match - PCRE and PHP - Escaping meta-character -

i continue learn php , pcre. question today following: <?php $search = "money $ money $ money..."; /*i "invalid"*/ if(preg_match("&money \$&", $search)){ echo 'valid <br/>'; }else{ echo 'invalid <br/>'; } /*i "valid"*/ if(preg_match('&money \$&', $search)){ echo 'valid <br/>'; }else{ echo 'invalid <br/>'; } ?> i suppose when use double quotes instead of single ones php messing encoding of ascii character, not totally understand why. can provide detailed answer? single quote strings not processed (not extent of double quote strings, precise) , taken "as-is", when string specified in double quotes , more special characters available , variables parsed within it. if dollar sign ( $ ) encountered in dou

NG-Repeat don't work when I upgrade AngularJS v1.0.x to Angular 1.3.14 -

in 2012 took "angular phonecat tutorial" on angular homepage https://docs.angularjs.org/tutorial and changed things text in json-file (which included in tutorial), worked on webpage . i downloaded , put whole tutorial on site, included angular.js (version 1.0.2) now replace line <script src="../app/lib/angular/angular.js"></script> (this version 1.0.2 provide in tutorial) with <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> and webpage isn't work anymore. i've reread tuturial , have changed things in it, can't figure out difference between these 2 versions. here code: <ul class="phones"> <li ng-repeat="arr in arrangementen | filter:value1| filter:value2|filter:value3| filter:value21| filter:value4| filter:value5| filter:query | orderby:orderprop" class="thumbnail"> <a href="{{arr.link}}&quo

Get large files from FTP with python lib -

i need download large files (>30gb per file) ftp server. i'm using ftplib python standardlib there pitfalls: if download large file, can not use connection anymore if file finishes. eof error afterwards, connection closed (due timeout?) , each succeeding file error 421. from read, there 2 connections. data , control channel, data channel seems work correctly (i can download file completly) control channels times out in meantime. read ftplib (and other python ftp libraries) not suited large files , may support files around 1gb. there similar question topic here: how download big file in python via ftp (with monitoring & reconnect)? not quite same because files huge in comparison. my current code looks this: import ftplib import tempfile ftp = ftplib.ftp_tls() ftp.connect(host=server, port=port) ftp.login(user=user, passwd=password) ftp.prot_p() ftp.cwd(folder) file in ftp.nlst(): fd, local_filename = tempfile.mkstemp() f = open(fd, "wb") ft

javascript - how to place the Table data in begining while browser width is decreased? -

hi have page , 2 css files table if decrease width of browser table data(td) starts centre not beginning.so need when width of browser decreased table data should start left not middle , heading of table (th) should place in middle.below code. tableresponsive.css -------------------------------- @media screen , (max-width: 760px), (min-device-width: 768px) , (max-device-width: 1024px) { /* table properties phone */ table.phone thead, table.phone tbody, table.phone th, table.phone td, table.phone tr { display: block; } /* table properties datepicker */ table.ui-datepicker table, table.ui-datepicker thead, table.ui-datepicker tbody, table.ui-datepicker th, table.ui-datepicker td, table.ui-datepicker tr { display:none; } /* hide table headers (but not display: none;, accessibility) */ table:not(.ui-datepicker-calendar) thead tr, th { position: absolute; top: -9999px; left: -999

javascript - How to do a Swipe down refresh animation on jQuery Mobile -

Image
i'm developing web application first time, , i'm looking swipe down refresh animation make page reload again, i'm using javascript , jquerymobile web app. is there library ? or easy method can use here link thing can use...apparently theres newer version out, tried example , works http://cubiq.org/iscroll-4 here example http://cubiq.org/dropbox/iscroll4/examples/pull-to-refresh/ found on post pull down refresh on mobile web browser

python - How can I bin by date ranges and categories in pandas? -

i have data frame date, category , value. i'd plot sum-aggregated values per category. example want sum values happen in 3 day periods, each category individually. an attempt seems complicating is import random import datetime dt import pandas pd random.seed(0) df=pd.dataframe([[dt.datetime(2000,1,random.randint(1,31)), random.choice("abc"), random.randint(1,3)] _ in range(100)], columns=["date", "cat", "value"]) df.set_index("date", inplace=true) result=df.groupby("cat").resample("3d", how="sum").unstack("cat").value.fillna(0) result.plot() this right logic, resampling doesn't have fixed start, date ranges 3-day periods don't align between categories (and nan/0 values). what better way achieve plot? i think should group cat , date : df = pd.dataframe([[dt.datetime(2000,1,random.randint(1,31)), random.choice("abc"), random.randint(1,3)] _ in range(10

Selenium webdriver - implicit wait with chrome driver -

i want use implicit or explicit wait in code. not working chrome driver. special patch available work? same worked firefoxdriver. my application supports chrome don't have choice use other browser. please me how can use - wait - load element or other solution available? use explicit wait per below way : webelement element = (new webdriverwait(driver, 30)) .until(expectedconditions.elementtobeclickable(by.classname("progress_bg"))); element.click(); you can use id , xpath or other locator element. have used class in above per comment.

ios - FBAudienceNetwork v4.1.0 Build Error -

i tried include fbaudiencenetwork.framework because want display banner/interstitial ad unit in app. app gave me several errors. error undefined symbols architecture armv7: "_objc_class_$_cicontext", referenced from:      objc-class-ref in fbaudiencenetwork(fbadutility.o) "_objc_class_$_cifilter", referenced from:      objc-class-ref in fbaudiencenetwork(fbadblurredimageview.o)      objc-class-ref in fbaudiencenetwork(fbadutility.o) "_kciinputimagekey", referenced from:      ___65-[fbadblurredimageview sliceimage:withaspectratioinfo:withblock:]      _block_invoke42 in fbaudiencenetwork(fbadblurredimageview.o)      +[fbadutility(fbadviewutility) blurimage:withradius:]      in fbaudiencenetwork(fbadutility.o) "_objc_class_$_eaglcontext", referenced from:      objc-class-ref in fbaudiencenetwork(fbadutility.o) "_kcicontextworkingcolorspace", referenced from:      +[fbadutility(fbadviewutilit

SQL Server 2014 Optimizer index selectivity -

i found sql server 2012 , sql server 2014 use different non-clustered index same query , execution plan sql server 2014 sucks. i try update related tables , indexes fullscan kick old plan off, sql server 2014 not using same index sql server 2012. has faced problem, too? how optimizer on 2012 , 2014 make decision indexes selectivity? sql server 2014 uses new cardinality estimator, can cause bad plans. it new way sql server "guess" how many rows returned each operator in plan. you can disable on specific query (if estimations causing bad plan) appending option (querytraceon 9481) query. you can disable server wide setting compability level lower 120: alter database adventureworks2012 set compatibility_level = 110; you might able rewrite query new cardinality estimator performs better old estimator. there lot of information new cardinality estimator, take time read of it. start: http://sqlperformance.com/2013/12/t-sql-queries/a-first-look-at-the-n

Setting a SQL Azure server's name -

one can create sql server on azure cmdlet new-azuresqldatabaseserver but how possible set server name? azure gave automatic name, not easy later you can set azure sql server name https://msdn.microsoft.com/en-us/library/mt163526.aspx but need change azure mode azure resource manager mode this: switch-azuremode –name azureresourcemanager you need latest azure powershell module here: http://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/

How to open a command prompt and input different commands from a java program -

i need open command prompt & execute ij.bat , take me prompt, can give command connect db & later different sql statements. able execute ij.bat java program process process = runtime.getruntime().exec("d:\\ij.bat"); but how give furthur set of commands through java program? you can use exec public process exec(string command) throws ioexception also visit this link

how to plot graph of Precision and Recall in Matlab? -

i have 3 values precision , recall follows: precision = 0.4 recall= 0.45 precision= 0.58 recall= 0.52 precision= 0.6 recall= 0.53 above values show when precision 0.4 recall 0.45 , vice versa, want plot these results in graph should show increase , decrease in precision , recall values respect each other. i want show result of these values in single graph should show 3 curves(lines) different colors different representation. i guessing @ trying achieve honest, possibly looking "hold all" command. if not want achieve, please provide example of plotting single curve, can push in right direction of how expand on that. figure hold plot(calculate_my_results(0.4,0.45)) plot(calculate_my_results(0.58,0.52)) plot(calculate_my_results(0.6,0.53))

Meteor-Ionic - hide safari address bar and tab bar -

i've used wonderful meteor-ionic combo app, when view on iphone can still see safari address bar @ top , safari tab-bar @ bottom of screen. apologies if newbie question, i've been looking solution hours, without luck. is if possible hide either , both bars? the possibilities modify safari's ui mobile website quite limited. you use following meta tag hide bars: <meta name="viewport" content="......,minimal-ui"> but has been removed in ios 8 version , available ios 7.1. another tag used: <meta name="apple-mobile-web-app-capable" content="yes"> but working when user adds website application on homescreen. i think best solution wrap application in cordova webview using meteor build tools, see there: https://github.com/meteor/meteor/wiki/meteor-cordova-phonegap-integration . thus, won't have ui apart 1 provide in webapp.

javascript - Jquery executing/triggering same code on different events -

i have function onclick event of custom tag densitybtn='yes' $("[densitybtn='yes']").on('click', function () { var no_of_people = 0; //calcdensity $("[calcdensity='yes']").each(function () { no_of_people = parseint($(this).val()) + no_of_people; }); var total_density = parseint(carpetarea) / parseint(no_of_people); $("#densityval").html(myval); }); can extend same code extending $("[calcdensity='yes']").on('blur') $("[calcdensity='yes']").on('blur').$("[densitybtn='yes']").on('click', function () { }); am not sure on executing same code on different events let me know method correct? or there alternative way available? define function (not anonymous function) , pass function event listeners function listener() { var no_of_people = 0; //calcdensity $("[calcdensity='yes']

python - cherrypy thread does not spawn subprocess -

i having cherrypy application calls subprocess (subprocess.popen), works fine of time not work. when restart server, subprocess.popen called , works fine. there way monitor threads in cherrypy , check why subprocess.popen not called. update: thread continues rest part of code , response, problem subprocess not called sample code def fn_test(self,**args): #return args['md5'].split()[0] final_html="the complete html" in ['ab','cd','ef']: if args.has_key(i): cherrypy.session[i]='checked' else: cherrypy.session[i]='' subprocess.popen(["python","test.py",'test','aval','bval']) return final_html for simple , occasional background tasks recommend cherrypy.process.plugins.backgroundtask . take @ this question complete example , other general consideration background tasks. specifically, treating subprocess

sql server - Retrieve values for multiple ids given in the order -

i having stored procedure uses csv accept multiple ids. want retrieve values table in order of ids given. stored procedure using is create procedure [dbo].[proc1] @userid varchar(max)=null begin set nocount on; declare @useridord table (userid varchar(max),position int identity(1,1)); insert @useridord select item [dbo].[split] (@userid, ',') select * user user.userid in (select top 100 percent userid @useridord order position) end go what trying csv inserting values temporary table adding order value position. use orderby position, implemented in inner select. output given order in table. know use orderby in outer select statement don't know correct syntax execute it. can me? how using inner join ? select u.* user u inner join @useridord uo on uo.userid = u.userid order uo.position

How to build "edit" button in JSF and switch between h:outputText and h:inputText -

how can create "edit" button when button clicked change h:outputtext h:inputtext ? make use of rendered attribute: <h:outputtext value="#{bean.entity.property}" rendered="#{not bean.editmode}" /> <h:inputtext value="#{bean.entity.property}" rendered="#{bean.editmode}" /> ... <h:commandbutton value="edit" action="#{bean.edit}" rendered="#{not bean.editmode}" /> <h:commandbutton value="save" action="#{bean.save}" rendered="#{bean.editmode}" /> with in view scoped bean: private boolean editmode; public void edit() { editmode = true; } public void save() { entityservice.save(entity); editmode = false; } public boolean iseditmode() { return editmode; } // ... note bean being view scoped important reason mentioned in point 5 of answer: commandbutton/commandlink/ajax action/listener method not invoked or input value no

java - How to replace a word by its most representative mention using Stanford CoreNLP Coreferences module -

i trying figure out way rewrite sentences "resolving" (replacing words with) coreferences using stanford corenlp's coreference module. the idea rewrite sentence following : john drove judy’s house. made dinner. into john drove judy’s house. john made judy dinner. here's code i've been fooling around : private void dotest(string text){ annotation doc = new annotation(text); pipeline.annotate(doc); map<integer, corefchain> corefs = doc.get(corefchainannotation.class); list<coremap> sentences = doc.get(coreannotations.sentencesannotation.class); list<string> resolved = new arraylist<string>(); (coremap sentence : sentences) { list<corelabel> tokens = sentence.get(coreannotations.tokensannotation.class); (corelabel token : tokens) { integer corefclustid= token.get(corefcoreannotations.corefclusteridannotation.class); system.out.println(toke

javascript - Running Node.js Server using User Level Root -

basic question not sure turn start figuring out. i've setup simple node server on port 3000 responds index.html file. when call http://localhost:3000 in browser, proper page served dependencies. don't want authenticate every time though i'd run user-level. i tried typing http://localhost~myusername:3000 in browser keep getting: the requested url /~myusername:3000 not found on server. (i have setup user-level root accessed through ~/sites , have gotten access files through here, php, it's when start using node server problem occurs.) how can node.js respond user-level requests? , serve proper index.html relative path of user-level root instead of /library/webserver/documents ? update code of server.js: var http = require('http'); var fs = require('fs'); function send404(response) { response.writehead(404, { 'content-type': 'text/plain' }); response.write('error 404: resource not found.'); respon

vhdl - Creating a tachometer in VDHL -

i have been assigned task of creating tachometer using vdhl program device. have been provided pin in input signal connected , need display frequency of ones occurring per second (the frequency). having programmed in vhdl couple of times having difficulty figuring out how implement code: so far have constructed following steps device needs take count logical ones in input signal creating process depending on it i did creating process dependent on input_singal , increments variable when high present in input_signal counthigh:process(input_signal) -- counthigh process begin if (input signal = '1') current_count := current_count+1; end if; end process; -- end process stop counting after set amount of time , update display frequency of input_signal i unsure how accomplish using vhdl. have provided process previous code used implement state machine. c_clk clock operates @ 5mhz/1024 (the timer div constant used) meaning period equa

ios - Network requirements for OTA deploy -

i have found following network requirements ota deployment: https://help.apple.com/deployment/ios/#/apda0e3426d7 network configuration requirements if devices connected closed internal network, should let ios devices access following: ax.init.itunes.apple.com: device obtains current file-size limit downloading apps on cellular network. if website isn’t reachable, installation may fail. ocsp.apple.com: device contacts website check status of distribution certificate used sign provisioning profile. i want ask possible deploy through intranet without access above website? work around? thanks.

regex - How do you tell Ruby to stop scan after the 1st match of regular expression -

i have tried different examples provided still couldn't solve issue. here's example: i wan ruby scan text , stop @ 1st occurrence of word happy bigtext = "i happy. happy. happy too." i use "?" ruby stop continues scan , return 3 occurrences of "happy" bigtext.scan(/happy?/) my version of ruby 2.0.0 ^.*?happy you can use m or multiline mode.see demo. https://regex101.com/r/of9hr9/12

ios - Reload UIViewController in "viewDidLoad" -

i change value of 2 uilabels in "viewdidload" method, need view refresh after in order display values. stands, uilabels display value of selected cell. need refresh right after change labels' values. "setneedsdisplay" method not doing job. - (void)viewdidload { [super viewdidload]; // additional setup after loading view. _namelabel.text = _selectedlocation.name; _addresslabel.text = _selectedlocation.address; [self.view setneedsdisplay]; } based on comments, think trying like: - (void)updatelabeltexts { _namelabel.text = _selectedlocation.name; _addresslabel.text = _selectedlocation.address; } and wherever changing _selectedlocation values: //just example -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; _selectedlocation = _yourlocationsarray[indexpath.row]; //now call update method

arrays - Macro in Outlook to delete duplicate emails- -

public sub remdups() dim t items, _ integer, _ arr collection, _ f folder, _ parent folder, _ target folder, _ milast mailitem, _ mi mailitem set parent = application.getnamespace("mapi").pickfolder set target = application.getnamespace("mapi").pickfolder each f in parent.folders set t = f.items t.sort "[subject]" = 1 set milast = t(i) set arr = new collection while < t.count = + 1 if typename(t(i)) = "mailitem" set mi = t(i) if milast.subject = mi.subject , milast.body = mi.body _ , milast.receivedtime = mi.receivedtime arr.add mi else set milast = mi end if end if wend each mi in arr mi.move target next mi next f end sub set milast = t(i) gives "run-time error'440' array index out of bounds please help this modified version

android - Implement OnClickListener to the ListView Items -

This summary is not available. Please click here to view the post.

ios - What I am doing wrong with my CLLocation? -

i trying make simple app shows: latitude longitude horizontal accuracy altitude vertical accuracy location start my code is: @iboutlet weak var latitude: uilabel! @iboutlet weak var longitude: uilabel! @iboutlet weak var horizontalaccuracy: uilabel! @iboutlet weak var altitude: uilabel! @iboutlet weak var verticalaccuracy: uilabel! @iboutlet weak var distance: uilabel! var locationmanager: cllocationmanager = cllocationmanager() var startlocation: cllocation! @ibaction func resetdistance(sender: anyobject) { startlocation = nil } func locationmanager(manager: cllocationmanager!, didupdatelocations locations: [anyobject]!) { var latestlocation: anyobject = locations[locations.count - 1] latitude.text = string(format: "%.4f", latestlocation.coordinate.latitude) longitude.text = string(format: "%.4f", latestlocation.coordinate.longitude) horizontalaccuracy.text = string(format: "%.4f", latestlocation

how to remove row selection highlight from ui-grid -

i have 2 angular ui-grids in 1 html page remove row selection highlighting 1 of them. how can accomplish this? tried removing 'ui-grid-row-selected' class in ui-grid-unstable.js removes highlight other grid not want. appreciated. just remove ui-grid-selection attribute html , make enablerowselection : false on second grid. 2 make sure selection disabled on rows.

c# - ImageResizer not touching file from webapi 2 controller -

i've read post: imageresizer not resizing images served webapi and i've read associated faq talks webapi , imageresizer here: http://imageresizing.net/docs/best-practices i'm still not understanding need make files served route: config.routes.maphttproute ("api vimeo thumbnail", "rpc/{controller}/{action}/{vimeoid}.jpg", new { }); and handled controller: public class vimeocontroller : apicontroller { [httpget] [actionname("thumbnail")] public httpresponsemessage thumbnail(string vimeoid = null, int? width = 1280, int? height = 720) { string url = string.format("https://vimeo.com/api/oembed.json?url=https%3a//vimeo.com/{0}&width={1}&height={2}", vimeoid, width, height); var endpointrequest = (httpwebrequest) webrequest.create(url); endpointrequest.method = "get";