Posts

Showing posts from January, 2014

javascript - How can I remove the input before cloning a div? -

i've found few answers question on stack overflow, it's not working me. @ moment, code looks (i removed other divs it's not long read) : <div id="dynamicinput"> <div id="duplicater"> <input type="text" placeholder="event title" name="title"> <input type="text" placeholder="url" name="url"> </div> </div> and javascript : var = 0; var original = document.getelementbyid('duplicater'); function duplicate() { var clone = original.clonenode(true); clone.id = "duplicate" + ++i; original.parentnode.appendchild(clone); } it works great, if put text before pressing button "add event", clones text, , don't want that. i've tried add .find('input').val('') on first line, it's not working, can't clone anymore. error in console method find not found . the same thi

javascript - How to retrive attribute value if user clicked on child element? -

can tell me how retrive data-custom attribute value if click on red square?i dont want place same attribute in child because getting verbose if have more&deeper nested elements. class example extends react.component { constructor(props){ super(props) this.onclick = this.onclick.bind(this) } render(){ return ( <div classname="large-box" data-custom="iexist" onclick={this.onclick}> <div classname="box red"></div> </div> ) } onclick(e){ console.log(e.target.getattribute('data-custom')) } } reactdom.render(<example />,document.getelementbyid('app')) .large-box { display:flex; width:200px; height:100px; border:1px solid black; } .box { margin:auto auto; width:40px; height:40px; } .red{background-color:red;} <script src="https:/

javascript - d3-geo-projection es6 imports -

i've started using es6 imports in projects , id import d3-geo-projection in such way can call projections have, in: var proj = d3.geoaitoff(); and i'd avoid rolling own bundle. i have tried import * d3 'd3'; import 'd3-geo-projection'; and tried import * d3 'd3'; import {geoaitoff} 'd3-geo-projection'; neither results in being able call var proj = d3.geoaitoff() ; can advise on how should done?

PySpark minimum of a list -

how find minimum of list stored in cell? can udf, feels overkill. min function pyspark.sql.functions works on groups (that result of groupby). min_ = udf(lambda inarr: min(inarr), integertype()) mydataframewithmin = mydataframe.withcolumn('min_value', min_(f.col('position_list'))) if imported pyspark.sql.functions , python's min covered, can still access __builtins__ prefix, example: min_ = udf(lambda inarr: __builtins__.min(inarr), integertype())

Openshift 3 free: mini SpringBoot app + Mysql immediately exceeds the quota limits? -

when experimenting openshift v3 - create , deploy simple webapplication wildfly & postgres. when trying create simple springboot application (as war) mysql (with 1 table), mysql volume storage exceeds quota. result simple application cannot run properly. error creating: pods "springbootmysql-8-" forbidden: exceeded quota: compute-resources, requested: limits.cpu=1,limits.memory=512mi, used: limits.cpu=2,limits.memory=1gi, limited: limits.cpu=2,limits.memory=1gi 19 times in last 11 minutes update : configured both pod's 480mi memory - memory quota's not exceeded. i error message stoping build , deployment: error creating: pods "springbootmysql6-2-" forbidden: exceeded quota: compute-resources, requested: limits.cpu=957m,limits.memory=490mi, used: limits.cpu=1914m,limits.memory=980mi, limited: limits.cpu=2,limits.memory=1gi on openshift online starter, if running both database , frontend both using 512mb each,

oracle - As a non-DBA user, how can I pass on scripts to other users that work in their own Schema? -

here's situation. i'm non-dba user in oracle database. such, have ddl , dml privileges own schema, can create, drop, update, etc tables in own schema. so let's write script creates , updates tables in own schema (let's call schema user1). when day comes leave company , need pass script on replacement (let's user2), how do if script works user1? user2 have go through script , replace references of user1 user2? point being i'd script work regardless user runs without having tinker it. first, if it's production script creates tables application , manipulates it's data, shouldn't run own user, dedicated production user. regardless, if you're running script in own schema, doesn't need explicitly reference it. remove references schema, , objects created under user running it, meaning user can run own account (assuming has basic dml/ddl permissions script requires).

objective c - ARKit : how to find all planes hit by a hitTest? -

i have array of planes (non infinite planes => finite dimensions) in array: plane *plane = [[plane alloc] initwithanchor: (arplaneanchor *)anchor]; [self.planes setobject:plane forkey:anchor.identifier]; (plane object heritates scnnode , has arplaneanchor *anchor , scnplane *planegeometry properties) how find planes of array planes hit hittest @ point of screen ? thanks ! i use categorybitmask , set example 3 (=11b). set categorybitmask option in hit test 2 (=10b). way nodes second bit of categroy 1 returned.

c++ - Function default parameters are ignored -

for simplified piece of code i'm getting following error: error: few arguments function std::cout << f(); int g(int = 2, int b = 1) { return + b; } template<class func> void generic(func f) { std::cout << f(); } int main() { generic(g); } i cannot clue reason why default parameters of function f not passing function generic . behaves f doesn't have default parameters ... what's wrong there? how forward default parameters correctly? g may have default arguments, type of &g still int(*)(int, int) , not type can called no arguments. within generic , can't differentiate - we've lost context default arguments. you can wrap g in lambda preserve context: generic([]{ return g(); });

javascript - Repeat mouse path with different start and end points -

i have recorded mouse path stored array. record: function(selector) { var target = document.queryselector(selector); this.target = target; target.addeventlistener('mousemove', (event) => { if (!event.istrusted) return false; var x = event.pagex - target.offsetleft; var y = event.pagey - target.offsettop; this.addpoint(x, y); }); } how can repeat recorded path other start , stop coordinates? provide code example or library? for example: [0, 1] [0, 2] [0, 3] [0, 4] start point [0, 1] , end point [0, 4]. want repeat same path different start , stop points. with regards "could provide code example or library ?", take @ paper.js ( http://paperjs.org/features/#vector-geometry ) , tutorial on vector geometry ( https://scriptographer.org/tutorials/geometry/vector-geometry ).

java - Keytool Error in CMD: invalid signed fields -

i'm running rem procedures on cmd import new certification , key store. https://i.stack.imgur.com/ss8fj.png i receive error when try run it. there way tell invalid keys being referred to? [1]:

html - border-spacing for fieldset elements -

this question has answer here: textboxes being treated <td> elements css not aligning corresponding text 1 answer i'm trying "pad" elements of fieldset , suggested used border spacing. looking @ w3 schools, appears border spacing table elements, i'm not sure else do. here css , html. using border-spacing made no changes display of page. fieldset { display: block; /*margin: 0 auto;*/ /*text-align: center;*/ /*margin-left: 2px;*/ /*margin-right: 2px;*/ padding-top: 0.35em; padding-bottom: 0.625em; padding-left: 0.75em; padding-right: 0.75em; border: 2px groove; } .table { display: table; /*text-align: center;*/ /*margin: 0 auto;*/ } .tr { display: table-row; /*padding-top: 0.35em;*/ /*padding-bottom: 0.625em;*/ vertical-align: top; border-spacing: 10px 50px; } .td {

php - Not working after moving to production server, no error, empty response -

i attempting use php curl's functions interact api made. worked fine on development machine: function handleerrors(int $errseverity , string $errmsg, string $errfile, int $errline) { $credentials = array( "grant_type" => "password", "username" => "user", "password" => "pass" ); $errorobj = array ( "appid" => 2, "errorsource" => $errfile . " line, " . $errline, "errormessage" => $errmsg ); $curl = curl_init(); try { curl_setopt_array($curl, array( curlopt_returntransfer => 1, curlopt_url => api_base . api_auth_path, curlopt_post => 1, curlopt_postfields => http_build_query($credentials) )); $resp = curl_exec($curl); $token = json_decode($resp, true)["access_token"]; curl_setopt_array($curl, array( curlopt_url => api_base . api_error_path, curlopt_post => 1, curlinfo_header_out => 1, curlopt_httpheader =&

wpf - Zooming on CTRL + Mousewheel in DotNetBrowser -

i'm using dotnetbrowser wpf control , need set zoom level on ctrl + mousewheel event. i've added following code control, expecting e.delta give me direction mouse wheel being moved. having ctrl key down prevents underlying window scrolling, figured control zoom checking whether delta positive or negative. browserview.previewmousewheel += (s, e) => { debug.writeline("previewing event " + e.delta); }; however, when attached browserview, delta value 0. how can determine direction mouse wheel being moved can apply zoom level?

git - Jenkins - How do I publish coverage report to github -

i trying use github-pr-coverage-status-plugin , documentation says need run following on master branch: step([$class: 'mastercoverageaction']) but when add pipeline following error: java.lang.unsupportedoperationexception: can't find git_url or change_url in envs: {branch_name=master, build_display_name=#41, build_id=41, build_number=41, build_tag=jenkins-testci-master-41, build_url=https://jnkns-ci.myserver.com/job/testci/job/master/41/, classpath=, hudson_home=/var/jenkins_home, hudson_server_cookie=01f6aedeea333d1f, hudson_url=https://jnkns-ci.myserver.com/, jenkins_home=/var/jenkins_home, jenkins_server_cookie=01f6aedeea333d1f, jenkins_url=https://jnkns-ci.myserver.com/, job_base_name=master, job_display_url=https://jnkns-ci.myserver.com/job/testci/job/master/display/redirect, job_name=testci/master, job_url=https://jnkns-ci.myserver.com/job/testci/job/master/, run_changes_display_url=https://jnkns-ci.myserver.com/job/testci/job/master/41/display/redirect?

caching - Invalidate Cloudfront Cache in Rails app -

i'm trying invalidate aws cloudfront cache within rails application on save/ update, rather doing manually in aws console. i've researched aws-cloudfront gem, nothing making sense me. help/ suggestions appreciated. the invalidation ideally should happen automatically because filename being served different. if asset on rails asset pipeline finger printing feature should working you, sense saving updating else.

san - HP P2000 iSCSI additions -

i have hp p2000 san 2 msa 4 iscsi ports each. 2 iscsi ports per msa utilized. 1 going each of our san switches , furthermore our hosts. throughput has been lacking lately , idea brought forth utilize remaining 2 iscsi ports per msa. have assigned ports ip in san network , added appropriate vlan. new me, there else should done os (win serv 08) perspective utilize additional links? sure there more information need provide, ask away , happy fill in gaps

How to get embedded type from GO struct? -

i trying embedded type go structs. below example program demonstrates this. there way write myfunc() without enumerating every type can come in input? https://play.golang.org/p/5wp14o660m package main import ( "fmt" ) type objectmeta struct { name string namespace string } type struct { objectmeta x string } type b struct { objectmeta x string } func myfunc(v interface{}) objectmeta { switch u := v.(type) { case *a: return u.objectmeta case a: return u.objectmeta case *b: return u.objectmeta case b: return u.objectmeta } panic("no matching type") } func main() { fmt.println(myfunc(&a{})) var v interface{} = &a{} fmt.println(v.(*objectmeta)) } objectmeta , a , b structs exist in external project. have no control on them. it can done using reflection, iterating through fields of incoming value: func myfunc(v interface{}) objectmeta {

maple - Shade Bounded Region along y-axis -

Image
i plotted line want shade area between 2 , 4 along y axis illustrate area under curve cannot figure out how that, can help? code, rather simple >y:=(2*x); >plot(y,x=0..3); i find difficult understand region have in mind. is this? restart; y := 2*x: plots:-display( plot(2*x, x=0..3), plots:-inequal([y>=y, y>=2, y<=4], x=0..3, y=0..6, 'nolines', 'color'="burgundy") ); of course omit curve (line) y=2*x by removing call plot above. if have other region in mind should able adjust call plots:-inequal accordingly. there other ways accomplish such things, such calling plot filled option. can use plottools:-reflect , or use parametric calling sequence of plot , flip x , y axes. i figure might wanting avoid having "solve x", x values corresponding y=2 , y=4 (even though in example of y=2*x can in head). these reasons why think you'd likley find easiest use plots:-inequal .

json - Installing Packages in Sublimetext3 with Package Control under a proxy -

Image
i installed sublimetext3 , manually installed package control following this website the second step configure package control settings proxy network, this: { "bootstrapped": true, "http_proxy": "http:proxy.xxx/accelerated_pac_base.pac", "https_proxy": "https:proxy.xxx/accelerated_pac_base.pac", "in_process_packages": [ ], "installed_packages": [ "package control" ], "proxy_password": "xxxxx", "proxy_username": "123456" } when try tools>command palette> package control: install package receive following message: the console return following situation (error 401): dpi scale: 1 startup, version: 3143 windows x32 channel: stable executable: /c/users/tbmepyg/desktop/sublimetext/sublime_text.exe working dir: /c/users/tbmepyg/desktop/sublimetext packages path: /c/users/tbmepyg/desktop/sublimetext/data/p

django - python app not starting in visual studio -

i have created django python app, , when press f5 , pops python shell says available subcommands: [auth] changepassword createsuperuser [django] check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate runfcgi shell showmigrations sql sqlall sqlclear sqlcustom sqldropindexes sqlflush sqlindexes sqlmigrate sqlsequencereset squashmigrations startapp startproject syncdb test testserver validate [sessions] clearsessions [staticfiles] collectstatic findstatic runserver press key continue . . . but not open browser , app not running, when hit key , stops app. i wondering issue. weird thing few days ago app working fine , didn't after that. i resolved issue. issue port 8000, system not allowing me access port number: 8000. so went visualstudio ---->debug ----> project properties @ bottom ---> debug --->enter port number : 5000 and worked charm.

python - How to update to sklearn 0.19? -

first tried update package according documentation using commands below: pip install -u scikit-learn or conda install scikit-learn but version still 0.18 in pycharm. tried run update in "settings--project interpreter", failed error: installerror: error: 1 or more of packages installed depend on 'conda' , should installed in root environment: conda conda-env. these packages need removed before conda can proceed. i'm totally stuck now. appreciate in advance!

ruby on rails - Import CSV files into SQL database in ROR -

i've searched similar thread no luck far, building ror application , have create database, want import css file database, below files have errors got: schema.rb: activerecord::schema.define(version: 20170913210926) create_table "items", force: :cascade |t| t.string "title" t.string "description" t.string "author" t.string "tags" t.datetime "created_at", null: false t.datetime "updated_at", null: false end end i have rake task file(import.task): require 'csv' csv_text = file.read('/path/to/csv/item.csv') csv = csv.parse(csv_text, :headers => true) csv.each |row| item.create!(row.to_hash) end so when ran rake import.task in terminal got following error: rake aborted! nameerror: undefined local variable or method `item' main:object your rake task looks more regular ruby script rake task. if want use rake this, try like: require 'csv&

java - Why final byte variable cannot be converted to Integer during auto-boxing? -

there no error when try autobox i2 byte ,but when vise-versa( b1 integer ),then error occurs. final byte b1 = 1; integer i1 = b1; //error final int i2 = 1; byte b2 = i2;// no error byte b3 = 1; int i3 = b3; // no error can suggest read jls sec 5.2 , linked in answer previous similar question . assignment contexts allow use of 1 of following: an identity conversion (§5.1.1) a widening primitive conversion (§5.1.2) a widening reference conversion (§5.1.5) a boxing conversion (§5.1.7) optionally followed widening reference conversion an unboxing conversion (§5.1.8) optionally followed widening primitive conversion. ... in addition, if expression constant expression (§15.28) of type byte, short, char, or int: a narrowing primitive conversion may used if type of variable byte, short, or char, , value of constant expression representable in type of variable. a narrowing

gcc - How to Compile a C program which contains 32bit asm into .o file? -

introduction i'm following through book " learning linux binary analysis ". have experience working 32 bit assembly , c (however still consider myself novice). i'm having trouble , confusion of how compile c program , contains 32 bit assembly object file .o. im guessing compilation issue on part. the source code part of example of code injection-based binary patching. source code #include <sys/syscall.h> int _write (int fd, void *buf, int count) { long ret; __asm__ __volatile__ ("pushl %%ebx\n\t" "movl %%esi,%%ebx\n\t" "int $0x80\n\t""popl %%ebx":"=a" (ret) :"0" (sys_write), "s" ((long) fd), "c" ((long) buf), "d" ((long) count)); if (ret >= 0) { return (int) ret; } return -1; } int evil_puts(void) { _write(1, "haha puts() has been hijacked!\n", 31); } the problem i attempt compile evil_pu

authentication - Keep Cordova app 'unlocked' even while offline, once authenticated -

i'm creating app cordova/phonegap, displays variety of information offline. i'm aiming keep distribution private, know possible others it. what i'm trying achieve: want user able perform kind of login/authentication, unlock of information within app, otherwise blocked. need once on given device, , on info visible, when device offline. question: once authentication has occurred (i'll work out separately), sort of mechanism use app record unlocked (e.g. storing locally), without requirement online check anything. extra info: - assume simple flag html localstorage (to unlocked=yes) spoofed (though need), , instead needs store more complicated code links email address maybe, couldn't guessed? - right in saying quite easy read actual information within app anyway, it's not secure in first place? if case, how can make text information within html pages less easy casually read once app has been built. - don't know how these things, imagine it's si

android - How can I get checkboxes working in my listview? -

i've been trying follow tutorials/ posts on s.o on how checkbox working in listview . lots of stuff want first want position of item checked app crashes , nullpointerexception error. the error (with more stuff below part) : java.lang.nullpointerexception @ com.example.chris.tutorialspoint.selectphonecontactadapter.getview(selectphonecontactadapter.java:104) and line 104 : convertview.settag(v); but me looks i've been following tutorials , don't know how adapt these posts problem: getting nullpointerexception in custom listview , crash in listview @ abslistview.obtainview listactivity . can tell me wrong? worked until started experimenting these checkboxes. here customadapter code, selectphonecontactadapter : public class selectphonecontactadapter extends baseadapter { //define list made out of selectphonecontacts , call thecontactslist public list<selectphonecontact> thecontactslist; //define array list made out of selectcontacts

ios - Xcode stdint.h #error This file should only be included when compiling with MSVC -

Image
i've got cocoapods react native project in xcode has been working 99% of time past few months. (the 1% random stuff this, linker errors, etc... comes , goes seemingly @ random). i installed new pod , corresponding npm dependency today, , in past when added pods have issues until try things pod deintegrate , pod install , react-native link , clean xcode project, example. time seems nothing fixing it. every time build, whether simulator or physical device, following error stdint.h this file should included when compiling msvc. it's pretty easy find source of error, it's explicitly user-defined in stdint.h : but can't life of me figure out why it's getting triggered. says right there in comments msvc included. knowledge, c-based xcode compiler should provide msvc version satisfy conditional. additionally, throughout course of troubleshooting/experimenting past few hours, culprit calling error has changed multiple times. right it's coming rctfbsdk

java - Proper way to parse the body of an error with Spring's RestTemplate -

i'm using @valid annotation on @requestbody argument uses hibernate validation, ensure it's validated: public responseentity<?> register(@requestbody @valid registrationmodel registration) { ... following recommendations of spring rest book, i'm catching exception , turning nice json error message looks this: { "title": "validation failed", "status": 400, "detail": "input validation failed", "timestamp": 1505345551757, "developermessage": "org.springframework.web.bind.methodargumentnotvalidexception", "errors": { "hashedpassword": [ { "code": "notnull", "message": "must not null" } ], "organization": [ { "code": "notblank", "message": "must not blank" } ], "name": [ {

amazon web services - How to clean up S3 files that is used by AWS Firehose after loading the files? -

aws firehose uses s3 intermittent storage before data copied redshift. once data transferred redshift, how clean them automatically if succeeds. i deleted files manually, went out of state complaining files got deleted, had delete , recreate firehose again resume. deleting files after 7 days s3 rules work? or there automated way, firehose can delete successful files got moved redshift. once you're done loading destination table, execute similar (the below snippet typical shell script): aws s3 ls $aws_bucket/$table_name.txt.gz if [ "$?" = "0" ] aws s3 rm $aws_bucket/$table_name.txt.gz fi this'll check whether table you've loaded exists on s3 or not , drop it. execute part of cronjob. if etl/elt not recursive , can write snippet towards end of script. it'll delete file on s3 after populating table. however, before execution of part, make sure target table has been populated. if etl/elt recursive , may pu

ios11 - what version of macOS and xcode is required to submit for ios 11 -

i submitted build using xcode 9.0 gm , mac os 10.13 , getting error saying new apps , app updates must built public (gm) versions of xcode 6 or later, macos, , ios sdk. don't submit apps built beta software including beta macos builds. what version of mac os , xcode should running. nothing making clear version exactly?thank you.

javascript - Merge multiple json objects iniside an array to a Desired format -

i have json file goes below [{ "data": { "aggregations": { "openissue": { "buckets": [{ "doc_count": 5, "date": "25 aug" }, { "doc_count": 6, "date": "26 aug" }, { "doc_count": 7, "date": "27 aug" }, { "doc_count": 8, "date": "28 aug" } ] } } }, "a": "not needed", "b": "not needed" }, { "data": { "aggregations": { "closeis

performance - why simple for loop with if condition is faster than conditional generator expression in python -

why loop if condition in first case more 2 times faster second case conditional generator expression? %%timeit in range(100000): if < 10000: continue pass clocks @ 100 loops, best of 3: 2.85 ms per loop, while using generator expression: %%timeit in (i in range(100000) if >= 10000): pass 100 loops, best of 3: 6.03 ms per loop first version : each element in range: assign i . second version : each element in range: assign inner i (third 1 left), evaluate expression i (the i ...(i for... assign result "outer" (leftmost) i . the if statements have similar performance impact in both versions.

constructor - Using if/else statements in setters -

in uml telling me not let field update if value negative public void setcurrentbalance(double currentbalance) { if (currentbalance <= 0) this.currentbalance = currentbalance; else this.currentbalance = currentbalance; } does correct if constructor looks like: setaccountnumber(accountnumber); setownerfirstname(ownerfirstname); setownerlastname(ownerlastname); setcurrentbalance(currentbalance); setminimumbalancerequired(minimumbalancerequired);

How can I use Ansible nested variable? -

i have ansible playbook 1 below, want use nested variable this: msg={{{{component}}.community_release_num}} , when run playbook: ansible-playbook vartest.yml -e 'version=version_402', not work [es@vpn-server nested-var]$ tree . ├── vars │   ├── horizon.yml │   └── version_402.yml └── vartest.yml 1 directory, 3 files [es@vpn-server nested-var]$ cat vartest.yml --- - name: test hosts: localhost vars_files: - vars/{{version}}.yml tasks: - debug: msg={{{{component}}.community_release_num}} - debug: msg={{{{component}}.release_num}} [es@vpn-server nested-var]$ cat vars/horizon.yml component: horizon [es@vpn-server nested-var]$ cat vars/version_402.yml - horizon: community_release_num: '9.0.1' release_num: '4.0.2' [es@vpn-server nested-var]$ error messages [es@vpn-server nested-var]$ ansible-playbook vartest.yml -e 'version=version_402' /usr/lib64/python2.6/site-packages/cryptography/__init__.py:25: deprecationwarnin

Java ProcessBuilder calling another java with arguments -

i want use progressbuilder run jar arguments inserted. example: es.jar file main class, , arg sl . know can use runtime.getruntime().exec() this: string arg = "sl"; process p = runtime.getruntime().exec("java -cp \"es.jar " + arg + "\" main"); if use progressbuilder , without arg sl , this: processbuilder.command("java","-cp","es.jar", "main").start(); however, arg sl needed, how can insert it? have tried following codes none of them work: processbuilder.command("java","-cp","es.jar sl", "main").start(); // failed processbuilder.command("java","-cp","\"es.jar sl\"", "main").start(); // failed java -cp "es.jar sl" main makes no sense, , i'm pretty sure otherwise fail java states java [-options] class [args...] , first parameter after options class executed, based on questio

html - ID not applying styles to table -

i trying apply css styles tables using section tag styles not being applied. here code below. <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <link href="https://fonts.googleapis.com/css?family=open+sans|oswald" rel="stylesheet"> </head> <body> <div id="nav"> <a href="assignment1.html">home</a> <a href="table.html">table</a> <a href="http://rrc.ca">red river</a> <a href="http://google.ca">google</a> </div <section id="table1"> <table> <thead> <tr> <th>syntax</th> <th>description</th>

python - Adding a conditional column to a datframe if the value is in a list -

i have pandas dataframe column called 'letters' has letters of alphabet values. first row 'c', next row 'z', next 'm' on , forth: letters c z m a b o .... i have lists groups letters of alphabet fall, so: early_alph = ['a','b','c'....'m'] late_alph = ['n','o','p'....'z'] i to add new column dataframe groups letters of alphabet depending on list in. if sql write following: %let early_alph = ('a','b','c'....'m'); %let late_alph = ('n','o','p'....'z'); create table my_df select letters, case when letters in &early_alph. 'early_alph' when letters in &late_alph 'late_alph' else 'unknown' end 'alph_group' my_table; the output looking is: letters alph_group c early_alph z late_alph m early_alph a

database - How to get $id to delete in list item? -

i create function list_product show list product. i want have button delete on each product on list products. but can't $id delete. have method delete rows on list database? my function like: <?php function product_list() { ?> <div class="wrap"> <?php global $wpdb; $table_name = $wpdb->prefix . "product"; if (isset($_post['delete'])) { $wpdb->query($wpdb->prepare("delete $table_name id = %s", $id)); } else { $rows = $wpdb->get_results("select id,name $table_name"); } ?> <table> <tr> <th>id</th> <th>name</th> </tr> <?php foreach ($rows $row) { ?> <tr> <td><?php echo $row->id; ?></td> <td><?

javascript - Can't access the window level variable even though it exists. returns undefined when accessed -

Image
i trying access window level variable in script in window.onload() , returns undefined . when console log or try type in window in debug console, shows me variable exists on window object , has value. unclear why happening , there way access it? please correct me if doing wrong , point me in right direction. appreciated. update: window._vp variable declared in script of live website , trying access particular variable using chrome extension. my script: window.onload = _ => { console.log("window._vp is:", window._vp); } website script: var _vp = {}; _vp['isdashavailable'] = false; //... you can see behavior in following screenshot of dev tool console: thank you. i believe issue extensions isolated context, detailed in so post context isolation faced identical issue. you should try following method quoted other answer: method 2b: using function for big chunk of code, quoting string not feasible. instead of using array, functi

javascript - I want to know how Array.prototype.sort works basically polyfill of sort function -

i know how sort works in js want know how array.prototype.sort implemented, polyfill of sort function, algorithm or other details i'm unable find here, https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/sort if you're interested, here's specification array.protoype.sort: http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.11 it not dictate sorting algorithm use, that's browser's implementation.

r - How do you access tables not in the default Oracle schema using dplyr? -

with release of dplyr 0.7.0 , supposedly easy connect oracle using odbc package. however, running problem accessing tables not inside default schema (for me username). example, suppose there table test_table in schema test_schema . then, example sql syntax data be: select * test_schema.test_table' . to same in `dplyr, trying following: # make database connection using odbc: [here's guide][1] oracle_con <- dbi::dbconnect(odbc::odbc(), "db") # attempt table data tbl(oracle_con, 'test_schema.test_table') now, leads error message: error: <sql> 'select * ("test_schema.test_table") "zzz12" (0 = 1)' nanodbc/nanodbc.cpp:1587: 42s02: [oracle][odbc][ora]ora-00942: table or view not exist i think problem here double quotation marks, as: dbi::dbgetquery(oracle_con, "select * (test_schema.test_table) rownum < 100;") works fine. i struggled while until found solution @ bottom of introduction d

rest - Securing RESTful service on Weblogic server -

i using jdev12.2.1.0.0. new rest api. have created restful service using json , want deploy in weblogic server. how should secure service? i have read through docs : securing restful web services https://docs.oracle.com/cd/e24329_01/web.1211/e24983/secure.htm#restf252 approach should followed? what details security should shared developers of client application apart wadl url?

Comparing the same row in SQL Server table -

how display result india vs pakistan, india vs sri lanka, india vs bangladesh, bangladesh vs sri lanka, bangladesh vs pakistan, pakistan vs sri lanka below table? teams ------- india pakistan sri lanka bangladesh for example: --output: bangladesh vs. india bangladesh vs. sri lanka bangladesh vs. pakistan india vs. sri lanka india vs. pakistan pakistan vs. sri lanka i guess looking non repeating combinations of team matches. try below: create table temp ( team varchar(100) ) insert temp values ('india'), ('bangladesh'), ('sri lanka'), ('pakistan') select t1.team + ' vs. ' + t2.team temp t1 cross join temp t2 t1.team < t2.team drop table temp result ----------- india vs. sri lanka india vs. pakistan bangladesh vs. india bangladesh vs. sri lanka bangladesh vs. pakistan pakistan vs. sri lanka

PHP MySQL : Load data infile add row index base on primary key -

i uploading csv file using load data infile, how can make row index specific column. $max_asset_id = 79; load data local infile '$file' ignore table asset_mgt.asset_info fields terminated ',' enclosed '\"' lines terminated '\n' (@asset_id, @type_of_asset, @asset_description, @model, @serial_number, @asset_tagging_no, @quanity, @remarks) set asset_id = /*add increment here $max_asset_id++ */, type_of_asset = @type_of_asset, asset_description = @asset_description, model = @model, serial_number = @serial_number, asset_tagging_no = @asset_tagging_no, quanity = @quanity, remarks = @remarks

networking - Shadowsocks+SwitchyOmega does not work -

system:arch linux x86_64 chrome:version 61.0.3163.79 (official build) (64-bit) chrome plusins : ublock origin,httpseverywhere,switchyomega switchyomega : v2.5.2 switchyomega settings :socks5 127.0.0.1:1080 shadowsocks gui :shadowsocks-qt5 2.9.0 when use omega visit google.com,it gives me : this site can’t reached www.google.com unexpectedly closed connection. err_connection_closed" and youtube.com gives me : youtube.com uses unsupported protocol. err_ssl_version_or_cipher_mismatch shadowsocks android client fine. so ,is google chrome or switchyomega problem ? btw,i'm in china,so consider our network censor problem.

osx - How do I perform Face Detection in Swift -

Image
im using following code detect face image. let userdirectory = filemanager.default.homedirectoryforcurrentuser let desktopdirectory = userdirectory.appendingpathcomponent("desktop") let pictureurl = desktopdirectory.appendingpathcomponent("test").appendingpathextension("jpg") let image = ciimage(contentsof: pictureurl) let facedetector = cidetector(oftype: cidetectortypeface, context: nil, options: [cidetectoraccuracy: cidetectoraccuracyhigh]) let faces = facedetector?.features(in: image!) as! [cifacefeature] print("number of faces: \(faces.count)") how can detect face , save nsimage? xcode 9 • swift 4 extension nsimage { var ciimage: ciimage? { guard let data = tiffrepresentation else { return nil } return ciimage(data: data) } var faces: [nsimage] { guard let ciimage = ciimage else { return [] } return (cidetector(oftype: cidetectortypeface, context: nil, options: [cidetectoracc

d3.js - D3 scatterplot on time series multi-line line graph -

i've attempted place points (eventually hover tooltips) @ each data point on time-series graph. here d3 block the multi-line portion based on this example , , creates function called draw() draws graph leveraging external d3.line() generators. i'm trying create scatterplot dots on data-points temperature data , time intersect - works on lines not on ellipses, , i'm not sure i'm doing wrong. the failing scatterplot attempt here. what's best way make circles overlap data-points? error i'm getting in javascript debugger d3.v4.js:1381 error: <circle> attribute cx: expected length, "nan". d3.v4.js:1381 error: <circle> attribute cy: expected length, "nan". the data parsing seems work fine line intersections, not cx , cy coordinates. javascript failing attempt below: // set dimensions , margins of graph var margin = {top: 20, right: 20, bottom: 30, left: 50}, width = 960 - margin.left - margin.right, height =