Posts

Showing posts from March, 2010

model view controller - Jquery chosen plugin works in one page but not in another one -

hi have used chosen in other projects before , havent had problems in current project can't work on specific page, although works on page. firebug gives me error: syntaxerror: expected expression, got '<' '!doctype html' chosen.jquery.js (row 1) syntaxerror: expected expression, got '<' '!doctype html' prism.js (row 1) typeerror: $(...).chosen not function $(selector).chosen(config[selector]); the site develop using mvc framework , view display/loads script, 1 doesnt work, looks (edit-question): <h1><?=$title?></h1> <form method='post'> <fieldset> <input type='hidden' name='id' value='<?=$id?>' required/> <input id='textfield' type='text' name='titel' placeholder='titel' value='<?=$titel?>' tabindex='1' required/> <textarea id='askquestion' name

C - X11 API: Graphics not Working in a While Loop -

i trying draw background dynamically. graphics work great normally...but: int width, height; gc gc_backcolor; xgcvalues gcv_backcolor; width = c_values.width; height = c_values.height; gcv_backcolor.background = c_values.backcolor; gcv_backcolor.foreground = c_values.backcolor; gc_backcolor = xcreategc(display, canvas, gcbackground | gcforeground, &gcv_backcolor); int x = 0; int y = 0; while (y < height) { x = 0; while (x < width) { xdrawpoint(display, canvas, gc_backcolor, x, y); x++; } y++; } x = 0; y = 0; ...for reason, when run in loop, not work. if explain me why behaving way, grateful. could calling function on canvas expose event? while(1) { xnextevent(display, &event); if (event.xany.window == canvas) { if (event.type == expose) { canvas_draw(display, canvas, c_values); } } } here main code: #include <stdio.h> #include <stdlib.h> #include &

ruby on rails - How to send form data to #index with post instead of #create? -

i have resource route setup: resources :events for 1 form, i'd send data #index action :post method. how can this? i tried <%= form_tag url_for(controller: 'events', action: 'index'), method: :post , still goes #create short answer: can't routes. long answer: when using resources :events following routes defined you: get /events events#index /events/new events#new post /events events#create /events/:id events#show /events/:id/edit events#edit patch/put /events/:id events#update delete /events/:id events#destroy therefore index action isn't accessible post request. and trying (with f.e. custom routes resources :events ) make create action on post inaccessible.

ruby - How can I loop through arrays skipping previously referred elements? -

is there way loop through 2 arrays , have them refer element each time? example: first_array = ['a', 'b', 'c', 'd'] second_array = ['e', 'f', 'g', 'h'] first_array.each |item| puts item.get(second_array) the results like: a work e b work f c work g d work h i'm trying make when variable first_array passed work second_array , moves next variable in second_array , skipping used variable. that zip . first_array.zip(second_array){|e1, e2| ...}

android - Change spinner items color -

i developing android app , in activity have 3 fields: 1. mobile number 2. spinner 3. spinner after user enters mobile number want change color of spinner items. can tell me how can done ? in advance. you listen onfocuschanged that, in here . alternatively, implement textwatcher , listen ontextchanged event, in here .

camera - Stereo vision with OpenCV: PS3 Eye or Logitech C920? -

i have read 2 ps3 eye cameras can hardware-synchronized take pictures @ same time, need special drivers use them , need pay them because free version supports 1 ps3eye,is correct? is there software on opencv ready stereo either of cameras? the reason consider logitech c920 thehigher resolution , wider field of view, not find clear answer of fps can camera. any welcome, in advance! i presently working 2 ps3 eye cameras on similar problem. tried test viso2_ros package. faced few problems , decided depth map using robovision repo , see if sufficient feature points extracted. previous link had few make errors. can fixed seeing errors in terminal. camera addresses fixed /dev/video1 , /dev/video2 .

javascript - How do I get bootstrap modal working? -

below html <!doctype html> <html> <head> <title>title</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="styles/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="styles/bootstrap-theme.min.css" /> <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script> <script type="text/javascipt" src="js/bootstrap.min.js"></script> </head> <body> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mymodal">launch demo modal </button> <!-- modal file filter --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mym

c - Can a linked list node contain more than one data field? -

i'm rather asking if makes sense this. have not seen examples of haven't seen goes against idea. i in publisher-subscriber model, idea have far is: create list of topics, added file. but instead of having each name of topic , pointer next topic, kind of wanted have node of suscribers each topic, in each topic's node. since i'm explaining myself poorly, idea: struct topicnode{ char * topicname; //i believe there no problem pointers in lists again, have not seen doing either so... struct suscribernode; struct topicnode next; }; and make, if there's suscriber topic, list of suscribers topic. i've done similar things in java, i'm worried it's not such idea in c. yes, single linked list can contain data ------------------------------ ------------------------------ | | | \ | | | | data | next |--------------| data | next | |

php - Wordpress theme memory leak -

i'm developing custom wordpress theme 1 of clients , encounter several memory exhausted errors. at moment have set available memory @ 64mb , can set higher don't want this; optimize work. client insists use 2 plugins (visual composer & ultimate addons visual composer) takes more memory. my question is: how can see queries, objects, variables use memory , how can free those. i tried bunch of plugins (debug bar, memory viewer, p3, query monitor) tell me how memory use , nothing specific. can point me articles subject (i searched 2 days nothing clear returned subject). most of memory errors appear after make ajax calls. there can prevent memory overload in php function? any advice appreciated. thanks here code memory leak happens - problem somewhere around wp_head execution. investigations reveal jump in memory use @ time. question general guidelines , things in case need debug these kind of issues. // $args printed array ( [post_type] => estate_p

Select alternate rows from SQL Server table -

i working sql server 2008. have table not contain unique columns; how alternate rows it? sql server table: +-----+--------+ | id | name | |-----+--------| | 1 | abc | | 2 | pqr | | 2 | pqr | | 3 | xyz | | 4 | lmn | | 5 | efg | | 5 | efg | +-----+--------+ as we've come @ least 1 working suggestion question, i've tried below code; not proper technique when fetching huge amount of data. trial: create table #tmp ( id int, name varchar(10), srno int ) insert #tmp select id, name, row_number() on (order id) % 2 srno --,alternate rows employee select * #tmp srno = 1 --or srno = 0 above query gives out alternate rows i.e. 1st, 3rd, 5th or 2nd, 4th, 6th etc. please me out proper way without #tmp achieve goal! thank you! you can use select statement in-line view. don't need #tmp table. select t.id, name (select id, name, row_number() on (order id) srno employee) t (t.srno % 2

Cannot read Excel file from SQL Server with multiple versions of SQL Server -

exec sp_configure 'show advanced options', 1 reconfigure go exec sp_configure 'ad hoc distributed queries', 1 reconfigure go use [master] go exec master.dbo.sp_msset_oledb_prop n'microsoft.ace.oledb.12.0', n'allowinprocess', 1 go exec master.dbo.sp_msset_oledb_prop n'microsoft.ace.oledb.12.0', n'dynamicparameters', 1 go reading excel declare @sqlconnect varchar(8000) set @sqlconnect = 'select * openrowset(''microsoft.ace.oledb.12.0'', ''excel 8.0;database=d:\wages.xlsx;'', ''select * [sheet2$]'')' exec (@sqlconnect) exception msg 7399, level 16, state 1, line 1 ole db provider "microsoft.ace.oledb.12.0" linked server "(null)" reported error. provider reported unexpected catastrophic failure. msg 7303, level 16, state 1, line 1 cannot initialize data source

olap - Advice on creating analytical query (SQL) generator -

we migrating microsoft's analysis services (ssas) hp vertica database our olap solution. part of involves changing our query language mdx sql. had custom mdx query generator allowed others query data through api or user interface specifying needed dimensions , facts (outputs). generated mdx queries ok , didn't have handle joins manually. however, using sql language , since keeping data in different fact tables need find way how generate queries using same dimension , fact primitives. eg. if user wants see client name number of sales, might take request: dimensions: { 'client_name' } facts: { 'total_number_of_sales' } and generate query this: select clients.name, sum(sales.total) clients join sales on clients.id = sales.client_id group 1 and gets more complicated quickly. i thinking graph based solution store relations between dimension , fact tables , build required joins finding shortest path between nodes in graph. i appreciate information

jquery - Set checkbox value on submit ASP.NET MVC -

i have asp.net mvc view checkbox in form. there way change checkbox value when submit button clicked? i have form 2 text inputs , checkbox. have 2 submit buttons, when submit 1 clicked want submit form is. but, when submit 2 click want automatically set checkbox checked , post form controller. is there way this? in view or javascript? there 2 way solve this. first can set event on click on second button <input name="submit" type="submit" id="justsubmit"/> <input name="submit" type="submit" onclick="checkedcheckbox()" id="submitwithcheckbox"/> on javascript function checkedcheckbox() { $('#mycheckbox').prop('checked', true); } second 1 using server side. can name both of submit button validate , change value checkbox based on submit button pressed. <input name="submit" type="submit" id="submit" value="save" /> <

vb.net - Unhandle exception issue -

we have large app built using vb.net vs2012. every , when closing app unhandled exception occurs. random, sometimes doesn't. the error below. system.invalidoperationexception unhandled hresult=-2146233079 message=invoke or begininvoke cannot called on control until window handle has been created. source=system.windows.forms stacktrace: @ system.windows.forms.control.marshaledinvoke(control caller, delegate method, object[] args, boolean synchronous) @ system.windows.forms.control.begininvoke(delegate method, object[] args) @ system.windows.forms.windowsformssynchronizationcontext.post(sendorpostcallback d, object state) @ system.windows.forms.axhost.connectionpointcookie.finalize() innerexception: we produce dump file try , find originating have had no luck. debugger shows no source code available . are using third-party controls. @ point want find trying create control. if problem third party control , if don't have code, can&

jQuery spawn boxes and give css styling afterwards -

i'm trying make rain cookies on site. problem cookies spawn margin 50% , not @ 0 , margin 50 should be. i've found out that "alert();" make work, know, box appears every time. question is, there way make delay or make work? this code: i = 1; function spawncookies(){ /*setinterval(function() { var min = 10; var max = 60; var margin = math.floor(math.random() * (max - min + 1)) + min; }, 100);*/ setinterval(function() { bodywidth = $(window).width(); pos = math.floor(math.random() * bodywidth) + 0; var minwidth = 10; var maxwidth = 60; var width = math.floor(math.random() * (maxwidth - minwidth + 1)) + minwidth; thisdiv = $(".cookiearea").append("<div class='cookie "+i+"' style='width:"+width+"px; height:"+width+"px'></div>");

php - Getting Zillow API Data -

i can't access zillow information though feel using api correctly. help? $zillow_id = '<my zpid>'; $search = "2114 bigelow ave"; $citystate = "seattle, wa"; $address = urlencode($search); $citystatezip = urlencode($citystate); $url = "http://www.zillow.com/webservice/getsearchresults.htm?zws-id=$zillow_id&address=$address&citystatezip=$citystatezip"; $result = file_get_contents($url); //$data = simplexml_load_string($result); print_r($result); edit 1: error when run on inmotion hosting when run code on inmotion hosting server receive : <html><head><title>zillow: real estate, apartments, mortgage &amp; home values in us</title><meta http-equiv="x-ua-compatible" content="ie=8, ie=9"/><meta name="robots" content="noindex, nofollow"/><link href="//fonts.googleapis.com/css?family=open+sans:400&subset=latin" rel="styleshee

loopbackjs - AngularJS getting status code 0 for 413 (Request Entity Too Large) in Loopback API -

1. info i have angularjs 1.3.15 client-side app making requests loopback api. in app, intercept request results (with $httpprovider.interceptors) , interpret status codes display meaningful messages when user - example intercept 401 responses telling user doesn't have authorization, 200 when saves , on. 2. problem for example if user tries upload image that's big, request payload exceed remoting limit , able intercept requesterror status code shows 0. looking @ browser's console see this: put http://localhost:3000/api/modules?id=9 413 (request entity large) xmlhttprequest cannot load http://localhost:3000/api/modules?id=9. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost' therefore not allowed access. response had http status code 413. the problem if server offline, status code 0 when intercepting requesterror, there's no way me distinguish error connecting server between error sending data.

syntax error - Code::Blocks, process terminated with status 2 unexpected "(" C programming language -

i've installed code::blocks. check if worked created new project made hello world program in c went this. #include<stdio.h> main() { printf("hello, world"); } however when go compile error. -------------- build: src in code::blocks wx2.8.x (compiler: gnu gcc compiler)--------------- g++ -wall (invalid) -pipe -mthreads -fmessage-length=0 -fexceptions -winvalid-pch -dhave_w32api_h -d__wxmsw__ -dwxusingdll -dcbdebug -dcb_precomp -dwx_precomp -dwxuse_unicode -dbuilding_plugin -iquote.objs/include -i.objs/include -i. -i"(invalid)/include" -i"(invalid)/lib/gcc_dll/mswu" -isdk/wxscintilla/include -isdk/wxpropgrid/include -iinclude/tinyxml -iinclude -iinclude/scripting/include -iinclude/scripting/sqplus -iinclude/mozilla_chardet -iinclude/mozilla_chardet/mfbt -iinclude/mozilla_chardet/nsprpub/pr/include -iinclude/mozilla_chardet/xpcom -iinclude/mozilla_chardet/xpcom/base -iinclude/mozilla_chardet/xpcom/glue -c /home/jackphd/trunk/src/include

c# - Client update after launching a game - Unity -

im making multiplayer game in unity, , because of want has game have latest versión available. there way have it checks if there new update every time open game, , if there one, download , applies automatically? any appreciated :)

MongoDB PHP - findOne, using query to filter results not working for a specific item -

this mongo collection i'm trying test on: {"_id":{"$id":"54d5002adc533bf41000002c"},"tasks":[{"taskid":1,"taskname":"task 1 name here","subtasks":[1],"coords":{"gantt":{"x":10,"y":30},"pert":{"x":90,"y":100}}},{"taskid":2,"taskname":"task 2 name here","participators":[1,2],"startdate":"5-12-2014","enddate":"5-21-2014"},{"taskid":3,"taskname":"task 3 name here","subtasks":[3],"participators":[1]}],"participators":[{"participatorid":1,"participatorname":"participator 1 name here"},{"participatorid":2,"participatorname":"participator 2 name here"}]} i'm trying filter data based on id , return set of tasks, filtering using taskid.

How to save data in local hd with javascript? -

i'm using ckeditor create text in website create documents. problem internet connection, pc far away town , it's unstable 3g connection. have routine save draft every ten seconds (or time user wish be) in server safe - simple task. problem if internet goes down, user have select - copy text , try save locally text editor (maybe word, make mess). so i'm wondering if exists way of create file , download local hd without remote server, javascript , navigator. also, might way save job keeping cpu on , navigator open, couldn't find in stack overflow. i found 1 non-standard api firefox compatible: device storage api of course, not javascript standard don't know if it's idea use right now. any ideas? [compatibility note] this solution uses <a> attribute download , save data in text file. html5 attribute supported chrome 14+, firefox 20+ , opera 15+ on desktop , none on ios , current majors except webview on android . -

r - Use FFT fft() to compute a Riemann sum -

Image
i calculate following sum applying fast fourier transforms (fft). want compute following riemann sum approximation using fft : here psy function i'm using : psyfun<-function(u,t,r,q,sigma,lmbda,meanv,v0,rho){ j <- as.complex(1i) <- lmbda*meanv b <- lmbda d <- sqrt((j*rho*sigma*u-b)**2+(u**2+j*u)*sigma**2) g <- (b-j*rho*sigma*u-d)/(b-j*rho*sigma*u+d) ret <- exp(j*u*(r-q)*t) ret <- ret*exp((a/sigma**2)*((b - rho*j*sigma*u - d)*t - 2.0*log((1-g*exp(-d*t))/(1-g)))) return (ret*exp((v0/sigma**2)*(b - rho*j*sigma*u - d)*(1-exp(-d*t))/(1-g*exp(-d*t)))) } here sample parameters : r = 0.025 ,q= 0.01, sigma = 0.2, lmbda = 0.5, meanv = 0.5, v0 = 0.5 , rho = 0.3 i want compute values k , t equals : k1=172.77 , t1 = 0.197, k2= 75.63 , t2 = 0.563, k3 = 269.54 , t3 = 0.2648 i implement following code it: n=2^10 # number of subdivision in [0,a] alpha=2 # alpha delta= 0.25 # delta= a/n value of w (w i

multithreading - python flask alert on html while running a thread -

i using flask end of web page navigator, , can run thread on post method. thread counting class function in python file(counter.py), i'm looking way alert user front end when thread has done counting 5. there tool or library need use this? i'm not @ web programming tips help. thanks! :) class count(threading.thread) def __init__(self): count = 0 def run(self): while count < 20: print count time.sleep(1) count += 1 if count % 5 == 0: #alert user pass here code flask import flask, flask.views import counter mythread = counter.count() app = flask.flask(__name__) class view(flask.views.methodview): def get(self): return flask.render_template('index.html', message=l.message) def post(self): mythread.start() return flask.redirect(flask.url_for('main'))

php - pdf form sends FDF instead of PDF -

update discovered sends pdf if opened adobe reader @ computer, same pdf form sends fdf if opened in chrome browser @ website update end i using acrobat xi pro trial version adobe acrobat offer forms in pdf documents, forms can submitted server submit button settings http://gyazo.com/0ff0dc17210f39f062a131c85265406c my server code <?php ob_start(); $file = file_get_contents("php://input"); //gets binary pdf data $time = microtime(true); $newfile = "./customers/" . $time . ".pdf"; //names file based on time microsecond nothing gets overwritten. $worked = file_put_contents($newfile, $file); //creates file ob_end_clean(); ?> and getting fdf data instead, not pdf document in general adobe pdf forms full functionality available in adobe reader. google chrome pdf viewer sends fdf format. firefox pdf viewer don't allow form editing/sending @ all. maybe obvious, php developer , never worked pdf forms.

javascript - PM2 change cluster processes size at runtime -

does know if possible change in nodejs pm2 number of cluster processes application @ runtime? regards philipp you can use pm2 scale scale vertically number of process @ runtime, note work cluster mode . example : pm2 scale appname 2 add 2 process. pm2 scale appname -1 remove 1 process. source link

windows 7 - Unable to see IIS on my pc after installation -

i have downloaded iis 7.5 following url http://www.microsoft.com/en-us/download/details.aspx?id=1038 , installed on windows 7 home basic. installation successful. though i'm unable see iis in start menu. when typed inetmgr in run , clicked on ok, it's showing error message. typed iisreset in command prompt. it's restarting iis. when tried install iis windows platform installer, it's showing iis installed on pc. but, i'm unable see iis. please me out. in control panel, click programs. click turn windows features on or off. you may receive windows security warning. click allow continue. windows features dialog box displayed. expand internet information services. additional categories of iis features displayed. select internet information services choose default features installation. expand additional categories displayed, , select additional features want install, such web management tools. if installing iis evaluation purposes, may want selec

spring integration - parallely processing the messages from a queue -

i have below program consumes messages queue , queue tibco queue , trying develop utility lets situation comes in external application sends lots of messages on queue example somewhere around 20,000 messages in day have legacy code written in java simple consumes messages , write file named messagesday.txtand write messages of queue in file , store in c drive of computer now want enhance this legacy utility takes lots of time in consuming messages have chosen spring integration in technology , in spring integration have come below on xml in consuming messages queue rite now plese advise how can add concurrent consumers in multiple consumers can listen same queue @ time , write messages of queue text file , save in c drive of computer folks please advise <int:channel id="output" > </int:channel> <bean id="tibcoemsjnditemplate" class="org.springframework.jndi.jnditemplate"> <property name="environment"&

ASP.NET c# Rating control - making it one time rating and fixed -

i'm trying follow example allow users rate seminars have attended: http://www.aspsnippets.com/articles/using-aspnet-ajax-rating-control-inside-gridview-templatefield-itemtemplate.aspx how can make rating rated user once , display ratings rated user? dont want let users change own rating multiple times. thanks! on fruit_rating table have add userid . fruitid | rating | userid and before inserting rating, have make query see if userid made rating on fruit , if it's true skip, else make insert. pseudo cod below. var currentrating = getfruit_ratingby(ratingid , userid); if(currentrating == null) { currentrating = new fruit_rating(fruitid, newrating, userid); insert(currentrating); } if want cell readonly can override rowdatabound event , write logic readonly there.

ruby on rails - Undefined method `answer' for class -

i have form can ask question , add question few answers. when try save question , answers clicking 'create' error: "undefined method `answer'" in questions_controller.rb in 'create' method. my question.rb model: class question < activerecord::base has_many :answers, :dependent => :destroy accepts_nested_attributes_for :answers, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true before_save { self.content = content.downcase } validates :content, presence: true, length: { maximum: 150 } end my answer.rb model: class answer < activerecord::base belongs_to :question validates :answer, presence: true, length: { maximum: 150 } end questions_controller.rb: class questionscontroller < applicationcontroller def show @question = question.find(params[:id]) end def new @question = question.new 3.times answer = @question.answers.build end end def create @ques

javascript - Using DataTables, how to specify an element inside a <td> to be searched -

i'm using jquery datatables, , have table cells, each <td> contains <span> , hidden <select> , want filter on text inside <span> not whole content of <td> contains hidden <select> element. i'm using basic datatables configuration: $(document).ready( function () { $('#table_id').datatable(); } ); i've been trying couple of days on site, datatables site , googling, couldn't find answer, please in advance the code generated on server, resulting table this: please notice that: <select> element hidden css <tr> <td> <span>text</span> <select> <option>option1</option> <option>option2</option> .... </select> </td> <td> <span>text</span> <select> <option>option1</option> <option>option2</option>

android - getPacketManager().resolveActivity(...) - Fails only with system applications -

i retrieve installed applications via following code: final intent mainintent = new intent(intent.action_main, null); mainintent.addcategory(intent.category_launcher); final list < resolveinfo > pkgappslist = context.getpackagemanager().queryintentactivities(mainintent, 0); when call resolveactivity() function system packagenames receive following exception: java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.string android.net.uri.gethost()' on null object reference @ android.os.parcel.readexception(parcel.java:1546) @ android.os.parcel.readexception(parcel.java:1493) @ android.content.pm.ipackagemanager$stub$proxy.resolveintent(ipackagemanager.java:2513) @ android.app.applicationpackagemanager.resolveactivityasuser(applicationpackagemanager.java:545) @ android.app.applicationpackagemanager.resolveactivity(applicationpackagemanager.java:539) @ com.github.aayvazyan.polyse.util.apkinfo.getresolv

WebStorm shortcut commands -

what shortcut tab commands, such cw -> console.writeline() in vs , sout -> system.out.println() in intelij, webstorm? or can find them? googling phrases such "webstorm shortcuts" , "webstorm shortcut phrases" give me ordinary keyboard shortcuts, not looking for. it's called live templates . you can find them under settings > editor > live templates . the template system.out.print() sout .

xcode - Increasing an images size over time? -

i have image needs increase in size on time. how go doing that? var timer = nstimer.scheduledtimerwithtimeinterval(0.4, target: self, selector: selector("grow"), userinfo: nil, repeats: true) for actual function confused how write it. if want fluid animation, use this: uiview.animatewithduration(0.4, animations: { () -> void in imageview.transform = cgaffinetransformmakescale(2.0, 2.0) })

java - Null pointer exception, taking data form lists and arrays -

i've checked several time, can't wrong.. main class: try { file productdata = new file("productdata.txt"); product [] consideredrange = inputfiledata .readproductdatafile(productdata); electronicsequipmentsupplier management = new electronicsequipmentsupplier(1, 12, consideredrange); file customerdata = new file("customerdata.txt"); scanner filescan = new scanner(customerdata); while(filescan.hasnext()) management.addnewcustomer(inputfiledata. readcustomerdata(filescan)); management.addnewpurchaseorder("21/01/12", "psc-1235", "kd/9767", 50); } catch(exception e) { system.out.println(e); e.printstacktrace(); } inputfiledata class works perfectly. have created object of electro

gruntjs - Protractor with Mocha/Chai don't display errors since 1.8.0 migration -

i'm having lot e2e tests done protractor 1.3.1 / mocha 1.21.4 , chai 1.9.1. since migrate protractor 1.8.0, mocha 2.2.1, i've got no error description when test fail. make hard find wrong. example : we connected mongo ! show/hide login bar : √ should see login bar √ should see loggin button √ should not see loggout button account creation popup : √ should see create account form (944ms) √ should not able submit form √ should possible submit form after checking cg (1102ms) √ should not possible submit form without typing email, pseudo , accounttype (530ms) √ should possible submit form email, pseudo , accounttype (2325ms) √ should possible create account submitting form (1423ms) √ should not possible create account existing , activated show direct account creation popup : √ should display accountcreationpopup when calling /create-account.html (1980ms) exception thrown: keeping selenium se

java - Android Studio - App compiles, but won't run. See error -

Image
i ported app eclipse android studio, , app won't run. clear, did not export eclipse. created new project in android studio, , manually cut/pasted every class in project. i running android studio on new macbook pro - yosemite. having issues running app, though compiles. can see, problem might using jdk 1.8. well, cannot figure out how heck jdk 6. here error when run project in android studio error:execution failed task ':app:predexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home/bin/java'' finished non-zero exit value 1 when scroll in gradle event log, see error: com.android.dx.cf.iface.parseexception: bad class file magic (cafebabe) or version (0034.0000) in addition app not running, android studio freezes lot! again, because of version of java have installed? wait, why didn't import proje

python 3.x - How to prepare longitudinal data by Pandas to be then used from a learning algorithm? -

Image
i using pandas clean , prepare datasets used learning algorithm such random forest classification or k-means clustering. i used have datasets (illustrated example): however, facing in such of dataset different type called: longitudinal data following illustrated example: as can see, every single instance (person or car) has several values same feature every value added @ specific point of time. this edited example dataset: "id","temperature","***", "001","36","***", "001","36","***", "001","37","***", "001","36","***", "002","38","***", "002","38","***", "002","36","***", ... "004","37","***", "004","37","***", "005","36","***", "005"

osx - Change title bar colour - Mac -

Image
i working on mac app. wandering if possible change title bar colour in nswindow? know how remove it, problem removes 3 buttons (close, minimise, resize). want keep 3 buttons rid of bar. is there anyway this? yes, it's been done here on so: how change color of nswindow title bar in osx they one-link answers bad form here, heck-- you're asking. , works-- i've tried myself. the couple things notice: code there works on default window of nsapp... need bit of work generalize case of / "any" nswindow. ( take code puts in appdelegate , move own subclass of nswindow or nswindowcontroller. controller. ) also, says subclass nsview "mytitleview", in code, it's called "blacktitlebarview"... pick 1 name, consistent, , it's fine. also, color of title text in drawstring: method, has [nscolor whitecolor]. also, gets fancy gradients, you'll see when run code... if don't need or want that, can replace chunks of code

image processing - Rolling ball background subtraction algorithm for OpenCV -

is there opencv (android) implementation of "rolling ball" background subtraction algorithm found in imagej: process->subtract background? opencv has backgroundsubtractormog class, used video streams not single, independent images. this example of method does: http://imgur.com/8sn2cfz here documentation of process: http://imagejdocu.tudor.lu/doku.php?id=gui:process:subtract_background there's no implementation in opencv c libraries know of , android jni wrappers - wrappers around main libraries. having said source code imagej implementation available online here , should able incorporate directly android image processing pipeline. there discussion relative merits of rolling ball vs. e.g. using disk structuring element (which is available in opencv) here . if absolutely require rolling ball , opencv unfortunately it's not available 'out of box'.

multithreading - c# Controlled Thread Pooling. More threads are running simultaneously than expected -

first timer threadpooling , critical sections. i'm trying manage number of threads active @ given time. mythreadpool class manages thread counts , active threads. myusefulwork has square method accessed threads. main method queues work using threadpool.queueuserworkitem. i'm using manualresetevent class methods set() , waitone() try , limit threads max count(mythreadpool.maxthreads) 3 in example. apparently i'm doing wrong, given activethreads count going way beyond maxthreads upto 18(which displayed in output 'increment: number' or 'decreement: number'). activethreads incremented within lock if thread waiting, active thread not incremented. so if can point out doing wrong, of great help. thank you. using system; using system.collections.generic; using system.threading; namespace threadingdemo { class myusefulwork { public void square(object number) { try { console.writeline("thr

javascript - Implementing a live email checker with a syntax email checker -

i followed example, http://formvalidation.io/examples/using-data-returned-validator/ , , able implement simple validation email , usernames. found demo/example uses ajax call live email checker php script. what have not figured out how implement (combine) live username checker standard validator both checks see if email of valid format in addition available use, not registered member already. messing javascript, have gotten validator see php script, check_email.php using ajax post. however don't have right syntax make validator make use of result of php script return message 'duplicate" or "email in use". html email: <!-- email --> <div class="form-group"> <div class="row"> <label class="col-xs-6 control-label">email address</label> <div class="col-xs-6" style='clear:left;width: 50%;'> <input type="text" class="form-control email"

How method preference work in java? -

i want understand how below code snippet work ? class annathread extends thread { public static void main(string args[]){ thread t = new annathread(); t.start(); } public void run(){ system.out.println("anna here"); } public void start(){ system.out.println("rocky here"); } } output - rocky here there's not explain. you override start() code prints rocky here then call start() prints rocky here . (the run method never involved) people confuse purpose of start , run . see instance question:        why call thread.start() method in turns calls run method? the rules simple: thread.run ordinary method (no magic) thread.start contains magic because spawns separate thread (and lets thread invoke run ). if override thread.start own method, there's no magic left anywhere.

navigation drawer - Android 5.1, ActionBarDrawerToggle not showing the arrow, worked with 5.0 with no code changes -

i use toolbar action bar, drawerlayout , actionbardrawertoggle. min , target sdk 21. @ point, working fine while device running 5.0.1 (api 21). other day, got 5.1 update , drawer toggle broke - arrow/hamburger icon not showing more. here code: setactionbar((toolbar) findviewbyid(r.id.toolbar)); drawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); drawertoggle = new actionbardrawertoggle(this, drawerlayout, r.string.action_open_drawer, r.string.action_close_drawer); drawerlayout.setdrawerlistener(drawertoggle); i have drawertoggle.syncstate() in onpostcreate(). since i've updated min , target 22, along compile , build tools 22 , 22.0.1 respectively, , support libs use 22.0.0, , nothing helped. any ideas? so managed hamburger/arrow icon work again. did add magic line: getactionbar().setdisplayhomeasupenabled(true); why works have no idea. seems not make sense, hamburger has nothing drawer toggle. or it?

performance - Duplicate removal within a certain distance in Python -

i have 2 numpy.arrays of points (shapes (m,2) , (n,2)) this: a = numpy.array([[1,2],[3,4]]) b = numpy.array([[5,6],[7,8],[9,2]]) i need merge them array next condition: if there 2 points distance less or equal epsilon, leave one i have code, it's slow: import numpy np eps = 0.1 = np.array([[1,2],[3,4]]) b = np.array([[5,6],[7,8],[9,2]]) point in b: if not (np.amin(np.linalg.norm(a-point)) <= eps): = np.append( , [point], axis=0) what best way using numpy? thanks lot! you calculate delaunay triangulation first, list of neighboring points can extracted: import numpy np itertools import product scipy.spatial import delaunay eps = 3. # choose value, filters out points = np.array([[1,2],[3,4]]) b = np.array([[5,6],[7,8],[9,2]]) # triangulate points: pts = np.vstack([a, b]) tri = delaunay(pts) # extract edges: si_idx = [[0, 1], [0, 2], [1, 2]] # edge indeces in tri.simplices edges = [si[i] si, in product(tri.simplices, si_idx)] di

android - How set AdView refresh interval from Java code -

how programaticaly set interval refresh adview (com.google.android.gms.ads.adview) java code? i can use com.google.android.gms.ads.adview.loadad(...) inside timertask . but may exist method set interval in adview without timers or threads? if using admob, when set specific advertisement, gives option select refresh rate. if set admob unit, go monetize , click on ad edit it.

Ram usage going crazy while using Dim ... as New Bitmap with a timer -

i'm making bot needs detects pixel colors @ few spots every 100ms. way found save current screen bitmap , colors bitmap. seems each 100ms creates new bitmap , don't rid of previous one, increase ram usage ! here code : private sub timer1_tick(sender object, e eventargs) handles timer1.tick dim img new bitmap(1280, 720) dim imggraphics graphics = graphics.fromimage(img) imggraphics.copyfromscreen(0, 0, 0, 0, img.size) dim slot1selec color = img.getpixel(1158, 572) if slot1selec.toargb = -65906 label2.text = ("1") else : label2.text = ("0") end if dim slot1life color = img.getpixel(1148, 559) if slot1life.toargb = -13052710 label3.text = ("1") else : label3.text = ("0") end if and i'm checking 16 pixel colors, here 2 it's same thing after slot2selec, slot2life, slot3selec, slot3life etc... please ! else other way pixel color without creating stupid bitmaps alo

Why is my CSS3 animation not working? -

i have following css3 animation want in chrome: (fadein, , change text color). have div element class "divvy" , contains text "hello world". don't know whymy css is: .fade-in { opacity:0; -webkit-animation:fadein ease-in 1; -moz-animation:fadein ease-in 1; animation:fadein ease-in 1; -webkit-animation-fill-mode:forwards; -moz-animation-fill-mode:forwards; animation-fill-mode:forwards; -webkit-animation-duration:0.3s; -moz-animation-duration:0.3s; animation-duration:0.3s; -webkit-animation-delay: 0.5s; -moz-animation-delay: 0.5s; animation-delay: 0.5s; } @-webkit-keyframes example { {color: black;} {color: yellow;} } @keyframes example { {color: black;} {color: yellow;} } .divvy { color: black; -webkit-animation-delay: 1s; -moz-animation-delay: 1s; animation-delay: 1s; -webkit-animation-name: example; -webkit-animation-duration: 4s; anima

ruby on rails - url helper for namespace nested model -

i using public_activity gem. use gem, not need create activities controller it. did not. however, have comments controller. want have following url helper comment's create action: public_activity_activity_comments_path(@activity) i have tried 2 things in routes , both have failed. first, tried using namespace route: namespace :public_activity resources :activity resources :comments end end this produces error: actioncontroller::routingerror - uninitialized constant publicactivity::commentscontroller: since not have publicactivity::activities controller, tried instead: get '/public_activity/activity/:activity_id/comments/new', to: 'comments#new' post '/public_activity/activity/:activity_id/comments', to: 'comments#create' however, not seem produce url helpers @ all, gives me following error: nomethoderror - undefined method `public_activity_activity_comments_path' #<#<class:0x007f868e1b7760>:0x00

javascript - Angular not updating view when changed by service called from controller -

it seems when use service, called controller, within directive, update array in main controller (mycontroller in example), angular doesn't update view. however if leave service out, , have directive directly update array, view updated. (in example below have, in mydirectivescontroller there 2 lines, 1 commented out version works - changing gridindirective directly....the line below calls myservice, gridindirective array locally, , seem change locally, view not updated) if run example idea click on colored div , elements of array, printed ng-repeat loop, changed. i have experimented using $scope.$apply() in few places (a) didn't work , (b) understanding that should necessary if making changes outside of angular...and don't think am. so question is, how version of grid updated in myservice update view, , why doesn't work way have it? thanks in advance takes time have look. 'use strict'; (function() { var ssheet = angular.module('s