Posts

Showing posts from July, 2010

android - Does MapQuest allow us to draw routes on the Map on the free version? -

i have app has old mapquest key , wanted show route on map. however, didn't work, , on callback got message: this key not authorized service. if not have key, can obtain free key registering @ http://developer.mapquest.com . does mean key invalid, expired, or maybe have pay have service? i visited mapquest appkeys page today (mar 29 2015) , tells me that: the ability create free & open appkeys has been temporarily paused. can confirm whether routing allowed free key? you can draw route on mapquest map free&open key, cannot use service (i mean use android sdk routing) because it's not free. although, i've created demo app directions mapquest's web service (wich free) , uses response draw route. can request guidance information. take @ github repo: https://github.com/sebasira/android-routewebservice hope helps you! (it headache me @ time)

oauth 2.0 - How to set the body on an apache camel http POST request -

i trying send credentials restful service takes in json formatted username , password , return access token. no matter try, 400 error , error returned server "must supply body." here's last snippet tried: @component public class loginroute extends routebuilder { @override public void configure() throws exception { string jsoncredentials = "{\"username\":\"username\",\"password\":\"password\",\"grant_type\":\"password\",\"scope\":\"admin\"}"; from("timer://login?repeatcount=1") .setbody(constant(jsoncredentials)) .setheader(exchange.http_method, constant(org.apache.camel.component.http4.httpmethods.post)) .to("http://url"); } } i have confirmed credentials work fine in postman , receive proper response, access token. believe service trying connect using oauth2. try marshalling. me worked: // custom defined bean credentials creds...

gulp - Visual Studio Code - Scaffolding Newly Created File -

i have gulp file watches source files add project. when sees file added , newly created file empty, scaffold file boilerplate code. the problem when create file in editor have refresh editor (visual studio code in case) in order see wrote file. (right file appears blank). perhaps there way delay code displaying file? or perhaps there faster way write file code displays correctly initially? benjamin pasero on vscode team sent me this: close vs code open c:\users\\appdata\local\code\app-0.3.2\resources\app\server\lib\watcher\ base.win32.watcher.js find following lines: else if (currentchangetype === watcher.changetypes.created && newchangetype === watcher.changetypes.changed) { } remove them or comment them out adding “//” beginning of line restart vs code this fix said included in next update of vscode.

performance - Best way to design for one-to-many code values in Oracle -

we receive several millions of records per day on temperature metrics. of pertinent metadata these records maintained in single partitioned table date (month). going start receiving 20 individual codes associated data. intent allow searching these codes. what effective way store data minimize search response time? database oracle 11gr2. some options taking consideration: (1) create separate table main record id , code values. like id code -- ---- 1 aa 1 bb 1 cc 2 aa 2 cc 2 dd concerns: would require bitmap index on code column, table highly transactional no bitmap table huge on time 20 codes per main record (2) create separate table partitioned code values. concerns: partition maintenance new codes search performance (3) add xmltype column existing table , format codes each record xml , create xmlindex on column: like: <c1>aa</c1> <c2>bb</c2> <c3>cc</c3>...

Query on VHDL generics in packages -

i have written simple vhdl code add 2 matrices containing 32 bit floating point numbers. matrix dimensions have been defined in package. currently, specify matrix dimensions in vhdl code , use corresponding type package. however, use generic in design deal matrices of different dimensions. have somehow use right type defined in package. how go doing this? current vhdl code below. library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.mat_pak.all; entity newproj port ( clk : in std_logic; clr : in std_logic; start : in std_logic; a_in : in t2; b_in : in t2; aplusb : out t2; parallel_add_done : out std_logic); end newproj; architecture behavioral of newproj component add port ( : in std_logic_vector(31 downto 0); b : in std_logic_vector(31 downto 0); clk : in std_logic; sclr : in std_logic; ce : in std_logic; result : out std_logic_vector(31 downto 0); ...

base64 - Node.js quick canvas to webp [NOT SOLVED] -

if @ code webp out-performs png , jpg alot <canvas id="canvas"></canvas> <script> var ctx = canvas.getcontext("2d"); ctx.fillstyle = "red"; ctx.fillrect(0, 0, 8, 8); var webp = canvas.todataurl("image/webp"); // chrome only? var png = canvas.todataurl("image/png"); var jpg = canvas.todataurl("image/jpeg"); console.log(webp.length, webp); // 263 byte console.log(png.length, png); // 1918 byte console.log(jpg.length, jpg); // 1938 byte document.body.appendchild(new image).src = webp; document.body.appendchild(new image).src = png; document.body.appendchild(new image).src = jpg; </script> i using node module https://github.com/automattic/node-canvas which not support webp but, simulate canvas element what think need wrapper around canvas do wrapper(canvas).todataurl('image/webp'); as have found out on many attempts converting base64 png image webp png poor speed wise. ...

jquery - Populate text field based on result of dropdown selection -

using mvc 5, have created dropdown menu 3 options: $500, $5000 , other. want hide "amountother" text field until user has selected "amountother" option dropdown. can help? thanks. <script src="scripts/jquery-2.1.3.js"></script> <script src="scripts/jquery.validate.min.js"></script> <script src="scripts/jquery.validate.unobtrusive.min.js"></script> <div class="col-md-10" id="divamount"> <select class="form-control" data-val="true" id="amount" name="amount"> <option value="">-- amount --</option> <option value="500">$500</option> <option value="5000">$5000</option> <option value="amountother">amount other</option> </select> <div> <div class="col-md-10" id="divamou...

angularjs - Angular Directive with ui-select and transclude -

i have project using lot of angular ui-select directives. usage of ui-select standardized , difference between various points use ui-select-choice template , service used fetch results. i'm trying write picker directive wraps ui-select. problem i'm encountering transcluding ui-select-choice template. here directive i've written. registerdirective("picker", ["$injector", ($injector): idirective => { return { restrict: "e", templateurl: "/scripts/app/views/picker.html", transclude: true, scope: { model: "=model", sourcename: "=sourcename" }, link: ($scope: interfaces.ipickerscope, $: jquery, attrs: ng.iattributes) => { var service = <services.ipickerservice>$injector.get($scope.sourcename + "service"); $scope.fetchresults = (filter: string) => { service.pickersearch(filter).then((response: any[]) =...

unit testing - Access a value set up by `beforeAll` during tests -

here's i've got: spec :: spec spec = manager <- runio newmanager "foo" $ -- code uses manager "bar" $ -- code usees manager the docs runio suggest should using beforeall instead, since not need manager construct spec tree, need run each test, , in use case it's better them share same manager rather creating new 1 each test. if not need result of io action construct spec tree, beforeall may more suitable use case. beforeall :: io -> specwith -> spec but can't figure out how access manager tests. spec :: spec spec = beforeall newmanager go go :: specwith manager go = "foo" $ -- needs "manager" in scope "bar" $ -- needs "manager" in scope spec arguments passed blocks regular function arguments (look @ associated type of example type class, if want understand what's going on). self-contained example be: import test.hspec main...

javascript - setMinDate and minDate function in Bootstrap 3 DatetimePicker not working -

javascript: $('#dpstart').datetimepicker({ pickdate: true, picktime: false, format: "dd-mm-yyyy", useminutes: false, useseconds: false }); $('#dpend').datetimepicker({ pickdate: true, picktime: false, format: "dd-mm-yyyy", useminutes: false, useseconds: false }); $("#dpstart").on("change.dp", function(e) { alert('hey'); $('#dpend').data("datetimepicker").setmindate(e.date); }); html: <div class="row"> <div class="col-md-6 col-sm-6 form-group"> <label for="txtstartdate"> start date-time</label> <div class="input-group date" id="dpstart" data-date-format="dd-mm-yyyy"> <asp:textbox id=...

c# - Setting Server Name Indication (SNI) takes off certificate binding -

Image
i'm using microsoft.web.administration (inside wix customaction) configure server name indication , bind existing server certificate on iis 8.5 site. turns out, setting sni takes off certificate binding. following code make things clearer: using microsoft.web.administration; var binding = site.bindings.firstordefault(x => x.isipporthostbinding && x.host == sitename); binding.certificatehash = certificate.getcerthash(); binding.certificatestorename = store.name; // statement causing certificate info messed up. binding["sslflags"] = 1; // or binding.setattributevalue("sslflags", 1); results: with binding["sslflags"] = 1; without binding["sslflags"] = 1; is bug or missing something? how can both sni , certificate binding stick? it seems microsoft.web.administration v7.0 culprit here. official 1 on nuget gallery , seems meant iis 7 (i mean it'll work features common in both iis 7 & 8 7 doesn...

visual studio - Python access violation -

here python 3.4 user, in vs 2013 , ptvs ... i'd written program plot matplotlib ... output had been generating , ok... so, closed vs , i've opened again after hour, running script, time press f5 , window appears , says python has stopped working ... there short log in output window, asserts that: the program '[9952] python.exe' has exited code -1073741819 (0xc0000005) 'access violation'. who decrypt error, please?!... kind regards ......................................... edit: i tested again no change... error has been changed to: the program '[11284] python.exe' has exited code -1073741819 (0xc0000005) 'access violation'. debug shows when program points drawing command of matloptlib , i.e. plt.show() , crash happen... all of attempts sounds futile... even removing vs challenging stuff... , people consider, changing os stable way rid of vs in presence of such anomalies regarding libraries... so... cha...

How to resolve circular dependency with friend declarations in C++? -

why doesn't following code compile , how can fix it? error is: use of undeclared identifier 'foo' although foo declared , defined @ point error occurs (at friend declaration in bar ). foo.h : #ifndef foo_h #define foo_h #include "bar.h" // needed friend declaration in foochild class foo { public: void func(const bar&) const; }; class foochild : public foo { friend void bar::func(foochild*); }; #endif foo.cpp : #include "foo.h" void foo::func(const bar& b) const { // stuff b.x } bar.h : #ifndef bar_h #define bar_h #include "foo.h" class bar { public: void func(foochild*) {} private: int x; friend void foo::func(const bar&) const; // "use of undeclared identifier 'foo'" }; #endif here 's compilable online version of above code. put foochild in header file of own. foo.h: #ifndef foo_h #define foo_h class bar; class foo { public: void func(const bar...

javascript - Convert html to image (take a snapshot of dom) -

we have use case want take image of content within rich text editor (ckeditor). using html2canvas ( http://html2canvas.hertzen.com/ ) works fine extent below issues facing: a)html2canvas needs proxy (wrote own proxy in java) server fetch images if html has images hosted on different server( proxy required due cross domain restrictions), have run issues process of taking image/snapshot takes lot of time when there lot of images hosted on different server. time take images effected if url's broken. i wondering if there reliable solution taking images/snapshots of dom elements has cross browser compatibility , fast. below research did on alternatives need advice. phantomjs: looked @ phantomjs allows taking images outside browser world if felt using phantomjs might on doing requires lot of build setup , whole different library include. svg based solution: ran link ( https://developer.mozilla.org/en-us/docs/web/api/canvas_api/drawing_dom_objects_into_a_canvas ) shows takin...

wordpress image_default_link_type no way works -

what way change default link url when inserting image, 'none' rather displaying link in wordpress? i try way found: http://wpsites.net/wordpress-tips/5-ways-to-change-default-image-links/ i have version 4.2.2. but nothing works. much i function update settings. placed in functions.php , trick. add_action( 'after_setup_theme', 'default_attachment_display_settings' ); function default_attachment_display_settings() { update_option( 'image_default_align', 'none' ); update_option( 'image_default_link_type', 'none' ); } cheers

random - Setting the seed for betarnd() in Matlab 2014b -

i trying set seed betarnd() every time re-run code, use same values generated betarnd() . in previous version of matlab on else's computer, suffices do randn('seed', num) rand('seed', num) and can same set of random values sampled beta distribution each time betarnd(0.5,0.5,[1,15]) run, instance. however, in case, although set seeds shown above, different values. causing discrepancy? , how can resolve it? matlab changed policies , syntaxes since version 2014. have @ explanation page . basically, can set seed using rng(sd) before using function rand or randn usual.

Importing values from excel into VBA -

is possible pull value excel sheet vba, use calculations export calculated value specific cell in excel sheet? yes possible, here's how (one of many methods) following code assumes running within excel. this gets value dim cellcontent string cellcontent = worksheets("asheet").range("a6").value and sets it worksheets("asheet").range("a6").value = "foo" hope helped

excel - 1004 Read-Only Error when Opening Closed Workbooks in VBA -

to give context problem i'm facing - keep in mind i'm relative novice - attempting write code open , close series of workbooks contained within folder, in order update number of vlookups on master data sheet (since update them, believe dependents need open). right now, i'm attempting 1 of files can go through , rest of folder. when attempt open file though, "run-time error 1004" message "excel cannot access 'foldername'. document may read-only or encrypted" the code i'm using is: sub openevery_v2() ' openevery_v2 macro ' keyboard shortcut: ctrl+shift+o ' dim diafolder filedialog <-- ideally user use dialog box select folder ' dim fname string ' dim originalwb workbook ' set originalwb = thisworkbook ' originalwb.save ' set diafolder = application.filedialog(msofiledialogfolderpicker) ' diafolder.allowmultiselect = false ' diafolder.show ' fname = diafolder.selecteditems(1) fname = ...

javascript - jQuery slideToggle keeps repeating -

i have simple jquery code looks this: $( "#resp-navigation" ).one("click", function() { $( "#navigation" ).slidetoggle(500); }); my html looks this: <div id="resp-navigation"> ... </div> <nav id="navigation"> ... </nav> my problem when click on #resp-navigation div, #navigation keeps toggling. meybe know why? thanks. if intention have '#navigation' div toggle each time clicks on '#resp-navigation' div, then: this: $( "#resp-navigation" ).one should be: $( "#resp-navigation" ).on and works fine in fiddle: http://jsfiddle.net/us0dm62c/ if, however, intention ever have '#navigation' div toggle once (so disappears , cannot shown again), code no modifications, can see in fiddle: http://jsfiddle.net/gktnhhm5/

PHP and MySQL Nested database connection -

this general example. application has 3 files. conn.inc.php -- setting database connection <?php $db_host = "localhost"; $db_username = "root"; $db_pass = ""; $db_name = "hmt"; $conn = new mysqli($db_host, $db_username, $db_pass, $db_name); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } ?> func.inc.php -- file including functions <?php function load_module($module_name){ $sqlcmd = "select content modules name='$module_name' limit 1"; $result = $conn->query($sqlcmd); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $module_footer = $row["content"]; } }else { echo 'error while loading module '.$module_name; } return $result; $result->free_result(); } ?> index.php -- main page display content <?php include 'conn.inc.php'; include 'func.inc.php'; if ...

java - Access NameBinding value inside my filter -

i've filter rest service. normal authentication filter. now need pass boolean in it. link got point: @namebinding @target({elementtype.type, elementtype.method}) @retention(value = retentionpolicy.runtime) public @interface authenticationfilterbinding { boolean checkaccountstatus() default true; } and in filter implementation i've: @authenticationfilterbinding @provider @priority(filterpriority.authentication_priority) public class authenticationfilter extends authenticationabstractfilter implements containerrequestfilter { private static final logger logger = loggerfactory.getlogger(authenticationfilter.class); @override public void filter(containerrequestcontext requestcontext) { // here need check value of checkaccountstatus() defined in code above. // how can access value? // filter logic goes here } } on endpoints i've like: @post @path("/photo") @consumes(mediatype.multipart_form_data) @authenticationfil...

java - No spreadsheets found when using AppIdentityService to authenticate -

i can authenticate app engine app using appidentityservice . when perform spreadsheetservice.getentries receive no entries. here's code: spreadsheetservice service = new spreadsheetservice("spreadsheet editing"); string[] scopesarray = { "https://spreadsheets.google.com/feeds" }; final list scopes = arrays.aslist(scopesarray); appidentityservice appidentity = appidentityservicefactory.getappidentityservice(); appidentityservice.getaccesstokenresult accesstoken = appidentity.getaccesstoken(scopes); credential creds = new credential(bearertoken.authorizationheaderaccessmethod()); creds.setaccesstoken(accesstoken.getaccesstoken()); service.setoauth2credentials(creds); spreadsheetfeed feed = service.getfeed(new url("https://spreadsheets.google.com/feeds/spreadsheets/private/full"), spreadsheetfeed.class); list spreadsheets = feed.getentries(); at point, spreadsheets empty list. i have shared spreadsheet app entering service account emai...

linux - What does the dot sign mean in the command -

i not familiar linux command line stuff. need find files suffix '.fvp' under directory , sub-directories. got online, works fine. didn't quite understand means. command line follows: ls -r | grep '.*[.]fvp' i know -r option listing recursively , pipe redirecting. why in single quote, there dot before asterisk , dot within brace. , whey not '*.fvp'? thank you! @grep uses regular expression (regex) syntax opposes glob syntax may used to. *.fvp glob expression trying do, regexes, different. . in regex matches single character. * means amount of preceding character. so, .* means character 0 or more times. [.] means, marc b said, literal period, because . means else.

unit testing - Spring controller tests with mocks -

so i'm having issues coming solution test. this method want test(i'm new this). clears fields on web page each time it's loaded. @requestmapping("/addaddressform") public string addaddressform(httpsession session) { session.removeattribute("firstname"); session.removeattribute("surname"); session.removeattribute("phone"); session.removeattribute("workno"); session.removeattribute("homeno"); session.removeattribute("address"); session.removeattribute("email"); return "simpleforms/addcontact"; } and here's have far test package controllertests; import java.text.attributedcharacteriterator.attribute; import org.junit.before; import org.junit.test; import org.junit.runner.runwith; import org.springframework.beans.factory.annotation.autowired; import org.springframework.mock.web.mockhttpsession; import org.springframework.test.context.conte...

Using date in a check constraint, Oracle -

i trying check add following constraint oracle returns error shown below. alter table table1 add (constraint gt_table1_closedate check (closedate > sysdate), constraint lt_table1_closedate check (closedate <= sysdate + 365)), constraint gt_table1_startdate check (startdate > (closedate + (sysdate + 730)))); error: error report: sql error: ora-02436: date or system variable wrongly specified in check constraint 02436. 00000 - "date or system variable wrongly specified in check constraint" *cause: attempt made use date constant or system variable, such user, in check constraint not specified in create table or alter table statement. example, date specified without century. *action: specify date constant or system variable. setting event 10149 allows constraints "a1 > '10-may-96'", bug permitted created before version 8. a check constraint, unfortunately, cannot referen...

can I able to dynamically intercept the endpoints in camel -

i need dynamically intercept endpoint based on tenant configuration.is there way dynamically intercept endpoint while starting camel context camel intercept lets this... intercept().when(body().contains("hello")).to("mock:intercepted"); from("direct:start") .to("mock:foo", "mock:bar", "mock:result");

javascript - ng-class expression: merge condition and class name -

supposing have 3 variables (they can change value): $scope.a = 'one'; $scope.b = true; $scope.c = false; <div ng-class="a"></div> renders <div class="one"> <div ng-class="{'two': b, 'three': c}"></div> renders <div class="two"> how can merge variable , expression render <div class="one two"> ? have write function? i tried: <div ng-class="[a, {'two': b}, {'three': c}]"></div> i've got 2 solutions in mind : see them working in plunker first : in html <div class="aclass {{a}}" ng-class="{'two': b, 'three': c}"></div> second : function <div class="aclass" ng-class="getclasses()"></div> and in controller $scope.a = 'one'; $scope.b = true; $scope.c = false; $scope.getclasses = function(){ var classes = ...

Bytes computation Javascript -

yesterday friend complaining how in bash couldn't sort list of elements because method calling ended return statement. eventually return instruction in bash returns defined amount of bytes, , reason of concerns. my question is: how work memory allocation in javascript? how know how many bytes commands void 0 or undefined are? that's pretty low level , know js not supposed these kind of tasks, yet curious on best way approach research. you don't allocate memory in js - environment you. cannot micro-manage it, , absolutely not matter how many bytes value takes. if needed know, you'll have @ implementation of engine using; , exact size of particular values in application can take heap snapshot profiler.

excel - Trying to write to a cell (Application defined or object defined error) -

i have following code: for each cell in worksheets("bulk & prod").range("b4:m4") if strcomp(cell.value, "#n/a") windows("analysis.xlsx").activate dim y workbook set y = activeworkbook y.sheets("sheet1").range("a:" & num).setvalue (wb.name) num = num + 1 end if next cell the idea want paste wb.name cell, num starts @ 1 , increments, leading nice column of file names. i've been using vba 3 days, , have hit dead end, awesome. assuming num set valid value, not 0, , wb refers valid object, should remove colon range address , there no setvalue method range in vba: range("a" & num).value = wb.name

sql server - Can't install LocalDB on Windows 8.1 -

i've developed application uses sql server (in particular localdb), and, have pushed out client. the client runs windows 8.1 x64, but, when try install either x86 or x64 version of sql localdb direct microsoft, keep getting error: microsoft sql server 2014 express localdb installation of product failed because not supported on operating system. information on supported configurations, see product documentation. i'm little bit stuck here, and, quite confused using localdb on windows 8.1 dev machine. how can resolve this? please right click localdb setup file , check if configured other compatibility mode. , make sure choose “run administrator” start installation. there similar thread reference, may require reinstall windows resolve os error. sql server 2014 express why not support windows 8.1 pro

c++ Search for char in char function? -

i have googled lot search solution, non far! need search in char variable char match. char somechar[] = { 0xc1, 0xc2, 0xd4, 0xd3 }; if (strchr(somechar, '0xd3') == null) { // did not find it! } strstr not work, strchar not work, ant other solution? many thanks! note need careful using values high signed char s. example, 0xd3 == (char)0xd3 not true, whereas 0xd3 == (unsigned char)0xd3 is. an example std::find : char somechar[] { 0x31, 0xc2, 0xd4, 0xd3 }; auto loc = std::find(std::begin(somechar), std::end(somechar), (char)0xd3); std::cout << "found @ " << std::distance(std::begin(somechar),loc) << std::endl;

angularjs - Output is concatenated -

new click on [filter] not clear previous output adding exists. example, if filtered "banned" see banned users list, next filter "registered" not remove "banned" adding "registered" end of table. in controller $scope.site_users overwritten, somewhere still saves previous filter output. why happens? may on packages side? installed packages: urigo:angular - angular angularui:angular-ui-router accounts-password accounts-ui twbs:bootstrap removed packages: insecure autopublish or in code controller: angular.module("sis_admin_am").controller("userslistctrl", ['$scope', '$meteor', function($scope, $meteor){ $scope.filter = function(){ $scope.site_users = ''; $scope.site_users = $meteor.collection(users).subscribe('site_users_filtered', {status: $scope.userstatus}); }; } ]); view: <form ng-submit="filter()"> <...

vb.net - Meitrack device what to return to confirm server recived data -

i communicating meitrack odb device, can receive data when set protocol to"event report needs servers confiramtion " , field (i resume cache count". in documentation can find "aff" return device, doesnt seem clear cache though. ***deleting gprs event in cache zone – aff gprs setting aff, number of deleted gprs events gprs responding aff, number of remaining caches,command type, (-) latitude,(-) longitude,data and time,status,number of satellites,gsm signal status,speed,direction,horizontal positioning accuracy,altitude,mileage,run time,base station information,i/o port status,analog input value description number of deleted gprs events: hexadecimal string. default value 1. number of remaining caches: total number of events in internal flash memory. hexadecimal string. applicable model example gprs sending @@h27,353358017784062,aff,1*0b\r\n gprs receiving $$h28,353358017784062,aff,ok*3d\r\n you can not communicate device o...

Automatically reading data files containing special characters in Matlab -

i import data file in matlab generated external software automatically . this data file can contain special characters in third column @ random places. therefore, cannot utilize dlmread. i'm figuring out how import file automatically in matlab while inserting data in matrix. also, identifying special characters , replacing them nan necessary. here sample data better picture of problem: naca0012 alfa = 25.00000 re = 0.000 xflap,yflap = 0.000000 0.000000 x y cp 1.00000 0.00126 0.53803 0.08399 0.04389 -7.27148 0.07278 0.04150 -8.16799 0.03346 0.02983-15.69087 0.02840 0.02771-18.03665 0.02399 0.02566-20.81862 0.00360 0.01041-95.28658 0.00238 0.00851********* 0.00141 0.00659********* 0.00070 0.00467********* 0.00025 0.00277********* 0.00003 0.00091********* 0.00003 -0.00091********* 0.00025 -0.00277-93.41611 0.00070 -0.00467-72.18787 0.00141 -0.00659-51.54605 0.00238 -0.00851-37.04853 notice how third column gets sort of ...

c# - How to Let Two Processes Running on Different Hosts Communicate via Named Pipe -

i'm using named pipes let 2 processes running on different hosts communicate. here server code: public class pipeserver { public static void main() { pipesecurity ps = new pipesecurity(); ps.addaccessrule(new pipeaccessrule("everyone", pipeaccessrights.fullcontrol, system.security.accesscontrol.accesscontroltype.allow)); namedpipeserverstream pipeserver = new namedpipeserverstream( "testpipe", pipedirection.inout, 4, pipetransmissionmode.message, pipeoptions.writethrough, 1024, 1024, ps); streamreader sr = new streamreader(pipeserver); streamwriter sw = new streamwriter(pipeserver); { try { pipeserver.waitforconnection(); sw.writeline("waiting"); sw.flush(); pipeserver.waitforpipedrain(); string message = sr.readline(); sw.wri...

html - Nested web component's `attachedCallback` not running on appended -

Image
i'm playing w3c web components. i have homepage, includes component a: <!-- homepage.html --> <link rel='import' href='a.html'> <component-a></component-a> in component include component b: <!-- a.html --> <link rel='import' href='b.html'> <template> <component-b></component-b> <component-b></component-b> </template> <script> void function() { var currentdocument = document.currentscript.ownerdocument function gettemplate(selector) { return currentdocument.queryselector(selector).content.clonenode(true) } var proto = object.create(htmlelement.prototype) proto.attachedcallback = function() { console.log('a') this.appendchild(gettemplate('template')) } document.registerelement('component-a', { prototype: proto }) }() </script> b's code similar a: <!-- b.html --> <...

python - Perl: counting many words in many strings efficiently -

i find myself needing count number of times words appear in number of text strings. when this, want know how many times each word, individually, appears in each text string. i don't believe approach efficient , give me great. usually, write loop (1) pulls in text txt file text string, (2) executes loop loops on words want count using regular expression check how many times given word appears each time pushing count array, (3) prints array of counts separated commas file. here example: #create array holds list of words i'm looking count; @word_list = qw(word1 word2 word3 word4); #create array holds names of txt files want count; $data_loc = "/data/txt_files_for_counting/" opendir(dir1,"$data_loc")||die "can't open directory"; @file_names=readdir(dir1); #create place save results; $out_path_name = "/output/my_counts.csv"; open (out_file, ">>", $out_path_name); #run loops; foreach $file(@file_names){ i...

javascript - Centering text label in mapbox-gl-js? -

Image
i'm trying center text label on feature polygon in mapbox-gl-js. possible? looks option related placement of label "symbol-placement" layout property ( https://www.mapbox.com/mapbox-gl-style-spec/#symbol ): symbol-placement optional enum. 1 of point, line. defaults point. label placement relative geometry. line can used on linestrings , polygons. using "point" places label @ bottom right corner of feature: ideas? you can use turf library find centroid of polygon, make symbol point co-ordinate , add text field it. see below example text label displayed on centroid of polygon feature mapboxgl.accesstoken = 'pk.eyj1ijoiyxj1bmficmfoyw0ilcjhijoiodbjtv9wusj9.m5tbz5xyg8vhd-8qu7d_sa'; // initialize map var map = new mapboxgl.map({ container: 'map', // container id style: 'mapbox://styles/mapbox/streets-v8', //stylesheet location center: [-68.13734351262877, 45.137451890638886], // starting po...

plsql - What encoding is used when calling an Oracle PL/SQL procedure -

on coldfusion page call pl/sql procedure. html form encoded using utf-8, oracle db has encoding we8iso8859p1 . kind of conversion happens in case of i_value below? i'm interested in happens ms word left quote (which encoded in utf-8 e28098 ). when decode i_value in pl/sql becomes 18 (hex). considering u+2018 makes sense, still wonder why 20 swallowed. <cfstoredproc procedure = "my_schema.lib.write_field" datasource="#datasource#"> <cfprocparam cfsqltype="cf_sql_varchar" variable="i_name" value="remark" type="in"> <cfprocparam cfsqltype="cf_sql_varchar" variable="i_value" value="#form.remark#" type="in"> </cfstoredproc> coldfusion java based guess string variables encoded using utf-16. when going utf-16 (2 byte encoding) 1 byte encoding(e.g. we8iso8859p1 ) case in example, msb ignored , lsb considered. this explain obs...

PHP PHARs with composer? -

i've been thinking of advantages , disadvantages of distributing app single phar. i'd still use composer manage random dependencies have, though. means writing phar if stuff changes, understand @ best convoluted process. what's best way of reconciling that? should keep app self-contained , have work external /vendor dir? thanks in advance! considering composer.phar file includes few symfony components, other libraries written author, , put .phar file distribution (including, explicitly, a number of vendor/ sub-directories ), doesn't seem unreasonable include required vendor directories own project.

c - Warning: Suspicious pointer-to-pointer conversion (area too small) with lint -

long keyintvalue; uint8_t *value; *(long *)value = keyintvalue; i suspicious pointer-to-pointer conversion (area small) while linting. me understand why , how rid of it? you casting "pointer uint8_t" ( uint8_t * ) long * . uint8_t 1 byte (assuming 8 bits) available, assgnment long * overflow following bytes (a long has @ least 32 bits = 4 bytes) not belong object pointed to, creating undefined behaviour (ub). note shown, value undefined @ time of assignment, exhibiting ub.

if statement - if and else if do the same thing -

i'm trying refactor if-else chain doesn't particularly good. common sense telling me should able call method once can't figure out elegant way it. have is: if(condition1) method1; else if(condition2) method1; which looks hideous. there's repeat code! best can come is: if(condition1 || (!condition1 && condition2)) method1; but looks bad, since i'm negating condition1 after or, seems unnecessary... i made truth table this: c1| c2| r 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 1 and in case interested, real-life problem i'm having got 2 intances of fancytree in javascript , want set rules transferring nodes between them. tree can transfer lone nodes tree b, while tree b can reorder freely, put on tree b's dragdrop event: if(data.othernode.tree === node.tree){ data.othernode.moveto(node, data.hitmode); } else if(!data.othernode.haschildren()){ data.othernode.moveto(node, data.hitmode); } you can simp...

sql server - SQL slow subquery -

i trying retrieve data large audits table (millions of rows). need make query run efficiently possible. first playing subquery return objecttypeid , use limit query on audit table this query taking 4 minutes run: select distinct audits.objecttypeid, count(*) count audits audits audits.objecttypeid = (select distinct objecttype.objecttypeid objecttype objectname = 'data') group audits.objecttypeid if default in objecttypeid query runs in 42 seconds select distinct(audits.objecttypeid), count(*) count audits audits.objecttypeid = 1 group audits.objecttypeid but subquery when run in isolation takes second run. why should first query take long? i can see 3 things might help: pull objecttypeid variable: since there should 1 value it take out distinct on both queries since should unnecessary (the subquery should have 1 value , grouping value in outer query take out group since querying 1 objecttypeid so final query be: declare @objecttypeid int ...

c# - How to Add multiple item in list Windows Phone -

i working on windows phone app , want add item in exists list problem when have added first item ok when adding second item list replace previous added item private void btn_profession_loaded(object sender, routedeventargs e) { try { selectedkeywordsids = app.skillids; // selected keyword selectedprofname = app.professionalname; selectedprofid = app.professionalid; this.btn_profession.content = selectedprofname; key = app.skillkeywords ; pro = app.professionalname; final1=key.replace(pro, ""); list<string> numbers = final1.split(',').tolist<string>(); numbers.add(selectedkeywordsids); numbers = numbers.where(s => !string.isnullorwhitespace(s)).distinct().tolist(); listbox1.itemssource = null; listbox1.itemssource = numbers; } it looks building list previo...

Generating sequential alphanumeric numbers on ASP.net C# -

i want generate following sequence of alphanumeric string in asp.net c#. aa000 aa001 ... aa999 ab000 ab001 ... az999 ba000 ba001 ... zz999 " something ( linq ): var source = enumerable .range(0, 1000 * 26 * 26) .select(x => ((char) ((x / 1000) / 26 + 'a')).tostring() + ((char) ((x / 1000) % 26 + 'a')).tostring() + (x % 1000).tostring("000")); ... foreach(string item in source) { ... } to see whole sequence (e.g. debugging etc): // aa000 aa001 aa002 ... aa999 ab000 ... az999 ba000 ... zz999 mytextbox.text = string.join(" ", source);

.net - Sign out In ADFS2.0 with WIF application -

i have followed this link understand wif application adfs 2.0 , installed adfs2.0 , sample application (in iis) in same machine,now can login sample application active directory username , password ,but problem ,although sign out sample application redirects me login.aspx page when click button in browser , refresh can still logged in ,that means session not expiring in application .do need clear logged in session in adfs ?if how can ?i have used "federatedpassivesigninstatus" tool assumed logout both application , adfs . this demo in gif. <wif:federatedpassivesigninstatus id="federatedpassivesigninstatus1" runat="server" onsignedout="onfederatedpassivesigninstatussignedout" signinbuttontype="link" federatedpassivesignout="true" signoutaction="federatedpassivesignout" /> protected void onfederatedpassivesigninstatussignedout(object sender, eventargs e) { wsfederation...

php - Laravel 5, calling function inside compose@ViewComposer logs fatal error and returns result as expected -

i trying route name app('request')->route()->getname(); inside compose method of view composer called boot method of serviceprovider. the result returns expected (foo.create etc.) but, when check log files, laravel 5 logs, exception 'symfony\component\debug\exception\fatalerrorexception' message 'call member function getname() on null' and can't understand how can undefined function return right object , can call method on it. any appreciated. thanks. i got current route's name in different way , did not see in logs, maybe try this: public function boot() { view()->composer([...], function($view){ dd(\route::currentroutename()); about error, i'd guess ->route() returning null, hence error, laravel sends getname() message app('request') works. can try app('request')->getname(); or app('route')->getname();

android - Getting same list for two tabs in tabs with listview on start of activity -

so,i have activity has tabs listviews in them, , problems i'm facing are: the first , second tabs having same content i.e. content second tab should have in first , second tab. the third tab has correct content, though because instantiates first , second tabs initially. when set mviewpager.setoffscreenpagelimit(2); all 3 tabs have same content, of third tab. but after i've scrolled third tab , scroll first one, first 1 refreshes , has correct content. also, next problem second tab never refreshes,because on right or left tab opened. want tabs refresh every time opened since i'll changing material in lists. package com.towntrot.anil.towntrot_eventmanager_02; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.listview; import android.widget.toas...

How to interrupt boost::this_thread in c++ -

in application have given sleep of 10 sec. have given sleep using boost::this_thread::sleep function. there possible way interrupt boost::this_thread::sleep function.? from sleep() reference : throws: boost::thread_interrupted if current thread of execution interrupted. notes: sleep() 1 of predefined interruption points . so need in thread put sleep() call in try-catch , , catch boost::thread_interrupted . call interrupt() on thread object interrupt sleep. by way, sleep reference : warning deprecated since 3.0.0. use sleep_for() , sleep_until() instead.

c# - CollectionChanged Event is not firing on a static ObservableCollection -

in 1 class i'm adding objects observablecollection. , in class, i'm doing stuff added object , delete collection. those 2 classes cannot communicate each other, decided go static collection (i have access class definition reason) in first class, elements added (i checked count property), in second class subscribe collectionchanged event. however, event not raising. think it's because of static keyword, i'm not sure. here code sample: static public class { public static observablecollection<object> mycollection = new observablecollection<object>(); } public class b { public b() { a.mycollection.collectionchanged += func_collectionchanged; } void func_collectionchanged(...) { //stuff } } public class c { public void func() { a.mycollection.add(object); } } here works fine me: class program { static void main(string[] args) { b obj = new b(); } } public class { ...