Posts

arrays - sum two lists element-by-element in python recursively -

this question has answer here: element-wise addition of 2 lists? 12 answers is possible recursively sum 2 lists element element , return new list? def sumlistelements(listone, listtwo): list = [] = 0 while < len(listone): list.append(listone[i] + listtwo[i]) += 1 return list so, a = [1, 2, 3] b = [3, 4, 5] results r = [4, 6, 8] here recursive implementation def recursive_sum(l1, l2, idx = 0): if idx < min(len(l1), len(l2)): return [l1[idx] + l2[idx]] + recursive_sum(l1, l2, idx + 1) else: return [] print recursive_sum([1, 2, 3], [4, 5, 6]) # [5, 7, 9] or def recursive_sum(l1, l2, result = none, idx = 0): if result none: result = [] if idx < min(len(l1), len(l2)): result.append(l1[idx] + l2[idx]) return recursive_sum(l1, l2, result, idx + 1) e...

dictionary - android map fragment in dialog fragment -

this xml code dialogfragment.xml : <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text = "this map"/> <fragment android:layout_width="match_parent" android:layout_height="wrap_content" android:name="com.google.android.gms.maps.mapfragment"/> </linearlayout> this java code: public class mydialog extends dialogfragment implements onclicklistener { public view oncreateview(layoutinflater inflater, viewgroup container,bundle savedinstancestate) { getdialog().settitle("title"); view v = inflater.inflate(r.layout.dialogfragment.xml, nul...

ios - Issue with UILabel not loading in a UIView -

ok, have uiview in view controller, when run program uiview displayed fine, when put either uilabel , button or else in uiview wont display when run, displays when uiview on own, works when there uiimageview or uitextfield in it. suggestions why may happen , how fix it? edit: console showing label , uiview exist , 'on screen' cant seem see it. seems position problem. can nslog position?

jquery - Retain height of 'tr' of table after deleting first col -

i'm working on table first col should deleted dynamically using jquery. after removal of first col, tr height adjusting according content. i want tr height same after removal of first col. please suggest answer. this code i'm using remove first col $(document).ready(function(){ $('.remove tr').each(function(){ $(this).find('td:first-child').remove(); $(this).find('th:first-child').remove(); }) }) please see fiddle add line-height:0px, width , height in css following: td,th{ border:1px solid #ccc; line-height:0px; height:40px; width:100px; } see updated fiddle : demo hope helps.

sql server - How to filter the SQL query result using regular expression or SQL functions -

i have got below types of urls: /fullnews/news/english/2014/2014.xml /fullnews/news/english/2014/1221264.xml /fullnews/news/english/2014/1221272.xml /fullnews/news/english/2013/2013.xml /fullnews/news/english/2013/1251272.xml /fullnews/news/english/2012/2012.xml /fullnews/news/english/2012/1281272.xml /fullnews/news/english/config.xml /fullnews/news/english/list.xml now need write sql procedure pass "fullnews" parameter , procedure return below results getdata("fullnews"); /fullnews/news/english/2014/1221264.xml /fullnews/news/english/2014/1221272.xml /fullnews/news/english/2013/1251272.xml /fullnews/news/english/2012/1281272.xml it should filter ther urls last part not numeric (config,list etc.) , should not return urls last part (2014,2013,2012 etc.) else (1281272, 1221264 etc.) need rendered. create procedure p_test ( @parameter varchar(400) ) begin select * <tablename> url '/'+@parameter+'/news/english/20[0-2][2-9]/[0-9...

java - Does distributed queues also help in load balancing? -

i went thru http://activemq.apache.org/how-do-distributed-queues-work.html , , found out distibuted queues advantageous when if master fails, clients failover slave , don't loose message. somehow had 1 more point in mind distributed queues (say have 4 distributed queues), message published go 1 of queue balance load on each queue. looks had wrong understanding. right? is configurable if load on specific queue reaches specific limit, message gets published on distributed queue? update:- per http://activemq.apache.org/clustering.html clustering of brokers exist did not find queue clustering?

css3 - CSS - dynamically calculate width -

i come across width: calc(25% - 20px + 5px); i couldn't find answer via google. wanted know how width 410px 3 boxes in each row, because right returns me 4 boxes in smaller width 410px. any or insight appreciated. this method resolves entire expression single value , applies element. the thing you're trying first calculate 25% of parent element integer value , move on next operand. calculate result , apply. i think, need lessen down parent element's width property. you'll see 3 checkboxes width of 410px. secondly, can try make sure expression accurate while calculating result width. try fiddle: http://jsfiddle.net/afzaal_ahmad_zeeshan/d6sq5/ see, how calc() method works.