Posts

Showing posts from May, 2014

angularjs - ng-repeat with angular form select box -

i working angularjs dynamic forms . according userid value generated multiple form field same model name using ng-repeat. using select box loading location. per requirement default need load first option value select box. using ng-init loading first option data not working . inside controller trying select box model value $scope.user.location shown error. can please send js fiddle solution problem. html <div ng-app="myapp"> <div ng-controller="myctrl"> <form role="form" name='userform' novalidate> <div class="container"> <div class="row" ng-repeat="user in users"> <div class="form-group"> <div class="col-md-3"> <label>id</label> <input ng-model="user.id" id="user.id" name="user.id" placeholder=&q

python 3.x - How to properly find root verb using spacy? -

i want check if word root verb using spacy. can check if word is, instance, subject, this: if word.dep == spacy.symbols.nsubj i think checking if it's root verb: if word.dep == spacy.symbols.root but fails. can this: if word.dep == 512817 or if word.dep_ == "root" but both seem wrong. there way more analogous first example?

Mock Custom User in Spring Security Test -

we using spring 4.3.9.release , spring security 4.2.3.release, these of latest versions have seen. have restful (spring-mvc) backend using spring web security roles-based access api's. we have controller looks this: @requestmapping(value = "/create", method = requestmethod.post, produces = "application/json", headers = "content-type=application/json") public @responsebody myobjectentity createmyobject(@requestbody myobjectentity myobj) throws myobjectexception { userdetails userdetails = (userdetails) securitycontextholder.getcontext().getauthentication().getprincipal(); customuser user = null; if (userdetails instanceof customuser) { user = ((customuser) userdetails); } string email = user.getemail(); myobjectentity myobj = myobjectservice.createmyobject(myobj, email); if (securitycontextholder.getcontext().getauthentication() != null) { securitycontextholder.getcontext().setauthentication(n

javascript - What happens to previous Subscriptions in RxJS? -

while i'm pretty used using rxjs, , reactive programming, there 1 thing that's been bothering me, can't head around. let's have simple function run every time 1 clicks button scan function scan() { this.startscaning(10).subscribe(scanneditem => console.log(scanneditem)) } inside our scan function, use startscanning method starts scanning (i.e. bluetooth devices) 10 seconds, , returns observable subscribe , log discovered devices/items. ok, far good, bothers me happens if user clicks button 10 times in row. happens previous subscriptions? , how supposed handle this? need unsubscribe every time, need unsubscribe @ all? a nice explanation appreciated, possible further readings/examples, thanks the way handle flip boolean while process running , bind button's [disabled] property value, e.g. isscanning: boolean function scan() { this.isscanning = true this.startscaning(10).subscribe({ next: scanneditem => console.log(sca

Types inside a function in Python. Why some gets updated but not others? -

this question has answer here: immutable vs mutable types 14 answers why calling several times in row following function: a = [] def test(a,b): if b > 0: a.append(1) return with test(a,4), enlarges list each time, calling several times in row function: a = 0 def test(a,b): if b > 0: += 1 return with test(a,4) returns 1 every single time instead of 1, 2, 3, etc.? it looks lists updated function , retain updated value after function finished execute, while behavior doesn't hold integers (and guess floats , several other types). integers immutable; lists mutable. a += 1 changes value of a reassigning value refers to. a.append(1) adds value 1 list a refers to, without changing reference itself. in test function, a if reference within function's scope; not same reference a in global scop

Fast queries on a large MongoDB collection from Python -

i'm working on project involves visualizing ever growing database of on 100m entries (tweets), , running bottlenecks in python i'm not sure how face. some details: the database indexed on fields querying on, including time, , text. each entry in collection contains large , complex structure, 100 nested fields. i projecting small number of columns, visualization requires fraction of stored data. fields queried of types string, float32/64, date, , id. when querying data given date range within mongo shell, processing times more acceptable, however, queries made within python take exponentially longer. while think have decent understanding of why happens, don't have enough knowledge on matter find solution. i have used both pymongo , monary, both disappointing results. are there obvious solutions processing time within python closer time in mongo shell? idea's have thought of include having mongo save query results separate collection before transferring

node.js - Jest does not know the instance of an object in parameter -

when use jest, can't know types (instance) of object in parameter. example : class customerror1 extends error { constructor(reason, myid) { super(reason); this.id = myid; } } class customerror2 extends error { constructor(reason, secondid) { super(reason); this.secondid = secondid; } } myfunction(id, callback) { if(id === 1) { return callback(new customerror1('1', id )); } else { return callback(new customerror2('2', id )); } } if use jest (with jest.fn or sinon have same result (but works mocha)) let c = jest.fn(); myfunction(1, c); expect(c.mock.calls[0][0].constructor.name).tobe('error'); // true expect(c.mock.calls[0][0]).tobeinstanceof(customerror1); // false -- it's object :s how can know type of object using jest ?

Sending emails with "if" - Python -

i'm trying figure out i'm going wrong code below: for row in cursor.execute("select * orcam anomes=?", cdate): try: percfor = (row.vr_forecast / 100) * 90 except typeerror: percfor = row.vr_forecast if row.vr_real > percfor , row.vr_forecast > 0: print(row.ccusto, row.grupo, row.anomes) try: body = """<html><body> <font face="calibri" size="3" color = "black"> alertamos que os gastos com o cc """ + row.ccusto + """ grupo """ + row.grupo + """, sob sua responsabilidade, excedeu 90% previsto no forecast para o mes """ + cdate + """ conforme abaixo: <br> <b>- previsto:</b> """ + str(row.vr_forecast) + """ <br> <b>- real:</b> """ + str(row.vr_real) + """ </body&

php - wordpres multisite content input -

im working on wordpress multi site client makes new multi site each employee homepage, blog, contact, , pages. each employee have different information each page on sites. when creating new site there additional fields can fill in information , have automatically input correct locations on new site similar how many custom post types work in wordpress. possible , there easy ways of doing plugin or light php coding?

javascript - How to identify repeater if the ng-repeat value changes -

the ng-repeat tag angular repeater looks this: ng-repeat="prop in ::$obfus.obfuscated(2, 1) track $index" (obfus , obfuscated changes obfuscate). the page has widget panel shows around 10 pieces of information, each piece of information text label value next it. each of tuples repeated element. the (2, 1) in repeater id problem. it's column identifier within panel. depending on width of browser, panel may choose show 10 pieces of information in 2 columns (i.e. 5 pieces of information in each of 2 columns), or 3 columns (4 pieces of information in 1st column, , 3 pieces of information in next 2 columns). if use protractor acquire webelements, identify repeater syntax above. , me repeated objects for column . if browser different width , run test again, things broken. for purpose of these tests, don't care column they're in. is possible use wildcards or regular expressions when identifying repeater in protractor? i'd of these repeated objects i

r - Variable name collision in dplyr -

i attempting compute moving median on variable contained within data.frame using dplyr. problem running function passing rollapply() has same name variable in original data.frame. example: df <- data.frame(median = seq(1:100)) df %>% mutate(ln_median = log(median)) %>% mutate(ln_median_10 = rollapply(ln_median, 5, median)) generates error message: error in eval(substitute(expr), envir, enclos) : '1:100' not function, character or symbol the underlying cause median in rollapply() resolving variable in data.frame , not function "median". have been able around following code: df %>% mutate(ln_median = log(median)) %>% mutate(ln_median_10 = rollapply(ln_median, 5, function(a) median(a), fill = na)) that is, wrapping median function in order suppress being interpreted variable within data.frame. is there more elegant way of achieving same thing? have tried pass function name in as stats::median

javascript - HTML checkbox validation breaks when there are multiple checkboxes in the form -

in form below, how ignore disabled checkbox. expected behavior in form if user not check model check box , click on submit button, form should submitted. if model checkbox checked, user must enter data. behavior works long there no other checkbox on page. if there checkbox, , submit button clicked without checking model checkbox, alert thrown. how can ignore other checkboxes in form achieve desired behavior? thanks! $(document).ready(function () { $('#checkmodelbtn').click(function() { var ischeckboxchecked = $("input[type=checkbox]:checked").length; var istextentered = $("input.childmodel").val().length; if ( istextentered || !ischeckboxchecked ) { //alert("validation passed!"); } else { alert("please enter model number"); } }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> &l

tvos - apple tv running 2 concurrent applications -

is there way create apple tv app runs on top of other apple tv apps? application run in corner of screen show workouts while tv show playing or other application running. enter image description here no, picture-in-picture only available on ipad .

c++ - glDrawElementsInstancedBaseInstance() requires preceding glVertexArrayVertexBuffer() -

my objective draw textured quads screen rendering text. trying use gldrawelementsinstancedbaseinstance render each glyph quad instance of same mesh. in order convey individual information each character quad (like position, size , glyph index) use 2 buffers ( quadstorage , charstorage ), sources vertex attributes ( vec2 quadpos , vec2 quadsize , unsigned int glyphindex ) advance each instance. because may want change text on screen occasionally, need way stream buffers. in application, have used immutable buffers (initialized glbufferstorage ) mapped gl_map_persistent_bit , gl_map_coherent_bit flags set, enables me map entire buffer "forever" , use mapped pointer c-array. avoid writing memory being read create storage 3 times large need , can use new range in buffer each stream upload. when want use updated data in shaders have rebind buffer bindings reference updated range in buffer using glbindbufferrange gl_uniform_buffer s , glvertexarrayvertexbuffer gl_array_

html - Clicking Javascript confirmation button in VBA script -

the purpose of code run report on website specified criteria. want search of "distance" criteria, prompts message box asking if i'm sure. want code able click "ok" button. however, code stops running once "submit" button hit , hung until "ok" button hit. note: cannot change html or javascript here's vba code sub data_grab() 'open internet explorer , webpage dim ie object set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate "insert website here" 'wait page finish loading while ie.busy loop 'get reference search form finding id in web page's object model dim daysas object dim city object set days= ie.document.getelementbyid("age"): days.value = "10" set city= ie.document.getelementbyid("location"): city.value = "la" 'click search button ie.document set elems = .getelementsbytagname("input") each

Wordpress - Get latest custom post from every user -

how can latest custom post every user? $args = array( 'post_type' => 'userdatax', 'post_status' => 'publish', 'orderby' => 'post_date', 'order' => 'desc', 'posts_per_page' => 999999 ); $query_res = new wp_query($args); according me below code can achieve goal. try code function getuserposts() { $args = array( 'order' => 'asc', ); $users = get_users( $args ); foreach ($users $key => $value) { // wp_query arguments $args = array( 'post_type' => array( 'userdatax' ), 'post_status' => array( 'publish' ), 'author' => $value->id, 'posts_per_page' => '-1', 'order'

swift - SKPhysicBodies appear to be slightly off-place -

Image
edit: have been able solve problem using physicseditor make polygonal physicsbody instead of using skphysicsbody(... alphathreshold: ... ) -- for reason i'm having trouble i'm assuming skphysicbodies being off-place. while using showphysics stationary obstacle nodes appear have physicbodies in correct position, able trigger collisions without touching obstacle. if @ image below shows have found physicsbodies off centre, despite showphysics telling me otherwise. (note, player node travels in middle of these obstacle nodes). i thought worth noting while player travelling, physicbody appears travel ahead figured normal. i use skphysicsbody(... alphathreshold: ... ) create physicbodies .png images. cheers. edit: here's how create obstacle physicbodies. once they're added worldnode left alone until need removed. apart don't change them in way. let obstaclenode = skspritenode(imagenamed: ... ) obstaclenode.position = cgpoint(x: ..., y: ...) obstac

jquery - Ajax Post Error - can you see the code error? -

i trying simple ajax post working. when post headers , data url using fiddler, returns ok. ajax code goes error: function. $(document).ready(function () { $('#lblajaxstatus').html('ready'); $('#btnajaxlogin').click(function () { $.ajax( { url: "https://www.testurl.com/api/login", type: "post", contenttype: "application/json", headers: { "from":"cc", "to":"ccm", "language":"0", "offset":"-8" }, data: { "loginid": "email@gmail.com", "password": "password1", "vehicletype": "e", "deviceid": "abcdef", "clientid": "123456", "appversion": &quo

javascript - Web app with Google script - handling the class google.script.url -

i have developed web app on google script, parameter "mocnumber" in url, people specific link can access directly needed information. web app run "as me", , access open people within organization. here extract of .gs file (server side), doget function: function doget(e) { var t = htmlservice.createtemplatefromfile('index'); t.data=json.stringify(e.parameter.mocnumber) logger.log(t.data); return t.evaluate().setsandboxmode(htmlservice.sandboxmode.iframe) .settitle('my tool - beta version ii'); } on client side (.js file), use following function put parameter variable, , use load required information. var mocnumber="" google.script.url.getlocation(function(location) { mocnumber=location.parameter.mocnumber; }); however, when share web app link people of organization, appears script file has shared them, incoherent fact app run me. does know if use way "google.script.url" url parameters?? than

javascript - Preview an image before it is uploaded -

i want able preview file (image) before uploaded. preview action should executed in browser without using ajax upload image. how can this? please take @ sample js code below: function readurl(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $('#blah').attr('src', e.target.result); } reader.readasdataurl(input.files[0]); } } $("#imginp").change(function(){ readurl(this); }); and associated html: <form id="form1" runat="server"> <input type='file' id="imginp" /> <img id="blah" src="#" alt="your image" /> </form> also, can try sample here .

javascript - Background image - Let run image into other div? -

i set this image background image on this page . let background image start on in class navbar navbar-default . , problem comes. want image continues next div called class="elementor-element elementor-element-gjr87i6 elementor-section-boxed elementor-section-height-default elementor-section-height-default elementor-section elementor-top-section" how can implement that? - tried overflow don't working. you have set background image div, , inside div have put oher divs want share same background.

c - How to check msr.le at runtime using built-ins? -

this question came in power8 in-core crypto patch . patch provides aes using power8 built-ins. when loading vsx register need perform 128-bit endian reversal when running on little-endian machine ensure vsx register loads proper value. at compile time can check macros __byte_order__ . however, believe supposed check machine status register @ runtime. if msr.le=1 , perform endian swap. see altivec programming environment manual , section 3.1.4, p. 3-5. how check machine status register @ runtime using built-ins? you don't need - it's known @ compile time. instructions encoded incorrectly if you're running in opposite endianness of compiled code. so, os ensure program running in correct msr[le] setting endianness of executable. in essence: msr[le] bit controls instructions data loads/stores. there tricks can use detect endianness if have no idea, unless you're writing super boot code, won't need that.

Invalid Post: 400 - Bad Request with Python requests -

i'm using politemail's odata restful api (doc: politemail api entity directory ) i'm trying create contact inside of politemail requests.post() . below steps load libraries import requests import json # point credentials import os import yaml mykeys = yaml.load(open(os.path.join(os.path.expanduser('~'), 'documents\keyfile2.json'))) authentication creds user = mykeys['politemail'][1]['user'] password = mykeys['politemail'][1]['password'] auth = requests.auth.httpbasicauth(user, password) base_url = 'https://comm.microsoft.com/ssv3/odata/' entity = 'lists' url = base_url+entity get request r = requests.get(url+'(56)', auth=auth) print(r.status_code) # '200' i can within entity, can't post. post request below structure given in documentation payload = { "id":"0", "name":"test list", "description":"does work&quo

html - How to get user friendly URLs without any file extensions? -

i've been wondering long time how people manage urls work without file extentions such '.html' or '.apsx' on end. look @ website example: http://www.axongarside.com/communication http://www.axongarside.com/communication/compleat http://www.axongarside.com/brand http://www.axongarside.com/brand/k3-group how have accomplished this? method can think of create new directory each page , have index page in each directory huge hassle larger website. there other way? thankyou the 3 common ways to: use index pages (i.e. create directory , put index.html file in it). use rewrite engine (such apache's mod_rewrite ) map urls onto different files (this common approach in php-land). use front controller script processes urls (this usual approach mvc frameworks). the latter approach use in apache server configuration: wsgidaemonprocess example processes=2 threads=15 display-name=%{group} wsgiprocessgroup example wsgiscriptalias / /hosts/example.

Jquery loop with html -

i need loop content in <div class="newslist"> : <figure class="effect-lily"> <img src="img/1.jpg" alt="img06"> <figcaption> <div> <h2><span>lily</span></h2> <p>lily likes play crayons , pencils</p> </div> <a href="https://tympanus.net/development/hovereffectideas/index.html#">view more</a> </figcaption> </figure> my jquery is: $(function() { $.ajax({ url: "test.json", datatype:'json', type: 'get', data:'data', success:

java - Slow performance when wrapping BufferedReader in custom FilterReader -

while tinkering around i/o stuff, made interesting observation: custom filterreader seemed have unexpected performance overhead. try , diagnose issue, threw simple performance test: import java.io.*; abstract class test { public final long timerun(reader in) throws ioexception { long start = system.nanotime(); run(in); long end = system.nanotime(); return end - start; } protected abstract void run(reader in) throws ioexception; } class wrapinfiltertest extends test { private class letterfilterreader extends filterreader { public letterfilterreader(reader in) { super(in); } @override public int read() throws ioexception { int read; while ((read = in.read()) != -1) { if (character.isletter(read)) break; } return read; } } @override public void run(r

c# - Web service return value confusing -

in our project have multiple web service references. methods of web services return object name response . format of response depends on web service reference. sometimes application confuses return value. a message appears like webservice1.response cannot converted webservice2.response` while called method webservice2. what can avoid this?

drools - Will logical facts be re-inserted when an object is updated but the updated fields from that object are not included in the rule that adds the fact? -

what want find out drools truth maintenance system re-insert logical fact (basically update existing 1 fresh object) when object part of rule inserting changed none of fields included in rule have changed? below example show i'm talking about. lets have 2 classes below: public class class1{ int x; int y; int z; } public class class2{ class1 class1; int x; int y; } public class logicalfact{ class2 class2; } and next 2 example rules insert logical fact object class "logicalfact" : rule "example1" when $class2 : class2(x > 20) insertlogical(new logicalfact($class2)); end rule "example2" when $class2 : class2(class1.x > 10, x > 20) insertlogical(new logicalfact($class2)); end lets y field class2 object ("class2") changed , z field class1 object on class2 object ("class2") pointing @ changed. in "example2" rule change in field y

unsigned long long int - Counting the number of Common Divisors between two numbers -

well point coded on common divisors between 2 numbers found more interesting #include<stdio.h> int main() { long long int t; scanf("%lld",&t); long long int i; while(t--){ long long int a,b; scanf("%lld %lld",&a,&b); long long int k=0; for(i=1;i<=b;i++) if((a%i)==0 && (b%i)==0) k++; printf("%lld\n",k); } } but can't estimate why code's timing out when input 8 bit number kindly let me know what's problem !!

Multiple Webpack configs in .config file breaking app -

i have project job host react component export npm module. there 2 goals. running host project develop , test component i'm creating module. , transpile component/module down vanilla js such can imported via require() in other project. for 2 purposes have following webpack config: var path = require("path"); var webpack = require("webpack"); const htmlwebpackplugin = require("html-webpack-plugin"); var projectconfig = { name: "project", entry: "./src/index.js", output: { path: path.resolve(__dirname, "dist"), filename: "bundle.js" }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader", query: { presets: ["react", "es2015", "stage-2"], plugins: ["transform-class-properties"] } }, { rules: [ {

python 3.x - How to uninstall the packages in Pycharm -

i trying uninstall packages in pycharm community edition 2017.2 on ubuntu 14.04 machine. don't find clues on uninstallation . i wondering if packages can removed dropping related files in python's dist-packages. package's path given follows: usr/local/lib/python3.4/dist-packages to uninstall package on project interpreter page, in list of packages, select ones deleted. click /help/img/idea/2017.2/delete.png. the selected packages removed disk. please check https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html https://askubuntu.com/questions/598162/how-to-permanently-remove-pycharm-community

pyspark - How to config the sc in spark? -

myconf = sparkconf().setappname("create_h5_pairwise")\ .set("spark.hadoop.validateoutputspecs", false)\ .set("spark.akka.framesize", 300)\ .set("spark.driver.maxresultsize","8g")\ .set("spark.num.executors", 40)\ .set("spark.executor.memory", "20g")\ .set("spark.executor.cores", 3)\ .set("spark.driver.memory", "4g") sc = sparkcontext(conf=myconf) i have use config of sc read small table hive (500 rows). want change sc configure read table more 600 million rows. how configure sc parameters ? use same sc read huge table ? when count it, stuck in following phase: [stage 11:> (0 + 2) / 4] and there no progress @ all.

maven - Is there a way to ask IntelliJ IDEA to skip indexing some specific jar files added as library? -

our project (managed maven) has jar dependency contains lots , lots of .js files. problem modify dependency often, , every time mvn install it, intellij idea start re-index .js files, , becomes slow or dead. so wonder there way ask intellij skip indexing specific jar library?

if statement - if else condition with radio button not working on button click in android -

i stuck in simple code. trying check radiobutton checked , showing results on button click. when click male radio button, shows results when check female radio button showing nothing or can not working , not showing error. don't know whats wrong code. please take look: radiobutton radm,radf; radm=(radiobutton)findviewbyid(r.id.radiomale); radf=(radiobutton)findviewbyid(r.id.radiofemale); button find=(button) findviewbyid(r.id.btnfind); //where s spinner , find button find.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if(s.getselecteditem().tostring().equals("kg")){ if(radm.ischecked()){ int inches= myfoot*12+myinch; float sizeincm= inches*2.54f; mybmr= (float) (66.47f+ (13.7*myweight) +(5*sizeincm) -6.8 * myage); myrmr= (float) ((10*myweight)+(6.25*sizeincm)-(5*myage)+5);

amazon web services - Doesn't Spark/Hadoop support SSE-KMS encryption on AWS S3 -

i trying save rdd on s3 server side encryption using kms key (sse-kms), getting following exception: exception in thread "main" com.amazonaws.services.s3.model.amazons3exception: status code: 400, aws service: amazon s3, aws request id: 695e32175eba568a, aws error code: invalidargument, aws error message: encryption method specified not supported, s3 extended request id: pi+hflg0wsawtkdi2s/xviocrpmci7zdhiao5n1f7tiwpje2z0lpy1c2cr53pnnucj3358gx3aq= following piece of test code write rdd on s3 using sse-kms encryption: val sparkconf = new sparkconf(). setmaster("local[*]"). setappname("aws-encryption") val sc = new sparkcontext(sparkconf) sc.hadoopconfiguration.set("fs.s3a.access.key", aws_access_key) sc.hadoopconfiguration.set("fs.s3a.secret.key", aws_secret_key) sc.hadoopconfiguration.setboolean("fs.s3a.sse.enabled", true) sc.hadoopconfiguration.set("fs.s3a.server-side-encryption-algorithm"

html5 - ui-grid not showing data angularjs -

can please me. want implement data display using ui-grid. grid not displaying data showing blank yet when use table <tr ng-repeat="transaction in savingaccountdetails.transactions> data displayed. i want use ui-grid because of ability have fixed header while scrolling large data hard make table header fixed, times columns don't align. tried cases not working expected. my codes below:- var columnsuigrid = [ { displayname: 'value date', field: 'accountdetails.transactions.date'}, { displayname: 'seq', field: 'accountdetails.transactions.id'}, { displayname: 'number', field: 'accountdetails.transactions.transactioncode'}, { displayname: 'type', field: 'accountdetails.transactions.transactioncode'}, { displayname: 'debit', field: 'accountdetails.transactions.amount'}, { displayname: 'cre

Generate Dates for particular range using SQL server -

i need generate dates particular date range e.g. 2010 2050 googled didn't find solution. how can generate date range using sql server. need using sql query not use stored procedure , block. appreciate. thanks create numbers/tally table (a table values 0 10,000, let's say), call dbo.numbers, select there, calculating date each number, starting @ 1 , whatever number need: select dateadd(day, n.number, '2010-01-01') dbo.numbers n n < [yourmaxnumberhere]

winforms - Set default value to DataGridViewComboBoxColumn cells after using DataGridView.DataSource C# -

this question has answer here: set default value datagridview combobox 1 answer i trying add new column datagridview combobox. , set ever new cell default value. list of combobox updated fine, can't see default value... this code : batteryinformationtests = databasemanager.getcatalogpropsbycatalognumber(catalognumber); batteryinformationtestsdatagridview.datasource = batteryinformationtests; datagridviewcomboboxcolumn cmbcol = new datagridviewcomboboxcolumn { name = "propname", datapropertyname = "propname" }; cmbcol.items.addrange(new object[] { "1", "2", "3" }); batteryinformationtestsdatagridview.columns.add(cmbcol); foreach (datagridviewrow row in batteryinformationtestsdatagr

php - housenumber automatically converted to date in xl sheet -

i'm using php coding., i'm downloading data msxl dashboard, in 1 field housenumber, when downloaded xl data fine housenumber field getting displayed date format, for eg: entered date 10-61 showed me oct-61 in dashboard after downloading how can correct housenumber after importing, any regarding this..?

ajax - How to make the following code from Get to Post in C#? -

private static stringbuilder buildpaymentmethodsxml(ilist<methods> listofpayments) { stringbuilder xmltoinsert = new stringbuilder(); xmltoinsert.append("<paymentmethods>"); foreach (methods paymentmethod in listofpayments) { xmltoinsert.append("<t>"); xmltoinsert.appendformat("<bonuses>{0}</bonuses>", paymentmethod.bonuses.tostring()); xmltoinsert.appendformat("<payment>{0}</payment>", paymentmethod.payment.tostring()); xmltoinsert.append("</paymentmethods>"); } xmltoinsert.append("</paymentmethods>"); return xmltoinsert; } i want pass huge string url , cannot pass.currently have error 400 size of request headers long. please, advise :)

css - Can I merge Bootstrap 2.3.1 with new versions like 4.0 or 3.x.x? -

i have website in used bootstrap 2.3.1. want change version , want update. if updated bootstrap new version. total ui changing. website turning clumsy . intention merge previous bootstrap file new 1 without removing previous attributes , updating new content. yes, can. don't want it. merging both bootstraps cause hardly maintainable mess , conflicts (one behavior overwriting another). surely it's doable, couple more imports of new bootstrap , there have it. i try solve without merging different bootstraps, though! here's how: if project small, maybe it's idea migrate new bootstrap , rid of old one. if project big, use new bootstrap in new views, while leaving old views use old bootstrap untouched. if have time , resources, rewrite/migrate these old views 1 one using new bootstrap. idea not use both bootstraps on same view @ same time, rather switch new bootstrap chosen views. good luck!

How to properly secure laravel newsletter subscription? -

i have newsletter powered laravel application. lets subscribers select area , set filters receive mail notifications on new housing sale. to solve in easy way user did not want use passwords , long registration process names etc. instead, email, in email there edit link secret token: https://myapp.com/subscribers/42/edit?token=gwoi6n4ginagrpoargp4ar5gp14a would considered safe approach? when user clicks link, on https encrypted, still show in current browsers history.. will flamed doing , if ways improve it? with encrypted data in ssl communications yes it's safe. in opinion there offers: 1-remove token word address. 2- link should not show user edit page directly. instead sends arguments controller , controller redirects user new page clean link. save token in page authorizing user. 3- why not produce longer (just bit longer!) tokens? 4- being safer each link should have expire time. new link sent each newsletter mail.

hadoop - issue with hive partitioning and bucketing in CDH 5.10 quick VM -

i new area , got stuck in simple issue. i loading data hive table (using insert command table tset1) partitioned udate , day bucket. insert overwrite test1 partition(udate) select id,value,udate,day tset1; so issue when loading data taking wrong value in partition column. day taken partition because in table last column during data load it's taking day udate. how can force query take right value during data load? hive (testdb)> create table test1_buk(id int, value string,day int) partitioned by(udate string) clustered by(day) 5 buckets row format delimited fields terminated ',' stored textfile; hive (testdb)> desc tset1; ok col_name data_type comment id int value string udate string day int hive (testdb)> desc test1_buk; ok col_name data_type comme

mongodb - mongoose referencing not working when object_id is string -

i have 2 mongo collections, 1 department , 1 users var deptschema = new schema({ name: { type: string, required: 'department name missing.' }},{ timestamps: true }); deptschema.plugin(sequencegenerator, { field: '_id', startat: '0001', prefix: 'dept' }); module.exports = mongoose.model('departments', deptschema); //user or staff schema definition var userschema = new schema({ name: { type: string, required: 'user name missing.' }, role: { type: string, required: 'role missing.', enum: ['admin', 'sales'] }, passwordhash: string, passwordsalt: string, departmentid: { type: schema.types.objectid, required: 'department id missing.', ref: 'departments' } },{ timestamps: true }); userschema.plugin(sequencegenerator, { field: '_id', startat: '0001', prefix: 'staff' }); module.exports = mongoose.model('users', userschema);

Selenium Java - Page Object Model Query -

imagine there page http://google.com/adduser , here enter details record , click save. once page redirects http://google.com/userlist where can see list of users including new record entered. if going page object model, method enter details , save record should exist on adduser.java , method validate if record saved , displayed should on userlist.java if consider adduser , userlist corresponding objects both classes below : adduser.enterdetailssaverecord(); userlist.validatesavedrecord(); so in test case need call 2 separate methods, 1 action , other validate. both adduser.java , userlist.java have basepage.java superclass. there way club them both single method or there i'm going in wrong way , there better approach? thank you i don't see wrong approach either, although, approach logically separate functional interaction application testing functions. so, still have adduser.enterdetailssaverecord(); but userlist use useritem founduse

Python Closing Toplevel Window Error -

i wanted code create popup error window destroys after 4 seconds can closed via button. def error(self): top = toplevel() top.after(4000, lambda: top.destroy()) center_window(300,100, top) top.title("error") label(top, text="please enter valid code", height=3, width=200).pack() ok = button(top, text="ok", command=top.destroy) ok.pack() ok.bind("<return>", lambda a: top.destroy()) ok.focus_set() i have run code , works fine 90% of time except throws error: typeerror: <lambda>() takes 1 argument (0 given) i have done research says tkinters threading. not sure if issue when take out line of code: top.after(4000, lambda: top.destroy()) it seems work. if me, have taught myself know of python, sure there holes in learning. think may need somehow use main thread of execution destroy window, or otherwise create own custom widget. appreciated. when using after or bind, don't nee

apache spark - scala type mismatch error in graphX code -

i'm new scala, learning apache-spark. wrote simple function in scala graphx def foo(edge: edgetriplet[map[long, double], double]): iterator[(vertexid, map[long, double])] = { val m = edge.srcattr for((k, v) <- m){ if (v + edge.attr < edge.dstattr.getorelse(k, 10.0)) iterator(edge.dstid, map(k -> v + edge.attr)) else iterator.empty } } errors name: compile error message: <console>:37: error: type mismatch; found : double required: string iterator(edge.dstid, map(k -> v + edge.attr)) ^ <console>:35: error: type mismatch; found : unit required: iterator[(org.apache.spark.graphx.vertexid, map[long,double])] (which expands to) iterator[(long, map[long,double])] for((k, v) <- m){ ^ stacktrace: why scala treating v string? , cause of second error? after editing code sug

c# - Why a GridLengthAnimation can't control its direction? -

recently, i've wrote 0*2 grid execute it's expand , shrink function. however, when try drag canvas edge of border control it's expanding direction animation. can't. when add this: canvas.setbottom(this._usercontrol,0). it totally changes direction, after lose control. canvas.setbottom(this._usercontrol, 0); gridlengthanimation d = new gridlengthanimation(); d.from = new gridlength(0, gridunittype.pixel); d.to = new gridlength(_gridrowsslength, gridunittype.pixel); d.reversevalue = _gridrowsslength; d.autoreverse = false; d.duration = timespan.fromseconds(3); d.fillbehavior = system.windows.media.animation.fillbehavior.stop; d.completed += _timers_tick; _gridmain.rowdefinitions[1].beginanimation(rowdefinition.heightproperty, d);

ionic2 - Ionic 2 App Back button behaviour to navigate to another page -

i have used this.navctrl.push() navigate new page on click of button. creates default button clicking takes me previous page. want navigate page on click of button. how can ? i have tried doesn't work : constructor(public navctrl: navcontroller, public navparams: navparams,public platform: platform) { platform.ready().then(()=>{ platform.registerbackbuttonaction(()=>this.myhandlerfunction()); }); } myhandlerfunction(){ this.navctrl.setroot(vesselsearchpage); } inject platform 'ionic-angular' , register new handler button action: import { platform } 'ionic-angular'; constructor(private platform: platform) { } ionviewwillenter(): void { this.platform.registerbackbuttonaction(() => this.backbuttonfunc()); } private backbuttonfunc(): void { // }