Posts

Showing posts from January, 2012

system verilog - How to implement Summation equation in SystemVerilog constraints? -

c=∑(a[i]*b[i]) consider 2 arrays , b. result,c of mac operation of 2 arrays , b should less 1024. use systemverilog constraints implement above condition. size of 2 arrays can go 1 n , each array element stores 1 byte. have randomize both arrays. now i've seen solution in chat, i'll give thinking constraint c_sum { c == a.sum() (a[item.index] * b[item.index]); c < 1024;}

javascript - PayPal Angular Integration -

i have angular application, need integrate paypal payment process. i've been following tutorials, stuck this. what i've done until now? run 'npm install xcomponent' run 'npm instal paypal-checkout' add <scriptsrc="https://www.paypalobjects.com/api/checkout.js"></script> index.html add <paypal-button [props]="{ payment: payment, onauthorize: onauthorize }"></paypal-button> page need button rendered at app.module.ts, exported , imported (in ngmodule imports list) new module this: declare const paypal:any; export const paypalbuttonmodule = paypal.button.driver('angular2',{component,ngmodule,elementref,ngzone}); add component (lets call mypaypalcomponent.ts) need render button: payment() { console.log('payment'); } onauthorize() { console.log("onauthorize"); } and button being rendered, next step? how to, @ mypaypalcomponent.ts, "overload" functions paym

mysql - How I can get the first row of each hour? -

mysql []> show columns reading; | field | type | null | key | default | | | cont | int(4) | no | pri | null | auto_increment | | id | int(4) | yes | mul | null | | | sensor_num | int(4) | yes | | null | | | value | float(5,2) | yes | | null | | | time | datetime | yes | | null | | select * reading; 18570 | 1 | 1 | 23.93 | 2017-08-14 12:45:01 | | 18571 | 1 | 1 | 23.93 | 2017-08-14 12:46:01 | | 18572 | 1 | 1 | 23.93 | 2017-08-14 12:47:01 | | 18573 | 1 | 1 | 23.93 | 2017-08-14 12:48:01 | | 18574 | 1 | 1 | 23.93 | 2017-08-14 12:49:02 | | 18575 | 1 | 1 | 23.93 | 2017-08-14 12:50:02 | | 18576 | 1 | 1 | 23.93 | 2017-08-14 12:51:02 | | 18577 | 1 | 1 | 23.93 | 2017-08-14 12:52:02 | | 18578 | 1 | 1 | 23.93 | 2017-08-14 12:53:

Show woocommerce errors -

i have woocommerce store , want show wocommerce error messages in specific place of theme, example under submit button. i know wocommerce error messages come here: <ul class="woocommerce-error"> <?php foreach ( $messages $message ) : ?> <li><?php echo wp_kses_post( $message ); ?></li> <?php endforeach; ?> </ul> but, when put code in page (for example edit-my-address.php page), giving error! working or simple code showing messages in woocommerce? in advance.

python - Using masks to apply different thresholds to different parts of an image -

i have image, in want threshold part of image within circular region, , remainder of image outside of region. unfortunately attempts seem thresholding image whole, ignoring masks. how can achieved? see code attempt below. def circular_mask(h, w, centre=none, radius=none): if centre none: # use middle of image centre = [int(w / 2), int(h / 2)] if radius none: # use smallest distance between centre , image walls radius = min(centre[0], centre[1], w - centre[0], h - centre[1]) y, x = np.ogrid[:h, :w] dist_from_centre = np.sqrt((x - centre[0]) ** 2 + (y - centre[1]) ** 2) mask = dist_from_centre <= radius return mask img = cv2.imread('image.png', 0) #read image h,w = img.shape[:2] mask = circular_mask(h,w, centre=(135,140),radius=75) #create boolean circle mask mask_img = img.copy() inside = np.ma.array(mask_img, mask=~mask) t1 = inside < 50 #threshold part of image within circle, ignore rest of image plt.imshow(inside) p

html - Overflow-y scroll content disappears inside of div container? -

i have facing problems div container. want set standard height on container. if content inside of div large scroll bar should show on side. here example of code: //in section have navigation bar , html included. <section class="settingsbox"> <nav class="xnavigationsetting"> <a href="#" data-id="settingmain">menu</a> | </nav> <div id="htmlsetting"> <cfinclude template="includes/hmsettings.html"> </div> </section> <div id="settingmain" class="settingsbox"> <div id="settingtesting"> <fieldset> <legend>testing</legend> <ul> <li> <span id="location">test location</span> </li> <li> <span id="reason"&g

python - Spacy returns empty results -

i've installed spacy following instructions on website python 2.7 using pip , downloaded english models, using pip, when run simple test code returns empty set result, when example online indicates should identify subject. think spacy not connecting models, , therefore not returning results, gives me no errors , indicates has connected properly. from spacy.en import english nlp = english() sent = "i shot elephant" doc = nlp(sent) sub_toks = [tok tok in doc if (tok.dep_ == "nsubj")] print sub_toks this returns [] , no errors or other issues. how return result? my problem english models didn't load correctly. when reinstalled saw despite fact command prompt said 'linked successfully' line above 'you not have sufficient rights perform operation', ran administrator , worked

How to handle conditional sub-category in AngularJS product gallery -

just starting out learning angularjs , decided mock basic product gallery using i've learned far , i've hit roadblock. have simple product gallery 3 templates(category listing, products in category listing , product overview). set sort of conditional, if products in selected category have sub-category, displays list of sub-categories using category-list template. if don't have sub-category goes straight product-list template. i have created plunker showing @ far. in above example, if clicks on "cars" want show listing of sub-categories using category-list template. when click "cars" take screen 2 buttons: 4-door , 2-door . clicking on 1 of buttons show products sub-categories using product-list template. however, if click on "trucks" initial screen, take directly product-list template since trucks don't have sub-categories. here category-list template: <section id="categories" ng-hide="productsvisible&qu

html - codnigter PHP echo form_submit error -

1 - dont pass variable e don´t login.... why ?? <?php echo form_submit('login', 'login', 'class="btn btn-primary"') ?> 2 - work <button type="submit" class="btn btn-primary">login</button> your " , ' in wrong place change <?php echo form_submit('login', 'login', 'class="btn btn-primary"') ?> to <?php echo form_submit('login', 'login',"class='btn btn-danger'");?>

Flurry setCrashReportingEnabled(true) depreciated in Swift -

in ios/xcode/swift, since upgraded latest version of flurry ios sdk " flurry.setcrashreportingenabled depreciated ". this code: ... //start flurry flurry.setcrashreportingenabled(true) flurry.startsession(environment.flurryapikey) ... looking @ flurry ios sdk github project found "deprecated since 7.7.0, please use flurrysessionbuilder in place of calling api." however cannot find info regarding flurrysessionbuilder usage in swift. how convert above code using flurrysessionbuilder rid of depreciated warning? after contact support flurry support found answer here: https://developer.yahoo.com/flurry/docs/integrateflurry/ios/#initialize-flurry let builder = flurrysessionbuilder.init() .withappversion("1.0") .withloglevel(flurryloglevelall) .withcrashreporting(true) .withsessioncontinueseconds(10) //

Android BottomSheet adapt/shrink related map view -

trying mimic current google maps bar @ bottom. failed hard , tried much; collapsingtoolbar, bottomsheet, custom libs. what want: making map view adapt it's size , camera when bottomsheet sliding, bottom sheet not slide on map instead map fits in space left. take @ this video see mean (and don't mean zoom functionality)

node.js - Is there a way to convert a base64 encoded string into 8-bit ASCII in NodeJS? -

i'm writing code in firebase functions acts intermediary between 2 databases. (i've been mandated way.) i need send user data , pdfs on database 1 database 2. have working except pdfs. there pdfs right number of pages in database 2, problem pdfs show blank in user portal , when download them database. database 1 sends me base64 encoded string pdf. don't know i'm supposed send database 2. database 2 has api , sparse documentation in ruby; provide examples, , there little support api. below part haven't been able figure out far: post_body << "--#{boundary}\r\n" post_body << "content-disposition: form-data; name=\"document[attachments_attributes][0][attachment]\"; filename=\"document.pdf\"\r\n" post_body << "content-type: application/pdf \r\n" post_body << "\r\n" post_body << file.read(file) post_body << "\r\n--#{boundary}--\r\n" # last boundar

object - Scaling swfobject to make it responsive -

i'm trying insert swf file , make responsive. <div class="modal fade" id="portfoliobig3" tabindex="-1" role="dialog" aria-hidden="true" > <div class="modal-content" > <div class="container"> <div class="row"> <div class="col-md-12"> <div class="modal-body" > <!-- classid : identifie la commande activex pour le navigateur. codebase : identifie l'emplaceemnt de la commande activex de flash player pour que le navigateurpuisse l'instller si ce n'est pas déjà fait. --> <object class="object" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/p

asp.net mvc - It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level when publishing site via FTP -

i have updated development machine. in process of doing so, installed visual studio 2017 enterprise opposed 2017 community, thing has changed in respect of trying do. i 'now' following error when publishing mvc site via ftp; it error use section registered allowdefinition='machinetoapplication' beyond application level. error can caused virtual directory not being configured application in iis. i error means, failing understand why. the specific section referring is; <authentication mode="forms"> <forms loginurl="~/account/login" /> </authentication> the website published using same source, same profile, same server. site running configuration identical being published no issues. if publish site local directory , copy file server (in same place) no issues. i add error during build, not publish. suggestions?

How to provide permissions to particular user for accessing web page in asp.net? -

i created 1 page named welcome.aspx . on page added 1 button,on button click event page should redirect page i.e userregisteration.aspx page userregisteration.aspx page should accessible particular user team lead,manager. if user other click on button , try access userregisteration.aspx page error message should generate. please suggest me how achieve above requirement?? in advance use button code: protected void button1_click(object sender, eventargs e) { string usertype = "team lead"; // set user type if (usertype=="team lead" || usertype=="manager") { response.redirect("userregisteration.aspx"); // redirects specified page } else { // shows error message scriptmanager.registerstartupscript(this, this.gettype(), "", "alert('you not valid user!')", true); } }

javascript - Assigning the value of the sender object to a variable -

i'm using several comboboxes have extract values , concatenate them in textbox. problem use sender.get_selecteditem().get_value(); extract data of each one, each 1 obtains data of combobox, variables acquire same value (it not keep values obtained in previous variable), using telerik controls. <script type="text/javascript"> function cmp(sender, eventargs { if (document.getelementbyid("ctl00_contentplaceholder_rgpartesrfq_ctl00_ctl05_planta")) { var pl = sender.get_selecteditem().get_value(); var fo = sender.get_selecteditem().get_value(); var gr = sender.get_selecteditem().get_value(); var di = document.getelementbyid("ctl00_contentplaceholder_rgpartesrfq_ctl00_ctl05_txtdiam1").value; var lo = document.getelementbyid("ctl00_contentplaceholder_rgpartesrfq_ctl00_ctl05_txtlongt").value; var codemp = document.getelementbyid("ctl00_conten

Kotlin KFunction reflection - get parameter values -

in order create simple annotation logs function calls, i'm trying grab following attributes function has said annotation: function name parameter names parameter values what have far uses kcallable value, makes grabbing name , names list of kparameter simple. however, cannot figure out how values of said parameters make log statement more contextual. does have ideas on grabbing these parameters values within annotation? doesn't need use kcallable , seemed intuitive receiver.

nameerror - calling a separate method in an another one in Python -

i have multiple methods, don't know how put in python 3.4. eventually, library of methods , wrapping them in 1 class estimators. here have far: class estimators(): """some methods building basic estimators. methods. """ def average(series): return float(sum(series))/len(series) def moving_average(series, n): return self.average(series[-n:]) def main(): series = [3, 10, 12, 13, 12, 10, 12] done = average(series) print(done) outputmv = moving_averge(series, 2) print('this moving average:\n %d.2' % outputmv) it throws `nameerror: global name 'average' not defined also, want make sure right architecture. practice in python define multiple methods have (functional) dependencies along? functional dependencies mean methods might use methods defined outside scope. in case, seems better use module rather class. module separate python file. if name file estimators

powershell - Regex to find space before a month name or abbreviation -

in powershell script i'm trying write regex find space before month name or abbreviation (e.g. jan, january, feb, february, etc.). i'm using drive -replace operator. i've constructed regex works, finds space before works jane, marcus, etc. find space before exact words such jan, january, mar, march, etc. ideas? [ ](?=jan|(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|jun(?:e)?|jul(?:y)?|aug(?:ust)?|sep(?:tember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?) thanks in advance help. you've got of right. missing part end-of-the-word anchor \b , prevents matching prefixes of longer words: \s(?=(?:jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|jun(?:e)?|jul(?:y)?|aug(?:ust)?|sep(?:tember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)\b) demo. note: replaces [ ] \s , matches tabs , newlines.

reactjs - React Checkbox Group - Set initial state from API -

i have checkboxgroup component takes in options array prop , generates checkboxinput components. on page load make call api returns array of pre-selected checkboxes (delivered value prop). depending on logged in user, call can return empty array or selection of selected checkbox options. the following code takes response of api call , sets relevant checkboxes 'checked'. issue have code doesn't allow me make changes checkboxes after page load (clicking checkboxes has no effect). i think there disconnect between initial selectedcheckboxes state , value of api call read setting props initial state anti-pattern (e.g. selectedcheckboxes: props.value, ). export default class checkboxgroup extends component { constructor(props) { super(props); this.state = { selectedcheckboxes: [], }; } addcheckboxtoselected = (id) => { if (this.state.selectedcheckboxes.includes(id)) { // remove checkbox array , update state const filtereda

html - Align elements with different heights on the same row -

i trying display multiple circles on same horizontal axis different width , height. problem circles shrinked. body, html { height: 100%; margin: 0; padding: 0; } .circles-container { display: table; border-spacing: 40px; } .row { display: table-row; } .circle { width: 100px; height: 100px; border: 1px solid #000; border-radius: 50%; text-align: center; vertical-align: middle; display: table-cell; } .cell { display: table-cell; } .big-circle { width: 300px; height: 300px; } <div class="circles-container"> <div class="row"> <div class="cell"> <div class="circle"> <span>text</span> </div> </div> <div class="cell"> <div class="circle"> <span>text</span> </div> </div> <div class="cell&quo

c# - Selenium Web Driver Click -

i having issues these last lines working. last search button part breaks. says"unknown error:cannot focus element".the last lines clicking search button. here html code im getting from. search button code. <img class="banner-search-type-search-imagestyle" src="images/bannerimages/go-img.png" id="btnsearch"> here code. var mfgpartnumber = "crcw12061r00fkea"; iwebdriver driver=new chromedriver(@"c:\users\josimpso\appdata\roaming"); driver.navigate().gotourl("https://app.siliconexpert.com/cmomfx/customerlogin.html"); //set username iwebelement setusername = driver.findelement(by.classname("logininput")); setusername.sendkeys("username"); //set password iwebelement setpassword = driver.findelement(by.name("password")); setpassword.sendkeys("password"); // click login button iwebel

dataframe - R: How to uppercase first letter of each word split by semicolon in data frame column? -

suppose have dataframe df . > df <- data.frame(disease = c('disease entry1; disease entry2', 'disease entry4','disease entry5; disease entry6'), id = c(1,2,3)) > df disease id 1 disease entry1; disease entry2 1 2 disease entry4 2 3 disease entry5; disease entry6 3 how can manipulate each disease entry lowercase except first letter each entry? i.e. > df disease id 1 disease entry1; disease entry2 1 2 disease entry4 2 3 disease entry5; disease entry6 3 i assume take use of tolower function somehow, how take account semicolons? you can firstly convert letters lower case, , use gsub convert letters @ bos or after ; upper case using reference \\1 \\u : df$disease <- gsub("(?<=^|; )([a-z])", "\\u\\1", tolower(df$disease), perl = t) df # disease id #1 disease entry1; disease entry2 1 #2

proxy - Python requests proxies.txt IP:Port:User:pass -

i trying use file store proxies in it. want load these on proxies on requests module. but problem is, proxies mixed up. proxies authentication, , doesn´t. so proxies.txt looks this 123.12.190.121:2323:user:pass 123.12.190.122:2323:user:pass 123.12.190.123:2323 123.12.190.124:2323:user:pass 123.12.190.125:2323 some authentication, doesn´t. now want call command this response = session.get(url, proxies=proxies) with loaded proxies stored in proxies.txt can me out? from requests documentation can use proxy user/pass or without. please check following link: http://docs.python-requests.org/en/master/user/advanced/ to use http basic auth proxy, use http://user:password@host/ syntax: proxies = {'http': 'http://user:pass@10.10.1.10:3128/'} so need create proxies dictionary or regular expression or splitting ':' character. can create proxy url like: http://user:pass@10.10.1.10:3128 or http://10.10.1.10:3128. from documentation: give

django - Wagtail CMS APIv2 Pagination not Showing Numbers or Next & Previous -

i can't seem pagination work wagtail cms projects api. shows random list of 20 on page, image or documents. code listed below settings file. wagtail documents mention adding rest_framework settings file allow browsing can't seem figure out how browse , not 20 results. thank you. rest_framework = { 'default_pagination_class': 'rest_framework.pagination.pagenumberpagination', 'page_size': 100, 'default_renderer_classes': ( 'rest_framework.renderers.jsonrenderer', 'rest_framework.renderers.browsableapirenderer', ), 'default_parser_classes': ( 'rest_framework.parsers.jsonparser', ), }

ios - Autoshrink feature of Label in Tableview cell on scrolling doesn't work -

Image
i have 2 labels side side in custom cell of tableview. when adding data first time looks : which fine , required design . problem occurs when start scrolling tableview. after going down in tableview , coming changes this: first label has autoshrink feature added not in second label. doing in storyboard except data poulating part. please tell me if doing wrong in it. any appreciated. **edit: ** the custom cell have added in project: there 2 labels have highlighted selecting them. constraints first label are: i have added auto shrink feature in first label : constraints second label are: i haven't added auto shrink feature in second label have keep fixed font size in second label. finally after reading more content hugging priority , content compression resistance priority got solution. thanks blog too: https://krakendev.io/blog/autolayout-magic-like-harry-potter-but-real i changed priority follows: for first label: for

java - Why Dialer app opens Contacts app - Android Studio custom launcher -

i've built custom launcher android, have issue on samsung phone. when try open dialer app opens samsung's contact app. on emulator works fine, think problem on phone. how can fix it? this code set packages in main activity. public void setpackages(){ final intent mainintent = new intent(intent.action_main, null); mainintent.addcategory(intent.category_launcher); list<resolveinfo> packageslist = packagemanager.queryintentactivities(mainintent, 0); packages = new package[packageslist.size()]; (int = 0; < packageslist.size(); i++){ packages[i] = new package(packageslist.get(i).loadicon(packagemanager), packageslist.get(i).loadlabel(packagemanager).tostring()); packages[i].seticon(packageslist.get(i).loadicon(packagemanager)); packages[i].setappname(packageslist.get(i).activityinfo.packagename); packages[i].setlabel(packageslist.get(i).loadlabel(packagemanager).tostring()); } new utils().changesort(package

sql server - UPDATE Blocking SELECT Of Unrelated Rows -

i have tablea col1 primary key. running following transaction without committing (for test purposes). begin transaction update tablea set col3 = 0 col2 = 'aaa' in meanwhile, run following query , see waits on first transaction complete. select * tablea col2 = 'bbb' but following query returns results immediately: select * tablea col1 = '1' so thought second query might need read rows have exclusive locks put first transaction in order select rows col2 = 'bbb' . that's why tried index col2 table seek not necessary did not work either. second query still waits on first transaction. what should done prevent select blocking (except use of nolock ). p.s: transaction isolation level "read committed".

php - Apache - Website timeout after random time ( Fore to restart Apache ) -

hello stackoverflow community, i have big problem apache server. ( use google translate message ) for reason not know yet, randomly, apache2 server starts stop responding (error 500). i noticed when problem occurs, in file "error.log", find line: [mon aug 14 18:42:39.917495 2017] [mpm_prefork:error] [pid 23163] ah00161: server reached maxrequestworkers setting, consider raising maxrequestworkers setting after that, had asked change value "maxrequestworkers", did not change anything, problem still there. i noticed generally, when problem occurs, following strong request sucks apache server (especially last, raw force attack), these log (access.log): http://p.hexicans.eu/mmgrunkxqx in file "error.log", recorded many of these errors: [mon aug 14 18:28:58.366861 2017] [core:warn] [pid 20916] ah00045: child process 22399 still did not exit, sending sigterm [mon aug 14 18:28:58.366873 2017] [core:warn] [pid 20916] ah00045: child process 2

javascript - I am trying to connect to connect to my SQL server database with node and hapi.js -

i trying test out connection sql server using node , hapi.js , run simple query on 1 of tables. new node , hapi trying figure out so first folder structure follows have folder called api has routes in , doing routes get_aosdata.js works tested passing 'hello world' have query folder under api setting db connections in connection.js this route looks 'use strict'; const query = require('../query/connection'); module.exports = { method: 'get', path: '/api/query/{id}', config: { pre: [ { method: query.getsqlconnection, assign: 'db' } ], handler: (request, reply) => { const request = new db.request(); request.query(`select a.ordnbr, a.sotypeid, a.user6, a.lupd_datetime, a.user3, a.crtd_user, a.s4future01, a.slsperid, a.totmerch, a.custordnbr soheader join customer b on a.custid = b.custid

GCC 7.1 on RHEL 6 64 bit compiles Fortran as 32 bit -

i have managed compile gcc 7.1 on rhel 6 64 bit configure --prefix=/opt/gcc-7.1 . unfortunately, compiling gfortran produces 32 bit binaries default. how can tell gfortran compile 64 bit , use /opt/gcc-7.1/lib64 in rpath default? suprisingly, system-bundled gfortran 64 bit default.

php - How to get website content if its part is dynamically loaded -

Image
1st of need inform im trying ceontent website adults if youre under 18 don't enter (i need purpose of using affiliate program) website url showup[dot]tv. i need capture number of received coins displayed in 2 places on page of each girl (online of course). can check link show numbers on website: below code able make (i have used girl natusia example girl have change curently online girl). it's working can pass 1st "confirmation of age" page sending cookie , can string need but... since number of coins dynamically loaded cant number... instead im getting "- / - żetonów (0%)" can me correct "parse?" code? (im begginer): <?php function get_string_between($string, $start, $end){ $string = ' ' . $string; $ini = strpos($string, $start); if ($ini == 0) return ''; $ini += strlen($start); $len = strpos($string, $end, $ini) - $ini; return substr($string, $ini, $len); } $opts = array( 'http&#

c# - Is that possible to have two namespaces in the class XMLTypeAttribute to handle deserialization of 2 soap responses? -

i have class has following declaration: [system.xml.serialization.xmltypeattribute(anonymoustype = true, namespace = "http://schemas.xmlsoap.org/soap/envelope/")] [system.xml.serialization.xmlrootattribute(namespace = "http://schemas.xmlsoap.org/soap/envelope/", isnullable = false)] public partial class envelope { private envelopebody bodyfield; /// <remarks/> public envelopebody body { { return this.bodyfield; } set { this.bodyfield = value; } } } . . code generated here based on response xml... . [system.xml.serialization.xmltypeattribute(anonymoustype = true, namespace = "order")] [system.xml.serialization.xmlrootattribute(namespace = "order", isnullable = false)] public partial class insertresponse { private insertresponseout outfield; /// <remarks/> public insertresponseout @out { { r

ssl - PHP Secure Websocket server can't read data from clients -

trying secure websocket server communicate clients. it's working fine exception of 2 problems. i'm using this script. my first problem when client sends handshake request, first letter in clients header gets removed. get /echobot http/1.1 becomes et /echobot http/1.1 now, have managed temporarily botch changing et on line 193 , 194 in websockets.php , making server accept request. my other problem recieving data clients. when send client.html, thing recieve server-side "ü" (or ascii character 129). when try running normal "non-tls" server, works fine. this current options array, should need it: $options = array( 'ssl' => array( 'peer_name' => 'my.url', 'verify_peer' => false, 'local_cert' => '/etc/letsencrypt/live/my.url/cert.pem', 'local_pk' => '/etc/letsencrypt/live/my.url/privkey.pem', 'disable_compr

javascript - Compare dates on moment.js -

i working library moment.js difference in months between 2 dates .. code works fine .. takes month when same day eg: first date = 2017-08-14, second date = 2017-09-14 ... in case takes account full month, question ahy way if second date was: 2017-09-12 example .. take account month? i leave little code have. var date1 = moment('2017-08-14'); var date2 = moment('2017-09-12'); var result = date2.diff(date1, 'months'); console.log(result); <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> according documentation .diff() round down when value positive, , round when value negative (i.e. positive values < 1 rounded down 0): by default, moment#diff return number rounded towards 0 (down positive, negative). if want floating point number, pass true third argument. if want floating point number, this: var result = date2.diff(dat

print number in binary MIPS Assembly. Program abruptly ends -

a specific portion of program isn't working properly. supposed print stored decimal value in binary. when debugging, program abruptly ends when finishes 'printzero' branch, @ nop. i'm not sure why. when hits jal puts, doesn't print 0. i'm confused. code below. andi $a0, $a0, #0 /* reset $a0 */ lw $t0, number lw $t1, bitmask andi $t2, $t2, #0 /* reset $t2 */ addi $t2, $t2, #16 /* use our counter */ checkandprintmask: , $t3, $t1, $t0 beq $t3, $zero, printzero /* branch if zero. else, print 1 */ nop la $a0, print1 jal puts nop b done nop printzero: la $a0, print0 jal puts nop /* (abruptly ends here) */ done: srl $t1, $t1, 1 addi $t2, $t2, #-1 bgtz $t2, checkandprintmask .data welcomemessage: .asciiz "welcome converter\n" decimalmessage: .asciiz "the decimal number is: " binarymessage: .asciiz "the binary number is: " number: .word #65535 print0: .asciiz "0" print1: .asciiz "1" bitma

.htaccess - How to enable GZIP Compression on BigCommerce site -

for familiar bigcommerce , i'm sure know whether gzip compression possible configure or not on platform. minified js files , instead of them pointing cdn , they're looking straight local files because way update files. now want enable gzip these files can't find it(if it's possible). thank takes time offer answer! after further research, not have access .htaccess file in bigcommerce. because bigcommerce not run on apache, runs on nginx. not .htaccess can produce security risks, want avoid using bigcommerce. you can add following code top of of pages compress php: <?php if (substr_count($_server['http_accept_encoding'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>

c++ - Unable to move temporary object into the *this object -

while trying create binary search tree (bst) using c++11 hit snag. can't extract created bst out of function created. function reads data file (in case number on each line) , builds bst those. building part in loop works correctly. problem can't temporary object moved want be. zooming in on problem think, see edit 3. more context: bst<t> class derives publicly std::unique_ptr<bstknoop<t>> bst<t> inherits constructors of unique_ptr<bstknoop<t>> with template<class t> using bstknoopptr=std::unique_ptr<bstknoop<t>>; // alias template and using bstknoopptr<t>::bstknoopptr; // in body of bst<t> class declaration` a bstknoop<t> data structure 3 fields 1 t object hold node data 2 bst<t> objects left , right (each child tree in own right) the goal move newly created bst calling object. idea in main can call bst<int> tree; tree.lees(ifs); (with ifs open input filestream) , tree

c# - mvc 5 update bind attribute in submit -

i have mvc 5 entity framework application, database first , new mvc. have file picker control selects image , in action result class of create view, encode picture storage in sql. have encoding correct, data view in bind attributes , want update property bind encoded picture before write database. when try write database, whole app churns until runs out of memory. obviously, missing piece. view: div filepicker , place entity framework wanted coded pic go. <div class="col-md-10"><br/><br/> @html.textbox("beforeencode", "", new { type = "file" })<br /> @html.labelfor(model => model.fldphoto, htmlattributes: new { @class = "control-label col-md-2" }) @html.editorfor(model => model.fldphoto, new { htmlattributes = new { @class = "form-control"} }) @html.validationmessagefor(model => model.fldphoto, &quo

xml - Roku: How do I open a LabelList on a new screen? -

from brightscript , how open following labellist on new screen ( not main screen/scene)? <?xml version = "1.0" encoding = "utf-8" ?> <!--********** copyright 2016 roku corp. rights reserved. **********--> <component name = "labellistexample" extends = "group" initialfocus = "examplelabellist" > <script type = "text/brightscript" > <![cdata[ sub init() m.top.backgrounduri = "pkg:/images/rsgde_bg_hd.jpg" example = m.top.findnode("examplelabellist") examplerect = example.boundingrect() centerx = (1280 - examplerect.width) / 2 centery = (720 - examplerect.height) / 2 example.translation = [ centerx, centery ] m.top.setfocus(true) end sub ]]> </script> <children > <labellist id = "examplelabellist" > <contentnode role = "content" > <co

iis 8 - IIS 8, SERVER SSL the UserTrust Network Certification path not found -

please me explain on marchine, ssl of website has not usertrust network certification path. see images below ssl wrong has not found usertrust network certification path ssl correct usertrust network certification path thanks suggestion i found answser question is using mmc/certificates , delete comodo rsa... miss import not correct after re import ssl of website yes, see correct , can use tool " https://www.sslshopper.com/ssl-checker.html#hostname " check

pandas - Python: Implement mean of means 95% Confidence Interval? -

how can this solution implemented using pandas/python? question concerns implementation of finding 95% ci around mean of means using stats.stackexchange solution . import pandas pd ipython.display import display import scipy import scipy.stats st import scikits.bootstrap bootstraps data = pd.dataframe({ "exp1":[34, 41, 39] ,"exp2":[45, 51, 52] ,"exp3":[29, 31, 35] }).t data.loc[:,"row_mean"] = data.mean(axis=1) data.loc[:,"row_std"] = data.std(axis=1) display(data) <table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>0</th> <th>1</th> <th>2</th> <th>row_mean</th> <th>row_std</th> </tr> </thead> <tbody> <tr> <th>exp1</th> <td>34</td> <td>41<