Posts

Showing posts from May, 2014

Python selenium webdriver Chrome - Chrome is being controlled by an automated software -

Image
i using selenium webdriver , creating chrome driver instance. when try scroll down , scroll up,i getting following error message. further can see error message 'chrome being controlled automated software'. annoying see error though not able change settings in chrome browser allowing automation. from selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.support import expected_conditions ec selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait wait selenium.common.exceptions import timeoutexception log_util.logger import log log import time log = log() class wiki(object): def __init__(self): self.link = 'http://wikipedia.org' self.path = '/users/swadhikar_c/downloads/chromedriver' self.driver = webdriver.chrome(executable_path=self.path) def open_wiki(self): driver = self.driver driver.get(self.link) return self.wait_for_page_load

javascript - bootstrapvalidator submit button not allowed after validation error -

i'm running form bootstrapvalidator. if submit form while there still validation errors (for example, forgot input 1 of fields), when finish filling form fields properly, submit button maintains "cursor: not-allowed" style got initial submission: <form id="invoice_form" class="well form-horizontal" action="submit.php" method="post" data-toggle="validator""> <fieldset> ... <!-- button --> <div class="form-group"> <label class="col-md-4 control-label"></label> <div class="col-md-4" style="text-align: left;"> <button type="submit" class="btn btn-primary" > send <span class="glyphicon glyphicon-send"></span></button> </div> </div> </fieldset> </form> thanks, david edit:

python - how to modify peter norvig spell checker to get more number of suggestions per word -

i tried peter norvig code spellchecker on http://norvig.com/spell-correct.html how modify more number of suggestions instead of 1 correct spelling import re collections import counter def words(text): return re.findall(r'\w+', text.lower()) words = counter(words(open('big.txt').read())) def p(word, n=sum(words.values())): "probability of `word`." return words[word] / n def correction(word): "most probable spelling correction word." return max(candidates(word), key=p) def candidates(word): "generate possible spelling corrections word." return (known([word]) or known(edits1(word)) or known(edits2(word)) or [word]) def known(words): "the subset of `words` appear in dictionary of words." return set(w w in words if w in words) def edits1(word): "all edits 1 edit away `word`." letters = 'abcdefghijklmnopqrstuvwxyz' splits = [(word[:i]

r - How to use dplyr to find unique entries in the previous rows -

i have long dataframe, more or less following structure: df <- data.frame( dates = c("2011-10-01","2011-10-01","2011-10-01","2011-10-02","2011-10-03","2011-10-05","2011-10-06","2011-10-06"), ids = c("a","a","b","c","d","a","e","d"), values = c(10,1,25,2,5,10,4,1)) > df dates ids values 1 2011-10-01 10 2 2011-10-01 1 3 2011-10-01 b 25 4 2011-10-02 c 2 5 2011-10-03 d 5 6 2011-10-05 10 7 2011-10-06 e 4 8 2011-10-06 d 1 i following output: dates unique_ids sum_values 1 2011-10-01 2 36 2 2011-10-02 3 38 3 2011-10-03 4 43 4 2011-10-04 4 43 5 2011-10-05 4 53 6 2011-10-06 5 58 i.e. each date unique_ids gives number of unique ids correspon

java - How to make logger.trace() and logger.info() work together -

i have issue logging trace function in distinct file info function, prepared classic log4j.xml file containing required configuration. logger.info() working. logger.trace() not working. <appender name="file" class="org.apache.log4j.fileappender"> <param name="append" value="true" /> <param name="file" value="c:/logs/transaction.log" /> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n" /> </layout> <filter class="org.apache.log4j.varia.levelrangefilter"> <param name="levelmin" value="trace" /> <param name="levelmax" value="trace" /> <param name="acceptonmatch&quo

ios - TableViews inside ScrollView Autolayout -

Image
i trying create view contains many subviews , can contain many tableviews. need enable scroll of subviews. created scroll view , put superview. put views inside scroll have lot of problems putting tableviews inside scroll using autolayout. dont want scroll inside tableviews, need enable clicks each tableview create. listen of suggestions how can create view. a scrollview inside of scrollview hard handle. maybe it's worth redesign data model combine contents? e.g. (assuming each table contains 2 labels) image -> row cell 0 of type or tableheader label -> row cell 1 of type b label -> row cell 2 of type b label -> row cell 3 of type b label -> row cell 4 of type b table 1 label 1 -> row cell 5 of type c table 1 label 2 -> row cell 6 of type c label -> row cell 7 of type b table 2 label 1 -> row cell 8 of type c table 2 label 2 -> row cell 9 of type c label -> row cell 10 of type b table 3 label 1 -> row cell 11 of

Add subsequent plot to legend in matlab -

Image
i doing iterative process create figure, add plot , append legend item. doing series of commands have collected in script below. please note cannot script since actual plotting depends on external processes must physically iterate since have no control on them. >> x = [0:1:10] >> y1 = [] >> y2 = [] >> y3 = [] >> figure >> hold on >> = 1:size(x,2) y1(i) = x(i)^2 end >> plot(x,y1,'b') >> legend('x^2') >> = 1:size(x,2) y2(i) = 2*x(i)^2 end >> plot(x,y2,'r') >> legend('2*x^2') >> = 1:size(x,2) y3(i) = 3*x(i)^2 end >> plot(x,y3,'g') >> legend('3*x^2') as expected creates plot 3 functions of interest legend containing last item. not happy since when series of commands must each time create new legend old items new ones. achieve desired result commands must modified follows >> x = [0:1:10] >> y1 = [] >> y2 = []

design - In chain of responsibility, why a sub class has to come back to its predecessor? -

to make question better, lets have example. suppose have base class base , 3 derived classes named: derived1 , derived2 , , derived3 . so per chain of responsibility pattern, if derived1 not able handle request, pass request base , base send request derived2 , on. my question : why derived1 have pass request base ? instead, can directly pass derived2 , on? can derived1 try handle request , if not pass dereved2 , if still not handled, can pass derived3 bypassing base class?

javascript - How speed up overflow auto -

i have 10000 items on page. <body> /*10000 items*/ </body> all works if items in body (on scroll not lag, because browser's scroll). but if i'am using <div> css overflow:auto on scroll it's lag. <div style="overflow:auto; height: 1000px;"> /*10000 items*/ </div> why happend , how can resolve problem?

javascript - CSS style is not applying to button in React component -

i have css stylesheet in index.html file react app loaded. in here have following css values : #webshop { background-color: white; height: 100%; width: 100%; } and #webshop, button { position: relative border: 6px solid #232323 z-index: 2 padding: 12px 22px margin: 0 10px box-sizing: border-box font-size: 26px font-weight: 600 text-transform: uppercase text-decoration: none color: #232323 } webshop located in different file contains render method: render() { return ( <div classname='webshop' id='webshop'> <li> <img src="./products.jpeg" width="350" height="350"></img> <button onclick={this.handleclick} classname="addit">add cart</button> <select id="size" onchange={this.change} value={this.st

Finding for a specific row in a 2D Array and printing it out in Java -

sorry, i'm new java. created 2d array , populated string data. task find specific row in array, filled string , print out. mean print row found. problem don't know row be. managed find row , print it, prints column along found row. possible print row not column? sorry english. public class math extends studentcharts { public math(){ math = new string [3][3]; math[0][0]="math"; math[0][1]="person1"; math[0][2]="49"; math[1][0]=math[0][0]; math[1][1]="person2"; math[1][2]="12"; math[2][0]=math[0][0]; math[2][1]="person3"; math[2][2]="31"; } public void prnt (string namechk){ int x = 0; int y = 0; (x=0; x<3; x++) { if (namechk.equals(math[x][1])) { (y=0; y<3; y++) { system.out.println(math[x][y]+" "); } } else { system.out.println("error"); } the main class: public static void main(string

java - Spring FrameworkServlet won't load Properties during Tomcat startup -

i having strange issue spring propertyplaceholderconfigurer all junit tests pass, when start tomcat, run properties initialization issue: // first root initialization, properties fine [...] info: initializing spring root webapplicationcontext 14:21:13.195 info [quartzproperties] - quartzproperties: false 0 0/30 * * * ? true 18:00 1 // second 'servlet' initialization, properties empty [...] info: initializing spring frameworkservlet 'global' 14:21:16.133 info [quartzproperties] - quartzproperties: false false ${quartz.triggertime} 0 the servlet context initialization doesn't use properties, , triggers crash of quartz library (invalid values). i see nothing wrong in configuration , don't understand what's going on: web.xlm [...] <servlet> <servlet-name>global</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup&g

Javascript replace by regex but only the first character -

i want replace spaces in string in javascript. if there price behind it. example: var before = 'porto rood / wit 4,00'; var after = 'porto rood / wit;4,00'; the regex use \s\d+,\d{2} in javascript there way replace first character of regex match ? you can use positive lookahead match whitespace before price. var before = 'porto rood / wit 4,00', after = before.replace(/\s(?=\d+,\d{2})/, ';'); console.log(after);

c# - Most efficient way to write AutoMapper code? -

i gave automapper shot, , once got working it's absolutely fantastic. issue actual code have write setup automapper kind of gross, , i'm wondering if way i'm doing can improved upon or simplified. i'm using (in following example) convert entity viewmodel. field names entirely different, have manually create mapping (afaik) public static class automapperconfig { public static void registermappings() { mapper.initialize(cfg => { cfg.createmap<customer_master, customerviewmodel>() .formember (dst => dst.firstname, src => src.mapfrom(e => e.cm_firstname)) .formember (dst => dst.lastname, src => src.mapfrom(e => e.cm_lastname)) .formember (dst => dst.id, src => src.mapfrom(e => e.cm_id)) .formember (dst => dst.address1, src => src.mapfrom(e => e.cm_address1)) .formemb

javascript - How to add google Map marker from SQL database -

i have google map , add new marker on each element add on database (with latitude , longitude). have done isn't working. helping. <?php $reponse = $bdd->query('select * zdou order id '); while ($donnees = $reponse->fetch()){ ?> <p> <strong>latitude</strong> : <?php echo $donnees['latitude']; ?><br/> <strong>longitude</strong> : <?php echo $donnees['longitude']; ?><br/> </p> <?php $latitude = $donnees['latitude']; $longitude = $donnees['longitude']; ?> <script> latitude = <?php echo $latitude ?>; longitude = <?php echo $longitude ?>; marker = new google.maps.latlng(latitude, longitude); var placermarker = new google.maps.marker({position:marker,map:map,title:"zdou"}); </script

python - SVG Elements: Able to locate elements using xpath but not able to click -

i interacting svg elements in web page. able locate svg elements xpath, not able click it, error mentions methods click(), onclick() not available. any suggestions of how can make clickable ? please advice ? try make use of actions or robot class

javascript - Retrieve JSON object from Google Sheets using Sheetrock.js -

i using sheetrock.js allow me query public google spreadsheet. works , populating html table data returning. using so: $('#spreadsheet').sheetrock({ url: myspreadsheet, query: "select b,y,ad order ab asc", labels: ['name', 'levels skipped', 'time'], fetchsize: 10 }); instead of using data populate table want data json can use in javascript code not know how so.

html - Alert or Console.log not working from dynamically loaded JavaScript -

i use following function dynamically load javascript: function loadjs(file, c) { var jsel = document.createelement("script"); jsel.type = "application/javascript"; jsel.src = file; jsel.async = false; document.body.appendchild(jsel); if (c) { jsel.addeventlistener('load', function (e) { c(null, e); }, false); } document.getelementsbytagname("head")[0].appendchild(jsel); } below 1 of functions contained within dynamically added file: function formelements_select_add(x) { console.log("add"); alert("add"); var id = x[1]; var value = x[2]; var index = x[3]; var select = document.getelementbyid(id); var option; option = document.createelement("option"); option.text = value; select.add(option, index); } i know javascript file gets added correctly , function gets executed because option added select element. why alert , console.log not execute

java - How to change getRealPath("/") path from .metadata to WEB-INF -

i uploading image files application, want save them in web-inf, eclipse saving in .metadata folder .metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps . please let me know can path web-inf3 @requestmapping(value = "/admin/productinventory/addproduct", method = requestmethod.post) public string addproduct(@modelattribute("product") product product,httpservletrequest request) {//httservlet- aswe need use toget thesessionpath productdao.addproduct(product); /////add image multipartfile productimage= product.getproductimage(); string rootdirectory= request.getsession().getservletcontext().getrealpath("/"); //c:\users\avinash kharche\ecommerce_spring_neon\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\emusicstore\ path =paths.get(rootdirectory + "\\web-inf\\resources\\images\\" + product.getproductid()+".png"); //path =paths.get("c:\\users\\avinash kharche\\ecommerce_spring_neon

c# - How to create annotation using PdfSharp to highlight text of existing PDF -

i know whether possible create text highlight annotation in existing pdf using pdfsharp? in pdfsharp documentation , see examples of pdftextannotation & pdfrubberstampannotation , did not find sample code following annotations mentioned in documentation. pdflineannotation, pdfsquareannotation, pdfcircleannotation, pdfmarkupannotation, pdfhighlightannotation, pdfunderlineannotation, pdfsquigglyannotation, pdfsoundannotation, pdfmovieannotation. are these annotations yet implemented in pdfsharp? if has implemented, please point me code samples.

java - Collision Detection algorithm -

Image
this algorithm i'm trying solve: there n circular organisms radii r0,r1,..rn-1 . during each second, 2 organisms radii ri , rj , (chosen randomly , equiprobably) collide form new, bigger organism radius ri+rj. enter image description here given radii n creatures , integer,k, print single floating-point number denoting expected total area of creatures after k seconds. input format the first line contains 2 space-separated integers describing respective values of n , k. second line contains n space-separated integers describing respective values of r0,r1,..rn-1 constraints 1 < n < 10^5 0< k < n-1 1 < ri < 10^4 an answer considered correct if has relative error of @ 10^-9. output format print single floating-point number denoting expected sum of creatures' areas after k collisions. sample input 0 3 1 1 2 3 sample output 0 67.0206432766 sample input 1 3 2 1 2 3 sample output 1 113.0973355292 explanation 1 we have

android - How to launch task shortcut from resolve info? -

i have gotten list of shortcuts using: packagemanager.queryintentactivities(new intent(intent.action_create_shortcut), packagemanager.match_all); and have list of tasks shown user. once 1 clicked use try launch activity: resolveinfo info = adapter.getitem(position); componentname name = new componentname(info.activityinfo.applicationinfo.packagename, info.activityinfo.name); intent intent = new intent(intent.action_main, null); intent.addcategory(intent.category_launcher); intent.setcomponent(name); intent.setflags(intent.flag_activity_new_task); startactivityforresult(intent, 8); and launches shortcut shortcut instantly closes result result_canceled. have no idea why close unless action wrong (i tried using intent.action_create_shortcut ). :d

Cross compile cocos2d-x game -

i develop , build cocos2d-x game (using lua) on linux , want build windows version in place, when set -p win32 says, linux , android , tizen build aviable. have installed required packages cross compiling. cross building cocos2d-x aviable now, if not, planned in future?

multiple columns - Trying to add white space vertically between cols in a row - Bootstrap 4 -

i'm running issue here. i've used background images in each of 8 columns in row , need add white space between them. i've created 2 classes here , should work, wrong. also, i've used in past project , both thin-gutters , waffle used in row element, waffle works on child element of col. here's code... <div id="products"> <div class="container-fluid"> <div class="row thin-gutters text-center"> <div class="col-12 col-md-6 col-xl-3 product-images waffle ceramic-tile"> <h2 class="product-title"><a href="#">ceramic tile</a></h2> </div> <div class="col-12 col-md-6 col-xl-3 product-images waffle carpet"> <h2 class="product-title"><a href="#"> carpet</a></h2> </div> <div class="col-12 col-md-6 col-xl-3 product-image

java - What is the preferred way to complete this while loop for desired output? -

i have written little program takes name of email sender looking @ email address , returning letters @ character. i have written while loop in 2 ways, 1 way primes loop , second uses nested if statement. both each other or 1 preferred method on other? priming while loop: public void findusername() { scanner keyboard = new scanner(system.in); char symbol = ' '; system.out.println("please enter email!"); symbol = keyboard.findwithinhorizon(".", 0).charat(0); while (symbol != '@') { system.out.print(symbol); symbol = keyboard.findwithinhorizon(".", 0).charat(0); } system.out.println(); } using nested if statement break if symbol == '@' public void findusername() { scanner keyboard = new scanner(system.in); char symbol = ' '; system.out.println("please enter email!"); while (symbol != '@') { symbol = keyboard.findwithinhorizo

android - NestedScrollView scrollbar width doesn't change -

i getting around adding scrollbars (those ux guys, sheesh) nestedscrollview, can't width of scrollbars change 5dp (eyeball measurement). i have style: <style name="nestedscrollbarstyle"> <item name="android:scrollbarfadeduration">500</item> <item name="android:scrollbars">vertical</item> <item name="android:scrollbarstyle">insideinset</item> <item name="android:scrollbarsize">160dp</item> </style> and, inside coordinatorlayout, have swiperefreshlayout nestedscrollview: <android.support.v4.widget.swiperefreshlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/refresh_container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" > <android.support.v4.widget.

c# - System.DirectoryServices.AccountManagement.dll issue with ASp.net mvc application -

relatively new deploying asp.net mvc application. have made change in project reading email using: var user = system.directoryservices.accountmanagement.userprincipal.current.emailaddress; i referencing dll c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5.1\system.directoryservices.accountmanagement.dll i deploy application right click , publish. when run project on local machine current email in user variable works fine. after deploy test server, user variable come null. also observed bin folder not contain "system.directoryservices.accountmanagement.dll" what doing wrong here? pointers? appreciate help.

bash - OSMC start from terminal (Raspberry Pi) -

i have bash script i'd run visually on terminal (there user interaction) before osmc gui starts up. script connects vpn, checks updates etc, , if vpn info looks correct, asks user if they'd proceed startup.. basically, need terminal automatically launch raspberry pi powered on. (i know how terminal once gui has started, pressing exc after exit, not i'm asking). i've added script rc.local file. runs script in background, not want in case. i feel should simple solution, can't seem find info on how osmc.

add jar file as reference to c# console application(no ikvm) -

need execute jar file c# console parameters have written following code public void updateresults( string runname, int tcid, string teststatus, int almtestid) { { string filename = "d:\\restapi"; string almhost = configurationmanager.appsettings.get("almhost"); string almport = configurationmanager.appsettings.get("port"); string almdomain = configurationmanager.appsettings.get("domain"); string almproject = configurationmanager.appsettings.get("project"); string username = configurationmanager.appsettings.get("username"); string password = configurationmanager.appsettings.get("password"); string testtype = configurationmanager.appsettings.get("testtype"); string owner = configurationmanager.appsettings.get("owner");

inputstream - Java Scanner doesn't read all the inputs -

i have input 1000002 lines. first line has 2 number n, q. there n number 1 n in next line , q lines after second line. in input, n 100000 , q 1000000. when try read inputs java code, paste stdin although last input copied, code doesn't reach end , seems didn't read inputs. here code: import java.util.scanner; import java.util.list; import java.util.arraylist; import java.lang.*; import java.io.*; public class test { public static void main(string[] args) { int n; int q; scanner s = new scanner(system.in); n = s.nextint(); q = s.nextint(); (int = 0; < n; i++) { int id = s.nextint(); } for(int = 0; < q; i++) { int nodex = s.nextint(); int nodey = s.nextint(); } s.close(); system.out.println("done"); } } here input file 12 mb :) input.txt also when try print know number of read inputs, last 950000. so what's wron

javascript - Cascading the convert function for a nested model in ExtJS 5 -

i have grid i'd fill translatable strings in extjs 5. in past i've translated strings using convert method, in case need translations in nested model , convert method firing @ top level. ideas on making cascade? ext.define('application.model.messageconfig', { extend : "application.model.base", fields: [ { name: 'messagetype', reference: 'messagetype', unique: true }, { name: 'subscribedapp', type: 'boolean' }, { name: 'subscribedemail', type: 'boolean' } ] }); ext.define('application.model.messagetype', { extend : "application.model.base", mixins: [ 'elsevier.localization.translate.util' ], constructor: function(){ this.inittranslate(); this.callparent(arguments); }, fields: [ { name: 'messagetypeid', type: 'int' }, { name: 'status

javascript - How can I refresh a page after form submit? -

this question has answer here: how make redirect in php? 21 answers hi can me on issue, please post whole code because noob in coding , allready lost many hours searching right answer. if want vote game see "spielbewertung" on page http://www.spielonline.ch/spiel.php/kogama-ostry.html page loads iframe nickolodeonspelheader.php page spiel.php after voting , url looks http://www.spielonline.ch/ nickelodeonspelheader.php /kogama-ostry.html offcourse wrong should change data in database after input , come on original parent page game can played after voting. form code: <table style="display: inline-block;"><tr> <td class="top" colspan="1" width="100%"><h2>spielbewertung</h2></td></tr> <tr><td width="50%" style="align:left;"> <form na

amazon web services - Chef Server 12 Self signed Certificate is not working with ELB -

i have installed open source chef in chef server12 in rhel 7, part of configuration chef12 created self-signed certificate need high availability keeping server under elb have copied self-signed certificate elb not working, nodes throwing error ssl certificate verification failed, have copied certificate nodes in trusted certificate,also created multi-domain certificate elb , chef-server name still no luck .

python - Two text files with 1,096 individual decimal numbers - subtract each of the elements and total the sum -

i have 2 text files contain 1,096 values (these features extracted neural network layer). i want take first element of the first text file , subtract first element of second text file , on through 1,096 decimal values. i want take sum of these subtractions , store in variable later use. i new python i'm unsure best way access each element - aiming method similar euclidean distance method. assuming files 1.txt , 2.txt import decimal dc open('1.txt','rb') fin1, open('2.txt','rb') fin2: sub_sum = 0 x,y in zip(fin1,fin2): sub_sum += dc.decimal(x) - dc.decimal(y)

java - OpenGL only 1 triangle is drawn -

i relatively new @ opengl lwjgl stuff, , have thoroughly checked code, 1 triangle drawn, despite me putting in coords 2. prove point, 6 points drawn gl_points. main.scala import org.lwjgl._ import org.lwjgl.glfw.callbacks._ import org.lwjgl.glfw.glfw._ import org.lwjgl.opengl.gl11._ import org.lwjgl.system.memoryutil._ class main { import org.lwjgl.glfw.glfwerrorcallback import org.lwjgl.opengl.gl private var window = 0l def run(): unit = { system.out.println("version: " + version.getversion + "!") init() run_loop() glfwfreecallbacks(window) glfwdestroywindow(window) glfwterminate() glfwseterrorcallback(null).free() } private def init() = { glfwerrorcallback.createprint(system.err).set if (!glfwinit) throw new illegalstateexception("unable initialize glfw") glfwdefaultwindowhints() glfwwindowhint(glfw_visible, glfw_false) glfwwindowhint(glfw_resizable, glfw_true) window = gl

Can't execute a java code from command line -

hello jdk installed in:d:\java on computer path : d:\oracle\product\10.2.0\db_1\bin;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;c:\program files (x86)\apache-maven\bin;c:\program files (x86)\apache-tomcat\bin;c:\program files (x86)\skype\phone\;d:\java\bin;d:\jboss-as-7.1.3.final\bin;c:\program files\tortoisesvn\bin;e:\formation\essais\maven\apache-maven-3.5.0-bin\apache-maven-3.5.0\bin my java_home :d:\java little program in :e:\zoo.java my program completely: public class zoo { public static void main(string[] args) { system.out.println("hello"); } } in command prompt type : javac zoo.java i don't "hello": please know why , do compile javac zoo.java , run java zoo . comments :- please there way compile , run @ once? no , java both compiled , interpreted.

angular ui router - Angularjs 1.x -- UIRouter Path /XYZ vs /#!/XYZ -

i trying create path variable @ top level. eg: website.com/xyz123 xyz123 account code. how can in angular app? my config below: $urlrouterprovider.otherwise('/'); .state ('/', { url: '/', templateurl: 'views/landing.html', controller: 'landingctrl', authenticate: false }).state ('signin', { url: '/{accountcode:[0-9a-z]{6}}', templateurl: 'views/student/signin.html', controller: 'studentsigninctrl', authenticate: false }) website.com/#!/xyz123 -- works.. can make website.com/xyz123 go angularjs spa? thanks in config block in main module, use $locationprovider turn off html5 mode , not display hash in route: // removes fragment identifier ('#') urls $locationprovider.html5mode(true); note there caveats of doing this, need make sure include <base> tag in main (index) html file:

c# - NHibernate fetching nested collections -

i'm rookie in nhibernate. i have problem nested collections. objects structure : product-> collection->item->collecion -> item i need fetch data, stuck on fetching second collection. var partbase = session.query<product>() .fetch(x => x.baseuom) .fetch(x => x.category) .fetch(x => x.x) .fetch(x => x.y) .fetch(x => x.z).where(x => x.id == partbaseid.id); partbase.fetchmany(x => x.parts) .thenfetch(x =>x.item) .thenfetchmany(x=> x.variables) .tofuture(); return partbase.tofuture().tolist().firstordefault(); i getting exception "cannot simultaneously fetch multiple bags" after "thenfetchmany". any suggesions ? thanks

angular2 routing - Angular 2 - Extract multiple variables from url -

i want extract multiple parameters url. suppose url www.example.com/parent-component/2/list/child-component/5/list i want extract parameters 2 , 5 the link on parent component is [routerlink]="['/loggedin','warehouse','move-request',moverequest.id, 'issued-inventory',issuedinventory.id,'list']" in respective routes file doing this {path:':move/issued-inventory',component:issueinventorycomponent, children : issued_inventory_routes} the child route file is {path:':myid/list',component:listissueinventorycomponent}, in following component want access both variables move , myid this.sub = this.activatedroute.params.subscribe((params : params) => { this.moverequestid = params['move']; }); on console moverequestid undefined doing wrong? how access variables? router version : "@angular/router": "^3.3.1" you should first retriev

flexbox - eliminate white space around css rotateY of image -

after css transform:rotatey of div have space covering area of original div (not rotated). have read layout cannot adapt after transform wondering possible solutions. read couple of entries in stackoverflow not able solve issue. (i tried display: block or inline-block or float). here fiddle have achieved: white space after image rotatey the center slide should stretch fill space between right side of previous slide , right side of next slide. , should responsive (no fixed width in px). and here code: #wrapper { width: 100%; display: flex; flex-direction: row; } .slide { height: 200px; background-image: url(http://placehold.it/600x300); background-position: center; background-size: cover; color: #fff; font-size: 20px; font-family: sans-serif; text-align: center; } .prev { width: 50%; transform: rotatey(-65deg); transform-origin: left; } .next { width: 50%; transform: rotatey(65deg); transform-origin: right; } <div id="wrapper"

javascript - How to update count of number of appended divs -

i'm building socket chat program, everytime joining chat room, badge showing number of users, should increase. code below function adds new user's name list of users. new name added div id="elementinpeople. problem badge displaying 1, though multiple users have entered chat. suggestions how can fix this? socket.on("update-people", function(people){ $("#people").empty(); $.each(people, function(clientid, name) { $people.append('<div id="elementinpeople">' + name + '</div>'); var np = $("#elementinpeople").length; $("#numberofpeopleonline").text(np); }); }); server-side: socket.on("connection", function(client) { client.on("join", function(name){ console.log("someone joined chat"); people[client.id] = name; client.emit("updatetoself", "you have c

bash - Capture run time of python script executed inside shell script -

this question has answer here: get program execution time in shell 9 answers i have bash shell script internally calling python script.i know how long python taking execute.i not allowed changes in python script. leads helpful in advance. you can use time command runtime of python script. ]$ cat time_test.bash #!/bin/bash # can use: time python script.py time python -c 'import os;os.getenv("home")' output this ]$ ./time_test.bash real 0m0.010s user 0m0.005s sys 0m0.005s

C Pointer of array of strings garbled when retreived later -

i have read lot of answers on theoretical issues memory allocation pointer arrays, have not been able fix code...so turning you. i have array of strings in struct, need write , read from. declared as: typedef struct client_mod { /* client ad_file */ char *ad_filenames[10]; /* client's current ad array index*/ unsigned int ad_index; } client; then , inside function , assign values pointer: static int get_spots (client_mod *client) { char buf[512]; file *ptr; if ((ptr = popen("php /media/cdn/getspot.php", "r")) != null) { /* read 1 byte @ time, bufsiz - 1 bytes, last byte used null termination. */ size_t byte_count = fread(buf, 1, 512 - 1, ptr); /* apply null termination read bytes can treated string. */ buf[byte_count] = 0; } (void) pclose(ptr); // parse extracted string here... int = 0; client->ad_filenames[i] = strdup(strtok(buf,"|")); while(client->ad_filenames[i]!= null && i<5) { client->ad_filenames[+

c# - ASP.NET Repeater OnItemBound -

private void bindproductsrepeater() { string cs = system.configuration.configurationmanager.connectionstrings["databaseconnectionstring"].connectionstring; using (sqlconnection con = new sqlconnection(cs)) { using (sqlcommand cmd = new sqlcommand("procbindallproducts", con)) { cmd.commandtype = commandtype.storedprocedure; using (sqldataadapter sda = new sqldataadapter(cmd)) { datatable dt = new datatable(); sda.fill(dt); rptrproducts.datasource = dt; rptrproducts.databind(); } } } } i have method bind items repeater via onitembound, works fine. display product details, title, price, image, want create function can order items price via sql command. i'm @ wits end on how this.

How to use predict function in matlab to test mutli-class SVM -

i want implement 10 fold cross-validation in multi-class svm using matlab built-in functions. i've used code this answer , replaced training function svmtrain , testing part following code: for j=1: size(testdata,1) found=0; k=1:numlabels if(svmclassify(model{k},testdata(j,:))) result(j) = k; found=1; break; end end if(found==0) %not classified result(j) = -1; end however, faced problem data not classified because svmclassify returned 0 iterations. thus, want use predict function can pick label maximum score. can please me implement it.

html - javascript loading screen until data loads -

first, i'm totally new web programming - javascript, css etc.. know html , coming background of scripting in different languages (lua, batch, shell etc..). so, point, i'm creating webpage display statistics data being generated simulator mysql db. display it, thinking if should go php, because i'm using flask , python on server side, , not support php, therefore decided display stats through javascript , jquery. so way works is, have top menu tabs, each time tab clicked should show page, in 1 of pages, can click 1 of tables rows navigate tab, problem is, tab shown before data loads tables in tab. tab function (copied somewhere on net): function opencity(evt, cityname) { var i, tabcontent, tablinks; tabcontent = document.getelementsbyclassname("tabcontent"); (i = 0; < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getelementsbyclassname("tablinks

ruby on rails - How to use local variables when calling show on an object i.e. @object.this_#{variable}? -

this question has answer here: how turn string method call? [duplicate] 3 answers is there way pass variable through instance in show partial? i'm creating service follows crud , want able iterate instanced variable. can create passing partial so: in parent view: <%= form_for(@report) |f| %> <%= render :partial => "reports/forms/partial_form", :locals => {:g => f, :var => "01"} %> <% end %> in partial view: <label><%= "enter data variable #{lane_number}" %></label> <%= g.text_field :"variable_#{var}" %> this useful variables in partial have similar-enough naming convention use same var iterate through several items. works fine. i similar when viewing input data, can't figure out how pass var instance variable. in parent view: <%= render :par

javascript - Highcharts: Custom dataGrouping approximation: dataGroups cropped by chart area -

see example custom approximation provided highcharts: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/stock/plotoptions/series-datagrouping-approximation datagrouping: { approximation: function () { return this.datagroupinfo.length; }, forced: true }, scroll selection left right. notice datagroupinfo.length increases , decreases datagroup enters , exits chart area. believe due datagroup being cropped chart area. i have attempted resolve issue setting cropthreshold infinity without success (it seems unrelated). i need create custom approximation not cropped chart area. to complicate things bit, custom approximation series[0] , average. in case, result of series[0] divided series[1] . my current attempt following: http://jsfiddle.net/rbwc217s/ approximation: function(arr) { var numerator = 0, denominator = 0; if (arr.length !== 0) { var start = this.xdata.indexof(this.processedxdata[0

vba - Error 440 "Array Index out of Bounds" -

i trying download excel attachment subject keyword. i managed create code giving error 440 "array index out of bounds" . the code got stuck in part. if items(i).class = outlook.olobjectclass.olmail here code sub attachment() dim n1 string dim en string en = cstr(environ("userprofile")) savefolder = en & "\desktop\" n1 = "mail attachment" if len(dir(savefolder & n1, vbdirectory)) = 0 mkdir (savefolder & n1) end if call test01 end sub private sub test01() dim inbox outlook.folder dim obj object dim items outlook.items dim attach object dim mailitem outlook.mailitem dim long dim filter string dim savefolder string, pathlocation string dim dateformat string dim datecreated string dim strnewfoldername string dim creation string const filetype1 string = "xlsx" const filetype2 string = "xlsm" const fi

angular - How to use SVG for inital Angular2 load -

instead of angular2's default application "loading..", svg loading spinner. possible? yes, can replace "loading..." text inside <my-app> tags in index.html file html or svg , should render content while app loads , angular takes on rendering: <my-app> <svg> <!-- svg code here...--> </svg> </my-app>

javascript - Start background process in node (loopback) -

i trying start process in loopback "archives" part of database every 5 minutes. right starting archiver bootscript schedule every 5 minutes via setinterval: // boot/start_archiver.js setinterval(function(){ console.log("starting archiver"); building_archiver.archivebuildings(); room_archiver.archiverooms(); }, 300000); // archive every 5 minutes i have feeling not correct way of doing this, seems loopback api unresponsive whenever archiver runs. how can outsource archiver call different process runs separate api? can point me in right direction or me find framework?