Posts

Showing posts from May, 2013

regex - Regular expression name of series grouped in 3 groups -

i'm starting learning regular expression , stuck 3 days on problem. need regular expression group name of series, season number of episode , else. came this, not result needed. (.*)([ss]?[0-9]{1,2}?[ee]?[0-9]{1,2}?)(.*) code should work on these timeless.s01e05.hdtv.x264-killers[ettv] the.big.bang.theory.1007.hdtv-lol dcs.legends.of.tomorrow.107.hdtv[ettv] 3 days spent. finaly figured out. expression works tv series startin number or if movie title has year in it. ([0-9]{1,4}?.*?|.*[0-9]{4}.?|.*?)([ss]?[0-9].+?[ee]?[0-9]+?)([^0-9].+$)

angular - Angular2 Aot and multi stage source maps integration -

i working on angular2 application. went through doucmentation , implemented aot , rollup. have non-es6 modules in application. after rollup, bundle js of webpack replacing 'require' statements required library code. have generated sourcemap @ every step.but still, when error turns in console, not reflect correct line. following aot, rollup , webpack configs. 'sourcemap' option set 'true' in each of configs. please advise. tsconfig.aot.js { "compileroptions": { "target": "es5", "module": "es2015", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators": true, "removecomments": false, "noimplicitany": false, "allowunreachablecode": true, "suppressimplicitanyindexerrors": true, "allowsyntheticdefaultimports...

Loop through condition and append to string in php? -

am writing content file, store content in variable. parts of file content need repeated minor changes, changes stored in variable , need run loop change. see following code sample, $looped_valuearray; //this array need loop content in $looped_value //to show values $content = 'sample content '. $looped_value.' fdgdf'; i not loop write forloop appending string like $content = 'sample content '. foreach($looped_valuearray $looped_value) $looped_value;.'fdgdf'; hi follow scripts if append content in variable: $content ="sample content "; foreach($looped_valuearray $looped_value){ $content .=$looped_value; }

c++ - How to get rid of TLE? -

i solved following challenge brute-force: given n bags, each bag contains ai chocolates. there kid , magician. in 1 unit of time, kid chooses random bag i, eats ai chocolates, magician fills ith bag floor(ai/2) chocolates. given ai 1 <= <= n, find maximum number of chocolates kid can eat in k units of time. for example, k = 3 n = 2 = 6 5 return: 14 at t = 1 kid eats 6 chocolates bag 0, , bag gets filled 3 chocolates @ t = 2 kid eats 5 chocolates bag 1, , bag gets filled 2 chocolates @ t = 3 kid eats 3 chocolates bag 0, , bag gets filled 1 chocolate so, total number of chocolates eaten: 6 + 5 + 3 = 14 note: return answer modulo 10^9+7 first took array in vector pair first element value , 2nd element index. find max value vector , change value. unfortunately, takes long. there better way? int solution::nchoc(int a, vector<int> &b) { vector<pair<int, int> >vc; for(int i=0; i<b.size...

ios - Swift 3 Firebase NSString * type -

Image
i'm using firebase library call requires string of type nsstring * i'm new swift don't know means. have noticed if use literal works fine, if use variable thread abort. i have let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let email = appdelegate.email let fullname = appdelegate.fullname and want this let newuser = ["name" : fullname] let users = self.ref.child("users") let currentuser = users.childbyappendingpath(email) currentuser.setvalue(newuser) but childbyappendingpath(email) requires type nsstring * is there way can convert email literal/const/static ? i'm kind of lost here. here email , fullname in appdelegate file var fullname = string() var email = string() func signin(signin: gidsignin!, didsigninforuser user: gidgoogleuser!, witherror error: nserror!) { if (error == nil) { // perform operations on signed in user here. full...

c++ - Template class with virtual member: linker error -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers consider following code. abstract, generic class; b both implements , specializes it. code seems trivially correct me, reason end strange linker errors. template<typename t> class { public: virtual void f(); }; class b : public a<int> { public: void f() {}; }; int main(int argc, char** argv) { auto b = new b(); return 0; } gcc output: /tmp/ccxg2z8a.o:(.rodata._ztv1aiie[_ztv1aiie]+0x10): undefined reference `a<int>::foo()' collect2: error: ld returned 1 exit status clang output: /tmp/l2-2a09ab.o: in function `main': l2.cpp:(.text+0x35): undefined reference `operator new(unsigned long)' /tmp/l2-2a09ab.o:(.rodata._zti1aiie[_zti1aiie]+0x0): undefined reference `vtable __cxxabiv1::__clas...

java - spring integration test cleanup for conflicting configuration contexts -

i'm working on application use integration tests intensively since core framework using operates on database. i have test classes using configuration context class such this: @runwith(springjunit4classrunner.class) @contextconfiguration(classes = configa.class) public a_test(){ } the majority of tests using same context above. have on 200+ such tests. needed additional configuration use cases well, this: @runwith(springjunit4classrunner.class) @contextconfiguration(classes = {configa.class, configb.class}) public b_test(){ } problem when execute tests maven, or ide runners , loaded cache configa no longer works. spring tries recreate context configa fails because have h2 db configured , spring tries create schemas, tables fails so. to overcome started use @dirtiescontext on tests. result on 1h build time, reduces developer productivity significantly. question: possible clear context tests b_test only? @dirtiescontext(classmode=after_class) doesn't because...

ios - How to make UITableView header to show only when dragging down table view -

i have uilabel shows me current date added table view header. when app running can see header right start. what after when app starts not see header, when try drag table view down, reveal label. , when releasing header should hidden again. i think snapchat uses technique in stories screen. any ideas how can achieved ? i'm thinking setcontentoffset when app starts move table view on top of header. how do know when table view dragged , released ? you correct can use setcontentoffset move tableviewdown. can implement uiscrollviewdelegate method scrollviewwillenddragging( :withvelocity:targetcontentoffset:) tell when user lets go of tableview , call setcontentoffset( :animated:) animate tableview initial position.

asp.net mvc - I have a list with objects, each object contains a list, each of these lists needs to become a DropDownList in a gridview -

i have list contains ~80 of following objects: public class sourcemapping { public int id { get; set; } public string sourcewaarde { get; set; } public string onderwerp { get; set; } public string sourceid { get; set; } public string applicatiedataid { get; set; } [notmapped] public string selectedvalue { get; set; } [notmapped] public ienumerable<selectlistitem> destinationoptionslist { get; set; } } each of these objects can see has ienumerable< selectlistitem > these options want display in table combobox (dropdownlist). way works should work: @model myproject.models.home.homeviewmodel <table> @foreach (var sourceentity in model.onderwerp.sourceentitieslist) { <tr> <td> @sourceentity.sourcewaarde </td> <td> @html.dropdownlistfor(model => sourceentity.selectedvalue, sourceentity.destinationoptionslist)...

javascript - Having a fixed response structure with node.js and Express -

we have started using node.js our api server instead of java. apart things node.js provides, 1 thing miss having proper response object api. since javascript being dynamically typed languages, objects can created on fly while returning response. in contrast java, can have class , instance of serialized in response. can anytime lookup class determine response of api be. is there such design pattern in node.js / javascript. our api's have strict conformance such templated object. you can make them yourself. if you're using es6 example, can have various error , response modules, , perform own validation in class creates responses. for example, // sample-response.js class sampleresponse { constructor(message) { // validate `message` somehow this.data = message } } module.exports = { sampleresponse } then you're structuring http interface, can send whichever response you'd (for example, express): res.send(new sampleresponse(message...

dependency injection - Spring, maven archetype @value -

we using spring boot (1.4) , maven (3.3.9) archetypes. in archetype, trying create jerseyconfiguration extends abstractjerseyconfiguration (that implements org.glassfish.jersey.server.resourceconfig ). in constructor trying pass value through constructor injection (with key loggingfilter.register ) configurtion.properties . in order @value("${loggingfilter.register:false}") boolean .. after archetype generates mvn project, doing @value("${$symbol_dollar}{loggingfilter.register:false}") boolean .. . here code snippet: #set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) package ${package}; import java.util.logging.logger; import javax.ws.rs.applicationpath; import org.springframework.beans.factory.annotation.autowired; import org.springframework.beans.factory.annotation.value; import org.springframework.stereotype.component; import com.a.a.c.abstractjerseyconfiguration; import com.a.a.c.m.logr...

Visual Studio Code not opening after aborted update -

premise: using windows 7. installed vs code last week , today, when opened it, informed me of update available. tried update it, signalled error during update operation (sorry don't remember error was), clicked "abort". if try open vs code, error popup appears instead: a javascript error occurred in main process i suppose went wrong while rolling when aborted update. there way fix without reinstalling program? looks corrupted project file. create new empty project , import files in new project. problem gone.

java - How can I get the n-th element in a ListView -

i have listview 2 items inside each row, textview , switch button. this how created list view: rootview = inflater.inflate(r.layout.fragment_list_view, container,false); listview list = (listview) rootview.findviewbyid(r.id.listviewfragment); rootview.findviewbyid(r.id.buttonsubmitplayerstrainingattendances) ; string[] = { "nameplayer", "switch" }; int[] = { r.id.textviewplayername, r.id.switchattendance }; list<hashmap<string,string>> alist = new arraylist<hashmap<string,string>>(); for(int a=0; < totalplayers ;a++) { hashmap<string, string> hm = new hashmap<string,string>(); hm.put("nameplayer", playerssurnames.get(a) + " " + playersnames.get(a) ); alist.add(hm); } simpleadapter adapter = new simpleadapter(getactivity().getbasecontext(), alist, r.layout.player_list, from, to); list.setadapter(adapter); i used layout fragment_list_view.xml has li...

opencv - AttributeError: 'module' object has no attribute 'imshow' -

i using mac os10.12 when run following snippet of code import cv2 img = cv2.imread('happyfish.jpeg',0) cv2.imshow('image',img) cv2.waitkey(0) cv2.destroyallwindows() i error saying: attributeerror: 'module' object has no attribute 'imshow' my opencv installed fine. when run imread command execute.

css - html input range thumb smooth movement -

i have html input range set bunch of css changes appearance, , wondering if there way make smoothly change wherever user changes? input[type=range] { -webkit-appearance: none; width: 100%; height: 20px; border-radius: 5px; border: 1px solid; background: none; box-shadow: 0px 0px 8px 0px #555, 0px 0px 25px 0px #555 inset; transition: 0.4s ease-out; outline: none; } input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; background-color: #ccc; border: solid 1px #333; border-radius: 4px; box-shadow: 0px 0px 8px 0px #555, 0px 0px 25px 0px #555 inset; cursor: pointer; transition: 0.4s ease-out; } input[type=range]:hover { background: rgba(255, 255, 255, 0.2); box-shadow: 0px 0px 13px 0px #444, 0px 0px 20px 0px #444 inset; } input...

python - Adding an object attribute value to an array Django -

i new django , first project using it. have run issue don't understand , (perhaps i'm not using right search terms) i'm not finding relevant results in searching solutions. i trying array of distinct entries in 'topic' field of model. playing in shell, trying figure out when got following result didn't expect. this entered in shell: >>> pomodoro.models import chunk, result >>> chunk.objects.all() <queryset [<chunk: onboard state estimation>, <chunk: newton's 2nd law of motion>, <chunk: if>]> >>> = [] >>> q in chunk.objects.all(): += q.topic ... >>> ['r', 'o', 'b', 'o', 't', 'i', 'c', 's', 'm', 'e', 'c', 'h', 'a', 'n', 'i', 'c', 's', 'l', 'o', 'g', 'i', 'c'] >>> ose = chunk.objects.get(pk=1) >>...

css - Floating Nav Links to Right -

how can every link main 'digestible` link right of nav keep them in order? jsfiddle: https://jsfiddle.net/ut1poay3/ <div id="app"> <nav class="navbar navbar-light bg-faded"> <ul class="nav navbar-nav"> <li class="nav-item active"> <a class="nav-link" href="#"><h4>digestible <span class="sr-only">(current)</span></h4></a> </li> <li class="nav-item"> <a class="nav-link" href="#" style="color: #ffcc00">create quiz</a> </li> <li class="nav-item"> <a class="nav-link" href="#">study</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="http://example.com" id=...

python - How to Use a Wildcard (%) in Pandas read_sql() -

i trying run mysql query has text wildcard in demonstrated below: import sqlalchemy import pandas pd #connect mysql database engine = sqlalchemy.create_engine('mysql://user:@localhost/db?charset=utf8') conn = engine.connect() #read sql pandas dataframe mysql_statement = """select * table field '%part%'; """ df = pd.read_sql(mysql_statement, con=conn) when run error shown below related formatting. typeerror: not enough arguments format string how can use wild card when reading mysql pandas? under hood of pandas, it's using whatever sql engine you've given parse statement. in case that's sqlalchemy, need figure out how handles % . might easy escaping like '%%part%%' . in case of psycopg, use params variable this: mysql_statement = """select * table field %s; """ df = pd.read_sql(mysql_statement, con=conn, param=("%part%",))

javascript - How would I use an asynchronous function as a default parameter for another function -

i trying make function call function if parameter doesn't exist. for example: function getallfoo(){ // makes request api , returns array of foos } function getnumfoo(foosarray = getallfoo(), num = 5){ // selects num of foos foosarray or calls getallfoos selects num of them } try wrap asynchronous function js promise, , in dependent function call then() function: function getallfoo () { return new promise( // resolver function called ability resolve or // reject promise function(resolve, reject) { // resolve or reject here, according logic var foosarray = ['your', 'array']; resolve(foosarray); } ) }; function getnumfoo(num = 5){ getallfoo().then(function (foosarray) { // selects num of foos foosarray or calls getallfoos selects num of them }); }

jquery - Paste text untill 100% height -

i'm trying make script copy/paste text, until 100% screen height has been reatched: <p class="text">jeg er 19 år og elsker sprut, penge og ligegyldig sex ahhh.</p> but lost how should it, know can done jquery, not sure how? this css div around text area text should placed in: .centermarg { font-size: 35px; margin: 0 auto; text-align: center; height: 100%; max-height: 100%; } if don't wnat content go go beyond bottom (scroll) need discount text height or use overflow: hidden in css. var b = $('.container'), t = $('.text'); while (b.height() < window.innerheight) { t.clone().appendto(b); } .text { font-size: 35px; margin: 0 auto; text-align: center; height: 100%; max-height: 100%; } <div class="container"> <p class="text">jeg er 19 år og elsker sprut, penge og ligegyldig sex ahhh.</p> </div> <scrip...

servlets - How to render a Vaadin view from backend -

Image
in application, remote client making restful call backend method, @post response lookup(@context httpservletrequest request) . then, if request parameters satisfy conditions, vaadin view, resultview supposed rendered client's browser. in other cases, lookup() returns without confrontation myui . this boils down creating ui instance backend(?) how this? tried (1) below , found out (2). 1.) put @post response lookup(@context httpservletrequest request) myui . this, added myui @path("/lookup") . change made myui. following annotations on myui now: @suppresswarnings("serial") @theme("mytheme") @path("/lookup") i havent changed web.xml mapping restful calls: this didn't show errors. however, didn't invoke lookup() . 2.) make uiprovider create ui instance suggested in this post. vaadin @push wouldn't work this, have invoke ui explicitly. this may naive question, i'm backend developer-- not fami...

android - How to stop a thread in a service -

today have problem in android project. use service thread in log location information in period of 10s. however, when change screen orientation (portrait -> landscape), period messed up. i think may run thread got 1 more thread running behind once rotate screen. have print log messages , seems guessing right. here code: public class locationservice extends service { public location loc; public locationservice() { } @override public int onstartcommand(intent intent, int flags, int id) { thread thread = new thread(new runnable() { @override public void run() { locationmanager locationmanager = (locationmanager)getsystemservice(context.location_service); if ( contextcompat.checkselfpermission(locationservice.this, android.manifest.permission.access_coarse_location ) == packagemanager.permission_granted ) { loc = locationmanager.g...

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e...

google app engine - Firebase ApplicationDefaultCredentials doesn't work in dev_appserver -

i'm following instructions on: https://cloud.google.com/solutions/using-firebase-real-time-events-app-engine i'm trying dev_appserver make credentialed requests firebase database. works after i've deployed, not locally. i've run gcloud auth application-default login and have set credentials follows: try: functools import lru_cache except importerror: functools32 import lru_cache import json import httplib2 oauth2client.client import googlecredentials _firebase_scopes = [ 'https://www.googleapis.com/auth/firebase.database', 'https://www.googleapis.com/auth/userinfo.email'] # memoize authorized http, avoid fetching new access tokens @lru_cache() def _get_http(): """provides authed http object.""" http = httplib2.http() # use application default credentials make firebase calls # https://firebase.google.com/docs/reference/rest/database/user-auth creds = googlecredentials.get_a...

javascript - How can I select a nested element without an id or class? -

for example, suppose had following html: <div> <table> <tr> <td>x</td> <td></td> </tr> </table> </div> <div></div> and wished fin value within td element x in it. know use var foo = document.getelementsbytagname("td")[0].innerhtml; in order select specific td element, , not 1 of others. however, given know path element, how can javascript used in way select particular value? you should first tr var tr = document.getelementsbytagname("tr")[0]; var foo = tr.getelementsbytagname("td")[0].innerhtml; console.log(foo); <div> <table> <tr> <td>x</td> <td></td> </tr> </table> </div> <div></div>

How to bind key from tmux to cmd on osx and iterm? -

recently converting screen tmux. need way bind cmd key - left/right move between windows. have screen setup this bindkey "^[[c" next # bind cmd+->, escape sequence binded in iterm2 bindkey "^[[d" prev # bind cmd+<- in iterms set escape sequence cmd+left/right keys. can’t figure out how bind escape sequence next/right in tmux btw, bind-key -n appears in many configs, wonder ‘-n’ mean?

sql - How to improve the following stored procedure to verify the syntax of an email? -

i created following table: create table tbl_email ( id int identity primary key, email varchar(25) not null ); i create stored procedure check if syntax of new email ok, want cover 2 possibilities if email has not "@" character follows: insert tbl_email (email) values ('email.com') and if email has not corresponding dot: insert tbl_email (email) values ('email@com') i want cover these cases, create stored procedure activated when there insert or update create trigger tr_verify_email on tbl_email insert,update begin declaring variables count inside while , flag know if "@" located @ first position, declare @v_count int,@flag int declare @v_email_inserted varchar(25) set @v_count = 1 set @flag = 0 select @v_email_inserted = email inserted; while(@v_count < len(@v_email_inserted)) begin if(substring(@v_email_inserted,@v_count,1)='@' , @v_count > 4) begin set @f...

java - How to send command to a usb printer? -

i need open cash drawer cmd. started java (with app) didn't found detailed information classes , how them interact windows ports couldn't working. these method tried(neither errors neither open cash drawer): public void cashdraweropen() { string code1 = "27 112 0 150 250"; //decimal string code2 = "1b 70 00 96 fa"; //hexadecimal string code = "escp0û."; //ascii printservice service = printservicelookup.lookupdefaultprintservice(); system.out.println(service.getname()); docflavor flavor = docflavor.byte_array.autosense; docprintjob pj = service.createprintjob(); byte[] bytes; bytes=code2.getbytes(); doc doc=new simpledoc(bytes,flavor,null); try { pj.print(doc, null); } catch (printexception e) { // todo auto-generated catch block e.printstacktrace(); } } public void cashdraweropen2(){ string code1 = "27 112 0 150 250"; string code2 = ...

asp.net mvc - Is it a good idea to pass IdentityUser object to other controller from View? -

in primary controller action method following current applicationuser object (it inherits identityuser): [authorized] ... var user = await (usermanger<..>)usermanager.getuserasync(httpcontext.user) the object need in view, pass viewdata: viewdata["user"] = user; in view want display auxiliary information current user: @{ applicationuser user = (applicationuser)viewdata["user"]; int unreadmessages = othercontroller.gettotalunreadmsgs(user); } therefore need applicationuser object in view. pass method of other controller. method uses dbcontext information db (context object scoped, single per request). question: safe? exist better practice?

Android Save chosen item from Context Menu -

hi struggling witch menu context after chose item setting new background color how save it??? idea save doesn't work :( public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button btn2 = (button)findviewbyid(r.id.btn2); linearlayout mainscreen = (linearlayout) findviewbyid(r.id.mainscreen); this.registerforcontextmenu(btn2); sharedpreferences settings = getsharedpreferences("mypref", 0); if(settings!=null){ //do nothing }else if(settings.getstring("color", "red").equals("red")){ mainscreen.setbackgroundcolor(color.red); }else if(settings.getstring("color", "blue").equals("blue")){ mainscreen.setbackgroundcolor(color.blue); }else if(settings.getstring("color", "green").equals("...

multithreading - C pthreads and signaling -

i'm having alot of trouble on assignment class, , great. need code create 4 producer threads continuously loop , send sigusr1 or sigusr2 4 consumer threads. 2 respond sigusr1, , 2 respond sigusr2. signals being sent producers, , received consumers, nothing happens after , program crashes. below program, , output gdb when ran. #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <semaphore.h> #include <signal.h> #include <time.h> #define np 4 #define nc1 2 #define nc2 2 #define cnt 10 void handler1(int); void handler2(int); typedef struct { int sent; int received; int buf[1]; int sig1; int sig2; sem_t con; sem_t prod; } sbuf_t; sbuf_t buff; pthread_t threads[9]; void *producer() { srand(time(0)); int s,i; while(1){ sem_wait(&buff.prod); s=(rand()%2)+1; //printf("prod...

c++ - Qt Parent to delete variable after child has closed -

i'm writing application in c++ using qt library. there central window (the parent) , children launched when needed. since number of these windows can open multiple times, display different data, i'm declaring objects new . here example of i've got: home_window.hpp view_window *somewindow; home_window.cpp void home_window::on_windowbutton_clicked() { somewindow = new view_window(); somewindow->show(); } what want do, delete object, when window closed reduce memory footprint of application. i've been able delete of objects contained in child window reduce memory usage, core object still lingers, , if, through single day user opens , closes 1000's of windows, , each object holds onto 40-50kb of memory, footprint of application goes couple of mbs of memory 100's of mbs of memory. i've not been able find guide online allow me achieve this. considering slot , signal pair, know when window closed, sends qobject::destroyed() signal. iss...

Error Putting a DateTime from php to mysql db? -

this question has answer here: mysql: insert datetime other datetime field 3 answers when use single quotes, double quotes, , backticks in mysql 10 answers i have time (h:i:s format), not date, call: $dateformat = 'y-m-d h:i:s'; $value4 = date($dateformat, strtotime($_post['start_time'])); $value5 = date($dateformat, strtotime($_post['finish_time'])); then call sql function: $sql = "insert times (site_id, crew_leader_id, service_number, start_time, finish_time, deicer_quantity, salt_quantity) values ($value1, $value2, $value3, $value4, $value5, $value6, $value7)"; i following error: error: insert times (site_id, crew_leader_id, service_number, start_time, finish_time, deicer_quantity, salt_quantity) val...

(Drupal 8) View display nodes with taxonomy term found in URL -

using drupal 8 i have working setup problem when try access taxonomy term made of two words. set up. view : shows nodes of content type a has relationship (required) field in content type stores taxonomy term (one or more terms need associated each content type) has contextual filter (that uses previous relationship) taxonomy term url. filter gets default value raw value url path component: 2 , , has use path alias instead of internal because url has taxonomy term name. has specify validation criteria taxonomy term name transform dashes in url spaces in term name filter values fan-art can correctly matched taxonomy term fan art . i have no problem taxonomy terms made of 1 word, it's ones made of 2 words giving me headache, ideas? i gave trying understand why doesn't work , resorted using has taxonomy term id instead. the url contains taxonomy term id only contextual filter needed. in raw value url taxonomy/term/[id] , needs done tell...

r - boosted regression trees train error in caret package -

i trying use code below train boosted regression tree cv of auc. getting message: error in { : task 1 failed - "subscript out of bounds" if didn't specify distribution="gaussian", not receive error message. any ideal fix problem? thank much. gbmgrid <- expand.grid(interaction.depth=(3:6), n.trees=(1:40)*100, shrinkage=.01) gbmgrid$n.minobsinnode = rep(10,nrow(gbmgrid)) head(gbmgrid) bootcontrol <- traincontrol(method='cv',classprobs = true,number=3,summaryfunction = twoclasssummary) gmbfit<- caret::train(x,y, distribution="gaussian", method = "gbm", verbose = f, trcontrol = bootcontrol, bag.fraction=0.5, metric="roc", tunegrid=gbmgrid)

rails - get YYYY-MM-dd date format in string -

i'm not sure why can't figure out it's simple. i'm trying concatenate todays date in format yyyy-mm-dd string , doesn't work. i've tried creating date now = time.now.strftime("%y-%m-%d") and concatenating 'http://api.flurry.com/appmetrics/sessions?apiaccesscode=########&apikey=#########&startdate='+now+'&enddate='+now please advise, thank you. edit: if set now = '2016-11-05' works fine. issue in how i'm creating date. i ended making work string interpolation after not working string interpolation. why wasn't working? turns out have use double quotes if not takes interpolation literal!! now = time.now.strftime("%y-%m-%d") "http://api.flurry.com/appmetrics/sessions?apiaccesscode=########&apikey=#########&startdate=#{now}&enddate=#{now}"

spring - NoSuchBeanDefinitionException despite being defined -

i have beans.xml definition: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="products" class="com.example.products"> <property name="products"> <map key-type="java.lang.string" value-type="com.example.product"> <entry key="coke"> <bean class="com.example.product"> <property name="name" value="coke"/> <property name="price" value="2.0"/> </bean> </entry> ...