Posts

Showing posts from July, 2010

selenium - Open a calendar that appears only on clicking the right side of an input box -

Image
i have calendar opens on clicking on black arrow(marked in image). black arrow appear on hovering right extreme of input box. tried click on input tag, not show calendar arrow doesn't appear. how can make calendar appear? this how element looks in inspecting it. <input type="week" name="startweek"> im using selenium web-driver java. i have found solution this. workaround pass date directly calendar element using sendkeys method. getelement(calendar).sendkeys( "03012016") ; this enter date directly onto calendar field.

Can android read the serial number of the USB charger -

is there way android device can read serial number (or other id) of usb charger? charger functional usb host , not power wires used. i have tried use usbaccessory ( https://developer.android.com/guide/topics/connectivity/usb/accessory.html ), null result of getparcelableextra(usbmanager.extra_accessory). best regards, ivan

python - Print an sqlalchemy row -

all i'd print single row of sqlalchemy table row. say have: from sqlalchemy import column, integer, string sqlalchemy.ext.declarative import declarative_base base = declarative_base() class atable(base): __tablename__ = 'atable' id = column(integer, primary_key=true) name = column(string(255), nullable=false) then i'd output looks this: id: 1 name: therowname preferable without having hard code in table columns, i.e. more generally. i've tried: atable = atable() ... #add values etc. print atable print str(atable) print repr(atable) print atable.__table__.c as thought implementing __str__ , __repr__ , again lack generality request. there many questions on covering table row json, that's not want, care more visual output - doesn't need machine readable afterwards. to clear - want general method print "col: value" without hardcoding column names? not use sqlalchemy much, __str__ method should ...

c# - Transform XML returned from a web request using XLST -

i see several questions close none cover it: how apply xslt stylesheet in c# xslt transform of xml using xml data web form how transform xml structure generated request web services i can cobble these worry passing through many steps efficient. what have this, read xml http web request: webrequest request = webrequest.create(url); webresponse response = request.getresponse(); stream stream = response.getresponsestream(); streamreader streamreader = new streamreader(stream); string xml = streamreader.readtoend(); this before need apply xlst transform needed. have (possibly null) xslcompiledtransform object. so want add block like: if(transform != null) { xml = transform.transform(xml); } clearly isn't possible written. see stringreaders , xmlreaders can created inefficient xml string , push object? can use stream or streamreader objects directly support same basic flow, optional transformation? personally ...

angular - How to add preloader to every http request(angular2)? -

in angular2 app want show preloader(locking screen) every time http request starts , hide after request ends. subscribe method allows detect when request successful, has errors or completes. think it`s bad idea write code of preloader every time call subscribe method on request. how can detect request starts/ends(except in subscribe method)? what way add preloader every request? i extend http class below , add service containing observable / subject notified when http request executed export class customhttp extends http { constructor(backend: connectionbackend, defaultoptions: requestoptions, private _notifierservice:notifierservice) { super(backend, defaultoptions); } request(url: string | request, options?: requestoptionsargs): observable<response> { this._notifierservice.notifybeforerequest(); return super.request(url, options); } get(url: string, options?: requestoptionsargs): observable<response> { this...

ibm mobilefirst - How to deploy adapter to local MFP server with CLI? -

i have been looking mfp cli doc how deploy adapter local mfp server can't find one. can't find 1 in mfp adapter . what command? run command mfp push push adapter locally running mobilefirst server.

html - How to give 2 different colours of the font to the vertical text, in order to text 1 and text 2 was in one "div class"? -

two texts saved on "background-color: blue" test. have 2 "div class": 1) vertical-text1 (text color ---> white) 2) vertical-text2 (text color ---> yellow + font-weight: bold) my code: <div class="video_info"> <div class="vertical-text1">text 1</div> <div class="vertical-text2">text 2</div> </div> .video_info { position: fixed; left: 30px; top: 70%; } .vertical-text1 { transform: rotate(-90deg); color: white; background-color: #0000ff; position: absolute; left: -190px; top: -215px; width: 400px; } .vertical-text2 { transform: rotate(-90deg); color: yellow; font-weight: bold; background-color: #0000ff; position: absolute; left: -40px; top: -350px; width: 100px; } how give 2 different colours of font vertical text, in order text 1 , text 2 in 1 "div class"? i don't think can have...

ruby on rails - It seems that sidekiq doesn't support actioncable in Rails5? -

so i'm trying broadcast message in 1 of jobs. job being executed it's not broadcasting message. because actioncable requires puma perform message broadcasting? so guess reason why wasn't working because cable adapter wasn't set redis in config/cable.yml

Upgrading from PHP 5.5 to Php 7 -

php 5.5 retiring in 11 days best stable option upgrade php 5.6 or php 7 ? good noon friend, as per link http://php.net/supported-versions.php active support until till 10 jul 2016 , security support until - 10 jul 2016. that doesn't mean can not use it. can use php community doesn't fixes on that. lots of current websites still using php 5.x versions. i suggest use php 5.6. php 5.6 has better support in framework , extension availability. have tried php 7 still lots of library , frameworks doesn't support php 7. aslo when tried install extension on windows wamp , xampp php 7 it's hard it. have tried mbstring after long research got used magento 2 , symfony2.x framework suggest use php 5.6. hope answer work you. :)

robotframework - Error while trying to execute .robot file using robot.run -

i trying execute run_keyword.robot made ride file in directory 'robot' python interpreter , getting following error. able run .py file cmd without error , gives expected results. can reason this. newbie robot framework. please this. from robot import run run(suite = 'robot') the error getting follows. traceback (most recent call last): file "c:\users\uvijayac\desktop\robot\rf.py", line 27, in <module> run_tests() file "c:\users\uvijayac\desktop\robot\rf.py", line 23, in run_tests report=report_file) file "c:\python27\lib\site-packages\robot\run.py", line 471, in run return robotframework().execute(*datasources, **options) file "c:\python27\lib\site-packages\robot\utils\application.py", line 83, in execute return self._execute(list(arguments), options) file "c:\python27\lib\site-packages\robot\utils\application.py", line 89, in _execute return self._report_error(unicode(er...

elasticsearch start error how to resolve this? -

i install elasticsearch in centos6.x....(rpm) service elasticsearch start command occur error how resolve problem my java version 1.7.0 elasticsearch version 2.3.3 enter image description here you have permissions issue /var/lib/elasticsearch folder. elasticsearch can't write folder. need recheck under user works elasticsearch: ps aux | grep elasticsearch and permissions him: ls -lah /var/lib/elasticsearch

javascript - Get links photos and insert another div? -

first, helping me. english not want people me. how grab photos of class="swiper-slide" insert class="tt1" ? ex: <div class="tt1"></div> <div class="tt11">...</div> <div class="tt2"> <div class="tt3"> <div class="swiper-slide"> <img src="/image1.jpg" style="width: 225px; height: 400px;"> </div> <div class="swiper-slide"> <img src="/image2.jpg" style="width: 225px; height: 400px;"> </div> <div class="swiper-slide"> <img src="/image3.jpg" style="width: 225px; height: 400px;"> </div> </div> </div> result: <div class="tt1"> <img src="/image1.jpg"> </div> <div class="tt11">......

html - how to avoid printing 'echo' output with system command in C -

system("echo 'abcpasswd' | su - newusr -c 'ls -ltr'"); above code embedded in 'c' code generats binary , later called html page. above code prompts 'password' piped in command. end seeing prompt 'password:' in html rendered page. how around ?. don't want prompt 'password:' seen on webpage. for security reasons, su doesn't takes password everywhere else interactive terminal. option - full login not standard input reading. you may use sudo can control better (read os manual it), beware using such in non interactive mode considered harmful...

Copyright - okay to change open sourced Maven groupId? -

there opensourced maven plugin hosted on github , use it. however, needed make little adjustment in specific needs , need deploy our company's maven repo. the repo serves proxy maven central , other , want avoid conflicts thought change groupid/artifactid else. okay, copyright , ethics-wise? leave credit original, links etc. license apache 2.0. thanks

javascript - Create inner divs within a loop -

can explain me how appending divs concats , looks mess. want each trip inside separate divs var origin = ' '; var destination = ' '; var distance = ' '; var oneconcatedtrip = ' '; var outerdiv = document.getelementbyid('demo'); var innerdiv = document.createelement('div'); var = 1; var query = firebase.database().ref('users/' + uid +'/waypoints/work/2016/06').orderbykey(); query.once("value") .then(function(snapshot) { snapshot.foreach(function(childsnapshot) { var key = childsnapshot.key; var childdata = childsnapshot.val(); origin = childsnapshot.val().origin; destination = childsnapshot.val().destination; distance = childsnapshot.val().distance; innerdiv.classname = 'block-' + i++; outerdiv.appendc...

javascript - Using bootstrap on confirm message onclick() -

i'm new bootstrap, , i've code message confirmation. how can put onclick() using code below? $("#mymodal").on("show", function() { // wire ok button dismiss modal when shown $("#mymodal a.btn").on("click", function(e) { console.log("button pressed"); // example... $("#mymodal").modal('hide'); // dismiss dialog }); }); $("#mymodal").on("hide", function() { // remove event listeners when dialog dismissed $("#mymodal a.btn").off("click"); }); $("#mymodal").on("hidden", function() { // remove actual elements dom when hidden $("#mymodal").remove(); }); $("#mymodal").modal({ // wire actual modal functionality , show dialog "backdrop" : "static", "keyboard" : true, "show" : true // ensure modal...

flexbox - CSS flex box alternate row colors -

when using tables, easy alternate colors in table rows using nth child selectors ( https://stackoverflow.com/a/3084318/1385857 ). there comparable way when using flexbox layout. have following (from https://philipwalton.github.io/solved-by-flexbox/demos/grids/ ): <div class="grid"> <div class="grid-cell"></div> [more divs] <div class="grid-cell"></div> </div> .grid { display: flex; flex-wrap: wrap; } .grid-cell { flex: 1; } is possible alternate row colors in scenario. clarify, there no real rows, virtual rows created flex box due wrapping. you can use same technic nth-child (2n+1, even, odd), or whatever want. the display of element doesn't interfere here. .grid { display: flex; flex-wrap: wrap; } .grid-row { flex: 1; } .grid-cell:nth-child(2n+1) { background: pink; } <div class="grid"> <div class="grid-row"> <div cl...

elasticsearch - Elastic Search Bulk Import from JSON without ID -

is there way import data json file elasticsearch without having provide id each document? i have data in json file. contains around 1000 documents no id has been specified document. here's how data looks like: {"business_id": "aasd231as", "full_address": "202 mcclure 15034", "hours":{}} {"business_id": "123123444", "full_address": "1322 lure 34", "hours": {}} {"business_id": "sd231as", "full_address": "2 mccl 5034", "hours": {}} it not have {"index":{"_id":"5"}} before document. trying import data elasticsearch using following command: curl -xpost localhost:9200/newindex/newtype/_bulk?pretty --data-binary @path/file.json but throws following error: "type" : "illegal_argument_exception", "reason" : "malformed action/metadata line [1], expected start_o...

angularjs - Remove gridlines in AngularCharts -

i using angularcharts agnularjs wrapper chart.js. want remove grid lines chart there actual line chart only. grids not being removed. controller $scope.labelsx2 = [" ", " ", " ", " time ago ", " ", " ", " "]; $scope.seriesx2 = [' ']; $scope.datax2 = [ [65, 59, 80, 81, 56, 55, 40] ]; $scope.options = { scaleshowgridlines : false }; $scope.labelsx2 = [" ", " ", " ", " time ago ", " ", " ", " "]; $scope.seriesx2 = [' ']; $scope.datax2 = [ [65, 59, 80, 81, 56, 55, 40] ]; $scope.options = { scaleshowgridlines : false }; chart.html <canvas id="line" class="chart chart-line" data="datax2" labels="labelsx2" legend="true" series="seriesx2" options="{showtooltips: false}"></can...

Python deleting file with Unicode characters -

i writing cleanup method in python 2 should erase files including ones unicode name. shutil.rmtree not option since lacks control need. at moment tried declaring # -*- coding: utf-8 -*- , use combinations of .encode('utf-8') , .decode('utf-8') no success. how method looks without encoding or decoding def _remove_files(path): files = [] dirpath, dirnames, filenames in os.walk(path): filename in [f f in filenames]: files.append(os.path.join(dirpath, filename)) _file in files: print _file os.chmod(_file, stat.s_irwxu | stat.s_irwxg | stat.s_irwxo) os.remove(_file) this error get: windowserror: [error 2] system cannot find file specified: u'c:\users\xxxxx\yyyyy\\u65e5\u672c\u8a9e\u306e\u656c\u8a9e.txt'

ios - Update UILabel frame and text continously -

i trying move uilabel follow finger using touchmoved. , updating current frame label text. label shuttered not moving accordingly. if comment 1 moving or updating text working i made sample have uilabel , add pan gesture recognizer, change frame according location in view of superview example it's here : self.view . remember add userinteractionenabled = true uilabel . luck @iboutlet var label: uilabel! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let pangesturerecognizer = uipangesturerecognizer(target: self, action: #selector(self.handlepan(_:))) label.addgesturerecognizer(pangesturerecognizer) label.userinteractionenabled = true } func handlepan(gesturerecognizer: uipangesturerecognizer) { let location = gesturerecognizer.locationinview(self.view) var frame = label.frame frame.origin.x = location.x frame.origin.y = location.y label.frame = frame }

javascript - Fill up previous stars on a JQuery 5-star rating onmouseover system -

i want implement 5 star rating system , fill stars left mouseover position yellow (class called yellow ), otherwise grey . i have done far: html: <div id="stars3"> <i data-count="0" class="glyphicon glyphicon-star grey-light grey"></i> <i data-count="1" class="glyphicon glyphicon-star grey-light grey"></i> <i data-count="2" class="glyphicon glyphicon-star grey-light grey"></i> <i data-count="3" class="glyphicon glyphicon-star grey-light grey"></i> <i data-count="4" class="glyphicon glyphicon-star grey-light grey"></i> </div> jquery: $("[id^=stars] > i").hover(function() { count = $(this).attr("data-count"); $(this).each(function (i) { if ($(this).attr("data-count") < count) $(this).addclass("yellow"); }); consol...

matlab - Disp difference between A and B when B is not NaN -

a have 2 matrices <1x100 double> plot(a,b) . in columns of matrix b there nan. want difference (like 5 higher b) between b both , b exists. want presented local maximum, printing out disp . example: when max(a) = 20 , b = 10 want display: 10 more b. when changes 30 once again want display: max(a) 20 more b. help appreciated! validdata = ~isnan(a) & ~isnan(b); % indices both exist plot(a(validdata),b(validdata)); isnan gives elements nan , negate ( ~ ), , non-nan values. can used logical index both a , b . to maximum values, andrasdeak suggests nanmax(a-b) update: apparently max has default omit nan values, can use directly: [maxvalue,maxposition] = max(a-b);

How to use "value%" with like keyword in mangodb -

i can execute below query in mangodb mysql: select * users user_id "bc%; mangodb: db.users.find( { user_id: /^bc/ } ) the above query working. below query not working please me give suggestion. mysql: select * users user_id "%bc"; mangodb: db.users.find( { user_id: /bc^/ } ); in regex ^ character labels start of subject. putting on right hand side therefore not meaningful. instead, "end of string" analogue ^ $ : db.users.find( { user_id: /bc$/ } ); this translates to: find users last 2 characters of user_id attribute 'bc'.

regex - How to replace http for https in string but only on specific domains in PHP -

i need parse strings of html content , possible replace urls images on other domains https wherever http. issue not external domains support https can't blanket replace http https. so want list of domains know work https. there small added complication search has work domains irrelevant if www. added or not. using example given @wiktor have close want, needs reversing run replace when match found, not when match isn't found code functions. /http(?!:\/\/(?:[^\/]+\.)?(?:example\.com|main\.com)\b)/i i believe can use $domains = array("example.com", "main.com"); $s = "http://example.com http://main.main.com http://let.com"; $re = '/http(?=:\/\/(?:[^\/]+\.)?(?:' . implode("|", array_map(function ($x) { return preg_quote($x); }, $domains)) . ')\b)/i'; echo preg_replace($re, "https", $s); // => https://example.com https://main.main.com http://let.com ...

java - Zoomdata - Failed to validate connection -

2016-06-28 08:15:39,542 warn [c.z.c.s.i.connectionsservice] failed validate connection 'brokerage12' com.zoomdata.model.service.validationexception: failed establish connection @ com.zoomdata.solr.solrstoragefactory.validateconnection(solrstoragefactory.java:66) ~[connector-solr-2.2.7.jar!/:na] @ com.zoomdata.core.service.impl.connectionsservice.validate(connectionsservice.java:196) ~[core-2.2.7.jar!/:na] @ com.zoomdata.core.service.impl.connectionsservice$$fastclassbyspringcglib$$eacd836a.invoke(<generated>) [core-2.2.7.jar!/:na] @ org.springframework.cglib.proxy.methodproxy.invoke(methodproxy.java:204) [spring-core-4.2.3.release.jar!/:4.2.3.release] @ org.springframework.aop.framework.cglibaopproxy$cglibmethodinvocation.invokejoinpoint(cglibaopproxy.java:718) [spring-aop-4.2.3.release.jar!/:4.2.3.release] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:157) [sprin...

go - Why am I getting an never ending loop when reading from a byte.Buffer -

currently i'm writing program reading buffer bytes.buffer. supposed stop reading when finds character e. when reading buffer using loop noticed odd. when put byte reading part of statement infinity loop ( example in go playground ): b := bytes.newbuffer([]byte("uoiea")) v, _ := b.readbyte(); v != 'e'; { println("the value " + string(v)) } but if removed , put inside loop, doesn't ( example in go playground ): b := bytes.newbuffer([]byte("uoiea")) ;; { v, _ := b.readbyte() println("the value " + string(v)) if v == 'e'{ break } } does know why this? find adding break expression ugly , error prone way solve this. because post statement of for-loop empty (you have init statement ), don't read next byte every iteration ( v 'u' ). here fixed version : b := bytes.newbuffer([]byte("uoiea")) v, _ := b.readbyte(); v != 'e'; v, _ = b.readbyte() { ...

python - Django generic view is not accepting arguments -

i new django , trying pass arguments django generic base view , not showing in terminal printing arguments passed. views.py from django.views.generic import view class cartview(view): def get(self, request, *args, **kwargs): item = request.get.get('item') qty = request.get.get('qty') print item, qty return httpresponseredirect('/') urls.py: urlpatterns = [ url(r'^home/$', 'newsletter.views.home', name='home'), url(r'^contact/$', 'newsletter.views.contact', name='contact'), url(r'^about/$', 'dressika.views.about', name='about'), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.default.urls')), url(r'^', include('products.urls')), url(r'^categories/', include('products.urls_categories')), url(r'^cart/', cartv...

javascript - How to find position of a web element in relation to another web element? -

i have scenario have assert presence of web element position. more clear have web element x , web element y. have assert after clicking button can see x sitting above y. how that? you should 2 elements‘ positions in document , subtract position value of x value of y. if value positive, know x sitting farther y. getting position use boxpositionofx = getelementbyid(“myx”).getboundingclientrect(); boxpositionofy = getelementbyid(“myy”).getboundingclientrect(); this returns object containing 4 position values: top , right , bottom , left , relative viewport. not need convert viewport positions document positions, since document offset you'd have add same both elements , cut in subtraction. comparing positions now subtract positions: positiondifference = boxpositionofy.top - boxpositionofx.top; if positiondifference greater 0, x’s top border lies above y’s top border. if want make sure elements not overlap, use this: if ( (boxpositionofy.top - boxposit...

Highlight menu item i created with a block in magento -

i explain problem. have running installation of magento, wanted change shop megamenu, created new block megamenu. set " no " in: include in navigation menu of main shop category. now have new menu working problem when go shop page "shop" button not highlighted. how can fix that? the shop here: http://www.ovunque6.it/shop.html

html - Delete each row in a table using JavaScript -

i working on application allows user click delete button on row in table, confirmation modal should pop up; when click yes, should able delete row. code doesn't that, instead first deletes header of want delete row specified, not header. used bootstrap css. function deleterow(r) { var = r.parentnode.parentnode.rowindex; document.getelementbyid("datatable-responsive").deleterow(i); $('#confirm-delete').modal('hide'); } <table id="datatable-responsiv"> <thead align="center"> <tr> <th> <input type="checkbox" name="prog" id="check-all" class="flat"> </th> <th>name of video</th> <th>link</th> <th>action</th> </tr> </thead> <tbody> <tr class="even pointer"...

python - What is os.linesep for? -

python's os module contains value platform specific line separating string, docs explicitly not use when writing file: do not use os.linesep line terminator when writing files opened in text mode (the default); use single '\n' instead, on platforms. docs previous questions have explored why shouldn't use in context, context useful for? when should use line separator, , what? the docs explicitly not use when writing file this not exact, doc says not used in text mode. the os.linesep used when want iterate through lines of text file. internal scanner recognise os.linesep , replace single "\n". for illustration, write binary file contains 3 lines separated "\r\n" (windows delimiter): import io filename = "text.txt" content = b'line1\r\nline2\r\nline3' io.open(filename, mode="wb") fd: fd.write(content) the content of binary file is: with io.open(filename, mode="rb") f...

php - Regular Expression for this text -

i want write regex extracting numbers following text (that part of bigger text): switchport trunk allowed vlan 206,220,23,234,250,262,21,283,2086,296,305,323 switchport trunk allowed vlan add 334,340,342,365,380,404,41,414,42,421,434 switchport trunk allowed vlan add 461,472,499,509,29,535,544,551,552,55,595 switchport trunk allowed vlan add 642,672,690,697,701,704,711,800,2018,2020 switchport trunk allowed vlan add 2054 switchport mode trunk i want extract vlan numbers between switchport trunk allowed vlan , switchport mode trunk i think pattern should like: switchport trunk allowed vlan (\s*) ((\d+),*)+(?:.|\n) but don't know how extract other numbers (only first 1 matched) i use pattern in php in preg_match function. to extract numbers, can in following manner:- <?php $str = ' switchport trunk allowed vlan 206,220,23,234,250,262,21,283,2086,296,305,323 switchport trunk allowed vlan add 334,340,342,365,380,404,41,414,42,421,434 switch...

ios - Standard Weather app: view hierarchy with same behavior -

Image
i trying understand, how can achieve same vertical scroll behavior (all horizontal behavior looks obvious) in standard weather iphone app. saw this question, it's not enough. goal construct view hierarchy using uiscrollview 's and/or uitableview 's possibly without custom animations. made screenshots 3 different states: initial state: "refresh" state (dragged): detail state (scrolled): ideas have: separate screen red, yellow, green , blue modules looks nice idea. 1) green + blue area (and yellow?) close uitableview green module header view, 1 unstandard thing - can move green module top, skipping "refresh" area. 2) in top of red area can interact blue/green modules, move them , down, so, possibly area inset of uitableview custom animated uiview under uitableview ? we have no way of knowing whats going on since it's apple's source. there not lot of options available design kind of logic weather app has the...

node.js - callback gets fired without waiting node js -

hi new node trying create sign functionality ... checks whether username exists or not , other few validations .. not waiting getting results mongodb check whether user exists or not.. callback fired early..pls how can make way want var fs = require('fs'); var bcrypt = require('bcrypt-nodejs'); var util = require('./util'); exports.loginvalidate = function(user, callback) { var user = require("../models/userschema").model('user'); user.findone({ uname: user }, function(err, userdata) { if (err) console.log(err); callback(userdata); }); } exports.createuser = function(data, callback) { var user = require("../models/userschema").model("user"); var user = new user(data); user.save(function(error) { if (error) { return res.json({ msg: "error" }); } else { cal...

Spark Redshift with Python -

Image
i'm trying connect spark amazon redshift i'm getting error : my code follow : from pyspark.sql import sqlcontext pyspark import sparkcontext sc = sparkcontext(appname="connect spark redshift") sql_context = sqlcontext(sc) sc._jsc.hadoopconfiguration().set("fs.s3n.awsaccesskeyid", <accessid>) sc._jsc.hadoopconfiguration().set("fs.s3n.awssecretaccesskey", <accesskey>) df = sql_context.read \ .option("url", "jdbc:redshift://example.coyf2i236wts.eu-central- 1.redshift.amazonaws.com:5439/agcdb?user=user&password=pwd") \ .option("dbtable", "table_name") \ .option("tempdir", "bucket") \ .load() here step step process connecting redshift. download redshift connector file . try below command wget "https://s3.amazonaws.com/redshift-downloads/drivers/redshiftjdbc4-1.2.1.1001.jar" save below code in python file(.py want run) ...

Can JGraphT java library be used for making 3D graphs -

basically have plot 3d undirected graph list of vertices.at present can plot undirected graph in 2d , have used following code this. import java.awt.color; import java.awt.dimension; import java.awt.rectangle; import java.awt.geom.rectangle2d; import java.util.hashmap; import java.util.map; import javax.swing.japplet; import javax.swing.jframe; import org.jgraph.jgraph; import org.jgraph.graph.defaultgraphcell; import org.jgraph.graph.graphconstants; import org.jgrapht.listenablegraph; import org.jgrapht.ext.jgraphmodeladapter; import org.jgrapht.graph.listenabledirectedgraph; import org.jgrapht.graph.defaultedge; public class jgraphadapterdemo extends japplet { private static final color default_bg_color = color.decode( "#fafbff" ); private static final dimension default_size = new dimension( 530, 320 ); // private jgraphmodeladapter m_jgadapter; /** * @see java.applet.applet#init(). */ public void init( ) { // create jgrapht graph listenablegrap...

css - Why does NetBeans say inherited margin is invalid? -

i'm overriding bootstrap style desktop, want default applied mobiles. i wrap desktop in media query, i'd rather have smaller mobile query default. however, netbeans saying invalid: .reader-profile .description {margin-bottom:inherit;font-size:inherit;} because of inherit value on margin-bottom. however, according w3 schools, correct property: http://www.w3schools.com/cssref/pr_margin-bottom.asp who or correct? according w3c site here valid. if highlight margin-bottom , press ctrl + space see exact same info on w3.org. netbeans having little bug in highlighting of unexpected characters

jquery - nvd3 linebar chart xAxis date format -

i have working line , bar chart having problems getting date format appropriately on xaxis. did around couldn't find linebar chart examples out there used same date format need. here json stored variable looks like: var data = [{ "key": "cases", "bar": true, "color": "skyblue", "values": [ [2016-01-01, 13], [2016-01-02, 17], [2016-01-03, 19], [2016-01-04, 39], [2016-01-05, 46], [2016-01-06, 34], [2016-01-07, 36], [2016-01-08, 32] ] }, { "key": "csat", "color": "steelblue", "values": [ [2016-01-01, 9], [2016-01-02, 7], [2016-01-03, 10], [2016-01-04, 10], [2016-01-05, 8], [2016-01-06, 9], [2016-01-07, 10], [...

matlab - Parameter estimation (MLE) of a truncated Pareto distribution -

i'm new here , super desperate hope of can me.... have sample of random data x_1....x_n , want fit truncated pareto distribution data.... fit generalized pareto distribution super easy , have done that. calculated shape , scale parameters matlab routine. truncated pareto distribution can't seem find routine calculate parameters need... have idea how it? thanks in advance! you can use markov-chain-monte-carlo simulations bayesian inference parameters of generalized pareto distribution given data. or stay maximum likelihood method. problem can solved in many ways. if want apply mle need search maximum. fminsearch() http://de.mathworks.com/help/optim/ug/fminsearch.html for need define function in separate m-file computes likelihood or log-likehood given set of parameters of truncated pareto distribution. fminsearch returns optimal parameters according likelihood. kind of routine looking for?

python - Compile user subroutine only once when running consecutive jobs in Abaqus -

i have script written in python calibrates material parameters based on output of last job, is, runs many jobs in abaqus consecutively until error small enough. i use fortran subroutine compiles before each job. the problem each job submit, user subroutine compiles. though input parameters different last job user subroutine not have compiled again. compilation of subroutine takes 80% of time of running job. how can specify compile user subroutine once , use consecutive runs? the following snippets of relevant code written in python. execute script typing abaqus cae nogui=script.py in terminal. code uses abaqus scripting interface. creating job: mdb.job(name=self.jobname, model='model-1', description='', type=analysis, attime=none, waitminutes=0, waithours=0, queue=none, memory=90, memoryunits=percentage, getmemoryfromanalysis=true, explicitprecision=single, nodaloutputprecision=single, echoprint=off, modelprint=off...

android - Vimeo embed showing white screen/missing progressbar -

i'm using vimeo webview in 1 of apps, in devices isn't working well. on xaiomi(api-19) doesn't show video progressbar , on s4(api-21) first time watch video display correctly, @ second time shows white screen, not on video watch in others vimeos videos try play. knows i'm doing wrong? or way works?. here's vimeoplayer activity. public class vimeoplayer extends activity { private html5webview mwebview; private modelvideo video; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mwebview = new html5webview(this); video = getintent().getparcelableextra("video"); //auto playing vimeo videos in android webview mwebview.getsettings().setjavascriptenabled(true); mwebview.getsettings().setallowfileaccess(true); mwebview.getsettings().setappcacheenabled(true); mwebview.getsettings().setdomstorageenabled(true); mwebview.getsetting...

Setting the order in d3plus stacked area plot -

how can set ordering of areas in stacked area plot in d3plus? i use following example http://d3plus.org/examples/basic/9029462/ : <script> // sample data array var sample_data = [ {"year": 1993, "name":"alpha", "value": 20}, {"year": 1994, "name":"alpha", "value": 30}, {"year": 1995, "name":"alpha", "value": 60}, {"year": 1993, "name":"beta", "value": 40}, {"year": 1994, "name":"beta", "value": 60}, {"year": 1995, "name":"beta", "value": 10}, {"year": 1994, "name":"gamma", "value": 10}, {"year": 1995, "name":"gamma", "value": 40} ] // instantiate d3plus var visualization = d3plus.viz() .container("#viz"...

indexeddb - Where is my data? Using PouchDb and Electron...nowhere to be found -

i beginning experiment pouchdb , electron. able create input stores data. can retrieve data , display in view. i know data being stored. tried deleting history including automatically , manually deleting indexeddb data browser data remains. have tried removing localstorage browser. totally unaware of data being stored if not being handled browser's indexeddb. pointers?? thanks!!! this varies adapter adapter. if use leveldb adapter (recommended electron), can specify filepath if using in node. if use indexeddb or websql, though, in lot of places. chrome, though, did hunt down, answer helps out: https://stackoverflow.com/a/36341491/680742 . in case of electron, might in ~/library/application support , can't quite recall. luck!

c# - Return value from wcf async call in Visual Studio 2010 -

i want value wcf async call. public datetime currentdatetime; private void getdatetime() { var client = new wcfclient(); client.getcurrentdatetimecompleted -= clientgetcurrentdatetimecompleted; client.getcurrentdatetimecompleted += clientgetcurrentdatetimecompleted; client.getcurrentdatetimeasync(); } private void clientgetcurrentdatetimecompleted(object sender, getcurrentdatetimecompletedeventargs args) { try { if (args.error == null && args.result != null) { currentdatetime = args.result; } } to call method. use getdatetime . question code didn't reach method @ in debug mode. result time date = {1/1/0001 12:00:00 am} . i know call synchronously. how in debug model? the easiest way putting breakpoint @ first line of async method , pressing f5, debugger should stop there , can debug it. see here. also msdn has document.

math - Find minimum of function on C# -

suppose have polynomial determined array of coefficients. coefficients integers -100 100. task find max point of function in range 0 1 programmatically. how can this? extrema occur @ roots of first derivative. compute latter , rewrite in bernstein basis (this takes resolution of triangular linear system). convex hull property tells roots possible/impossible looking changes of signs in coefficients. using de casteljau algorithm of subdivision, can implement dichotomic process root refinement. then, computing sign of second derivative @ roots allow tell maxima minima.

elasticsearch - Logstash is not converting correctly in JSON -

following json log file [ { "error_message": " failed line input file (end of file?).", "type": "error", "line_no": "2625", "file": "gtfplaintext.c", "time": "17:40:02", "date": "01/07/16", "error_code": "gtf-00014" }, { "error_message": " bad gtf plain text file header or footer line. ", "type": "error", "line_no": "2669", "file": "gtfplaintext.c", "time": "17:40:02", "date": "01/07/16", "error_code": "gtf-00004" }, { "error_message": " '???' ", "type": "error", "line_no": ...

sql server - Relationship between databse tables -

i have existing db schema this.is there way create kind of referential integrity between these 2 tables. kind of relationship ? many many 2 classes student table: id name courseid ------------------------ 1 student1 100023 2 student2 100023 3 student3 100024 4 student4 null course table: id courseid coursename -------------------------- 1 100023 course1 2 100022 course2 3 100024 course3 4 100023 course6 id primary key in both tables. courseid column relationships. definitely. can create foreign key constraint between student.courseid , course.courseid. can either through sql server management studio directly or using alter table/add constraint statement. personally, find management studio easiest use. do search on "sql foreign key constraints" , should find w3schools (or similar) explaining need know started them.

mysql - mysqli signal to php error -

i have mysql stored procedure, in cases give signal error this: create definer=`root`@`localhost` procedure `insertaction`(in `employerid` int, in `storefromid` int, in `storetoid` int, in `storeid` int, in `productid` int, in `quantity` decimal(10,2), in `dualoperation` tinyint, in `inorout` tinyint) language sql not deterministic contains sql sql security definer comment '' begin start transaction; select @lastactionid; select @lasttransferid; select @retval; select sum(ad.quantity) @retval productin pri join actiondetails ad on ad.id=pri.id; if dualoperation = 1 if @retval>quantity insert actions (employerid, storehouseid, `date`) values (employerid, storefromid, curdate()); set @lastactionid = (select id actions order id desc limit 1); insert producttra...

android - Fragment over another fragment that can be closed swiping up -

Image
i've made fragment fullscreen overlay fragment b. want handle swipe touch can close fragment swiping , reopen swiping down. i've made example image: how can implement that? i've not found tutorial of particular case. thank you. compile 'me.imid.swipebacklayout.lib:library:1.0.0' <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.darwich.swipetoclose.mainactivity"> <radiogroup android:id="@+id/id_radiogroup" android:layout_centerhorizontal="true" android:layout_margintop="40dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> <radiobutton android:id="@+i...

ios - get value from nested dictionary (from plist file) in swift 2.2 -

Image
i facing problem values plist file. want data of 2 marked red rectangles. flow of : i can 3 key values root dictionary, want go marked rectangle of testablesummaries which array.than has dictionary test and on. currently can values of testablesummaries the code use given below: var componentarray: [anyobject] var mydict: nsdictionary? if let path = nsbundle.mainbundle().pathforresource("test", oftype: "plist") { mydict = nsdictionary(contentsoffile: path) } if let dict = mydict { var val = dict.valueforkeypath("testablesummaries")! print(val) } but can't go deep of testablesummaries. in advance.

php - Symfony controller action execution before listener -

is possible have controller action executed before listener? i need trigger database change on action call before listener checks if change exists. can set or possible in symfony 2/3? the structure of actions should this: controlleraction saves database , returns response listener checks against database , execute or redirect based on end result db now listener having priority , don't know if possible changed. check kernel.response event , modify response if needed. http://symfony.com/doc/current/components/http_kernel/introduction.html#the-kernel-response-event