Posts

Showing posts from February, 2013

python - Pandas: Repeat function for current keyword if except -

i have built web scraper. program enters searchterm searchbox , grabs results. pandas goes through spreadsheet line-by-line in column retrieve each searchterm. sometimes page doesn't load properly, prompting refresh. i need way repeat function , try same searchterm if fails. right now, if return , go on next line in spreadsheet. import pandas pd selenium import webdriver selenium.webdriver.common.keys import keys df = pd.read_csv(searchterms.csv, delimiter=",") def scrape(searchterm): #loads url searchbox = driver.find_element_by_name("searchbox") searchbox.clear() searchbox.send_keys(searchterm) print "searching %s ..." % searchterm no_result = true while no_result true: try: #find results, grab them no_result = false except: #refresh page , above again current searchterm - how? driver.refresh() return pd.series([col1, col2]) df[["colum

mysql - STR_TO_DATE returns blob value -

Image
this question has answer here: phpmyadmin: date fields display blob 1 answer i don't understand why mysql returns blob value here : select dat_real, str_to_date(dat_real, '%d-%m-%y') `entretiens` dat_real <> '' from phpmyadmin : clicking on blob link leads me page saying request = select str_to_date(dat_real, '%d-%m-%y') 'entretiens' 'entretiens'.'dat_real' = '02-09-2010' , .'str_to_date(dat_real, '%d-%m-%y')' = '2010-09-02'; type of dat_real varchar(12) please specify data type of "dat_real" field. , please ensure must string, since str_to_date accepts first parameter date in string format.

Makefile: Save a variable during execution time -

i'm using makefiles "make" lot of things starting / stopping / configuring services i've written. i'd read input user. ways know either make user pass input name=value when executing make, or putting command read -p "setting x: " var ; echo $$var makefile. name=value has disadvantage user must manually set , can't "ask" him enter value. read has disadvantage read value can not (or don't know how) saved in variable , can't used multiple times. is there way read user input variable during executing specific makefile target? (i don't want put file ?= 'read -p "value: " var ; echo $$var' in header because value needed 1 target, , when put line in target itself, error "/bin/bash: file: command not found. ". i use intermediate files purpose. input = dialog --inputbox 80 10 10 all: case1 case2 case1: read-input echo $(shell cat read-input) in case 1 case2: read-input echo $(s

java - Spring @Scheduled annotation -

how can use @scheduled annotation of spring dynamically? crontrigger(string expression, timezone timezone) http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/crontrigger.html#crontrigger-java.lang.string-java.util.timezone- as have multiple timezones in database, how can pass them dynamically? i tried in code: timezone timezone = null; string timezone1 = null; public schedulerbean(string timezone2) { this.timezone1 = timezone2; //constructor } @scheduled(cron="0 0 8 * * ?", zone =timezone.gettimezone(timezone1) ) //error @ line public void sendquestionnotif() { //......code } here error getting, *type mismatch: cannot convert timezone string* please me. because want trigger cron based on timezones . tia. annotation parameters cannot set dynamically. can programmatically, this class scheduler implements runnable { public scheduler(taskscheduler scheduler, string timezone, string cron) {

Find a list of strings across a data table in R -

i have vector of strings (candidates), each of want find within data table (fbgn_dmels), , return first column entry if match found within row (e.g. cg2175 should return "1-dec"). > head(candidates) [1] "cg2175" "cg31196" "cg3169" "cg15168" "cg2252" "cg2019" > fbgn_dmels v1_01 v1_02 v1_03 v1_04 v1_05 v1_06 v1_07 v1_08 v1_09 v1_10 v1_11 v1_12 v1_13 v1_14 1: 1-dec fbgn0000427 fbgn0000645 cg2175 na na na na na na na na na na 2: 1-sep fbgn0011710 fbgn0005665 fbgn0013404 fbgn0014082 fbgn0024226 cg1403 na na na na na na na 3: 128up fbgn0010339 fbgn0010196 cg8340 na na na na na na na na na na 4: 14-3-3epsilon fbgn0020238 fbgn0011329

Chrome extension maximum message length -

Image
i'm using google chrome notification api. question simple , short, possible change maximum length of message in notification? example if question wasn't clear: that's notification options: var options = { type: "basic", title: title, message: text, iconurl: "152.png" } in case text = "time t oast toastt oastt oasttoas ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast toastt oasttoa sttoastto astto ast oasttoasttoasttoa sttoasttoast toastt oastto asttoastto asttoast toastt oast." it's example as can see notifications api cut @ middle , added 3 dots: so question is, can make notification show full message , not cut @ middle? i've read few tutorials , saw there called expandedmessage , doesn't appear in api document

c++ - Passing matrix to a function -

i getting error when calling 'printmat' function. requirement create matrix after accepting number of rows , columns, , take input matrix, call printmat sending matrix , print elements. error follows: error: parameter 'a' includes pointer array of unknown bo und 'int []' #include<iostream> using namespace std; int row,col; void printmat(int* a[]) { for(int i=0; i<row; ++i) { for(int j=0; j<col; ++j) { cout<<a[i][j]<<" "; } } } int main() { cin>>row; cin>>col; int mat[row][col]; for(int i=0; i<row; ++i) { for(int j=0; j<col; ++j) { cin>>mat[i][j]; } } printmat(mat); return 0; } int* a[] is array of pointer, passing pointer array: int (*a)[]

sql - Extract string between period delimiter -

i need extract p4534 string below in sql. length between 2 periods can change. need account longer strings between 2 periods when doing substring. how can start @ different position? <?xml version="1.0" encoding="utf-8"?><mydata>9.9.p4534.2.3</mydata> the at() function returns integer indicating position of first character character expression. store '9.9.p4534.2.3' gcstring store 'p4534' gcfindstring substring(gcstring, at(gcfindstring,gcstring), 5)

android - Reading sensor data from two phones simultaneously in Matlab -

i want connect 2 or more mobile devices matlab. right able connect both android phone , iphone; however, unable distinguish between them. use code connect: connector on password; m = mobiledev; is there way can store 2 1x1 mobildev's , gather data them simultaneously?

F# Subtype Discriminated Unions -

i have du this: type food = | beer | bacon | apple | cherry i want add characteristic du flag if food fruit or not. first thought of this: type nonfruit = nonfruit type fruit = fruit type food = | beer of nonfruit | bacon of nonfruit | apple of fruit | cherry of fruit and method this: let fruitchecker (myfood:food) = match myfood | :? nonfruit -> "no" | :? fruit -> "yes" but compiler yelling @ me: the type 'food' not have proper subtypes , cannot used source am approaching problem incorrectly? thanks or, use active patterns: https://msdn.microsoft.com/en-us/library/dd233248.aspx type food = | beer | bacon | apple | cherry let (|nonfruit|fruit|) = function | beer | bacon -> nonfruit | apple | cherry -> fruit let fruitchecker = function | nonfruit -> "no" | fruit -> "yes" [beer;bacon;apple;cherry] |> list.iter(fun x -> printfn "%s" (fruitch

RequestAsyncTask of Facebook sdk not working for posting video in android -

{ request request = null; requestasynctask task = null ; bundle requestparams requestparams=new bundle(); byte[] data = downloadurl(new url("urltodownload")); requestparams.putbytearray("video", data); requestparams.putstring("title", "video post"); requestparams.putstring("description", " #sometag"); request = new request(session.getactivesession(),"me/videos" , requestparams, httpmethod.post,new request.callback() { @override public void oncompleted(response response) { //applink=null; if (response.geterror() == null) { logs.e(debug_facebook_publish, "publish success");

hadoop - How do I flatten nested Avro records in a Pig query? -

avro schema looks this: { "type" : "record", "name" : "name1", "fields" : [ { "name" : "f1", "type" : "string" }, { "name" : "f2", "type" : { "type" : "array", "items" : { "type" : "record", "name" : "name2", "fields" : [ { "name" : "time", "type" : [ "float", "int", "double", "long" ] }, ] } } } ] } after reading in pig: grunt> = load 'data' using avrostorage(); grunt> describe a; a: {f1: chararray,f2: {array_elem: (time: (float: float,int: int,double: double,long: long))}} what want bag of (f1:chararr

How to open a web page in different div/frame using html? -

this question has answer here: how open google links inside iframe? 2 answers i have webpage has 3 frames, , want is, while clicking button of frame 1, want open web page in frame 2 area. is possible? if yes how achieve that? , if no can div? see below code <body> <a href="http:/www.google.com/" target="demo">click me</a> </body> in above code "demo" id of 'frame'. as per understanding "google.com" page should open in frame has id "demo" here not happening. can help? thanks in advance google has server-side code stops other websites opening http://www.google.com/ in iframe. it's stop people doing malicious purposes. change url different ( http://www.example.com/ ) , see if works.

ios - How create a Flip effect for SKSpriteNode in swift -

i want create flip effect in swift skspritenode effect . try solution before horizontal rotation can see vertical rotation. want horizontal rotation in example html/css. solution flip skspritenode : func fliptile(node : rectsprite){ let flip = skaction.scalexto(-1, duration: 0.4) node.setscale(1.0) var changecolor = skaction.runblock( { node.texture = sktexture(imagenamed: "blue")}) var action = skaction.sequence([flip, changecolor] ) node.runaction(action) }

Building openwrt on centos7 -

i trying build openwrt on centos7(64bits) using command make , giving error svn: /home/shwetha/openwrt/trunk/staging_dir/host/lib/liblzma.so.5: no version information available (required /lib64/libselinux.so.1) i tried changing configurations giving same error: /home/shwetha/openwrt/trunk/staging_dir/host/lib/liblzma.so.5: no version information available (required /lib64/libselinux.so.1) /lib64/libselinux.so.1: undefined reference 'lzma_code@xz_5.0' /lib64/libselinux.so.1: undefined reference 'lzma_stream_decoder@xz_5.0' /lib64/libselinux.so.1: undefined reference 'lzma_end@xz_5.0' this has been fixed 2 week ago in openwrt trunk , cc, see this: https://dev.openwrt.org/changeset/46603 you have update more recent trunk or cc version, or manually update xz in tools directory version 5.2.1, example cherry-picking commit mentioned.

meteor - Why is this MongoDB selector not working? -

i have simpleschema attached meteor.users following property: tags: { type: [object], label: "tags", optional: true, } }, 'tags.$.name' : { type: string, }, 'tags.$.correct' : { type: number, }, 'tags.$.wrong' : { type: number, }, and have created user single "tag" object "tags" : [ { "name" : "history", "correct" : 0, "wrong" : 1 }, ] but when make call meteor.users.findone({ 'tags.$.name' : "history" }); it returns undefined . know doing wrong? thank helping. has been stalling me days. =\ you need specify fields option in findone statement. this worked me: meteor.users.findone({ 'tags.name': "history" }, { fields: {'tags.$': 1} });

ant - Nutch 2.2.1, Hbase 0.90.4 and Hadoop 1.2.1 session timeout -

i followed tutorial , stuck when tried inject urls nutch hadoop. configured nutch files tutorial copying hadoop conf files nutch conf directory. when tried run ant runtime configured files according first tutorial, did not work. ubuntu@ip-172-31-35-238:~/apache-nutch-2.2.1/runtime/deploy$ bin/nutch inject urls warning: $hadoop_home deprecated. 15/07/27 12:01:07 info crawl.injectorjob: injectorjob: starting @ 2015-07-27 12:01:07 15/07/27 12:01:07 info crawl.injectorjob: injectorjob: injecting urldir: urls 15/07/27 12:01:10 info zookeeper.zookeeper: client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 gmt 15/07/27 12:01:10 info zookeeper.zookeeper: client environment:host.name=master 15/07/27 12:01:10 info zookeeper.zookeeper: client environment:java.version=1.6.0_45 15/07/27 12:01:10 info zookeeper.zookeeper: client environment:java.vendor=sun microsystems inc. 15/07/27 12:01:10 info zookeeper.zookeeper: client environment:java.home=/usr/lib/jvm/java-6-

html - How to align this logo center using bootstrap? -

Image
i have page: link i want align , center logo in picture below code html: <span class="logo"> <a href="http://dizievents.ch"><img src="http://dizievents.ch/wp-content/uploads/2015/07/dizi-events-3.png" alt="logo"></a> </span> i tried replace code following <span class="img-responsive center-block"> <a href="http://dizievents.ch"><img src="http://dizievents.ch/wp-content/uploads/2015/07/dizi-events-3.png" alt="logo"></a> </span> can tell me please wrong , not work? it's simple (i think) realize problem thanks in advance! use inbuilt twitter bootstrap class col-md-offset-6 align logo. if need including centering in smaller devices, replace md xs or sm <span class="logo col-md-offset-6"> <a href="http://dizievents.ch"><img src="http://dizievents.c

javascript - Regex to filter out certain characters -

what regex string if provided random string such : "u23ntfb23nnfj3mimowmndnwm8" and wanted filter out characters such 2, b, j, d, g, k , 8? so in case, function return '2bjd8' . there's lot of literature on internet nothing straight point. shouldn't hard create regex filter string right? ps. not homework cool daft punk you need create regular expression , execute on string. this need : var str = "u23ntfb23nnfj3mimowmndnwm8"; var re = /[2bjd8]+/g; alert(str.match(re).join('')); to matches use string.prototype.match() regex. it give following matches in output: 2 b2 j d 8

specify what files from the repository are included in master.zip when using the "Download ZIP" link on GitHub -

is possible specify files included or not included in zip file when use "download zip" link in repository? or need make own? you need make own: github api exposes archive link , without customization. you tarball or zipball archive full repository, not subset.

java - Error with an If Statement within a GUI (Always falls into ELSE never IF) -

this question has answer here: how compare strings in java? 23 answers i'm making basic login prompt gui revision java exam next week (this exercise possibly come in exam that's why i'm trying ace first). when type in name, in case 'joe' it'll verified, otherwise it'll unverified. however, when type in joe it'll still unverified. can see i've gone wrong? thanks. package gui.eventhandler; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jpanel; import javax.swing.jtextfield; public class eventhandlerexample2_nameconfirmation { private jframe frame; private jpanel panel; private jbutton button1; private jlabel label; private jtextfield fname; public eventhandlerexample2_n

javascript - Spy on function that's called on click event -

what doing wrong? trying spy on function get's called on elements click event test returns false. spec: describe('button', function() { before(function() { this.spy = sinon.spy(window, 'testmethod'); }); it('should call testmethod', function() { $('#testbtn').click(); expect(this.spy.called).to.equal(true); }); }); js: $('#testbtn').on('click', testmethod); function testmethod() { return true; } the problem due fact line: $('#testbtn').on('click', testmethod); grabs reference testmethod before spy set. grabs reference original function, not spy, , not matter set spy on window.testmethod because function called on click event going original testmethod . have few options test work: run $('#testbtn').on('click', testmethod); after set spy. instance, put in before hook. change $('#testbtn').on('click', testmethod); $('#testbtn&#

javascript - Is there any point in a JS file that has no functions? -

i've got olapic's api in front of me, , looks this: <script src="https://olapic_source.net" data-olapic="olapic_specific_widget" data-instance="213598612346580671235" data-apikey="081274081760283650812734612" data-tags="product_id" async="async"> </script> i'm keeping js out of html files wherever possible. i'm wondering if there reason put in own file, versus putting right on page. the requirement script located inside of div class called "olapic_specific_widget" so essentially <div class="olapic_specific_widget"> <script src="path/to/external/file.js" type="text/javascript"> </script> </div> which tidier <div class="olapic_specific_widget"> <script src="https://olapic_source.net" data-olapic="olapic_specific_widget"

android - Google Map V21, how to programatically stop the automatic location updates? -

hello using support map fragment android map. other using default settings (no customisation), noticed out of box map seems provide location updates automatically i.e. dot on map tells user , periodically updates. my map fragment apart of layout whereby map fragment visibility can set gone , other content shown in place. my question is, how programmatically stop these location updates? noticed when activity hosts map fragment goes in stop state, location updates stop. this behaviour want mimic when visibility of fragment changes. in xml <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.supportmapfragment" /> initialised in code supportmapfragment mapfragment = ((supportmapfragment) getchildfragmentmanager().findfragmentbyid(r.id.map)); mapfragment.getmapasync(this); some settings set

How to make clang stop before a specified LLVM pass and dump the LLVM IR -

how run clang , have stop before pass, loop-vectorize , , dump ir .ll file can later fed opt ? opt has -stop-after= option, clang seems missing equivalent option. here failed attempt clang 3.7.0rc2: $ ../build/bin/clang -o2 -mllvm -stop-after=loop-vectorize a.cpp clang (llvm option parsing): unknown command line argument '-stop-after=loop-vectorize'. try: 'clang (llvm option parsing) -help' clang (llvm option parsing): did mean '-print-after=loop-vectorize'? i've tried running clang -o0 -emit-llvm -s , running opt -o2 , results different running clang -o2 directly. i'm not aware of way stop after specific pass when compiling clang , instead can offer helpful alternative. first, address opt , clang producing different ir files, may helpful compare pass lists clang -o2 , opt -o2 manually. can done both passing -debug-pass=arguments . when running clang need -mllvm pass argument along. having done myself appears different

jquery - Fullcalendar (angular) disable/hide dates out of range -

i disable (preferably) or hide (less preferably) dates outside contract timespan. let's contract runs 1 through 31 july, want have other days disabled or hidden. i've managed gray cells out, problem being cells still selectable! here's issue edit: here's snippet of code i've tried (disable day render if date out of range) $scope.dayrender = function (date, cell) { if (moment(date) > $scope.settings.contractend || moment(date) < $scope.settings.contractstart) { return false; } };

python - How to format errorbars in matplotlib -

Image
i importing data file pandas dataframe , want graph data errorbars. here code: y = df['pp04-o3n2snpos log(o/h)+12'] - df['nuclear metallicity'] yerr = np.array([df['negative error!'],df['positive error!']]).t x = df['ned calculated virgo infall distance in kpc'] plt.errorbar(x,y,yerr,fmt = 'r^') plt.xlabel('distance center in kpc') plt.ylabel('pp04-o3n2snpos log(o/h)+12') plt.title('central metallicity vs sn metallicity') plt.show() however, graph looks as can see, format of errorbars on graph messed up. i'm not sure why isn't plotting normal errorbars, instead lines randomly placed. your problem shape of yerr array. documentation says array should nx1 array or 2xn array. yerr array has nx2 shape. replace second line with # create 2xn array error bars yerr = np.array([df['negative error!'],df['positive error!']]) and should ok

How to deploy a simple static micro site on Microsoft Azure -

i plan move websites own baremetal server microsoft azure. things started want poc , deploy simple static microsite - single html page css/img/js resources. how 1 go deploy simple static website? can see options simple cms type sites, nothing basic of sites. while there several options mentioned brents answer (and comments), find 1 simple option easiest. create website azure portal. go to: https://{sitename}.scm.azurewebsites.net/debugconsole navigate to: site/wwwroot drag drop files (html/js/css/...). done (browse http://{sitename}.azurewebsites.net/ see site). note: can edit files view.

php - htaccess URL manipulation -

we have multilingual wordpress site passes parameter end of page's friendly url display translated version of page, somewhere along line update 1 of plugins causing parameter inserted in middle of url so... http://www.example.com/?lang=es/about-us/our-team/ ...whereas actual url should be... http://www.example.com/about-us/our-team/?lang=es there many urls affected, share same pattern (protocol://domain/parameter/page/category). knowing this, possible fix urls matching pattern, remove parameter middle of url , place on end of url belongs? i know fixing underlying problem ideal solution, great if have "working" website in meantime. [edit:] possible change order of url through use of htaccess rule?

php - XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page -

i've downloaded , installed xampp 5.6.11 , started tools control panel. i've seen 1 of it's new features has welcome/dashboard page. previously, going 127.0.0.1 take me language selection page , orange-yellow page configure xampp. now, going 127.0.0.1 or hitting apache's "admin" button in xampp control panel takes me dashboard/welcome page no matter what. one curious thing: attempting go http://localhost/xampp/ shows me empty directory listing. figured perhaps install botched reinstalled xampp. still no luck. tried installing apache 5.5.27. same problem. am missing something? same issue here, comparing htdocs/xampp folder in 5.6.11 5.6.8 saw files there missing in 5.6.11. copied entire htdocs/xampp folder 5.6.8 5.6.11 , worked fine.

jquery - how to append dynamic version number to javascript tag -

i have html file in loading multiple js files . need declare variable n append each of script tag. how can ? appending variable parameter this can done server side client side. safest way server side. set variable session containing current system date of server , add onto page. if wish client side, need script tags in code src attribute , append variable containing current date it. can call piece of code window.onload() or document.ready() per will.

MATLAB: Combining LaTeX characters with data formatting in axes title -

i'm trying figure out if there way me combine symbols via tex interpreter , data inputs single string axes title. for example, current code goes this: figure axhandle = axes; appletrees = 4; s = sprintf( ... 'apples vs acres\nnumber of apples trees $\alpha = %2.0f$', appletrees); title(axhandle,s,'interpreter','latex') i understand doesn't work, think conveys trying do. sprintf causes following message: warning: control character '\l' not valid. see 'doc sprintf' control characters valid in format string. i can ditch sprintf , go quotes, lose data formatting / text formatting capability. the backslash \ special character when formatting strings functions in matlab. sprintf 1 of those. write backslash, use \\ instead. here list of other special characters , how can written. in case, use following lines: s = sprintf( ... 'apples vs acres\nnumber of apples trees $\\alpha = %2.0f$', appletrees

html - Give new email window focus -

i have link on webpage open new message in default email service. link opens , works except fact new window never has focus. there way give focus? have included link below. <a href='mailto:soandso@email.com?subject=hi' target='_top' id='emailevents'>soandso@email.com</a> new page : <a href='mailto:test@email.com?subject=test' target='_blank' id='emailevents'>test@email.com </a> page : <a href='mailto:test@email.com?subject=test' target='_self' id='emailevents'>test@email.com </a>

Conditional iteration in a single job in Apache Spark -

i working on iterative algorithm using apache spark, claims perfect that. examples have found far creates single job hardcoded number of iterations. need algorithm run until condition met. my current implementation launches new job each iteration this: var data = sc.textfile(...).map().cache() while(data.filter(...).isempty()) { // run algorithm (also handles caching) val data = performstep(data) } this pretty inefficient. between each iteration wait long time next job start. 4 servers wait around 10 seconds in between each job, 32 servers 100 seconds. in total end spending @ least half of runtime waiting in between jobs. i find conditional iterations quite common in types of algorithms, example stopping criteria in machine learning. hoping can improved. is there more efficient way of doing this? example away run conditional repetition in single job? thanks!

osx - STPrivilegedTask ask for password for each task -

i start lot of nstasks require root privilege, found should use apple's authorization kit , found stprivilegedtask, designed that. the thing is, when start stprivilegedtask, ask me root password each time. there way enter root password first privileged task, , other tasks, application remember root password, user won't have enter password again , again , again? depending on use case, might happy replacing initialization of authorizationref in stprivilegedtask -launch like... // create authorization reference static authorizationref authorizationref = null; @synchronized(self) { if (!authorizationref) { err = authorizationcreate(null, kauthorizationemptyenvironment, kauthorizationflagdefaults, &authorizationref); if (err != errauthorizationsuccess) { return err; } } } ... , removing authorizationfree : // free auth ref authorizationfree(authorizationref, kauthorizationflagdefaults); that allow launch tasks without password pro

java - How to interrupt a user action in database -

i want interrupt user actions(ex: when user trying insert values, modify/delete values in database). want check if specific condition satisfied in java application based on user action(ex cond: free user not allowed modify contents). java application having information users. if condition satisfied can allow user perform action, if not he/she must denied. there way or specific tools monitoring or interrupting user actions in database. note: free use database. relational/no-sql. in oracle can call web service trigger using pl/sql or using java however should re-evalute need @ database level. severly hamper performance , may violate transaction boundaries. discussion on possible issues see thread

sql server - SQL Query - Group and SUM of Values -

Image
i have following database structure: id | payment (decimal) | paymentdate (datetime) | paymentstatus(int) i able grouping of of payments on time year , date , total across payment status's using following query; select year = year(duedate), month = month(duedate), mmm = upper(left(datename(month,duedate),3)), totals = sum(payment) paymentschedules duedate not null group year(duedate), month(duedate), datename(month,duedate) order year, month this gives me results far good. what able have added totals splits in each section. example if each payment paid (1) or unpaid (2) or overdue (3) not number of paid / unpaid / overdue total value of unpaid items / paid items / overdue items each year / month combination. you need add sum s case statements inside sum payments when correct status detected, this: select year = year(duedate), month = month(duedate), mmm = upper(left(datename(month,duedate),3)), totalpaid = sum(case when paymentst

highlighting - Can ElasticSearch stitch together a field to show matches from different parts of a field? -

when performing query on long field, ie. description , field may day 200 or more characters in length. to show relevancy in search result, can es stitch different parts of field show this? for example: there red car 4 doors driving down brick road ... , red balloon floating. if query searches ' red ', there way of displaying following: there [em]red[/em] car 4 doors . . . , [em]red[/em] balloon floating. i realize can use highlight ing wrap matching keyword fragments in emphasis tags. i know if es can stitch relevant field fragments around matched keyword fragments. yes, you're on right path, that's highlighting for. let's try on example. first, let's create index highlights mapping type having single string field called content . example, use fast vector highlighter , job want show. curl -xput localhost:9200/highlights -d '{ "mappings": { "highlight": { "properties": {

Closing shortcode in WordPress -

i made simple wordpress plugin highlights text. add_shortcode('close-span', 'highlighter_closing_span_shortcode'); function highlighter_closing_span_shortcode($atts) { return '</span>'; } it's closing shortcode part of plugin. in case, users must type "[close-span]". want change "[/span]". how can modify code above? you can use $content parameter of shortcode allow users put copy between tags: add_shortcode( 'span', 'my_span_shortcode' ); function my_span_shortcode( $atts, $content = null ){ return '<span class="highlighted">' . $content . '</span>'; } you use shortcode this: [span]this highlighted[/span] and result in: <span class="highlighted">this highlighted</span>

c# - how to get the memory mapping of a function? -

i have of function datas seem corrupted. confirm suspicion , it, i'd need know location of function. is there way know space in memory used function? for example 0x00000000 0x00002000 if address available. system: windows 7 , ms vs 2013

javascript - Select2.js v4.0: how set the default selected value with a local array data source? -

by using select2.js v4 plugin , how set default selected value when use local array data source? for example code var data_names = [{ id: 0, text: "henri", }, { id: 1, text: "john", }, { id: 2, text: "victor", }, { id: 3, text: "marie", }]; $('select').select2({ data: data_names, }); how set id 3 default selected value? $('.select').select2({ data: data_names, }).select2("val",3);

itunesconnect - Is there a limit to how often you can upload builds to TestFlight? -

how can upload build per hour? will apple block me sending many builds? yes. we use fastlane automate tf uploading, , our build server went crazy , kept building , uploading on weekend. @ point builds started failing error: [15:33:20]: [31m[transporter error output]: error itms-90382: "upload limit reached. upload limit application has been reached. please wait 1 day , try again." [0m [15:33:20]: [31mtransporter transfer failed.[0m [15:33:20]: [33m[0m [15:33:20]: [31merror itms-90382: "upload limit reached. upload limit application has been reached. please wait 1 day , try again." [0m [15:33:20]: [31merror itms-90382: "upload limit reached. upload limit application has been reached. please wait 1 day , try again." return status of itunes transporter 1: error itms-90382: "upload limit reached. upload limit application has been reached. please wait 1 day , try again. it looks got banned after ~20 uploads, though i'm pretty s

javascript - onClick event not working - JS -

i writing simple search function return similar results database based on user selected, though when testing onclick function not working have checked code similar , should work, searched before asking question though no solution me, sample of code..` <form> <fieldset> <legend>search form..</legend> <input type="text" id="itemid" name="itemname" placeholder="enter item name.." /> <select id="locselect"> <option id="loc1" value="mountain"> mountain </option> </select> </br> <input type="button" id="searchid" name="searchname" value="search" onclick="runsearch();" /> </fieldset> </form> <div id="searchresult"></div> <script type="text/javascript"> function runsearch() { var item = $("#itemid").val();

scripting - Automatically generating ambient module declarations -

given these 2 typescript files api/token.ts interface token { code: string } export default token and index.ts export * './api/token' tsc 1.5 --declarations switch generate 2 .d.ts files (with similar content) api/token.d.ts interface token { code: string; } export default token; and index.d.ts export * './api/token'; running grunt-dts-bundle following options dts_bundle: { release: { options: { name: 'my-module', main: 'index.d.ts' } } } will generate ambient module declaration file my-module.d.ts following content declare module 'my-module' { export * './api/token'; } however declaration not compile due : import or export declaration in ambient module declaration cannot reference module through relative module name. how can automatically generate ambient module declaration 2 typescript files above ? edi

Excel to remove duplicates one column at a time for many columns -

i have excel workbook many sheets(40+) have many columns in each(30+). my goal remove duplicates in each column not based on other columns. repeat columns in sheets. i tried create macro upon execution macro select column had selected when created macro. this code remove duplicates each column in workbook - treating each column separate entity. sub removedups() dim wrksht worksheet dim llastcol long dim llastrow long dim long 'work through each sheet in workbook. each wrksht in thisworkbook.worksheets 'find last column on sheet. llastcol = lastcell(wrksht).column 'work through each column on sheet. = 1 llastcol 'find last row each column. llastrow = lastcell(wrksht, i).row 'remove duplicates. wrksht .range(.cells(1, i), .cells(llastrow, i)).removeduplicates columns:=1, header:=xlno end next next wrk

php - Autoloading not working on Amazon Linux (EC2) -

i using autoloader automatically include plugin classes in wordpress. works fine locally. however, if put same code on amazon ec2 instance, fails find classes. file paths correct, compared ones on local installation ones on ec2 instance. here original code in question: https://wordpress.stackexchange.com/questions/193997/namespaces-in-wordpress-how-do-i-initiate-the-main-class

Jasper report column is too large to display on single page -

i have table several column's. 1 of them in case large (for example contains 800 character, , other columns contains 50-100 characters). column data contains multiple text lines, each line has linebreak @ end. suppose not fit on single page based on column width. so, when data displayed, when such large column comes, on column data.first page got whole column empty, not single character in column in displayed, , on second page displayed last line of text. know why happens , how fix it? cannot change column width because of other columns. can set option on jasperreports override such behaviour? this behavior managed splittype attribute of band: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/type/splittypeenum.html .

logging - How is poxos keep replication logs in sync practically -

i read paxos can used keep replications in sync syncing operation logs replications. to understanding each paxos instance define log id operation ideally log on each nodes, therefore apply operation log in order of log id keep data consistent each other delete .... add ... remove ... to understanding log id not increased 1 one , log should : 1.delete .... 3.add ... 5.remove ... i guess questions how work practically if 1 node down, during paxos instance? because node miss 1 log entry, how node knows missed entry after recovered ? according wiki https://en.wikipedia.org/wiki/paxos_(computer_science)#multi-paxos multiple-paxos seems implemented in way of make sure log id increase no gap. that's said, understanding, each replicate still need periodically talk make sure on latest change.

javascript - Isolate scope variable inside ng-repeat -

i'm building end ios application , it's made angularjs, admins can manage data website please. data consists of multiple , diverse elements. 1 of elements are, let's say, boxes. each box contains pointer present, , each present has name. it's box -> present.name, if know mean. the problem i'm dealing need show boxes in list (don't worry in code example ahead, simplified it), , content of each list item should name of present belongs each box. data has obtained parse.com, need call function given box retrieves present , allows name. this have right now: <div ng-repeat="box in boxes"> <span ng-init="getpresentfromobject(box)"> {{relatedpresent.get("name")}} </span> </div> the problem obvious. i'm using $scope.relatedpresent hold value of each present (one each box), it's updating value each iteration , @ end end list of elements, of them presenting same name, 1 of last pr

javascript - Jquery UI sortable on scrolled webpage -

Image
there seems problem jquery ui sortable plugin on scrolled webpage. i'm using reorder table rows (and move them 1 table another). when website scrolled, drag&drop bottom table top table doesn't behave correctly imho. dragged element's placeholder not inserted new table @ bottom position, rather few rows after it. it's 2, 3 rows above. until mouse cursor goes up, it's broken. mouse goes @ least 1 pixel down, gets repositioned , fixed. this screenshot how works when page not scrolled (on left), , later same page when scrolled bit (right): code straightforward: $( ".sortable tbody" ).sortable({"axis": "y", "cursor": "move", 'tolerance': 'pointer', 'cursorat': { top: 20, left: 20 }, 'scroll': false, "connectwith": $('.sortable tbody'), "items" : 'tr:not(.nosort)' }); $('body').scrolltop(340); jsfiddle

swift - how to avoid an object being deallocated? -

static func appendmissingobjtoarray(var oldarray:[anyobject],newarray:[anyobject]){ n in newarray{ var isexist = false o in oldarray{ if(n.isequal(o)){ //exist isexist = true break } } if(!isexist){ oldarray.append(n) } } } the above function append data newarray oldarray. when function done. , getting data oldarray, got bad access error. think due newly added object in oldarray have been deallocated , newarray released. any thing can avoid this? i believe need declare oldarray parameter inout . follows: //... static func appendmissingobjtoarray(inout oldarray:[anyobject],newarray:[anyobject]){ //... you can e.g (note ampersand & below: class01.appendmissingobjtoarray(&myoldarray, newarray: mynewarray) println(myoldarray) // contain appended result done myoldarray (the passed array) mutated. may need pass copy of original

mongodb - Check last element in array matches a condition -

i have array of numbers in mongodb documents , need check if last number in array meets conditions. my documents stored this: { name: string, data: { dates: array, numbers: array } } and need check if last number in numbers "lies between" 2 other numbers. any suggestions on how appreciated. right effficient way have of doing using javascript evaluation of $where can find value of last array element , test programatically. with sample documents: { "a": [1,2,3] }, { "a": [1,2,4] }, { "a": [1,2,5] } and query: db.collection.find(function() { var = this.a.pop(); return ( > 2 ) & ( < 5 ) }) or presented $where string evaluation: model.find( { "$where": "var = this.a.pop(); return ( > 2 ) && ( < 5 )" }, function(err,results) { // handling here } ); which simple way , not have "overhead" such $unwind

linux - Increment my server-port in my Config file -

i want make bash script, increment server-port option in config file every time +1 if run script. config file looks this. server-port=1000 server-online=true level-name=hapos type=xzc so example how needs work # ./script.sh change port # cat config.txt 1001 ----------------- # ./script.sh change port # cat config.txt 1002 ----------------- # ./script.sh change port # cat config.txt 1003 incrementing awk let's start config file: $ cat config.txt server-port=1000 server-online=true level-name=hapos type=xzc we can increment port using awk: $ awk -f= -v ofs== '$1 == "server-port"{$2++} 1' config.txt server-port=1001 server-online=true level-name=hapos type=xzc the code works follows: -f= sets field separator on input = . -v ofs== sets field separator on output = . $1 == "server-port"{$2++} tests see if first field server-port . if is, increments second field. 1 awk's cryptic shorthand print-the-line. changing

parallel processing - PHP receive and respond to thousands of requests - do calculations behind the scene -

i working on php script that: receives client request; processes request via cpu-and-time-intensive-binary-computation store result of computation mysql database then respond client status 200 ok problem: when there 10s of 1000s of requests coming in per second during peak hours: clients have wait long time receive status 200 ok . flexibilities: script not need respond client result of computation. script not need respond status 200 ok based on success/failure of computation - computation may fail , that's okay. actual computation happen in parallel behind scene. what tools / packages / libraries / strategies should used achieve kind of intensive request handling design on php? on php side or solvable apache side? notes: running apache, mysql, php, redis on ubuntu [ampru] clients send request , receive status 200 ok right away. clients not wait computation of request complete. there no auto-scaling or load-balancing concept in place: it's single ampru

javascript - Trying to make a dojo widget that will create a form -

i wanted make place data-dojo-type="js/widget/sauploadform" upload widget generate form there. not sure wrong right no form generated on page. <html> <head> <title>upload</title> <script> dojoconfig = { async : true, parseonload : false } </script> <script src="js/dojo/dojo.js"></script> </head> <body> <div> <h1 align="center">upload</h1> <br /> <div data-dojo-type="js/widget/sauploadform"></div> </div> </body> </html> my widget file: sauploadform.js define(["dojo/_base/declare", "dojo/dom-construct", "dojo/parser", "dijit/_widgetbase", "dijit/_templatedmixin"], function(declare, domconstruct, parser, ready, _widgetbase, _templatedmixin) { decalre("sauploadform", [_widgetbase, _templatedmixin], { formstring

apache - apache2 - can I setup a subdomain without creating an A record? -

so have mydomain.com and want test.mydomain.com can set without creating record subdomain? either .htaccess or you need in dns. can a , cname , or can use wildcard entry like *.mydomain.com. in cname mydomain.com. the above wildcard record, match name under mydomain.com . can use record specific name. ; alias name pointing mydomain.com test.mydomain.com. in cname mydomain.com. ; or, regular dns record test.mydomain.com. in 1.2.3.4 without dns entry, browser not know apache instance begin with. cannot solve .htaccess or apache config alone, dns must route request apache first.

java - Why is my JTable always reported as empty using VoiceOver on OS X? -

Image
voiceover on osx 10.10.4 (yosemite), using jre 1.7.0_75 , jre 1.8.0_45, reports following table "empty". package stackoverflow.examples.jtable; import javax.swing.jframe; import javax.swing.jtable; import javax.swing.swingutilities; public class tabledemo extends jframe { private static final long serialversionuid = 1l; public tabledemo() { super("accessible jtable?"); final string[] columnnames = { "first name", "last name", "sport", "# of years", "vegetarian" }; final object[][] data = { {"kathy", "smith", "snowboarding", new integer(5), new boolean(false)}, {"john", "doe", "rowing", new integer(3), new boolean(true)}, }; final jtable jtable