Posts

Showing posts from July, 2013

javascript - How to fetch data from ajax.inc.php page, using node modules? -

i use node.js , want http://myanimelist.net/includes/ajax.inc.php?t=64&id=1 page , fetch data need. wasn't able make cheerio, because i've never encounter such kind of pages before. i'll glad if tell me how parse such pages , node module use since wasn't able figure out google, understand should easy , i'm asking silly question. here, simple extracted output html output via code. { "description": "in year 2071, humanity has colonized several of planets , moons of solar system leaving uninhabitable surface of planet earth behind. inter solar system police attempts ke...", "genres": "action, adventure, comedy, drama, sci-fi, space", "status": "finished airing", "type": "tv", "episodes": "26", "score": "8.83", "ranked": "#22", "popularity": "#31", "members...

python - I can't connect mongodb with django -

Image
i use mongoengine. , below settings: _mongodb_user = 'user1' _mongodb_passwd = '12345678' _mongodb_host = 'mongodb://user1:damian123@ds99999.mlab.com:23932/projekt_dkjp' _mongodb_name = 'baza1' _mongodb_database_host = \ 'mongodb://%s:%s@%s/%s' \ % (_mongodb_user, _mongodb_passwd, _mongodb_host, _mongodb_name) mongoengine.connect(_mongodb_name, host=_mongodb_host) databases = { 'default': { 'engine': '', }, } and when run server see problem: file "c:\users\vbox\pycharmprojects\projekt06\projekt\projekt\settings.py", line 90, in mongoengine.connect(_mongodb_name, host=_mongodb_host) file "c:\users\vbox\appdata\local\programs\python\python35-32\lib\site-packages\mongoengine\connection.py", line 165, in connect return get_connection(alias) file "c:\users\vbox\appdata\local\programs\p...

Install rpy2 with custom R installation -

i have custom installation of r in ~/r-3.2.2/bin/ when run sudo pip install rpy2 i warning: tried guess r's home no command (r) in path. traceback (most recent call last): file "<string>", line 17, in <module> file "/tmp/pip-build-itkmkr/rpy2/setup.py", line 330, in <module> ri_ext = getrinterface_ext() file "/tmp/pip-build-itkmkr/rpy2/setup.py", line 231, in getrinterface_ext r_home = _get_r_home() file "/tmp/pip-build-itkmkr/rpy2/setup.py", line 63, in _get_r_home r_home = r_home.split(os.linesep) unboundlocalerror: local variable 'r_home' referenced before assignment i have found no answer problem, though appears in several posts. here tried add r executable path export path=$path:/home/r-3.2.2/bin/ did not work export r_home same value: did not work echo export path=$path:/home/r-3.2.2/bin/ >> ~/.bashrc source ~/.bashrc did not work. on other hand "pr...

angularjs - Bootstrap nav-tabs not working with Angular $routeprovider -

i using angularjs , bootstrap. while using $routeprovider spa, using bootstrap layout. working fine. however, trying use bootstrap nav-tabs have tab based navigations. my html this: <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#/mis">...

Java Applet doesn't find included JAR files on Windows -

i'm using jtds driver connect sql server... included jar file proyect... compiled proyect jar file, signed jar file. uploaded website. when test on ubuntu works charm. on windows shows error "no suitable driver found" (or that). seems windows dosen't find jtds driver jar file... because if extract jar file website directory error dissapears, shows me permissions errors because there no signed jar... what can do?

ios - Cycling through value event types and making value UIButton's titleLabel with Firebase in swift -

inside of app have seem have ran error. not runtime error or bug, not being able figure out how or go it. in 1 part of app, users can post data firebase using firebase reference in swift. in part, getting stuck, how not read data, organize that. have list of ten uibuttons on view controller , trying have every time value changed using firebase's method .observeeventtype(.value, withblock: { snapshot in }) catch snapshot.value , downcast string using as! string , make that, recent data, first uibutton's title , second uibutton's title old first unbutton's title etc. until ninth uibutton's title tenth , tenth ignored. cycle of uibutton's title based on ten recent posts firebase. great , hope helps other people! thanks! below attempt @ code: override func viewdidload() { super.viewdidload() // firebase reference defined // uibuttons deck1 - deck10 defined refname.observeeventtype(.value, withblock: { snapshot in ...

Making database connection in Python with Sybase or odbc -

in organization make use of sybase create db service of database , our software connect service make use of database. i using python(pycharm) , want connect db service. or if create new service in python code work done. able following connection string information interactive sql while connecting same service- "uid=;pwd=;server=;astart=no;links=tcpip()" i want able create db connection in python using above information. helpful if can give me sqlalchemy db url(or working format) such scenarios. my simple goal able connect database , result of select queries in list or dictionary. engine = create_engine(' connectionstring ') what should format of connectionstring given above information?

java - WordNet does not have a definition for the word 'for' -

i'm using wordnet 3 validate english words, not have definition word for . code snippet: system.setproperty("wordnet.database.dir", modelfolder); // path wordnet nounsynset nounsynset; nounsynset[] hyponyms; wordnetdatabase database = wordnetdatabase.getfileinstance(); synset[] synsets = database.getsynsets(word); // no results boolean isfound = synsets.length > 0; wordnet semantics, i.e. meaning of words, doesn't contain words have no meaning grammatical function. these called function words. source: http://www.d.umn.edu/~tpederse/group01/wordnet/wordnet-stoplist.html

javascript - how to add a loading page before the page completly shows up -

i want add loading page before main page show when loading complete. animates till page load complete ? you add element in page <div id="loading"> <img src="http://www.iceflowstudios.com/v3/wp-content/uploads/2013/01/loadingcircle_firstani.gif" /> loading... </div> jquery: $(window).load(function(){ // page loaded // fade out overlaying div $('#loading').fadeout(); });

How to compute the GCD of a vector in GNU Octave / Matlab -

gcd (a1, a2, ...) computes gcd of elements a1(1), a2(1), ... . being elements stored in vector a , how compute gcd (a) ? (i mean, gcd (4, 2, 8) = 2 , gcd ([4, 2, 8] raise error in gnu octave 4.0.0). with cell array expansion here one-liner, valid in octave (thanks nirvana-msu pointing out matlab's limitation): a = [10 25 15]; gcd(num2cell(a){:}) # ans = 5 this use cell array expansion, bit hidden there : accessing multiple elements of cell array ‘{’ , ‘}’ operators result in comma separated list of requested elements so here a{:} interpreted a(1), a(2), a(3) , , gcd(a{:}) gcd(a(1), a(2), a(3)) performance still under octave a = 3:259; tic; gcd(num2cell(a){:}); toc elapsed time 0.000228882 seconds. while gcd_vect in @nirvana_msu answer, tic; gcd_vect(a); toc elapsed time 0.0184669 seconds. this because using recursion implies high performance penalty (at least under octave). , more 256 elements in a, recursion limit exhausted. ...

swift - Access Computed Property of a Protocol in a Protocol Extension -

assume have protocol like protocol typedstring : customstringconvertible, equatable, hashable { } func == <s : typedstring, t : typedstring> (lhs : t, rhs : s) -> bool { return lhs.description == rhs.description } i want able provide default implementation of hashable : extension typedstring { var hashvalue = { return self.description.hashvalue } } but problem error use of unresolved identifier self . how create default implementation of hashable using string representation given description property defined in customstringconvertible protocol? the motivation want create shallow wrappers around strings, can semantically type-check code. example instead of writing func login (u : string, p : string) -> bool instead write func login (u : username, p : password) -> bool (failable) initialisers username , password validation. example might write struct username : typedstring { let description : string init?(username : string) { ...

deployment - ear deploying to jboss 7 is successfully but context-root doesn't work -

i'm using maven 3.3.3 create ear application(with war , jars). web-xml: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <welcome-file-list> <welcome-file>/landingpage.xhtml</welcome-file> </welcome-file-list> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> <context-param> <param-name>javax....

Can the same SQL query be run against a SQL Server 2012 column-based table and an earlier row-based table on an earlier version of SQL Server? -

i have problem using column-based storage feature in sql server 2012 out lot. there bunch of people using earlier versions of sql server won't able upgrade. in theory, possible create table works optimally on both? i'm hoping client running sql server reports work both against 2012 columnar instance , non-columnar standard instance table difference 2012 1 faster. is doable? what need watch out when reading/writing massive amounts of data in storage-type agnostic way? thanks it's possible have sql queries compatible both earlier version of sql , 2012. things should fine unless using deprecated functionality in earlier versions or new features 2012 (you'd know if were). here's link microsoft's summary of changes in sql 2012 might need watch out http://technet.microsoft.com/en-us/library/cc707787.aspx .

java - Getting months as 01,02 instead of 1,2 -

i working calender class , more need 12 months 2 numbers. if use following code: int month = (mycalendar.get(calendar.month)) +1; this different months: 1,2,3,4,5,6,7,8,9,10,11,12 but need is: 01,02,03,04,05,06,07,08,09,10,11,12 this beacuse need make substrings , go wrong if number of ints get. there easy way fix this? i use if statement , check if whole date 5 numbers, add 0 , 3 position, feels cumberstone. the reason loading "1" instead of "01" because stored in int , following if statement: string smonth = ""; if (month < 10) { smonth = "0"+string.valueof(month); } else { smonth = string.valueof(month); } then use smonth instead of month .

laravel - php artisan development server crashing -

Image
for php laravel development i'm using build-in webserver of php. start command "php artisan serve" on windows. few months working charm, it's of sudden crashing on pages didn't change recently. as try load page, error: it's in dutch, it's general windows crash message. in log file see: mail_encryption=null.error: exception 'invalidargumentexception' message 'there no commands defined in "view" namespace.' in d:\home-automation\webinterface\vendor\symfony\console\symfony\component\console\application.php:501 stack trace: #0 d:\home-automation\webinterface\vendor\symfony\console\symfony\component\console\application.php(535): symfony\component\console\application->findnamespace('view') #1 d:\home-automation\webinterface\vendor\symfony\console\symfony\component\console\application.php(192): symfony\component\console\application->find('view:clear') #2 d:\home-automation\webinterface\vendor\symfony\con...

c# - I am trying to make AngularJS/MVC Asp.Net app and I stuck while trying to get JSON data from controller -

task make web aplication mp3 file managment. list of functionalities application should have: adding, editing , deleting mp3 parameters (song name , author ...) adding, editing , deleting playlists adding mp3 files in numbers of playlists searching files name, author , playlist (search should done on server) view of each entry should able bookmark(add favorites) in browser back , forward buttons should work on whole application in browser technical requirements: application should made single page web application fetches data using ajax calls angularjs should used on client side , asp.net mvc on server side data should stored in persisten storage upon first start application should able add test data in database so far have made mvc asp.net application , added sql database model first approach . has 2 tables 'playlist' , 'song' ( one many relationship ). later on have auto generated songcontroller , playlistcontroller (mvc 5 controller views,...

Extract geo keys field from MongoDB "NYC restaurant" collection by JAVA -

i use dataset nyc restaurants in mongodb. each restaurant has address example: "address" : { "building" : "461", "coord" : [-74.138492, 40.631136], "street" : "port richmond ave", "zipcode" : "10302" } i tried "coord" pair of double java code - not work list. data structure [-74.138492, 40.631136] ? want compare restaurant coordinate location find restaurants in specific range. meantime i've found way "coord" fields double. code far perfect. if knows more elegant way - i'll glad know. "closestpoints" method calculate box of defined range around location. meantime prints out filtered coordinates. //.... code..... db db = mongoclient.getdb("test"); dbcollection coll = db.getcollection("restaurants"); basicdbobject query = new basicdbobject(); query.put("cuisine", "chinese")...

c# - Using DateTimePicker to specify my ReportViewer in MS Access -

so use datetimepicker parameter display specific dates database, report generating dates based on today, though i've tried using other dates. please help, stuck. private void button1_click(object sender, eventargs e) { datatable dt = new datatable(); try { oledbcommand com = new oledbcommand(); oledbdataadapter adapter = new oledbdataadapter(); connection.open(); com.connection = connection; if (true) { com.commandtext = string.format("select customer.cid, customer.firstname, customer.lastname, customer.mobilecontactnumber, booking.vehiclenumber, customer.membertype, customer.points, booking.[date], booking.[time] (booking inner join customer on booking.cid = customer.cid) booking.[date] = ' "+datetimepicker1.value+"'"); adapter.selectcommand = com; adapter.fill(dt); } this.dat...

python - <type 'exceptions.SyntaxError'> invalid table/column name "size" is a "ALL" reserved SQL/NOSQL keyword -

db.define_table('bookspace', field('locaton','string'), field('size','string'), field('availablefrom', 'string'), field('availableto', 'string'), field('rooftype', 'string'), field('sitetype', 'string'), field('name', 'string'), field('email', 'string'), field('mobile', 'string'), field('industry_food', 'string'), field('industry_ecommerce', 'string'), field('industry_furniture', 'string'), field('industry_exim', 'string'), field('industry_auto', 'string'), field('industry_chemical', 'string'), field('industry_logistics', 'string...

if statement - CLIPS - if then else function gives [CSTRCPSR1] err -

Image
here error summary: clips> (load "c:/users/labor/desktop/witek/projekt.clp") defining defrule: r1 +j+j defining defrule: r2 +j+j defining defrule: r3 =j+j+j defining defrule: imie-if =j=j+j+j [cstrcpsr1] expected beginning of construct. and here code clips program. want react different if name , last name different abraham lincoln. (defrule r1 (initial-fact) => (printout t "enter name:" crlf) (bind ?name (read)) (assert (name ?name))) (defrule r2 (name ?name) => (printout t "enter last name" crlf) (bind ?lastnm (read)) (assert (lastnm ?lastnm))) (defrule r3 (and(name ?name)(lastnm ?lastnm)) => (printout t "how old " ?name "?" crlf) (bind ?age (read)) (assert (age ?age))) (defrule name-if (name ?name)(lastnm ?lastnm)(age ?age) => (if(and(eq ?name abraham)(eq ?lastnm lincoln)) (printout t "hello " ?name " " ?lastnm ", " ?age " years old bro" crlf)) else (printout t ...

javascript - D3 - How to get width of previous elements in Text selection -

in code below, seek insert 3 strings on screen 1 next other to so, need calculate screen width of labels have been displayed, highlighted in attr("x",...) line. how refer previous elements during selection in d3? references: how refer previous element , how calculate width of text before displaying it var labels = ['a label', 'another label', 'a third label'] var textitems = svg.append('g') .selectall('.my_labels_text') .data(labels) .enter() .append("text") .attr("class", "my_labels_text") .attr("text-anchor", "left") .attr("x", function (d, i) { return <cumulated width of labels displayed>}) .attr("y", 10) // arbitrary y value .text(function(d) { return d }) if need keep running width count; use variable in outer scope: <!doctype html> <html> <head> <script data-...

How to parse json text data with python -

i need make request api of client, , api returns data: [6,0,'vt3zrya',5,'usuezwa',5,0,0,0,0,0,4,0,0,0,2,0,0,3,0,0,0,0,2,0,1,["portale.titolari.client.config.shoulderdto/4121330600","java.util.hashset/3273092938","matteo sbragia","java.util.arraylist/4159755760","java.util.date/3385151746","matteo"],0,7] how can parse data , extract following fields : matteo sbragia matteo i've tried code, it's not working : data = json.load(output_data) pprint data this in fact not valid json string because contains single quotes ' . can replace single quotes double quotes , parse string it's question whether intentional or mistake: import json s = '[6,0,\'vt3zrya\',5,\'usuezwa\',5,0,0,0,0,0,4,0,0,0,2,0,0,3,0,0,0,0,2,0,1,["portale.titolari.client.config.shoulderdto/4121330600","java.util.hashset/3273092938","matteo sbragia","java.ut...

c# - VS2015 Community ASP.NET5 Dependency injection and azure publish errors after UWP update -

until had working asp.net 5 mvc webapi project. worked locally , able push azure cloud (publish option). week ago started work on universal windows app rasberry pi 3 - installed necessary package (visual studio tools universal windows apps) couple more updates gallery (new version asp.net , web tools probably). when got working on webapi project i've noticed warnings: dotnet1015 'compilationoptions' option deprecated. use 'buildoptions' instead. dotnet1015 'exclude' option deprecated. use 'exclude' within 'compile' or 'embed' instead. dotnet1015 'publishexclude' option deprecated. use 'publishoptions' instead. in project.json file must have changed after updates. project build passes when start locally on debug , iis express get: an unhandled exception of type 'system.invalidoperationexception' occurred in microsoft.extensions.dependencyinjection.abstractions.dll ...

javascript - post form input to an iframe on onchange of a select -

using html, css , js, have form containing select , submit - works great. however, want when select's onchange triggered, option posted page, inside iframe. meaning when option 'red' selected in 'color' dropdown, i'll able display in iframe /changed?color=red, using post. however original form has action target can't through simple submit. should do? use "onsubmit" on form <script> function myfunction(){ // open iframe } </script> <form onsubmit="myfunction()" action="..."> enter name: <input type="text"> <input type="submit"> </form>

time - Matlab parfor taking longer than normal for -

i have matlab code using parfor reduce amount of time taken for image processing tasks. basically,it taking 2 images , after doing mathematical calculations, produces scalar qunatity called eucdist . this, 1 image kept fixed , image generated fortran code taking around 20 seconds that. below outline of code: matlabpool open gray1 = some_image(8192,200); dep = 0.04:0.01:0.40; % parameter 1 vel = 1.47:0.01:1.72; % parameter 2 dist = zeros(length(dep),length(vel)); tic parfor = 1:length(dep) ans = zeros(1,length(vel)); j = 1:length(vel) % updating input.txt file fname = sprintf('input_%.2d%s',i,'.txt'); fid=fopen(fname,'w'); fprintf(fid,'%-5.2f\n%-5.2f\n%.2d',dep(i),vel(j),i); fclose(fid); % running fortran code generate .dat file (note have compiled code outside these loops) system(['./editcrfl ' fname]); % calling image_gen script incorporating above ...

machine learning - Multinomial Logistic Regression in spark ml vs mllib -

spark version 2.0.0 has stated goal bring feature parity between ml , now-deprecated mllib packages. presently ml package provides elasticnet support binary regression. obtain multinomial apparently have accept using deprecated mllib? the downsides of using mllib: it deprecated. have "why using old stuff" questions field they not use ml workflow not integrate cleanly for above reasons have rewrite. is there approach available achieving one-vs-all multinomial ml package? this answer-in-progress. there is onevsrest classifier in spark.ml . apparently approach provide logisticregressionclassifier binary classifier - run binary version across classes , return class highest score. update in response @zero323. here info xiangrui meng on deprecation of mllib: switch rdd-based mllib apis maintenance mode in spark 2.0 hi all, more year ago, in spark 1.2 introduced ml pipeline api built on top of spark sql’s dataframes. since new da...

c# - Monogame - Changing background colour error -

i'm building 2d platformer , want have different colour backgrounds each level. i've made object when collided with, places character onto next level changing player.position , so... protected override void update(gametime gametime){ if (player.bounds.intersects(teleportobj.bounds)) { graphicsdevice.clear(color.slategray); // fails change bg color player.position = new vector2(172, 0); // changes character position mediaplayer.play(dungeonsong); // plays new song mediaplayer.isrepeating = true; // repeats new song } } i have set background first level begin in game1's draw() function this: graphicsdevice.clear(color.cornflowerblue); but when player collides teleportobj , the background color doesn't change. graphicsdevice.clear(color.slategray); used in draw function. try creating new color variable, , change variable in update method, , when using graphicsdevice.clear( name of variable ); , use in...

spring mvc - Neither BindingResult Nor Plain Target Object For Bean Name ‘Xxx’ Available As Request Attribute -

i getting error, while trying configure spring controllers. sure have name correctly matching , still gives me error. here controller class. input , output page same. please me "neither bindingresult nor plain target object bean name 'userform' available request attribute" @controller @sessionattributes public class usercontroller { protected log logger = logfactory.getlog(getclass()); @autowired userservice userservice; @requestmapping(value="/userlist") public modelandview getuserlist(){ list<user> userlist = userservice.getuserlist(); return new modelandview("userlist", "userlist", userlist); } @requestmapping(value="/finduser") public modelandview finduser(@modelattribute("user") user user, bindingresult result){ list<user> userresultslist = null; //model.addattribute("use...

mysql - SQLzoo tutorial | GROUP BY and HAVING -

i can't answer correctly following question in show years in 3 prizes given physics. i've written following script returns wrong. select yr, count(subject) nobel subject = 'physics' group yr having count(subject) = 3 thank time that query looks correct, can't sure without link sqlzoo page. try select yr nobel subject = 'physics' group yr having count(subject) = 3 -- might finicky exact format of results returning. it's asking year.

3d - OpenGL scene centering problems -

i'm trying make scene looking @ xy plane z coming towards , away camera view. want see objects further away @ different size objects in front of face imagine supposed use gluperspective this. should have axes on screen coming origin out, however, don't see @ all. had working bunch of translations want make sure understand how manipulate because guess , check before. void resizewindow(glint newwidth, glint newheight) { glviewport(0, 0, newwidth, newheight); glmatrixmode(gl_projection); glloadidentity(); gluperspective(60.0f, (glfloat)newwidth / (glfloat)newheight, 0.1f, 100.0f); glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glmatrixmode(gl_modelview); glloadidentity(); glulookat(0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); } glpushmatrix(); glcolor4ub(0, 120, 20, 255); glbegin(gl_line_strip); glvertex3f(0.0f, 0.0f, 0.0f); glvertex3f(3.0f, 0.0f, 0.0f); glvertex3f(2.85f, 0.10f, 0.0f); glvertex3f(2.85f, -0.10f, 0.0f); glvertex3f(3.0f, ...

javascript - ComboBox to select only data in the list but submit their 3 digit code HTML5 -

i want add input box in form users can select airport similar 1 in website ( http://www.wego.pk/ ) when type on destination input, list of possible values detailed suggestion including city name + country name when user submits form value submitted 3 digit code airport. i tried html5 combobox as: <form> <input type="text" name="product" list="productname"/> <datalist id="productname"> <option value="isb">pen</option> <option value="khi">pencil</option> <option value="pwh">paper</option> </datalist> <input type="submit"> </form> but if type pen no suggestion comes. kindly share code snippet or library purpose. i recommend use autocomplete plugin (e.g. jquery ui autocomplete) instead html5 datalist. however, if question regarding datalist, can populate product code hidden field: ...

Design for Graphic Rendering in Java with Unspecified Update Reasons (Hierarchical) -

original question i'm working graphic rendering part of program, , got several severe problems previous design. so, want ask how design structures of renderers , models. or there specific design pattern handle case? currently have hierarchical implementations of renderers (graphics) models (data render, receive updates) i accepted hierarchy since rendered contents can classified, , should managed separately. there several limiting conditions: rendering done on rendering loop. there many types of renderers , models, , design should not aware of them. there various reasons update models. update reasons should not specified in design itself, since various reasons can added. models aware of possible update reasons itself. renderers have render passes , render helpers. types of render passes dependent classes(groups) of renderers. render helpers should provided, , each renderer should able use different version of it. edit: code explain current s...

ruby on rails - Boolean validation rSpec tests -

i'm having trouble writing test make sure field :on_ride_photo boolean value. my validates call: validates :on_ride_photo, inclusion: [true, false] my tests: it { should validate_presence_of(:on_ride_photo) } { should ensure_inclusion_of(:on_ride_photo).in_array([true, false]) } { should_not allow_value(4).for(:on_ride_photo) } { should_not allow_value('lots').for(:on_ride_photo) } factory: factory :coaster association :park name 'nemesis' speed 60 height 60 length 160 inversions 4 on_ride_photo true lat 52.98694 lng -1.88284 dates_ridden '24th jul 2013:4, 9th aug 2009:7' powered false end errors: failures: 1) coaster validations should not allow on_ride_photo set "lots" failure/error: { should_not allow_value('lots').for(:on_ride_photo) } expected errors when on_ride_photo set "lots", got no errors # ./spec/models/coaster...

python - Error with pycripto and AWS-Lambda -

i'm trying use pycrypto , lambda service, every time run script lambda service return: unable import module 'service': /var/task/crypto/cipher/_aes.so: invalid elf header i don't know why happen if have same problem, please me. thank everyone. i ran same issue, had build deployable zip on linux vm. as alex-luminul comments in issue , may due osx-compatible shared library _aes.so being sent lambda, lambda requires linux compatible shared libraries.

rust - Clone String to Specific Lifetime -

i'm trying write little command line app in rust , i've hit wall lifetimes. extern crate clap; use self::clap::{app, arg}; use std::env; impl<'p> params<'p> { fn get_username_arg<'r>() -> arg<'r, 'r> { let mut arg = arg::with_name("username") .short("u") .long("username") .takes_value(true); match env::var("username") { ok(username) => { // how pass `username` default_value? arg.default_value(username) } err(e) => arg.required(true), } } // more code below... } the problem i'm trying pass username default value method, requires str lifetime of 'r . tried cloning can't figure how tell lifetime of clone going be. tried along following lines: let cln = (&*username).clone::<'r>(); arg.default_value(username) for ...

python - Pandas: Append rows to DataFrame already running through pandas.DataFrame.apply -

brief : using selenium webdriver , pandas python 2.7 make web scraper goes sequence of urls , scrapes urls on page. if finds urls there, want them added running sequence. how can using pandas.dataframe.apply ? code: import pandas pd selenium import webdriver import re df = pd.read_csv(spreadsheet.csv, delimiter=",") def crawl(use): url = use["url"] driver.get(url) scraped_urls = re.findall(r"(www.+)", element.text) something_else = "foobar" #ideally scraped_urls list have unpacked here return pd.series([scraped_urls, something_else]) df[["url", "something else"]] = df["url"].apply(crawl) df.to_csv("result.csv", delimiter=",") the above scraper uses column "url" in spreadsheet.csv navigate each new url . scrapes strings on page matches regex www.+ find urls, , puts results in list scraped_urls . it gets string something_else = "foobar...

swift - How to add a custom border to viewcontroller (ios) -

Image
i have view (uipopoverpresentation) functionality works fine, need add custom border. i'm using borderwidth , bordercolor cannot seem find way make customized border, seen in photo below. how go creating customized border? make cgrect? what need: what have: i've attempted add image background of popover , resulted in this: edit: //popoverview (presented using uipopoverpresentation) override func viewdidload() { super.viewdidload() self.view.layer.cornerradius = 10.0 self.view.layer.borderwidth = 1.5 self.view.layer.bordercolor = uicolor.whitecolor().cgcolor self.navigationcontroller?.navigationbarhidden = true self.popviewtableview.delegate = self self.popviewtableview.datasource = self self.popviewtableview.alwaysbouncevertical = false self.popviewtableview.backgroundcolor = uicolor(red: 151.0/255.0, green: 87.0/255.0, blue: 172.0/255.0, alpha: 1.0) } //base view controller. when button pressed, function called p...

dataframe - Histogram of binned data frame in R -

Image
my (huge) dataframe coming python code composed of counts in different size classes each sample in : dummy <- as.data.frame(matrix(nrow = 10, ncol = 12)) colnames(dummy) <- c("id", paste("cl", c(1:11), sep = ".")) dummy$id <- c(letters[1:10]) dummy[, -1] <- rep(round(abs(rnorm(11))*1000,0), 10) i try create histograms of counts each sample (id) having size classes on x axis , counts (frequencies) on y axis. no success hist() , combining as.numeric() , t() , as.table() ... i don't succeed in telling r data frame (at least partly) table counts distributed in bins colnames . i'm sure i'm not first guy looking can't find answer since 2 days, maybe because don't right keywords (?). can help? a histogram special kind of barplot. use function barplot . i prefer package ggplot2 this: #reshape long format library(reshape2) dummy <- melt(dummy, id.var="id") library(ggplot2) p <- ggp...

ios - The redirect_uri URL must be absolute error for deep linking URI fbAPP_ID:// -

everything working fine until today i've tried test safari facebook login mechanism on app , started getting following error on web browser: the redirect_uri url must absolute . i'm not using facebook sdk (for various reasons outside question's context, don't ask why) , i'm trying open following url manually: https://www.facebook.com/dialog/oauth?client_id=my_app_id&response_type=token,granted_scopes&redirect_uri=fbmy_app_id://&scope=user_friends,user_birthday,email,user_photos&default_audience=friends&sdk=ios everything working fine, until today realized url isn't executing properly. didn't change app settings or anything. how can complete login flow? yes, need redirect fbapp_id:// launch app when using ios versions lower 9.0 native safari isn't supported. or there known way of redirecting application pre-ios 9 external safari? (other me redirecting website, then on website, redirecting app force opening fbapp_id:// j...

c# - Can .Find method return wrong results in multi-user environment -

it mentioned on msdn link following .find() method if entity not found in context query sent database find entity there. null returned if entity not found in context or in database. find different using query in 2 significant ways: • round-trip database made if entity given key not found in context. • find return entities in added state. is, find return entities have been added context have not yet been saved database. but can cause problem? let's object marked added state, before saving database exception occurred. find might return object added state, have not been saved database later on. second concern, if .find found object in context , object updated in database after finding it, object version on context old? so benefits can using .find() instead of doing search based on primary key using .where or .firstordefault(a=>a.primarykey ==id) ? well docs state find... uses primary key value attempt find entity tracked co...

vi - jumping to a specific position in vim -

this question has answer here: how move cursor specific row , column? 3 answers i move cursor specific position, lets line 64 , column 40. there way on command line. what do: :64 40| but there way combine these 2 commands 1 such can type on command line? thanks. the answer given in answer " how move cursor specific row , column? ". specifically: thus, if wanted x,y coordinate (e.g. 42,80) 42g80| . if want command-line mode :norm 42g80|

sql - Can't insert more than 150 rows -

i using go-sql-driver/mysql insert ton of movies omdb data dump. parsing data , inserting following code: _, err = database.query("insert `movies` (`name`, `year`, `release_date`, `full_plot`, `genre`, `imdb_id`) values (?, ?, ?, ?, ?, ?)", movie.name, movie.year, movie.releasedate, movie.fullplot, movie.genre, movie.imdbid) if err != nil { return false, nil } return true, nil it works, 150 rows. doing wrong? your code seems discard error value returned, shouldn't do; handle gracefully. see error is, if you're opening many connections db, should use database connection pool , set (*db) setmaxopenconns value. (*db)query typically used select statements return rows, use (*db)exec or (*stmt)exec insert . i'd advise using db connection pool, , (*sql.db)prepare prepare statement , run inserts (even concurrently) using prepared statement. see https://golang.org/pkg/database/sql/#db.prepare

actionscript 3 - How to get mt character to attack -

i'm trying create beat em game , right got character attacking. have 3 attack animation far , works about. want, if player presses attack button character attack , if player keeps pressing attack button continue attack sequence (note: no want if player holds down key, has key press). the problem if keep mashing attack button attacks problem goes next attack animation attack button down , don't want that. how can make go next attack animation once current attack animation has finished instead of jumping next frame midway of it's current attack animation. want character finish attack , if player still keys in attack key go next attack frame otherwise stop. have done far package { import flash.display.movieclip; import flash.events.event; import flash.events.keyboardevent; import flash.ui.keyboard; public class player extends movieclip { //attack variables var attacking:boolean = false; var punches:int = 0; var ...

laravel - Blade view not reflecting changes -

i developing laravel(5.2.29) project in windows environment , testing on chrome browser. i have made changes on blade file using atom text editor , refreshed page , noticed has stopped reflecting changes (it's loading old blade file). i've tried following: restarted browser clearing browser cache running php artisan cache:clear running composer dumpautoload deleting blade file (and got view not found error). created new blade file same name, no content , refreshed page. no matter what, code displayed on browser same (old) version , not content of blade file. how can solve issue? in order avoid parsing of blade files on each reload, laravel caches views after blade processed. i've experienced situations source (view file) updated cache file not "reloaded". in these cases, need delete cached views , reload page. the cached view files stored in storage/framework/views .