Posts

Showing posts from July, 2011

java - Get data from sqlite on android -

i trying fetch data sqlite database on android. however, when run code , see android monitor, message: 04-14 15:27:27.737 11177-11177/com.example.daniel.toto e/cursorwindow: failed read row 0, column -1 cursorwindow has 6 rows, 5 columns. this method in database helper class use data database: public arraylist<string> getallsales() { arraylist<string> array_list = new arraylist<string>(); sqlitedatabase db = this.getreadabledatabase(); cursor res; res = db.rawquery( "select * sales", null ); if (res != null) { res.movetofirst(); while (res.isafterlast() == false) { array_list.add(res.getstring(res.getcolumnindex(sales_table_name))); res.movetonext(); } return array_list; } else { array_list = null; } return array_list; } this call in oncreate method activity: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstances

calculated properties in hubspot -

was after assistance. using instapages landing page lead generation , have form data integrated hubspot. we able have calculated values returned client in automated email sequence. hubspot can handle templated email sequence not sure how include calculated values in hubspot properties. any suggestions welcome. cheers

c++ - How to avoid defining the whole template class in header file -

i have class this: template <typename t> class c { public: c(t t): t{t} {} void publicmethoda() { privatemethoda(); } void publicmethodb() {} void publicmethodc() {} // ... private: void privatemethoda() { t.call(); /* 1 place uses t member */ } void privatemethodb() {} // ... t t; }; in example need template field t in 1 place (in privatemethoda ) , forces me define each method in header file (but not use t member). how can avoid this? have ideas? you can put not depend on t in base class , inherit it. anyhow, fact class template, has many methods not depend on template parameter suggests putting stuff inside single class better belongs seperate ones.

python socket programming settimeout() timer not reset each call -

the settimeout(10) function reset it's timer 10 when each time call connectionsocket.recv(1024) i want timer reset if send active server. this: timeout = 10 connectionsocket.settimeout(timeout) while 1: sentence = connectionsocket.recv(1024) if sentence.decode() == 'active': #reset timer of settimeout() this application level constraint, not tcp can handle you. you can set timeout acceptable error margin (eg. if want wait 10s total, timeout of 1s give 11s in worst case) , handle timeout of transaction yourself.

c# - Insufficient memory to continue the execution of the program" error when run WPF application that uses the RenderTargetBitmap class -

currently, working on project detect face live video. had used ms cognitive service face api detect face , opencvsharp streaming live video. need draw face rectangle on live video screen. had override frame draw content(whatever want). working on pc while gives error in machine although same configuration. can please suggest wrong there: private static bitmapsource drawoverlay(bitmapsource baseimage, action<drawingcontext, double> drawaction) { double annotationscale = baseimage.pixelheight / 320; drawingvisual visual = new drawingvisual(); drawingcontext drawingcontext = visual.renderopen(); drawingcontext.drawimage(baseimage, new rect(0, 0, baseimage.width, baseimage.height)); drawaction(drawingcontext, annotationscale); drawingcontext.close(); rendertargetbitmap outputbitmap = new rendertargetbitmap( baseimage.pixelwidth, baseimage.pixelheight, baseimage.dpix, baseimage.dpiy, pi

windows - How to use GtkAda in command-line? -

i try compile simple gtkada application in command-line, on windows. here app code: `with gtk.main ; use gtk.main ; gtk.window ; use gtk.window ; procedure test01 win : gtk_window ; begin init ; gtk_new(win) ; win.show_all ; main ; end test01 ;` compiling with gcc -c test01.adb -ic:\<<path_to_gtkada\include\gtkada>> , obtain test.ali , test01.o expected. but how link libs please? gcc test.o -lc:\<<path_to_gtkada>>\lib gives: `test01.o:test01.adb:(.text+0xe): undefined reference `gtk__main__init' test01.o:test01.adb:(.text+0x21): undefined reference `gtk__window__gtk_new' test01.o:test01.adb:(.text+0x3e): undefined reference `__gnat_rcheck_ce_access_check' test01.o:test01.adb:(.text+0x5e): undefined reference `gtk__main__main' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: test01.o: bad reloc address 0x20 in section `.eh_f rame' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../..

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback ca

python - MQTT paho client Connection timeout error -

i running mqtt mosquitto broker on laptop. trying connect 2 paho mqtt clients it: 1) android phone using java paho , 2) raspberry pi using python paho. from android connection made perfectly. no problems. however, raspberry reason can not connect. instead client.connect method blocks , after time receive following: traceback (most recent call last): file "sensorsclient.py", line 28, in <module> client.connect(mqttserver, 1883) file "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 700, in connect return self.reconnect() file "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 822, in reconnect sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0)) file "/usr/lib/python2.7/socket.py", line 571, in create_connection raise err socket.error: [errno 110] connection timed out the code connection below: import paho.mqtt.client mqtt def

typescript - Error in sinon when I try to stub getter again -

when try stub getter again, have error: typeerror: cannot redefine property: cqlfilter @ function.defineproperty (<anonymous>) this part of test code: const layer = new layer(); const cqlfilterstub = sinon.stub(layer, "cqlfilter"); cqlfilterstub.get(() => "test"); // error occurs in line cqlfilterstub.get(() => null);

javascript - Post data to Mongodb using Angular -

i'm trying post form mongodb using angular, i'm not sure how it. i've made connection mongodb node, , works, trying using angular this form: <form action="/insert" method="post"> <div class="title-1">contact</div> <div class="col-sm-6"> <div class="group"> <input type="text" id="name" name="name" required/> <label>naam *</label> </div> <div class="group"> <input type="text" id="adress" name="adress" required/> <label>straat + huisnummer *</label> </div> <div class="group"> <input type="text" id="postal" name="postal" required/> <label>postcode *</label> </div>

ionic2 - Ionic 2 app works using "ionic run android", but not on IonicView -

when run ionic2 app using ionic run android works perfectly, , works using ionic serve, when i'm trying run using ionic view see blank screen. what doing wrong? did make sure use cordova plugins supported ionic view? otherwise need handle separately.

c# - How to Separate NEO4J db Connection in Asp.net Core? -

in neo4j driver .net run queries should use below code using (var driver = graphdatabase.driver("bolt://localhost:7687", authtokens.basic("neo4j", "neo4j"))) using (var session = driver.session()){ { var statementtemplate = "match (n:test {id:{id}}) return n.name test"; var statementparameters = new dictionary<string, object> { { "id", "121" } }; var statementresult = session.run(statementtemplate, statementparameters); console.writeline(record["test"].as<string>()); } now want have code in class when want run queries call class , run query i put graphdatabase.driver in new method , call method in startup constructor

google bigquery - Why standard SQL UDF increase the Bytes billed so much for all the query after it? -

bq support team, we investigate standard sql udf in bq, , seems works pretty good. noticed can costly use it. bytes billed can hundred times original table. think makes sense udf make need memory process. not understand queries use table generated udf sql still use memory udf sql. our original table 1.03k, , udf sql run has 10m billed. , below job info normal query: select * project.udf_sql_table_name ; job id * creation time apr 14, 2017, 2:57:29 pm start time apr 14, 2017, 2:57:29 pm end time apr 14, 2017, 2:57:30 pm bytes processed 1.05 kb bytes billed 10.0 mb billing tier 1 destination table * use legacy sql fase from job info, can see udf sql generate table 1.05k, saved project.udf_sql_table_name. , simple "select", "bytes billed" still 10m, 1000 times bigger processed table. may know correct when using udf? thanks the "bytes billed" still 10m, 1000 times bigger processed table. ... correc

sql - Get column with two two rows having specific values -

i have table looks this: | col1 | col2 | |------|------| | | 1 | | | 2 | | | 3 | | b | 1 | | b | 3 | | c | 1 | | c | 2 | i need find value of col1 2 rows same col1 value exist has col2 value of 1 , 2 results be: | col1 | |------| | | | c | you can filter rows col2 values want, group col1 , take groups count = 2 select col1 yourtable col2 in (1, 2) group col1 having count(distinct col2) = 2

List multiple 'options' (CakePHP 3) -

i'm new cakephp 3 let me know if need add more details. i editing add.ctp page , trying list available options. trying list 5 personality traits (prideful, respectful, pervasent, loyal, bold , disciplined) in database. how go listing these options ability add value each? here current code: echo $this->form->control('name_id', ['options' => $names]); echo $this->form->control('personalities_id', ['options' => $personalities]); echo $this->form->control('value'); example of need: name prideful, value respectful, value pervasent, value loyal, value bold, value disciplined, value i create inputs through looping. i'm not sure $personalities array or controller action looks like, basic idea. foreach ($personalities $personality) { echo $this->form->text("{$personality}"); } cakephp 3 form docs

python - csv class writer : a bytes-like object is required, not 'str' -

for personal project i'm trying upgrade paterns package python 3. i'm running test:db.py, i'm stuck following error in '__init__.py' file, on csv class: this code snippet od save() function: there, dfine s bytesio() stream, function asked stream bytes self csv file. error comes line: w.writerows([[csv_header_encode(name, type) name, type in self.fields]]) typeerror: bytes-like object required, not 'str' ( below, code function) it's supposed csv_header_encode deliver bytes, , checked , does, somehow, in conversion list changes 'str'. , if change s encoding stringsio complaining comes from f.write(bom_utf8) any appreciated. def save(self, path, separator=",", encoder=lambda v: v, headers=false, password=none, **kwargs): """ exports table unicode text file @ given path. rows in file separated newline. columns in row separated given separator (by default, comma). data typ

asp.net - .ashx handler not getting gzip compressed despite IIS Config setting -

i have handler in sitecore site that's beeing used on of pages. site gzip-compressed via web.config settings, , other files show proper headers indicate gzip compression. google analytics page speed suggestions reporting 1 handler file not being compressed. way file gzip-encoded? inherits ihttphandler, irequiressessionstate.

javascript - Angular ng-repeat not working spotify app -

ng-repeat not seem work app.js var app = angular.module('angularjs-starter', ['jsonservice', 'ngroute', 'ngresource']) app.controller('mainctrl', function($scope, jsonservice) { //jsonservice.get(function(data) { // $scope.name = data.artists.href; // $scope.children = data.artists.items; //}); $scope.searchshow = () => { jsonservice.search.query({ show: $scope.showname }, (response) => { console.log(response); // $scope.name = response.artists.href; $scope.children = response; }) } $scope.showdetails = (id) => { console.log(id); jsonservice.detail.get({ details: id }, (response) => { console.log(response.items); // $scope.name = response.artists.href; $scope.details = response.items; }) } }); app.config(['$locationprovider'

html - Horizontal Navigation Bar won't be as long as page -

horizontal nav bar won't take whole screen , i'm not sure how that. here's looks like. also, once it's done that, want image on top of nav bar, instead of above it. appreciated. html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } nav li { list-style-type: none; display: inline-block; padding: 1em; back

c++ - Why my comparison with an HEX enum fails? -

i seeing weird issue whe comparing hex value stored enum , value read register, have defined chipid follows enum { bme_280_1_chipid = 0x60, bme_280_2_chipid = 0x58, }; i have snippet of code in driver chip id check uint8_t id = read8(bme280_register_chipid); if ( ( id != bme_280_2_chipid) || (id != bme_280_1_chipid) ){ #ifdef debug uint8_t value = read8(bme280_register_chipid); debugprint("bme280 debug: read bme280_chipid "); debugprint(value,hex); debugprint( " expected "); debugprint(bme_280_1_chipid,hex); debugprint( " or "); debugprintln(bme_280_2_chipid,hex); #endif return false; } my read8() funtion uint8_t adafruit_bme280::read8(byte reg) { uint8_t value; wire1.begintransmission((uint8_t)_i2caddr); wire1.write((uint8_t)reg); wire1.endtransmission(); wire1.requestfrom((uint8_t)_i2caddr, (byte)1); value = wire1.read(); return value; }

java - No output from Google Endpoints API -

i trying retrieve entities called 'blayer' stored in datastore. running ok without error, not returning anything. @ end of road here. since part of backend, can't stepwise debug either. here endpoints code: @apimethod(name = "getblayers") public arraylist<arraylist<blayer>> getblayers(@named ("bnames") arraylist<string> bnames) { asyncdatastoreservice datastoreservice = datastoreservicefactory.getasyncdatastoreservice(); key blayerparentkey = keyfactory.createkey("tour",tour_name); arraylist<blayer> blayers = new arraylist<blayer>(); arraylist<arraylist<blayer>> blayersgamelist = new arraylist<arraylist<blayer>>(); arraylist<list<entity>> resultsall=new arraylist<>(); arraylist<string> realnames = new arraylist<string>(arrays.aslist(bnames.get(0).split(","))); if(bnames.size()==1){ bnames=realnames; }

d3.js - Using d3 to read in information from a CSV file, how can i store values of a particular type into a variable? -

Image
i have code reads information in csv file. information regarding road traffic accidents. so code, can target values using 'd['weather conditions']' gives me - which great! i'm looking store values of particular types in variables. e.g values equal 'fine without high winds' stored in array object 'var windy' or similar, there anyway go simply? *update some sample data any appreciated. thanks right now, in code, printing console each weather condition encounter go on dataset row row. if want group data based on weather conditions, can using d3.nest() . the example below uses simple json data show how can it. here, using d3.nest() , setting key weather condition , values object. after structuring, data grouped, can check running script below: accidents rainy under key rainy , same other weather conditions. var data = [{ "weather condition": "rainy", "property1": "val1"

jquery - Find nearest polygon on svg -

https://codepen.io/jriggs/pen/yvpvwv clicking on colored part of "childrens learning center" works expected, clicking on text returns letter path object, want polygon contains text $("#svg_id > *").click(function () { ...do stuff $(this) } the problem there shapes text 'on top' of polygon when click on them selected , not polygon. clicking on i need getparerent svg. can edit svg code if necessary i have tried use polygon selector, , jquerys closest: $(this).closest('polygon') and messing z-index properties no success. file given mefrom designer if there way export in more jquery friendly format may option. image floorplan many shapes , layers. if want target clicked element in svg... should use event target. i don't know wish do... console.log clicked ellemet class , tagname . make more obvious visually, change fill color cyan. see in codepen . $(document).ready(function () { $("#layer_1")

javascript - Multiscroll.js and scroll inside div -

i looking solution of problem contected multiscroll.js plugin. creating website - demo - , need allow user scroll photos inside last div (right column). had use multiscroll.js because effect of scroll necessary me. can me? :) thank , time.

Android contradicting documentation about lifecycle callbacks onPause() and onStop() -

intuitively, applicable callback perform stuff in onpause() . yet, there seems contradiction in documentation: according https://developer.android.com/guide/components/activities/activity-lifecycle.html : onpause() execution brief, , not afford enough time perform save operations. reason, you should not use onpause() save application or user data, make network calls, or execute database transactions; such work may not complete before method completes. instead, should perform heavy-load shutdown operations during onstop() . you should use onstop() perform relatively cpu-intensive shutdown operations . example, if can't find more opportune time save information database, might during onstop(). according https://developer.android.com/reference/android/app/activity.html : note "killable" column in above table -- methods marked being killable, after method returns process hosting activity may killed system @ time without line of

java - JTextArea not editable -

i came across following problem. want have scrollable jtextarea , create 1 that: jscrollpane scrollabletextarea = new jscrollpane(); jtextarea text = new jtextarea(); scrollabletextarea.add(text); the result have grey field cannot write into. if create jtextarea works: jscrollpane scrollabletextarea = new jscrollpane(new jtextarea()); where mistake leads behaviour? if create jtextarea works: a jscrollpane uses own custom layout manager. scrollpane contains areas for: horizontal/vertical scrollbars a "row header" , "column header" components @ top/right , top/left of scroll pane the "viewport" used contain component want scroll when use following: scrollabletextarea.add(text); this mess scroll pane because component added scroll pane directly , not viewport of scroll pane when use: jscrollpane scrollabletextarea = new jscrollpane(new jtextarea(5, 20)); this create scroll pane , add text area viewport of scroll

How to run a PHP program from command prompt on a Windows Machine? -

Image
i'm php developer profession. i'm using lenovo ideapad laptop runs on windows 10 home single language 64-bit operating system i've installed xampp control panel v3.2.2 @ location "c:\xampp" execute php programs in web browser on machine. the "php.exe" file present @ location "c:\xampp\php" . the document root directory save php files @ location "c:\xampp\htdocs" . i'm able run php programs created , saved in directory c:\xampp\htdocs\html_playground starting xampp software(by double clicking on xampp shortcut present on desktop) , entering url of program file " http://localhost/html_playground/sample.php " in browser's address bar. this way i'm able run php programs finely want run same program windows command prompt for done following steps : went went advanced system settings (control panel\system , security\system\advanced system settings) then clicked on environment variables

telerik - Getting a reference to the text box elements on an edit -

in mvc grid, i'm trapping edit event follows: .events(events => events.change("gridrowchange").edit("onedit")) in onedit() method gets called when edit occurring, i'd reference text box elements each editable cell in row can attach onblur event of them. how go getting reference each text box element in row being edited? as per telerik's documentation onedit : the event argument exposes 3 fields: dataitem - javascript object editor row bound to. undefined during insertion. mode - string value either "insert" or "edit" form - dom element contains editing components (textboxes, checkboxes, dropdownlists etc.) this should reference given textbox: function onedit(e) { var yourtextbox = $(form).find("#your_id"); yourtextbox.on("blur", function () { //your on blur code here }); }

mean stack - Which production code base to use -

i've spent past several months building small search app based on mean stack. in course of development, found several flavors of stack, meant seems production deploys , large teams (meanjs.org , mean.io) , seems simplistic possible started (megaboilerplate, , degree hackathon-starter- have add "a"). i'm done development , want deploy app have bit of dilema. i've never deployed app before , guidance. deploy on large more complex stack meanjs or keep simple , deploy on megaboilerplate or hackathon? seems meanjs , hackathon more complete, taking security account. megaboilerplate nice , simple, may lack security features. meanjs seems more complete (while bit dated), hackathon-starter similar meanjs, more updated. megaboilerplate simple, leads me believe may missing vital security features. anyone have experience deploying either stack? note: know mentioned mean.io, however, never integrated search app - worth try?

r - How to convert list.files() output to an int? -

this question has answer here: how count number of files read list? 1 answer the output when checking empty directory r's list.files() character string... > list.files('/home/somedir') character(0) but test length , use in control structure like > current <- '/home/somedir' > dirpick <- function(){ trycatch( if (length(list.files(current) > 0)) { dirdata <- current } else { dirdata <- old } ) } but object returned list.files() doesn't act i'd expect: > list.files('/home/somedir') == 0 logical(0) > as.numeric(list.files('/home/somedir')) == 0 logical(0) not sure understand difference between logical , boolean, why doesn't act integer zero? try: length(list.files('/home/somedir')) == 0 the value character(0) ind

Word VBA: Make macro easy to run -

i've made form-letter document macro performs mail merge. don't want user have run menus, , want portable. if there's way button appear on each user's ribbon or quick command menu, i'm not familiar it. so put button in document itself. unfortunately, every form-letter created has same button in it. suppose write code delete every one, think slow. is there way assign shortcut key existing macro, , have reside in document? i had implement pretty similar referring 10 staff. solution (by no means portable desired) export macros , forms normal template other users, coupled ribbon customization , worked well. unfortunately, when change needed, had trudge on everyone's machine individually. i suggest stick solution of deleting button after merge complete. here's code that: sub deletecommandbutton() each o in activedocument.inlineshapes if o.oleformat.object.name = "commandbutton1" o.delete end if ne

Custom Facebook author tag wordpress -

i have function in wordpress checks if user of post haves facebook id add specific meta tag facebook id else if empty it's adding preset facebook id. problem if user of post haves facebook id in facebookurl area function adding default facebook id. function facebook_author_tag() { if ( is_single() ) { global $post; $author = (int) $post->post_author; $facebook_url = the_author_meta('facebook_url'); if ( !empty( $facebook_url ) ) { echo '<meta property="article:author" content="'. $facebook_url .'" />'; } else{ echo '<meta property="article:author" content="https://www.facebook.com/test" />'; } } } add_action( 'wp_head', 'facebook_author_tag', 8 ); and code used insert socials fields in user's page. function my_new_contactmethods( $contactmethods ) { // add twitter $contactmethods['twitter'] =

swift - getting "unexpectedly found nil" AFTER performing nil check -

despite checking nil, getting fatal error: unexpectedly found nil while unwrapping optional value error being caught in conditional (first line below) if (obj.prop != nil && obj.prop?.otherprop != nil) { anotherobj.yetanotherprop = (obj.prop?.otherprop nsurl).absolutestring } i have tried if let follows (xcode highlights 2nd let being unexpected nil found): if let obja = obj.prop, let otherprop = obja.otherprop { anotherobj.yetanotherprop = (otherprop nsurl).absolutestring } why don't either of these work?! i getting source object ( obj in both cases above) 3rd party library written in objective c. suspecting checking nil wrong somehow? so in writing think sort of figured out. don't knwo why first 1 doesn't work, second works as: if let obja = obj.prop, let otherprop = obja?.otherprop { anotherobj.yetanotherprop = (otherprop nsurl).absolutestring }

java - Why i am getting error saying illegal start of expression at public class Name{ -

define string variable named firstname stores name. set value name question , code follow: public class name{ public static void main(string[] args){ console console=system.console(); string firstname="bhawani"; console.printf("heloo name %s",firstname); console.printf("%s learning java",firstname); } } you have spelling mistakes, however, here's updated version of code should run. public class name{ public void main(string[]args){ console console = system.console(); string firstname = "bhawani"; console.printf("hi, name %s", firstname); console.printf("%s learning how write code in java", firstname); } } you should make sure check code correct before asking questions :) you mispelt: system.consol(); console.printf("%s learning how write code in java", firstname); also, should note using console return null unless application runs through termin

makefile - gmake - loop through and process runtime variables -

i have makefile following content: m_one = 1 m_two = 2 m_three = 3 numbers = $(foreach v, $(shell echo "$(.variables)" | sed 's/ /'$$"\n"'/g' | grep "^m_" | xargs), $(info $(v)=$($(v)))) get-numbers: numbers=$(numbers) ;\ echo -e "numbers: \n$$numbers" ;\ echo -e "numbers: \n$(numbers)" i have variables start same pattern, here "m_". want retrieve values of variables run-time, , execute shell tasks each 1 of them. when execute command here get: $ gmake --silent get-numbers m_two=2 m_one=1 m_three=3 m_two=2 m_one=1 m_three=3 numbers: numbers: it's if variable 'numbers' empty. don't understand why since escaped it's declaration. , actually, it's if gmake variable 'numbers' empty too. what want loop through "key=values" , file processing (sedding). how can solve this, or approach consider ot so? that seems lot of work wa

c# - Delete xml file after create a Visual Studio Setup Project -

Image
all time when create setup project in visual studio 2015 ,just have xml file. what need delete file? don't choose xml file this screen choose in application folder : really searched forum etc can't find solution . have same problem? edit 1 <?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> </configsections> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5.2" /> </startup> <usersettings> <c_sharp_od_nowa.properties.settings> <setting name="login" serializeas="string"> <value /> </setting> <setting name="password" serializeas="string"> <value /> </setting> <setting name="checkbox_rememberme" serializeas="s

ecmascript 6 - typesafe rest parameter in ES6 -

do have way make rest parameter typesafe. trying following code throwing error, <script> function addn(name, ...numarray:number[]){ let result = 0; numarray.foreach((n) => result += n); return result; } document.write(addn('abc', 2,33,6)); </script>

c# - StreamWriter only writes one line -

i trying write .csv file new file. every time streamwriter writes, writes first line of new file. overwrites line next string, , continues until streamreader reaches endofstream . has ever experienced this? how did overcome it? this first solution outside of required in school work. there unknown number of rows in original file. each row of .csv file has 17 columns. need write 3 of them , in order found in code snippet below. before coding streamwriter used console.writeline() make sure each line in correct order. here code snippet: { string path = @ "c:\directory\file.csv"; string newpath = @ "c:\directory\newfile.csv" using(filestream fs = new filestream(path, filemode.open)) { using(streamreader sr = new streamreader(fs)) { string line; string[] columns; while ((line = sr.readline()) != null) { columns = line.split(',');

c# - How to unit test private properties? -

i'm pretty new tdd , have hard time understand how test private members of class (i know! it's private, shouldn't tested - please keep reading) . might have public function sets private property , other public function returns "something" based on private property. let me show basic example: public class cell { public int x { get; set; } public int y { get; set; } public string value { get; set; } } public class table { private cell[,] cells { get; } public table(cell[,] cells) { cells = cells; } public void setcell(int x, int y, string value) { cells[x, y].value = value; } public void reset() { (int = 0; < cells.getlength(0); i++) { (int j = 0; j < cells.getlength(1); j++) { cells[i, j].value = ""; } } } public bool areneighborcellsset(int x, int y) { bool areneighborcellsset =

internet explorer - Cookie sharing behavior in IE 11 vs Edge -

i creating cookie in asp.net mvc application (httpcontext.current.request.cookies["validated"]) , noticed cookie shared across multiple tabs in ie 11, not if open separate instance of ie. in edge cookie shared across tabs , across new instance of edge. expected behavior?

r - Why is dataset[, uniqueN(x)] in data.table not returning the correct count of unique values within variables in RStudio? -

i working dataset has 379561 instances , 75 variables. want calculate summary statistics(mean, standard deviation, #outliers,range) data. variables of type (numeric, integer , categorical). because comparatively large data set, conventional code taking time. decided go data.table package in r. dataset has binary coded (0 1 variables) variables want treated categorical. writing function counts unique entries in each variable , if #unique entries < 10, want treat particular variable categorical. have written following code. returns count 1 variables. have attached enter image description here code. thank , if possible, suggest me alternative data.table.

android - How to count the highest variable Integer value -

i have 5 integers, equal 0: happy neutral sad angry stressed. whenever user clicks on particular button (happy, sad, etc.) each of integers, 1 added. bit know how do. here part need help. want count see variable has highest value, e.g. if 'happy' integer 5 , rest 3 'happy' highest. can if statements, seem long have go through every integer. there faster way this? put them list , use collections.sort(myintegerlist, comparator.reverse()); the highest value can afterwards calling myintegerlist.get(0);

How to spilled string that contins string in Quote in java -

i find function in java spilled string need make save quote symbol in output like example: hello "string type" the output be: hello i am string type expected output: hello i am "string type" public static string[] split(string str) { str += " "; // detect last token when not quoted... arraylist<string> strings = new arraylist<string>(); boolean inquote = false; stringbuilder sb = new stringbuilder(); (int = 0; < str.length(); i++) { char c = str.charat(i); if (c == '"' || c == ' '|| c=='\n' && !inquote) { if (c == '"') inquote = !inquote; if (!inquote && sb.length() > 0) { strings.add(sb.tostring()); sb.delete(0, sb.length()); } } else sb.append(c); } return strings.toarray(new string[strings.size()]);} any idea improve function thank you,

apache - ExpressionEngine 2 all sub pages return "File not found" -

i working on expressionengine 2 site , i'm having problems, believe, rewrite rules. i'm able access main site without issues, moment try access sub-pages i'm met plain white screen , simple phrase "file not found." (the page source text.) what's weird work on friends' computers leads me believe it's problem server configuration. i'm running vagrant box built puphpet using ubuntu 14.04.5, , apache2. below .htaccess rewrite rules. <ifmodule mod_rewrite.c> # enable rewrite engine # ------------------------------ rewriteengine on rewritebase / # redirect index.php requests # ------------------------------ rewritecond %{the_request} ^[^/]*/index\.php [nc] rewritecond %{the_request} ^get rewriterule ^index\.php(.+) $1 [r=301,l] # standard expressionengine rewrite # ------------------------------ rewritecond $1 !\.(css|js|gif|jpe?g|png) [nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.

forms - Delay between displaying an input value in react -

what i'm trying fix one-key-delay in state update e.target.value. i have tried solving without redux , have exact same problem. http://codepen.io/yoloonthebf/pen/kmwrpq?editors=0010 thanks lot help, hope can understand pen issue. class app extends react.component{ //here issue ?! handlechange(e){ const backspace_keycode = 8; const keycodein = e.keycode; if ( !isnumber(keycodein) && !(keycodein === backspace_keycode) ) { return e.preventdefault(); }else{ store.dispatch({type: 'update', payload: e.target.value}); } function isnumber(keycode){ return (keycode >= 48 && keycode <= 57) || (keycode >= 96 && keycode <= 105) } console.log(store.getstate()) } render(){ return( <div classname='container'> <h1>{store.getstate()}</h1> <input type='text' classname='form-control'

BizTalk Tracking for an Orchestration -

step: click start, click programs, click microsoft biztalk server 20xx, , click biztalk server administration. in console tree, expand biztalk server administration, expand biztalk group, expand applications, , expand application containing orchestration want configure tracking. click orchestrations, right-click orchestration want configure tracking, , click properties. click tracking tab, select tracking options want, described in following table, , click ok. track events - orchestration start , end --check box enable track events - message send , receive --check box enable track events - shape start , end --check box enable question: i ran query completed instances through biztalk admin console haven't seen same time other few application i'm able see completed orchestration. so, make different not track completed instances such application ? is issue related sql agent job biztalk? specific details how run query using sql management studio find out

javascript - How are asynchronous streams transmitted in RXJS? -

i'm trying understand how stream transmitted through pipe in rxjs. know should not concern because that's whole idea async streams - still there's want understand. looking @ code : var source = rx.observable .range(1, 3) .flatmaplatest(function (x) { //`switch` these days... return rx.observable.range(x*100, 2); }); source.subscribe(value => console.log('i got value ', value)) result : i got value 100 got value 200 got value 300 got value 301 i believe (iiuc) diagram : (notice striked 101,201 unsubscribed) ----1---------2------------------3------------------------------| ░░░░░░░░flatmaplatest(x=>rx.observable.range(x*100, 2))░░░░░░░░ -----100-------(-̶1̶0̶1̶)-------200---(-̶2̶0̶1̶)-----300------301------------- and here question: question: is guaranteed 2 arrive before (101) ? same 3 arriving before (201) ? i mean - if i'm not suppose @ time line legal following diagram occur : ----1---------------2--

excel - MS Power Query - eliminating duplicates in a set of delimited strings -

i have excel data looks this: sources targets routes lemons chair a,d lemons chair d,f oranges chair b,f,g oranges chair b,c oranges door a,g oranges door b,c i trying use power query condense this: sources targets routes lemons chair a,d,f oranges chair b,c,f,g oranges door a,b,c,g that is, each source/target pair, need split apart comma-delimited routes, eliminate duplicate routes combine routes comma-delimited list display in single record source/target pair. there max of 3 routes in routes source data. i'm pretty sure need split routes column 3 columns, use group . there stuck. suggestions? the code below implements steps outlined plus sort on routes. doesn't use split columns, text.split. the splittedroutes step created using text transform function on transform tab, adjusted use text.split. likewise, groupedrows step created group on transform tab, using operation rows,