Posts

sql - Display employee name,total salary of each employee(total salary=salary+commission) -

display employee name, total salary of each employee. conditions: if commission not null total salary=(salary + commission) else total salary = salary ; here table: table name: myemp columns: empno [primary key], name, salary, commission, deptno create table myemp ( empno number primary key, name varchar2(20), salary number, commission number, deptno number ); query: select name, salary, commission, (salary + ((salary*commission) / 100)) "total_salary" myemp; this query give incorrect result. when commission null , total_salary = 0 . should total_salay=salary ; how fix this? my table below: sql> select * emp; empno ename job mgr hiredate sal comm deptno 7369 smith clerk 7902 17-dec-80 800 20 7499 allen salesman 7698 20-feb-81 1600 300 30 7521 ward salesman 7698 22-...

NoSuchBeanDefinitionException : 'o.s.b.a.MessageSourceAutoConfiguration' is defined when started spring boot -

i have application consisting of 2 modules: 1/logic: spring-core, spring-data-neo4j 2/presentation: spring-boot the declartion of spring beans in first module done through xml file. file imported file context of second module. below setup: @configuration @propertysource("classpath:application.properties") @componentscan @enableautoconfiguration @importresource(value = "application-context-presentation-all.xml") public class application { public static void main(string[] args) { springapplication.run(application.class, args); } } application-context-presentation-all.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.spri...

python - matplotlib changing barplot xtick labels and sorting the order of bars -

Image
i have dataset i'm trying plot, how plot it: in range(0,5): plt.subplot2grid((1,5),(0,i)) df.survived[df.sibsp == i].value_counts().plot(kind='bar') title(str(i)) the values in x (survived) 0 or 1 , i'm plotting value count of them. i'm trying change xsticks "survived"\"not survived", how can it? and i'm trying sort xsticks @ graphs @ same way (as can see in pic default sort according ycount, causing x's 0-1 @ first graph , 1-0 @ second graph) i not sure how data looks like, assume 1 means survived , 0 means dead, , there no other values other 0 , 1. if so, need few small changes: for in range(0,5): plt.subplot2grid((1,5),(0,i)) ax=df.survived[df.sibsp == i].value_counts().ix[[0,1]].plot(kind='bar') ax.set_xticklabels(['alive', 'dead']) title(str(i)) and should ready go.

Unexpected JavaScript infinite loop when checking for body tag -

i going asap script checks if body tag loaded, causes whole page freeze. here is: while (!document.body) if (document.body) console.log('loaded'); this of course wouldn't work in cases, i'm puzzled why becomes infinite loop , freezes page. javascript single-threaded. while loop running, nothing else runs, body can't loaded. there's nothing in body of loop changes value of document.body , if it's not set when start, never be.

php - How to protect an url video streaming using flumotion? -

this scenario: have localhost website logged in users can visit. stored on mysql database. server side running php. inside website have video player plays video localhost flumotion video streaming server. i want protect video streaming url in order registered users can access it. if copy video url, won't able play outside website. how can it? edit: mean "video url" url this: 192.168.1.221/myvideo.mp4 (my flumotion video streaming running on localhost) url html5 video player get. , want protect copy , paste in browser tab. because if it, can play without need website. you check if user logged in, checking if session set depending on how login system works. function is_logged_in(){ if (!isset($_session['you_session_name']))//user not logged in.. return false; return true; } then in video page check if user logged in, , if it's not redirect him on page: if (!is_logged_in()) header("location: http://redirectsite.com/p...

stl - Inserting values into a global C++ set from a recursion -

first time questioner. realized morning knew how perform task of interest simple recursive call. trouble global set not changed of calls s.insert(n) put in. expect there straightforward way rewrite fill set numbers found. so, question is, how that? here function wrote it, fragment calls later, , relevant part of output. entirely happy lines cerr command, matter of getting values (first , third in each line) stl set. first guess on how part not enough. .............................................................. void insert_primitive_reps(unsigned int a, unsigned int h, unsigned int b, unsigned int m, set<unsigned int> s) { cerr << setw(12) << << setw(12) << h << setw(12) << b << " insert_primitive_reps" << endl; if ( <= m ) { s.insert(a); if ( b <= m ) { s.insert(b); if ( <= m - b && h <= m - - b) { if( <= m - - h ) insert_primitive_reps...

html - Javascript in separate file not working -

i'm starting out in javascript, , i'm trying put scripts in separate file. work fine when they're in html file, move them own separate file stops working. here's html file: <!doctype html> <head> <meta lang = "en"> <link rel="stylesheet" type="text/css" href="css/mainstyle.css"> <script src="js/script1.js"></script> <title>web dev practice</title> </head> <body> <h1>first javascript example</h1> <button type="button" onclick="changetext()">clickme!</button> <p id="demo">this test.</p> </br> </br> <h1>second javascript example</h1> <img id="lightbulb" onclick="changeimage()" src="res/img/pic_bulboff.gif" width="100" height="180"> ...