Posts

Showing posts from March, 2012

javascript - mesureText() returning big number -

Image
in app user can dynamically add either text or image input bar. text inside span element. after images , text added, user can click button add canvas. when adding text canvas use measuretext() texts width can place nicely beside image. but when use it, returns huge number that's same no matter how big text (303 px). causing this? if (divel){ ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.imagesmoothingenabled = false; for(var n=0; n<imgdiv.children.length; n++){ if (imgdiv.children[n].nodename === "img"){ ctx.drawimage(imgdiv.children[n], prevx ,0) prevx += imgdiv.children[n].width console.log(imgdiv.children[n].width) } else if(imgdiv.children[n].nodename === "span"){ ctx.font = window.getcomputedstyle(spanel[0]).fontsize + " open sans" ctx.filltex

language lawyer - Accessing base class members with incorrect downcast in C++ -

is following c++ code correct? struct base { int x; }; struct derived : base { int y; } base * b = new base; derived * d = static_cast<derived *>(b); //below access d->x, not d->y std::cout << d->x; if not, wrong? c++ standard this? @ least have not seen ever crashed. this reasonably straightforward in [expr.static.cast]/11 (emphasis mine): a prvalue of type “pointer cv1 b”, b class type, can converted prvalue of type “pointer cv2 d”, d class derived b , if cv2 same cv-qualification as, or greater cv-qualification than, cv1. if b virtual base class of d or base class of virtual base class of d, or if no valid standard conversion “pointer d” “pointer b” exists ([conv.ptr]), program ill-formed. null pointer value converted null pointer value of destination type. if prvalue of type “pointer cv1 b” points b subobject of object of type d, resulting pointer points enclosing object of type d. otherwise, behavior undefined. you don't have subo

java - Why is the money representation not typesafe? -

what design decision why monetaryamount not parameterized on currency ? if have had monetaryamount<usd> compiler disallow when try add monetaryamount<eur> - increase robust typing capabilities of api , pleasantness of usage overall. i know entail have defined class usd extending interface currency - api can package iso currencies along crypto-currencies. if user not have pre-defined currency new 1 can defined implementing interface. thoughts? edit ok, tone of comments not pleasant see. asker, not claiming smarter library designers. in fact, likes library much. asker pretty sure designers have tinkered idea of using generics on money put off reasons. "reasons", asker wants know - learn something.

javascript - Creating dynamic link with ui-sref inserting with highcharts -

i'm trying create category xaxis acts links other areas of app. want avoid using href because reload everything. have core of problem down, think. labels: { formatter: function () { let newvar = $compile(`<a class="link">${this.value} - ${vm.tabledata.contentmain[this.pos].bothneeded} - ${vm.tabledata.contentmain[this.pos].percentagecompleted}</a> - `)($scope) return angular.element(newvar[0]); }, usehtml: true } my problem [object object] shows on page instead of link. believe need compile in order ui-sref work, why there. creating these dynamic links appreciated! i running angular 1.6 in case matters update hopefully misunderstanding how $compile works. here bad, non-working example outside of highcharts http://jsfiddle.net/hb7lu/31241/ from highcharts docs formatter returns string. have nothing it. $compile generated dom element has been regestered digest cycle. not out case. however can generate str

string - how to summary the historical data based on the same ID in R -

i have data: id |result -------- 1 | ------- 1 | b ------- 1 | c ------- 2 | e ------- 2 | f ------- 2 | g the dataframe want listed below: id |result|history ------------------- 1 | | ------------------- 1 | b | ------------------ 1 | c | a,b ------------------ 2 | e | ------------------ 2 | f | e ----------------- 2 | g | e,f i tried use lag in r. however, doesn't work one. can help? df$history = unlist(tapply(x = df$result, index = df$id, function(a) c("", reduce(function(x, y) {paste(x, y, sep = ", ")}, head(a, -1), accumulate = true)))) df # id result history #1 1 #2 1 b #3 1 c a, b #4 2 e #5 2 f e #6 2 g e, f data df = structure(list(id = c(1l, 1l, 1l, 2l, 2l, 2l), result = c("a", "b", "c", "e", "f", "g")), .names = c("id&

What strategy should I use to copy a git branch from one repo into a branch of another repo? -

i have git branch need copy 1 repository branch within repository. from: repo_a branch: develop top: repo_b branch: whatever i cannot mirror repo_a repo_b repo_b has restrictions on commits, must go branch, approved others, , merged master branch. what best way go doing this? should clone repo_a, checkout branch 'develop', create branch on repo_b , copy contents of 'develop' new branch , push changes? or there better strategy? you add other remote can call repo_a on local git, pull repo_a new branch can call branch_repo_a, make new branch branch want merge let's in repo_b have branch dev checkout new branch repo_b/dev can call dev_a_b (do new branch repo_b in case somenthing goes wrong merge) then merge in dev_a_b git merge branch_repo_a and there have code merge, did not ask merge suggestion, :)

visual studio - Windows 10 app using angular and cordova -

i'm trying create windows 10 app angular project. first time using it. i'm using visual studio 2017 cordova tools. project generated contains www folder. after building angular project, removed files inside , moved dist contents www folder. then tried build , run project within visual studio local machine windows-64. works fine now, build success , run well. generates white screen after splashscreen in output console have : exception thrown @ line 1, column 25606 in ms-appx-web://.../www/scripts/vendor.71fa8c15.js 0x800a139e - javascript runtime error: syntaxerror exception thrown @ line 1, column 26118 in ms-appx-web://.../www/scripts/vendor.71fa8c15.js 0x800a139e - javascript runtime error: syntaxerror i'm new , know if i'm missing 1 step or else. there different windows 10 application ? by way, if build android or ios works

javascript - When to use atob, encodeURIComponent and btoa, decodeURIComponent -

when use atob, encodeuricomponent, btoa, decodeuricomponent. suppose used i.e., atob(encodeuricomponent(...))? if not, when atob&btoa used , when encodeuricomponent&decodeuricomponent used. btoa() encodes string of binary data in base-64 format. common use of creating data: uri contents of file (e.g. turning jpeg or gif file data: uri incorporate directly page instead of referencing remote file). atob() performs opposite: given base-64 string, returns binary data. encodeuricomponent() used perform url-encoding of strings used in uri. converts characters have special meaning in uris % followed hex encoding, e.g. space becomes %20 . used when creating url parameters used in redirects or ajax requests, or data sent in xmlhttprequest.send() . decodeuricomponent() performs reverse of encodeuricomponent() , if have "foo%20bar" return "foo bar" . it's pretty rare need use both url-encoding , base-64 same string.

python - How to change the background color in PyQt4 -

i new pyqt4(just learned 2 days ago) , know question has easy answer can't find anywhere. trying change background color of window black. have code far. import sys pyqt4 import qtgui class display(qtgui.qmainwindow): def __init__(self): super(display, self).__init__() self.showfullscreen() self.show() if name == '__main__': app = qtgui.qapplication(sys.argv) gui = display() sys.exit(app.exec()) when run white window. there method run change black? you can set stylesheet window. self.showfullscreen() self.setstylesheet("background-color: black;") reference stylesheet reference

css - Apply styles to _root based on JSON object -

this json object. { "group": "+display", "name": "card skin", "description": "wraps article in card skin.", "hidden": false, "id": "skintoggle", "required": true, "fieldtype": "boolean", "defaultvalue": false }, what i'd have happen style below applied when card-skin object selected. _root { padding: 0; } ====================== i know <c:if test="${custom.skintoggle eq true}"> <c:set var="cardskinpadding" value=" card-skin-padding " /> </c:if> but i'm having trouble wrapping head around how i'd apply _root . any appreciated, thank you.

facebook php sdk - Instagram Graph API: Media Thumbnail URL -

i'm using instagram graph api in business account, , works fine. have created wordpress port of facebook sdk, , function retrieves media items looks (part of class, $fb object authenticated using default_access_token in class constructor): public function get_media( $business_account_id = '', $limit = 15 ) { $limit = absint( $limit ); try { $response = $this->fb->get( "/{$business_account_id}?fields=media.limit({$limit}){media_url,caption,thumbnail_url,permalink}" ); return $response->getdecodedbody(); } catch ( \facebook\exceptions\facebookresponseexception $e ) { return $e->getmessage(); } catch ( \facebook\exceptions\facebooksdkexception $e ) { return $e->getmessage(); } } the fields i'm requesting, can see, are: media_url , caption , thumbnail_url , permalink . api responds fields except thumbnail_url : array(2) { ["media"]=> array(2) { ["data

html5 - How do you query a web browser for CSS Grid support? -

how query web browser css grid support? all major browsers support css grid recent versions, need fallback else if client has older version. in css can use this: @supports (display: grid) { /* css styles css grid */ } the @supports syntax works chrome 28, edge 20, firefox 22, opera 12, safari 9 according mdn web docs . internet explorer not listed support @supports syntax.

search - Increasing algorithm efficiency using divide and conquer paradigm -

i want find minimum , maximum integer within array. relatively inefficient method consider first integer max\min. compare other integers , if greater/smaller integer compared current minimum or maximum integer replaced. takes place until end of array. have worked out complexity (based on worst case) n -1 (n size of array). question how use divide , conquer paradigm make more efficient? have tried dividing array 2 parts , doing same algorithm above both divisions although makes less efficient? calculations complexity becomes n + 1. i consider you're using 1 thread if array not sorted, complexity o(n) . however, in opinion, should check need max number? or second max well, , third max .. if that's case, you'd better build max heap (min heap counterpart case), takes o(nlogn) time, , check peek of heap.

google spreadsheet - My app keeps showing today's date and not what is in the cell I called for -

i getting output of first date of column date "exp" should be. column 3 expiration dates when call , output it shows long formatted day date , time. know little if coding. please help. this output should except date should date from not top date sheet. mjc-ap-200 watchguard model : ap 200is due in 10 days 09/30/17. dma-ap-300-2 watchguard model : ap 300is due in 0 days 09/30/17. elwood properties watchguard model : wgd-wg026583is due in 0 days 09/30/17. elwood prop-xtm-26w watchguard model : xtm 26-wis due in 0 days 09/30/17. function checkreminder() { // spreadsheet object var spreadsheet = spreadsheetapp.getactivespreadsheet(); // set first sheet active spreadsheetapp.setactivesheet(spreadsheet.getsheets()[0]); // fetch sheet var sheet = spreadsheet.getactivesheet(); // figure out last row var lastrow = sheet.getlastrow(); // rows indexed starting @ 1, , first row // headers, start row 2 var startrow = 2; // grab column 8 (the 'days left' col

asp.net - Can't build chart with data from database -

i can't build chart data database. tried this, don't work controller: public actionresult chart() { return partialview("_chart"); } in main view: img src="@url.action("chart")"/> partial view ( _chart.cshtml ): @using testproject.models; @{ datetime[] xval = new datetime(); decimal[] yval = new decimal(); testprojectcontext db = new testprojectcontext(); var deals = d in db.dealsdirectory select d; deals.tolist().foreach(x => xval.add(x.date)); deals.tolist().foreach(y => yval.add(y.price)); var chart = new chart(width: 600, height: 400) .addtitle("Зависимость цены от времени") .addseries( name: "usd", xvalue: xval, yvalues: yval, charttype:"line") .write(); } your code has basic syntax problem prevent code compile! the below snippet not valid ! datetime[] xva

java - Is it possible to combine @After Advice with spring boot junit tests? -

is somehow possibile create @after advice each tests method in spring boot application? write tests using groovy. here example: test class: @runwith(springrunner) class mytest { @test void 'this test'() { ... } } my advice class: @advice public class myadvice() { @after("@annotation(org.junit.junit)") public void after() { system.out.println("this end of test case"); } } or event log in @after annotation failed (assertexception) or passed. when tryied run code in application getting "method name 'this test' invalid".

javascript - Check if the same number is randomized twice in a row -

i've made quote generator, times, because there few quotes, same quote shows twice in row. how check , avoid issue? randomnum = math.floor((math.random() * quotes.length)); randomquote = quotes[randomnum]; randomauthor = author[randomnum]; $("#quote").text(randomquote); $("#author").text(randomauthor); } $("#newquote").on('click', function() { getquote(); }); full code . you can check if new random quote equal previous quote , change if is. replace randomnum = math.floor((math.random()*quotes.length)) with while(randomquote === quotes[randomnum]) randomnum = math.floor((math.random()*quotes.length));

android - How can I provide a "fakes" product flavor without also specifying a "real" (default) product flavor? -

i want provide build variant fake implementation of interfaces provided module. can use productflavors achieve this android { flavordimensions "realorfake" productflavors { fakes {...} real {...} } } this generates 4 build variants fakesdebug fakesrelease realassemble realrelease however want provide default configuration, , optional fakes configuration (i don't want define real product flavor. 4 build variants should be: fakesdebug fakesrelease debug release is possible? or have provide real product flavor , utilize matchingfallbacks ? want avoid every downstream module having specify real flavor. i'd want compile use upstream's real product flavor, , testcompile use upstream's fakes product flavor. note: using android gradle plugin 3.0

AngularJs: View is not displaying data even though the data is present in controller -

i have following controller , view , want display properties of productcategory object in view. though productcategory present in controller, not displayed in view. controller: angular.module('jordans') .controller('productcategoryctrl', function ($scope, $rootscope, dataservice) { $scope.productcategories = []; $scope.currentdata = {}; $scope.productcategory = []; $scope.getcategories = function () { dataservice.getproductcategories().then(function (data) { $scope.productcategories = data; // console.log('productcategories = ' + json.stringify($scope.productcategories)); }) } $scope.getcategory = function () { $scope.productcategory = dataservice.getproductcategory($scope.currentdata); console.log('productcategory = ' + json.stringify($scope.productcategory)); } $rootscope.$on('setcategory&

Need help writing this function in python 3 -

this question has answer here: nested arguments not compiling 1 answer how represent code in python3 it's written in python 2 def transform(x, y , (a, b, c, d, e, f)=matrix): return a*x + b*y + c, d*x + e*y + f error def transform(x, y , (a, b, c, d, e, f)=matrix): ^ syntaxerror: invalid syntax many more coming def transform(x, y, matrix): (a, b, c, d, e, f) = matrix return a*x + b*y + c, d*x + e*y + f

typescript - Where does ngOnInit come into play when it comes to handling forms (angular 2) -

so, understanding of ngoninit() ran within ngoninit method runs @ time page "initialized" (or loaded) up, 1 of lifecycle hooks. like // importing in inject decorator because want // import datatype // inject decorators can used constructor properties import { component, inject } '@angular/core'; // import {formgroup} '@angular/forms'; // form builder has group method on forming // form gropus import { validators, formbuilder } '@angular/forms'; import { router } '@angular/router'; // importing our service inject import { mediaitemservice } './media-item.service'; import { lookuplisttoken } './providers'; @component({ selector: 'mw-media-item-form', templateurl: 'app/media-item-form.component.html', styleurls: ['app/media-item-form.component.css'] }) export class mediaitemformcomponent { form; // class property /* constructor allows constructor injection (no

python - Better interpolation for Plotly Scatter splines -

Image
plotly supports catmull-rom splines interpolation of lines between markers on scatter plot. i have graphs data fundamentally normal distribution. cubic or hermite interpolation works type of data in other graphing frameworks - unfortunately catmull-rom splines (or @ least plotly's implementation of them) doesn't. i've experimented values of "smoothing" between 0.0 , 1.0 (it seems, though not documented, values on 1.0 make no further difference). unfortunately, bad. i've seen suggestion elsewhere might make sense own interpolation using scipy's interpolate.interp2d, , graph line separately. however, fails use case, since want color of line paired color of markers, , both appear on legend single item, shown above. has had experience making plotly splines nicer on quasi-normal distribution using smoothing=1.0?

jquery - Map Json data to an object using AJAX and C# -

how can use json formatted data sent ajax request in c#? here's view jquery , ajax <script type="text/javascript"> $(function () { $("#btnget").click(function () { var values = { "name": "manuel andrade", "dateofbirth": "12/01/1995" } $.ajax({ type: "post", url: "/api/webapi/getage", data: values, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (response) { alert("hello: " + response.name + ".\ncurrent date , time: " + response.datetime); }, failure: function (response) { alert(response.responsetext); }, error:

node.js - How use backticks in npm scripts on windows -

my workflow npm scripts, running commands in node_modules along simple shell commands. unfortunately makes difficult windows users due using backticks in commands (see example below). have pull request volunteering convert shelljs/shx build repo build cross-platform can't figure out solution backticks in npm scripts. question: what shell npm use? on windows appears not support backticks. is there workaround? piping doesn't help, alas, rm, mkdir etc don't use stdin. example backtick use in package.json: "mkdirs": [ "dist/as", "libs", "models/scripts" ], "scripts": { "mkdirs": "mkdir -p `bin/pkgkey.js mkdirs`", .... .. bin/pkgkey.js mkdirs script returns mkdirs array. may seem odd it's great organizing npm-style workflow. the pkgkey script (simplified): #!/usr/bin/env node const fs = require('fs') const json = json.parse(fs.readfilesync('p

uipath - UI path write multiple column in excel -

i learning uipath , source excel file. have excel file column a,b, c. want write column , c new excel file. i confused function should use read / write. think if use read range / write range, write column. however, want column , c read entire excel sheet readrange. outputs datatable. datatables there activity called remove data column (programming->datatable). use remove col b.

Finding indexes of matching rows in two numpy arrays -

this question has answer here: find row indexes of several values in numpy array 5 answers how can find indexes of rows match between 2 numpy arrays. example: x = np.array(([0,1], [1,0], [0,0])) y = np.array(([0,1], [1,1], [0,0])) this should return: matches = [0,2] # match @ row no 0 , 2 np.flatnonzero((x == y).all(1)) # array([0, 2]) or: np.nonzero((x == y).all(1))[0] or: np.where((x == y).all(1))[0]

android - How to change google voice to text method, popup vs in text box -

got new phone , when use google voice text, takes sentence , various versions , puts them popup box me choose. other way continually type box speak. can click words edit them. how can change latter version/method? thanks

javascript - Data keeps on duplicating after adding to database -

Image
i have table has starting id of 1. have function gets last added id using limittolast(1) , added 1 next data add database have 2 key if ever last added id 1.but happened this: it added 2 key data added continues add more , duplicates data. code: function uploadproperty() { user = firebase.auth().currentuser; var selectedfile; var propertiesref = db.ref('property/'); propertiesref.orderbychild("property").limittolast(1).on("child_added", function(snapshot) { var getkey = number(snapshot.key); var id = getkey + 1; firebase.database().ref("property/" + id).set({ property_id: id, user_id: user.uid, property_desc: $("#desc").val() , property_address: $("#address0").val() , property_slot: $("#slot").val(), property_price: $("#price").val(), rent_type: $("#renttype").val(), type: $("#type").val(), lat: $(&quo

php - Why is paginate_links giving me a blank /page/2 result? -

i have blog roll on homepage of website (on front-page.php ) shows 12 posts per "page" - when click on next paginated page, want show next 12 posts in place of first 12. my loop displays paginated links below blog roll, when click on "page 2" load more posts, brings empty /page/2 page references index.php file. how fix it's not returning blank page? , there way load next 12 posts in exact place of original 12 on front-page.php layout (and not routing through index.php)? here's wp_query code: <?php $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1; // query includes custom post type 'song' $the_query = new wp_query(array('post_type'=>array('post', 'song'))); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div class="jd-box"> <a href="<?php the_permalink(); ?>

android - Turn on/off gps using button without getting into setting menu -

i want ask turn on gps in android without getting setting menu. 1. method possibly do? 2. if yes how that? thank you. it impossible. user can turn on/off gps. done because shouldn't able user's location if doesn't want it. thing can ask him turn on/off opening gps settings: startactivity(new intent(settings.action_location_source_settings));

racket - Bad syntax error on define-type using #lang plai -

i'm getting bad syntax error on piece of code deleted and more specifically, error: xxx:22.0: define-type: bad syntax in: xxx #(739 316) i'm new language kind enough tell me what's wrong code , how rid of error? the following problematic lines causing syntax-error : i --> [give (expr1 oe?) name (id-ref1 symbol?) in (expr2 oe?)] ii --> [(string-literal string?)] iii --> [(id-ref2 symbol?)] as noted in docs , define-type has structure (define-type type-id variant ...) where variant = (variant-id (field-id contract-expr) ...) so, every variant must have variant-id , , each field-id must have associated contract . violation of cause of syntax-error. in case of (i) , both name , in lack contracts, possible fix adding contracts fields, such (using string? example contract): [give (expr1 oe?) (name string?) (id-ref1 symbol?) (in string?) (expr2 oe?)] both (ii) , (iii) lack variant-ids , adding them fix problem: [some-v

Migrating Auth to Core 2.0: The entity type 'IdentityUserRole<int>' requires a primary key to be defined -

i migrating app asp.net core 2.0. https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/identity-2x in above article, has following mapping: protected override void onmodelcreating(modelbuilder builder) { base.onmodelcreating(builder); // customize asp.net identity model , override defaults if needed. // example, can rename asp.net identity table names , more. // add customizations after calling base.onmodelcreating(builder); builder.entity<applicationuser>() .hasmany(e => e.claims) .withone() .hasforeignkey(e => e.userid) .isrequired() .ondelete(deletebehavior.cascade); builder.entity<applicationuser>() .hasmany(e => e.logins) .withone() .hasforeignkey(e => e.userid) .isrequired() .ondelete(deletebehavior.cascade); builder.entity<applicationuser>() .hasmany(e => e.roles) .withone() .hasforeignkey(e =

python - plotting with subsets of data -

so have various arrays of data treatments coded dummy variables x=[0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1] z=[1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0] d=[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5] y=[1,2,3,4,5,0,0,1,0,1,1,10,20,35,50,1,10,15,20,25] and plot 4 plots @ same time in separate figures each of combination of treatments 1 plot. so plt.figure(1) plt.subplot(411) plt.plot(d,y[x==0],[z==0]) plt.figure(2) plt.subplot(412) plt.plot(d,y[x==1],[z==0]) plt.figure(3) plt.subplot(421) plt.plot(d,y[x==0],[z==1]) plt.figure(4) plt.subplot(422) plt.plot(d,y[x==1],[z==1]) p.show() but error saying third argument has format string. i don't want break data smaller chunks before plotting running data through regression model prior plotting , seems though may complicate things little me. any appreciated inexperienced python. thank clarification op: i'm trying 4 graphs in 1 pane with; the first plot being ~ y when x=0 , z=0, the 2nd plot being ~ y whe

android - Removing items from recycler view generates an error -

i want remove items recyclerview. able remove single item @ time unable remove multiple items @ once. below code removing items: final online2_g_s online2_g_s = online2_g_slist.get(position); if (online2_g_s.getpmrp()==0){ removeitem(holder.getadapterposition()); } private void removeitem(final int position) { new handler().post(new runnable() { @override public void run() { try{ log.i("sand36", string.valueof(position)+" "+online2_g_slist.get(position)); online2_g_slist.remove(position); notifyitemremoved(position); notifyitemrangechanged(position, online2_g_slist.size()); }catch (exception e){ log.i("sand36", string.valueof(e)); } } }); and here error getting while removing items: 09-14 09:09:36.816 26394-26394/com.parse.awaazdo i/sand36: java.lang.indexoutofboundsexception: invalid index 4, siz

javascript - How can I convert a date and time into a time only using angular-moment? -

so have dates this: $scope.sample_time = "september 14th 2017, 1:00:00 pm"; and in view, want show time example 1:00 pm . using angular-moment , tried {{ sample_time | amparse:'hh:mm a'}} 2017-09-14t06:00:00.000z . am missing here? appreciated. because "september 14th 2017, 1:00:00 pm" not default valid date, need parse first, corresponding format use (which 'mmmm yyyy, h:mm:ss a' ), got valid date , can use amdateformat format it: amdatformat:'hh:mm a' {{ sample_time | amparse:'mmmm yyyy, h:mm:ss a' | amdateformat: 'h:mm s'}} a plunker: http://plnkr.co/edit/rocnlpq6ublfncclfb8n?p=preview

java - invalid range exception with setAutoCreateRowSorter() -

i getting invalid range exception jtable when use setautocreaterowsorter(). if remove setautocreaterowsorter, problem goes away, no longer able sort table. also, if try setting sorter directly: mytable.setrowsorter(new tablerowsorter(model)); i still same error. this close sscce think can convey issue. import java.util.arraylist; import javax.swing.table.abstracttablemodel; public class mytesttable extends javax.swing.jframe { private mytestabstracttablemodel model = new mytestabstracttablemodel(); private int selectedrow = -1; public void setlist(arraylist arraylist) { model.setlist(arraylist); } public mytesttable() { initcomponents(); mytable.setmodel(model); mytable.setautocreaterowsorter(true); // error here } /** * method called within constructor initialize form. * warning: not modify code. content of method * regenerated form editor. */ @suppresswarnings("unchecked&quo

node.js - image-watermark, nodejs showing error -

i trying put watermark on image, using image-watermark, nodejs. const express = require('express') const app = express(); var path = require('path'); var watermark = require('image-watermark'); app.use(express.static(path.join(__dirname, 'public'))); var options = { 'text' : 'sample watermark', 'resize' : '200%' }; app.get('/', function (req, res) { var fs = require('fs'); if (fs.existssync('./public/files/pg363.jpg')) { // watermark.embedwatermark('./public/files/pg363.jpg', options); res.send('hello world'); }else{ res.json({"filesexist":"no"}); } }); app.listen(3000,function(){ console.log('app running on server 3000'); }) this giving me error: events.js:163 throw er; // unhandled 'error' event ^ error: spawn identify enoent @ expo

bootstrap 4 - how to make a carousel bigger only on mobile screens? -

i'd make bigger carousel on mobile devices. there way accomplish this? @ code, you'll see carousel on mobile screen tiny: https://codepen.io/codewife_101/pen/xejalr <nav class="navbar navbar-expand-sm navbar-light bg-light"> <div class="container"> <a class="navbar-brand" href="#">brand name</a> <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarnav2"><span class="navbar-toggler-icon"></span></button> <div class="collapse navbar-collapse" id="navbarnav2"> <ul class="navbar-nav ml-auto"> <li class="nav-item"> <a class="nav-link" href="#">home</a> </li> <li class="nav-item"

java web service get parameter while using post method -

i did java rest web service using method.the web service works fine method.but when try post method doesn't display anything. below simple code test post method. please me in solving issue. @path("/post") public class testpost { @post @path("/test") public string post(@queryparam("param") string msg) { string output = "post:hello: "+msg; return output; } } public string post(@queryparam("param") string msg) { there no @queryparam post. get. for post, should use @requestparam

java - Prefixing xml elements that are missing namespace -

i receiving pregenerated xml document string , need prefix xml elements prefix missing. example input: <a xmlns:b="http://www.b.com"> <element1>test</element1> <b:element2>test</b:element2> </a> output: <c:a xmlns:b="http://www.b.com" c="http://www.c.com"> <c:element1>test</c:element1> <b:element2>test</b:element2> </c:a> i have document parsed node, can't figure how add prefix element missing prefix. going fall on regex string replacement, think should possible java xml api, i'm stuck. the following xslt 1.0 transformation move no-namespace elements namespace prefix="c", uri="http://www.c.com". <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="*[namespace-uri()='']"> <xsl:element name="c:{local-name()}" namespace=&

c# - Invoke Property -

i have written program in synchronous model want add threading long tasks, have several properties automate retrieval of information like: private int tabidx { { return tabs.selectedindex; } } private string tabname { { return tabs.selectedtab.text; } } public tabcontrols tabcontrols { { return (tabcontrols)tabs.tabpages[tabidx].controls[string.format("tab_{0}_controls", tabidx)]; } } internal tabcontrols gettabcontrols(string name) { int desiredidx = tabs.tabpages.indexofkey(name); return (tabcontrols)tabs.tabpages[desiredidx].controls[string.format("tab_{0}_controls", desiredidx)]; } public core rcore { { return rdbcores[tabidx]; } } obviously if try access these properties inside task.run(()) or likewise i'm going cross-thread exception. so question is: is possible invoke these properties method similar too: private void invokeifrequired(isynchronizeinvoke obj, methodinvoker action) { if (obj.invokerequired) { obj.invoke(action,

html - What you need to change so that the input fields are to the right of the picture? -

please, me, need change input fields right of picture? https://codepen.io/anon/pen/gmgjqy .div1{ font-size:250%; text_align: center; } .pedit_labeled{ float: left; line-height: 16px; } .pedit_label{ color: #656565; width: 170px; padding: 6px 10px 0 0; line-height: 16px; float: left; text-align: right; } .clear_fix { display: block; } .clear_fix:after { content: '.'; display: block; height: 0; font-size: 0; line-height: 0; clear: both; visibility: hidden; } .pedit_row { padding-bottom: 15px; } input.dark, #profile_editor textarea, .pedit_dropdown { width: 300px; } pedit_bday, .pedit_bmonth { padding-right: 8px; } .fl_l { float: left; } .selector_container { background: #fff; zoom: 1; } <div class="div1">contact's profile</div> <div> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:a

complex regex for JMeter -

need capture below value string in jmeter <input id="__tridocumentname" type="hidden" value="c%3a%5cwindows%5ctemp%2fdocuments%5cbirtdoctdy1z2sxwrm6nzf2s7ugo0s%5c20170913_061108_464%5cbalance+sheet+report28082017.rptdocument"/> value capture: 20170913_061108_464 what regex this? notice here birtdoctdy1z2sxwrm6nzf2s7ugo0s value dynamic. right click on sampler want extract dynamic value , add>post processors> regular expression extractor. “apply to” checkbox : useful in case if sample has child samples request embedded resources. parameter defines regular expression applied either main sample results or embedded resources too. can choose according requirement “response field check” check-box.this parameter defines field regular expression should applied. in regular expression field: you have find left boundary , right boundary of value extract e.g. response "something date:"20170913_061108_464" value&quo

Facebook Original Advertising Banners and Slogans -

i searched bit around web (to search "facebook"! banners) realized how pointless in these days. i remember time facebook not popular now, web full of facebook ads (join facebook! blue banner around web!), advertising on facebook (this not want). so knows these banner located facebook not need them anymore. these facebook's advertising materials/campaigns(banners, ad slogans etc. 2002?). i want these "old facebook slogans , banners" not "advertise on facebook banners". i hope gets me , maybe can me this.

winforms - How to handle windows Form in seleniuim -

i have scenario getting windows form ,autoit not able handle window form,is there other way handle window form using selenium if unable automate os level dialogue boxes/windows forms autoit , can use sikuli automate windows forms. sikuli: sikuli automates see on screen. uses image recognition identify , control gui components. useful when there no easy access gui's internal or source code.you can more info below link- http://www.sikuli.org/ http://www.devengineering.com/blog/testing/how-integrate-sikuli-script-selenium-webdriver

c++ - Simple Word Guessing Game -

bool guess(char c) { if (guesses[c]) { guesses[] = c; return true; } else if (c > ='a' && c <= 'z') { guesses[] = c; return false; } } bool guesses[255] = {}; i need use see if person has enter char between - z , if haven't return true else return false. either way update guesses char. right don't understand how add char array, next time check false , tell them guessed. understand using ascii table beyond lost. explain why won't work. i error expected primary-expression before']' but if take bracket out get incompatible type char bool which make sense how make char c mark true in boolean array you've left brackets empty, aren't providing index: guesses[c] = c; but don't want assign char guesses , you'd want assign bool : guesses[c] = true; that compile* , fix problem. * note have syntax error > = , assume copy+paste issue e

Spark HiveContext : Spark Engine OR Hive Engine? -

i trying understand spark hivecontext . when write query using hivecontext sqlcontext=new hivecontext(sc) sqlcontext.sql("select * tablea inner join tableb on ( a=b) ") is using spark engine or hive engine?? believe above query executed spark engine. if thats case why need dataframes? we can blindly copy hive queries in sqlcontext.sql("") , run without using dataframes. by dataframes, mean tablea.join(tableb, === b) can perform aggregation using sql commands. 1 please clarify concept? if there advantage of using dataframe joins rather sqlcontext.sql() join? join example. :) the spark hivecontext uses spark execution engine underneath see spark code . parser support in spark pluggable, hivecontext uses spark's hivequery parser. functionally can sql , dataframes not needed. dataframes provided convenient way achieve same results. user doesn't need write sql statement.

html5sortable - sortupdate event is not triggered on dynamic elements -

i using html5sortable plugins sort list. problem is, because list , item self builds dynamically, sortupdate event listener not triggered. is there me please? how trigger sortupdate event on dynamically added elemetns? here mya codes: var url = 'some url; var divtree = $(".tree-module"); divtree.empty(); $.get(url).done(function (hasil) { var isi = ''; isi += '<ol class="tree ">'; isi += ' <li>'; isi += ' <label>module<input type="checkbox"/></label>'; isi += ' <ol class="module-tree">'; $.each(hasil.master, function (i, row) { isi += '<li class="file li-module" data-id="' + row.id + '" data-urut="' + row.urut + '">' isi += '<a href="#module-' + row.id + '" data-modul

keras - How to get Conv2D layer filter weights -

how weights of filters (like 32 ,64, etc.) of conv2d layer in keras after each epoch? mention that, because initial weights random after optimization change. i checked this answer did not understand. please me find solution of getting weights of filter , after every epoch. and 1 more question in keras documentation conv2d layer input shape (samples, channels, rows, cols). samples mean? total number of inputs have (like in mnist data set 60.000 training images) or batch size (like 128 or other)? samples = batch size = number of images in batch keras use none dimension, meaning can vary , don't have set it. although dimension exists, when create layer, pass input_shape without it: conv2d(64,(3,3), input_shape=(channels,rows,cols)) #the standard (rows,cols,channels), depending on data_format to have actions done after each epoch (or batch), can use lambdacallback , passing on_epoch_end function: #the function call def get_weights(epoch,logs): wsan

python - How to add multiple foreign key in Django -

i beginner in django. having 2 models class employee(models.model): full_name = models.charfield(max_length=120,default=none) designation = models.charfield(max_length=80,default=none) class leave(models.model): employee = models.foreignkey(employee, related_name='employee') number_of_days = models.integerfield(default=0) now have inline leave model employee in admin.py can add many leaves want in employees when retrieve model in views new leave s created, want 1 employee should show total = number of days , creates new leaves, not able build logic here stuck, please ask if u don't understand asking. not sure asking, guess want display total number of absent days of employee in admin. can use aggregation , sum in particular , custom method on model: # models django.db.models import sum class employee(models.model): def absent_days(self): return self.leaves.aggregate(s=sum('number_of_days'))['s'] or 0 ab

friend - describe the 8th line of this c++ code? -

i learning c++, presently learned java(there no friend function concept on there). here on friends function section. btw know friend function allow access private , protected data of class.. i know "::" scope qualifier. know ":?" conditional operator box(): length(0) { } // code line confused me. same blocks used in java or else. #include <iostream> using namespace std; class box { private: int length; public: box(): length(0) { } // ****what ?? ****** friend int printlength(box); //friend function }; int printlength(box b) { b.length += 10; return b.length; } int main() { box b; cout<<"length of box: "<< printlength(b)<<endl; return 0; } that default constructor box, initializing length member variable 0 when run. if tried change 0 in there example 12, boxes default length of 12. c++ constructor initialization list