Posts

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"...

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