Posts

Showing posts from January, 2013

eclipse - Selenium- WebButton need to be clicked only once in a loop -

i writing selenium script in eclipse adding user application fetching user values excel sheet. in scenarion button "add" exist @ first user addition, once clicked textbox "add_name" appear name need added. in loop second user addition selenium "add" webelement, does'nt exists throwing error. i have used below code elements existance i'm getting below error. please me in this. code used : //click on "add new button" if(browser.findelements(by.id("ext-gen72")).size()!=0){ browser.findelement(by.id("ext-gen72")).click(); } else{ continue rest of steps.... } error:exception in thread "main" org.openqa.selenium.elementnotvisibleexception: cannot click on element (warning: server did not provide stacktrace information)

java - How can add popupMenu to items of listView in Android? -

i want show popupmenu onlongclick in android, write: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); listview = (listview) findviewbyid(r.id.listview); adapter = new myadapter(getapplicationcontext()); } @override protected void onresume() { super.onresume(); connecttodatabase(); } private void connecttodatabase() { //create database listview.setadapter(adapter); } my adapter: @override public view getview(final int position, view convertview, final viewgroup parent) { final myholder holder; if (convertview == null) { convertview = layoutinflater.inflate(r.layout.list_row, null); holder = new myholder(); holder.vocabs = (textview) convertview.findviewbyid(r.id.textviewvocabs); holder.points = (textview) convertview.findviewbyid(r.id.textviewpoints); holder.tick = (imag

php - Additional web page with flexible access control in Moodle -

in moodle 2.6 created new web page external.php , copied root folder on server. web page contains activity (my own html , javascript) must accessible participants of definite courses. have 3 courses (let's call them a, b , c) , want content of web page visible participants of , b, not participants of c. so far managed limit access isloggedin() , works fine, compromise. so question is : possible limit access web page (it not part of course , not intended be) participants of course , b, not c? this code of external.php : <?php require_once('config.php'); // open page if user logged in if (isloggedin()) { $page->set_context(get_system_context()); $page->set_pagelayout('standart'); $page->set_title("experimental page"); $page->set_heading("external"); $page->set_url($cfg->wwwroot . '/external.php'); // adding navbar $page->navbar->ignore_active(); $strhome = "impor

Access my projects details in Microsoft Project server 2013 errors? -

i have created 1 pwa(project web app) site in ms project server 2013 i created projects on it working fine, but after time when wanted access projects details page it give loop error: an error occurred while opening project. give few minutes , try again. if happens again, contact administrator. can tell cause error in ms project server 2013 web app have checked permissions in groups & categories? simple needing add "open project," "view project site" "view project schedule in project web app" , "view project summary in project center" (in categories). i have had weird permissions issues cause such loops. place start if haven't investigated.

Ionic and angularjs Cannot read property 'scrollWidth' of null -

i have following problem. have 2 same list views, directives inside (i use angularjs). 1 of them runs without issues, other 1 throws following error: typeerror: cannot read property 'scrollwidth' of null @ object.ionic.views.scroll.ionic.views.view.inherit.initialize.options.getcontentwidth (ionic.bundle.js:4081) @ ionic.views.scroll.ionic.views.view.inherit.resize (ionic.bundle.js:4835) @ ionic.views.scroll.ionic.views.view.inherit.run (ionic.bundle.js:4147) @ ionic.bundle.js:39888 @ ionic.bundle.js:21929 @ completeoutstandingrequest (ionic.bundle.js:12022) @ ionic.bundle.js:12330ionic.bundle.js:17696 (anonymous function)ionic.bundle.js:14989 $getionic.bundle.js:21932 (anonymous function)ionic.bundle.js:12022 completeoutstandingrequestionic.bundle.js:12330 (anonymous function) my code pretty long, not posting yet - if there need so, :) hint: i've tested app on phone, , seems cant scroll on error occurs. suggestions? thanks ok, figured out. didnt have d

c# - How to get available space on Storage Device -

i'm working on windows store app (windows 8.1, using vs2012), , i'm having trouble retrieving available/used space specific storage folder , retrieved storage device. clear, app meant run on desktop, , exchange files usb devices connected through storage device api. this have until now: storagefolder folder = windows.devices.portable.storagedevice.fromid(phoneid); uint64[] info = new uint64[] {}; var properties = await folder.properties.retrievepropertiesasync( new string[] { "system.freespace", "system.capacity" }); if (properties.containskey("system.freespace") && properties.containskey("system.freespace")) { info = new uint64[] { (uint64) properties["system.freespace"], (uint64) properties["system.capacity"] }; } return info; but no success, 'info' empty array. ideas? i've found out doing wrong. storagefolder object representing phone connected desktop. if 1

python - How to convert a script to UTF-8 -

i have sikuli/python script works good. since dutch have same letters in our alphabet english alphabet. now there 1 letter have not occur in alphabet, used in dutch grammar. ë. sikuli falls on becuase doesn't belong in english alphabet. have belgium custumers might use french on in future. how can make scripts @ utf-8, , not @ ascii (what seems default)? in order specify module shall include utf-8 encoding, use encoding declaration in header or footer of file, per pep 0263 : # -*- coding: utf-8 -*-

linux - Is preset dictionary is only useful for first 32 K bytes of data ? -

i wanted use preset dictionary compressor , de-compressor. read here preset dictionary helpful first 32k bytes of data , after recent 32k data used dictionary. true? missing here ? that's correct, preset dictionary used virtual input decompressor processed before actual compressed input, can use compressed codes replicate parts of it. the deflate algorithm of zlib uses window of 32 kb size refer bytes decompressed before - parts of window , byte literals can use decompression. preset dictionary initialises window, data there "shifted out" real decompressed data, first 32k bytes of data can use decreasing part of preset dictionary.

ios - AnyObject vs. Struct (Any) -

i create method projects: func print(obj: anyobject) { if let rect = obj as? cgrect { println(nsstringfromcgrect(rect)) } else if let size = obj as? cgsize { println(nsstringfromcgsize(size)) } //... } but can't because cgrect , cgsize struct s , not conform anyobject protocol . so, ideas on how done? @nkukushkin's answer correct, however, if want function behaves differently depending on whether it’s passed cgrect or cgstruct , better off overloading: func print(rect: cgrect) { println(nsstringfromcgrect(rect)) } func print(size: cgsize) { println(nsstringfromcgsize(size)) } in comparison, any both inefficient (converting structs any , back, have big impact if lot in tight loop), , non-typesafe (you can pass function, , fail @ runtime). if intention coerce both types common type , same operation on it, can create 3rd overload takes type, , have other 2 call it.

sql server - SQL with Left Join showing values that are zero -

i have sql query setup want ignore 0's in min_on_hand column, , can't seem figure out why doesn't work select sku_master.sku, sku_master.description, sku_master.min_on_hand, sku_master.max_on_hand, x.total_qty_on_hand [fci].dbo.[sku_master] left join (select sku_master.sku, sum(location_inventory.qty_on_hand) total_qty_on_hand [fci].[dbo].[location_inventory] join [fci].dbo.[sku_master] on location_inventory.sku = sku_master.sku sku_master.min_on_hand > 0 group sku_master.sku) x on sku_master.sku = x.sku; as others have mentioned in comments, filtering on min_on_hand in subquery has no effect - you'll still returned values in sku_master , won't include of data x . if move check main query not see records min_on_hand = 0 select sku_master.sku, sku_master.description, sku_master.min_on_hand, sku_master.max_

java - Use placeholders to search in postgresql -

i want search in table title containing substring (in case substring title passed getbookfortitle method). problem doesn't return anything. public void getbookfortitle(string title) { preparedstatement stm = null; resultset rs = null; try { stm = connection.preparestatement("select * books name '%?%'; "); rs = stm.executequery(); while (rs.next()) { system.out.print(rs.getint(1)); system.out.print(": "); system.out.print(rs.getstring(1)); system.out.println(rs.getboolean(3)); } } catch (sqlexception ex) { ex.printstacktrace(); } } you never bind value placeholder. placeholder should not contain % sign , single quotes. it must like: stm = connection.preparestatement("select * books name ? "); stm.setstring(

Frontend Editing in Joomla 3.4 is not working -

i have enabled: global configuration –> mouse-over edit icons for: -> module&menus global configuration –> articles -> editing layout -> show publishing options -> yes ----- , show article options , enable versions set yes. i'm logged in in front-end , back-end super user. in every acl super user frontend editing set allowed. joomla 3.4 k2 v2.6.9 purity_iii 1.1.2 ........... i still can’t edit in frontend. how enable frontend editing? articles, k2 items, menus, modules. what missing? thanks help. this functionality depending on template. have ask joomlart if manage function.

c# - Send selectedText from AutocompleteTextView Automatically - Jquery / Asp.net -

i searched lot. created autocomplete jquery citytextbox , selecteditem autocomplete textbox. split selecteditem "|" , assign string[] lines after user select autocomplete view. on code assign lines below( lines[0] citytextbox , lines[1] postcodetextbox); $('#postcodetextbox').text = $("#<%=postcodetextbox.clientid%>").val(lines[1].trim()); $('#citytextbox').text = $("#<%=citytextbox.clientid%>").val(lines[0].trim()); }); this works fine after select when click somewhere or focus ect(events define in $("#citytextbox").bind() ). happens. want send lines[0] , lines[1] text boxes automatically when select autocomplete list without click etc. can see java script code below: $(function () { $("#citytextbox").autocomplete({ source: function (request, response) { var param = { cityname: $('#ci

stm32 - Break function execution from interrupt -

i write firmware stm32. there function a() executes in main loop. need break execution of function if happens uart interrupt! possible? thanks) of course can that. canonical method create volatile flag variable accessible within scope of both irq , a() method. initialise false . when irq method wants tell a() method sets flag true. in a() method poll flag , if it's true act upon it. the fact you're asking makes me think perhaps you're making blocking call somewhere in a() , want somehow forcibly unblocked interrupt code. that's not possible. if code you'll need redesign non-blocking.

continuous integration - Jenkins does not show some builds log and failed builds in history -

we have updated our jenkins ci tool updated version number is: 1.596.1. problem is, projects, cannot see build console log. when try see log, jenkins responds 404 error page. also, when problem occurs in particular job, have examined that, failed builds not shown in build history list in job page. though see there build gerrit history, when click on job specified id, again 404 error. we using jenkins git/gerrit, , builds triggered gerrit review system. new information: jobs have problem have inconsistent timestamp problem. seems problem occurs when jenkins job triggered patchset creation/merge in gerrit review system. what may root cause problem? version we're using or other factor? this persistent problem jenkins. restart, can front page when you're authenticated, fix. visit https://yoursite/jenkins/quietdown to restart instance.

excel - Delete cell content after enter key? -

excel need delete type right after press enter possible? might easy don't know how to. yes using data need send data , delete results data in. have far: "=countif(b2;c8)" if b2 matches c8 adds 1 , need delete b2 automatically enter new value. place following event macro in worksheet code area: private sub worksheet_change(byval target range) application.enableevents = false target.clearcontents application.enableevents = true end sub because worksheet code, easy install , automatic use: right-click tab name near bottom of excel window select view code - brings vbe window paste stuff in , close vbe window if have concerns, first try on trial worksheet. if save workbook, macro saved it. if using version of excel later 2003, must save file .xlsm rather .xlsx to remove macro: bring vbe windows above clear code out close vbe window to learn more macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm

How to do times and device in mysql? -

i want take 2 values in ms devide them , *1000. select count_star exec_count, sum_timer_wait total_latency, (sum_timer_wait/count_star)*1000 'avg_latency(sec)' dbname the following working (sum_timer_wait/count_star) 'avg_latency(ms)' exec_count total_latency avg_latency(ms) 13 3282064379000 252466490692.3077 13 23618632000 1816817846.1538 1 10046560000 10046560000.0000 however when add *1000 convert seconds bad value (sum_timer_wait/count_star)*1000 'avg_latency(sec)' exec_count total_latency avg_latency(sec) 13 3282064379000 25246649069230.7692 13 23618632000 181681784615.3846 1 10046560000 1004656000000.0000 it not giving bad value rather extending values more decimal points. you can use floor nearest inetger value. try this: select count_star exec_count, sum_timer_wait total_latency, floo

regex - Pattern matching for strings independent from symbols -

i have need algorithm can find pre-defined patterns in data (which present in form of strings) independent actual symbols/characters of data , pattern. care relations between symbols, not symbols themselves. legal have different pattern symbols same symbol in data. thing pattern matching algorithm has enforce multiple occurences of same symbol in pattern preserved. give example: the pattern abca , first , last letter same. application, equivalent way write 1 2 3 1 , digits variables. data have thistextisatest . resulting algorithm should give me 2 correct matches here, text , test . because in these 2 cases, first , fourth letter same, in pattern. as second example, pattern abcd should return 12 matches (one each position in thistextisat). since no variable in pattern repeated, trivially matched everywhere. in case of text , test , because legal variables a , d of pattern map same symbol. the goal of algorithm should detect similarities in written language. imagine havin

wpf - IntelliSense for Data Binding not working -

Image
after couple of hours trying debug issue data-binding caused mistyped property in binding extension. once noticed mistake, realization if intellisense available may have not made mistake in first place. visual studio user used error/warnings when mistyping name; perhaps i'm spoiled, lack of intellisense led error. i did research , found intellisense data binding available visual studio 2013 i'm using (ultimate edition). tried creating simple wpf app following second example in blog. firstly, there appears error in second example in blog resulted compiler error. prefixing type=viewmodel:mainviewmodel attribute d: fixed compiler error, yet properties of view-model class still not showing in intellisense menu. code below , in github . mainviewmodel.cs: using system.componentmodel; using system.runtime.compilerservices; namespace intellisensefordatabinding { public class mainviewmodel : inotifypropertychanged { public mainviewmodel() {

java - Intellij show warnings a errors -

a feature in eclipse shows me errors , warnings in code (in list) also - each file there mark whether file has warnings/errors in intellij found rather challenging... intellij experts out there - is there way show warnings in list (i saw similar in messages toolbar dissapears when there no compilation errors) how can see if file has warnings without looking it's contents? thanks! also error/warning list appears when trying commit file subversion. if errors or warnings present in file, idea shows popup window review button. button opens message sub-window handy , good-looking errors/warnings list. p.s. may helpful build -> rebuild project p.s.2. see displaying warnings here: warnings in intellij idea v12

deployment - maven release:prepare with artifactory deploy substep fails -

after researching days , close suicidal tendencies here problem , really hope stupid find problem myself .... setup: windows7 / maven 3.2.3 / jdk 1.7.0_60 (64bit) / artifactory 3.5.0 problem: - mvn clean install deploy --> works - mvn release:prepare --> works - mvn release:perform fails in substep deploy (which works standalone mentioned before) - pom.xml , settings.xml (for testing took pregenerated 1 artifactory) me. attached them further down.... thnx in advance help! cheers j. log: ..... [info] [info] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ apps.hr --- [info] uploading: http://vm-local-repo.fernbach-lu.dom:8081/artifactory/libs-release-local/com/fernbach/apps.hr/0.1.4/apps.hr-0.1.4.war [info] 2/75918 kb [info] 4/75918 kb [info] 6/75918 kb [info] 8/75918 kb .... [info] 60/75918 kb [info] apr 01, 2015 4:56:30 pm org.apache.maven.wagon.providers.http.httpclient.impl.execchain.retryexec execute [info] 62/75

servlets - Null Pointer Exception on using HTTPServletRequest.authenticate in Tomcat 7 -

i have servlet based rest api. have conditionally turn on/off authentication based on path parameters. have rules stored in db. found servlet3.0 provides httpservletrequest.authenticate(), can used programmtically launch login. so, added following in web.xml <login-config> <auth-method>basic</auth-method> </login-config> and in servletfilter, have code launch login programmatically request.authenticate(response); but null pointer exception java.lang.nullpointerexception org.apache.catalina.connector.request.authenticate(request.java:2603) org.apache.catalina.connector.requestfacade.authenticate(requestfacade.java:1059) am missing configuration? appreciate help.

android - xxhdpi density added in API 16, what in <16 if I provide only xxhdpi resources? -

Image
i'm working on porting ios android, , since ios guy gave me @3x versions of graphic resources, have placed them in res/drawable-xxhdpi folder. know it's not practice not provide alternative low-res resources, according official documentation: by default, android scales bitmap drawables [...] render @ appropriate physical size on each device. example, if application provides bitmap drawables [...] medium screen density (mdpi), system scales them when on high-density screen, , scales them down when on low-density screen. now, documentation says: xxhdpi: extra-extra-high-density screens; approximately 480dpi. added in api level 16 then, question. don't give bitmap alternatives aside xxhdpi , on devices running android api <16 drawables rendered @ all? tried app on api 10 emulator, , stuff there. should be? if yes, why ?!? the answer yes, resources rendered on devices api < 16. why yes? this finding: if inside contents of output apk res

xsd - What is wrong with my XML? -

can please me below xml? <?xml version="1.0" encoding="utf-8" ?> <xs:collection-list xmlns:xs="http://www.hp.com/hpsim7.5.0.0" elementformdefault="qualified"> <xs:collection name="abc" type="system" parent="systems type"> <member name="all servers" type="query" display-status="0"default-view="tableview" hidden="false" /> </collection> </collection-list> i not sure what's wrong it. what's wrong xml is not well-formed . that is, not meet basic requirements being xml. then, per comment error indicating collection-list cannot found, xml not valid . is, not meet additional requirements specified schema. might want read more well-formed vs valid xml in general. below, each category of problems in pa

html - How to display items side by side until window width then in next row -

Image
i have list of items in angularjs scope variable. want display them in browser screen side side upto window width, in next row. this. i want padding of 5px; sides between 2 items. how using bootstrap/css. bootstrap preferred. you can giving these items display: inline-block; , padding: 5px; keep gap want. here's code need: .box { padding : 5px; display : inline-block; min-width: 100px; min-height: 50px; background-color: red; } <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> you can resize window see difference , how behave dynamically. resize result window in demo fiddle best results.

javascript - Senchat Touch 2 : how to list data inside a scrollable panel? -

i trying build layout sencha touch 2.4 app. want page : a panel a list of data another panel and want global scroll. don't want scroll on list itself. list should take height needs contains data. i created fiddle : here is . see problem, reduce height of brower window. items not visible anymore. if replace flex:1 height:'400px' , see try obtain. i tryed set size of list when painted event triggered, : listeners: { painted: function() { this.setheight(this.itemscount*(this.getitemheight()+3)); } but getitemheight return size doesn't match real size of each element. there clean way i'm trying achieve ?

java - Android Spinner GetSelection -

i work android project. small code //spinadapter custom class spinadapter fromadapter = new spinadapter(getactivity(), 0, new arraylist<cities>()); // private spinner mfrom; mfrom.setadapter(fromadapter); asynchttpclient.get(url, null, new httpresponsehandler() { @override public void onoperationsuccess(string response) { type listoftestobject = new typetoken<arraylist<cities>>() { }.gettype(); arraylist<cities> list = new gson().fromjson(response, listoftestobject); fromadapter.addall(list); cities selectionid=mfrom.getselection() } @override public void onfailure(string message) { } }); var selectionid null ? why? can me? for spinner need use getselecteditem(), not getselection() you can string getselecteditem().tostring()

angularjs - ng-show not working with ng-repeat -

i have variable set true in ng-click div underneath not displaying. i've followed this post looks doesnt work in maybe ng-repeat ? here's plunker: http://plnkr.co/edit/90g1kax9fmf2sgrs5gyk?p=preview angular.module('myappapp', []) .controller('mainctrl', function ($scope) { $scope.notes = [{ id: 1, label: 'first note', done: false, somerandom: 31431 }, { id: 2, label: 'second note', done: false }, { id: 3, label: 'finished third note', done: true }]; $scope.reach= function (id) { //the assignment below works //$scope.flag = true; alert("hello there"); }; }); <div ng-app="myappapp"> <div ng-controller="mainctrl"> <div ng-repeat="note in notes">

vba - Writing Range in excel. -

colname = split(cells(, i).address, "$")(1) lastrow = .cells(.rows.count, colname).end(xlup).row ws.("?" & lastrow).copy ws1.cells(rows.count, "a").end(xlup).offset(1, 0) i number, converted column name. need range starting number 4 eg if =1, need range("a4" & lastrow) . have lastrow , can , how make a4 dim ws worksheet dim row integer dim col integer row = 4 col = 1 range(cells(row, col), cells(lastrow, col)) ws.range(cells(row, col), cells(lastrow, col))

javascript - Equal Space between the legends in d3 -

Image
i newbie in using d3 library, trying have equal space between legends. in current stage of work -attached- not provide equal spaces. i know how able fix. here code have far: var margin = { top: 20, right: 50, bottom: 30, left: 60 }; self.drawlegends = function () { var legenddata = [{ "color": "blue", text: "normal distribution" }, { color: "green", text: " ave a" }, { color: "red", text: "ave b" }] var legends = self.svg.selectall("g legends").data(legenddata); var legendbox = legends.enter() .append("g") .attr("transform", function (d, i) { return "translate(" + parsefloat((i + 1) * (($("#chart").width() - margin.left - margin.right) / 4)) + ",-10)" }) var circles = legendbox.append("circle") .attr("r", 5) .attr(&quo

I need user's email address after successful facebook login in android using SDK 4.0 -

i have integrated latest facebook android sdk 4.0. in sdk 3.0+ user's email address retreived using user.getproperty("email") after successful login. looking corresponding command in facebook android sdk 4.0 reference links: https://developers.facebook.com/docs/facebook-login/android/v2.3#overview https://developers.facebook.com/docs/android/upgrading-4.x @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(getactivity().getapplicationcontext()); callbackmanager = callbackmanager.factory.create(); } @override public void onviewcreated(view view, @nullable bundle savedinstancestate) { super.onviewcreated(view, savedinstancestate); loginbutton = (loginbutton) view.findviewbyid(r.id.login_button); loginbutton.setreadpermissions("email", "user_likes", "user_friends"); loginbutton.setfragment(this); setfacebooklogintext(loginbutton);

content management system - Hybris CMS Cockpit - add Javascript -

i working hybris cms cockpit (only user, not admin) , have built page content slots. however trying insert javascript page. cannot see mean't add javascript , tried in-line <script> tags stripped out , turned plain text. does know if possible or have ask admin of system enable something? you can add javascript have have developer make overrides configuration files (local.properties) of environments want add javascript in. the settings are: xss.filter.rule.script_fragments= xss.filter.rule.lonely_script_tags= xss.filter.rule.lonely_script_tags2= xss.filter.rule.javascript= by doing this, system no longer strip tags :)

php - How to validate if user inserts http:// anywhere in form, display a error message? -

in form user can add urls of social sites. cannot add url http:// or https:// . if user adds http:// or https:// in form submit; form had not submitted , redirect error page. but want if user add http:// or https:// in form submit, display error message , not redirect on error page. here form process. (mysql deprecated transfer later) if(isset($_post['update_ac'])){ $web = mysql_real_escape_string($_post['web']); $fb = mysql_real_escape_string($_post['fb']); $tw = mysql_real_escape_string($_post['tw']); $gg = mysql_real_escape_string($_post['gg']); $fk = mysql_real_escape_string($_post['fk']); $rn = mysql_real_escape_string($_post['rn']); $yt = mysql_real_escape_string($_post['yt']); $ig = mysql_real_escape_string($_post['ig']); $it = mysql_real_escape_string($_post['it']); $ms = mysql_real_escape_string($_post['ms']); $pt = mysql_real_escape_string($_post['pt']); $sc = mysq

PHP - Return reference -

i m trying create function take array , create columns , values don't know how return references functions. appreciated. private function data($data) { $columns = ""; $values = array(); foreach ($data $column => $value) { $columns .= ($columns == '') ? '' : ', '; $columns .= $column; $values[$column] = &$data[$column]; } return array($columns, $values); } this function inserts data in database. /** * insert item items table. * * @param (array) $data - column => value array created in item class. */ public function insertitem($data) { $columns = ""; $values = array(); $prep = "isiisiisiiis"; /*foreach ($data $column => $value) { $columns .= ($columns == '') ? '' : ', '; $columns .= $column; $values[$column] = &$data[$column]; }*/ $thedata = $this->data($data); $a = str_repe

scala - Converting `flatMap` to `for-comprehension` with Either -

given either[string,int] : scala> val z: either[string, int] = right(100) z: either[string,int] = right(100) i can write following code flatmap : scala> z.right.flatmap(x => if(x == 100) left("foo") else right(x)) res14: scala.util.either[string,int] = left(foo) but, doing wrong for comprehension version? scala> { | <- z.right | _ <- if(a == 100) left("foo") else right(a) | } yield <console>:11: error: value map not member of product serializable scala.util.either[string,int] _ <- if(a == 100) left("foo") else right(a) ^ if(a == 100) left("foo") else right(a) either[string, int] , , not leftprojection or rightprojection , doesn't have map or flatmap . need project well: for { <- z.right _ <- (if(a == 100) left("foo") else right(a)).right } yield the difference between , one-liner one-liner equivalent

using HTML div and CSS -

so, html code <head lang="en"> <meta charset="utf-8"> <title>test</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <div> <div class="header"> <input name="1" value="1" disabled /> </div> </div> and css-file: .header { background-color: yellow; color: green } the problem have, css code isn't changing html, made quick test , put css code in html file , worked. i know that, if use "id" insead of "class" works, task not change html file my problem don't want css code in html file, possible? edit: tried online worked, seems problem of webstorm since set in html file: <link rel="stylesheet" href="style.css" type="text/css"> your style.css file must in same folder html file. also, ;

elasticsearch - Rotating logstash logs holding onto file handle. Can I force it to write to a new log? -

so have been experimenting rotating logs in logstash. created script rotate logs because logrotate undesirable in environment. said rotates logs correctly logstash still writes old file after renaming , moving file. i hesitant delete said file @ risk of causing service crash. few other posts indicated let go of file handle after few hours been days multiple renames , still writes same file. the config options offer max file size according documentation isnt supported yet. there way force logstash write new log file without restarting service?

Javascript join(), i want to join some of them in array -

in case example, have array : var myarr = ["red", "green", "blue", "yellow"]; question: how join "myarr", except "red" or 1 of them, or want join of them (example). example, becomes below: greenblueyellow advice.. you can use array.prototype.filter() var filterval = 'green'; var joinedstring = myarr.filter(function(item){ return item !== filterval; }).join(); alert(joinedstring); demo

How to get the class of a trait within an object defined in scala from within a java class? -

i have scala object similar following: object myconfig { @propertymanagersources(array("my.properties")) trait myconfigowner extends propertymanagerconfig { @key("my.key") def getsomething(): boolean } this using owner manage properties. i trying access trait within java class such: import com.bah.cr.common.config.myconfig.myconfigowner; public class myjavaclass{ myconfigowner config = propertymanagerconfig factory.create(myconfigowner.class); } however, error myconfig not exist. thanks in advance. turns out works. issue error in package of scala class.

python - How to remove matplotlib axis from multiple plots? -

i have multiple subplots cant seem remove axis of plots, 1 of them. best way this? import numpy np import matplotlib.pyplot plt array_list = [np.random.random_integers(0, i, (5,5)).astype(bool) in range(10)] count = 0 fig, axes = plt.subplots(nrows=2, ncols=5) in range(2): j in range(5): axes[i, j].imshow(array_list[count], interpolation='nearest') count += 1 plt.axis('off') plt.show() you need turn off axis each subplot. try following code , see if want. import numpy np import matplotlib.pyplot plt array_list = [np.random.random_integers(0, i, (5,5)).astype(bool) in range(10)] count = 0 fig, axes = plt.subplots(nrows=2, ncols=5) in range(2): j in range(5): axes[i, j].imshow(array_list[count], interpolation='nearest') count += 1 axes[i, j].axis('off') plt.show()

php - how to make a functionality in a layout using laravel 5 -

ok, have partial contact form in layout, , i'm trying inputted data pass full contact view form instead of submitting request via clicking submit button. in partial, has name, email, , phone input. want info populate appropriate input , remaining inputs in full contact form , rest blank waiting users input them. naturally on submit sends out. full contact form working, need partial on layout work. problem it's redirecting view that's method. myself don't idea, it's job , want. preferr not have make view. have far the layout form: {!! form::open(array('url' => 'contact_index')) !!} <div class="form-group"> {!! form::label('name:') !!} {!! form::text('name', null, ['class' => 'form-control', 'placeholder' => '', 'size' => '25']) !!} </div> <div class=&

java - Texture.setEnforcePotImages(false); cannot resolve mothed error under android studio -

i using libgdx tutorial first time under android studio. ide android studio , have setup initial gradle under android studio , tested on emulator. the tutorial says use texture.setenforcepotimages(false); since using 800x480 pixels canvas. however, error "cannot resolve method" , there no intellisense setenforcepotimages when click texture. why says that. have libraries included per tutorial. hope can help. thanks hwq that method has been removed. texture.setenforcepotimages(false) method disable libgdx's protection against issues image files did not have size of power of 2 (1, 2, 4, 8, 16, 32, 64, 128, 256 , on). protection enabled because (older) devices don't support image files don't have size of power of 2 (pot). case opengl es version 1.x. opengl es version 2.x , above restriction (and libgdx's protection) doesn't apply. of version 1.0 of libgdx support opengl es v1.x (including method) has been removed . you can use image

c++ - Understanding the Warning and Compilation Error while Initializing and Declaring Pointer Variable -

this question has answer here: declare , initialize pointer concisely (i. e. pointer int) 4 answers please @ following code snippet - int main(){ int *i_ptr = 5; printf("%d", *i_ptr); return 0; } here trying declare , initialize pointer variable i_ptr . gives me following warning while compiles fine - warning: initialization makes pointer integer without cast [enabled default] but when going execute code gives me following error - segmentation fault (core dumped) i know correct way - int n = 5; int *ptr = &n; now have questions - 1. while first code fails @ execution time why doesn't give compilation error, instead of warning? 2. can initialize , declare pointer variable - int n = 5 // both declaration , initialization of int type variable n thanks in advance. while first code

php - Symfony's documentation Implies that Multiple Type-Hinting is Possible. Why? -

i had assumed multiple type-hinting wasn't possible. however, saw constructor in symfony api documentation documentation. __construct(array $options = array(), abstractproxy|nativesessionhandler|sessionhandlerinterface|null $handler = null, metadatabag $metabag = null) for second parameter, makes seemthat multiple types possible. can explain seeing? its question, though answer not type hint in language sense. more of documentation https://github.com/symfony/symfony/blob/7c026bb33e8ca96b285402f7fe7ae27a04a74ea9/src/symfony/component/httpfoundation/session/storage/nativesessionstorage.php#l99 is defined in source, no type hint public function __construct(array $options = array(), $handler = null, metadatabag $metabag = null) https://github.com/symfony/symfony/blob/7c026bb33e8ca96b285402f7fe7ae27a04a74ea9/src/symfony/component/httpfoundation/session/storage/nativesessionstorage.php#l353 is functionality exists, checks instanceof of type hints listed in docu

javascript - D3 Update bar chart -

so i'm relatively new d3, have been trouble shooting issue few days, no luck. wondering if i'm making newbie mistake. i'm attempting create graph represents volume vs. time, , allow user update graph different date range. function updatevolumegraph(data, div) { //get data again data.foreach(function(d) { d.starttime = new date(d.starttime); d.totalvolume = d.totalvolume; }); //scale range of data again x.domain(d3.extent(data, function(d) { return d.starttime;})); y.domain([0, d3.max(data, function(d) { return d.totalvolume; })]); //select section want apply our changes var graphelement = d3.select(div).transition(); var bars = graphelement.selectall(".bar").data(data); <<< undefined //add bars bars.enter().append("rect") .attr("class", "bar") .attr("x", function(d) { return x(d.starttime); }) .attr("y", function(d) { return y(d.totalvolume); }

xcode - Signal SIGABRT in Swift using NSuserdefaults -

i'm building swift game , need set class. code works elements in class, not this. func saveinformationmember(){ var membersdefaultname = nsuserdefaults.standarduserdefaults() membersdefaultname.setvalue(globalcurrentmembers, forkey: "globalcurrentmembersdata") membersdefaultname.synchronize() } globalcurrentmembers array of member wich looks that: class member { var image = string () var name = string () var progression = int() var round = int() var level = int() var imageprogression = [uibutton]() func init(){ image = "default.png" name = "default" progression = 0 round = 0 level = 0 } thx in advance help. to save class way, member needs conform nscoding protocol.

python - django permissions and contenttypes translations -

i've been using django-modeltranslation translate models in django while. straightforward , works on apps i've been developing, all model translated content gets inserted forms final user. eg : inputs: content, content_en, content_pt, ... i have build application need translate 'built-in' model strings generated django, 'auth.permission.name' or 'contenttypes.contenttype.name' and add them translation django.po files . i came solution works fine, which uses post_migration signals create file lists of ugettext_lazy elements, new strings, new contenttype.name example, added 'django.po' dynamically , loaded database. yet, bit weird having create file ugettext calls in order register strings, didn't find way of registering , adding them dynamically django.po file, need help here's have done: 1. created app named 'tools', last 1 on installed_apps, migrations naturally last ones called. app not have models, runs