Posts

Showing posts from March, 2015

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

python - How does this specific section of code work? -

def add_info_extractor(self, ie): """add infoextractor object end of list.""" self._ies.append(ie) if not isinstance(ie, type): self._ies_instances[ie.ie_key()] = ie ie.set_downloader(self) def get_info_extractor(self, ie_key): """ instance of ie name ie_key, try 1 _ies list, if there's no instance create new 1 , add extractor list. """ ie = self._ies_instances.get(ie_key) if ie none: ie = get_info_extractor(ie_key)() self.add_info_extractor(ie) return ie the following taken popular python repo, youtube-dl. in effor become better programmer cam across section , i'm having trouble understanding it. particularly last method , how not enter infinite recursion if ie_key not found in list. as isinstance comparision in first method. i understand normal implementation effect of: isinstance('hello', str) , how can type() type? wha

c# - OrientDB-NET.binary - Saving Emoji not working -

i'm trying save text contains items such emoji's, e.g. :point_right:. can save same text directly in management ui. don't think database configuration issue, set utf8 correct afaik. believe issue around area string serialized binary transport across wire. thanks in advance darren

How to parallelize nested loops in java 7 (android) -

i have following code snippet string result; (int s1 = 0; s1 < 10; s1++) (int s2 = 0; s2 < 100; s2++) (int s3 = 0; s3 < 10; s3++) (int s4 = 0; s4 < 100; s4++) { result = dosomething(s1, s2, s3, s4); if (result != null) addresult(result); //adds results arraylist of strings } how can parallelize code make faster? i've seen similar posts here parallelizing single loops want evenly parallelize whole thing make run decently on android device. you use asynctask parallelize each of s1 executions, e.g.: for (int s1 = 0; s1 < 10; s1++) { new asynctask<integer, object, arraylist<string>>() { @override protected arraylist<string> doinbackground(integer... params) { arraylist<string> results = new arraylist<>();

python - Given a graph's nodes degree sequence, how do find the distribution? -

if have zachary karate club graph , if make assumption representative of kcs, how use maximum entropy determine probability distribution degree sequence comes from? my goal sample sequence of length l can produce graph karate club of , order of magnitude larger (340 nodes minimum)? a similar question on this one great if can call like: nx.utils.create_degree_sequence(340,karate_club_graph().degree().values)

javascript - jQuery: cropit to remove image data and replace with a new one? -

i'm using cropit.js jquery plugin crop images in browser. plugin website here . the issue have loading images dynamically based on image that's clicked on. the first image loads fine , works perfectly. however, if click on second image or other image, doesn't load onto cropper area , first image gets stuck in cropping area reason. i've tried create fiddle explain think due security reasons, external images wont load using cropit.js. also, jsfiddle wont allow http: url's couldn't fiddle , running. structure of code this: https://jsfiddle.net/hhshgeed/ you have run locally in simple html file images available in same folder html file. also, need include cropit.js well. this entire code: $('.position').live('click', function(){ var img = $(this).attr('src'); alert(img); // re-enables cropper. // opposite `disable` method. $(function() { $('.image-editor').cropit({ imagebackgr

Twitter bootstrap grid issues - Items overflow container when downscaling window size using responsive -

Image
i'm investigating use of twitter bootstrap foundation future web development projects clients. have been through of standard documentation on github page , understanding, use grid layout effectively, rows must contain total of twelve columns (made of different elements or single element). with in mind have conducted small test text spanning 4 columns in row along offset div spanning 6 columns. seems work fine however, have tried include single row contained div spanning 3 columns offset 9 columns (still totalling 12) give impression content within div floated right on page. issue appears fine when window mode suited desktop begin scale window, contents of div pushed out of overall container. if continue scale down window, elements stack expect mobile view. my question is, why behaving in way? understanding long there 12 columns content remain encased within external container. my code can found below. there lots of inline css testing purposes. stock bootstrap options chec

git - Changes on FTP to BitBucket as a commit -

it possible commit changes on ftp? i have subdomain development , want use bitbucket. you can use new bitbucket tool, pipelines! configure new pipeline file: image: samueldebruyn/debian-git pipelines: default: - step: script: - apt-get update - apt-get -qq install git-ftp - git ftp init --user $ftp_username --passwd $ftp_password ftp://server/public_html/ before commit, create environment variables $ ftp_username , $ ftp_password in settings -> environment variables. for push edit source code , change "init" "push" , commit replace file on shared server. for more information watch video: https://www.youtube.com/watch?v=8hzhhtzebdw

c++ - Default constructor with empty brackets -

is there reason empty set of round brackets (parentheses) isn't valid calling default constructor in c++? myobject object; // ok - default ctor myobject object(blah); // ok myobject object(); // error i seem type "()" automatically everytime. there reason isn't allowed? most vexing parse this related known "c++'s vexing parse". basically, can interpreted compiler declaration interpreted declaration. another instance of same problem: std::ifstream ifs("file.txt"); std::vector<t> v(std::istream_iterator<t>(ifs), std::istream_iterator<t>()); v interpreted declaration of function 2 parameters. the workaround add pair of parentheses: std::vector<t> v((std::istream_iterator<t>(ifs)), std::istream_iterator<t>()); or, if have c++11 , list-initialization (also known uniform initialization) available: std::vector<t> v{std::istream_iterator<t>{ifs}, std::istream_iterat

android - How do i use relativelayout as header to listview -

i have simple app allows users top post messages others can comment on.i have 2 activities mainactivity , commentactivity.on mainactivity when user clicks on post on list view intent intent = new intent(mainactivity.this, commentactivity.class); intent.putextra("appid", post.getobjectid()); intent.putextra("username", post.getuser().getusername()); intent.putextra("text", post.gettext()); intent.putextra("vote",integer.tostring(post.getvote())); intent.putextra("timestamp",long.tostring(post.gettimestamp())); startactivity(intent); on comment activity retrieve string username = intent.getstringextra("username"); string text = intent.getstringextra("text"); post_id = intent.getstringextra("appid"); string sum = intent.getstringextra("vote"); string time = intent.getstringextra("timestamp"); and displays them on relative layout above listview. want rel

python - Pyinstaller 3.1.1 no --exclude-module option -

i have little problem pyinstaller, version 3.1.1. i'm using python 3.4 (anaconda). need compile project excluding pyqt5 , matplotlib pyinstaller --onefile --icon=project.ico --exclude-module=pyqt5 --exclude-module=matplotlib project.py but when try use "--exclude-module" following error message: usage: pyinstaller-script.py [opts] <scriptname> [ <scriptname> ...] | <specfile> pyinstaller-script.py: error: no such option: --exclude-module did make mistake in writing command? any welcome. edit: problem version of pyinstaller using. donwloaded development branche github. installed stable version pyinstaller.org , working fine... @ least --exclude-module instruction.

Javascript RegExp to match user ID pattern -

i using c# code below detect if string formatted e123456, h123456 or t123456. regex(@"\b[eht]\d{6}") i trying use javascript equivalent having difficulties. so far have, it's returning false each time when should returning true. regexp("\b[eht]\d{6}") any appreciated, or link regexp formatting. i believe issue having due fact when using regexp constructor string argument, special characters such slashes , quotation marks must escaped backslash character. also, use i flag if want allow both upper , lower case matches. to make regexp constructor method, use: new regexp("\\b[eht]\\d{6}", "i") or make regexp literal, go with: var regexname = /\b[eht]\d{6}/i also, if want experiment more regex's in javascript, http://regexr.com/ wonderful site highly recommend!

how to check if process is running or not every 10mins for one hour using shell -

e.g. process name test. if use below ps -ef | grep test see process running. want check every 10mins 1 hour , print success if it's running 1 hour. best way so? put command shell script, , if process running when shell script ran print "success". add cron job runs every 10 minutes: */10 * * * * /path/to/scriptorcommand

ios - Present UINavigationController from anywhere in view hierarchy? -

you'll note ton of people have written articles describing difficulty navigation controllers, , getting message "tried present xyz on abc view not in view hierarchy" well, i'm having ton of similar issues, , suspect has trying present navigation controller ol' arbitrary view controller in view hierarchy, precisely i'm trying do. as best can tell, every example i've found demonstrates using uinavigationcontroller, uses root view controller below window, , frustrating part no 1 makes clear whether in fact way can use uinavigationcontroller, or whether can use depth want in hierarchy , have work fine. in case, i'm getting dreaded "view not in hierarchy" message well, , want know, true uinavigationcontroller must , used root of entire view hierarchy. if that's not true, how can use arbitrary depth in hierarchy, because i'm not doing right, lol.

Loopback.js/Node.js MongoDB - querying against an array -

i have structure looks this: model: { "name":"testing", "details":["detail1","detail2","detail10"] } how 1 go finding instances above structure contains instance of detail2 within details property ? i've tried: model.find({where:{details:{elemmatch:{"detail2"}}}},function(err,models){ console.log(models); console.log(err); }); and: model.find({details:"detail2"},function(err, models){ //throws [error: items must array: "details2"] }); from can see (based on comment engineering, https://github.com/strongloop/loopback-datasource-juggler/issues/342#issuecomment-73138705 ), not possible filter this. need objects , post process. in theory build own remote method , filtering on server aren't doing server-side.

python - Communicate with process send key in subprocess linux -

i have 1 sh file, need install in target linux box. i'm in process of writing automatic installation sh file required lot of input user. example, first thing made ./file.sh show big paragaraph , ask user press enter . i'm stuck in place. how send key data sub process. here i've tried. import subprocess def runprocess(exe): global p p = subprocess.popen(exe, stdout=subprocess.pipe, stderr=subprocess.stdout) while(true): retcode = p.poll() #returns none while subprocess running line = p.stdout.readline() yield line if(retcode not none): break line in runprocess('./file.sh'.split()): if '[enter]' in line: print line + 'got it' p.communicate('\r') correct me if understanding wrong, pardon me if duplicate. if need send bunch of newlines , nothing else, need to: make sure stdin popen pipe send newlines without causing deadlock your current code neither. mig

c# - How to select next enum value ? -

this question has answer here: how next (or previous) enum value in c# 20 answers i've c# enum type: private enum dayname { monday=1, tuesday=2 ... sunday=7 }; private dayname today ; today = dayname.friday; how like: today ++ ; print(today) -> and "saturday" ? well first set today = dayname.friday , print(today.tostring() after today ++ ; as descirbed @ post, enum string name value

c# - ASP Net - using LoginView without Membership -

well, i want know how can use loginview asp, when use own method of authentication, in topic . here follow loginview mark: <asp:loginview runat="server" viewstatemode="disabled"> <anonymoustemplate> <ul class="nav navbar-nav navbar-right"> <li><a runat="server" href="~/account/register">register</a></li> <li><a runat="server" href="~/account/login">log in</a></li> </ul> </anonymoustemplate> <loggedintemplate> <ul class="nav navbar-nav navbar-right"> <li> <a runat="server" href="~/account/manage" title="manage account">hello, <%: context.user.identity.getusername() %> !</a> </li> <li> <asp:loginstatus runat="s

google maps - Each API works individually, but together they don't -

when using location google autocompletion api code before </body> , works: <script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"></script> <script> var input = document.getelementbyid('where'); var autocomplete = new google.maps.places.autocomplete(input); </script> when using google map api code before </body> , works : <script src="https://maps.googleapis.com/maps/api/js" async defer></script> <script> function initmap() { var mylatlng = {lat: 47.901773, lng: 1.905062}; var map = new google.maps.map(document.getelementbyid('map'), { center: mylatlng, scrollwheel: false, zoom: 12 }); var marker = new google.maps.marker({map: map, position: mylatlng, title: 'hello world!'}); } </script> <script src="https://maps.googleapis.com/maps/api/js?callback=initmap" async defer></script> but when using both of

jquery - Lightbox For Youtube Videos -

i'm using lightbox play video when image clicked. can't find tutorial followed of right works perfectly. here example of code i'm using: <a href="https://www.youtube.com/watch?v=e5ln4ur4twq?rel=0" data-toggle="lightbox" data-gallery="youtubevideos"> <img src="/img/placeholder.png" alt="pet-owners" width="1600" height="420" class="aligncenter size-full wp-image-23442" /> </a> the problem i'm having when video on recommended videos displays. i've been reading have add ?rel=0 end of youtube link , should fix it. realized since method doesn't embed video won't work. ideas should next? sorry didn't set jsfiddle wasn't sure how load lightbox css , js. i'm using boostrap 3 . thank you.

floating point - Why denormalized floats are so much slower than other floats, from hardware architecture viewpoint? -

denormals known underperform severely, 100x or so, compared normals. causes unexpected software problems . i'm curious, cpu architecture viewpoint, why denormals have that much slower? lack of performance intrinsic unfortunate representation? or maybe cpu architects neglect them reduce hardware cost under (mistaken) assumption denormals don't matter? in former case, if denormals intrinsically hardware-unfriendly, there known non-ieee-754 floating point representations gapless near zero, more convenient hardware implementation? on x86 systems, cause of slowness denormal values trigger fp_assist costly switches micro-code flow (very fault). see example - https://software.intel.com/en-us/forums/intel-performance-bottleneck-analyzer/topic/487262 the reason why case, architects decided optimize hw normal values speculating each value normalized (which more common), , did not want risk performance of frequent use case sake of rare corner cases. speculation t

c# - Windows Phone 8.1 access file in Documents folder -

Image
i'm new windows phone development, , not using silverlight or wpf. copy file "links.txt" windows phone folder @ "\documents\" , want access , content in file, i'm getting access denied error. click on package.appxmanifest file select "capabilities" tab, don't see "documents library access" me check it. matter fact don't see "... library access" showing. below code: string filename = "\\documents\\links.txt"; string parentpath = applicationdata.current.localfolder.path; string filepath = path.combine(parentpath, filename); storagefile file = await storagefile.getfilefrompathasync(filepath); any suggestion how can read file? thanks. updates: it seems code above not work, when using code below , change folder "music" instead of "documents" check capabilities "musiclibrary", it's working. var folder = knownfolders.musiclibrary; var file = await folder.getfileas

sql server - How to fill previous record and on conditional based? -

Image
i have following data in table i.e. no, date , step +---------+----------------------------+----------------------------+ | no | date | step | +---------+----------------------------+----------------------------+ | 643995g | 03/12/2012 3:22:48 pm | transferinstart | | 643995g | 03/12/2012 3:22:50 pm | | | 643995g | 15/02/2013 10:53:57 | hold | | 643995g | 15/02/2013 10:54:00 | hold copy processing start | | 643995g | 20/02/2013 4:38:26 pm | | | 643995g | 21/02/2013 3:27:01 pm | exceptionstart | | 643995g | 22/02/2013 9:38:32 | exceptionend | | 643995g | 22/02/2013 9:39:32 | | | 643995g | 22/02/2013 10:04:53 | | | 643995g | 22/02/2013 10:04:56 | | | 643995g | 25/02/2013 10:48:18 | transferin

Powershell: unexpected return value from function, use of $args to access parameters -

ok, have coded quite while in different, not getting powershells concept of function return?.... i new powershell, sure missing basic. i have function below: function plgetkeyvalue ([string] $filename, [string] $sectionname, [string] $key) { if ($psboundparameters.count -lt 2 -or $psboundparameters.count -gt 3 ) { "invalid call {0} in {1}" -f $myinvocation.mycommand.name, $myinvocation.mycommand.modulename return } # declaration $lfilecontents = "" $lsections = "" $ldatastart = "" $lstart = -1 $lend = -1 $lfoundsection = "" $lnextsection = "" $lresults = "" $lretvalue = "" # handle optional parameter. if ( $psboundparameters.count -eq 2 ) { $psboundparameters.add('key', $sectionname) $psboundparameters.remove(&

javascript - jQuery - After refreshing the page doesn't work -

at moment, learning how write in javascript , jquery. however, wrote simple jquery code when enter page/website automatically scrolls specific div. script working fine when loading page/website , automatically scrolls div want. problem coming when refreshing browser. after refreshed page script doesn't want scroll div pointed in code. if me grateful , thank in advance. on chrome , opera script working after refresh made. however, cannot same firefox, ie , edge. $(document).ready(function() { $(".left_container").animate({ scrolltop: $(".home_left").offset().top }, 0); }); ps: using "left_container" instead of "html,body" because want scroll in particular div. best regards, george s. some browsers save scroll position after page reloads it's not problem of code. what can force browser instantly scroll top , animate div this: $(document).ready(function() { $(".left_container").scrollto

#inf c++ visual studio -

i came across question in calculating sum of double. when set iteration 100000, function asian_call_mc still return number. however, when set iteration around 500000 , above, begin return 1.#inf. can tell me why happens , how solve it? using visual studio 2013 write c++ code. double avg_price(double init_p, double impl_vol, double drift, int step, double deltasqrt) { //calculate average price of 1 sample path //delta = t/ step //drift = (risk_free - div_y - impl_vol*impl_vol / 2)*(t / step) double sa = 0.0; double st = init_p; (int = 0; < step; i++) { st = st*exp(drift + impl_vol*deltasqrt*normal_gen()); //sa = sa * / (i + 1) + st / (i + 1); sa += st; } sa = sa / double(step); return sa; } double asian_call_mc(double strike_p, double t, double init_p, double impl_vol, double risk_free, double div_y, int iter, int step) { //calculate constants in advance reduce computation time double drift = (risk_free - div_y - impl_vol*impl_vol / 2)*double(t / step); double d

unix - How to check if a number is an integer in Pari/GP? -

i'm trying write if statement this if(denominator([(i-1)! + 1] / i)-1,print(hi),print(ho)) i can integer example 10, when set i 10 gives error. ? [(x-1)! + 1] / x *** should integer: [(x-1)!+1]/x ^----------- i need check if [(x-1)! + 1] / x integer or not denominator thing came with, tried mod couldn't working either. it seems confused names x , i . please, see expression below works properly: i = 10; print([(i-1)! + 1] / i); gp > [362881/10]

php - Edit a css file from the live website -

so want develop mini website builder within website. have control panel users can edit text in websites, want each of html pages have own css file attached it. now, want user sees button saying "edit background color" prompted color picker , on hitting save, css file updated without them knowing css exists. i know language can use make previous example happen. , if possible hint of code. i appreciate answers, braulio :) i didn't downvote informational purposes, reason downvoted due scope of question, language choose depends on platform running site on. , possible want in tons of different languages assuming platform supports them. easy solution check out .net languages c# ajax controls live updates without refreshes. again use ruby rails. or of in client side jquery , javascript send results server utilize php. broad question answer without writing whole thing nobody going do.

swift - ios: why it call deinit immediately -

today faced problem , vc never call deinit, added weak func showaddcityviewcontroller() { weak var vc:swaddcityviewcontroller! vc = swaddcityviewcontroller() vc.delegate = self let nav = uinavigationcontroller(rootviewcontroller: vc) dispatch_async(dispatch_get_main_queue(), { self.presentvc(nav) }) } i run function , fatal error: unexpectedly found nil while unwrapping optional value the vc go nil ,but don't know why , should make code happy? you wrote this: weak var vc:swaddcityviewcontroller! vc = swaddcityviewcontroller() the vc variable “implicitly unwrapped optional”, means can either point existing (not-deallocated) object, or can nil. you create new swaddcityviewcontroller object , assign vc . after assignment statement completes, there 1 weak reference new object (in vc ) , there no strong references it. object deallocated has no strong references, deallocated assignm

Calculating intersection of lots of sets in R -

i've got long list of authors , words like author1,word1 author1,word2 author1,word3 author2,word2 author3,word1 the actual list has hundreds of authors , thousands of words. exists csv file have read dataframe , de-duplicated like > typeof(x) [1] "list" > colnames(x) [1] "author" "word" the last bit of dput(head(x)) looks like ), class = "factor")), .names = c("author", "word"), row.names = c(na, 6l), class = "data.frame") what i'm trying calculate how similar word lists between authors based on intersection of author's wordlists percentage of 1 authors total vocabulary. (i'm sure there proper terms i'm doing don't quite know are.) in python or perl group words author , use nested loops compare everyone else i'm wondering how in r? have feeling "use apply" going answer- if can please explain in small words newbies me?

javascript - removeAttr from multiple classes -

is possible use removeattr multiple classes , ids ? not find that. smth dont work $('.one.two.six.eleven#box').removeattr("style"); nor this $(".one.two.three#smth.seven").css("transition", "3s"); i cant manage use removeattr on multiple classes , id's not children of each other :). i cant manage add css() many free classes in window , every has own parameters there bind deal of them. in fiddle have basic works me long many lines. seems awfull. thank answers. i placed jsfiddle show mess made want 'dry' , 'lim'. fiddle fork on... new edit explanation function some_func() { $(".some").removeattr("style"); $(".thing").css("transition", "3s"); $(".right").removeattr("style"); $(".right").css("transition", "3s"); $(".left").removeattr("style"); $

r - Get 1st Friday of every month and subsequent day (merging xts objects) -

i have xts object hourly prices, , want @ price behavior after non farm payrolls (nfp) economic releases. nfp take place on first friday of every month. want create subset prices first friday of every month , monday after. achieve looked @ question get 4th wednesday of each november in r , put following code: library(xts) datsxts <- structure(c(1069.4, 1070.7, 1070.4, 1070.3, 1068.7, 1068.7, 1069.4, 1069.7, 1069.5, 1068.1, 1069.3, 1069.2, 1069.3, 1070.7, 1070.9, 1070.7, 1070.8, 1070.5, 1070.5, 1069.7, 1068.9, 1070.2, 1067.3, 1067.8, 1067.9, 1061.7, 1060.8, 1061.7, 1060.9, 1060.2, 1060.9, 1061, 1060.3, 1061.2, 1061.9, 1062, 1061.9, 1062.5, 1062.3, 1062.3, 1062, 1062.7, 1063, 1062, 1062.6, 1062.4, 1061.8, 1058.9, 1061.5, 1062.4, 1061.4, 1060.9, 1062, 1060.6, 1059.4, 1060.5, 1061.3, 1063.1, 1064.6, 1063.5, 1064.3, 1063.7, 1065.3, 1068.7, 1069.8, 1071.3, 1072.8, 1073.8, 1072.9, 1072.7, 1072.6, 1078.8, 1080.6, 1078.2, 1073.7, 1076.4, 1075.2, 1075.4, 1075.4, 1074.7, 1073.2