Posts

php - Display html in echo statement -

this question has answer here: how write php ternary operator 8 answers ok below information works im trying figure problem if displays title grade... but want put | inbetween this title | grade. my below code works if there no grade still echos |, how can echo when there value in field. because when field empty shows title | <div class="sto-info"> <span><?php echo $title; ?> <?php echo '|', $grade; ?></span> </div> you can use ternary operator: <span><?php echo $title; ?> <?php echo $grade ? '|' . $grade : ''; ?></span>

lua - Cannot connect to MQTT broker from ESP8266 -

i have installed mosquitto on windows machine , it's mqtt v3.1 broker (downloaded mosquitto.org). i trying connect broker esp8266 , far have not been able connect broker. can connect public broker, not broker installed on machine connected same wifi network. i have built firmware using build-nodemcu service , used master branch. think has mqtt v3.1.1. i came across question , guess have ran same situation. though cause of issue has been given, how rid of problem has not been mentioned there. can please suggest how rid of problem? update [13-09-2016] here code using: sensorid = "sen_001" tgthost = "192.168.8.101" tgtport = "1883" mqttuserid = "admin" mqttpass = "word" mqtttimeout = 120 topicqueue = "/security" wifi_ssid = "lakmal 4g" wifi_password = "tf18bny3m" wifi_signal_mode = wifi.phymode_n esp8266_ip="" esp8266_netmask="" esp8266_gateway="" if wifi....

Inverse function in R -

so have function: f(a,b,rho)=r . given a , b , r , find rho . came across inverse function in r, seems when function tries find rho , function cannot tell of a , b or rho specified rho , function cannot load given a , b . in addition, know rho between 0 , 1. a = -.7 b = 2 r <- function(rho,a,b){ # here defined long function of r # in terms of , b , rho } r_inverse=inverse(function(rho) r(rho,-.7,2),0,1) # r_value random value r_inverse(r_value) this not work. appreciate inverse function or other alternative way find rho given r , a , b .

javascript - JQuery/JS onclick change class of element inside link clicked -

i have couple of drop downs using bootstrap , want code in simple function change class of span element inside link clicked. to clarify... here's example of html have: <a data-toggle="collapse" href="#collapse-panel" aria-expanded="false" onclick="toggleicon()"> <span class="glyphicon glyphicon-knight"></span> drop down title <span class="glyphicon glyphicon-triangle-bottom"></span> </a> <div class="collapse" id="collapse-panel"> <!-- content --> </div> i looking function (using js or jquery ) can toggle second span class change between glyphicon glyphicon-triangle-bottom , glyphicon glyphicon-triangle-top . bear in mind, function has work multiple drop-downs. appreciated. $('a[data-toggle="collapse"]').click(function(){ $(this).find('.glyphicon-triangle-bottom, .glyphicon-triangle-to...

linux - How can I "delay" in Zsh with a float-point number? -

in zsh there wait (for process or job) command, while (seconds == delay) command, , sched (do later if shell still running) command, no "delay" command. if there were, fear limited whole second delays. need "delay" statement can cause procedure/task nothing time specified in fixed point number or until clock time. most scripts use "sleep", have delay timer run without having open io; seeking ideal can accomplished within zsh. does know how perhaps make function (or maybe builtin/module) perform floating point idle delay in seconds? i'll argue making wrong assumption. zsh shell, , therefore purpose shell. 1 important point in being shell posix compatible shell. since zsh backward compatible bash , in turn backward compatible bourne shell should poisx shell. that means zsh must have access sleep since sleep required posix shell . and far go posix compatibility argument. practical use argument. systems use gnu coreutils...

sql - oracle self outer join filtering records -

select a.emp_id a_emp_id, a.emp_code a_emp_code, b.emp_id b_emp_id, b.emp_code b_emp_code, c.emp_id c_emp_id, c.emp_code c_emp_code, emp left outer join emp b on a.u_code =b.u_code left outer join emp c on a.u_code =c.u_code a.src ='a' , b.src ='b' , c.src ='c' for 1 employee have data different sources , id different systems. there more 5 different source system data coming table. u_code remain same in sources. emp having each row each system. now, need build cross walk table in 1 row can give source system id single employee. above query working fine if employee having data in 3 systems filtering out data if present in 2 systems. table data empid,emp_code,src,u_code 1,abc,a,101 2,pqr,b,101 3,xyz,c,101 4,kpo,a,102 5,lip,b,102 query should return a_emp_id,a_emp_code,b_emp_id,b_emp_code,c_emp_id,c_emp_code 1,abc,2,pqr,3,xyz,101 4,kpo,5,lip,,,102 query working fine 101 u_code not returing 102 database oracle 10g when have o...

sql server - Can the ROOT element in a select statement using FOR XML PATH be set using a variable? -

i have query creates xml file. currently, have root element hard-coded. use variable value set root element value substituting hard-coded string variable throws syntax error of expecting string . select statement: declare @selectresults xml declare @databasename varchar(100) select @databasename = db_name(); set @selectresults = ( select...query results here... xml path(''), root(@databasename) --when set 'databasename' works ) can use variable in function root() ? you replacement in separate replace acting on xml output: declare @selectresults xml declare @databasename varchar(100) select @databasename = db_name(); set @selectresults = replace( select...query results here... xml path(''), root('root_element') --when set 'databasename' works ), 'root_element>',@databasename+'>' )