Posts

Showing posts from August, 2013

Spark-Scala quote issue -

i have input data in iso-8859-1 format. cedilla delimited file. data has double quote in it. converting file utf8 format. when doing so, spark inserting escape character , more quotes. can make sure quotes , escape character not added output? sample input xyzÇvib bros crane , big "tonyÇ1961-02-23Ç00:00:00 sample output xyzÇ"vib bros crane , big \"tony"Ç1961-02-23Ç00:00:00 code var inputformatdataframe = sparksession.sqlcontext.read .format("com.databricks.spark.csv") .option("delimiter", delimiter) .option("charset", input_format) .option("header", "false") .option("treatemptyvaluesasnulls","true") .option("nullvalue"," ") .option("quote","") .option("quotemode","none") //.option(...

Kubernetes HA leader control plane services restarting -

while following kubernetes-the-hard-way , porting local ubuntu 16.04 vms, bringing ha control plane giving me problems. kube-apiserver , kube-controller-manager services elected leader keep failing , restarting control planes on other 2 non-leader masters come fine. behavior follows leader around cluster. etcd looks happy: member 7f44a7567a5e995 healthy: got healthy result https://10.1.15.117:2379 member 43d2258c438cbf4e healthy: got healthy result https://10.1.15.116:2379 member a83b22e9f907f471 healthy: got healthy result https://10.1.15.115:2379 cluster healthy i've verified current leader by: kubectl endpoints kube-controller-manager --namespace=kube-system -o yaml apiversion: v1 kind: endpoints metadata: annotations: control-plane.alpha.kubernetes.io/leader: '{"holderidentity":"df-dev-kube-test02","leasedurationseconds":15,"acquiretime":"2017-09-13t17:15:06z","renewtime":"2017-09-13t18:10...

How do I access the name of the variable assigned to the result of a function within the function in R? -

for example, suppose able define function returned name of assignment variable concatenated first argument: a <- add_str("b") # "ab" the function in example above this: add_str <- function(x) { arg0 <- as.list(match.call())[[1]] return(paste0(arg0, x)) } but arg0 line of function replaced line name of variable being assigned ("a") rather name of function. i've tried messing around match.call , sys.call, can't work. idea here assignment operator being called on variable , function result, should parent call of function call.

uilabel - Send Labels forward and back in Swift... do I have to? -

i uilabel continually update behind interface elements on same screen. can see label starts below other elements using debug view hierarchy tool in swift's xcode tool. update text in label, jumps top , writes on other labels , interface elements. first image 3d debugger image first question... can't find tool setting front layers in interface builder... if can point out me that'd great, google has not been friend. since it's going end on top when update label, figure can send label whenever refresh it... in viewcontroller.swift file, in function update label's text, i've tried: (my label's outlet hook called "consoleme" super.sendsubview(toback:consoleme) nope... that's backwards maybe? tried: consoleme.sendsubview(toback: super) ...as "self" instead of super. doesn't super @ all. complains self viewcontroller , not uiview. finally, i'm wondering if have @ all-- surely there's way specify uilabel s...

ngrx - TypeScript compiler incorrectly reports that action.payload does not exist -

i'm using ngrx 4.03 , typescript 2.5.2. i have defined action such: import { action } '@ngrx/store'; import { iuser } '../models'; export const login_success = '[auth] login success'; export const logout_success = '[auth] logout success'; export class loginsuccess implements action { readonly type = login_success; constructor ( public payload: iuser ) {} } export class logoutsuccess implements action { readonly type = logout_success; } export type authactions = loginsuccess | logoutsuccess; in corresponding reducer, typescript telling me action.payload not exist on action , though can log value fine. doing wrong? i'm sure if have 1 action (or more) without payload, introduce behavior. so change code: export class logoutsuccess implements action { readonly type = logout_success; } to export class logoutsuccess implements action { readonly type = logout_success; constructor(public payload: nul...

python - Message: Element is not visible - Selenium error happens randomly -

i'm working on side project monitor flight prices i'm getting error message: element not visible only . weird thing error not thrown every time , cannot manage figure out causes it. tried adding implicit wait incase page hasn't loaded didn't help. page loads google flights , error happens when tries send text destination city. import time selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec class bot: def __init__(self): self.browser = webdriver.firefox(executable_path='./geckodriver') # self.browser = webdriver.chrome('./chromedriver') self.departure_city = "cou" self.destination_city = "hnd" self.departure_day = "december 1" self.return_day = "december 10" self.prices = [] self.ru...

coq tactic - Simplifying Subformulas in Coq -

i'm trying solve equation of form a * b * c * d * e = f where * complicated left associative operation. at moment, opaque (including * , a through f ), , can made transparent via autounfold m_db . the problem if globally unfold definition in formula, simplification take forever. instead, want first unfold a * b , apply tactics reduce normal form x , , same x * c , forth. any idea how accomplish this? here's current approach in a or at a doesn't work. also, it's not clear me whether right structure, or reduce_m ought return something. ltac reduce_m m := match m | ?a × ?b => reduce_m a; reduce_m b; simpl; autorewrite c_db | ?a => autounfold m_db (* in *); simpl; autorewrite c_db end. ltac simpl_m := match goal | [|- ?m = _ ] => reduce_m m end. a minimalish example: require import arith. definition add_f (f g : nat -> nat) := fun x => f...

xml - ImportXML into Google Sheets -

i trying stock prices nasdaq using importxml in google sheets. here importxml code: =importxml(f13,f14) -- in cell c4. , =importxml(f13,f11) -- in cell b4. f13 has url: http://www.nasdaq.com/symbol/ko/historical f14 has x-path: // [@id="quotes_content_left_pnlajax"]/table/tbody/tr[2]/td[5] f11 has x-path date cell: // [@id="quotes_content_left_pnlajax"]/table/tbody/tr[2]/td[1]/text() the x-path fed loop increments row number (tr[2] in above) 20 each iteration, each x-path presented sucessively approximately 1 month earlier dates. this works fine first 4 loops ( ie. row 2, 22, 42, , 62), after fails, , returns n/a. the nasdaq page shows 3 months of data, unless manually select, say, 2 years data, displays, there no change of url or in form of x-path when 2 years data selected. example, x-path mar. 17, (about 6 mos. back), is: //*[@id="quotes_content_left_pnlajax"]/table/tbody/tr[125]/td[5], differing row number. my code gets date in sa...

python - Why is PyCharm giving me an Unresolved Reference NameError -

i'm taking tutorial learn python. i've written code see below: creatures = [] def get_creature_race(): creature_race = [] creature in creatures: creature_race.append(creature["race"].title()) return creature_race def print_creature_race(): creature_race = get_creature_race() print(creature_race) def add_creature(race, sex): creature = {"race": race, "creature_sex": sex} creatures.append(creature) def save_file(creature): try: f = open("creatures.txt", "a") f.write(creature + "\n") f.close() except exception: print("could not save file") def read_file(): f = open("creatures.txt", "r") creature in f.readlines(): add_creature(creature) f.close() read_file() print_creature_race() creature_race = input("enter creature race: ") creature_sex = input("enter creature se...

org.apache.ignite.IgniteCheckedException: Failed to find class with given class loader for unmarshalling -

using ignite 2.1, start first node in default server mode peer class loading enabled command line. see following line in logs: when start second node (using ignitespringbean on tomcat server, in client mode) getting following error, though peer class loading enabled: org.apache.ignite.ignitecheckedexception: failed find class given class loader unmarshalling (make sure same versions of classes available on nodes or enable peer-class-loading) [clsldr=sun.misc.launcher$appclassloader@18b4aac2,... visor tells me both server , client node in topology , both have peer class loading enabled... server logs: [vagrant@tw apache-ignite-fabric-2.1.0-bin]$ ./bin/ignite.sh ./config/example-default.xml -v ignite command line startup, ver. 2.1.0#20170720-sha1:a6ca5c8a 2017 copyright(c) apache software foundation [13:41:51,967][info][main][ignitekernal] >>> __________ ________________ >>> / _/ ___/ |/ / _/_ __/ __/ >>...

python - how to pass info from one widget to another in kv kivy -

Image
i want set text of label when button pressed, problem being son separate screens , therefore in separate widgets in kv file. code have change is: <screenone>: boxlayout: textinput: id: player_name button: text: "continue" on_release: root.manager.current = "screen2" root.ids.final_playername.text=player_name.text <screentwo>: gridlayout: label: text: "player" id: final_playername the error is: traceback (most recent call last): file "c:\users\rayne\desktop\python exp\noughts , crosses kivy sm\nandx.py", line 36, in <module> nandxapp().run() file "c:\users\rayne\appdata\local\programs\python\python36-32\lib\site-packages\kivy\app.py", line 828, in run runtouchapp() file "c:\users\rayne\appdata\local\programs\python\python36-32\lib\site-packages\kivy\ba...

jquery - Load external javascript file and create iframe -

this question has answer here: can make javascript function replace on page custom html? 4 answers i need create javascript return iframe tag. customer paste script in iframe need be, , script should create iframe. must this: <script src="http://www.helloworld.com/script/loadcustomerframe.js" data-customer="14532"></script> then script should load iframe url somewhere, , need read "data-customer". i backend developer c#, not frontend. have try several days now, cant work. please help. thanks something should work: $(document).ready(() => { $("[data-customer]").each(function() { let customerid = $(this).data("customer"); $(this).replacewith(`<p>this customer #${customerid}.</p>`); // following comment example of how use iframe //$(this).replacew...

reactjs - Images in react not showing up -

learning react , want show image on main page folder. put picture here ..\client\myapp\src\imagefolder\myimage.jpg in react's app.js <img src='./imagefolder/myimage.jpg' alt="hel"/> <img src='/imagefolder/myimage.jpg' alt="hel"/> both of these methods dont work. did because app.js inside src folder , trying navigate position picture. doing wrong?

lucene - Solr Facet Search - Get Value based on Max and Group by -

i trying price based on maximum timestamp grouped source. the solr query have right pulls maximum timestamp each source. how can modify query pull corresponding price associated maximum timestamp? http://localhost:6500/solr/listings/select?q=desc_t:"watch"&indent=on&rows=0&indent=true&wt=json&json.facet= { prices: { type: terms, field: source_s, facet: { max_ingestdate: "max(timestamp_dt)" } } } this returns back: "facets":{ "count":141211, "prices":{ "buckets":[{ "val":"a1", "count":71466, "max_ingestdate":1.505277283278e12}, { "val":"a2", "count":52415, "max_ingestdate":1.501872553356e12}, { "val":"a3",...

In Java, is it possible to have a switch statement within a method, and return the case value? -

i working on simple black jack simulator (just beginning learn java) , have confusion how can return value method. possible return entirety of individual case method every time method run? public static int player = 0; static random random = new random(); public static int randomcard = (random.nextint(13) + 1); public static void yourcard() { //this need change return type switch (randomcard) { case 1: system.out.println("your card ace!"); player += randomcard; //how return within case when method called system.out.println("your hand is:" + player); case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: system.out.println("your card " + randomcard + "!"); player += randomcard; ...

java - How to override parent pom JAR's in child POM? -

my parent pom has springboot 1.1.9 version, has spring jms version 4.0.6 part of it. i want use spring jms 4.1.0. added dependency such in child pom. required jar reflected in maven dependencies. compiles . when run application, gets methodnotfounderror/classnotfounderror. have checked , found uses parent pom jar of jms spring 4.0.6. my parent pom <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.bp.pnc</groupid> <artifactid>pnc-components-parent</artifactid> <packaging>pom</packaging> <version>1.0.128-snapshot</version> <name>pnc components parent</name> <parent> <groupid>org.springframework.boot</groupid> ...

ehcache - Hibernate second level cache: Hit and miss counts are always 0 -

i using hibernate 4.1.7 , ehcache second level cache <property name="hibernate.cache.region.factory_class"> org.hibernate.cache.ehcache.ehcacheregionfactory</property> <property name="hibernate.cache.use_second_level_cache">true</property> <property name="hibernate.cache.use_query_cache">true</property> when check miss count , hit count before , after db calls, 0. long loadentitycount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xys.program").getelementcountinmemory(); long hitcount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xys.program").gethitcount(); long misscount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xys.program").getmisscount(); list patientprograms = getprogramsforpatient( r); loadentitycount = hibernateuti...

java - Time complexity of given code ?subarray sum -

public static void print(int arr[],string s,int j,int sum,int num){ if(num==sum&&s.length()==6){ system.out.println(s.substring(1)); } if(j==arr.length){ return; } for(int i=j;i<arr.length;i++){ print(arr, s+" "+arr[i], i+1, sum+arr[i], num); } } public static void findtriplet(int[] arr, int x){ print(arr, "", 0, 0,x); } find time complexity of code, question find subarray of given array sum k can have duplicates values

vb.net - Regex if match then replace -

i've looked around try find answer question, can't find i'm looking for. seems there should way decide if there match , replace, otherwise else without need repeat matching. i'm trying decide if test string contains html document ends in </body></html> and inject text directly ahead of tags. of course there might combination of white-space/carriage-returns/line-feeds between 2 tags, i'm trying regex. however, test string might plain text , if regex match fails, append text end of string. , of course, i'm making more difficult is. i don't have code show here since can't figure out if possible .net regex implementation, here psudo-code showing do: dim teststring string = file contents dim reg new regex("(<\/body>\s*<\/html>)", regexoptions.ignorecase) dim rmatch match = reg.match(teststring) if rmatch.success rmatch.replace(newstring) else te...

c - Why my program outputs weird characteres? -

when use 3 or more names programs outputs weird characters. when use 2 totally fine, when use lot of spaces well. but when try kaue rodrigo pacheco output is: krp]a #include <stdio.h> #include <cs50.h> #include <string.h> int main(void) { string name = get_string("what name?\n"); // initiate array contain initials char initials[10]; // initials index int index = 0; // if first character not space append initials if (name[0] != 32) { // if character not between a-z if (!(name[0] >= 'a' && name[0] <= 'z')) { // transform in uppercase name[0] = name[0] - 32; } // append character initials array initials[index] = name[0]; // keep track on how many done index++; } // iterate through user input (int = 1; < strlen(name); i++) { if ((name[i] != 32) && (name[i - 1] == 32)) { // if character after blank...

android - How can I share a specific srcSet/configuration with a downstream module? -

i have :a (upstream module). inside :a , there's src/fakes/java want share downstream modules. contains fake implementations of interfaces within :a useful testing purposes. want include within :a tests, , optionally expose downstream consumers. :a 's build.gradle android { sourcesets { fakes { java { srcdir android.sourcesets.main.java srcdir 'src/fakes/java' } } test.java.srcdir 'src/fakes/java' } configurations { fakes fakes.extendsfrom(main) fakes.transitive false } } } :b 's build.gradle dependencies { compile project(path: ':a') testcompile project(path: ':a', configuration: 'fakes') } however, when compiling test classes within :b reference classes within :a 's src/fake/java , unresolved reference error. because :a not build .apk fakes configuration. how can achieve this? i'd prefer not utilize android's product flavors if p...

c++11 - Relaxed Memory Ordering in C++ -

i trying understand relaxed memory ordering of c++11. understanding : this ordering guarantees ordering of operations on particular atomic variable doesn't change ordering of operations of different atomic variables can change. ordering here within same thread. example, thread 1 operation on atomic x operation b on atomic y operation c on atomic y operation d on atomic x relaxed ordering guarantees operation happen-before operation d , operation b happen-before operation c. having said that, ordering of operations between x & y can still change. is, suppose original code above. 1 possible execution order be: operation on atomic x operation d on atomic x operation b on atomic y operation c on atomic y please correct me if understanding wrong. i wrote sample code below test relaxed memory ordering , expected assert fail sometime. never fails. built program on visual studio 2017 , running on windows 10 intel(r) core(tm) i7-6600u cpu@ 2.60ghz 2.80ghz class rel...

Android 7.1.2 text relocations error -

Image
just started testing app on android 7 , , got error msg, have no idea what's talking click ok black screen , nothing happen idea update it seems problem in compiled version used "ndk", did not used ndk self used lib compress videos , it's seems lib compiled older version of ndk question how update lib compiled version note : i'm using virtualbox the problem in virtual machine uses intel x86 , ndk compiled in arm architecture.

java - Prevent server side application from piracy -

i'm looking technique, prevents admin copying our server side software. admin copy vm , keep running same server same mac under different ip. dont wont check ip, because problem if server gets relocated other ip. i thought technique, server sends broadcast , have listener broadcast. if there 2 servers in network, can react scenario because both listeners receive something. thank :)

I used pip to install a module but my program responds, "No module named..." (PYTHON) -

yes, there other questions this. however, custom modules. used pip install module , apparent reason, on command-line only, responds error. on idle , sublime/pycharm, works fine. however, running command-prompt, said, gives error. doing wrong? if there multiple python instances, try: python 2: pip2 install httplib2 --upgrade python 3: pip3 install httplib2 --upgrade to check what's installed , where, try: pip list pip2 list pip3 list

git - Select all changes in Xcode 9 Commit -

i using cocoa pods xcode project , there lots of files in each of modules, , ran pod update , there ton of changes in source control -> commit tab. is there anyway select changes instead of going through them 1 one take forever? tried classics shift-click , others did not work. i'm unsure of how within xcode, open directory in terminal , use git add wildcards stage , commit appropriate files. however, if go route, make sure type git status first , want commit of files shown.

html - Issue with Adding Additional CSS -Wordpress -

only top row of customized css affects theme design ,all rest not affected. why happening , how can fix it? edit: css being used #mytext { line-height: 0.5px; word-wrap: break-word } ; .site-branding { opacity: 0.8; font-size: px; text-transform: uppercase; text-shadow: 7px 5px 0 rgba(0, 0, 0, 0.5); } ; #navigation_menu { display: none } ; break-word } ; #page { font-family: 'lato', sans-serif } ; .navbar, .site-description, .site-title { font-family: 'lato', sans-serif } ; .entry-title { font-family: 'lato', sans-serif } ;

Scikit-Learn GridSearch custom scoring function -

i need perform kernel pca on dataset of dimension (5000, 26421) lower dimension representation. choose number of components (say k) parameter, performing reduction of data , reconstruction original space , getting mean square error of reconstructed , original data different values of k. i came across sklearn's gridsearch functionality , want use above parameter estimation. since there no score function kernel pca, have implemented custom scoring function , passing gridsearch. from sklearn.decomposition.kernel_pca import kernelpca sklearn.model_selection import gridsearchcv import numpy np import math def scorer(clf, x): y1 = clf.inverse_transform(x) error = math.sqrt(np.mean((x - y1)**2)) return error param_grid = [ {'degree': [1, 10], 'kernel': ['poly'], 'n_components': [100, 400, 100]}, {'gamma': [0.001, 0.0001], 'kernel': ['rbf'], 'n_components': [100, 400, 100]}, ] kpca = kernelpca(fi...

.net - Winforms UnauthorizedAccessException C# -

im trying upload & download file google drive via c#. upload process working great when im download file im error.i search on google , stackoverflow cant pass error. string desktop = environment.getfolderpath(environment.specialfolder.desktop); string filepath = desktop + @"\derslerim\"+textbox2.text; directory.createdirectory(filepath); and using (var filestream = new filestream(filepath,filemode.create,fileaccess.write)) { filestream.write(memorystream.getbuffer(), 0, memorystream.getbuffer().length); } that code blocks create directory , create file areas. please me!

Render Angular 2 image with postfix -

i got image postfix set validation image etc. image served aws. know how go around it? example: example_bs6fply.jpg?awsaccesskeyid=akiajm45bbcd7sx6utpa&signature=vohcc4pwmyjfots1jphoaep%2bamo%3d&expires=1505349454

php - set value while debugging is not enabled -

i'm using latest version of visual studio code 64bit , trying change value during debug session. i tried using set value menu option change value it's disabled. i've got php debugging extension installed , have no problems stepping through code. tried debug console can't seem unset's there. have $_server values clear. simply using debug console allows change values.

Use Android JobScheduler to test for network connectivity -

for android nougat 7.0 , above, recommended use jobscheduler instead of broadcast receiver test network connectivity. i've seen many posts , articles state , point official docs. can't seem find specific example of using jobscheduler specific purpose. does have example of using jobscheduler check network connection available? or can point me example?

hashmap - Is it possible to create copy of Map Iterators in Java? -

public boolean placelizardsbydfs(int noofqueens){ if(noofqueens == 0) { return true; } else { iterator itforrow = allowedrows.entryset().iterator(); while (itforrow.hasnext()) { double temprow = (double) ((map.entry) itforrow.next()).getkey(); iterator itforcolumn = allowedcolumns.entryset().iterator(); while(itforcolumn.hasnext()) { double tempcolumn = (double) ((map.entry) itforcolumn.next()).getkey(); placequeen(temprow, tempcolumn); if (placelizardsbydfs(noofqueens - 1)) return true; else removequeen(temprow, tempcolumn, temprangeforrow, temprangeforcolumn); } } return false; } } i'm trying solve n queens problem. seems bigger inputs, code inefficient. i'm trying optimize reducing no....

ubuntu - Laravel 5 - How to create an Artisan command to execute bash script -

i want artisan command run bash script when executed. so i've created artisan command using following php artisan make:command backuplist --command=backup:list and here backuplist.php <?php namespace app\console\commands; require_once __dir__ . '/vendor/autoload.php'; use illuminate\console\command; class backupdb extends command { protected $signature = 'backup:list {name}'; protected $description = 'database backup tool'; public function __construct() { parent::__construct(); } public function handle() { $this->exec('ls -la'); } } in handle() exec , shell_exec don't seem work, there alternatives artisan command run bash in shell? rather use: $this->exec('ls -la'); you can following: // execute command exec("ls -la", $output); // print output command $this->comment( implode( php_eol, $output ) );

Javascript resets its code? -

i'm working on website ask question , gives answer , i'm wondering after 1 set of questions being asked user re directed next page answer more questions question javascript reset. let when user press button turn blah true return false if re direct user new page unless using form of storage (local storage, cookies, etc) page reset. if use storage require work bring out of storage well. every time go page associated javascript run if first time ever ran.

laravel - How can i check if data is " " -

how can check if data blank not null data == " " still proceeds else statement. here code : @if(app\company::all()->first()->logo == " ") <br> @else <img src='.{{ app\company::all()->first()->getlogoattribute()}}' style=" width: 20%;"> @endif you can use is_null() , empty() method: <?php $logo = app\company::all()->first()->logo; @if(is_null($logo) == false && empty($logo) == true) <br> @else <img src='.{{ app\company::all()->first()->getlogoattribute()}}' style=" width: 20%;"> @endif

javascript - get id of HTMLDivElement -

i passing htmldivelement in function follows var tablehtml = "... <li name="item2" onclick="oncombtopie2d(\'' + id + '\');" >pie 2d</li> ...."; $('#graphsdiv').append(tablehtml); i able access element in function follows function oncombtopie2d(element) { alert($('#element')); } but cannot access id of element. have tried following far alert($('#element').attr('id')); //undefined alert($('#element').prop('id')); //undefined alert(element.id); //undefined in viewsource div present (which kendo chart) <div id="chartmd2467rt6" data-role="chart" class="k-chart" style="position: relative; touch-action: none;"> ... </div> try sample: function oncombtopie2d(idelemento) { alert($('#'+idelemento).attr('id')); } <script src="https://ajax.googleapis.com/aj...

javascript - How important is to enforce the "linebreak-style" rule in ESlint? Can I just turn it off? -

i've created node.js module i'm gonna open-sourcing soon. developed on linux , decided test on windows before publishing it. when ran eslint on windows noticed had huge amount of linting errors same: error expected linebreaks 'lf' found 'crlf' linebreak-style i read in couple of places these linebreaks inserted git when cloned repo on windows. read possible turn off rule in eslint config file. safe this? or there "best practice" regarding rule? (considering open source project , others contributing it) any advice or feedback appreciated. try re-clone repo after typing: git config --global core.autocrlf false that should avoid git converting eol (end of lines) lf crlf automatically on checkout. linter should find expected eol. note: have been advocating setting false default years: see " git: unix or dos line termination ".

javascript - How can I avoid passing a parameter to each function but still have access to it inside the function -

when click button, opening jquery dialog , creating object of customclass. need object in different functions. there way avoid passing each function still have access inside function? note: using same code open multiple dialogs through different click events. js fiddle link : https://jsfiddle.net/gwphxssq/1/ html : <div class='btn1'>button1</div> <div class='btn2'>button2</div> <p class='plain-text'> 2 dialog's open, 1 behind other. please drag top dialog see other dialog below. </p> js: var test = test || {}; test = { customclass: function(fnsave) { return { dialogelem: null, savebtn: null, fnsave: fnsave } }, cache: function(obj, dialogelem) { obj.dialogelem = $(dialogelem); obj.savebtn = $(dialogelem).find('.btnsave'); }, opendialog: function(option) { var = this; var dynamicelem = '<div>dialog' + '<input type="bu...

c# - How to format Datetime? type to "yyyy-MM-dd" -

i query field database, planstartdate datetime type, , planstartdate can null, want format planstartdate "yyyy-mm-dd" datatable dt = ds.tables[0]; var query = dt.asenumerable() .select(dr => new initoverview { iid = string.isnullorempty(dr.field<string>("iid").tostring()) ? "" : dr.field<string>("iid"), projectname = string.isnullorempty(dr.field<string>("projectname")) ? "" : dr.field<string>("projectname"), teamlead = string.isnullorempty(dr.field<string>("teamlead")) ? "" : dr.field<string>("teamlead"), status = string.isnullorempty(dr.field<string>("status")) ? "" : dr.field<string>("status"), overallstatus = string.isnullorempty(dr.field<string>("overallstatus")) ? "" ...