Posts

Showing posts from August, 2012

jsf - submit form when p:commandbutton click -

i using primefaces in jsf web application. in order user inputs have used primefaces keyboard component , it's working fine. issue after getting user input keyboard component , click on commandbutton cause page reload. <p:keyboard id="default" value="#{paymentbean.mobilenumber}" keypadonly="true" size="50" for="numberinput" /> <p:commandbutton id="enternotebtn" action="#{paymentbean.validatepayment()}" value="#{msg['billpayment.cash.message']}" onclick="onenternotebtn();" async="true" /> but when using primefaces inputtext instead of keyboard component not cause page reload. <p:inputtext id="numberinput" value="#{paymentbean.mobilenumber}" autocomplete="off" /> <p:commandbutton id="enternotebtn" action="#{paymentbean.validatepayment()}" value="#{msg['billp

java - Maven build error - Connection to maven central repository refused even though I am not in proxy network -

when created new maven project , clean , build error message. scanning projects... ------------------------------------------------------------------------ building mavenproject6 1.0-snapshot ------------------------------------------------------------------------ downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom ------------------------------------------------------------------------ build failure ------------------------------------------------------------------------ total time: 22.506s finished at: wed jan 27 12:26:55 ist 2016 final memory: 7m/123m ------------------------------------------------------------------------ plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or 1 of dependencies not resolved: failed read artifact descriptor org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to cent

javascript - Width setting on jQuery dropdownchecklist not being applied -

$(document).ready(function () { $("#ddlone").dropdownchecklist("destroy"); $("#ddlone").dropdownchecklist({ icon: {}, closeradioonclick: true, maxdropheight: 220, width: 58 }); }); i have above peace of code , no matter value set width, dropdownchecklist remains same. way i'm doing above there correct way?

php - What is the difference between {{ }} and {!! !!} in laravel blade files? -

in laravel framework can use blade add php code in html file. using both {{ }} , {!! !!} syntax in blade files of laravel. difference between them? blade {{ }} statements automatically sent through php's htmlentities function prevent xss attacks. if pass data controller view styling as $first = "<b>narendra sisodia</b>"; and if accessed within blade {{ $first }} then output'll <b>narendra sisodia</b> and if accessed within blade {!! $first !!} then output'll narendra sisodia

asp.net mvc - Sorting is not working in mvc MVCGrid.net -

i'm using mvcgrid.net grid show data data base. problem sort option not working here mvcgrid code ienumerable<state> st = null; mvcgriddefinitiontable.add("stategrid", new mvcgridbuilder<state>() .withauthorizationtype(authorizationtype.allowanonymous) .addcolumns(cols => { cols.add("statecode").withsorting(false) .withvalueexpression(p => p.statecode); cols.add("statename").withheadertext("state name") .withvalueexpression(p => p.statename); }) .withsorting(true, "statename") this old question, i'll tell helped me. columndefaults coldefauls = new columndefaults() { enablesorting = true }; mvcgriddefinitiontable.add("stategrid", new mvcgridbuilder<state>(coldefauls) .withauthorizationtype(au

html5 - how to fix footer at bottom gap without using height fixed? -

Image
i want fix footer @ bottom gap. think content less problem repeated , content full problem solved want content less not shows gap i'm using same footer remaining pages me one. if content less, why not fix @ bottom. mean dirtiest hack possible. if want clean, sticky footer.

Link-time optimization with android-ndk r8e -

i wanted compile sources (sdl , similar things) using new android ndk r8e. changelog states "enabled -flto in gcc 4.7, 4.6, clang 3.2 , clang 3.1". i've added -flto local_cflags, local_cppflags , local_ldflags. optimization , architecture flags arent in linker call , therefore no optimization done (aka slow binary). linker fails because cannot find functions .s files , instructions aren't available in thumb mode. worked fine without -flto. so how use link-time optimization correctly , how avoid problems? , no, adding own optimization/architecture flags local_ldflags no answer because want use ndk , not own hacky build scripts. the link-time optimization tested on amd64 (non-android) using own build scripts , worked fine (compiled, linked , 20% speed benefit). please keep answers ndk build system.

android - Multiple selection in ListView -

i followed this link multiple selection of listview . i want know if there way user can restrict selection on view depends on case. please help.

phpmyadmin - How to assign new database to user account(cpanel)? -

i have root access phpmyadmin , created database (cpaneluser_databasename) , user using php script, when login cpanel cannot find database there. now question how associate database user account user account mean cpanel account ? here find similar question didn't find proper answer here . i woring on oneclick installer create database , upload files , associate user account database. select database mysql insert user table correct values insert db table correct values flush privileges for correct values see mysql user manual regarding mysql security http://dev.mysql.com/doc/mysql-security-excerpt/5.0/en/grant-table-structure.html

javascript - Videojs-vast-vpaid ad control buttons -

please, help! have video.js v4.12.11 , videojs-vast-vpaid plugin. need control buttons "skip ad", "go site", "close ad". checked xml - have such information. example <extension type="skiptime"><![cdata[00:05]]></extension> <extension type="skiptime2"><![cdata[00:05]]></extension> <extension type="linktxt"><![cdata[&#1087;&#1077;&#1088;&#1077;&#1081;&#1090;&#1080; &#1085;&#1072; &#1089;&#1072;&#1081;&#1090; &#1088;&#1077;&#1082;&#1083;&#1072;&#1084;&#1086;&#1076;&#1072;&#1090;&#1077;&#1083;&#1103;]]></extension> <extension type="isclickable"><![cdata[1]]></extension> and have such code: "plugins": { 'ads-setup': { "adsenabled": true, "url": here url } }

javascript - Repeat the popup using php -

i have image directory, images showing on page want popup when user click on image, code using #overlay { display:none; position:fixed; left:0px; top:0px; width:100%; height:100%; background:#000; opacity:0.5; z-index:99999; } #popup{ display:none; position:fixed; left:50%; top:50%; width:300px; height:150px; margin-top:-75px; margin-left:-150px; background:#ffffff; border:2px solid #000; z-index:100000; }</style> <script>window.onload = function() { document.getelementbyid("picss").onclick = function(){ var overlay = document.getelementbyid("overlay"); var popup = document.getelementbyid("popup "); overlay.style.display = "block"; popup.st

Is there any other way to access open forms in C#? -

application.openforms["formname"]; is there other way access open form. application doesn't see form although opened. dont know why. isn't necessary name open form. can form want index: form frm = application.openforms[0] //will main form form frm = application.openforms[1] //will first child forms in openforms collection ordered in same way create it otherwise, alternative save reference form , accessing reference. //where want save reference: form theform; //where create form: myclass.theform = new myform(); //where want form: messagebox.show(myclass.theform.caption); (myclass class hold reference form, supposing accessing different classes) (also, see if affected this: application.openforms.count = 0 always )

javascript - React & Redux : connect() to multiple components & best practices -

i'm working on first react/redux project , have little question. i've read documentation , watched tutorials available @ https://egghead.io/lessons/javascript-redux-generating-containers-with-connect-from-react-redux-visibletodolist . but still have 1 question. it's login page. have presentational component named loginform : components/loginform.js import { component, proptypes } 'react' class loginform extends component { render () { return ( <div> <form action="#" onsubmitlogin={(e) => this.handlesubmit(e)}> <input type="text" ref={node => { this.login = node }} /> <input type="password" ref={node => { this.password = node }} /> <input type="submit" value="login" /> </form> </div> ) } handlesubmit(e) { e.preventdefault(); this.props.on

ruby - Storing Private Files on Heroku -

i have scenario here related storing private files on heroku. i need store private files( certificates , keys sending push notifications ios devices) in heroku app(uses cedar stack), can push these files heroku server through git storing on git not secure these private. so, want secure copy (scp) these files heroku server heroku doesnt allow incoming connections , storing these files on s3 bucket not great solution takes time file s3 bucket increases delay in sending each push notification when in loop. i'm kinda lost finding right solution scenario. gem https://github.com/nicoskaralis/pushmeup accepts private files either file object or string (that points out path of files on server). heroku allows set config vars(only strings) can used in environment not files. could please suggest me workarounds in scenario, thank you. you can't use file system in heroku, hence need different storage system. you can either use cloud-system storage such amazon s3, , enc

javascript - scripts and css not loading in web server -

my project build on codeigniter working fine in localhost running in webhost . not able find scripts , stylesheet , site running without design appearing. made following changes before running in webhost: config.php: $config['base_url'] = 'http://'.$_server['http_host'].'/scholarship/'; the project inside scholarship directory inside domain name database.php: all database settings done , working fine database part no error check htaccess make sure correct on chrome, right click - view sourse - find , click url of script

c# - Azure Diagnostics - encrypting connection string in cscfg -

in our project, want use azure diagnostics. fine, except 1 thing, there seems no possibility encrypt azure diagnostics connection string in cscfg file. take configuration part in cscfg, instance (real values obscured): in above, whole conn string (also accountkey) seen in azure portal. our problem. link verify: https://manage.windowsazure.com/microsoft.onmicrosoft.com#workspaces/cloudservicesextension/cloudservice/your-cloud-srv/configure also, can seen in cscfg file. during roll out, not want expose accountkey other parties eg portal administrator. now, question is: possible use encrypted accountkey in cscfg file, or, proposed way activate azure diagnostics in suc manner conn string can decrypted before azure diag activation? this has work latest azure sdk 2.71 or 2.8.1. update: if add encrypted conn string cscfg, being eg encdiagconnstring, still possible azure sdk 2.7.1 or azure sdk 2.8.1 programatically start diagnostics, if provide decrypted conn string in azure ro

Excel - import data from an online xls file -

i trying data excel found online sheet on computer. have tried script post ( excel - import data online xls file daily ), data in same sheet, instead of creating new sheet/having new workbook open whenever want run macro. i have tried replacing line: set wsnew = wbme.sheets.add(after:=wbme.sheets(w)) with: set wsnew = wbme.sheets("sheet9") this way, tried have sheet9 updated, instead of opening new worksheet everytime run macro. the full vba code used was: sub openxlsfromurl() dim wbme workbook dim wsnew worksheet dim w integer dim wburl workbook dim url string set wbme = thisworkbook url = "https://google.com/test.xls" set wburl = workbooks.open(url) '## add code copy data workbook and/or manipulate data...' w = wbme.sheets.count '## add new worksheet end of thisworkbook:' set wsnew = wbme.sheets(sheet9) '## copy & paste data in our new worksheet:' wburl.sheets(1).cells.copy destination:=wsnew.range("a1")

sql server - SQL - select all rows containing account number proceeding an earlier status -

when account reaches specific status, need return account number using select statement returning rows later date same account regardless of proceeding status. table , results bit this: table , expected results if break down result set account number need this. account 001 first time see b2 want see later rows regardless of status, earlier rows ignored. have used example because b2 seen again later. rows 2,3,4 returned. for account 002, there 1 row displayed. row 5 returned: for account 003 b2 first given status no previous rows exclude. rows 6,7,8 returned. select * yourtable t date_time >= (select min(date_time) yourtable p t.account_number = p.account_number , p.status = 'b2') i think should trick, clause filters account numbers have status b2 , dates after it.

php - Connection busy to MS SQL Server on Linux using Zend Framework 2 and ODBC Driver -

i needed migrate windows server setup linux (red hat 7.2) server. used pdo_sqlsrv driver on windows machine. on linux we've installed pdo_odbc driver. since zend framework 2 doesn't support out of box, figured out db configuration myself using zf2 api docs works now. configuration: 'db' => array( 'driver' => 'pdo', 'username' => 'ourdbusername', 'password' => 'ourdbpassword', 'dsn' => 'odbc:driver={sql server native client 11.0};uid=ourdbusername;pwd=ourdbpassword;database=ourdbname;server=ourserverip', 'charset' => 'utf-8' ), so far good. if run our application go expected till simple request fails every time details of object. can't make request working if remove other requests executed before it. chaining request in way doesn't help. error: statement not executed (hy000 - 0 - [microsoft][sql server native client 11.0] connection bu

javascript - How to make table row clickable while using <display:table> &<display:column> -

<display:table class="table" name="regionlist" id="elem" requesturi="./addcountry.html"> <display:column property="name" title="country" /> <display:column property="code" title="city" /> <display:column title="&nbsp;"> <a href="qqqq.html?id=<c:out value='${elem.id}' />">edit</a> </display:column> </display:table> how can make whole table row clickable link? there 3 options here: wrap het div's within anchor (not best practice , don't think seo likes it) $(".parentdiv").click(function() { window.location = $(this).data("http:///www.location.com"); }); <div onclick="location.href='your-url-here';" style="cursor: pointer;"></div>

r - Why this list can't be stored as element in data frame? -

i ran randomforest model , tried store model element in data frame. wrap things list() , store element, here seems need 2 layers list(list()) . can explian why, , tell me if list(list()) way fix this? library(randomforest) data1 = data.frame(a = sample.int(100, size = 100)) data1$b = data1$a data1$c = data1$a data1$d = data1$a report = data.frame(ntree = 500, mtry = 1:3, model = na) ( i_row in 1:nrow(report)){ ntree = report[i_row, 'ntree'] mtry = report[i_row, 'mtry'] rf = randomforest( d ~ ., data = data1, importance = t, ntree = ntree, mtry = mtry) report[i_row, 'model'] = rf # not work report[i_row, 'model'] = list(rf) # not work report[i_row, 'model'] = list(list(rf)) # works } data frames internally lists , if consider str(rf) see randomforest-model internally represented list. attributes have different dimensions, rf can't transformed data.frame r tries best

Jenkins "selective" matrix build [matrix-project-plugin] -

matrix plugin allows doing multi-dimensional builds based on user-defined or built-in axes. when trigger matrix build, jenkins starts build cartesian product builds. question: wonder there way trigger build single matrix entry or on wrong path? some visualization : axis 1 variables (branch) -> master branch1 branch2 axis 2 variables (app type) -> api web axis 3 variables (deploy target) -> test stage live in specific case jenkins comes 3-dimensional cube of jobs containing 3x2x3=18 builds in it, , when trigger build matrix project of them starts. want here is, should able select axis variable each axis (ie multiselect list), , based on selections jenkins should build corresponding items. instance; axis 1 -> branch1 axis 2 -> api axis 3 -> test stage hence jenkins should execute 2 jobs. you want matrix combination plugin prompt combinations want this plugin allows user choose matrix combinations wants run, opposed default behavi

asp.net mvc - Unable to access files from UNC path in ASP.MVC aplpication hosted in IIS7 -

Image
i'm downloading files unc path working fine on local host when hosted on iis 7 gives me following error: my action in mvc returns file is: [validateinput(false)] public fileresult getfile() { request.validateinput(); string filelocation = configurationmanager.appsettings["uncpath"]; string filename = httputility.urldecode(request.querystring["filename"]); string path = path.combine(filelocation, filename); string getfileextension = path.getextension(filename); string contenttype = mimetypemap.getmimetype(getfileextension); return file(path, contenttype, filename); } in web confing have uncpath \network\drivef...

unix - Bad use of parentheses -

i've been stuck on hours: cd /dir1 (cd $home); pwd; why pwd still /dir1 , didn't go home directory? parentheses start subshell: shell calls fork , , commands inside parentheses executed in subprocess. parent process waits subprocess exit resumes execution. what's happening is: execution of cd /dir1 : shell performs chdir("/dir1") . execution of parentheses: shell calls fork , parent process waits child exit. execution of cd $home : subshell performs chdir("/home/jurgen") . the subshell has run out of commands, exits. the subshell has exited, wait call in parent returns. execution of pwd : shell prints current directory, /dir1 .

list - Intersect between 2 collections in C# -

i have: list<infraestructura> l1 = listq1.tolist(); list<infraestructura> l2 = listq2.tolist(); and need intersect comparing ids. that: l1.intersect(l2, l1[].id_infraestructura == l2[].id_infraestructura) but don't know method must use , sintax. i found this: var ids = list1.select(a => a.id).intersect(list2.select(b => b.id)); but return list of ids , need list of elements contained in both lists. thank you! the other answers correct, can use intersect custom comparer. can create custom comparer implementing iequalitycomparer<> interface. , implementing interface must implmenet 2 methods, equals , gethashcode . public class infraestructuracomparer: iequalitycomparer<infraestructura> { /// <summary> /// whether 2 infraestructura equal. /// </summary> public bool equals(infraestructura firstobj, infraestructura secondobj) { if (firstobj == null &&

java - issue using HorizontalPicker library -

Image
i implemented this library app accomplishing horizontal picker view think followed whatever asked dont know why nit showing (widget here totally transparent) how implemented : mainactivity: public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { snackbar.make(view, "replace own action", snackbar.length_long) .setaction("action", null).show(); } }); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().infl

ios - Proper way to reuse UITableViewCell containing UICollectionView -

Image
i have uitableview. each cell contains horizontal collection view. when scroll table, collection view contains cells. guess because cells not reused. in illustration, grey cells not suppose there. what proper code should put in reusecell? tried following made app crash over ride func prepareforreuse() { super.prepareforreuse() channelscollectionview = uicollectionview() } it should //reset datasource channelscollectionview.datasourcearray = []() //reload data of collectionview channelscollectionview.reloaddata() again depends, 1 way of doing

javascript - Node.js isomorphic-react-example error -

i saw https://github.com/davidwells/isomorphic-react-example , create simple one,but error message can't find module app,is miss something?or how should change code?thanks server.js var express = require('express'); var exphbs = require('express-handlebars'); var app = express(); require("node-jsx").install(); var react = require("react"); app = react.createfactory(require("app")); app.engine('handlebars', exphbs()); app.set('view engine', 'handlebars'); app.get('/', function (req, res) { var markup = react.rendertostring(app()); res.render('main', { title: 'express', markup: markup }); }); app.listen(3000); app.js var react = require("react"); var app = react.createclass({ getinitialstate() { return { search: "" }; }, render() { return ( <div classname="search-component">

Protractor UI Tests fail with Jenkins, successful on WinServer on cmd run -

i have jenkins configured on windows server nightly builds, compilations etc.. , ui test (e2e tests) automation i'am having problems. have web application runs on chrome , need jenkins run these tests using protractor (with selenium). with manual run windows cmd console, tests finish successfully. -------here console output; ***c:\jenkins\jobs\ui automation\workspace> protractor e2e-tests/protractor.conf.js using chromedriver directly... [launcher] running 1 instances of webdriver warning - more 1 element found locator by.repeater("attachment in pos t_item.attachments") - first result used . finished in 68.394 seconds 1 test, 8 assertions, 0 failures [launcher] 0 instance(s) of webdriver still running [launcher] chrome #1 passed*** -----here output of run jenkins; c:\jenkins\jobs\ui automation\workspace>protractor e2e-tests/protractor.conf.js using chromedriver directly... [launcher] running 1 instances of webdriver warning - more 1 element fo

JavaScript array reduce start from index -

this problem has been bugging me while , can't seem find answer in web. is possible use array reduce method starting index? simple example var studentgrades = ["john doe", "some school", 6, 7, 8, 7, 9, 9]; if need loop on integers in studentgrades , can simple loop for(var = 2; < studentgrades.length; i++) { // stuff here ... } but let's need average grade sum of integers divided integers count. if array contained integers, there no problem using reduce . var onlyintegersarr = [5,2,3,4]; var averagegrade = onlyintegersarr.reduce(function(a,b){ return + b; }) / onlyintegersarr.length; however if know whatever reasons need skip first 2 array elements , start index array[2]. so example apply reduce studentgrades , starting index studentgrades[2]. is possible reduce ? thank solutions, slice approach, prefer not using new method in case. e.g. var average = studentgrades.reduce(function(a,b,i){ return >= 2 ? a+b : 0; })

reactjs - React updating state within the same component -

i new react, thought setting state re-render react component. did miss here, text not displayed until call this.forceupdate() . export default class hello extends react.component { constructor(props){ super(props); this.state = { value: ''}; this.handlechange = this.handlechange.bind(this); } render() { return ( <div> <input type="text" onchange={this.handlechange} /> <p> entered {this.state.value} </p> </div> ); } handlechange(event){ this.state = { value: event.target.value }; this.forceupdate(); } } you should call .setstate method instead of assign new value this.state handlechange(event){ this.setstate({ value: event.target.value }) }

Stop a method in java -

i have made method send e-mail, , wanted try if possible call method inside method timer, scheduler public void createexcel(){ int year = calendar.getinstance().get(calendar.year); int num_week = data.getcurrentweek()-1; arraylist<dhdemande> listedemandes = d.getdemandesforpaie(num_week, year); try { data.createfile(listedemandes); thread.sleep(20000); createexcel(); } catch(interruptedexception ex) { thread.currentthread().interrupt(); } } but method doesn't stop (it obvious) if refresh apache , if change method. how can stop ? because receive email every 20 second the thing treads there save way tell stop without memory leaks. can use thread.stop() , kill thread may cause memory problems if objects big. quote java doc: stop() deprecated. method inherently unsafe. stopping thread thread.stop causes unlock of monitors has locked (as natural conseq

inner join with group by pandas python -

i have 2 dataframes named geostat , ref, dataframes follows: geostat: count percent grpno. state code 0 14.78 1 ca 1 0.00 2 ca 2 8.80 3 ca 3 9.60 4 fl 4 55.90 4 ma 5 0.00 2 fl 6 0.00 6 nc 7 0.00 5 nc 8 6.90 1 fl 9 59.00 4 ma res: grpno. maxofcount percent 0 1 14.78 1 2 0.00 2 3 8.80 3 4 59.00 4 5 0.00 5 6 0.00 i want select first(res.maxofcount percent), res.grpno., , geostat.first(statecode) dataframe geostat , res inner join on columns res.maxofcount percent = geostat.count percent , res. grpno. = geostat.grpno. group res.grpno. i want python pandas, not sure on how inner join group by.can me on this? the

javascript - mdg:geolocation - App asks for general location permission but also for "http://meteor.local" -

unfortunately when deploy ios app, app asks general permission (as should) afterwards " http://meteor.local " webview. there way bypass second prompt or "problem" have deal with? thanks in advance. i running same issue you. using meteor 1.3 beta 3. try install https://github.com/apache/cordova-plugin-geolocation . run: meteor add cordova:cordova-plugin-geolocation@2.1.0 this fixed issue me.

javascript - "mouse:over" not firing and "mouse:down" returning undefined target using fabricJS -

here issue; trying display "markers" , on mouse over/out/click give actions. the problem no event gets fired on over @ , when on click (down) in console feedback, not of element per (target == undefined). my different shapes groups in group called "marker". , group following: marker.add(plateshape, platelabel, line, indicator); when using marker.addwithupdate(plateshape, platelabel, line, indicator); i feedback (over being finicky @ best) layout messed up. you can comment/uncomment line 86 check behaviour in following fiddle. https://jsfiddle.net/u7x7az1j/5/ thank help! :) the problem comes use of add . replace add addwithupdate , aware addwithupdate takes 1 parameter @ time. marker.addwithupdate(plateshape); marker.addwithupdate(platelabel); marker.addwithupdate(line); marker.addwithupdate(indicator); i tried on fiddle , works. consider replacing rect + triangle + line simple parametric fabric.path can build.

entity framework - EF 7 Code first DB creation issue -

i followed tutorial on pluralsight asp .net 5 , ef 7 using code first db. connection string : "worldcontextconnection": "server=cvu-octaviane\\sqlexpress;database=theworlddb;trusted_connection=true;" i added initial migration (which worked fine) , tried use ef 7 feature create db automatically: created context type class used database.ensurecreated() create db on first run. context class: public class worldcontext : dbcontext { public worldcontext() { database.ensurecreated(); } public dbset<trip> trips { get; set; } public dbset<stop> stops { get; set; } protected override void onconfiguring(dbcontextoptionsbuilder optionsbuilder) { var connstring = startup.configuration["data:worldcontextconnection"]; optionsbuilder.usesqlserver(connstring); base.onconfiguring(optionsbuilder); } } when ran project "a severe error occurred on current command" thanks

tsql - How can I get percentage in sql? -

[getpollresult] @poll_form_id int begin select a.question_id,a.title,count(*) vote tbl_poll_option join tbl_poll_answer b on a.id=b.option_id join tbl_poll_question c on a.question_id=c.id poll_form_id=@poll_form_id group a.title,a.question_id end i have poll system. use query count of every answer of question. how can percentage of every answered option this: question 1 ---> option1=20.13 % ---> option2=79.87 % question 2 ---> option3=100 % question 3 ---> option4=30 % ---> option5=70 % .... you can try following: [getpollresult] @poll_form_id int begin select distinct a.question_id,a.title,count(*) over(partition a.question_id,a.title) / count(*) over(partition a.question) vote_percent tbl_poll_option join tbl_poll_answer b on a.id=b.option_id join tbl_poll_question c on a.question_id=c.id poll_form_id=@poll_form_id end

node.js - Mongoose aggregate method does not work -

i have these lines : score.find({gameid : gameid}).exec(function(err,obj){ console.log("find length : " + obj.length); }); score.aggregate([ {$match: {gameid: gameid}} ], function (err, result) { console.log('result : ' + json.stringify(result)); console.log('is there error : ' + err); }); and output of these lines result : [] there error : null find length : 1 i not understand, why "match" method of aggregate not work expected - finding documents, match properties. added score.find same "body" find out, if document exist , does. ps : {gameid: gameid} - first gameid name of property, second 1 string value id looking for. ps2: fluent api having same result : score.aggregate().match({gameid: gameid}).exec(function (err, result){ console.log('result : ' + json.str

internationalization - Convert string to number using i18n in AngularJS -

using ng.ifilterservice in angularjs can convert number string. numberfilter uses i18n determine if needs period or comma format number. like so: var numberstring = $filter('number')(1.1234, 2); // numberstring = 1,12 when using i18n nl-nl (netherlands) what looking for, , far haven't found, how in reverse. when having string value '1,12' , knowing i18n setting decimal separator (in case comma) 1 know enough convert back. although can't find method in angularjs this.

c# - Compare DateTime and date as string -

i have value of datetime , date string. string date can in unknown format (1 of 2 in case : "mmm dd yyyy" or "dd mmm" ). need check if dates eaqual. is there other solution trying parse string date first , second formats , if 1 return datetime compare datetime type? of course. can use datetime.parseexact method. there several overloads of function. one of overloads parseexact(string, string[], iformatprovider, datetimestyles) . converts specified string representation of date , time datetime equivalent using specified array of formats, culture-specific format information, , style. format of string representation must match @ least 1 of specified formats or exception thrown. string[] formats= {"mmm dd yyyy", "dd mmm"}; var datevalue = datetime.parseexact(datestring, formats, cultureinfo.invariantculture, datetimestyles.none); keep in mind that, format

php - MySQL count takes too long with many join -

in project, make 3 queries , 1 takes time. use doctrine 2 , php , make request use querybuilder. i've got list of vehicles (900 000 records), list of clients (600 000 records), utilisateur (600 000 records) , _client_has_groupe_etablissement (600 000 records). in first query count number total of vehicles. take 0.25s => perfect. secound query allow find vehicle different filter multiple joins. take 0.5s => perfect. here query : select [many things] vehicule v0_ inner join categorie_vehicule c1_ on v0_.idcategorievehicule = c1_.idcategorievehicule inner join energie e2_ on v0_.idenergie = e2_.idenergie left join vehicule_lastrdv v6_ on (v6_.idvehicule = v0_.idvehicule) left join client c4_ on v0_.idutilisateur = c4_.idutilisateur left join utilisateur u5_ on c4_.idutilisateur = u5_.idutilisateur left join ​_client_has_groupe_etablissement t3_​ on c4_.idutilisateur = t3_.idutilisateur left join groupe_etablissement g7_ on t3_.idgroupeetablissement = g7_.idgro

ruby on rails - Nested query for association -

campaign has_many:ads ad belongs_to: campaign has_many :likes like belongs_to :ad i want count likes of ads in campaign.how query it? add relation campaign has_many :likes, through: :ads after can use: campaign.likes.count

installshield - Retrieving the value of checkbox of DIalog in Installscript -

how fetch value of checkbox in installscript in installshield? background : have checkbox has property "ualcstatus" , value "on" .in dialogs section . when fetch value in installscript using following command, fetches 0 or nothing (whether checked or unchecked) msigetproperty(hmsi, "ualcstatus", szstrvalue, nval); do have set custom action when check checkbox can set value of "ualcstatus" property in order gets set "on" . properties tied check boxes in windows installer ui set values evaluate true or false. while can tweak exact value used true/checked in checkbox table , simpler approach call msievaluatecondition condition string of name of property, , compare msicondition_true (1): if msievaluatecondition(hmsi, "ualcstatus") = msicondition_true : : : endif; alternately such simple condition, can property described , compare empty string. if it's empty, check box. if it's set else, ch

How to pass argument in callback function in php? -

i have repository class method follows: public function getone($id){ $method = __method__; $post = null; $post = $this->cachemanager($method, function($id) { return db::select("select * posts id = ?", [$id]); }); return $post; } i want cache result, in closure/callback function $id parameter not working. cachemanager trait i'm using in repository. public function cachemanager($method, $fn) { $obj = null; if(!$this->hascache($method)){ $obj = $fn(); } else { $obj = $this->getcache($method); } return $obj; } i have other methods without parameters , they're working intended. use use . :d with use clause, can import variables parent scope scope of function. public function getone($id){ $method = __method__; $post = null; $post = $this->cachemanager($method, function() use ($id) { return db::select("

Python - connecting with twitter's API -

i wrote script connect twitter's api. script works perfect on pc. here script, grabs tweets word 'car' in them: from tweepy.streaming import stream tweepy import oauthhandler tweepy import streamlistener ckey='mycustomerkey' csecret='mycustomersecret' atoken='mytoken' asecret='mysecret' class listener(streamlistener): def on_data(self,data): print data return true def on_error(self, status): print status auth=oauthhandler(ckey,csecret) auth.set_access_token(atoken, asecret) twitterstream=stream(auth, listener()) twitterstream.filter(track=['car']) as said, works perfect on machine. but, when copied script external server (and of course, downloaded relevant module (tweepy))- error: runfile('z:/data/twitter/grab_tweets.py', wdir='z:/data/twitter') traceback (most recent call last): file "<ipython-input-5-74327b031634>", line 1, in <module> runf

javascript - Alternate structure for a sequence of If statements? -

i'm programming poker program in javascript. have hand class has properties "cards", "value" , "valuecards". value property integer corresponds hand type, , valuecards array of 5 cards corresponds hand type. example, if original 7 cards(contained in cards property) contains flush, this.value flip 6, , this.valuecards equal 5 cards equal highest flush. i have 1 method each hand type, , of them change value , valuecards if hand type detected. have accessor method value called getvalue, when went make method run tests on hand , keep highest one, came out looking this: poker.hand.prototype.gettruevalue = function () { this.teststraightflush(); if(this.value == poker.hand_type.straight_flush){ return; } this.testquads(); if(this.value == poker.hand_type.quads){ return; } this.testfullhouse(); if(this.value == poker.hand_type.full_house){ return; } this.testflush(); if(this.value == poker.hand_type.flush){ return; }

windows - Error in upgrading to Service Pack 1 in visual studio 2010 -

Image
i have installed visual studio 2010 professional version , installation successful. when open visual studio, dialog in first image came , clicked on link. while installing sp1,the dialog in second image came.how can solve issue? log file is

excel - VBA: How do I allow filters to be turned on and off on a protected sheet? -

i have following piece of code, removes filters , re-applies them selected cells: range("a10:am10").select selection.autofilter selection.autofilter the problem have when sheet protected , try run code errors, there way of allowing filters turned on , off on protected sheet? how you? it depend on setup of protection. when protect worksheet, there option allow filtering (autofilter). if you're 1 who's protecting sheet, can use of worksheet's protect method's parameters set protection options. here protect method's parameters: sheetname.protect(password, drawingobjects, contents, scenarios, userinterfaceonly, allowformattingcells, allowformattingcolumns, allowformattingrows, allowinsertingcolumns, allowinsertingrows, allowinsertinghyperlinks, allowdeletingcolumns, allowdeletingrows, allowsorting, allowfiltering, allowusingpivottables) if want able implement filters code, can set userinterfaceonly parameter true. protection block u

r - dplyr having trouble redefining type with group_by() -

i have following problem: when using dplyr mutate numeric column after group_by(), fails if row contains 1 value nan when using mutate command. thus, if grouped column contains numeric, correctly classifies dbl, there instance of nan group, fails dplyr defines group lgl , while other groups dbl . my first (and more general question) is: there way tell dplyr, when using group_by(), define column in way? secondly, can me hack problem explained in mwe below: # error: provide column defining error mentioned: df <- data_frame(a = c(rep(letters[1:2],4),"c"),g = c(rep(letters[5:7],3)), x = c(7, 8,3, 5, 9, 2, 4, 7,8)) %>% tbl_df() df <- df %>% group_by(a) %>% mutate_each(funs(sd(., na.rm=true)),x) df <- df %>% mutate(winsorise = ifelse(x>2,2,x)) # no error (as no groups have single entry nan): df2 <- data_frame(a = c(rep(letters[1:2],4),"c"),g = c(rep(letters[5:7],3)), x = c(7, 8,3, 5, 9, 2, 4, 7,8)) %>% tbl_df() df2 <- df2