Posts

Showing posts from July, 2011

C++ auto-generated copy constructors with const and non-const refs -

consider following code snippet: #include <iostream> struct foo { foo() = default; foo(foo &) { std::cout << "foo(foo &)" << std::endl; } }; struct bar { foo m; }; int main() { bar b; bar b2(b); } if code run, foo(foo &) message written. ok, foo doesn't have foo(const foo &) constructor, base(base &) constructor generated base . now, if add following definition of foo : foo(const foo &) { std::cout << "foo(const foo &)" << std::endl; } the foo(const foo &) message written. ok, foo has copy-constructor const ref parameter, base(const base &) generated compiler. but, if declare foo(const foo &) explicitly deleted: foo(const foo&) = delete; then program won't compile following errors: prog.cc: in function 'int main()': prog.cc:15:13: error: use of deleted function 'bar::bar(const bar&)' bar b2(b); ...

jekyll: combine limit and where and reverse -

using jekyll i'd to: iterate through pages where page.path not current path where page.categories contains "featured" reverse them(most recent first) limit 3 i'm having problems when getting filters together {% assign posts = site.posts | reverse %} {% post in posts limit:3 %} {% if post.categories contains 'featured' , post.path != page.path %} {% include card.html post=post %} {% endif %} {% endfor %} right limit not working because inner if prevent few items being rendered. assign 0 counter variable before entering loop. don't set limit on loop, instead set condition on counter being below limit, , increment counter using liquid's plus filter every time meet criteria , output card. {% assign posts = site.posts | reverse %} {% assign counter = 0 %} {% post in posts %} {% if counter < 3 , post.categories contains 'featured' , post.path != page.path %} {% include card.html post=post %} {% ...

c - understanding asm blocks written for gcc -

what following assembly mean in simple c (this meant compiled gcc): asm volatile ( "mov.d %0,%4\n\t" "l1: bge %2,%3,l2\n\t" "gslqc1 $f2,$f0,0(%1)\n\t" "gslqc1 $f6,$f4,0(%5)\n\t" "madd.d %0,%0,$f6,$f2\n\t" "madd.d %0,%0,$f4,$f0\n\t" "add %1,%1,16\n\t" "add %2,%2,2\n\t" "add %5,%5,16\n\t" "j l1\n\t" "l2: nop\n\t" :"=f"(sham) :"r"(foo),"r"(bar),"r"(ro),"f"(sham),"r"(bo) :"$f0","$f2","$f4","$f6" ); after several hours of searching , reading i've come following assembly code in at&t syntax: mov.d %xmm0,%xmm1 l1: bge %ebx,%ecx,l2 gslqc1 $f2,$f0,0(%eax) gslqc1 $f6,$f4,0(%esi) madd.d %xmm0,%xmm0,$f6,$f2 madd.d %xmm0,%xmm0,$f4,$f0 add %eax,%eax,16 add %ebx,%ebx,2 add %esi,%esi,16 jmp l1 l2: nop i'm in...

javascript - struggling with normalisation using map and reduce -

i want radar chart have no control api output, have turn complicated data form. i'm stuck @ least half hour. how can turn raw data const raw = [{ "device_info": { "device_id": 123, "name": "iphone", }, "age_data": [{ "age_range": "0-10", "total_count": 15, "man": 6, "women": 9 }, { "age_range": "11-20", "total_count": 11, "man": 7, "women": 4 }] }, { "device_info": { "device_id": 456, "name": "android", }, "age_data": [{ "age_range": "0-10", "total_count": 1, "man": 1, "women": 0 }, { "age_range": "11-20", "total_count": 2, "man": 0, "women": 2 }] }] into this const data = [{ ...

redux - What is a network callback? -

i reading redux docs , came across passage "this ensures neither views nor network callbacks ever write directly state" http://redux.js.org/docs/introduction/threeprinciples.html i know callback function passed function, network callback? success function in jquery ajax request?

timeline.js - How to replace all items in a vis.js timeline -

i built timeline using vis.js. have ajax call returns dataset can populate timeline. how can use javascript replace items in original vis.js timeline dataset return ajax call. full replacement of items. i'm okay redraw of timeline. example appreciated.

html - PHP doesn't connect with MySQL -

this code supposed information simple html form , post in mysql database: <html> <head> <title>cadastro de cinema</title> <head> <body> <?php $host = "localhost"; $user = "root"; $pass = ""; $banco = "cinema"; $con = @mysqli_connect($host, $user, $pass, $db) or die(mysql_error()); ?> <?php $email= isset($_post['email']) ? $_post['email'] : ''; $senha= isset($_post['senha']) ? $_post['senha'] : ''; $nome= isset($_post['nome']) ? $_post['nome'] : ''; $rua= isset($_post['rua']) ? $_post['rua'] : ''; $bairro= isset($_post['bairro']) ? $_post['bairro'] : ''; $numero= isset($_post['numero']) ? $_post['numero'] : ''; $cidade= isset($_post['cidade']) ? $_post['cidade'] : ''; $sql = mysqli_query($con, ...

Regex to match exact substring java -

i have string below testfilter('value') , loadtestfilter('value1') , userfilter(value2) or testfilter('value3') i want extract testfilter along brackets above string. want regex match these 2 substrings testfilter('value') testfilter('value3') i have tried below regex .*testfilter\\((.*?)\\).* it working matching loadtestfilter in string how match testfilter. try this: testfilter\\((.*?)\\).* without first (.*)

php - Laravel redirects all resources to the home -

in laravel 5.4 application have resource , controller. when enter url of resource action (like index) instead of getting controller function result(json), redirected /home : (i have logged in , redirected user's /home ) my controller: class dreamcontroller extends controller { public function __construct() { $this->middleware('auth:api'); } public function index(request $request) { $dreams = $request->user()->dreams()->orderby('created_at', 'desc'); return response()->json(['dreams' => $dreams]); } } my route api.php: route::middleware('auth:api')->get('/user', function (request $request) { return $request->user(); }); route::resource('dreams', 'dreamcontroller'); my web.php route: route::get('/', function () { return view('welcome'); }); route::resource('dreams', 'dreamcontroller'); auth::routes(); route::get('/home', ...

c++ - opengles 3.0 draw disconnected line when i use GL_LINE_STRIP -

i use opengles 2.0 draw oscilloscope wave 500 sample per second when use gl_line_strip line draws disconnected if samples in straight line have noise. don't know problem if set threshold , set new samples bellow problem solve!!! if(new_sample<threshold) new_sample=previous_sample does 1 knows cause , solution! because using threshold produce invalid wave in manner? i searched , find problem related diamond exit rule , may related board , gpu driver. don't know can fixed programmatically?

ios - how to set a background image inside the UILabel inside a UITableViewCell -

Image
i'm working on project in swift 3 i've set background image inside uilabel inside uitableviewcell. image consist of gradient color has fade away effect on edges. once set in code reason gradient color seems appear on 1 side of label(left side). perhaps not been adjusted fit in uilabel.how can set image fits label size properly, appreciate. code bellow.what missing func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { switch indexpath.row { case 0: let cell = tableview.dequeuereusablecell(withidentifier: "featuredcell", for: indexpath) cell.bounds = cgrect(x: 0, y: 0, width: uiscreen.main.bounds.width, height: cell.bounds.height) return cell case (1...3): let text = self.categoryselectiontitles[indexpath.row - 2] let cell = tableview.dequeuereusablecell(withidentifier: "audiocell",for: indexpath) let labe = cell.viewwithtag(table_cell_tags.heade...

If Extract >= 600 then do this in imacro Error -

i writing macro code should work this: open link provided - no errors extract specified text - no errors remove unnecessary text, leaving number extract - no errors store number extract in variable "ff" - no errors make windows prompt , show number extracted - no errors text or check if extracted number greater or equal 600 - not working, see errors below make windows prompt , "greater 600" if condition met, if false "lower 600" - not working also anyone point out , correct codes? i'm sorry , thank help. tab t=1 set !extract_test_popup no url goto=https://www.instagram.com/user/ tag pos=1 type=a attr=href:/user/following/ extract=txt 'removes unnecessary text set ff eval("var s=\"{{!extract}}\"; s.replace(\"following\", \"\");") prompt {{ff}} set !var1 eval("var ff="{{!extract}}\"; if(ff==663) alert("greater 600"); else alert("lower 600");") er...

jdbc - My H2 database is showing "No suitable driver found for 08001/0" -

enter image description here enter image description here h2 database not showing saved setting . should ? it showing error no suitable driver found 08001/0 when starting h2 database showing nothing in saved setting nor in text area , , when clicking on connect showing error 'no suitable driver found 08001/0'

oracle - SQL exceptions don't appear to be working -

this question has answer here: delete statement not deleting records 1 answer anyone know why exceptions aren't working? when test sql exception appears when others. this first stored procedure, want insert new students using parameter values. create or replace procedure add_student_to_db (pstuid number, pstuname varchar2) out_of_range exception; begin if pstuid <=1 , pstuid >=499 raise out_of_range; end if; insert student (stuid, stuname) values (pstuid, pstuname); exception when dup_val_on_index dbms_output.put_line('-20010. duplicate student id'); when out_of_range dbms_output.put_line('-20002. student id out of range'); when others dbms_output.put_line('-20000. error'); end; this second stored procedure, want call first sp. create or replace procedure add_student_viasqldev (pstuid number, pstu...

python - Forcing a list out of a generator -

>>>def change(x): ... x.append(len(x)) ... return x >>>a=[] >>>b=(change(a) in range(3)) >>>next(b) [0] >>>next(b) [0,1] >>>next(b) [0,1,2] >>>next(b) traceback ... stopiteration >>>a=[] >>>b=(change(a) in range(3)) >>>list(b) #expecting [[0],[0,1],[0,1,2]] [[0,1,2],[0,1,2],[0,1,2]] so testing understanding of generators , messing around command prompt , i'm unsure if understand how generators work. the problem calls change(a) return the same object (in case, object value of a ), object mutable , changes value. example of same problem without using generators: a = [] b = [] in range(3): a.append(len(a)) b.append(a) print b if want avoid it, need make copy of object (for example, make change return x[:] instead of x ).

How to sort MonthName (varchar) in SQL Server? -

i got stuck while sorting month name in order in below query. here period alias user can choose if wants see result in daily, weekly, monthly or yearly. sorting working rest of cases except month. taking month string , if try convert month giving exception. please have , guide me. it begin return like: april august december desired output: january february march april december code: declare @period char = 'm' declare @finaldateid int = 20170101; select period, sum(cast(totalamount bigint)) value (select case when @period = 'd' cast(d.datename varchar(50)) when @period = 'w' cast(d.weekofyear varchar(50)) when @period = 'm' cast(d.monthname varchar(50)) when @period = 'y' cast(d.calendaryear varchar(50)) end period, tr.totalamount revenue tr ...

javascript - How to setState on specific item in array? -

in app, fetch data api , put in state of component. this.state = { contributors: [], } componentdidmount() { axios.get(data) .then(res => this.setstate({contributors: res}) } this.state.contributors array of objects. each 1 of objects has 3 properties values 3 api calls. 0: { "name": "thiscontributor", "followers_url": "https://api.github.com/users/thiscontributor/followers", "gists_url": "https://api.github.com/users/thiscontributor/gists", "repos_url": "https://api.github.com/users/thiscontributor/repos", } now need iterate over, 100 contributors (or of them makes load time long) , update each contributor length of response. thinking add properties holding these lengths: 0: { "name": "thiscontributor", "followers_url": "https://api.github.com/users/thiscontributor/followers", "gists_url...

How to call the method in Fragment from the Activity in android? -

i working on fragment concept here.here issue facing here need call call method in screen.java after giving run time permission in homescreen.java class have been trying cant right solution provide me proper solution this. public class homescreen extends draweractivity { public static final int multiple_permissions = 10; // code want. string[] permissions = new string[] { manifest.permission.access_coarse_location, manifest.permission.access_fine_location }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.e("passing in home", "passing in home"); checkpermission(home.this); ctx = this; } private boolean checkpermission(activity act) { int result; list<string> listpermissionsneeded = new arraylist<>(); (string p : permissions) { result = contextcompat.checkselfpermission(act, p); if (result != packagemanager.permission_granted)...

PHP CURL call is displaying NULL all the time -

Image
this question has been asked. of didn't work out me. getting null when curl call made time. the following list_clients.php file. <?php require_once 'init.php'; header('content-type: application/json'); $clientresults = mysqli_query($link, "select * clients"); $clients = array(); while($client = mysqli_fetch_assoc($clientresults)){ $clients[] = $client; } echo json_encode($clients); exit; so output of above : [{"ip_address":"192.168.177.137","mac_address":"3a:1a:cf:7c:92:89","added_on":"2017-08-19 12:48:34"},{"ip_address":"192.168.177.137","mac_address":"3a:1a:cf:7c:92:89","added_on":"2017-08-20 08:09:29"}] the following curl_call.php file <?php $url = 'http://127.0.0.1/testing/list_clients.php'; $curl = curl_init(); curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_returnt...

javascript - why cant my html code send a request to my servlet through XMLHttpRequest! i am using the Get method and i think i have used the correct servlet url -

i not able send request jasonresult servlet.. pls me have gone wrong. have tried on both eclipse , chrome environment. here trying build dynamic chart of chart.js. needs jason file update chart.. servlet not getting request call ajax in html form. <html> <head> <title>refresh</title> <link rel="stylesheet" href="testcss.css"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.6.0/chart.js"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.6.0/chart.min.js"> </script> </head> <body> <div class="container"> <input type="date" id="startdate"></input> <button name="button" id="button" onclick="reload()";>reload</button> <canvas id="mychart" width="700...

ios - When pulling images from a Firebase storage the images don’t load until I interact with the tableView by scrolling... SWIFT 3 -

i’m running problems twitter/instagram news feed… when pulling images firebase storage images don’t load until interact tableview scrolling... more scroll, more can appear. randomly displays wrong post image until scroll more , images load , settle in correct places. it doesn’t make sense… logic correct , using cachedimages when loading image urls database. i’ve watched lot video tutorials , use similar approaches i’ve used none of them have buggy problems ike do. any ideas on problem might be? code: var imagecache = [string: uiimage]() var lasturlusedtoloadimage: string? // loading user image urls extension uiimageview { func loadimage(urlstring: string) { lasturlusedtoloadimage = urlstring if let cachedimage = imagecache[urlstring] { self.image = cachedimage return } guard let url = url(string: urlstring) else { return } urlsessi...

java - Handling FragmentTransaction - addToBackStack() -

Image
i working on app has activity , fragment structure shown below: i couldn't implement fragmenttransaction in such way when press button in phone can go previous fragments. so, series begins in subfragment1 , ends in secondactivity: subfragment1 -> subfragment2 -> subfragment3 -> secondactivity handling framgnettransaction stuff inside fragmentb : //this part inside oncreateview of fragmentb fragmenttransaction fragmenttransaction = getchildfragmentmanager().begintransaction(); fragmenttransaction.add(r.id.container, subfragment1(), fragment_sub1); fragmenttransaction.addtobackstack("first"); fragmenttransaction.commit(); } public void gotosubfragment2(){ fragmenttransaction fragmenttransaction = getchildfragmentmanager().begintransaction(); fragmenttransaction.replace(r.id.container, subfragment2(), fragment_sub2); fragmenttransaction.addtobackstack("second"); fragmenttransaction.commit(); } public void gotosubfragment3(){...

Shared Element Transition Android -

android shared element button transition cause whole screen background color button background color, shown in gif while after removing button background transition works fine, shown in gif am using button theme style <style name="defaultbutton" parent="widget.appcompat.button.colored"> <item name="android:textcolor">@color/colorprimarytext</item> <item name="colorbuttonnormal">@color/colorprimary</item> </style> and button code <button android:id="@+id/btnlogin" android:layout_width="0dp" android:layout_height="66dp" android:layout_marginend="60dp" android:layout_marginleft="60dp" android:layout_marginright="60dp" android:layout_marginstart="60dp" android:layout_margintop="55dp" android:text="sign in" android:textsiz...

php - My $_GET value is not getting stored in $_SESSION array -

i have script works cart-mechanism. want store $_get value in $_session array made , stores once. other indexes not getting added. here code: <?php session_start(); require_once 'db_connect.php'; $_session['product_name']=array (); array_push($_session['product_name'],$_get["p_name"]); ?> you unset $_session['product_name'] every time line: $_session['product_name']=array (); change below: if(!isset($_session['product_name']) $_session['product_name']=array ();

c++ - GCC 7.2 standard library possible constexpr bug in std::distance using the constexpr overload -

the function declared constexpr , std::distance has constexpr overload. when compile gcc7.2 error don't understand. it seems me there bug in constexpr std::distance . error says calls std::__iterator_category(__first)); not constexpr . live example here code , error #include <iostream> #include <algorithm> #include <iterator> #include <stdexcept> #include <array> #include <string> #include <cassert> template<typename it> constexpr auto max (it first, last) { auto count = std::distance(first, last); if (count == 0) throw std::domain_error{"max undefined on empty range"}; if (count == 1) return *first; auto mid = first + (last - first) / 2; return std::max(max(first, mid), max(mid, last)); } int main() { constexpr std::array<int, 4> vs{1,6,8,3}; constexpr auto max_of_vs = max(std::cbegin(vs), std::cend(vs)); assert(max_of_vs == 8); std::cout << max_of_vs << std::endl; ...

liquid - Jekyll - Can't reverse sort by date -

i'm trying sort 3 recent, 'featured' posts on blog, loop have won't let me sort collection show recent posts first. what have below outputs 3 recent posts on blog, ignores where_exp , displays both featured , non-featured posts. if remove 'reverse' filter after sort date sort featured posts, sorts them oldest newest. i've tried reassigning featured-posts variable sort reverse-date again before loop doesn't work. everything i've tried far won't let me display 3 recent, featured posts in site, i'm hoping can tell me i'm going wrong.. post front matter: --- post_date: 2017-08-14 00:00:00 featured: true --- page for-loop: {% assign sorted-posts = site.posts | sort: 'post_date' | reverse %} {% assign featured-posts = sorted-posts | where_exp:"post","post.featured" %} {% post in featured-posts limit:3 %} <h2><a href="{{ post.url }}">{{ post.title | truncate: 58 }}</a>...

wordpress - Changes to page.php and single.php not applying -

i'm having quite weird issue wordpress site. building theme scratch , i'm trying make change containers on blog page (page.php , single.php). weirdly enough, have made no major changes code other add wrapper, changes aren't showing up. i've made many themes without issue i'm unsure what's going wrong time. have set blog page posts page in settings can't understand why template won't update. code have below, , standard wordpress code exception of 'grid wrapper' , attempting remove sidebar shows. i have done quite bit of research on see problem be, sadly post similar in 2014 no answer. <div class="container main-content"> <div class="grid wrapper"> <section class="the-content"> <main> <h1><?php the_title(); ?></h1> <?php while ( have_posts() ): the_post(); ?> <?php...

c# - How to make POST with parameters> -

i try make simple post request webapi: http://localhost::60310/locations/15 full request are: https://imgur.com/a/fgguj my controller: [produces("application/json")] [route("/locations")] public class locationscontroller : controller { [httppost("{id}")] public async task<iactionresult> putlocation() { var distance= request.form.firstordefault(p => p.key == "distance").value; var city = request.form.firstordefault(p => p.key == "city").value; var place= request.form.firstordefault(p => p.key == "place").value; var county= request.form.firstordefault(p => p.key == "country").value; var id = request.form.firstordefault(p => p.key == "id").value; //some code } } so, have data class: public class location { [jsonproperty("distance")] public int distance { get; set; } [jsonproperty("...

python - theano check if tensor is None -

what want create model in theano check , see if theano tensor none or not ( in situation theano tensor in fact shared variable, i'm looking general way not shared variable). after looking theano condition tutorial , didn't found out how can it. appreciated.

Interpreting as unsigned 32 bit integer with PHP -

i trying make little php tool world of tanks read battle replays. can see there each replay consists of , there example. unfortunately don't understand part of wiki article: read 4 bytes, , interpret these unsigned 32 bit integer, let "block count" i tried convert java code php, outputs "0" time. tried code found @ php.net/manual/en/language.types.integer.php#38478 outputs "0" too. here current code: function parse($string) { $x = (float)$string; if ($x > (float)2147483647) $x -= (float)"4294967296"; return (int)$x; } $replay = file_get_contents('steppes.txt'); $magic = substr($replay, 0, 4); $count = substr($replay, 4, 4); echo $magic." -- ".parse($magic)."<br>".$count." -- ".parse($count); you can use php-function unpack convert binary data. in case should use code v for unsigned long (always 32 bit, little endian byte order) (long name used 32bit int...

java - Unexpected Behaviour with and w/o Volatile Keyword -

public class threadvolatileperfectexample2 { public static boolean stop = false; // not volatile public static void main(string args[]) throws interruptedexception { thread testthread = new thread(){ @override public void run(){ int = 1; while(!stop){ i++; } system.out.println("thread stop i="+ i); } }; testthread.start(); thread.sleep(1); stop = true; system.out.println("now, in main thread stop is: " + stop); testthread.join(); } } marking stop volatile or not not affecting output, affecting if have increased sleep time. marking stop volatile or not not affecting output, affecting if have increased sleep time. not using volatile doesn't mean threads sharing same variable have not updated value. the idea according case, may , prevent having not updated varia...

Can I mix MySQL APIs in PHP? -

i have searched net , far have seen can use mysql_ , mysqli_ meaning: <?php $con=mysqli_connect("localhost", "root" ,"" ,"mysql"); if( mysqli_connect_errno( $con ) ) { echo "failed connect"; }else{ echo "connected"; } mysql_close($con); echo "done"; ?> or <?php $con=mysql_connect("localhost", "root" ,"" ,"mysql"); if( mysqli_connect_errno( $con ) ) { echo "failed connect"; }else{ echo "connected"; } mysqli_close($con); echo "done"; ?> are valid when use code is: connected warning: mysql_close() expects parameter 1 resource, object given in d:\************.php on line 9 done for first , same except mysqli_close() . second one. what problem? can't use mysql_ , mysqli together? or normal? way can check if connections valid @ all? (the if(mysq...) ) no, can't use mysql , mysqli toget...

android - Realm: Why on Devices/Emulators method RealmChangeListener.onChange() NOT call every times? -

realm 3.5.0 android application. my snippet: public class mainapp extends multidexapplication implements realmchangelistener<realmresults<permissionofferresponse>> { private void loginandconfig() { string authurl = "http://" + buildconfig.object_server_ip + ":" + buildconfig.object_server_port + "/auth"; syncuser.callback callback = new syncuser.callback() { @override public void onsuccess(syncuser user) { syncuser = user; createpermissionofferandsyncwithros(); } @override public void onerror(objectservererror error) { string errormsg; switch (error.geterrorcode()) { case unknown_account: errormsg = "account not exists."; break; case invalid_credentials: errormsg = ...

sql server - Same MDX different return values? -

Image
the below 2 mdx in photos return 2 different values although same , 1 have clarification me understand difference ?

Form Sanitize using filter_var() and html entities() in PHP -

my input must validated using filter_var() , html_entities(). heres code doesn't work: session_start(); if(empty($_post['add']) === false ) { $name = filter_var(input_post, 'name', filter_sanitize_string); $email = filter_var(input_post, 'email', filter_sanitize_email); $phone = filter_var(input_post, 'phone', filter_sanitize_int); $address = filter_var(input_post, 'address', filter_sanitize_string); } ?> when test , put " frost " name input comes out in bold not suppose to. after done needs write out $_session['cart']. im lost @ point from comments far can see: if $_get variable contains array, not posting html form right. use post-ing html <form> : <form action="/path/to/script.php" method="post" enctype="multipart/form-data"> <!-- input fields --> </form> also, peter van der wal said, use filter_input() function ...

How can I recreate composer.json from the content of the vendor directory? -

i have project using composer . however, have lost composer.json . is there way recreate composer.json content of vendor directory? identifying installed dependencies can achieved inspecting vendor └── composer    └── installed.json however, faced following problems: direct , indirect dependencies installed.json lists all installed dependencies, is, both direct and indirect dependencies. direct dependencies dependencies explicitly listed in require , require-dev sections. indirect dependencies dependencies of direct dependencies. that is, while programmatically parse installed.json , collect dependencies listed therein, need decide whether these direct or indirect dependencies, or in other words, whether want explicitly require these dependencies in composer.json . production , development dependencies installed.json lists all installed dependencies, is, depending on whether ran $ composer install or $composer install --no-dev...

forms - PHP Select Option from other select value -

this question has answer here: populate select other select value using jquery 4 answers if select 'man' in first select second select option show man's product database. if select 'woman' in first select second select option show woman's product database. how can set system? <form method="post" action="" > <label>category</label></br> <select name="cat"> <option value="man">man</option> <option value="woman">woman</option> </select></br></br> <label>product</label></br> <select name="product"> <option value="">select product</option> </se...

javascript - how do I make an invisible table with 1 column at the left and 2 columns at the right using html, css or js? -

#right div needs in right column , height must same sum of #leftbottom 's height , #lefttop 's height (left column). the following html example: #right { background-color: orange; width: 45%; margin: 10px; border-color: darkorange; border-style: solid; border-width: thin; } #leftbottom, #lefttop { background-image: url(images/backgrnd2.png); background-repeat: no-repeat; background-position: center; background-size: 102% 100%; width: 40%; margin: 10px; } <div class="body"> <div id="right"> <a>home</a> <p>featured theory of day:</p> <p>area 51<br/>why government hide truth behind these?</p> <a>continue reading>>></a> <p>is true?</p> <p>the hollow earth, agharta<br/>know more center of earth , inside of it?</p> <a>continue reading>>></a> ...

r - How to assign colors to categorical variables in ggplot2 that have stable mapping? -

Image
i've been getting speed r in last month , first post here. looking forward joining community. here question: what way assign colors categorical variables in ggplot2 have stable mapping? need consistent colors across set of graphs have different subsets , different number of categorical variables. for example, plot1 <- ggplot(data, aes(xdata, ydata,color=categoricalddata)) + geom_line() where categoricaldata has 5 levels. and then plot2 <- ggplot(data.subset, aes(xdata.subset, ydata.subset, color=categoricalddata.subset)) + geom_line() where categoricaldata.subset has 3 levels. however, particular level in both sets end different color, makes harder read graphs together. do need create vector of colors in data frame? or there way assigns specific colors categories? thanks for simple situations exact example in op, agree thierry's answer best. however, think it's useful point out approach becomes easie...

windows - xampp apache not starting due to dll file -

i have installed xampp , have running sql aapche showing error of api-ms-win-core-file-l1-2-0.dll missing or not designed run on windows? i have installed dll on windows still shows same problem. have tried disabling world wide web publishing services file missing in local services.

javascript - Node JS wrapper to mac os (.pkg, .app) -

i want wrap nodejs app mac osx -> .pkg or .app file. whats best way it? tutorial / tools appreciated. thanks asaf use node pkg module. you'll able create executables mac, windows , linux.

c# - How to find multiple lines without specific number -

i have these lines: mystring 33 mystring 10 mystring 3 mystring 5 i want match on lines doesn't have specific number: 3. therefore, need match on these numbers: mystring 33 mystring 10 mystring 5 but not on: mystring 3 this tried: mystring ^(?!3) mystring ^(3) mystring (^?!3) mystring (^3) but none of them worked. don't have experience regex. used website guide: https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/ i read similar questions: exclude numbers range of numbers using regular expression exclude set of specific numbers in "\d+" regular expression pattern but still didn't understand how it. you can use regex mystring (?!3\b)\d+ see regex demo negative lookahead (?!3\b) assert rege...

r - ggplot2: Recreating A plot of shrinkage from a book -

Image
i trying recreate following plot computer age statistical inference. i have following data player,mle,truth,js 1,0.345,0.298,0.2848934967658405 2,0.333,0.346,0.2807859008379247 3,0.322,0.222,0.2770206045706685 4,0.311,0.276,0.2732553083034123 5,0.289,0.263,0.26572471576889994 6,0.289,0.273,0.26572471576889994 7,0.278,0.303,0.26195941950164375 8,0.255,0.27,0.25408652730647174 9,0.244,0.23,0.25032123103921555 10,0.233,0.264,0.2465559347719594 11,0.233,0.264,0.2465559347719594 12,0.222,0.21,0.2427906385047032 13,0.222,0.256,0.2427906385047032 14,0.222,0.269,0.2427906385047032 15,0.211,0.316,0.239025342237447 16,0.211,0.226,0.239025342237447 17,0.2,0.285,0.23526004597019082 18,0.145,0.2,0.2164335646339099 i gave try, seems points not connected lines correctly. here code js_player %>% gather(type,value,2:4) %>% ggplot(aes(x=value,y=type))+ geom_point()+ geom_line(aes(group=player),lty=2, alpha=1/4)+ theme_minimal() from ?geom_line : geom_lin...

how to provide --from-file parameter via jenkins openshift build plugin -

i want convert below openshift command run jenkins pipeline openshift build plugin. oc start-build ${appname}-docker --from-file=microservicesdemoapp/target/myapp.jar -n ${project} the problem can't find how provide --from-file parameter via plugin. it passed individual quoted argument similar below: openshift.startbuild("${applicationname}", "--from-dir=.", "--wait=true", "-n ${projectname}")

swift - How to stop animating GIF in SDWebImage? -

i'm using sdwebimage fetch images web , display them. gifs, how stop gif? assuming using >= v4.0; docs: starting 4.0 version, rely on flanimatedimage take care of our animated images. from flanimatedimage 's docs; there 2 ways control playback: // flanimatedimageview can take flanimatedimage , plays automatically when in view hierarchy , stops when removed . // animation can controlled uiimageview methods - start / stop / isanimating .

c++ - How much time it takes for a thread waiting with pthread_cond_wait to wake after being signaled? how can I estimate this time? -

i'm writing c++ threadpool implantation , using pthread_cond_wait in worker's main function. wondering how time pass signaling condition variable until thread/threads waiting on wake up. have idea of how can estimate/calculate time? thank much. it depends, on cost of context switch on os, the cpu is thread or different process the load of machine is switch same core last ran on what working set size time since last ran linux best case, i7, 1100ns, thread in same process, same core ran in last, ran last thread, no load, working set 1 byte. bad case, flushed cache, different core, different process, expect 30µs of cpu overhead. where cost go: save last process context 70-400 cycles, load new context 100-400 cycles if different process, flush tlb, reload 3 5 page walks, potentially memory taking ~300 cycles each. plus few page walks if more 1 page touched, including instructions , data. os overhead, nice statistics, example add 1 context switch...

View multiple Point Clouds in same window using PCL in C++ -

i have 2 point cloud, want visualise in same window. #include <pcl/io/io.h> #include <pcl/io/pcd_io.h> #include <pcl/visualization/cloud_viewer.h> int main () { pcl::visualization::cloudviewer viewer("cloud viewer"); pcl::pointcloud<pcl::pointxyzrgba>::ptr body (new pcl::pointcloud<pcl::pointxyzrgba>); pcl::io::loadpcdfile ("body.pcd", *body); pcl::pointcloud<pcl::pointxyzrgba>::ptr head (new pcl::pointcloud<pcl::pointxyzrgba>); pcl::io::loadpcdfile ("head.pcd", *head); viewer.showcloud (body); viewer.showcloud (head); while (!viewer.wasstopped ()) { } return 0; } i can see last pcd file. please note don't want use pcd_viewer tool since need other processing on data. regarding comment "okay. check soon. can tell me set camera parameters , background color using cloud_viewer api?" i not 100% sure if can using pcl::visualization::clo...

sql - Can correlated subquery following is not null check be replaced with joins? -

can correlated subquery, subquery follows not null check on foreign key, replaced joins? example: select * tableabc t (t.label_id null or t.label_id in ( select t1.id labels t1 t1.type = '123')) , (t.tag_id null or t.tag_id in ( select t2.id tags t2 t2.type = '123')) described words: let's say, i'm looking records if have label reference defined label must of type; same apply tags . or query improved other means? it intended tsql (ms sql). update: have added table aliases hinted habo. hope improve readability. i'm not sure improvement, use left outer join instead of correlated subqueries. -- sample data. declare @tableabc table( abcid int identity, labelid int, tagid int ); declare @labels table( labelid int identity, label varchar(3) ); declare @tags table( tagid int identity, tag varchar(3) ); insert @labels ( label ) values ( '123' ), ( '12' ), ( '123' ); insert @tags ( tag ) values ( '123' ), ...