Posts

.net - adding new value to List overwrite previous value -

i'm trying add list. if move declaration loop works fine slow, if don't, add method overwrite previous values. what should do? dim _obj new classdal.site.salespoint dim _r = _obj.getcities dim temp new classdal.site.salespoint dim mylist new list(of classdal.site.salespoint) each row in _r temp.fullcode = convert.tostring(row.item(0)) temp.citycode = convert.tostring(row.item(1)) temp.karm = convert.toint32(row.item(2)) temp.name = convert.tostring(row.item(3)) mylist.add(temp) temp = new classdal.site.salespoint next return mylist you have declare varible inside loop reference type, otherwise in next loop modifying reference last item created. you try doing this, don't think quicker: for each row in _r mylist.add(new classdal.site.salespoint { .fullcode = convert.tostring(row.item(0)) .citycode = convert.tostring(row.item(1)) .karm = convert.toint3...

NGINX 2 domains on the same IP, want to redirect both to HTTPS -

i have 2 domains running on server, nginx proxies them node apps. have certificate one, other i'm using cloudflare provide https. want ensure when users visit either domain, redirected https version of domain, without www. current configuration, uncommenting block domain2 configuration file seems break both sites :( domain1 config file: upstream domain1.com { server 127.0.0.1:8000; keepalive 8; } server { listen 0.0.0.0:80; server_name domain1.com www.domain1.com; return 301 https://domain1.com$request_uri; } server { #listen 80; listen 443 ssl http2; server_name domain1.com; access_log /var/log/nginx/domain1.com.log; root /var/www/domain1.com/client/public; include /etc/nginx/global/cloudflare-allow.conf; ssl_certificate /etc/nginx/ssl/domain1.crt; ssl_certificate_key /etc/nginx/ssl/domain1.key; if ($bad_referer) { return 444; } location / { proxy_http_version 1.1; proxy_set_he...

Javascript, get the name of a bound function -

i've created function , bound arguments below. function myfunc(){} let boundfunc = myfunc.bind(argument); but pass bound function argument function, need name. following: function dothething(callable){ console.log(callable.name + " did thing"); } dothething(boundfunc); prints out bound did thing rather myfunc did thing . there way name of bound function? callable.caller results in uncaught typeerror: 'caller' , 'arguments' restricted function properties , cannot accessed in context. , not browser standard. google chrome v 51.0.2704.103 gives different result: function myfunc(){} let boundfunc = myfunc.bind(null); function dothething(callable){ console.log(callable.name + " did thing"); } dothething(boundfunc); it prints bound myfunc did thing , original name callable.name.substring(6)

c# - WCF connection with HTTPS security using SSON cookie -

i have little experience cookies need here. i have scenario have establish wcf connection remote endpoint using https security. situation complicated thing endpoint address in client config pointing web proxy redirects request actual endpoint if sson auth has been detected or redirects auth page. example : service address client config ' https://a.com/my.svc '. if auth ok connect address, if not, redirected ' https://a.com/auth ' , after successful auth proceed again ' https://a.com/my.svc ' if open address in web browser i'm redirected auth page , after successful auth (login/pwd) redirected address. after authenication sson cookie generated , consequent address queries lead me straight address no additional auth. as of i've done following: do auth using wpf webbrowser control. i've got cookie after that. made client endpoint connection. yeah session used default in prod environment, i'm not sure if can remove it. <custom...

oracle12c - Oracle 12C Identity Column with EntityManager -

i have created sample table identity column in oracle. create table "core_prod"."book" ( "id" number generated default identity minvalue 1 maxvalue 9999999999999999999999999999 increment 1 start 1 cache 20 noorder nocycle not null enable, "author" varchar2(255 byte), "genre" varchar2(255 byte), "isbn" varchar2(255 byte), "published" number not null enable, "title" varchar2(255 byte), primary key ("id") using index pctfree 10 initrans 2 maxtrans 255 compute statistics tablespace "mca_data" enable ) segment creation deferred pctfree 10 pctused 40 initrans 1 maxtrans 255 nocompress logging tablespace "prod_data" ; i have created entitymanagerconfiguration using below configuration @bean public datasource datasource() { drivermanagerdatasource datasource = new drivermanagerdatasource(); datasourc...

python - Why is numdifftools so inaccurate? How does it work? -

i'm using python's numdifftools library perform derivatives. however, few tests prove library highly inaccurate: import numpy np numdifftools import derivative # result should 1/2 or 0.5 derivative(np.log, 1)(2.0) >>> array(0.5493061443340549) is there way fix inaccuracy? using numdifftools 0.9.16 , numpy 1.9.3 following code gives exact result: import numpy np numdifftools import derivative # result should 1/2 or 0.5 derivative(np.log)(2.0) output: array(0.5000000000000238)

Uploading file on the wrong folder with PHP -

i'm uploading pictures using angularjs , php. on server side, code looks this: <?php $filename = $_files['file']['name']; $destination = '/home1/cccctang/public_html/miquelimarc/uploads' . $filename; move_uploaded_file( $_files['file']['tmp_name'] , $destination ); ?> even folder seems defined, keeps uploading files root folder (where .php file is). what missing? you forget write / $destination = '/home1/cccctang/public_html/miquelimarc/uploads/' . $filename;