Posts

Showing posts from April, 2013

First 5 records in spotfire -

i using show/hide items in properties of barchart getting top 10 records, unfortunately table has same value more 40 records chart displaying 40 restricting top 10. want pick first 5 among 40 records. thanks in advance. not sure if understand correctly, if trying display top 10 records (regardless of agregation method or criteria) use row number (rowid) rule column , set rule type bottom 5 show top 5 records.

onsubmit javascript to reload page but does not dispplay success message in Php -

i try reload page on current page when submit form prevent multiple data insert in each refresh page. below code reload current page not display successful message after form submit successful. pleas me solve problem. html code form below:- <form action="#" method="post" onsubmit="settimeout(function () { window.location.reload(); }, 10)"> <input type="hidden" name="actionform" value="test"/> status: <input name="status" type="text" class="form-control" id=""> <label>remarks</label> <textarea name="remark" class="form-control" rows="3" placeholder="enter ..."></textarea> <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> discard</button> <button type="submit...

javascript - How to display binary image data in lightbox -

i using lightbox 2 plugin display lightbox images ( http://lokeshdhakar.com/projects/lightbox2/ ). works fine, images stored array of bytes. how can change plugin (or maybe use plugin) display binary image data rather path image? i fixed creating custom image.ashx handler in asp.net mvc app processes images.

php - Issue in building search with like query using QueryBuilder yii2 -

i trying make search query website blogs using yii2 querybuilder , there error when try execute query ->all() . here error : strtr() expects parameter 1 string, object given . , here model , controller . have no idea causing problem . controller : public function actionsearchblog() { $model = new blog(); if ($model->load(yii::$app->request->post())) { blog::searchblog($model->search); } else { return $this->render('search',['model' => $model]); } } model : public static function searchblog($search = null) { $search = new query(); $result = $search->select('id','title','blog','picture') ->from('blog') ->where(['like' , 'title' , $search]) ->orwhere(['like' , 'blog' , $search]) ->all(); echo '<pre>'; ...

ios - Converting sizeWithFont:constrainedToSize to boundingRectWidth -

so cam across 1 old ios project , following line says deprecated: cgsize stringsize = [string sizewithfont:self.stringlabel.font constrainedtosize:cgsizemake(200, 300)]; it says should use boundingrectwidth if try with cgsize stringsize = [string sizewithfont:self.stringlabel.font boundingrectwidth:cgsizemake(200, 300)]; i trying upgrade deploy target 9.0 because 1 of libs build 7.0 + thats why realy must update this. says not exists, idea doing wrong? you can try out following code. can pass dictionary of attributes while calling boundingrectwithsize. in case dictionary contain font attribute. cgrect stringsize = [string boundingrectwithsize:cgsizemake(200, 300) options:nsstringdrawinguseslinefragmentorigin attributes:@{nsfontattributename: self.stringlabel.font} context:nil]; hope helps!

How to change column count in listing page Magento2? -

i want make product listing page use 3 columns instead of 4 default columns. i've got categories on magento2 web, , products on each category. want them show 3 columns count, shows 4 default columns count, how can change plz me this. magento 2 don't have option set column count magento 1. to change 4 3 (for theme based on luma) need change css , reset image size. css code need change inside magento_catalog module, file: _listings.less and this: .media-width(@extremum, @break) when (@extremum = 'min') , (@break = @screen__l) { .products-grid .product-item { width: 100%/5 } .page-layout-1column .products-grid .product-item { width: 100%/6 } .page-layout-3columns .products-grid .product-item { width: 100%/4 } .page-products .products-grid .product-items { margin: 0; } .page-products .products-grid .product-item { width: 24.439%; margin-left: calc(~"(100% - 4 * 32.439%) / 3"); padding: 0; &:nth-child(3n+1)...

node.js - Node modules are sometimes installed in program files and sometimes in APPDATA -

i have read quite lot on topic here on so, still can't figure out. why node modules installed in c:\program files(x86)\nodejs , in c:\users\user\appdata\roaming\npm ? i understand permission problem cmd not administrator, can't install files in program files, doesn't explain several modules installed in c:\program files thanks

Problems creating android build with Telerik Appbuilder; android-support-v4.jar" already exists -

im having trouble building app through build process of telerik appbuilder. using modified version of multi imagepicker plugin wich has reference android-support-v4.jar in plugin.xml , <source-file src="src/android/library/libs/android-support-v4.jar" target-dir="libs"/> when try create build via de telerik appbuilder option gives following error , doesnt complete build. android-support-v4.jar" exists when remove reference plugin.xml , try create build again, finishes build without errors plugin not work. i've tried use plugin in cordova (5.4.1) test project , have build via cli commands. cordova can build test project with plugin , reference android support library in place. test app deploys succesfully android device via cordova run android plugin , modifications functional in test project. fyi => if remove android support library reference in plugin.xml in cordova test project entire project not build. loads of compiling e...

php - How do I remove empty <p> elements? -

i have follow regex: $html = '<p></p><p>lorem ispum...</p><p> </p><p>;nbsp</p>'; $pattern = "/<p[^>]*><\\/p[^>]*>/"; echo preg_replace($pattern, '', $html ); this removes <p> tag if it's empty, i.e. <p></p> . how remove if has other invisible copy in it, such &nbsp; ? there several possible kinds of whitespace , more possibilities "empty" (e.g., <p><em></em></p> empty? or not?). also consider possibility of having <p class="para"> or <p id="chief"> . much depends on text comes from. microsoft word output &#160; 's in circumstances (i , did unremember them -- sorry) . a reasonable possibility might use regex such #<p>(\\s|&nbsp;)*</p>#mis' match multiple empty lines. but keep in mind kind of requisite tends rapidly become unreasonable - example cl...

javascript - ng-repeat: sort by time portion of the date only -

imagine have set of data includes property that's date/time stamp. there number of days, part of date matters in case, time portion of date. how 1 use time sort collection in ng-repeat expression? require manipulation of kind prior? i'm attempting replace time stamp property using moment.js after it's populated database. angular.foreach($scope.timeslots, function (timeslot, index) { timeslot.begintime = moment(timeslot.begintime).format("hh:mm a"); timeslot.endtime = moment(timeslot.endtime).format("hh:mm a"); }); when value used in template, still takes date account when sorting. so, depending on day times added, may out of order. <tr ng-repeat="timeslot in timeslots | orderby: 'begintime'"> i've attempted add new property timeslot object entirely, sort that. unfortunately, date portion of time stamp appears carried on still. angular controller: angular.foreach($scope.timeslots, function (ti...

sql - C# SQLCommand does not write data into db -

i have following sql statement (which works if execute inside db): if exists (select * dbo.popularitypokemon dex_id = '445') update dbo.popularitypokemon set timespicked = timespicked + 1 else insert dbo.popularitypokemon (dex_id, timespicked)values('445', 1); i need code-behind. i have following 2 parameters: private const int _pickcount = 1; string dexid the dexid parameter given function call. doing standard procedure making new connection , opening works fine, possibly have syntax error when using sqlcommand: try { using (myconnection) { using (sqlcommand command = new sqlcommand()) { command.connection = myconnection; command.commandtype = commandtype.text; command.commandtext = "if exists (select * dbo.popularitypokemon dex_id = @dex_id) update dbo.popularitypokemon set timespicked = timespicked + @pickcount" + "else" + "ins...

css - Text on the label Not sliding with when clicked -

i have accordion slider. have problem slider label text, not sliding when clicked. here url site. css text: .accordion label h7{ position: absolute; cursor:pointer; display: block; -webkit-backface-visibility: hidden; /* fixes chrome bug */ -webkit-transform: translatex(-100%) rotate(-90deg); -webkit-transform-origin: right top; -moz-transform: translatex(-100%) rotate(-90deg); -moz-transform-origin: right top; -o-transform: translatex(-100%) rotate(-90deg); -o-transform-origin: right top; transform: translatex(-100%) rotate(-90deg); transform-origin: right top; } what missing? way make slider auto slider seconds lag? the problem .accordion label h7 set position:absolute . if remove you'll notice text begins slide. a fix found resulting bunched text set width .accordion label h7 . .accordion label h7 { width: 200px; }

How to move the mouse on canvas to draw, using selenium webdriver -

i want automate drawing on canvas element. have written test case & passes. but in code, have written function select drawing tool & draw simple line on canvas. end drawing tool selected line not drawn. below code- public void drawline() { wait.until(expectedconditions.elementtobeclickable(anotate_draw)); action.click(anotate_draw).perform(); action.clickandhold(canvas_page1) .movebyoffset(420, 280) .movebyoffset(550,300) .release().build().perform(); } you have answered yourself. may work also: webelement element = driver.findelement(by.xpath("your xpath")); // canvas element actions builder = new actions(driver); action drawaction = builder.movetoelement(element,50,50) // start point .click() .movebyoffset(100, 60) // second point .doubleclick() .build(); drawaction.perform();

android - show video Tile in exoplayer -

Image
how can show video tile(thumbnail) instead of it's name in exoplayer? this code use , , it's result : public class samplechooseractivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.sample_chooser_activity); listview samplelist = (listview) findviewbyid(r.id.sample_list); final sampleadapter sampleadapter = new sampleadapter(this); sampleadapter.add(new header("local videos")); sampleadapter.addall((object[]) samples.local_videos); samplelist.setadapter(sampleadapter); samplelist.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { object item = sampleadapter.getitem(position); if (item instanceof samples.sample) { onsampleselected((samples.sample) item); } } }); } private ...

javascript - How do I collapse a user-topic network graph to a user-user graph? -

Image
i have d3 force directed graph shows user-topic relationship. want collapse user-user graph. node data looks this: [{ "id": "user", "type": "u", }, { "id": "user", "type": "u", }, { "id": "user", "type": "u", }, { "id": "topic", "type": "t", }, { "id": "topic", "type": "t", }] and edges data looks this: [{ "source": "topic", "target": "user", "score": 5 }, { "source": "topic", "target": "user", "score": 48 }] how go collapsing graph? i've had task before, more warning of potential pitfalls answer, might useful , won't fit in comment. the main point need build new set of edges, there's non-tr...

php - Inserting data from an XML file into table -

i trying data xml file on web datbase can use it. i have produced following code, been long time since have done coding, imlost error message getting. the error "unknown column '10074' in 'field list'". 10074 produce id of first item in xml file. any pointers useful doing head in! the code have follows: <?php $products = simplexml_load_file('http://atsdistribution.co.uk/feeds/xml_all_products.aspx'); $con = mysql_connect(details); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("catflaps_products", $con); foreach($products->product $product) { $productid = $product->productid; $name = $product->name; $dropshipprice = $product->dropshipprice; $srp = $product->srp; $brand = $product->brand; $xline = $product->xline; $instock = $product->instock; $stock = $product->stock; $barcode = $product->barcode; $weight = $product->weight; $categoryid = ...

How to pass input parameters to spring ReST web service avoiding SQL injection -

i'm creating spring rest application & passing input paramaters service using "wiztools.org restclient 3.2.2" follows { "user_id": 23, "user_email_id": "a@a.com", "user_password": "fdsdsdf", "firstname": "select * user user_email_id = 'anything' or 'x'='x'", "lastname": "sadffsd", "mobile_number": "1414141414", "user_status": 1, "isdeleted": 0, "created_by": 1, "profile_picturename": "kfksdjfhksjd", "address": "sfdsdfsd" } here first name want make sure sql injection should not injected along input parameters provide safety user. can anybudy suggest me suggestion same thanks in advance

Visual Studio 2012 C# Form application using log(base 10) function -

i'm writing program in visual studio 2012 c# form application. want use log(base 10) in calculation after button clicked. saw code , wrote in program giving me error. getting wrong? public static decimal log10( decimal value ) you need implement function , not declare it: public static decimal log10(decimal value) { return math.log10((double)value); } well, can see there's such function built .net framework: math.log10 . don't need reinvent wheel, use it.

c# - Ping.SendAsyncCancel hangs task -

i'm using ping class ping few hosts periodically. if time next ping comes, previous ping not completed yet, call sendasynccancel terminate it. problem appears if disable network interface. in case, asyncronous callback never called , call sendasynccancel never returns. some more info: i'm using .net 3.5 , c# vs2008 express on windows 7 x64. call pings form's timer.tick callback. create ping class once each host (3 hosts in total, same 1 host). timeout 5 seconds. problem 100% repeatable. all found problem ping crash on multiple create/destroy ping classes, not case. using system; using system.net.networkinformation; using system.windows.forms; namespace testping { public partial class form1 : form { private ping pinger; public form1() { initializecomponent(); pinger = new ping(); pinger.pingcompleted += new pingcompletedeventhandler(pingcompletedcallback); } private void pin...

java - JavaFX - Draw Popup where mouse is? -

Image
i have following class extends popup : package application; import java.io.file; import java.util.hashmap; import java.util.map; import javafx.animation.keyframe; import javafx.animation.keyvalue; import javafx.animation.timeline; import javafx.beans.property.booleanproperty; import javafx.beans.property.readonlybooleanproperty; import javafx.beans.property.simplebooleanproperty; import javafx.collections.observablelist; import javafx.geometry.insets; import javafx.geometry.pos; import javafx.scene.node; import javafx.scene.control.label; import javafx.scene.image.image; import javafx.scene.image.imageview; import javafx.scene.layout.vbox; import javafx.scene.paint.color; import javafx.stage.popup; import javafx.util.duration; import logic.item; import logic.itemquality; import logic.manager; /** * frame displays item, ideally used * when user hovers on given element. * frame's labels made * diablo 2-esque ends creating nice * looking frame fades in , out on use. * ...

Clojure - protocols/multimethods overflow -

in order better understand clojure protocols, asking myself if act cond . instance function may overflow : (defn my-cond [n] (cond (< n 0) (my-cond (inc n)) (> n 0) (my-cond (dec n)) :else "zero")) > (my-cond 3) ;; "zero" > (my-cond 99999999) ;; java.lang.stackoverflowerror for instance, let's use protocol make equivalent (ie. recursive protocol call). change in way way stack blow ? my intuition says no (how be), (1) have no understanding of protocol internals , (2) since make code less coupled, makes easier introduce kind of loop , make sense able prevent it. do protocols , multimethods use stack in same way normal method calls ? yes; functions, methods, multimethods , protocols push context onto stack. protocols differ function call conditional or multimethod because protocol exposes single dispatch on type, , jvm fast @ that. types make protocols usable java in ways dynamic function not. yes semantically sam...

unix - How to use <unistd.h> library in visual stdio? -

i faced os experiment develop unix shell. in order create new process, have use fork() function. however, fork() function defined in <unistd.h> , , can not use in microsoft visual studio. there way solve this? if using visual studio, means targetting windows...? fork() not part of windows api, must find way create new process: directly use windows api: createprocess use cross-platform library (that call createprocess on windows , fork on linux. have @ boost.process instance (but there's others, qt's qprocess i personnaly recommand second approach (i use boost.process ).

Python Mysql issue with %s for the table -

question why %s escape sequence not work in python script mysql package? background , code i have issue following line: cursor.execute("""insert `%s` (date, counter_in, counter_out, interface_name) values (current_timestamp, %s, %s, %s)""", (equipment, in_octets, out_octets, interface)) i following error message : traceback (most recent call last): file "snmp_query.py", line 41, in <module> cursor.execute("""insert `%s` (date, counter_in, counter_out, interface_name) values (current_timestamp, %s, %s, %s)""", (equipment, in_octets, out_octets, interface)) file "/usr/lib/pymodules/python2.6/mysqldb/cursors.py", line 166, in execute self.errorhandler(self, exc, value) file "/usr/lib/pymodules/python2.6/mysqldb/connections.py", line 35, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.programmingerror: (1146, "table 'sipartech....

javascript - How do I extract a portion of an image in canvas and use it as background image for a div? -

this how code looks: document.addeventlistener('domcontentloaded', function () { var canvas = document.queryselector('canvas'); var ctx = canvas.getcontext("2d"); var imagedata = ctx.getimagedata(0, 0, 300, 300); var tile = { 'id': 1, 'data': imagedata, 'dataurl': imagedata.todataurl() }; var div = document.createelement('div'); div.classlist.add('tile'); grid.appendchild(div); div.style.backgroundimage = ('url(' + tile.dataurl + ')'); }); i'm trying extract portion of image on canvas, (0,0) height , width 300px, , convert imagedata object dataurl used background of div. i error: imagedata.todataurl() not function. how can achieve this? thanks in advance! todataurl htmlcanvaselement method have call ca...

java - Android Volley - Getting No Response using StringRequest to XML API -

i no response when request string xml api . here's code : string url = "http://www.w3schools.com/xml/note.xml" string url2 = "http://api.json.request" requestqueue queue = volley.newrequestqueue(context); stringrequest stringrequest = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string _response) { log.d("json=>",_response); res = _response; } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { // error handling log.d("jsone=>", error.tostring()); } }); queue.add(stringrequest); i have tested using google api (url2) , it's fine. maybe android volley run slow when try response, seeing log didnt @ all. the log when initiate request : 01-28 10:57:05.253 21424-21424/com.merahjambutech.zuki.deteksi i/...

python - Output of neurons in Multiple Layer Perceprton Classifier in scikit-learn -

i working on mlpclassifier of neural_network package of sklearn. i trained classifier , predicting/running fine. need output values of neurons(nodes) in each layers when predicts class particular input after training , visualisation purposes. i read api , there attribute - coefs_ returns weight matrix of network couldn't find method or attribute return output of neurons. so being not mentioned in documentation, suppose not possible directly. there way/tweaking available these output of neurons @ each layer or alternatively direct method of visualisation of mlpclassifier. note - mlpclassifier not available in stable version of scikit-learn , 0.18 dev version only. i using python 2.7 , scikit-learn 0.18 dev version. output of neurons makes sense if have inputs. it's not intrinsic part of model. take inner product of inputs weights "outputs".

magento - Changes to CSS and JavaScript applies only after deploying static content -

i installed magento 2 magento site. have activated developer mode by {project directory}>php bin/magento setup:mode:set developer then have installed custom theme , deployed static content by {project directory}>php bin/magento setup:static-content:deploy my problem have delete pub/static directory , deploy static content every time apply css , javacript changes. static content deploy process slow , taking time frustrating. develop , have deploy change appeared. small change. flushing cache not helping. appreciated. in advance. the grunt jobs should enough run when change css. so can run: grunt exec grunt less or specified theme name: grunt exec:theme_name grunt less:theme_name check in database in core_config_data table , disable minify fields magento doesn't minify css / js while develop. can use sql query disable fields: update core_config_data set value=0 path in ('dev/css/minify_files', 'dev/css/merge_css_files', 'de...

jpa - can not generate entities from table in eclipse with foreign key (sql server) -

Image
i can not generate entities table in eclipse foreign key. usingsql server. here schema of tables: there's foreigne key between pointage.id , pause.idpointage. geration fails when try generate 2 tables. pointage generated not pause. in le last screen of generation pause table empty (no column). fails when import pause works when delete foreign key. i can see error in workspace log: org.apache.velocity.exception.methodinvocationexception: invocation of method 'getimportstatements' in class org.eclipse.jpt.jpa.gen.internal.ormgentable threw exception java.lang.illegalstateexception: pause.fk_pause_pointage - mismatched sizes: 0 vs. 1 @ main.java.vm[7,9] @ org.apache.velocity.runtime.parser.node.astidentifier.execute(astidentifier.java:205) @ org.apache.velocity.runtime.parser.node.astreference.execute(astreference.java:203) @ org.apache.velocity.runtime.parser.node.astreference.render(astreference.java:294) @ org.apache.velocity.runtime.parser.node.simplenode.rende...

apache - Htaccess - Check if file exists after url rewriting -

i've created rule: rewritecond %{request_filename} !-f rewriterule ^([a-za-z0-9_-]+)/account/(.*)$ accounts/$1/$2 [nc,l] to point address this: example.com/john/account/img/1.jpg example.com/accounts/john/img/1.jpg , works. i know how make rule if url phisical file not exists. but want, after rule, set folder default images (or other file types). referring example, want show image example.com/default/img/1.jpg (or directly example.com/img/1.jpg ) if image not exists in "john" folder ( example.com/accounts/john/img/1.jpg ). how can do? try these rules: # image doesn't exist in /accounts/john/<img> rewritecond %{request_filename} !-f rewritecond %{document_root}/accounts/$1/$2 !-f rewriterule ^([\w-]+)/account/(.+)$ default/$2 [nc,l] rewritecond %{request_filename} !-f rewritecond %{document_root}/accounts/$1/$2 -f rewriterule ^([\w-]+)/account/(.+)$ accounts/$1/$2 [nc,l]

Drupal 8 views ui : filter on custom field -

i m pretty new d8 , m trying following thing : i have content type : movie. in content type have custom field api_id wich integer. when on movie page want display under content block movies same api_id. i have managed create block same movies same author can't figure out how to filter on api_id (i have played contextual filters ...) any ideas ? thx ok , manage want hook_views_query_alter() : function my_module_views_query_alter(\drupal\views\viewexecutable $view, \drupal\views\plugin\views\query\querypluginbase $query) { if($view->id() == 'my_view' && $view->current_display == 'my_block'){ $movie= node::load($view->args[0]); if(is_object($movie)) { foreach ($query->where &$condition_group) { foreach ($condition_group['conditions'] &$condition) { if ($condition['field'] == 'node__field_id_movie.field_id_movie_value') { ...

qt - Printing QGraphicsScene cuts objects in half -

Image
i want print what's on qgraphicsscene: void mainwindow::on_print_clicked() { if (template_ptr != q_nullptr) { qprinter printer(qprinter::highresolution); if (qprintdialog(&printer, this).exec() == qdialog::accepted) { if (qpagesetupdialog(&printer, this).exec() == qdialog::accepted) { qpainter painter(&printer); painter.setrenderhint(qpainter::antialiasing); painter.setrenderhint(qpainter::textantialiasing); qreal x, _y, h, w, fake; ui->graphicsview->scenerect().getrect(&x, &_y, &w, &fake); h = template_ptr->page_height*2.0; qint32 page = 0; while (true) { qreal y = _y + h*page; qrectf leftrect(x, y, w, template_ptr->page_height*2.0*template_ptr->max_pages - h*page); if (ui->graphicsview->scene()->items(leftr...

jbossfuse - Jboss Fuse 6.2.1 Missing jar org.apache.servicemix.bundles.javassist -

i'm trying deploy bundle in fuse 6.2.1-084 fails because of classnotfoundexception com.google.common.util.concurrent.executionerror: java.lang.noclassdeffounderror: javassist/bytecode/classfile the class required other bundle org.apache.servicemix.bundles:org.apache.servicemix.bundles.reflections:0.9.8_1 the same bundle deploying , working correctly on fuse 6.2.0-133. updated pom of project use lib version of fuse 6.2.1. what i've noticed lib supposed provide missing class in "system" folder of fuse 6.2.0 not in fuse 6.2.1 the lib org.apache.servicemix.bundles.javassist my question is: lib removing reason or bug? if not bug, have explicity include bundle in fabric profile? the missing class contained in bundle, under jboss-fuse-6.2.0.redhat-133/system [vgohel@localhost system]$ jar -tf org/javassist/javassist/3.18.1-ga/javassist-3.18.1-ga.jar|grep classfile javassist/bytecode/classfile.class javassist/bytecode/classfileprinter.class ja...

swift - Can we hide a UIView partially in iOS -

Image
i have partially hide uiview when user scrolls on it. there uiscrollview above uiview . example in given image below want hide area covered under scrollable area in blue color. views background colors clear color. i want hide part given in below image, marked rectangle in red color. part of text (one, two, three) visible. each uiview , including uiscrollview , has core animation layer (a calayer ). you access calayer with view.layer in turn, calayer has mask, access with layer.mask using mask comprehensive method of controlling visibility , opacity @ runtime.

java - Menu Interface Student Record System -

i have partially working record system, i'm having trouble menu interface. basically, menu should allow to: add student delete student print students quit now menu works fine i'm having trouble add student section. when add student require: a prompt first name a prompt surname a prompt id number when have done this, asks if want add another; if "y" entered, loops again, , if "n" entered goes main menu. now on mine when press "n" nothing happens, , when press y, loops again won't let enter values first name. here's code system: registryinterface.java /** * @version 1.0 * @author parry2411 */ package student; import java.util.scanner; public class registryinterface { private registry theregistry = new registry(); scanner input = new scanner(system.in); public registryinterface(registry theregistry) { } public void domenu() { boole...

angularjs - Component template expression not updating -

in main view inject component, on initial load shows correct integer, if update value later on in main view console log message attached function displays correct integer actual html value not update. whats going on here? main.js: @component({ selector: 'step-one', directives: [pricebox], templateurl: 'step-one/step-one.html' }) export class stepone { constructor(@inject(router) router, @inject(http) http, @inject(routeparams) params, @inject(pricebox) pbox) { let cid = parseint(params.get('country')); pbox.price = 200; ... price-box.js import {component} 'angular2/core'; @component({ selector: 'price-box', template: ` <div> <h1>pricebox</h1> <p>{{totalprice}}</p> </div> ` }) export class pricebox { constructor() { this.totalprice = '130'; } set price(val){ this....

db2 - SQL query that will retrieve set containing all entries from another set -

i have following relations in db: organization: information political , economical organizations. name: full name of organization abbreviation: abbreviation ismember: memberships in political , economical organizations. organization: abbreviation of organization country: code of member country geo_desert: geographical information deserts desert: name of desert country: country code located province: province of country my task retrieve organizations have within members full set of countries deserts. organization can have countries without deserts. have set of countries deserts , every organization in result should have of them members , arbitrary amount of other (no desert) countries. i tried far write following code, doesn't work. with countrieswithdeserts ( select distinct country dbmaster.geo_desert ), organizationswithalldesertmembers ( select organization dbmaster.ismember ism ( select count(*) ( sele...

Calling same method before typical events in Selenium Webdriver -

in selenium webdriver, have call particular method before every "click / submit" event of every method wherever these events appear in class. can invoking same method (to repeated) before each click/ submit event. consider if there total 100 click events in class. cumbersome. instead have give logic , condition call method @ 1 place condition provided click/submit events , subsequently applied before such events. how can achieve this? note: statements of click/submit event different. create parameter customized click/submit method (which may accept locator on want perform action) method want call before click/submit , use customized method in test code. it onetime task.

python - In matplotlib plot cell averages instead of line plot -

Image
given set of n 'co-ordinates', x=[0, 1, 2, 3, 4] , n-1 'values' y = [10, 20, 30, 40] want plot piecewise-constant function equal 10 0 < x <1, equal 20 1 < x < 2 etc. in other words, x-list contains co-ordinates of cells boundaries while y-list represents value of function inside cells. standard way plot such data? i interested in non-regular grids , 2d plots. for 1d data, use bar plot. first argument center of bars, , second height. x=np.asarray([0, 1, 2, 3, 4]) centers=(x[1:]+x[:-1])/2.0 plt.bar(centers,[10, 20, 30, 40],width=1) for 2d data, can use pcolor , colorbar # x coordinates of cells x=np.asarray([0, 1, 2, 3, 4]) # y coordinates of cells y=np.asarray([0,1,2]) # values inside cells c = np.asarray([[10, 20, 30, 40], [50,60,70,80]]) # plot cells plt.pcolor(x,y,c) # plot bar match colors values plt.colorbar() to plot non regular grids, pcolor can take arguments 2d arrays x , y: can specify x , y coordinates each cell. ...

Bxslider slider shown only one slide -

bxslider slider shown 1 slide, space between slider big or problem can't figure out it shows 1 slide after scorollin 2nd slide e.t.c. but want 5 slidere scrolling alway carousel .bx-wrapper { position: relative; margin: 0 auto 20px; padding: 0; *zoom: 1; width: 780px; height: 100px; } .bx-wrapper img { max-width: 20%; display: block; } /** theme ===================================*/ .bx-wrapper .bx-viewport { -moz-box-shadow: 0 0 5px #fff; -webkit-box-shadow: 0 0 5px #fff; box-shadow: 0 0 5px #fff; border: 5px solid #fff; left: -5px; background: #fff; } thanks! this sample, need auto too, in example, http://bxslider.com/examples/carousel-dynamic-number-slides script <script type="text/javascript"> $(document).ready(function(){ $('.bxslider').bxslider(); }); </script> html <ul class="bxslider"> <li><img src="images/logo1...

android - cordova.file got undefined -

i work arround issus many day. i want use cordova-plugin-file read/write file on android cause me issus : cordova.file undefined. my project created ionic framework here list of information plugin version : ionic framework : 1.5.5 cordova version : 5.1.1 cordova plugin list: cordova-plugin-file 4.1.0 "file" cordova-plugin-whitelist 1.2.2-dev "whitelist" anyone can me fix problem :)

ios - Difference between UIsystemfonts -

i newbie learning obj-c. when typed following line nslog(@"system fonts %@", [uifont familynames]) i got following output. thonburi, "snell roundhand", "academy engraved let", avenir, "marker felt", "geeza pro", "arial rounded mt bold", "trebuchet ms", arial, marion, "gurmukhi mn", "malayalam sangam mn", "bradley hand", "kannada sangam mn", "bodoni 72 oldstyle", cochin, "sinhala sangam mn", "hiragino kaku gothic pron", papyrus, verdana, "zapf dingbats", "avenir next condensed", courier, "hoefler text", helvetica, "euphemia ucas", "hiragino mincho pron", "bodoni ornaments", "apple color emoji", optima, "gujarati sangam mn", "devanagari sangam mn", "times new roman", kailasa, "telugu sangam mn", "heiti sc", "apple sd ...

arrays - Difference between a -= b and a = a - b in Python -

i have applied this solution averaging every n rows of matrix. although solution works in general had problems when applied 7x1 array. have noticed problem when using -= operator. make small example: import numpy np = np.array([1,2,3]) b = np.copy(a) a[1:] -= a[:-1] b[1:] = b[1:] - b[:-1] print print b which outputs: [1 1 2] [1 1 1] so, in case of array a -= b produces different result a = - b . thought until these 2 ways same. difference? how come method mentioning summing every n rows in matrix working e.g. 7x4 matrix not 7x1 array? note: using in-place operations on numpy arrays share memory in no longer problem in version 1.13.0 onward (see details here ). 2 operation produce same result. answer applies earlier versions of numpy. mutating arrays while they're being used in computations can lead unexpected results! in example in question, subtraction -= modifies second element of a , uses modified second element in operation on third element...

php - How to put the values of a array pulled from mySQL into variables -

i have been able query data mysql database , put array variable $results, not able put part of array, password or regtime in $results varible separate variables. doing wrong? this select function in databse class querying data database using perameter of $query. works posts page, dont think problem. // select function public function select($query){ $result = $this->connection->query($query); while ( $obj = $result->fetch_object()){ $results[] = $obj; } return $results; } this login function in query class putting submitted username query , passing select function above pull results username, returned login function , stored in $results variable. checks whether variable empty , if kills script, working get: 1) yay!!!! 2)and displayed print_r() is: array ( [0] => stdclass object ( [id] => 1 [username] => dillon [fname] =...

node.js - kafka-node does not receive messages in real time -

i followed quick start guide: http://kafka.apache.org/documentation.html#quickstart , write consumer in node.js. topic 'test' created, can use kafka-console-produce.sh , receive messages kafka-console-consumer.sh i wrote simple consumer (live.js): var kafka = require('kafka-node'), client = new kafka.client('localhost:2181/'), consumer = new kafka.consumer(client, [{'topic': 'test', partition: 0}], {autocommit: true}); client.on('ready', function(){ console.log('client ready!'); }); console.log(client); console.log(consumer); consumer.on('error', function (err) { console.log("kafka error: consumer - " + err); }); consumer.on('offsetoutofrange', function (err){ console.log("kafka offsetoutofrange: " + err); }); consumer.on('message', function(message){ console.log(message); }); while runnin...