Posts

python - average of certain values of an array -

i have array contains numbers distances, , represents values @ distance. how calculate average of data @ fixed value of distance? e.g distances (d): [1 1 14 6 1 12 14 6 6 7 4 3 7 9 1 3 3 6 5 8] e.g data corresponding entry of distances: therefore value=3.3 @ d=1; value=2,1 @ d=1; value=3.5 @ d=14; etc.. [3.3 2.1 3.5 2.5 4.6 7.4 2.6 7.8 9.2 10.11 14.3 2.5 6.7 3.4 7.5 8.5 9.7 4.3 2.8 4.1] for exampe @ distance d=6 should mean of 2.5, 7.8, 9.2 , 4.3 i want values of d appear in vector 'd' , create vector (or matrix) of averages corresponding distance. thank in advance magnificent help! this handles every case in lists. adjust needed. key = [1, 1, 14, 6, 1, 12, 14, 6, 6, 7, 4, 3, 7, 9, 1, 3, 3, 6, 5, 8] dist = [3.3, 2.1, 3.5, 2.5, 4.6, 7.4, 2.6, 7.8, 9.2, 10.11, 14.3, 2.5, 6.7, 3.4, 7.5, 8.5, 9.7, 4.3, 2.8, 4.1] d in set(key): choose = [dist[i] in range(len(key)) if key[i] == d] print d, float(sum(choose)) / len(choose) you can shorten code ...

google maps - GMaps InfoWindow display issue -

Image
i cannot figure out why google maps infowindow not display properly. screengrab below: any idea may causing this? here code (js): /** * basic map */ $(document).ready(function(){ var map = new gmaps({ el: '#basic_map', lat: 51.5073346, lng: -0.1276831, zoom: 10, zoomcontrol : true, zoomcontrolopt: { style : 'small', position: 'top_left' }, pancontrol : false, }); map.addmarker({ lat: 51.5073346, lng: -0.1276831, title: 'big ben', infowindow: { content: 'big ben nickname great bell of clock @ north end of palace of westminster in london, , extended refer clock , clock tower, officially named elizabeth tower.' } }); }); css: .map { display: block; width: 95%; height: 350px; margin: 0 auto; -moz-box-shadow: 0px 5px 20px #ccc; -webkit-box-shadow: 0px 5px 20px #ccc; box-shadow: 0px 5px 20px #ccc; } html: ...

winforms - Memory leak in windows forms -

we have form forma, , form adding form fromb forma. on dispose method disposing forma using forma.dispose(). step whether dispose child forms used in forma or need call dispose() method explicitly each forms , controls? similarly in fromb using list of windows.forms.control , not making these lists null in dispose method of formb. need dispose these list also?

internet explorer - How to apply IE Fixes for LESS CSS -

my page code is: <!doctype html> <!--[if lt ie 7 ]><html class="no-js ie6" lang="en"><![endif]--> <!--[if ie 7 ]><html class="no-js ie7" lang="en"><![endif]--> <!--[if ie 8 ]><html class="no-js ie8" lang="en"><![endif]--> <!--[if ie 9 ]><html class="no-js ie9" lang="en"><![endif]--> <!--[if (gte ie 9)|!(ie)]><!--><html class="no-js" lang="en"><!--<![endif]--><head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <link rel="shortcut icon" href="favicon.ico"> <title>blue monday-homepage</title> <!--default style sheet--> <link rel="stylesheet/less" href="css/blue.less" media="screen" type="text/css" ti...

python - Extract dictionary from QTreeWidget -

Image
i managed create treewidget dictionary, want reverse engineer it, , want create dictionary qtreewidget. quite lost on how that, seems straight forward fail. the idea parent items for index in range(self.treewidget.toplevelitemcount()): parent = self.treewidget.toplevelitem(index) from there on need recursively go through each sublevel parent.childcount(), if childcount valid, iterate on child. but dont know how create dictionary that. please me out.. ideally this "core.global_vars.arrunner_qmenu_object_name" "core.global_vars.metadata_label" "core.logger.console_verbosity" or in best case {"core:{"global_vars:{"arrunner_qmenu_object_name":none}}, ...} update replacejson main functions gets root parents, there on gather childrens , add them global children list. after that, generate string "root.child.child.child" can expand dict {"root":"{"child":...}} then in replace...

cq5 - storing custom data in AEM 6.1 JCR repository -

we got aem 6.1, , went through developer training, well. coming cms background (sharepoint) , wanted learn / know, if need create list store data it, , refer programatically, somewhere on page or other common libraries in project , how do , store data , in /etc folder. not clear, guess, learnt training data stored in node types key / value pair, example if had list of movies attributes such date released, actors, awards etc. how store information in aem, don't want store part of list component of page. let me know if question vague, said, transitioning form cms. in advance. i appreciate pointers blogs, etc.. @rahul store data? data can stored in both /etc folder , /content folder. folders in /etc used supplement application's business logic code development, eg. clientlibs folder used store client side code(website styling, scripts etc. content folder authored content, user generated content gets persisted key value pairs , have build logic using jcr api's ...

sql - MySQL CONCAT returns NULL if any field contain NULL -

i have following data in table "devices" affiliate_name affiliate_location model ip os_type os_version cs1 inter dell 10.125.103.25 linux fedora cs2 inter dell 10.125.103.26 linux fedora cs3 inter dell 10.125.103.27 null null cs4 inter dell 10.125.103.28 null null i executed below query select concat(`affiliate_name`,'-',`model`,'-',`ip`,'-',`os_type`,'-',`os_version`) device_name devices it returns result given below cs1-dell-10.125.103.25-linux-fedora cs2-dell-10.125.103.26-linux-fedora (null) (null) how come out of should ignore null , result should be cs1-dell-10.125.103.25-linux-fedora cs2-dell-10.125.103.26-linux-fedora cs3-dell-10.125.103.27- cs4-dell-10.125.103.28- convert null values empty string wrapping in coalesce select ...