Posts

SQL Server : count date with biweekly date -

i having trouble count items biweekly (end @ friday) table like: +------------+------------+ | itemnumber | date | +------------+------------+ | 235 | 2016-03-02 | | 456 | 2016-03-04 | | 454 | 2016-03-08 | | 785 | 2016-03-10 | | 123 | 2016-03-15 | | 543 | 2016-03-18 | | 863 | 2016-03-20 | | 156 | 2016-03-26 | +------------+------------+ result: +-------+------------+ | total | biweek | +-------+------------+ | 4 | 2016-03-11 | | 3 | 2016-03-25 | | 1 | 2016-04-08 | +-------+------------+ if understood problem correctly, should work: select sum(1), dateadd(day, ceiling(datediff(day,4, [date]) / 14.0) * 14, 4) yourtable group dateadd(day, ceiling(datediff(day,4, [date]) / 14.0) * 14, 4) this calculates date difference in days "day 4" aka. 5.1.1900, divides 14 (rounding up) , multiplies 14 biweeks , adds "day 4".

react native - Setting NavigationBar's title asynchronously -

i trying set navigationbar navigator . when display static title, ok. however, when try set title asynchronously (for example when go user's profile route, user's display name api , set this.props.navigation.title when api call promise resolves) title gets jumpy. what proper approach issue? here component (which connected redux store) handles navigationbar : import react 'react-native'; let { component, navigator, view } = react; import {connect} 'react-redux'; let navigationbarroutemapper = { title: (route, navigator, index, navstate) => { return ( <text style={{margintop: 15, fontsize: 18, color: colors.white}}>{this.props.navigation.title}</text> ); } }; class app extends component { render() { return ( <view style={{flex: 1}}> <navigator ref={'navigator'} configurescene={...} ...

python - Finding closest pair of coordinates from a list -

i attempting implement solution previous so question i have pair of coordinates wish find closest associated pair of coordinates in list of coordinates. this can achieved finding pair minimum distance between points: dist = lambda s,d: (s[0]-d[0])**2+(s[1]-d[1])**2 i have dictionary, origin: {u'toid': u'osgb4000000029928750', u'point': [524511.405, 184846.794]} i have list containing pairs of coordinates, d_origins: [(532163.5648939193, 181848.77608212957),(532449.8292416488, 181847.71793660522), (532200.2156880093, 182053.30247829395), (533794.6284605444, 181119.5631480558)] i attempt find match value calling dist lambda function: match = min((origin[0]['point']),key=partial(dist,d_origins)) print origins, match however, output is: typeerror: 'float' object has no attribute '__getitem__' the min function takes list or iterable. additionally ordering can specified function 1 argument. means function map...

class - C++: Derived classes, "no matching constructor" error -

i've been working on assignment while. here's instructions: you design abstract class called employee members given below (make them protected): data members: char *name, long int id two constructors: default constructor // intitialize data memebrs default values , copy constructor methods: setperson (char *n, long int id) //allows user set information each person function called print () // should virtual function, prints data attributes of class. , destructor also define 2 classes derived class employee, called manager , secretary. each class should inherit members base class , has own data members , member functions well. manager should have data member called degree his/her undergraduate degree (e.g. diploma, bachelor, master, doctor), secretary should have contract (can boolean value 1/0 permanent/temporary). all member functions of derived class should overrided base class. write following main() test cl...

java - How to add a JPanel to a JFrame with Runnable method -

when create jpanel , add jframe , add canvas (space) show jpanel , not of graphics. why showing jpanel when want show both of them @ same time? source code: http://pastebin.com/cw9e0a8j if youre intent add canvas inside jpanel try change following lines in source original code : frame.add(p); frame.add(space, borderlayout.center); suggested code : p.add(space); frame.add(p, borderlayout.center); if willing view both jpanel , canvas in jframe try giving positioning canvas also.but different layout better. try out given example. original code : frame.setlayout(new borderlayout()); frame.add(p); frame.add(space, borderlayout.center); suggested code 1 : providing position jpanle in border layout. frame.setlayout(new borderlayout()); frame.add(p, borderlayout.north); frame.add(space, borderlayout.center); suggested code 2 : changing layout of jframe. frame.setlayout(new gridlayout(0,2)); frame.add(p); fra...

How to hide 'Adblock Plus' tab in Chrome DevTools? -

Image
recently noticed adblock plus (v1.11) has added tab chrome devtools. how can hidden or disabled? it looks option has been added disable feature abp options page ( https://issues.adblockplus.org/ticket/3796 ) , available when next version released (likely v1.12). for impatient: someone describes manually modifying extension disable feature here: https://adblockplus.org/forum/viewtopic.php?f=10&t=44378 - go chrome profile - extensions folder - go abp folder: stable abp: cfhdojbkjhnklbpkdaibdccddilifddb dev build: ldcecbkkoecffmfljeihcmifjjdoepkn - rename devtools.js

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot...