Posts

Showing posts from May, 2013

Wildfly Deployment through Jenkins -

i have spent many hours trying find solution one. i need deploy jenkins remote wildfly (no docker, vagrant etc) , want person deploys able choose version deployed. version's war should retrieved repository (artifactory) or int worse case, checkout svn tag , build anyone has working example? how define version needs deployed in jenkins ? http://blog.arungupta.me/2014/11/deployment-pipeline-javaee7-wildfly-arquillian-openshift-jenkins-techtip56/ shows how deploy remote wildfly using jenkins on openshift. app deployed if tests pass, , not otherwise.

python - matplotlib: How can you specify colour levels in a 2D historgram -

Image
i plot 2d histogram includes both positive , negative numbers. have following code uses pcolormesh unable specify color levels force white color corresponds 0 (i.e., want colorbar symmetric around zero). i've tried imshow. i know can specify colour levels in plt.contour , plt.contourf can't find way plot 2d histogram using blocks. any advice appreciated. import numpy np import matplotlib.pyplot plt matplotlib import cm cm fig = plt.figure() # create example histogram asymmetrical around 0 x = np.random.rand(400) y = np.random.rand(400) z, xedges, yedges = np.histogram2d(x, y, bins=10) z = z - 2. plt.pcolormesh(xedges, yedges, z, cmap=cm.rdbu_r) plt.colorbar() plt.savefig('test.png') add vmin , vmax parameters equal absolute values plt.pcolormesh(xedges, yedges, z, cmap=cm.rdbu_r, vmin=-7, vmax=7) and see if result

curl - PUT: command not found using elasticsearch -

i new elasticsearch , following guide on official website. when tried shorthand syntax given in guide i.e. put /megacorp/employee/1 { "first_name" : "john", "last_name" : "smith", "age" : 25, "about" : "i love go rock climbing", "interests": [ "sports", "music" ] } my terminal gives error put: command not found please guide me trick missing? put not command, need use curl, try this: curl -put http://localhost:9200/megacorp/employee/1 -d ' { "first_name" : "john", "last_name" : "smith", "age" : 25, "about" : "i love go rock climbing", "interests": [ "sports", "music" ] }' http://curl.haxx.se/docs/manpage.html http://www.elasticsearchtutorial.com/elasticsearch-in-5-minutes.html

android - Building Google Maps API v2 application but unfortunately .apk has stop working -

i trying build application using google maps api v2 thing is, application keeps giving me error unfortunately .apk has stop working although followed required instructions. please see code , me figure out problem. in advance here app code package com.example.ugoogle; import android.os.bundle; import android.view.menu; import android.view.menuitem; import com.google.android.maps.mapactivity; import com.google.android.maps.mapview; public class mainactivity extends mapactivity { mapview maps; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); maps = (mapview) findviewbyid (r.id.mapsviewmain); maps.setbuiltinzoomcontrols(true); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } @ove

javascript - does it make sense to test whether undeclared variable was defined earlier in code? -

i'm studying javascript , have no programming background @ all. in example think understand foo undeclared (global) variable doesn't exist when bar calculated, bar = (undefined + 1) or nan. var bar = foo + 1, foo = 1; let's toward end of long bunch of code. if foo had been defined , foo = 1 intended re-set value of foo? make sense test it? think i'm opening scope can of worms.... ("scope? can't haaaandle scope!") i thank in advance patience learning curve! answers phrase in analogy or metaphor under belt.... you can test , declare of not declared using or operator || foo = foo || 1; so if foo exists, foo foo. if foo not exist, foo 1.

vb.net - VPN Connection using VB in Visual Studion 2013 -

using visual studio 2013 , coding vb, not c#, need able create vpn connection. have been looking several days , tried several things nothing works. need disconnect. have done in batch file using following. rasdial "vpn connection" user password rasdial "china vpn connection" /disconnect obviously not work in vb.net. private sub button2_click(sender object, e eventargs) handles button2.click rasdial "vpn connection" user password end sub

metadata - mp3 file gets corrupted after tagging -

if downloaded songs gaana.com, goes sd card\android\data\com.gaana\files\.gaana folder without extension. when rename file .mp3 extension, able play song in windows media player. everything fine until here. when use softwares mp3tag, easytag , few others update album/track/artist , other metadata tag info, corrupts mp3 file , not play in windows media player. can tell me correct way of tagging downloaded mp3 files gaana.com? your file not mp3 - according http://mediaarea.net/de/mediainfo song mpeg-4 / aac. can find more infos format in http://en.wikipedia.org/wiki/advanced_audio_coding if rename *.aac , tag album/track/artist , other metadata info mp3tag song correctly , play well.

python - How do I check that PyQt5 is installed correctly on Mac? -

i've followed instructions on: http://danmarner.com/2014/04/23/installing-pyqt5-with-python-3-on-os-x.html to first install sip according instructions found at: http://pyqt.sourceforge.net/docs/sip4/installation.html and pyqt5 following instructions found here: http://pyqt.sourceforge.net/docs/pyqt5/installation.html and brew install qt5 but when run first example pyqt-gpl-5.3.2/examples/tutorials/addressbook/part1.py fails following: traceback (most recent call last): file "examples/tutorials/addressbook/part1.py", line 45, in <module> pyqt5.qtcore import qt importerror: no module named pyqt5.qtcore i'm running mavericks 10.9.5 , python 2.7.5 it doesn't seem it's installed correctly, or if python can't find it. i'm not sure how proceed suggestions appreciated! the issue resolved adding /usr/local/lib/python2.7/site-packages pythonpath. comments found here: https://stackoverflow.com/a/13103438/1729686

javascript - increase size of mouseleave area -

<http://jsfiddle.net/rbj9r/1504/> i mouseleave trigger area increase in size include image original mouseenter area (gray box). user able still see image if mouse on image area. thanks! #slender-trigger { background-color: #ccc; height: 100px; width: 120px; margin-left: 0px; margin-top: 50px; position: absolute; } #slender { font-family: 'strait', sans-serif; height: 400px; width: 400px; border: thin dotted #f00; position: absolute; margin-top: 50px; margin-left: 120px; display: none; } <div class="purchasing-tips"> <div id="slender-trigger">nnnn</div> <div id="slender" style="background-image:url(http://lorempixel.com/120/100/people); height: 100px; width: 120px; border: 1px solid black;">sadfasdf</div> </div> $("#slender-trigger").on("mouseenter", function() { $("#slender").show(); }).on("mouseleave", function() { $("#slender"

php - running a mysql count command within a looped drop down function -

basically, have created drop down box populated mysql database of primary catagories. when selection made, ajax function called runs query display sub catagories. for example, primary_catagory = p sub_catagory = s p s 1 a 1 b 1 c 2 d 2 e 2 f so when selection made in primary category, show either a,b , c or d, e , f depending on if 1 or 2 selected. query works fine except final cosmetic feature, show number of sub categories contained within primary one. so drop down box show choice (3) , choice b (2) example. this code have far, displays (1) every result. code stands. <select id="p_catagory" name="p_catagory" onchange = "getdata(this); return true;" style="position:absolute;left:0px;top:10px;width:315px;height:20px;z-index:11;text-align:left;"> if ($_get['p_catagory'] == "all") { <option value='all'>show all</option> } while ($row = mysqli_fetch_array($result, mysq

haskell - Does order of constructors / cases / guards / if-then-else matter to performance? -

i saw comment in containers/data/set/base.hs -- [note: order of constructors] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- order of constructors of set matters when considering performance. -- in ghc 7.0, when type has 2 constructors, forward conditional -- jump made when matching second constructor. successful match -- of first constructor results in forward jump not taken. -- on ghc 7.0, reordering constructors tip | bin bin | tip -- improves benchmark 10% on x86. where else order have tiny measurable impacts on performance? in particular wonder case statements many options. it depends. order of constructors does, unfortunately, make difference. means order of patterns type not . whether write foo (bin x y) = ... foo tip = ... or foo tip = ... foo (bin x y) = ... makes no difference, because reordered constructor order immediately in "desugaring" process. order of matching multiple patterns semantically left-to-right, argument order can matter if use multip

javascript - Get node inside template if statement -

on polymer-based website created custom element in loading data via ajax. depending on current state of data-loading created <template if="{{}}"> elements display right content. looks way: <polymer-element name="modules-item" attributes="moduleid categories"> <template > <service-get-module module="{{module}}" moduleid="{{moduleid}}"></service-get-module> <paper-shadow z="1"> <core-toolbar> <span flex hero-id="title" hero itemprop="name">{{module.title}}</span> </core-toolbar> </paper-shadow> <paper-progress id="moduleloadingprogress"></paper-progress> <template if="{{moduleid == null}}"> <p>modul not available</p> </template> <template if="{{moduleid != null && module == null}}"> <

java - What JAR contains the class MQSimpleConnectionManager -

anyone knows jar?? im going implement connection pooling mq series connection. the jar com.ibm.mq.jar can download http://www.java2s.com/code/jardownload/com.ibm/com.ibm.mq.jar.zip or if using maven <dependency> <groupid>com.ibm</groupid> <artifactid>com.ibm.mq</artifactid> <version>5.3.07</version> </dependency>

c++ - Algorithm for finding number of squares in a given circle -

here drawing: click i need write program, find number of squares(1x1), can draw circle of given radius.the squares can drawn , placed lego blocks- 1 on another. in cases, vertexes of squares can lie on circle. examples: 1- makes 0, 2- gives four, 3- 16 squares, 4-32, 5-52. i have written something, doesn't work fine 5+ (i mean- radius bigger 5). here goes: click . in code- r radius of circle, sum sum of squares , height height of triangles try "draw" circle (using pythagorean theorem). now- help? algorithm correct? should change something? there gauss's circle problem gives formula count integer points inside circle of given radius. may use logic count squares lie in circle. n = 4 * sum[i=1..r] (floor(sqrt((r^2-i^2))) example: r = 3 i=1 n1 = floor(sqrt(9-1))~floor(2.8)=2 i=2 n2 = floor(sqrt(9-4))~floor(2.2)=2 i=3 n2 = floor(sqrt(9-9))=0 n=4*(n1+n2+n3)=16

c - please help really stuck on structures -

hi guys been using site while tips never posted before (first time suppose) anyway doing assignment college (manufacturing degree) basic of you. basically the problem in search student name void near bottom program runs crashes enter name any appreciated #include <stdlib.h> #include <stdio.h> #define size 2 struct student { long studentid;//works char fname[21];//works char sname[21];//does not work int year;//works char course[51];//works float results_semester_1[6];//works float results_semester_2[6];//works int free; // 1 means free, 0 means not }; struct student beng[size]; int menu(); // function prototype void add_student(); // function prototype void display_students(); // function prototype void display_results(); // function prototype void search_for_student_studentid(); // function prototype void search_for_student_by_name(); // function prototype void delete_student(); // function prototype void initialise_database(

html - Center a div horizontally and vertically even on resize -

i saw asked few times of answers messed height. #transbox { position: fixed; top: 150px; right: 320px; width: 600px; height: 210px; background-color: #fff; border: 1px solid #000; opacity: 0.7; filter: alpha(opacity=60); } <div id="transbox"> <div id="title">navigation</div> <div id="navigation"> <table style="width:100%"> <tr> <td><a href="/">link</a></td> <td><a href="/">link</a></td> <td><a href="/">link</a></td> </tr> <tr> <td><a href="/">link</a></td> <td><a href="/">link</a&g

jquery - dustjs xpath parent equivalent -

i'm trying pretty simple: i'd show nba teams conference, isn't structure of json. i don't want ask rest service structure change, i.e., make teams child array of conference node. this presentation issue, i.e., json has data need, how can present using dustjs? you can see jsfiddle attempt here: xpath equivalent jsdust <script id="league-template2"> <div class="conference"> <h3>[i want put conference name here eg eastern] conference</h3> {#teams} <ul> {#properties} {@eq key=name value="numeric"} <li class="teamname teamdd_{value}"> <div class="logo-nba-small nba-small-[i want put abbv here eg phi]"><a>[i want put team name here eg 76ers]</a></div> </li> {/eq} {/properties} </ul>

php - XDebug with eclipse luna freezes at 57 % -

i have problem xdebug running on eclipse. this php.ini xdebug configuration: [xdebug] zend_extension = "c:\xampp\php\ext\php_xdebug-2.2.6-5.6-vc11.dll" xdebug.remote_enable = on xdebug.remote_host = "localhost:8080" xdebug.remote_port=9000 xdebug.remote_handler = dbgp xdebug.idekey=eclipse_dbgp xdebug.remote_log=/tmp/xdebug.log the run configuration works fine, when try debug, shows: launcing <debug configurazion name> : (57%) and in internal web browser shows me empty page. how can salve issue??? thanks in avance yes, solved in way: first changed file windows>system32>drivers>etc>hosts , added line 127.0.0.1 local.test.it secondly, changed configuration of server configuration @ windows>preferences>php>debug. go server settings area , click "php servers">new , following changes: name: server name debugger: xdebug base url: local.test.it:your_port. now works fine. i hope helpful

java - FATAL EXCEPTION: main - Android -

could guys me error? game ready publish, no errors in eclipse running on desktop, no notices, project cleaned many times, refuses launch on phones or android application through eclipse fatal exception. android manifest file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.omnicubegames.onemorejump" android:versioncode="0098" android:versionname="0.0.9.8" > <uses-sdk android:minsdkversion="9" android:targetsdkversion="19" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.wake_lock" /> <application and

android - imageView clickable and scrollable -

i want able click , scroll image view happened whenever touch image view , perform "action move" not scroll perform "click event" instead! want able both meaning when touch , move should scroll when touch should perform click! in advance this have done imageview ivuser = (imageview) findviewbyid(r.id.ivuser); ivuser.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub intent intent = new intent(storydetails.this, profileview.class); intent.putextra("id", usersid); log.d("ivuser attempt", usersid); startactivity(intent); } }); i implemented "ontouch listener" code below don't have idea next! ivpost.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { switch (event.getaction()) {

date - How to do a greater than or equal to with moments (moment.js) in javascript? -

basically, want mymoment >= yourmoment . there no mymoment.issameorafter , writing out combining issame , .isafter bit lengthy. what's alternative? convert moment js date , use >= compare? you can use issameorafter method in momentjs: moment1.issameorafter(moment2);

R - mean function warning 'argument is not numeric or logical' -

having problem in r. following works fine na.omit(data)["ozone" > 31 | "temp" > 90]["solar.r"] and returns solar.r 1 190 2 118 3 149 4 313 7 299 8 99 9 19 12 256 13 290 14 274 15 65 16 334 17 307 18 78 however, if pass mean function mean(na.omit(data)["ozone" > 31 | "temp" > 90]["solar.r"]) the result is, well, not nice (pun!) [1] na warning message: in mean.default(na.omit(data)["ozone" > 31 | "temp" > 90]["solar.r"]) : argument not numeric or logical: returning na any idea going wrong? puns more welcome!

java - libgdx AssetManager.finishLoading() not working -

i've tried implement assetmanager project. can't figure out i'm doing wrong assetmanager. i've googled, , tried different things. seems no 1 else have ever experienced kind of problem assetmanager. used .finisloading(), afterwards if ask .isloaded says hasn't been loaded. the wiki tutorial here says manager.load("data/mytexture.png", texture.class); .... manager.finishloading(); ... texture tex = manager.get("data/mytexture.png", texture.class); i have code // fullfile e.g. "d:\\folder\\subfolder\\subsubfolder\\jpg.jpg" if (!new filehandle(fullfile).exists()) { system.err.printf("invalid file \"%s\"\n",fullfile); system.exit(1); } if (!manager.isloaded(fullfile,texture.class)) manager.load(fullfile,texture.class); manager.finishloading(); if (!manager.isloaded(fullfile,texture.class)) { return = new sprite(new texture("d:\\folder\\subfolder\\subsubfolder\\p

sending HTML emails in Apple Mail from Safari not working in Yosemite -

i'm graphic designer , spend hours every day designing html emails various clients. code built in dreamweaver , images stored on server. send tests of these campaigns myself , clients i've relied on following process @ least last 8 years: open html file in safari type ⌘i (file > share > email page) mail opens , new email created html file displayed in it's graphical glory select recipient , hit send 4. with yosemite, process broken @ step 3. instead, mail displays blank email no content. i've tried getting around moving html file server, mail overriding of html, namely image dimensions specified in both <td> , <img> tags. i've been searching past few months solution. else using same work flow seeing problem? or know of option sending html emails mail? using yosemite 10.10.1, safari 8.0, mail 8.1 after step 1, in safari hit cmd+a (select all), cmd+c (copy) go mail, hit cmd+v (paste)

android - my map app stops unexpectedly -

i'm new android. i'm working on app using google map. after several test, have same problem : app stops unexpectedly. i present code. the manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.map_project" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="10" android:targetsdkversion="21" /> <permission android:name="com.map_project.permission.maps_receive" android:protectionlevel="signature" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <uses-permission android:name="com.map_project.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permissi

ios - iOS8 localization can't fallback to English -

my app support english , chinese, bug when install on ios8 system language france, localization can not fallback english, choose chinese. i tested on ios7 , ios8.1, ios7 correctly fallback english, ios8.1 can't that. is there setting ios8 choose fallback language? this determined device. if go settings:general:language&region, you'll se there preferred language order. update english preferred language , should work right.

javascript - AngularJS ng-repeat key-value pairs to directive -

i have following html: <p data-ng-repeat="(aname, arating) in content.ratings"> <div star-directive rating="arating"></div> </p> arating object. directive picks "arating" text rating variable. what directive have able use arating object? attrs.rating expression string set attribute. can evaluate against scope scope.$eval() . angular.module('your-module') .directive('stardirective', function() { return { restrict: 'a', scope: false, link: function(scope, element, attrs) { var ratingexpression = attrs.rating; var rating = scope.$eval(attrs.rating); // rating. } } }); scope: false default value, means directive not create new scope , shares scope parent. however, above directive won't know when arating updated. if want update directive arating changes, can use isolate scope , data binding. angular.module('your-module') .directi

javascript - D3 bar graph X-ticks not aligning -

i making bar graph using d3 when plot bar graph x-ticks not aligning under bars. think i'm not transforming bars properly. used following example http://bost.ocks.org/mike/bar/ , have been able create bar graph. appreciated. thank in advance. <!doctype html> <meta charset="utf-8"> <style> .bar { fill: steelblue; } .bar:hover { fill: brown; } .axis { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispedges; } .x.axis path { display: none; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script> var data = [277, 407, 422, 279, 680, 485, 1624, 729, 327, 425, 205, 236]; var margin = {top: 30, right: 30, bottom: 30, left: 30}, width = 480 - margin.left - margin.right, height = 340 - margin.top - margin.bottom; var labels = [ {"key": "ws1"},{"key&