Posts

Showing posts from May, 2014

javascript - Issues with CORS, Jquery and Coldfusion. Headers -

i using following code handle jquery stuff: var data = $('#loginform').serialize(); alert(data); $.ajax({ url: 'https://devport.mywebsite.com/login.cfm?method=login', crossdomain: true, type: "post", data: data, cache: false, beforesend: function (xhr) { xhr.setrequestheader("access-control-allow-origin", "*"); }, success: function (data) { alert(data); }, error: function (xhr, teststatus, error) { alert(teststatus + " " + error); } }); it time going error, not sure why problem is. error is: sec7123: request header access-control-allow-origin not present in access-control-allow-headers list. script7002: xmlhttprequest: network error 0x80070005, access denied. the coldfusion side this: <cfcontent type='text/html; charset=utf-8'> <cfheader name="access-control-allow-origin" value="*"> <cfheader name="acc

javascript - How to render multiple HighCharts using a queue to prevent long load times -

i using mvc razor foreach render charts, on 150. this how generate script: @{chartcount = 0;} @foreach (var item in model.chartrows.where(m => !m.summaryrow)) { $('#container_@(chartcount)').highcharts({ //code removed brevity }); chartcount++; } and in html use render containers: @for (int = 0; < chartcount; i++) { <div id="container_@(i)"></div><br /> } however, when there 100's of items in chartrows , page can take long time load before of charts appear. have taken on highcharts website , have found chart type called " sparkline " , jsfiddle example shows way rendering can delayed using settimout rendering them in "chunks". for me make work way need, have remove of data script (or @ least being populated item. ) , instead add 7+ data attributes onto each of html containers , use jquery data attributes populate chart data. i'm not

c++ - Is using "this" in contructor's initialization list specificly dangerous with Qt? -

i need reliable information "this" subject: class myclass, public qwidget { public: myclass( qwidget * parent = null ) :qwidget( parent ), mpanotherwidget( new qwidget( ) ){}; private: qwidget * mpanotherwidget; }; of course, calling virtual functions in contructor or initialization list bad idea. question is: can code mpanotherwidget( new qwidget( ) ) lead undefined behavior?! , if so: why ? please quote sources if can! thanks! it depends on qwidget pointer given. fine pass around reference or pointer half-constructed object long called code not access underlying object. need documentation of qwidget know whether touches object or stores pointer. in particular case of qt, reading documentation, calling constructor of qwidget , argument of type qwidget* , , this used cast base pointer. obtaining pointer base guaranteed in 12.7/3 requirement conversion the construction of x , construction of of direct or indirect bases

javascript - Nested loops in Knockout.js with if:clause -

i having problem nested foreach statements in ko. the following statements work fine on own when combine them inner 1 doesn't work , doesn't throw error either. ideally inner join conditional have tried without if clause , still no luck. experts have property array of expertroles assigned particular user. outer loop meant print expertroles , inner loop meant print experts match expert role of outer loop 1st foreach: works <ul data-bind="foreach: expertroles"> <li class="expert ui-menu-item" role="menuitem" data-bind="attr: { 'data-cid': id }, text: name"> </li> </ul> 2nd foreach: works <ul data-bind="foreach: experts"> <li class="expert ui-menu-item" role="menuitem" data-bind="attr: { 'data-cid': connectionid, 'title': username }"> <a href="javascript:void(0);" data-bind="text:

android - JSON and location distance calculate -

i planning this. first device location , info json. json includes latitude , longitude. after, calculate every items distance device. if less x number show in list view. have used use json parsing , list view basic. and here code location calculate location locationa = new location("point a"); locationa.setlatitude(lata); locationa.setlongitude(lnga); location locationb = new location("point b"); locationb.setlatitude(latb); locationb.setlongitude(lngb); float distance = locationa.distanceto(locationb); i use code. i think this. json items. before on list check distance if lover x put in list else return getting json item i need codes it. so have code calculate distance 2 points coordinates? make web page. can save coordinates database, when have phone position can take coordinates near position (like filter). after can use code check witch coordinates inside range x , put class contain coordinates. your coordinates class: p

meteor - How to update a collection on jQuery (drag and) drop -

i'm building meteor app let's user organize lists of items in tags. i use jquery draggable , droppable update collection when user drags item 1 tag another. i find hard understand how/where/when should call function. i've tried few different options (including this "hacky way of doing it". the blaze documentation mentions functions can called on dom events, lacks drag , drop events i'm looking for. i've settled on calling function under template.rendered, means item can dropped once per render. i've tried counter tracker.autorun, don't think understand how works , item can still dropped once per render. how can make .item draggable several times per render? template.tag.rendered = function () { //wait on subscriptions load if (session.get('data_loaded')) { tracker.autorun(function () { $(".item").draggable({ revert: true, start: function (event, ui) { var movingitem = blaze.g

google app engine - gcloud is stuck when trying to ssh to the virtual machine -

i running terminal. until yesterday, worked. gcloud compute --project my_project ssh --zone us-central1-a server_name no it's stuck no error message hours. have installed docker , boot2docker yesterday , it's possibly connected that. tried uninstalling docker still no luck.

json - Pass dynamic values to rest easy web service in java -

my web service in net beans , want pass dynamic values method android studio my json url : http://192.168.1.31:8084/adminwebservice/mywebservice/showselectedcategory/bar my webservice class is: @get @path("/showselectedcategory/{strrestrotypes}") @produces(mediatype.application_json) public list<categorytypes> showselectedcategory(@pathparam("strrestrotypes")string[] strrestrotypes) { } my entity file contains @xmlrootelement(name="restaurant") @xmltype(proporder = {"restroid","restroname"}) public class restauranttypes { private int restroid; private string restroname; //getter , setter } through code can pass 1 parameter, , not more in advance , suggestions

python - How to import a module given the full path? -

how can load python module given full path? note file can anywhere in filesystem, configuration option. for python 3.5+ use: import importlib.util spec = importlib.util.spec_from_file_location("module.name", "/path/to/file.py") foo = importlib.util.module_from_spec(spec) spec.loader.exec_module(foo) foo.myclass() for python 3.3 , 3.4 use: from importlib.machinery import sourcefileloader foo = sourcefileloader("module.name", "/path/to/file.py").load_module() foo.myclass() (although has been deprecated in python 3.4.) python 2 use: import imp foo = imp.load_source('module.name', '/path/to/file.py') foo.myclass() there equivalent convenience functions compiled python files , dlls. see also. http://bugs.python.org/issue21436 .

cookies in smarty tpl(probably syntax errors) -

i got code: ... {assign var="name" value="some_value"} {if $smarty.cookies.$name eq 'joc' } {assign var="test" value="`$product.total - 20`"} {assign var="test2" value="`$product.total_wt - 20`"} {assign var="var2" value="$smarty.cookies.$name"} {else} {assign var="test" value="`$product.total`"} {assign var="test2" value="`$product.total_wt`"} {/if} ... please me fix errors , make code work. i'm newbie smarty syntax. var2 empty, "if" condition return false try adding <pre>{$smarty.cookies|@print_r}</pre> template. debug why if condition not being met. may not have set cookie correctly in first place. alternatively try http://www.smarty.net/docsv2/en/chapter.debugging.console.tpl investigate smarty variables state.

javascript - Salesforce API insert adds special characters -

i using salesforce php toolkit in order insert values of javascript functions (just in order document functions using, not execution in salesforce) inside custom object have. in php function saving string like: (function(d,f){var b={src:(d.location.protocol=="https:"?"https:":"http:")... after insert string using sf api, result see in field is: (function(d,f){var b={src:(d.location.protocol==&quot;https:&quot;?&quot;... as can see, salesforce has added special characters string. haven't found anyway pass that. any idea's? the solution remove htmlspecialchars string. didn't think sf accept string without because not echo string without (due special characters in string). seems pass parameter without issue. i'd happy understand if understands.

android - Unable to open symbol file. Error (20): Not a directory -

i using ffmpeg library on android stream live video feed. have complied ffmpeg android following roman10 instructions . application working correctly - connects server, download feed, transcode it, rescale , displays on device's screen. after random moment app crashes fatal signal 11 (sigsegv), code 1 . have used ndk-stack find source of problem. here crash dump: ********** crash dump: ********** build fingerprint: 'google/hammerhead/hammerhead:5.0.1/lrx22c/1602158:user/release-keys' pid: 25241, tid: 25317, name: asynctask #5 >>> com.grzebyk.streamapp <<< signal 11 (sigsegv), code 1 (segv_maperr), fault addr 0x98e74c9c stack frame #00 pc 00047924 /data/app/com.grzebyk.streamapp-1/lib/arm/libswscale-3.so: unable open symbol file /users/grzebyk/documents/new_eclipse_projects/streamapp/libs/armeabi/libstreamapp.so/libswscale-3.so. error (20): not directory stack frame #01 pc 00034be8 /data/app/com.grzebyk.streamapp-1/lib/arm/libswscale-3.so (sws_sca

c# - WebApi Controller: Accessing database more than once, using Controller's own method? -

i writing a, let's say, nodecontroller project of mine. linked database, , of methods take id node access in ef database. node can have dependency on node, meaning that, if want to, say, "execute" 1 node, must check whether dependency-node has been executed or not, , fail, if not dependencies have been executed. i present partial versions of 2 of methods, whereas 1 uses other, first, there our controller's constructor, mentioned later on: private readonly nodedbcontext _context; public nodecontroller() { _context = new nodedbcontext(); } is correct way use dbcontext, or should limit ourselves using "using" statements whenever perform database-related (getting or putting, in our case)? [responsetype(typeof(bool))] [httpget] [route("node/{id}/executed")] public async task<ihttpactionresult> executed(int id) { var node = await nodecontrollerhelper.getnode(_context, id); if (node == null) return badrequest("there no

How to load the data in index page using spring mvc? -

i tried couple of tutorial in spring-mvc load data in index page without using ajax call means before loading index page want data server , load data index page.but did not proper answer. finally after couple of try got answer.here code. web.xml <display-name>springtest</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring-servlet.xml</param-value> </contex

javascript - Google organisational charts: styling with multiple attributes -

i'm using google organisational charts , can set 1 property data.setrowproperty(3, 'style', 'border: 1px solid green'); however want change background putting in more 1 attribute not working me data.setrowproperty(0, 'style', 'background-color:red; border: 1px solid green'); does know if can done? is issue can't set multiple or can't set background-color? if apply code example in [documentation][1] both styles added background-color isn't used because setting background default. google.setonloadcallback(drawchart); function drawchart() { var data = new google.visualization.datatable(); data.addcolumn('string', 'name'); data.addcolumn('string', 'manager'); data.addcolumn('string', 'tooltip'); data.addrows([ [{v:'mike', f:'mike<div style="color:red; font-style:italic"&g

c# - How To Determine Which Version of Excel last saved a Workbook -

this question has answer here: how can check version of excel files in c#? 3 answers i have excel files (.xls) being automatically generated system, , distributing these files users , edit fields in , send me. need know each file sent me version of excel using (is office 2003, 2007, 2010, 2013...?) because want know lowest versions need keed support for. is there way take these files , excel version saved each 1 of them ? i tried solution programmatically finding excel file's excel version didn't it... i believe looking for, @ least worked fine application. var excelwb = new oledocumentpropertiesclass(); excelwb.open(filepath, false, dsofileopenoptions.dsooptiondefault); string fileusedversion = excelwb.summaryproperties.version.tostring(); greetings

Java: memory efficient storing of arrays of integers -

premise : problem might known, , might using wrong wording, please refer me elsewhere if case. quick problem overview : have store high number of arrays of integers in order avoid duplication. doing following: linkedlist<int[]> arraysalreadyused; upon using array, add list. before using array see if in list. since need use many high dimensional arrays run memory issues. question : good/the best way of doing in order minimize amount of memory occupied? there way represent such arrays hash string? , better? it may make sense create wrapper implements equals , hashcode can place arrays in set o(1) contains / add . like: public class intarray { private final int[] array; private final int hash; public intarray(int[] array) { this.array = array; this.hash = arrays.hashcode(this.array); //cache hashcode better performance } @override public int hashcode() { return hash; } @override public boolean equals(object obj) { if (ob

python - Scikit-learn installed but not found, -

i have installed scipy, numpy , scikit-learn when i'm on python shell can't import sklearn, says there's no module name: requirement up-to-date: numpy in .../lib/python2.7/site-packages requirement up-to-date: scipy in .../site-packages requirement up-to-date: scikit-learn in ...7/site-packages >>> import sklearn traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named sklearn what problem?

asp.net mvc - Update Razor variable in foreach using button click -

okay, after lot of searching around haven't found answer problem. working on page who's main purpose display articles on main page. i got code down display articles, want display 6 first articles in foreach , user can chose increase display count 6 each time he/she clicks "show more articles" button. i using @foreach (var item in model.take(displayedarticles)) , var displayedarticles = 6; is there way user increase counter clicking "show more" button? having issues. my current code: <div class="container-fluid"> <h2 class="page-header">index</h2> @{ var displayedarticles = 6; } @foreach (var item in model.take(displayedarticles)) { <div class="col-lg-4"> <h2>@html.displayfor(modelitem => item.title) </h2> <div id="textcontent"> @html.displayfor(modelitem => item.content) </div> </div> } <div cl

ruby on rails - How save multiselect values to database -

how can add values string field in database multiple select. i have field in database: t.string "types" and view: <%= f.select :order, [["one", 1], ["two", 2], ["three", 3]], {}, { :class => 'form-control', :multiple => true } %> maybe serialize or json goot idea? possible save , simple way read this? you can use rails serialize on column: serialize :order, hash or json (depending want it): serialize :order, json however, columns needs of type 'text' not 'string' serialize work, sure create migration change column type. rails g migration change_order_type_in_table_name class changeordertypeintablename < activerecord::migration def change_column :my_table, :order, :text end def down change_column :my_table, :order, :string end end

php - Inconsistent strtotime conversions -

when doing conversion on date using strtotime, i'm getting inconsistent results. array[0] holds date converted: original -> converted -> converted array ([0] => 30.01.15) -> 1422576000 -> gmt: fri, 30 jan 2015 00:00:00 gmt array ([0] => 23.01.15) -> 1427925675 -> gmt: wed, 01 apr 2015 22:01:15 gmt when using dashes, instead of dots, get: array ([0] => 30-01-15) -> 1894665600 -> gmt: tue, 15 jan 2030 00:00:00 gmt array ([0] => 23-01-15) -> 1673740800 -> gmt: sun, 15 jan 2023 00:00:00 gmt it works in first instance, using dots, in second using dots todays date? ideas might causing inconsistency? according php manual, date , time must provided in supported date/time format: http://php.net/manual/en/datetime.formats.date.php the "dot" notation not seem supported date values, php tries parse time, here's why got "strange" behaviour. to better explain different behave: in first run 30 cannot int

php - Basic SQL query design issue -

i'm trying create query equivelant of (does not work). select * `categories` c , select * `items` , select count(i.id) items , select sum(i.price) price; i not using sqlserver, , i'm using pdo through php database connectivity. here's tables. category +----+------------+ | id | category | +----+------------+ | 1 | first_cat | | 2 | second_cat | +----+------------+ items +----+----------+------+-------+ | id | category | name | price | +----+----------+------+-------+ | 1 | 1 | foo | 1.99 | | 2 | 1 | bar | 2.00 | | 3 | 2 | oof | 0.99 | | 4 | 2 | rab | 1.99 | +----+----------+------+-------+ based on these tables expecting these query results: +----+------------+-------+-------+--+ | id | category | items | price | | +----+------------+-------+-------+--+ | 1 | first_cat | 2 | 3.99 | | | 2 | second_cat | 2 | 2.98 | | +----+------------+-------+-------+--+ any help? the query have

sql - What effect has a grant command when no schema is specified -

basically tried grant permissions schemas in database user have created before so use mydatabase go grant insert, select, execute, delete myuser -- note no schema specified go now, effect quite confusing. according ssms myuser has follwing effective permissions on mydatabase : connect, delete, execute, insert, select. however, doesn't seem have rights on schema. question is, effect of grant above , there way grant permissions on every schema in database (sth. wildcard)? you can find out permissions granted using following query: select d.*, object_name(major_id) objectname, schema_name(major_id) schemaname sys.database_permissions d inner join sys.database_principals u on d.grantee_principal_id=u.principal_id u.name='myuser' in case, permissions granted on entire database, same thing granting permisions on each schema.

Git does not delete folders after merge -

suppose have repository branches , b, stemming same origin. switch branch , delete directories. directories contain files. commit , switch branch b, directories not deleted yet. so, merge b don't see folders being removed in branch b. rather have weird situations half-deleted folders , self-restoring folders. so, how correctly commit , merge deletions main development branch?

nest - _id is not getting autogenerated in Elasticsearch -

i have simple list of documents of type salesorder. while inserting them elastic search, _id taking value of salesorderid. need autogenerated. below class public class salesorder { [xmlelement("id")] public long salesorderid { get; set; } public long customerid { get; set; } public datetime? bookeddate { get; set; } public long salesorderno { get; set; } } this how inserting docs in elastic search elasticclient elasticclient = createelasticclient(indexname); if (!elasticclient.indexexists(i => i.index(indexname)).exists) { elasticclient.createindex(indexname, s => s.addmapping<t>(m => m .mapfromattributes())); } // create indexes var response = elasticclient.indexmany<t>(documents); you can specify id field es use this: [elastictype(name = "salesorder", idproperty =

powershell - Parsing robocopy log file to PSCustomObject -

i'm trying create pscustomobject robocopy log file. first piece pretty easy i'm struggling $footer part. can't seem find way split values. it nice if every entry has it's own property , it's possible use example $total.dirs or $skipped.dirs . thinking import-csv , because that's great on how allows have column headers. doesn't seem fit here. there's solution found here seems bit of overkill. code: function convertfrom-robocopylog { param ( [parameter(mandatory=$true,valuefrompipelinebypropertyname=$true,position=0)] [string]$logfile ) process { $header = get-content $logfile | select -first 10 $footer = get-content $logfile | select -last 7 $header | foreach-object { if ($_ -like "*source*") {$source = (($_.split(':'))[1]).trim()} if ($_ -like "*dest*") {$destination = (($_.split(':'))[1]).trim()} } $footer |

java - Spring Data Jpa and Specification - how to work with ManyToOne and ManyToMany relations? -

i have simple model in project. [updatepackage] >- (manytoone) - [version] -< [usecase] - (manytomany) public class updatepackage implements comparable<updatepackage> { @manytoone(fetch = fetchtype.eager, cascade = cascadetype.all) @joincolumn(name = column_orig_version, nullable = true) private version origversion; // setters , getters } @entity @table(name = version.table_name) public class version { @manytomany(fetch = fetchtype.eager, cascade = cascadetype.all) @jointable(name = jvuc_table, joincolumns = { @joincolumn(name = jvuc_column_version, referencedcolumnname = column_id) }, inversejoincolumns = { @joincolumn(name = jvuc_column_usecase, referencedcolumnname = usecase.column_id) }) private final set<usecase> usecases = new hashset<usecase>(); // setters , getters } @entity @table(name = usecase.table_name) public class usecase { @column(name = column_name, nullable = false) private string name; // setters

Dynamic Group Lookup in JBPM -

i have been experimenting different ways of doing dynamic actor , group lookup. implementing custom usergroupcallback. authorization tricky since not conform standard jaas model. each user has role (assistant, administrator, officer); however, role specific department , functionality department. example, can assistant in hr department, have permission use time keeping functionality. in initial experiment, created service task had inputs role, department, , functionality permissions. perform lookup determine users meet criteria , return comma separated string users. save string process variable , set actor list user task #{approvedusers}. approach works, dislike having predefined user list since role permissions change time task acted upon. the next logical step generating dynamic comma separated list of group ids. since group needs single string, concatenated of possible attributes role. using previous example, user's role become 'assistant_hr_timekeeping'. able wor

groovy - How do I log the request and response in soapUI? -

Image
i calling rest based service soapui. have created load test service , test works. wrote following code in setup script load test. log.info("this setup script") def request = context.expand('${#request}') log.info(request) def response = context.expand('${#response}') log.info(response); the item getting in log "this setup script". added following lines of code in teardown script. log.info("teardown script") def response = context.expand('${#response}') log.info(response); i not seeing "teardown script" text in log. @ point bit puzzled behavior. load test: test suite test case options. have unchecked discard ok results test box. what changes need scripts in order log requests , responses? when create setup and/or teardown script, remember run once per run, not per test! intended not going work. in setup, since no tests have run yet, context going empty ... can see log message. in tea

image - Why is saving a picture twice in a row producing different binary in Paint -

i thought little odd. open paint on windows (i'm using windows 7) , draw (anything). save .png example called 1.png. save 'n' number of other copies straight away without modifying image (2.png, 3.png,..etc). i notice 1.png has different checksum 2/3/4/../n.png. 1.png varies in such (sometimes smaller , other times bigger) compared other images. what going on? the difference in filesize due choice of scanline filters used compressor. don't have idea why application use different set of filters when compressing image multiple times, it's harmless. there's no time stamp in 2 images mohammad posted. according "pngcheck -v", difference in content of idat chunk. image signatures computed imagemagick identical. neither image contains time chunk. "pngcrush" produces 2 identical images smaller filesize (11493 bytes). according "pngtest -mv" (pngtest included in libpng distribution), 1 image uses png "none&quo

google maps - Add Two library in android studio -

my application working fine in android studio when added library of google map.showing error. package com.iremember.kiet; import android.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import com.google.android.gms.maps.googlemap; //no error import info.androidhive.slidingmenu.r;// cannot resolve symbol r (when added library of google map) build.gradle apply plugin: 'com.android.application' android { compilesdkversion 18 buildtoolsversion "21.1.2" defaultconfig { applicationid "info.androidhive.slidingmenu" minsdkversion 11 targetsdkversion 17 } buildtypes { debug { debuggable true } release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile

php - CakePHP 2 testing model with no table using mock method for email -

i'm attempting write test model has no table sends email if data passes validation in cakephp 2. to test want assert data passes validation , therefore send email without sending one. attempting create mock method cakeemail. however, test failing because $usedbconfig hasn't defined mock method:- undefined property: mock_mymodel_7a1fb8d0::$usedbconfig i assume issue model not having table, cannot see how resolve it. my model looks (excluding validation rules):- <?php app::uses('cakeemail', 'network/email'); class mymodel extends appmodel { public $usetable = false; public function send($data) { $this->set($data); if ($this->validates() === false) { return false; } else { $email = $this->getemailer(); $email->from($data['mymodel']['email_from']); $email->to($data['mymodel']['email_to']); $email->subjec

c# - HP Fortify - Dead Code stored in Asp.net Temp Files -

is there possible fix dead code identified fortify when scanning asp.net mvc 3 project? code identified "dead' in generated files, stored in asp.net temp files folder. have 173 of these findings showing in our scan results. using version 6.10 of hp fortify scanner, latest rulepacks. i came across article mitigates fortify dead code in mvc. appearantly, out of box fortify scans the mvc website if standard asp.net application. modify fortify properties file open {fortify_install_dir}\core\config\fortify.properties , uncomment following: com.fortify.vs.skipaspprecompilation=true , also, set following property false (default value true). com.fortify.vs.requireaspprecompilation=false build project build project normal in visual studio copy build artifacts copy build artifacts /bin directory @ root of project following location - c:\windows\microsoft.net\framework{frameworkverion}\temporary asp.net files{yourprojectname} project named “yourproject.web” b

python - Move radial tick labels on a polar plot in matplotlib -

Image
from matplotlib examples : import numpy np import seaborn sbs import matplotlib.pyplot plt r = np.arange(0, 3.0, 0.01) theta = 2 * np.pi * r ax = plt.subplot(111, polar=true) ax.plot(theta, r, color='r', linewidth=3) ax.set_rmax(2.0) ax.grid(true) ax.set_title("a line plot on polar axis", va='bottom') plt.show() how move radial tick labels (0.5, 1.0, 1.5, 2.0) different angle, 120 deg? with version 1.4 or later, can use "set_rlabel_position". e.g. place radial ticks long line at, say, 135 degrees: ax.set_rlabel_position(135) the relevant documentation residing here , bit hidden under "projections". adding line above yields (i don't have seaborn has default matplotlib formatting): prior 1.4, ax.set_rgrids can take angle argument.

angularjs - ng-class not working in ng-repeat -

i have ng-class doesn't seem adding class on initial load. looks function working perfectly, , outputting proper boolean, class doesn't add. if toggle value, updates expected. <ul class="gb-talents-tiers"> <li class="clearfix" ng-repeat="tier in guide.tiers()"> <span>{{tier}}</span> <ul class="gb-talents-icons clearfix"> <li ng-repeat="talent in guide.talentsbytier(hero.hero, tier) | orderby: talent.ordernum"> <a href="#" class="talents-icon {{hero.hero.classname}} {{talent.classname}}" ng-class="{ 'tier-selected': guide.hasanytalent(hero, talent), 'active': guide.hastalent(hero, talent) }" ng-click="guide.toggletalent(hero, talent)" hots-talent>{{talent.name}}</a> </li> </ul> </li> </ul> the problem lies with: ng-class="{ 'tier-selected': guide

java - TOMCAT 7, Can't change the heap size -

i have set heap size of tomcat 7 adding boot script: export catalina_opts="-xms1024m -xmx248m" i change /etc/init.d/tomcat7 : if [ -z "$java_opts" ]; java_opts="-djava.awt.headless=true -xmx2048m -xms1024m" fi i reboot computer , restart tomcat: service tomcat7 restart and verify $catalina_opts works: > echo $catalina_opts -xms1024m -xmx2048m but when go tomcat manager, note heap has not changed. free memory: 38.02 mb total memory: 123.75 mb max memory: 123.75 mb please, need this. check setenv.sh in tomcat/bin , according manual should right place put params. another option, depend on os tomcat package, may config param overrided in /etc/conf.d/tomcat/ or /etc/tomcat . check init script , catalina.sh find settings overrided. btw if run ps -ef | grep tomcat should see full command line arguments: may give idea of how init script build command, , can investigate params set.

Why aren't variable-length arrays part of the C++ standard? -

i haven't used c in last few years. when read this question today came across c syntax wasn't familiar with. apparently in c99 following syntax valid: void foo(int n) { int values[n]; //declare variable length array } this seems pretty useful feature. there ever discussion adding c++ standard, , if so, why omitted? some potential reasons: hairy compiler vendors implement incompatible other part of standard functionality can emulated other c++ constructs the c++ standard states array size must constant expression (8.3.4.1). yes, of course realize in toy example 1 use std::vector<int> values(m); , allocates memory heap , not stack. , if want multidimensional array like: void foo(int x, int y, int z) { int values[x][y][z]; // declare variable length array } the vector version becomes pretty clumsy: void foo(int x, int y, int z) { vector< vector< vector<int> > > values( /* painful expression here. */); } the slice

mysql - PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused -

the situation this, trying use php connection connect mysql database on phpmyadmin. nothing fancy connection trying see whether connection successful or not. using mamp host database, connection trying use this: <?php $servername = "127.0.0.1"; $username = "root"; $password = "root"; try { $conn = new pdo("mysql:host=$servername;dbname=appdatabase", $username, $password); // set pdo error mode exception $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); echo "connected successfully"; } catch(pdoexception $e) { echo "connection failed: " . $e->getmessage(); } ?> i have been using postman test see if connection working, keep receiving error message: connection failed: sqlstate[hy000] [2002] connection refused before receiving error message of: connection failed: sqlstate[hy000] [2002] no such file or directory this because had set servername localhost, through cha

c++ - Opencv findcontours CV_RETR_EXTERNAL not working -

i've image: edit sorry had remove images! i need extract contour of non-black picture, used findcontour cv_retr_external parameter, obtain this: here's code: static mat canny_output, grey,draw; vector<vector<point>> contours; cvtcolor(final_img, grey, cv_bgr2gray); canny(grey, canny_output, 100, 200); findcontours(canny_output, contours, cv_retr_external, cv_chain_approx_simple); draw = mat::zeros(canny_output.size(), cv_8uc3); (size_t = 0; < contours.size(); i++) { drawcontours(draw, contours, i, scalar(255, 0, 0)); } how can resolve? simply add binarization minimal threshold, , remove canny: cvtcolor(final_img, grey, cv_bgr2gray); //threshold=1: low value, anyway rest of image pure black threshold(grey, binary, 1, 255, cv_thresh_binary); findcontours(binary, contours, cv_retr_external, cv_chain_approx_simple);

python - Deploying Django to AWS - WSGIPath refers to a file that does not exist -

i've been struggling getting django , aws work together. i'm following tutorial here: https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/ i've been following tutorial steps, including using "eb option" command change wsgipath, keep getting error: "error: wsgipath refers file not exist." as far can tell i've been doing according tutorial. the relevant part of config file looks this: numprocesses: '1' numthreads: '15' staticfiles: /static/=static/ wsgipath: iotd/iotd/wsgi.py what doing wrong? i have read realpython blog post referred to. refer aws tutorial. written deployment of bare bones django project , can found at: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-configure-for-eb i found useful work through, , learned great deal fixing error have identified. of course fix related own implementation of tutorial, followe

php - Wordpress - WP_Query, pulling in multiple post -

somewhat new wordpress , php , trying work though issue. have page ( http://www.moderateindividual.com.php53-13.dfw1-1.websitetestlink.com/ ) , twards bottom can see section 6 images, need pulled in custom post type custom taxonomy. have pulling in 1 post on , over, how make pull in 6 latest post in category? here code have far <?php //define custom post type name in arguments $args = array( 'post_type' => 'news', 'tax_query' => array( array( 'taxonomy' => 'news_category', 'field' => 'id', 'terms' => '47', ), ), ); //define loop based on arguments $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="st_views"> <div class="tab-1 st_view"> <div class="st_view_inner"> <div c

javascript - How to focus fist input field in the active navigation tab in angular bootstrap ui? -

how focus fist input field in active tab? next tab becomes active programmatically, after activates first input has selected. using angular js bootstrap ui i have had todo sounds same. to change tab <button class="btn btn-default btn-sm" ng-click="tabs[0].active = true">select second tab</button> from https://angular-ui.github.io/bootstrap/#/tabs if static html5 attribute may work <input type="text" name="fname" autofocus> mine dynamic did (and, dident know html5 thing when did this) .factory('focus', function($timeout) { return function(id) { $timeout(function() { var element = document.getelementbyid(id); if (element) element.focus(); }); }; }) and call code, had todo had code change made showup.

Cordova : [Error: Please install Android target: "android-21" -

i updated cordova + ionic in app, after installed android-sdk v22 via android sdk manager. but after running command: cordova build android i following message: running command: /users/peter/workspace/myapp/platforms/android/cordova/build [error: please install android target: "android-21". hint: open sdk manager running: /users/peter/adt-bundle-mac/sdk/tools/android require: 1. "sdk platform" android-21 2. "android sdk platform-tools (latest) 3. "android sdk build-tools" (latest)] error building 1 of platforms: error: /users/peter/workspace/myapp/platforms/android/cordova/build: command failed exit code 2 may not have required environment or os build project error: /users/peter/workspace/myapp/platforms/android/cordova/build: command failed exit code 2 @ childprocess.whendone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) @ childprocess.emit (events.js:110:17) @ maybeclose (c

html - how to make one div scrollable out of 2 or more div -

i have 3 div tags , want make 1 div (of 3) scrollable i have tried overflow:"auto" in div want make scrollable , overflow:"hidden" in div tags don't want make scrollable . not working. should fix size of div following 2 div don't want make scrollable <div class="span4" style="overflow:hidden"> ... <\div> <div class="span4" style="overflow:hidden"> ... <\div> and following div want make scrollable <div class="span4" style="overflow:auto"> ... <\div> try overflow: scroll or overflow-y: scroll explicit

c# - Programatically enable RichTextBox and show caret -

for application working on, have usercontrol added form programatically several times. part of usercontrol richtextbox set transparent , has click functionality disabled acts more label , blends user control. when user control deliberately clicked user, richtextbox's background changed white, isreadonly set false, , clicking enabled. the problem trying correct user still has click on richtextbox second time enable caret prior typing. googling , code attempts programatically set caret haven't worked. suggestions why below code isn't working? there else need do? contentbox.ishittestvisible = true; contentbox.background = new solidcolorbrush(color.fromrgb(240, 240, 240)); contentbox.isreadonly = false; //manage caret position textpointer newpointer = contentbox.caretposition; newpointer = newpointer.documentend; contentbox.caretposition = newpointer; i think missing setting logical , keyboard focus control afterwards. try dispatcher.begininvoke(

activemq - Active mq fail-over transport produce memory leak -

i using active mq fail-over transport configuration (master only) in spring web based application. version 5.8.0 after period of producing/consuming messages, out-of-memory occurs. transaction mode enabled. session commit or rollback invoked properly. memory analizer shows leak suspect: one instance of "org.apache.activemq.transport.failover.failovertransport" loaded "sun.misc.launcher$appclassloader @ 0xfc0e9a40" occupies 28,711,384 (46.09%) bytes. memory accumulated in 1 instance of "java.util.concurrent.concurrenthashmap$node[]" loaded "". any ideas. in advance

sql server 2008 - SQL generating multiple count columns -

i have developed sql generate statistics on our local tickets database table (sql server 2008). can see code, want select tickets, joining group group name, grouping group code year/month. i want create totals (counts) how many tickets open, closed, closed outside of sla (past due date), , sla%. this code works, i'm not happy having code nested (select counts); seems not strategy multiple re-scans. is there better design generating multiple "counts" columns single select on table ... or standard approach? select g.group_name [group], year(tm.date_open) year, month(tm.date_open) month, count(*) [tickets opened], (select count(*) tickets tm2 tm2.group_code = tm.group_code , year(tm2.completion_date) = year(tm.date_open) , month(tm2.completion_date) = month(tm.date_open) ) [tickets closed], (select count(*) tickets tm2 tm2.group_code = tm.group_code

php - Symfony doctrine ManyToMany insert -

i 'm having form on can create new "book". book, can add tags (e.g. describe additional information it). the relation between book , tag manytomany, because each book can have many tags, , each tag can rely different books. (each tag unique field on name). so, when user enters new tag book not exists in database, want create tag when submitting. if exists, want add tag book. i've tried following: $book = $this->form->getdata(); foreach ($tags $tag) { $tag = strtolower($tag); // check if tag exists $tagentity = $this->em->getrepository('bookbundle:tag')->findbyname($tag); // if not, create new tag , add if(null === $tagentity) { $tagentity = new tag(); $tagentity->setname($tag); } // add tag book $book->addtag($tagentity); // add book tag $tagentity->addbook($book); // create relation between tag , book $this->em->persist($book); $this->em->persist($tagentity); $this->