Posts

Count datetime entries for each month from datetime column in SQL Server -

i have table timestamps , want count total number of timestamps each month. have following script returning results. there simpler way this? select substring(convert(varchar(12), dt_create, 112), 0, 7) month, count(substring(convert(varchar(12), dt_create, 112), 0, 7)) signups table_name group substring(convert(varchar(12), dt_create, 112), 0, 7) order 1 output month signups ---------------- 201705 5959 201706 9782 201707 13663 201708 7385 characters values slower, may see increase in performance trying this. select year = year( dt_create ), month = month( dt_create ), signups = count( dt_create ) table_name group year( dt_create ), month( dt_create ) ;

python - What is the complexity of this recursive algorithm? -

Image
does following algorithm have complexity of o(nlogn)? the thing confuses me algorithm divides twice, not once regular o(nlogn) algorithm, , each time o(n) work. def equivalent(a, b): if isequal(a, b): return true half = int(len(a) / 2) if 2*half != len(a): return false if (equivalent(a[:half], b[:half]) , equivalent(a[half:], b[half:])): return true if (equivalent(a[:half], b[half:]) , equivalent(a[half:], b[:half])): return true return false each of 4 recursive calls equivalent reduces amount of input data factor of 2. thus, assuming a , b have same length, , isequal has linear time complexity, can construct recurrence relation overall complexity: where c constant. can solve relation repeatedly substituting , spotting pattern: what upper limit of summation, m ? stopping condition occurs when len(a) odd . may anywhere between n , 1 , depending on prime decomposition of n . in worse case scena...

how to delete the nth occurrence of a character in a string bash shell -

i have string this: str="test,test,test,test,test,test" . how can delete nth comma (,) in string str , n between 1 , 5 ? can give suggestion? thank you. $ echo "$str" test,test,test,test,test,test $ sed 's/,//5' <<<"$str" #or echo "$str" |sed 's/,//5' test,test,test,test,testtest

javascript - JS append </a> to <a> -

i cannot append </a> <a> (the second part isn't linked together) can use concatenation showed below. how solve instead of using concatenation? <!doctype html> <html> <head> <meta charset="utf-8"> <title>i'm template</title> </head> <body> <div id="a"></div> <script src="http://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgfzhoseeamdoygbf13fyquitwlaqgxvsngt4=" crossorigin="anonymous"></script> <script> var b = '<a href="#">%data%', c = ' - %data%</a>', d = '1'; // concatenation $("#a").append(b.replace('%data%', d) + c.replace('%data%', d)); $("#a").append('<br>'); // append $("#a").append(b.replace('%data%', d)...

Which Java XML Parsing method to use when rewriting an XML file? -

edited little clarity. i'm writing java application takes xml file , rewrites if information in file needs updated. example of xml file below: <!doctype book public "mydtd.dtd" [ <!entity % ent system "entities.ent"> %ent; ]> <book id="exdoc" label="beta" lang="en"> <title>example document</title> <bookinfo> <authorgroup> <author> <firstname>george</firstname> <surname>washington</surname> </author> <author> <firstname>barbara</firstname> <surname>bush</surname> </author> </authorgroup> <pubsnumber>e12345</pubsnumber> <releaseinfo/> <pubdate>march 2016</pubdate> <copyright> <year>2012, 2016</year> <holder>comp...

reactjs - React transition group - reload same component but swap contents after exit -

so, i've got csstransitiongroup around router switch , has route containing component currentproject inside (among couple others). the transitions working fine, switch. however, if route changed 1 matching currentproject matching currentproject (i.e, different project), enter/exit transition , new project loaded around same time, can see title , content swap on during transition. is there way react-transition-group 'exit' transition, wait content load, then 'enter' transition? are putting location={history.location} param switch tag? necessary holding content in leaving component...

html - How can I style my blockquotes to look like this? -

Image
i'm having trouble finding way add yellow blockquotes quote without indenting/adding unwanted line height. here's i'm trying achieve: here's i've tried: .contentquote { font-family: 'roboto slab', serif; font-size: 20px; } .quote { line-height: color: #003b49; font-size: 2.9em; } <h1 class="contentquote"><span class="quote">&ldquo;</span>in circles, when talk people firm best thinker in (value-based care) area , firm couples actual execution, talk premier...<span class="quote">&rdquo;</span></h1> here's keep getting: any appreciated! you have 3 problems code. first, have accidentally combined line-height , color line-height: color: . don't specify line-height in sample code, i'm guessing line-height typo. if you're using line-height , you'll need separate these out, using semicolon. second, forgot inclu...