Posts

Showing posts from January, 2014

c++ - Stream of Integers arriving at specified interval need to look sorted -

interview question: there stream of integers arrives @ specified intervals (say every 20 sec). container of stl use store them integers sorted? reply map/set when there no duplicate or multimap/multiset when there duplicate. better answer if exists? use multiset if want preserve duplicates. if don't want preserve duplicates, use set .

actionscript 3 - Action Script 3: Addchild within an already added child issue -

my issue error when function addspotlight called. typeerror: error #1010: term undefined , has no properties. @ bubbleboy_fla::maintimeline/addspotlight() @ bubbleboy_fla::maintimeline/policeheli() @ flash.utils::timer/_timerdispatch() @ flash.utils::timer/tick() my code this: //adding helicopter function addhelicopter(xlocation: int, ylocation: int, passspeedx, passspeedy): void { var helicopter: helicopter = new helicopter(xlocation, ylocation, passspeedx, passspeedy); back.addchild(helicopter); helilist.push(helicopter); playfly(); } //adding spotlight function addspotlight(xspotlightlocation: int, yspotlightlocation: int, spotlightspeedx): void { var spotlight: spotlight = new spotlight(xspotlightlocation, yspotlightlocation, spotlightspeedx); back.helicopter.addchild(spotlight); spotlightlist.push(spotlight); } the reason doing because helicopter can destroyed , spotlight gets removed @ same time, if don't destroy helico...

python - Issue in numpy array loop for central difference -

input array reference, u = array([[ 0., 0., 0., 0., 0.], [ 0., 1., 1., 1., 0.], [ 0., 1., 1., 1., 0.], [ 0., 1., 1., 1., 0.], [ 0., 0., 0., 0., 0.]]) python function using loop import numpy np u = np.zeros((5,5)) u[1:-1,1:-1]=1 def cds(n): in range(1,4): j in range(1,4): u[i,j] = u[i,j+1] + u[i,j-1] + u[i+1,j] + u[i-1,j] return u above function cds(5) provide following result using for loop , u=array([[ 0., 0., 0., 0., 0.], [ 0., 2., 4., 5., 0.], [ 0., 4., 10., 16., 0.], [ 0., 5., 16., 32., 0.], [ 0., 0., 0., 0., 0.]]) same function using numpy def cds(n): u[1:-1,1:-1] = u[1:-1,2:] + u[1:-1,:-2] + u[2:,1:-1] + u[:-2,1:-1] return u but same input array(u), function cds(5) using numpy provide different result., u=array([[ 0., 0., 0., 0., 0.], [ 0., 2., 3., 2., 0.], ...

Javascript Non-Repeating Number Generator Sometimes Returns Multiple Numbers -

i'm trying create random non-repeating number generator numbers 13. when run following function varying out puts, here results of running function 5 times using button click, , code. can't understand why it's repeating numbers. var checkifrandom = new array(); function getrandom(){ var randomnum= math.floor(math.random()*13); if(checkifrandom.indexof(randomnum) !== -1){ getrandom(); }else if(checkifrandom.indexof(randomnum)==-1){ checkifrandom.push(randomnum); } console.log(randomnum); }; //results 2 //click 1 7, 2 //click 2 6 //click 3 1 //click 4 5,7,1 //click 5 [2, 7, 6, 1, 5]//after 5 clicks logged checkifrandom array console in chrome. you're using recursion, means it's storing previous, non-unique numbers in stack , still logging them. move console.log() else if reads: function getrandom(){ var randomnum= math.floor(math.random()*13); if(checkifrandom.indexof(randomnu...

qt - Can't compile while Google Drive is running -

i compile stuff using qt , run google drive time. if compile project once, debug little , recompile quickly, google drive uploading files can't compile - can last minute due australian upload speeds. quit google drive, forget open again , next day files aren't synced when university. i never had problem when using dropbox (i assume copies files before uploading). any way around menacing problem?

virtualbox - What is the "vagrant-host-manager start id" in the /etc/hosts file? -

i using vagrant(1.7.2), virtualbox(4.3.26), along puphpet on project. using vagrant plugin vagrant-host-manager programmatically write /etc/hosts file on vagrant up , vagrant halt . i notice plugin provides information in comments of /etc/hosts ## vagrant-hostmanager-start id: 26c12a6f-22fd-4053-g193-77707p90318 (obfuscated id) i thought perhaps id string going contain name of running virtual machine, appear in virtualbox gui. appears not case. know how may associate above id 1 several machines. i want know because have several vm's containing same ip address , set of host names, therefore cannot discern vm has written what.

asp.net - Can i use c# to call ajax -

i have ajaxtoolkit pop this: <ajaxtoolkit:modalpopupextender id="modalpopupextender1" runat="server" targetcontrolid="button4" behaviorid="popup1" popupcontrolid="panel1" dropshadow="true" cancelcontrolid="button3" onokscript="okbuttonclick" backgroundcssclass="backgroundstyle" /> how can make execute inside btnreject_click @ c#? protected void btnreject_click(object sender, eventargs e) { //code here } at first make this. tb.text = "reject"; tb.cssclass = "btn btn-default"; tb.onclientclick = "javascript:$find('popup1').show();"; tb.usesubmitbehavior = false; tb.causesvalidation = false; tb.click += new eventhandler(btnreject_click); but find execute pop first. so, i'm looking way make execute after button click

linux - How to change directory to catkin workspace, then catkin_make, then go back -

currently, use following alias that: alias ck='export ck_dir=`pwd` && cd ~/catkin_ws && catkin_make && cd $ck_dir' this works if catkin_make finish without error. there modification that cd $ck_dir works if catkin_make failed? thanks. replace && semi-colon (;). here tips remember: && = continue if previous command passed || = continue if previous command failed ; = continue regardless of whether previous command passed or failed

What's the issue with TwitterOAuth in twitteR (R package)? -

i'm using r package twitter retrieve twitter data. the manual says : the function "registertwitteroauth" deprecated and the function "setup_twitter_oauth" called side effect. what's problem them? setup_twitter_oauth function want use. it's true call it's sideeffect - side effect being fact it'll authorize make calls twitter api. have pass keys/secrets/tokens per function documentation. i store these values in options when need authenticate call setup_twitter_oauth(getoption('twitter_consumer_key'), getoption('twitter_consumer_secret'), getoption('twitter_access_token'), getoption('twitter_access_secret'))

Migrating table data from a MySQL database to another MySQL database -

i'm having trouble understanding how works. know can migrate new database mysql through of workbench's tools, want here, data tables of database insert own database. issue other database not have same tables or same amount of data. of useless me, of doesn't fit tables. so how 1 regularly around doing this? need can capture data, no matter how may have been arranged in past, , place database. sounds hard when program doesn't know expect, issue. i'd appreciate if point me in right direction. can't do? perhaps missed somthing -- first create new table, avoid columns don't care about. create table newtable...... -- select old table columns need , insert them in new table insert newtable(col1, col2, col3) select col1, col2, col3 oldtable ..... and if want merge data between multiple columns use concat_ws insert newtable(col1, col2, col3) select concat_ws(' ', col1, col2) col1, col3 oldtable .....

javascript - youtube api v3 thumbnails not showing in IE 8 and 9 -

i'm working on project showing list of thumbnails of music videos using youtube api v3. works fine ie 10+ not work ie 8 or 9. thinking maybe jquery version(1.9.1) might not supported according jquery's site version 1+ can support ie6+. https://jquery.com/browser-support/ right stumped because can't find errors or , unsure how proceed. i speculating if has using iframe since i'm not embedding video , thumbnail figured shouldn't need use youtube iframe api. here relevant code snippets: <script src="https://apis.google.com/js/client.js"></script> $.get( "https://www.googleapis.com/youtube/v3/search?key=aizasyahnfotdo49dlvtdrzzezr0kovo4dwzhny", { part: 'snippet', q: query, maxresults: 8, type: 'video', }, function(data){ var output; var viewcount; $.each(data.items, function(i, item){ //console.log(item); var videoid = item.id.videoid; var vidthumb = item.snippe...

android - setOnEditorActionListener is not called in lollipop -

i want create layout user types in artist name , when presses search on virtual keyboard list of artists displayed. view rootview = (view) inflater.inflate(r.layout.fragment_search, container, false); edittext searchartist = (edittext) rootview.findviewbyid(r.id.searchartist); searchartist.setoneditoractionlistener(new textview.oneditoractionlistener() { @override public boolean oneditoraction(textview v, int actionid, keyevent event) { if (actionid == editorinfo.ime_action_search) { maketoast(); return true; } return false; } }); here xml <edittext android:id="@+id/searchartist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/search_artist" android:imeoptions="actionsearch" android:inputtype="text"> <requestfocus /> i have searched lot in other stackoverflow post regardi...

java - "A result was returned when none was expected" exception on JDBCTemplate update execution -

i trying execute function via postgresql update() method, throws me exception - "a result returned when none expected". postgresql function: create or replace function create_order(note varchar, created_by bigint, service_request bigint) returns table (service_order integer, note varchar) begin insert service_order (note, service_request_fk, created_by, so_status_type_fk, price_total, created) values (note, service_request, created_by, 1, 0, now()); end; $$ language plpgsql; sql, trying execute: string sql = "select create_order(?,?,?)"; the update function: int id = jdbc.update(sql, new object[] {order.getnote(), emp.getemployeeid(), order.getservicerequestid()}); the function must return void means nothing, seems me, returns table without rows, jdbctemplate consider table. how can avoid exception? you using select statement when using stored procedure; must use call. http://www.postgresql.org/docs/7.4/static/jdbc-callproc.ht...

javascript - How to add java script to the from user control button click event to parent page -

a link generate in user control button click event, want use clientscipt.registerstartupscript add javascript open link in new window. won't work. if same code in user control parent page, work, question can somehow add script parent page , execute it. var sb = new stringbuilder(); sb.append("<script type = 'text/javascript'>"); sb.append("window.open('"); sb.append(uri.absoluteuri); sb.append("');"); sb.append("</script>"); clientscript.registerstartupscript(this.gettype(), "script", sb.tostring()); please change sb.tostring() sb.tostring() . case matters.

python - Partially overriding view config inherit from parent class in Pyramid -

i using class based views cut down amount of repeating oneself in similar view methods. pyramid @view_config allows little boilerplate. example when have same view context changes: class baseedit(formview): @view_config(context=resource, name="edit", renderer="crud/edit.html", permission='edit') def edit(self): pass class useredit(baseedit): @view_config(context=userresource, name="edit", renderer="crud/edit.html", permission='edit') def edit(self): pass however, possible reduce boilerplate further? e.g. don't want re-declare template file, because doesn't change. want change @view_config parameters. there way this: class baseedit(formview): @view_config(context=resource, name="edit", renderer="crud/edit.html", permission='edit') def edit(self): pass class useredit(baseedit): @view_override(context=userre...

C SPI latch pulse happening too soon -

i'm trying interface 2 max7219 drivers using 9s12. problem when send data, latch pulse happening before spi transfer has been completed. http://imgur.com/bgd1sb9 attached picture shows pulse happening while spi clock , data still being sent in. void max7219init(void) { int8u count =0; setlow(portp, pin6); /* need set low on startup */ (count = 1; count <= 2; count++){ //run twice send data 2 max7219 spimx(0x0f, 0xcd); } pulse(portp, pin6); while (1) ; } void spimx(int8u address, int8u data) { while((spi0sr & sptef) == 0){} /*wait previous transmit */ spi0dr = (int8u)(address & 0b00001111); /*initiate transfer */ while((spi0sr & spif) == 0){} /*wait new data */ while((spi0sr & sptef) == 0){} /*wait previous transmit */ spi0dr = data; /*initiate transfer */ while((spi0sr & spif) == 0){} /*wait new data */ } what ...

php - Creating a chat with Laravel -

good night ! i managed show information users , content of messages following code route::get('chat', function(){ // number of days show data for, default of 7 $usr1 = 121; $usr2 = 123; /***obtener conversacion 121 y 123**/ $messageuser = messageuser::with('conversaciones')->get(); foreach($messageuser $msj){ if(($msj->id_emisor == $usr1)&&($msj->id_receptor == $usr2)){ $usuario1 = user::find($usr1); foreach($msj->conversaciones $conv){ echo $usuario1->name; echo $conv->contenido; } } if(($msj->id_emisor == $usr2)&&($msj->id_receptor == $usr1)){ $usuario2= user::find($usr2); foreach($msj->conversaciones $conv){ echo $usuario2->name; echo $conv->contenido; } } } }); now , need join 2 condition array send result view...

bash - How can I run a docker container and commit the changes once a script completes? -

i want set cron job run set of commands inside docker container , commit changes docker image. i'm able run container daemon , container id using command: container_id=$(sudo docker run -d my-image /bin/sh -c "sleep 10") but i'm having trouble second part--committing changes image once sleep 10 command completes. there way me tell when docker container killed , run command before is? edit: alternative, there way trigger ctrl-p-q via shell script in container leave container running return host? run in foreground, not daemon. when ends script launched takes control , commits/push it

spring - Quartz doesn't recognize schema job_scheduling_data_2_0.xsd present in quartz jar file -

i getting below exception on server startup. i using quartz 2.2.21 spring 3.2. have enabled quartz plugin (org.quartz.plugins.xml.xmlschedulingdataprocessorplugin). please find below start tag of our xml file: during server startup getting below log information , stacktrace: error message: unable load local schema packaged in quartz distribution jar. utilizing schema online @ http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd exception: caused by: org.xml.sax.saxparseexception; systemid: file:///quartz_job_data.xml; linenumber: 5; columnnumber: 104; schema_reference.4: failed read schema document 'http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd', because 1) not find document; 2) document not read; 3) root element of document not <xsd:schema>. i have same problem. i'm using 7.1.1 of jboss , problem appears when don't have connection internet. easy putting fake address that's unreachable in hosts. i t...

python - Using tkinter to assign a global variable and destroy the gui -

i have been writing annual data verification program , need bit of user input , decided go tkinter route. have created interface 1 of user input screen, , have make others, i'm having issues destruction of windows after selection made, , globalization of variable. so ideally program run, window pops up, appropriate attribute selection made, text on button passed "assign" function, creates global variable used in program, , window disappears. as stands now, running of code results in error: "tclerror: can't invoke "button" command: application has been destroyed". if comment out "mgui.destroy()" line, can select button , close window manually, "drn" variable passed variable "x" no matter what! import sys tkinter import * def assign(value): global x x = value mgui.destroy() mgui = tk() mgui.geometry("500x100+500+300") mgui.title("attribute selection window") mlabel = label(m...

javascript - How to pass data between multiple form views in angulars -

i have multi step form in angularjs. using ui-router routing between different views , ngresource sending data mongodb. problem not able send values of form directly database since form split multiple views. when submit form ng-submit, values of view being sent database. index.html <body> <div ui-view></div> </body> multiple views (register.html) <div class="row"> <div> <div id="form-container"> <div class="page-header"> <h2 class="text-center">enter following details</h2> <!-- links our nested states using relative paths --> <!-- add active class if state matches our ui-sref --> <div id="status-buttons" class="text-center link-colors"> <a ui-sref-active="active" ui-sref="/registration_form.signup"><span>1</span> setu...

How to use spring on a class situated in a library? -

although, i'm confortable other di macwire, need project deal spring. i'm trying integrate external library of service developing main application use spring instantiate services. i'm wondering how can such code in library treated same code in source respect spring ? that instantiating class in library, within main source of project using spring. give path of package scan bean ? m spring configuration file achieve di. have understand question is, looking way use spring capabilities instantiate class. (correct me if wrong..) way instantiate bean remain same external service or own library code. say if have classes like, //external library class package com.test; public class helloworld{ ... } // class package com.abc; import com.test.helloworld; public class myclass{ helloworld obj; ... } spring xml configuration file like, <beans> <!-- external library class --> <bean id="helloworld" class...

sql server - extract information from MS SQL database -

my database has table called "serialkey" 3 columns id pk email & serial. i have windows form in vb.net, form has 1 label, 1 textbox, 1 button, text in label displays email address, email address vary. when click button on form want database searched email address , find serial in database. have shown code below gives me error saying "object reference not set instance of object" highlights line below. dim reader sqldatareader = command.executereader() can me out here because i'm stuck , new :) appreciated. con = new sqlconnection("data source= connection string here; password='my password here'; ") cmd.connection = con cmd.commandtext = "select serial serialkey serial= ?" cmd.parameters.addwithvalue("?", lblname.text) con.open() dim lrd sqldatareader = cmd.executereader() while lrd.read() 'do if lrd.hasrows lrd.read() ...

Multi Source Replication MySQL 5.6 to 5.7 GTID Auto Position Issues [SOLVED] -

i have 3 master servers, different dbs, trying replicate single server. having hard time getting them setup , current. have duplicate entry errors on 3 channels. skipping them manually painful least. there way auto sync correct position? under impression easy pie gtid. i used: dump: mysqldump --databases profiles --single-transaction --triggers --routines --host=10.10.10.10 --port=3306 --user=user --password=pass > ~/dump.sql initialize: change master master_host="10.10.10.10", master_port=3306, master_user="user", master_password="pass", master_auto_position=1 channel "channel1"; master my.cnf: gtid_mode = on enforce_gtid_consistency = true log_bin = /var/log/mysql/bin_log.index log_slave_updates = true server-id = 2061 slave my.cnf: [client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] pid-file = /var/run/mysqld/mysqld.pid socket = /var/ru...

regex - Execute command defined by backreference in sed -

i creating primitive experimental templating engine based on sed (merely private enjoyment). 1 thing have been trying achieve several hours replace text patterns output of command contain. to clearify, if input line looks lorem {{echo ipsum}} i sed output this: lorem ipsum the closest have come this: echo 'lorem {{echo ipsum}}' | sed 's/{{\(.*\)}}/'"$(\\1)"'/g' which not work. however, echo 'lorem {{echo ipsum}}' | sed 's/{{\(.*\)}}/'"$(echo \\1)"'/g' gives me lorem echo ipsum i don't quite understand happening here. why can give backreference echo command, cannot evaluate entire backreference in $()? when \\1 getting evaluated? thing trying achieve possible pure sed? keep in mind entirely clear me trying achieve possible other tools. however, highly interested in whether possible pure sed. thanks! the reason attempt doesn't work $() expanded shell before sed called. r...

Importing Go source and coverage into SonarQube -

i have go project import sonarqube 5.1, using sonarrunner. i know it's not 1 of sonarqube's supported languages have set property sonar.import_unknown_files=true to accomplish basic level of import - , job. project has code coverage in cobertura format, generated using https://github.com/axw/gocov/ , https://github.com/aleksi/gocov-xml . i have not been successful in getting xml import settings: sonar.core.codecoverageplugin=cobertura sonar.cobertura.reportpath=coverage.xml hence project appears gray box on sonar dashboard. has done similar , got working? because go unsupported language? many thanks! andy yes, knowledge sonarqube cobertura plugin allows import coverage reports java (and maybe supported jvm based languages). however, if willing transformation on coverage result file, generic test coverage plugin might suit needs.

linux - Docker RUN groupadd && useradd directives have no effect -

i've built docker nginx 'base' image dockerfile fragment below: from ubuntu:14.04 maintainer me <me.net> run apt-get update && apt-get install -y supervisor add supervisord.conf /etc/supervisor/conf.d/ run apt-get install -y nginx .. this image linked database container , data volume. later, wanted add user container run applications user added 'run groupadd -r luqo33 && useradd -r -g luqo33 luqo33' directive dockerfile dockerfile this: from ubuntu:14.04 maintainer me <me.net> run groupadd -r luqo33 && useradd -r -g luqo33 luqo33 run apt-get update && apt-get install -y supervisor add supervisord.conf /etc/supervisor/conf.d/ run apt-get install -y nginx .. then rebuit image docker build -rm . , , run whole stack again docker-compose up (i have stack configured in docker-compose.yml). unfortunately, although run groupadd -r luqo33 && useradd -r -g luqo33 luqo33 step did not error out, when entered ...

ios - Change UIBarButtonItem color when selected -

i'm using images uibarbuttonitem pure white , transparent. how can change tint color when user selects item? there method tells me button selected inside uitoolbar ? you can change tintcolor of uibarbuttonitem when user taps so: @ibaction func mytoolbarbutton(sender: anyobject) { mytoolbarbutton.tintcolor = uicolor.greencolor() } you may want use uitabbar instead if user can select 1 button @ time. uitabbar change tintcolor of button selected , change button default color when select button. if keep uitoolbar have handle color changes yourself.

parse.com - Updating Parse User information locally without having to log out and log in again in Android -

i have app uses parse backend server. user information stored , can changed via edit profile activity. problem having this: 1. information gets changed on parse server correctly. 2. information doesn't updated on app unless log out, log in forces user information retrieved parse. 3. don't want force user log out/log in each time change information. there way refresh current parse user information way? yes, can through few options. first, can add swiperefreshlayout can surround main layout , users can swipe down refresh content. mean override onrefreshlistener 's onrefresh method call fetch() on objects parse wanted refresh, , update ui (notifydatasetchanged incase of listview/recyclerview/etc). another option, can provide refresh button somewhere in user interface, actionbar. same process swiperefreshlayout, right make click listener instead calls similar method defined in onrefresh method swiperefreshlayout. rememeber preform parseobject fetch call...

c# - Unable to get entity framework to generate a DbUpdateConcurrencyException (Database First) -

i'm trying implement optimistic locking model ef. have column timestamp datatype on tables i'm trying with. i've tried adding timestamp attribute on member modifying t4 script. running test , seeing not working, tried adding concurrencycheck attribute on same member in same way (via t4). however, in neither case generated sql utilize member on updates (shown below). i've set concurrency mode fixed on property in edmx designer. i can see timestamp column in separate select after update not on update itself. i've tried breaking on savechanges() , changing database record , seeing timestamp value changing after manual update, executing savechanges() line , executes fine without throwing exception. there i'm missing, need roll own timestamp comparison code, or need world of ef interceptors change sql output? thanks. the generated sql: (logged via dbcontext.database.log ) update [dbo].[foo] set [footitle] = @0 ([fooid] = @1) select [fooversion] [dbo]...

python - suggestion for processing huge amount of data on a single node system -

i have load huge amount of data(stackoverflow dump), process , generate files machine learning application. operations are.. parse xml file , load db(nosql or sql). use sax parser. do operations, group by(or aggregate) on database. then generate csv files. csv file generation on-demand. must not take more 2 minutes 10,000 records. my constraints python language can use , should run on dual core cpu(no distributed system). i tried using mysql , processing 21 million records took days(i created hell lot of indexes , aggregate operations). now, use mongodb, still takes lot of time. can suggest me technology can use make faster(like time taken can 4/5 hours).

windows phone - Ad added in DevCenter not visible in PubCenter, how to track? -

previously creating ad units in pubcenter , worked fine. time decided in devcenter. app published. has adcontrol proper app id , ad unit id. no ad showing up. it's ok, i'll wait time, maybe app should more downloads. the problem is: how can track statistics ad created in devcenter? can't find there. info in details app has add unit. there "ad mediation", i'm not using it. use microsoft's ad. when log in pubcenter account, can see app listed, without ad units. so, answer today is: not create ad units in devcenter. because don't work. workaround have created new app in pubcenter new ad unit , used ids in app. , works.

java - Adapting a command line-driven turn-based rpg to swing's event-driven paradigm -

background: for past few months, i've been working on turn-based rpg in free time in java. have been programming around year, expertise limited command line applications , object-oriented programming principles learned in elementary cs classes. development going swimmingly until started adapt game taking input command line using custom-made ui started building using swing. largely because command line-based input lets me stop i'm doing , wait input scanner or in vein, judging threads i've read on here ( waiting multiple button inputs in java swing , waiting till button pressed ), swing's event-driven nature doesn't allow wait without interrupting edt , freezing gui, bad thing purposes. the problem: while swing quite novel me, i've got working on main menu , see how readily applied games data relatively centralized between few objects utilize simple commands user move or attack or have you. problem rpg has anywhere between 2 , 16 active characters in ...

Closure and lm in R -

hi tried prepare little demo code closures in r when stumbled odd behavior. using debug realize failure happens due fact inside of lm line being executed mf <- eval(mf, parent.frame()) however seems defeat functional aspect of programming closures ? what missing ? here little example # typical closure use foo <- function(formula,data,weight=null) { if(is.null(weight)) w=ones(nrow(data),1) else w=weight force(w) lm(formula,data,weights=w) } setup_something <- function(...) { function(formula,data) { foo(formula,data,...) } } # set our model function model <- setup_something() # set our data df = data.frame(x=seq(1,10,1),y=c(1:10)^1.5 * 3 + 2) model(y~x,df) error in eval(expr, envir, enclos) : object 'w' not found instantiating formula (i.e. x~y ) captures both environment created in, in cases happens in parent.frame() of call model() . if want subjugate environment, can explicitly adding line right before cal...

playframework - Play Framework 2.4 and IntelliJ Idea -

Image
i trying open play 2.4 project in intellij since things have changed don't know how this. in previous versions run activator idea or use activator ui , click on generate intellij project, in 2.4 idea command doesn't seem exist [error] not valid command: idea (similar: eval, alias) [error] not valid project id: idea [error] expected ':' (if selecting configuration) [error] not valid key: idea (similar: clean) [error] idea [error] ^ and ui seems broken, when click on generate intellij project tries compile app , gives error: play/play$ java.lang.noclassdeffounderror: play/play$ use 'last' full log. failed load project. i created project scratch using play java template with: activator new i have tried importing folder project intellij doesn't seem identify project i run same problem, used idea open project folder, had play 2 app in sub folder, import module (play 2 app) system. and works well. after have changed module fo...

html - store Hebrew in database with utf- 8 encoding using php and mysql -

Image
i building web site database in hebrew (using php , mysql). on general use chrome test job... today tried explorer :-0 (yeh... must thinking "why f*** it... ;) ). found out data sent explorer stored in ????? , cannot used. i use <meta http-equiv="content-type" content="text/html; charset=utf-8" /> on main page and header('content-type: text/xml charset=utf-8'); on php page sends xml files (after receives request) on connect.ini.php included following code: mysql_query("set names 'utf8'",mysql_connect($host, $user, $password)); my ajax javascript is: if(xmlhttp.readystate==4||xmlhttp.readystate==0){ gender=document.getelementbyid("gender").value; xmlhttp.open("get","file.php?gender="+gender , true); xmlhttp...

python 2.7 - Simplifying Long List of `if` Statements -

i have lot of page objects application testing. page object have of elements on page. writing validate_fields method on each page object when tester navigates page, can call validate_fields method verify of items supposed on page in fact on page. the problem running validate_fields function can really long, , bunch of if not x.is_displayed(): self.problems.append("the item x missing page") with problems being list of problems assert empty @ end of our test. below code sample, there way simplify this? def validate_fields(self): if not self.el_page_header.is_displayed(): self.problems.append("the page header missing") if not self.el_preferred.is_displayed(): self.problems.append("the preferred check box missing") if not self.el_address.is_displayed(): self.problems.append("the address 1 field missing") if not self.el_address_2.is_displayed(): self.problems.append("the address...

javascript - Changing scope variables on events from a separates view's controller in Angular? -

say have login system, nav in on "main" view never changes, contains placeholder ng-model user's name: $scope.username = session.username(); however, being assigned page loads, , that's bad. how make login controller changes variable on maincontroller $http request returns successful? $scope.login = function() { $http.post('http://restfulservice.com', angular.tojson($scope.loginuser)) .success( function (data, status, headers, config) { if (data.out) { var data= json.parse(data.out); session.username(data.nombre); session.memorizarid(datos.idcliente); session.memorizarlogged(true); } you can take @ angularjs eventing mechanism $broadcast , $emit . once login successful can broadcast message , whichever controller listening message broadcasted message , act accordingly. $scope.login = function() { $http.post('http://restfulservice.com...

sql - Compare all parameters excluding the one selected? -

i'm working in sql server 2008. i've created stored proc, passed multiple values temp table. here's sample code of how temp table being populated: declare @ownerkey varchar(75) = '2,3,7,9,14,18,23,26,28' /* ***** temp table ***** */ if object_id('tempdb..#ownertable','u') not null drop table #ownertable create table #ownertable (owner varchar(10)) insert #ownertable select value ttt.parselist(@ownerkey,',') /* ***** temp table ***** */ later joined table, in order bring in multiple owner keys such: select t.product, o.ownerid table t join #ownertable o on o.owner = t.owner the issue i'm having stored proc being used in report , need exclude parameter being selected supposed compared other keys. question may convoluted, i'll best answer questions. essentially if user chooses parameter 2 want compare results other keys excluding key number 2 , need in ssms. i've tried merge when not matched , no avail. sorry l...

dictionary - Implement java map accessed by multiple threads that is only updated once for each key -

i need create map accessed multiple threads , ever has 1 (not null) value inserted in it. to clarify i'm trying : object getvalue(key) { if(map.get(key) != null) return map.get(key) else { object obj = new object(); map.put(key, obj); return obj; } } the easiest way make getvalue method synchronised, want make method efficient possible, requirement put 'else' part in synchronised block , locked somehow on 'key' value. best way implement this? i suspect want computeifabsent method. // support map allows concurrent access. concurrentmap<key,value> map = .... value oneperkey = map.computeifabsent(key, value::new); or value oneperkey = map.computeifabsent(key, key -> new value()); from javadoc computeifabsent the default implementation equivalent following steps map, returning current value or null if absent: if (map....

uitabbarcontroller - Is is possible to create a tabbarcontroller that does not have elements hidden within "More" section? -

i'm running issues similar ones described in this post , wondering if possible in tabbarcontroller not show "more" icon , display of view controllers in tab bar? the issue of reconciling show , hide becomes problematic if assume views have navigation bars , user may change order of tabs, hiding , showing tab bars becomes facet of project need keep track of in appearance , disappearance methods. per apple's documentation , morenavigationcontroller not set in tabbar's vc array, merely property

angularjs - Yoeman task "autoprefixer:dist" gets stuck -

i'm pretty new grunt workflow. have installed https://github.com/daftmonk/generator-angular-fullstack . when run grunt serve , gets stuck @ autoprefixer:dist task. when commented out autoprefixer task rest of task go through , app running. not sure whats wrong. please me rid of bottle neck, i'm pretty sure 1 line answer question. here's gruntfile 'use strict'; module.exports = function(grunt) { // load grunt tasks automatically, when needed require('jit-grunt')(grunt, { express: 'grunt-express-server', useminprepare: 'grunt-usemin', ngtemplates: 'grunt-angular-templates', cdnify: 'grunt-google-cdn', protractor: 'grunt-protractor-runner', injector: 'grunt-asset-injector' }); // time how long tasks take. can when optimizing build times require('time-grunt')(grunt); // define configuration tasks grunt.initconfig({ connect: { ...