Posts

Showing posts from February, 2015

java - spring boot multiple modules multiple property files @Propertysource not working -

i have 1 main project , 1 dependent project auditmodule. auditmodule has own datasource , , database properties in auditapplication.properties. main application has own application.properties.main project depends on audit project auditing stuff. when run main application , it's not detecting auditapplication.properties in audit module. below databaseconfiguration classes in main project , in audit project: main project: @configuration @enablejparepositories(basepackages = "com.staples.mpe.repository", entitymanagerfactoryref = "mpeentitymanager", transactionmanagerref = "mpetransactionmanager") @enabletransactionmanagement public class databaseconfiguration implements environmentaware {} audit project: @configuration @enablejparepositories(basepackages = "com.staples.em.magnus.audit.repository", entitymanagerfactoryref = "auditentitymanager") @en

jquery html replace page with $(document).ready code -

i using jquery replace html in site. html getting inserted has "$(document).ready" function @ bottom of page. code not getting run when html gets replaced. guess makes sense because whole page not loading. replacing html. best way make sure code runs? here code doing replacing: function procview(url, e) { var data = $('.checkout form').serialize(); $.ajax({ url: '/shop/' + url, data: data, success: function (result) { $('.rightpane').html(result); $('#dvsummary').load('/shop/_summary'); validatecc(); }, error: function (result) { alert(result.responsetext); } }); } it .html(result) line. if matters, using asp.net mvc5. and here document.ready code validatecc() function: $(document).ready(function () { alert("out of function!"); //$.validator.setdefaults({ ignore: ":hidden, .

c# - Where is the bin/Release folder located for ClickOnce Deployment applications? -

i have solution in visual studio 2013 use xcopy in post build events copy necessary files bin\debug folder. post build event works , when run application in visual studio application can find necessary files copied bin\debug folder. xcopy "$(solutiondir)packages\nunit.runners.2.6.3\*.*" "$(outdir)..\..\nunitrunners\" /e /i /y /f xcopy "$(solutiondir)productionsmoke\bin\debug\productionsmoke.exe" "$(outdir)..\..\" /e /i /y /f xcopy "$(solutiondir)productionsmoke\bin\debug\productionsmoke.exe.config" "$(outdir)..\..\" /e /i /y /f however, when publish solution using clickonce application throws exception cannot find files. private void buttonproductionsmoke_click(object sender, eventargs e) { var pathtonunitgui = appdomain.currentdomain.basedirectory + "nunitrunners\\tools\\nunit.exe"; var pathtoproductionsmoke = appdomain.currentdomain.basedirectory + "productionsmoke.exe"; process

Bootstrap Clockpicker CSS in web2py -

Image
i trying create widget input field using jquery clockpicker plugin. working style of plugin off. supposed this . link of current working code. is because of customized bootstrap css web2py use? if so, how can overide without affected current css creating admin panel of app around current css? extending default 'layout.html' provided web2py. also, correct way of using bootstrap css in web2py application. i using web2py 2.9.11 version the problem not due customizations of bootstrap due standard bootstrap 2 css rules, include following: [class*="span"] { float: left; min-height: 1px; margin-left: 20px; } the hours , minutes displayed in clockpicker have classes "clockpicker-span-hours" , "clockpicker-span-minutes", respectively, both of contain string "span" , therefore trigger float: left rule shown above. presumably clockpicker designed bootstrap 3, not include above rule. you'll either have upgrade s

How to read a gzip netcdf file in python? -

i have working python program reads in number of large netcdf files using dataset command netcdf4 module. here snippet of relevant parts: from netcdf4 import dataset import glob infile_root = 'start_of_file_name_' infile in sorted(glob.iglob(infile_root + '*')): ncin = dataset(infile,'r') ncin.close() i want modify read in netcdf files gzipped. files gzipped after creation; not internally compressed (i.e., files *.nc.gz). if reading in gzipped text files, command be: from netcdf4 import dataset import glob import gzip infile_root = 'start_of_file_name_' infile in sorted(glob.iglob(infile_root + '*.gz')): f = gzip.open(infile, 'rb') file_content = f.read() f.close() after googling around maybe half hour , reading through netcdf4 documentation, way can come netcdf files is: from netcdf4 import dataset import glob import os infile_root = 'start_of_file_name_' infile in sorted(glob.iglob(infile_root

Can I detect changes in a node's markup text using dojo? -

i have bunch of nodes contain markup in unpredictable structure. want able watch these nodes , see if html of of child nodes or descendants change, no matter how slightly. if do, want fire event. can through dojo? i'm using 1.10, latest one. thanks. it sounds you're looking dom mutations. far i'm aware dojo not provide api this, they're pretty simple set up. problem different browsers have different ways of doing this. var observenode = document.getelementbyid('observeme'); // check vendor-specific versions of mutationobserver. mutationobserver = (function() { var prefixes = ['webkit', 'moz', 'o', 'ms', '']; (var i=0, il=prefixes.length; i<il; i++) { if (prefixes[i] + 'mutationobserver' in window) { return window[prefixes[i] + 'mutationobserver']; } } }()); // sniff mutationobserver support if (mutationobserver) { var observer = new mutationobserver(function(mut

android - NDK is looking into wrong directory -

i using awesome library ffmpegmediametadataretriever . library requires me add platform specific native libraries. convenience have library project code , separate project free , paid version of app. package name of library project com.vidanalysis , paid version has got same name , free version's name com.vidanalysis.free . ffmpegmediametadataretriever library included in library project. paid version working fine, problem free version trying find library in com.vidanalyis , doesn't exist when haven't installed paid version. how can solve problem?

css - How to make logo stay in position even when the browser is resized -

jsfiddle demo html <div class="ratio-1439-330 bg-cover" style="background-image: url('https://www.agtinternational.com/wp-content/uploads/2013/11/city-solution.jpg');"> <div class="l-center" style="max-width: 1240px;"> <div class="square-logo bg-cover" style="background-image:url('http://www.astronautamarcospontes4077.com.br/wp-content/uploads/2014/07/person-icon.png');"> </div> <div class="header-cover" style="background-color: #373737; opacity: 0.9; position: absolute; bottom: 0; left:0; width: 100%; overflow: hidden; padding: 10px 0;"> <div class="l-center" style="max-width: 1240px"> <div class="nav nav-tabs" style="margin-left: 338px"> <a class="active" href="#overview" data-toggle="tab">

IOS Difference Between uiview and uilabel for drawing -

so have weird problem when im trying draw in custom class has subclass of uiview lines thick , fuzzy when change subclass uilabel looks smooth , thin. curious there different default settings enabled occur , if ? cant post screens yet thanks in advance update: relevent code note no changes being made between changing of subclass cgcontextref ctx = uigraphicsgetcurrentcontext(); // cgcontextsetallowsantialiasing(ctx, yes); // cgcontextsetshouldantialias(ctx,yes); // cgcontextsetinterpolationquality(ctx, kcginterpolationhigh); cgcontextsetstrokecolorwithcolor(ctx, [uicolor blackcolor].cgcolor); cgcontextsetshadow(ctx, cgsizemake(0, 3), 2); cgcontextbeginpath(ctx); cgcontextmovetopoint(ctx, 1, 0); cgcontextaddcurvetopoint(ctx, 5, self.frame.size.height - 10, 15, self.frame.size.height - 1, 30, self.frame.size.height - 1); cgcontextaddlinetopoint(ctx, self.frame.size.width - 30, self.frame.size.height - 1); cgcontextaddcurvetopoint(ctx, self.frame.size.w

python - Trying to fix css paths in Django -

Image
i'm working locally on django project bootstrap . structure screenshot above: i have following in index.html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="description" content="" /> <meta name="author" content="" /> <title>landing page - start bootstrap theme</title> <!-- bootstrap core css --> {% load staticfiles %} <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet" /> <!-- custom css --> <link href="{% static "css/landing-page.css" %}" rel="stylesheet" /> <!-- custom fonts --> &l

javascript - Angular.js paginate filtered data and display total items without duplicating code in view/controller -

let's have filter implemented in view this: <input data-ng-model="statementfilter" /> <ul> <li data-ng-repeat="statement in statements | filter: statementfilter"> {{ statement.name }} </li> </ul> this case insensitive partial match statements properties contain statementfilter . i need implement in controller instead of in view. understand can create custom filters in angular, want filter generic case insensitive partial matching on complex object built-in angular filter in view does. if create custom filter, have filtering using javascript require library afaik. how can leverage generic case insensitive partial matching comes angular's "view" filter in code? thanks update here plunker of i'm trying do. solution: http://plnkr.co/edit/acap437ojgmgmugctxt3?p=preview basically, problem controller doing knew accomplished inside of view... made more difficult other case

How to Format numbers using Google Embed API - Decimal placement limit - Whole numbers -

i format numbers returned via google's embed api, controlling decimal count, , comma placement numbers 1000+. i found documentation on numberformat google charts, following link embed ref guide: https://developers.google.com/chart/interactive/docs/reference#numberformatter https://developers.google.com/analytics/devguides/reporting/embed/v1/reference the syntax different embed, google charts number formatting doesn't seem apply. here's embed syntax...i'm assuming there's way add options number formatting, similar placed in options param below: var avgsessionduration = new gapi.analytics.googlecharts.datachart({ reporttype: 'ga', query: { 'metrics': 'ga:avgsessionduration', 'start-date': '30daysago', 'end-date': 'yesterday', }, chart: { type: 'table', container: 'avgsessionduration', options: { 'numberformat': { pattern: '$###,###' } } }

objective c - NSDictionary data shared between classes -

i creating os x app allow user play piano (using midi keyboard). notes scroll left right , user play correct note @ correct time, similar rock band or of other games. notes scrolling generated text file or sort of input source , may this: c4 d4 b3 a3 c4 ... i creating dictionary music notes. in music, there 12 unique values, let's there 12 unique letter types. value of "c" 0, "c#" 1, "d" 2, etc. need codify them in way because midi data user playing produced numerically. "c" 0, data needs hardcoded. best practice sharing dictionary between multiple classes each instance of class has access it? what best practice sharing dictionary between multiple classes each instance of class has access it? create dictionary in class's +initialize method , store pointer in static (file-scope) variable. +initialize called before instances of class created, it's place whatever setup class needs independent of specific objects

What does an interface in Java interface with? -

i've been trying learn basic object oriented programming in java. curious know origin of word interface , if there documented description. trying make sense of means thinking of generic concept as a point 2 systems, subjects, organizations, etc. meet , interact i got definition google search. 2 systems/entities interfacing? or maybe analogy used inappropriate?. far think of skeleton define methods , property outlines. software interfaces one-way (though there ways pass calling object reference callee), unlike electrical connectors interface both ways directly. if accept difference in definition object 'implementing' interface, object interfaced with. allows other objects connect using defined set of methods. to compare further electronics, if 3 different types of devices support audio-jacks, 3 devices state: can listen me, play audio. different devices (mp3 player, sonar, geiger counter) state: if plug in headphone, can sound out of me. this inte

python - scrapy: convert html string to HtmlResponse object -

i have raw html string want convert scrapy html response object can use selectors css , xpath , similar scrapy's response . how can it? first of all, if debugging or testing purposes, can use scrapy shell : $ cat index.html <div id="test"> test text </div> $ scrapy shell index.html >>> response.xpath('//div[@id="test"]/text()').extract()[0].strip() u'test text' there different objects available in shell during session, response , request . or, can instantiate htmlresponse class , provide html string in body : >>> scrapy.http import htmlresponse >>> response = htmlresponse(url="my html string", body='<div id="test">test text</div>') >>> response.xpath('//div[@id="test"]/text()').extract()[0].strip() u'test text'

python - Solving constrained maximization with SciPy -

function maximize: x[0] + x[1] + x[2] constraints: 0.2 * x[0] + 0.4 * x[1] - 0.33 * x[2] <= 25 5 * x[0] + 8.33 * x[2] <= 130 ... x[0] >= 0 x[1] >= 0 x[2] >= 0 my code looks like: from numpy import * scipy.optimize import minimize cons = ({'type': 'ineq', 'fun': lambda x: array([25 - 0.2 * x[0] - 0.4 * x[1] - 0.33 * x[2]])}, {'type': 'ineq', 'fun': lambda x: array([130 - 5 * x[0] - 8.33 * x[2]])}, {'type': 'ineq', 'fun': lambda x: array([16 - 0.6 * x[1] - 0.33 * x[2]])}, {'type': 'ineq', 'fun': lambda x: array([7 - 0.2 * x[0] - 0.1 * x[1] - 0.33 * x[2]])}, {'type': 'ineq', 'fun': lambda x: array([14 - 0.5 * x[1]])}, {'type': 'ineq', 'fun': lambda x: array([x[0]])}, {'type': 'ineq', 'fun': lambda x: array([x[1]])}, {'type'

animation - Animating UVs in SceneKit -

i'm looking way animate sprite sheets in scenekit. after research found core animation way this, perfect need control on animation possible. i've prepared simple plane mesh, uvs limited 1 spritesheet frame's size. way i'd need animate uvs horizontally. i've found relevant element of material's contentstransform matrix m14 (the 1 responsible horizontal translation). however, @ runtime, scenekit spits following error: [scnkit error] geometry?.firstmaterial?.diffuse.contentstransform.m14 not animatable path this relevant code: let spritesheetanimation = cabasicanimation(keypath: "geometry?.firstmaterial?.diffuse.contentstransform.m14") spritesheetanimation.fromvalue = 1 - 1 / spritesheetframecount spritesheetanimation.tovalue = 0 spritesheetanimation.byvalue = 1 / spritesheetframecount spritesheetanimation.duration = 1.0 spritesheetanimation.repeatcount = float.infinity node.geometry?.insertmaterial(material, atindex: 0) node.addanimation(s

sql - Getting the average over the first n rows -

i'm trying devise sql query can take column of results , return average/mean of first "n" results. in other words, if have sample of data looks this: | day | number of people | |:-----:|:----------------:| | 12/01 | 4 | | 12/02 | 8 | | 12/03 | 5 | | 12/04 | 6 | | 12/05 | 8 | | 12/06 | 3 | | 12/07 | 5 | i want query can result in table looking this: | day | number of people | nmean | |:-----:|:----------------:|:------:| | 12/01 | 4 | 4 | | 12/02 | 8 | 6 | | 12/03 | 5 | 5.6667 | | 12/04 | 6 | 5.75 | | 12/05 | 8 | 6.2 | | 12/06 | 3 | 5.6667 | | 12/07 | 5 | 5.5714 | you can have elegant solution if use window functions. though works in sql server 2012 , later. select d.[day], avg(d.[num] * 1.0) on ( order d.[day] asc

eclipse - apcompat_v7 when you create a new Android app? -

eclipse add automatically folder appcompat_v7 when create new android app project, why folder added automatically ? this android's support library automatically added support large diversity of os devices , fragmentation exists between different versions of android. using support library helps avoid lot o validations in code related methods not supported in android operative systems.

html - Responsive image scaling with changing max-height -

it's far simpler point example try , explain problem trying solve i'll (apologies people on mobile, won't work...) the effect want achieve can seen on vice news ( http://news.vice.com ) as can see while resizing browser, aspect ratio of image remains intact throughout sizes. jumps @ 1200px , again @ 700px, while scaling both width , height. is there way achieve using css? head stuck on one. thanks! media queries, of course. if in source code, see have 3 different versions of same image display @ each different size (to minimize scaling). then, using media queries, display proper 1 , have width fill page: here's mobile image, example: @media screen , (min-width: 43.75em) { .lede .lede-images img.mobile { display: none; } } and here's global code: .lede .lede-images img.mobile { width: 100%; } setting width 100% while not setting height automatically maintain aspect ratio while resizing.

php - password_verify gives false after password_hash, should be true -

i keep getting wrong result , can't understand why. i store new user , password this: // password input $pass = $_post[ 'password' ]; $options = [ 'cost' => 12 ]; $pass = password_hash($pass, password_default, $options); // add db $sql = "insert clients(first_name, last_name, email, password_hash) values ('$fname', '$lname', '$email', '$pass')"; for password ' 123456 ' this: $2y$12$dud9lwgk2b26r2nqz6ksfexfrhi/36rjrq8lao8vk6xc6vkibipvg next step verify password: // password input $pass = $_post[ 'password' ]; // row hash database $sql = "select email, password_hash, active clients email = '$email'"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows( $result ) == 0) { // email not found in database... } $row = mysqli_fetch_assoc($result); // true if password correct if ( password_verify( $pass, $row['password_hash'] ) ) { // logged in } else

python - Collision Detection Problems and Invalid Command Name? -

from tkinter import * root = tk() drawpad = canvas(root, width=600,height=600, background='white') player = drawpad.create_rectangle(260,590,340,595, fill = "blue") ball = drawpad.create_oval(293,576,307,590, fill = "white") brick1 = drawpad.create_rectangle(30,20,80,50, fill='green') brick2 = drawpad.create_rectangle(30,100,80,130, fill='green') brick3 = drawpad.create_rectangle(30,180,80,210, fill='green') brick4 = drawpad.create_rectangle(100,20,150,50, fill='green') brick5 = drawpad.create_rectangle(100,100,150,130, fill='green') brick6 = drawpad.create_rectangle(100,180,150,210, fill='green') brick7 = drawpad.create_rectangle(170,20,220,50, fill='green') brick8 = drawpad.create_rectangle(170,100,220,130, fill='green') brick9 = drawpad.create_rectangle(170,180,220,210, fill='green') brick10= drawpad.create_rectangle(240,20,290,50, fill='green') brick11= drawpad.create_rec

Python axis name in plot -

Image
can change location signature axis? write them on end of axis? , instead of them write inscription? have in code inscriptions set plt.plot(datax, datay) plt.xlabel('f, hz') plt.ylabel('n') plt.savefig(pathfornewgraphdir + "\\" + shortfilename + "_" + str(i) + "_.png") but need thank you

c# - Reusable Calculations For LINQ Projections In Entity Framework (Code First) -

my domain model has lot of complex financial data result of complex calculations on multiple properties of various entities. include these [notmapped] properties on appropriate domain model (i know, know - there's plenty of debate around putting business logic in entities - being pragmatic, works automapper , lets me define reusable dataannotations - discussion of whether or not not question). this works fine long want materialize entire entity (and other dependent entities, either via .include() linq calls or via additional queries after materialization) , map these properties view model after query. problem comes in when trying optimize problematic queries projecting view model instead of materializing entire entity. consider following domain models (obviously simplified): public class customer { public virtual icollection<holding> holdings { get; private set; } [notmapped] public decimal accountvalue { { return holdings.sum(x => x.value); } } } pu

My first DART polymer project: No execution / testing possible, nothing works? -

i have created polymer project. generates default app reverses text entered input field. works. then tried add core-header-panel. copied code description page index.html file of project: <body unresolved fullbleed layout vertical> <core-header-panel flex> <core-toolbar> <div>hello world!</div> </core-toolbar> </core-header-panel> <main-app> </main-app> <script type="application/dart">export 'package:polymer/init.dart';</script> </body> this gets me 3 warnings on displayed web page. 2 say: custom element found in document body without "unresolved" attribute on or 1 of parents. i have inserted unresolved attribute after body tag. not understand why error not go away. the third messages is: custom element name core-toolbar not found i added line <link rel="import" href="packages/core_elements/core_toolbar.html"

nlp - Building Jarvis like application for local languages -

the jarvis application developed, in english. want customize use local language. how develop kind of app local languages? kind of programming languages must know proceed development? have tested english version of jarvis, works me. how attach c# htk purpose of development? how develop kind of app local languages? you don't need develop scratch, take existing software , build on it. example can consider https://github.com/jasperproject/jasper-client , it's pretty actively developed. what kind of programming languages must know proceed development? most nlp libraries in python or java. need shell scripting (awk/perl) experience because models built linux tools. for speech recognition it's easiest use cmusphinx, tutorial add language cmusphinx @ http://cmusphinx.sourceforge.net/wiki/tutorialam . i have tested english version of jarvis, works me. how attach c# htk purpose of development? there many ways interoperability: 1) c# can invoke h

javascript - gulp-connect and connect.reload -

i trying set simple server test out d3.js stuff. i'm following screencast on tagtree.tv. code matches his, cannot index.html reload when make change js or sass files. i'm new gulp far can tell things ok, that's based upon assumption call connect.reload() reload whatever browser looking @ content. should noted livereload js being inserted index.html file. my directory structure follows: d3play -bower_components -dist -css -scripts - node_modules -sass -scripts gulpfile.js index.html package.json my gulpfile.js looks this: var gulp = require('gulp'), connect = require('gulp-connect'), traceur = require('gulp-traceur'), sass = require('gulp-ruby-sass'); gulp.task('connect', function(){ connect.server({ livereload: true }); }); gulp.task('reload', function(){ gulp.src('./dist/**/*.*') .pipe(connect.reload()); }); gulp.task('sass', function(){ gulp.src('./sass/*

Does node-webkit have performance issues with css filters? -

i'm using css filter in node-webkit (v0.11.2) application on windows 7 (64 bit) so: html { -webkit-filter: invert(); } this works fine part, when user maximizes window , attempts drag window, there huge performance lag. lag goes away without filter. i don't see same performance issues in browser, appears node-webkit issue.

ruby on rails - DRY-ing up ActiveAdmin -

i've got multiple resources in activeadmin installation share quite lot of same traits, like: the same or similar scopes equal or similar controller methods (action_methods, example) similar attributes (with code blocks) in show action similar attributes (with code blocks) in edit action what best way avoid duplicating functionality across different resources? i have set decorators avoid duplicating functionality in index view, i'm not sure if (and how?) used in other cases. you need extend dsl monkey patch: module activeadmin # class register blocks evaluated. class resourcedsl < dsl def your_custom_method attr #common code end end end now can use your_custom_method in registered resource file. https://github.com/activeadmin/activeadmin/blob/master/lib/active_admin/resource_dsl.rb

hardware - Why the INOUT doesn't work? -

i making circuit handles read , write operations registers , uses single bus transfer data between registers, problem when reading bus (a register reading bus) works well, when trying assign value in register not working. note if used signal write work !!! my code: library ieee; use ieee.std_logic_1164.all; -- entity: circuit -- description: organizes read , write operation bus -- n size of word in register, default 16 -- m number of selection lines in decoder, 2 ^ m -- number of registers in cicuit -- data_bus: bus used transfer data -- reg_read: input decoder determines register read bus. -- reg_write: input decoder determines register write bus. -- read: read signal -- write: write signal -- clk: clock -- rst: reset entity circuit generic( n : integer := 16; m : integer := 2); port(data_bus : inout std_logic_vector(n-1 downto 0); reg_read, reg_write : in std_logic_vector(m-1 downto 0); read, write, clk, rst : in std_logic); end circuit;

meteor - Iron:router "globbing" isn't working -

i want able match paths this: /path/anything/goes/here/and/can/be/an/arbitrarily/long/path . so tried of following: router.route('/path/*', function(){ this.render('home'); }); i tried path: '/path/:something(*)' , tried specifying path in second argument options object router.route : {path: '/path/*', action:myactionfunction} along action function. tried using router.map instead of router.route , prescribed in both of following: https://gentlenode.com/journal/meteor-11-iron-router-cheatsheet/18 http://www.manuel-schoebel.com/blog/iron-router-tutorial but still, going /path/anything/goes/here doesn't work. takes me default iron:router error page: oops, looks there's no route on client or server url: "http... localhost:1710... /path/this/should/work/according/to/the/above/links." any appreciated, thanks. try '/(

c# - Dictionary in CheckListBox help required -

the code c# windows forms application done on visual studio 2012, aim of task use dictionary in gui add, remove, , search books. i have laid out gui application, contains 4 buttons, 2 textfields, 2 checkboxlists,and few labels explain do. button3 supposed activate search using isbn. (user enters isbn in textbox1 , books contain part of matched) here form code dictionary<string, book> library = new dictionary<string, book>(); public form1() { initializecomponent(); button1.text = "add book"; button2.text = "remove book"; button3.text = "search using isbn"; button4.text = "search using title"; label1.text = "enter isbn below"; label2.text = "enter title below"; label3.text = "tick boxes on left display if book loaned or not"; label4.text = "all books found after search"; } public void update() { checkedlistbox1.items.clear(); foreach (var p

recursion - Different combinations of getting a total number with x amount of different smaller numbers MATLAB -

im trying create list represents different ways "change" (as in money) can given example this printcells(exchange([1,3,10],20)) and have output ans = <0,0,2> <1,3,1> <2,6,0> <4,2,1> <5,5,0> <7,1,1> <8,4,0> <10,0,1> <11,3,0> <14,2,0> <17,1,0> <20,0,0> the cells in output represent how many times each indicie used in combination. im trying use recursion , don't know start thanks in advance, well, programmed recursion , got following: function [] = change() % specify inputs here options = [1,3,10]; target = 20; global solutions; solutions = [zeros(1, size(options,2))]; sum_up(options, target); end function [] = sum_up(options, target) clc; recursive_sum(options, target, []); end function [] = recursive_sum(options, target, partial) global solutions; s = 0; i=1:size(partial,2) s = s + partial(i); end if s == targe

python - Custom JSON Response from Scrapy Spider Deployed via Scrapyd -

Image
i need find way make scrapy spider return custom json response. deployed via scrapyd using schedule.json . schedule.json responds jobid , status , i'd add more data response. if there's way creating separate response , make separate request work well. much appreciated! (taken learn read source, luke ). it doable. implement own resource based on scrapyd.webservice.wsresource , write render_post() method. then, tell scrapyd use schedule.json resource implementation: [services] schedule.json = project.module.myschedule

python - OS X not using most recent NumPY version -

trying update numpy running pip install -u numpy , yields "requirement up-to-date: numpy in /library/python/2.7/site-packages". checking version import numpy , numpy.version.version yields '1.6.2' (old version). python importing numpy via path '/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/numpy'. please me out here. you can remove old version of numpy /system/library/frameworks/python.framework/versions/2.7/extras/lib/python/numpy . delete numpy package there , try import numpy python shell.

html5 - Should headings in figure elements not be considered document headings? -

assume have page this: <!doctype html><html><body> <article> <h1>heading example</h1> <p>here heading (level 2) looks like:</p> <figure> <h2>demo heading</h2> </figure> </article> </body></html> when parsing page, should h2 element not considered semantic start of new subsection? there program in service exhibits such behavior (specifically treats headings within figure s differently when parsing document)? know of html5 spec, think should not considered start of new subsection, perhaps should , i'm incorrect. a figure sectioning root . first heading in sectioning root never starts subsection regardless of rank, unless heading appears after or within different sectioning content element within sectioning root, instance article > h1 in page. here relevant part of spec: the first element of heading content in element of sectioning content repre

objective c - Have Multiple UIImageView's From 1 UIImageViews -

i have declared 1 uiimageview in code. there way multiple out of it? example have imageview called red , position on screen. there way have multiple of red on screen @ 1 time? thanks in advance one image view 1 image view. if want more one, declare more one. if have many similar image views, consider creating 1 array of many image views instead of separate property each one. if have of image views in storyboard or .xib file, can use outlet collection instead of outlet store them.

apache coccoon - XSLT dynamically set count in paged transform? -

is possible dynamically set value of "count" param below? <map:transform type="filter" label="paged"> <map:parameter name="use-request-parameters" value="true" /> <map:parameter name="element-name" value="course" /> <map:parameter name="count" value="20" /> <map:parameter name="blocknr" value="{1}" /> </map:transform> for instance, if delete following line above: <map:parameter name="count" value="20" /> and create hidden field in form calls transform uses filter: <input type="hidden" name="count" value="40" /> then grab param when i'm in transform uses filter: <xsl:param name="count" /> shouldn't xsl:template match="block" able use count param passed in form? it's not working me outlined above, wanted se

ios - NSFetchRequest on a specific store -

i starting use multiple persistent stores core data. wrote following code: - (nsuinteger)countentity:(nsstring*)entityname withpredicate:(nspredicate*)predicate onstore:(nsstring*)configname { nsfetchrequest *request=[[nsfetchrequest alloc] init]; if (predicate) [request setpredicate:predicate]; nserror *error=nil; [request setentity:[nsentitydescription entityforname:entityname inmanagedobjectcontext:context]]; [request setaffectedstores: [nsarray arraywithobject:[[configurdico objectforkey:configname] objectforkey:@"store"]]]; nsuinteger count=[context countforfetchrequest:request error:&error]; // problematic line. return count; } but following message, on line problematic line un debugger. 2014-12-06 02:56:10.932 theapp[1501:76002] -[nsurl executerequest:withcontext:error:]: unrecognized selector sent instance 0x1757df50 what doi

Taking ids from two rows of one MySQL table and entering those values in one row of another MySQL table using PHP -

i have 2 tables, named shows , show_connections . ask user put in tv show names via post , values show1connection , show2connection . query separately defined function takes input , puts in sql. i have following code: $show1_name = $_post["show1connection"]; $show2_name = $_post["show2connection"]; $fail = query ("insert show_connections (show1_id) select id shows name = '$show1name'"); $fail2 = query ("insert show_connections (show2_id) select id shows name = '$show2name'"); my main problem want set show1_id , show2_id proper ids in 1 row. right now, syntax (which closest i've come solving problem) set show1_id id of show 1 , show2_id id of show 2, end on 2 separate rows. how make sure appear in same row? try - insert show_connections (show1_id, show2_id) select s1.id, s2.id shows s1, shows s2 s1.name = '$show1name' , s2.name = '$show2name'" side note - make

csv - numpy.savetxt IndexError: tuple index out of range -

i have numpy array following attributes: print(matrix.shape) (30000, 1000) print(matrix) (0, 208) 0.107297742751 (0, 666) 0.107413554001 (0, 833) 0.090485141939 (0, 616) 0.090485141939 .. .. when try write array file get: numpy.savetxt('matrix.csv', matrix, delimiter=',') --------------------------------------------------------------------------- indexerror traceback (most recent call last) <ipython-input-18-412b5d26d905> in <module>() ----> 1 numpy.savetxt('matrix.csv', matrix, delimiter=',') c:\anaconda3\lib\site-packages\numpy\lib\npyio.py in savetxt(fname, x, fmt, delimiter, newline, header, footer, comments) 1042 ncol = len(x.dtype.descr) 1043 else: -> 1044 ncol = x.shape[1] 1045 1046 iscomplex_x = np.iscomplexobj(x) indexerror: tuple index out of range what doing wrong? from output of print(matrix) ,

if statement - Ruby program help (ATM program) -

i'm newb ruby user using ruby version 2.1.5p273 , below created atm simulator program takes user input of deposits , withdrawals, , displays balance after. struggling ifs, elses , loops. want put decision making statement in beginning, asks if user wants withdraw, deposit, check balance, or end session. want put decision making statement in end, asks if user wants continue (which go beginning, or end session). general idea of want below, overall program below idea code. know it's wrong it's want like, in making correct , working code appreciated. print "would (w)ithdraw, (d)eposit, or (c)heck balance or (e)nd session? if "(w)ithdraw" # i'd make "press w withdraw" bank_account.withdraw elsif "(d)eposit" # i'd make "press d deposit" bank_account.deposit elsif "(c)heck balance" # i'd make "press c check balance" bank_account.show_balance elseif "(e)nd session&q

c++ - Why am I getting errors using virtuals? -

im trying create polymorphic classes using couple of examples have, followed them best , had kinda work around it, not quite sure why isn't compiling. #include<string> #include<iostream> #include<vector> #include<memory> #include<ctime> using namespace std; class vehicle { public: string colour; int wheels; //deconstructor virtual ~vehicle(){} virtual void setcolour(string col) {} virtual string getcolour() { return colour; } virtual int getwheels() { return wheels; } virtual void setwheels(int numwheels){}; vehicle(int numwheels, string col) : wheels(numwheels), colour(col){} }; class auto : public vehicle{ public: auto(int numwheels, string col) : vehicle(numwheels, col){} void setwheels(int numwheels){ wheels = numwheels; } void setcolour(string col){ colour = col; } int getwheels(); string getcolour(); }; class bike : public vehicle{ private: string scol; int iwheel; public:

performance - Why doesn't the List fuse as well as the Vector? (Haskell) -

consider following benchmark: module main import qualified data.list l import qualified data.vector.unboxed u import criterion.main goodsum :: int -> double {-# noinline goodsum #-} goodsum n = let ints = u.enumfromn 0 (n * n * 10) :: u.vector int in u.foldl' (+) 0 $ u.map fromintegral ints badsum :: int -> double {-# noinline badsum #-} badsum n = l.foldl' (+) 0.5 [fromintegral | <- [0 .. 10*n*n]] badsum2 :: int -> double {-# noinline badsum2 #-} badsum2 n = l.foldr (+) 0.5 [fromintegral | <- [0 .. 10*n*n]] worstsum :: int -> double {-# noinline worstsum #-} worstsum n = l.foldl1' (+) $ <- [0 .. n*n] return $ l.foldl1' (+) $ k <- [0 .. 10] return $ fromintegral $ k + main = defaultmain [ bench "good" $ nf goodsum 500 , bench "bad" $ nf badsum 500 , bench "bad2" $ nf badsum2 500 , bench "worst" $ nf worstsum 500 ] the results: benchmarking time