Posts

javascript - Using conditionals inside template literals -

i know more elegant way define string variables included, if want add conditional in pre es6 do.. var = "text"+(conditional?a:b)+" more text" now template literals do.. let a; if(conditional) = `test${a} more text`; else = `test${b} more text`; is there more elegant way implement conditional? possible include if shortcut? use this: let = `test${conditional ? : b} more text`;

c# - Why is the FilterConfig class not static? -

when create new asp.net mvc project defaults, filterconfig class ( , others ) this; namespace nop.web { public class filterconfig { public static void registerglobalfilters(globalfiltercollection filters) { filters.add(new handleerrorattribute()); } } } and it's usage ( under globalasax > application_start ) protected void application_start() { //... filterconfig.registerglobalfilters(globalfilters.filters); //... so why filterconfig class not static ? should this; public static class filterconfig { public static void registerglobalfilters(globalfiltercollection filters) { filters.add(new handleerrorattribute()); } } because there 1 static method in it, filterconfig should static too. missing something?

ssl - Unable to attach files in Odoo when using HTTPS via nginx -

been having issue , narrowed down, can't find solution. if setup nginx redirect https, works great, ssl connection , all, except when writing messages in odoo, our staff can't attach files. gets stuck on "uploading" (blue bar on file icon). there's no useful output in log, on verbose debug level. as workaround, i've disabled ssl, i'd turn on. suggestions? running odoo v9.0c.

mongodb - Mongo $text search not working on nested object? -

this code var mongoose = require('mongoose'); var schema = mongoose.schema; mongoose.connect('mongodb://localhost/mongo_search_problem'); var test = new schema({ text: { type: string, required: true }, level: { two: { type: string, required: true } } }); test.index({ text: 'text', 'level.two': 'text' }); var model = mongoose.model('tests', test); model.find({ $text: { $search: 'two' } }, function(err, result){ console.log(result); }); this document { "text" : "text", "level" : { "two" : "two" } } it return nothing if search two , if search text instead return document. why won't work on nested object?

css - Language-specific LESS classes which contain @font-faces not working -

i have bilingual site using i18n. i18n attaches classes , tags of site when renders. example, have: <html class="en"> <body class="i18n-en"> </body> </html> and when user switches languages, following renders: <html class="ar> <body class="i18n-ar"> </body> </html> i've created less file programmatically loads different font replace english default font when arabic version of site loads, follows: body.i18n-en { @font-face { font-family: 'dinalternatebold'; src: url('../fonts/din-alternate-bold.ttf') format('truetype'); } } body.i18n-ar { @font-face { font-family: 'dinalternatebold'; src: url('../fonts/harmattan-regular.woff') format('woff'); } } note calling "harmattan-regular.woff" same variable name "din-alternate-bold.ttf", replacement of instance of dinal...

c++ - How to compile a C++03 project that uses a C++11 library API? -

i required use shared library , api compiled using c++11. uses c++11 features std::mutex , std::shared_ptr in api. have no control on library a. however, being required compile code using c++03 uses library a's api. i pretty sure cannot done because compiler errors stating uses of std::mutex , std::shared_ptr , , others in api not found. (my understand is, if library didn't use c++11 specific types should able this.) but want make sure there isn't not understanding need in order compile code against c++11 library a. so question is, can compile code using c++03 against shared library , api uses c++11? an api exposes at edges c++11-specific features won't usable c++03. 1 way work around build c++11 wrapper library converts c++11-specific inputs , outputs c++03-compatible types. example if original c++11 library returns std::shared_ptr api, wrapper library return boost::shared_ptr or raw pointer instead. "pimpl" idiom might helpful wh...

jquery - Kendo UI chart select feature gets reset -

select on kendo ui chart made user lost when browser (mobile device/computer) resized. can retain selection when browser resized? to reproduce, please save below code html on system, open on browser, make selection on chart , resize browser. selection made lost. <html> <head> <meta charset="utf-8"> <title>retain kendo chart selection</title> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.common.min.css"> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.rtl.min.css"> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.default.min.css"> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.mobile.all.min.css"> <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script...

Bootstrap 4 Carousel not working -

building page carousel slider. bootsrap 4 carousel not working: <div id="carouselexampleindicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselexampleindicators" data-slide-to="0" class="active"></li> <li data-target="#carouselexampleindicators" data-slide-to="1"></li> <li data-target="#carouselexampleindicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="/wp-content/themes/tarps/assets/img/aaatarps-banner.png" alt="first slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="...

html - Chrome rendering hidden labels -

i've created tab system using css working intended, except in chrome 1 label gets randomly hidden. i've created small example represent issue: http://jsbin.com/xexupiciru/edit?html,css,output this excerpt of relevant code represents single tab: <div> <input name="tagmanage-tabbed" id="tagmanage-tabbed2" type="radio"> <section> <h1> <label for="tagmanage-tabbed2">{{ tabtitle }}</label> </h1> <div> <p>some content</p> </div> </section> </div> in safari , firefox works intended, in chrome, when label clicked, label gets hidden reason , can't figure out why. the reason why getting hidden in google chrome when click on element makes ever larger causing overflow imperceptible you. google chrome looks @ following rule , hides it: .tagmanage-tabbed > div > section > h1 { overflow: hidden; } w...

r - Dplyr difference between select and group_by with respect to quoted variables? -

in current version of dplyr, select arguments can passed value: variable <- "species" iris %>% select(variable) # species #1 setosa #2 setosa #3 setosa #4 setosa #5 setosa #6 setosa #... but group_by arguments cannot passed value: iris %>% group_by(variable) %>% summarise(petal.length = mean(petal.length)) # error in grouped_df_impl(data, unname(vars), drop) : # column `variable` unknown the documented dplyr::select behaviour iris %>% select(species) and documented documented dplyr::group_by behaviour iris %>% group_by(species) %>% summarise(petal.length = mean(petal.length)) why select , group_by different respect passing arguments value? why first select call working , continue work in future? why first group_by call not working? i'm trying figure out combination of quo() , enquo() , !! should use make work. i need because create function takes ...

User inserting Alphabet into array and controlling if there are repetitions and order of input Java -

i need create array of 26 , insert in alphabet letters, have control if there repetitions , order of input eg: a,b,c or z,y,x . my code: import java.util.scanner; public class esercizio4 { scanner sc = new scanner(system.in); private int ripetions; public esercizio4(){ char alfa[] = new char[26]; (int i=0;i<=26;i++){ system.out.println("insert letter"); alfa[i]=sc.next().charat(0); } } } i googled how make control of input being correct (accepting letters) couldn't find or hard understand. second part might easier still how control if there repetitions , if order increasing/decreasing ( a,b,c / z,x,y ). to know if char letter have compare numerical representation of char. have @ table i.e.: the letter a = 97 while a = 65 . what tells char can range between value of 97 - 122 lowercase letters , 65 - 90 capital letters. then question of looping trough array , comparing v...

php - mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 to be resource or mysqli_result, boolean given -

i trying select data mysql table, 1 of following error messages: mysql_fetch_array() expects parameter 1 resource, boolean given or mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given this code: $username = $_post['username']; $password = $_post['password']; $result = mysql_query('select * users username $username'); while($row = mysql_fetch_array($result)) { echo $row['firstname']; } the same applies code $result = mysqli_query($mysqli, 'slect ...'); // mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given while( $row=mysqli_fetch_array($result) ) { ... and $result = $mysqli->query($mysqli, 'selct ...'); // call member function fetch_assoc() on non-object while( $row=$result->fetch_assoc($result) ) { ... and $result = $pdo->query('slect ...', pdo::fetch_assoc); // invalid argument supplied foreach() foreach( $result $row ) { ... and ...

python - Substract epoch time from datatime.datatime.now -

Image
this question has answer here: convert python datetime epoch strftime 5 answers i asked value of key json on particular website , subtract value .now (it's expiration date). i'm doing using requests.get json.load . problem is: value i'm getting epoch time , datetime.datetime.now not. what's easiest way ( datetime.datetime.now - key(epoch value) )? see values in screenshot below. i've tried converting epoch "human date" subtraction nope. edit : may not duplicate because asks processing timestamp , wants number of seconds between timestamp , now. you did easiest. when timestamp involved think of arrow library. >>> time_string = '2017-08-14 11:52:09.145000' >>> import arrow >>> time_diff = arrow.now()-arrow.get(time_string) >>> time_diff.total_seconds() 17604.346025 ...

node.js - ionic build error reflect metadata -

i've transferred ionic application mac computer windows computer. ionic installation , ran fine, moment try run 'ionic serve' or 'ionic build' error saying "error: cannot find module 'reflect-metadata' does know of fix this? i have read forums mention adding line "reflect-metadata": "^0.1.3", and have done no luck. please help!

Python delete certain lines from file -

i have csv file looks following: ccc, rev, pindex, no. 23, 2.5, 0, 4 34, 4.3, 1, 3 27, 7.9, 2, 5 12, 5.7, 3, 7 where third element in each line called pindex . have code replicates each line once, while updating pindex accordingly. output looks following: ccc, rev, pindex, no. 23, 2.5, 0, 4 23, 2.5, 1, 4 34, 4.3, 2, 3 34, 4.3, 3, 3 27, 7.9, 4, 5 27, 7.9, 5, 5 12, 5.7, 6, 7 12, 5.7, 7, 7 below code that: with fileinput.input(inplace=true) f: n = 0 line in f: line = line.rstrip('\n') numbers = line.split(sep = ',') in range(2): numbers[3] = n n += 1 s = '' j in numbers: s += str(j) + ',' s = s.rstrip(',') print(s) now want delete 1 duplication each of first , last line, delete first line (after header, pindex 0) , last line in file. using fileinput , trying write result in same file. tried result = [] result.a...

web services - Front-end web development -

i'll cut chase!! i have created portfolio page , looking attach of other websites i've created it, brings me dilema. want use 1 domain of projects , store on rented server space. each website has it's own folder , it's own index.html page. can leave each project it's own index.html , link them main website? or there better way? i appreciate bit of advice/criticism thanks

keytool - Error with signing keys for phonegap build -

Image
i trying create singed key phonegap build can deploy app google play store! error occurs every time try.

javascript - How to make a style change when a property is "true" -

i'm using material-ui, react class app extends component { constructor() { super(); this.state = { draweropened: true }; }; render () { return( <div> <drawer open={this.state.draweropened}> <div style={{paddingleft: '256px'}}> </div> </div> i want padding-left when drawer open (true), how remove padding when closing drawer? <div style={{paddingleft: this.state.draweropened ? '256px' : 'initial'}}>

cursor - In MySQL, i am not being able to execute commands after a loop -

i using cursor , loop execute stored procedure on each item of table. need done once day. procedure works , executes daily procedure on each row of table. part works fine. but, when try adding logging @ end (updating of table rollupcontrol time execution took) command doesn't executed @ all... added 2 debugging selects, 1 inside loop , other outside. 1 inside gets executed 1 outside doesn't... drop procedure if exists `runx`; delimiter $$ create procedure `runx`() runx:begin -- roda rup366 uma vez para cada dispositivo declare t0 datetime(2) default now(2); declare t0i float default 0; declare debug int default 1; declare viddisp varchar(6); declare done boolean default false; declare _id bigint unsigned; declare cur cursor (select id tablem m join tabler r on m.id = r.id time_to_sec(timediff(lastupdatedtime,lastqueryedtime))/(60*60*24) > 1); declare continue handler not found set done := true; open cur; runxloop: loop fetch ...

swift - Show short videos from iOS library -

is possible show short videos ios photo library ? i want user able show , import videos less 10 seconds library. edit: i'm using uiimagepickercontroller retrieve videos photo library using native uiimagepicker don't think possible. however can show videos using uiimagepicker, , if user choose long video, push notification him first 10 seconds taken. better if show him video , let him pick 10 seconds it. hope helps!