Posts

Showing posts from January, 2011

How can I conver this string into a java list? -

how can convert string java list (java.util.list) of 3 elements ? {electronic,pop,rock} i use google guava, solution cant see 1 list<string> result = splitter.on(charmatcher.anyof("{,}")) .trimresults() .omitemptystrings() .splittolist(); relevant documentation: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/splitter.html

php - Grouping multiple like statements -

i'm new sql can't seem group multiple like statements together. idea doing incorrectly? $query = mysqli_query($mysqli, "select * table_name page ".$page." , profession ".$profession.", , age ".$age.""); thanks. its because not enclosed correctly $query = mysqli_query($mysqli, "select * table_name page ".$page." , profession ".$profession." , age ".$age.""); when compiled like select * table_name page page number 1 , profession profession , age 100 which invalid sql you need use quotes , escape values $query = mysqli_query($mysqli, "select * table_name page '%".$page."%' , profession '%".$profession."%' , age '%".$age."%'"); would give select * table_name ...

javascript - QBO3 How to get the PersonID on a form? -

i working on custom form in qbo3 system , calling javascript save data form payment table row. when there 2 fields require personid: createdpersonid , updatedpersonid. what code should use personid user on form? or can use simple xslt select find data? i.e. <xsl:value-of select="…"/> . the qbo.security.utilities.xsltextension.cs class made available qbo3 xslts using "urn:qbo3-security" namespace. in xslt, include namespace in declaration, such as: <xsl:stylesheet version="1.0" xmlns:security="urn:qbo3-security" ...> and can use of extension methods, such as: <xsl:value-of select="security:userid()"/> // personid; e.g. 128 <xsl:value-of select="security:haspermission('somefunction')"/> // boolean <xsl:value-of select="security:isinrole('administrators')"/> // boolean <xsl:value-of select="security:user()//lastlogin"/> // xml node ...

Can a call to write(2) be interrupted by OS with an fsync(2) -

i have loop of write(2) arbitrary amount of data + eol , fsync(2) appending file line line. can crash of process leave me file has half of data write(2) call written file? theory if os calls fsync occasionally, there might coincidence of happening during call write(2) leaving file half of line written, without ending new line. yes. without crash, might have partial line written write call might not write data passed -- might return short write.

javascript - Issue with vertical line (Google chart) -

Image
folks, i trying create column chart using google chart api , having lots of issue in getting y-axis line. i understand x-axis string why vertical grid line not coming y-axis line must come. marking in red of line not coming. i have following code. function drawchartsecond(resp) { var data = new google.visualization.datatable(); data.addcolumn('string', 'activity'); data.addcolumn('number', 'hours'); data.addrows([ ['work', 11], ['eat', 2 ], ['commute', 2 ], ['watch tv', 2], ['sleep', 7] ]); var options = { title : '', legend: { position: 'right', alignment: 'center' }, tooltip: { ishtml: true }, haxis: { title: 'activity', titletextstyle: { color: 'black', font...

java - What's the purpose of the method bytecode limit? -

following on this question : there 64kb bytecode limit on java methods. what benefit provide compiler? gcc happily compile multi-megabyte c methods -- what's reasoning behind design decision? just, suggested in this question , limit poor programming practices, since 64kb methods massive? or there specific benefit limit being 64kb rather other number? offsets in method bytecode 2 bytes long (called "u2" in class file format specification). maximum offset can expressed u2 64kb. the offsets appear in actual instructions, such if* bytecodes, followed 2 bytes containing offset delta of branch. also, other class file attributes stackmaptable , localvariabletable , exceptions , others contain offsets bytecode. if offsets u4, methods longer, all class files larger. it's trade-off.

html5 - Apply transformation matrix around the center of an element -

i using raphael make manipulations in svg. in order save svg image use canvg render svg in canvas. transformations of images inside svg rendered in canvas not right. canvg uses native transform() method of html5 apply transformations using below code in line 571 of canvg. ctx.transform(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5]); but results in transformations rotations , scaling done around origin of image. in raphael transformations applied around center of image. so possible apply transformations happens around center of image? you can make own function makes transformations happen around center of image given image's center points . the theory around making things transform center follows : translate image <-x,-y,-z> , (x,y,z) image's center. do transformation want do translate image <x,y,z> . (you're returning original position now)

doctrine2 - ZF2 doctrine OneToMany annotation form -

i have following entities: user /** * users * * @orm\table(name="users") * @orm\entity(repositoryclass="users\entity\repository\usersrepository") * @annotation\name("user") * @annotation\hydrator("zend\stdlib\hydrator\classmethods") */ class user { /** * @var string * * @orm\column(name="name", type="string", length=100, nullable=false) * @annotation\filter({"name":"stringtrim"}) * @annotation\validator({"name":"stringlength", "options":{"min":2, "max":100}}) * @annotation\attributes({"type":"text","class":"form-control"}) * @annotation\options({"label":"full name:"}) */ private $name; /** * @var user\entity\useritem * * @orm\onetomany(targetentity="user\entity\useritem", mappedby="user") * @annot...

database design - Storing multidimensional data in MongoDB -

i attempting convert large mysql database of product information (dimensions, specifications, etc) mongodb flexibility , move away restriction of column based table. freedom of being able add new key-value, without making update table structure. an example of data here: http://textuploader.com/9nwo . envisioned collection being "products", nested collection each product type (ex. hand chain hoists), , nested collected manufacturer (ex. coffing & harrington). 1 large multidimensional array. learning nested collections not allowed in mongodb, i'm @ dead end. how store kind of dataset? nosql right choice this? if nested structure not necessary, can "flatten" data having each document in collection specific product , each product can have manufacturer product type fields. can index these fields can still query them without nested structure. if need preserve hierarchy, mongodb has tutorial on designing product hierarchy model here: http://docs....

activerecord - Rails 4 path_to Active Record object of unknown type -

link_to cleverly figure out type active record object , create link it's show route. how can find path unknown object type. ie. i'd like <div id="target_path" data-path="<%= path_to @my_polymorphic_instance %>" ></div> implementing might like def path_to obj url_for( :controller => obj.class.to_s.underscore.pluralize, :action => :show, :id => obj.to_param, :only_path => true ) end whats better way? the polymorphic_path should trick: <div id="target_path" data-path="<%= polymorphic_path @my_polymorphic_instance %>" ></div> in fact, it's source code similar path_to supposition.

How to traverse a tree stored in SQL database with Python? -

i have root tree stored in sql using materialized path (storing path string each row). what best way visit each node node without starting root each time? materialized path right approach? harry ├── jane │ ├── mark │ └── diane │ ├── mary │ └── george │ └── jill └── bill what expect code first starts @ harry , visits jane, diane, george, jill. in order visit mary, need go 1 level jill, , visit mary. mary doesn't have children, , we've visited every node in level (george, mary), go level visit mark. no more children left on level, go 1 level jane, we've no other node on level, go again. finally, have bill on level, , visit him. when nodes have been visited, finished. i thought storing each level of tree in separate tables, , storing references tables in table seems bit inefficient because i'd have store level traversal on, , manipulate data. level_0_table: harry, bill level_1_table: jane level_2_table: mark, diane level_3_tabl...

ios - UILocalNotification fired but not showing, or showing but not visible in notification center, or firing like a charm -

i've been struggling past few days on local notifications on app. basically goal pop notification when user approches address. here code: nsmutablearray *notifications = [@[] mutablecopy]; (ccaddress *address in results) { cccategory *category = [address.categories.allobjects firstobject]; nsdictionary *userinfo = @{@"addressid" : address.identifier}; uilocalnotification *localnotification = [uilocalnotification new]; if (category == nil) localnotification.alertbody = [nsstring stringwithformat:@"vous êtes proche de %@", address.name]; else localnotification.alertbody = [nsstring stringwithformat:@"vous êtes proche de %@, %@", address.name, category.name]; localnotification.alertaction = @"linotte"; localnotification.soundname = uilocalnotificationdefaultsoundname; localnotification.userinfo = userinfo; [notifications addobject:localnotification]; address.lastnotif = [nsdate...

nginx - Resource responding well on browser, but empty with curl -

i'm making request http://mydomain.com/api/company?keyword=demo , , on browser, works , return array of objects. here's info shown on network tab of chrome dev tools: remote address:10.10.0.245:80 request url:http://mydomain.com/api/company?keyword=demo request method:get status code:200 ok request headers /api/company?keyword=demo http/1.1 host: mydomain.com connection: keep-alive cache-control: max-age=0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 user-agent: mozilla/5.0 (macintosh; intel mac os x 10_9_3) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.114 safari/537.36 accept-encoding: gzip,deflate,sdch accept-language: en-us,en;q=0.8,es;q=0.6 cookie: optimizelyenduserid=oeu1399053750186r0.30155641376040876; km_ai=xmfdodcdx6yxgralt3hwvxiotng%3d; km_lv=x; __gads=id=69f17ebdd35fb788:t=1399063348:s=alni_mzoemxyluzvqfunqnga_hnab9phbq; aic_s3=5366b00d4170e2b1358b457b; km_uq=; optimizelysegments=%...

generic handler - Pass fancytree data as JSON data -

i want pass data fancytree generic handler can save future use. if use code: function savetree() { var tree = $('#toptree').fancytree("gettree"); $.ajax({ cache: false, url: "savetree.ashx", data: { 'treedata': tree }, contenttype: "application/json; charset=utf-8" }); } then following error jquery.js: javascript runtime error: argument not optional i have tried: var tree = $('#toptree').fancytree("gettree").rootnode.children; this gives same error. understand because 'tree' not json. how can convert data json object? edit: if use code: function savetree() { var data = []; var tree = $('#toptree').fancytree("gettree").rootnode.children; (var = 0; < tree.length; i++) { data.push(tree[i].title) } data = json.parse(json.stringify(data)) $.ajax({ cache: false, url: "savetree.ashx...

How to use Jenkins credential store when accessing CVS? -

is there way use credential store cvs plugin access cvs repository? looking way store credential once , have 1 place change it, despite many jobs making use of it. the cvs plugin doesn't use credentials store directly (although there potential plans move in future overhaul of plugin), have concept of global credentials should provide need. reason having separate global credentials cvs introduced prior credentials plugin being available , steps have never been taken try , perform migration. to use credential feature, ensure have version 2.4 or above of cvs plugin, goto 'manage configuration' screen, scroll down cvs section , click 'add' button next 'authentication' option. once you've added credentials in here, go jobs you're wanting use global credentials on, check cvs root matches put in authentication section , doesn't contain username , run job. when running, console should show 'using globally configured credentials for......

java - JPanel doesnt show components after the second button click -

i want put jtextpane component in jpanel gridbaglayout when click on button. code works fine first button click, after, next components not displayed. here code: import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class refreshpanel { private jframe frame = new jframe(); private jpanel panel = new jpanel(); private jtextpane [] textpane;// = new jtextpane[1]; private jscrollpane scrollbar; private arraylist arraylist = new arraylist(); private jbutton newitem = new jbutton("new"); private int counter=0; private gridbaglayout gbl = new gridbaglayout(); refreshpanel() { scrollbar = new jscrollpane(panel); panel.setbackground(color.white); panel.setlayout(gbl); addbuttonlistener(); createframe(); } //constructor public void addbuttonlistener() { newitem.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent arg0) { ...

java - Why doesn't this work - JOptionPane - Reading Integer Value -

so i'm working on project , want implement commands such "/heal value" when debug code prints input in console not effect given? doing correctly? here full class import javax.swing.joptionpane; public class commands { //variables string command; //the variable controls each command int[] blockname; //each block int[] string number; //the block stack amount number - need worry /heal string amount; //the amount of health want give player public static boolean open = false; //detects whether command window open public commands() { } public void tick() { if(open) { //create joptionpane can enter command command = joptionpane.showinputdialog("please enter command"); //should check see if command matchs of commands loadcommands(); //prints command input if(command != "" || command != null) { system.out.println(component.username + ": " + command + " called"); ...

Why aren't there existentially quantified type variables in GHC Haskell -

there universally quantified type variables, , there existentially quantified data types. however, despite people give pseudocode of form exists a. int -> a explain concepts sometimes, doesn't seem compiler extension there's real interest in. "there isn't value in adding this" kind of thing (because seem valuable me), or there problem undecidability that's makes impossible. edit: i've marked viorior's answer correct because seems actual reason why not included. i'd add additional commentary though in case want clarify more. as requested in comments, i'll give example of why consider useful. suppose have data type follows: data person = person { age: int , height: double , weight: int , name: } so choose parameterize on a , naming convention (i know makes more sense in example make namingconvention adt appropriate data constructors american "first,middle,last", hispanic "name,paternal name,maternal name...

mysql - Does a database query that is ordered in memory require less server resource than including the order in the query of a Rails 3.2 app? -

we have rails 3.2 app has quite few database tables , hitting database quite often. thinking refactoring app place queries in 1 area of application controller. e.g.: # database queries def get_users_in_a_group @users_in_a_group = user.where("group_id = ?", current_group.id) end the same query ordered in variety of ways. example @users_in_a_group ordered username, date_of_birth or last_login depending on need. thinking of putting area application follows database queries area, e.g. # ordered database queries def get_users_in_a_group_ordered_by_username get_users_in_a_group @users_in_a_group_ordered_by_username = @users_in_a_group.order("username") end def get_users_in_a_group_ordered_by_last_login get_users_in_a_group @users_in_a_group_ordered_by_last_login = @users_in_a_group.order("last_login") end from have read, having fewer , simpler database queries better. think way scenario above works database hit once , ordering done in memo...

json - Get list of all values in a key:value list -

so input looks like {"selling":"0","quantity":"2","price":"80000","date":"1401384212","rs_name":"overhault","contact":"pm","notes":""} {"selling":"0","quantity":"100","price":"80000","date":"1401383271","rs_name":"sammvarnish","contact":"pm","notes":"seers bank w321 :)"} {"selling":"0","quantity":"100","price":"70000","date":"1401383168","rs_name":"pwnoramaa","contact":"pm","notes":""} and output want must like 0,2,80000,1401384212,overhault,pm,"" 0,100,80000,1401383271,sammvarnish,pm,"seers bank w321 :)" 0,100,70000,1401383168,pwnoramaa,p...

fieldcollapsing - Solr grouping using a comma separated field value -

i have comma separated field value called 'categories' have indexed & stored using custom field type defined as: <fieldtype name="text_comma_delimited" class="solr.textfield"> <analyzer> <tokenizer class="solr.patterntokenizerfactory" pattern="," /> </analyzer> </fieldtype> and defined field as: <field name="categories" type="text_comma_delimited" indexed="true" stored="true" /> now want products grouped these categories use simple grouping query this: http://localhost:8089/solr/products/select?q=*:*&wt=json&indent=true&group=true&group.field=categories&group.limit=-1&rows=-1&group.ngroups=true&group.facet=true but result gives 2 groups instead of 6. seems considering one-one relationship between product , category hence 1 product appearing once should 1 many. 1 product can appear in more 1 ca...

javascript - Image Upload Preview File Path -

i'm following answer here create file upload image preview. i have working, can't figure out how place file path in separate div. here's js: function readurl(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $('[data-label="uploadpreview"]').children('img').attr('src', e.target.result); } reader.readasdataurl(input.files[0]); } } $('#uploadinput').change(function(){ readurl(this); }); this element want place file path text: <div data-label="uploadpath"></div> i have tried setting .text on reader.onload function such $('[data-label="uploadpath"]').text(e.target.result); but result appears base64 value of image. can me figure out how include path of image in data-label="uploadpath" div? ideas! btw, i'm new jquery example of how include i...

javascript - Setting input type="file" using AngularJS expression not working in Chrome -

i working on form builder application in angular , have run odd bug in chrome. dynamically setting form input type based on variable. seems work input types except "file", change "text" in chrome. simple example below: <div ng-app="app"> <input type="{{'file'}}" /><br /> <input type="{{'color'}}" /><br /> <input type="{{'button'}}" value="button" /> </div> jsfiddle indeed, sounds bug, can bypass using ngattr : <input ng-attr-type="{{'file'}}" /> <input ng-attr-type="{{'color'}}" /> <input ng-attr-type="{{'button'}}" value="button" />

matlab - Gaussian Processes for Regression (GPR) and Logistic Regression (LR) -

i want implement model risk prediction (generate percentage). know lr adequate work try gpr. my question is: gpr suitable choice in case? know gpr generate probability distribution on function , can give robust estimation missing data possible make probabilistic prediction? (or gaussian processes classification can this?) thank help. :-) gpr regression problem. lr "classification" . you should use gaussian process followed nonlinearity (like softmax) classification needs approximations learning , prediction. included in following link. can run demo see how works: http://www.gaussianprocess.org/gpml/code/matlab/doc/

assembly - Risc processor the Negation of a register -

we consider risc processor have few command dbnz. trying write code writes negation of register b , second separate code should subtract b , put result c i not sure how don't maybe possbile nasm assembler 2 different things not sure how start for record, real risc architectures (e. g. arm or mips) richer dbnz. envision designated oisc or urisc. nasm, way, of no help. targets real life cpus; yours academic model. putting emulator in high level language rather trivial. can write 1 in javascript in hour or so. the syntax i'm assuming command is: dbnz reg[, label] and meaning is: reg = reg - 1 if label given , reg != 0 goto label if label omitted, implicit jump target next instruction. it's lump of syntactic sugar me, better code readability. everything after semicolon end of line comment. labels terminated colon. code assumes registers have finite size, , integer wrap-around happens quietly, without exceptions. the algorithm negation easy eno...

php - Mailchimp double_optin option not working -

i've followed this tutorial implement mailchimp api v2.0 on website. works great, double_optin option wanted add , set false (so users don't need validate registration via e-mail) doesn't seem working. it's if not taken consideration @ all, users still need validate registration via e-mail. is 'double_optin' => false placed @ wrong place? had @ mailchimp documentation level in programmation not enough identify wrong. help <?php $api_key = "12345486-us8"; $list_id = "123"; require('mailchimp.php'); $mailchimp = new mailchimp( $api_key ); $mailchimp_lists = new mailchimp_lists( $mailchimp ); $subscriber = $mailchimp_lists->subscribe( $list_id, array( 'email' => htmlentities($_post['email']),'double_optin' => false ) ); if ( ! empty( $subscriber['leid'] ) ) { echo "success"; } else { echo "fail"; } ?> according (admittedly unofficial-lo...

asp.net - Per request lifetime of ApplicationDbContext -

cannot seem applicationdbcontext using code httpcontext.getowincontext().get<applicationdbcontext>(); the error says no overloaded method get() uses 0 arguments. not sure parameter pass. i trying use same applicationdbcontext owin has link to, instead of creating additional one. the get() method without parameters defined extension method in microsoft.aspnet.identity.owin namespace. compile, add following using statement: using microsoft.aspnet.identity.owin;

ios - Calling loadView method to reload the uiview -

i have case subviews of viewcontroller (say a) declared in loadview method. when remove viewcontroller's view (say b) superview , add viewcontroller a's view superview, how can reload view? subview b on top of subview , when remove b should looking @ update subview a. simply removing view doesn't destroy it. if have destroyed view (by calling [viewcontroller setview:nil] ), calling [viewcontroller view] reload view. should never call loadview - system you.

Major PHP/MySQL Login Project, with session variables -

alright, past 2 days, i've been scouring internet , trying best put rather sophisticated login system. i've got core of working, users can sign up, , login. i'm not new simple php , mysql, when comes in-depth code i'm lost. want have users enter login, have verified (obviously) , have done, redirected members page displays information pertaining username/account only. i've registered session variables on checklogin.php (the file verify log in's, please below), life of me cannot variables passed actual members page. figured i'd start easy. i'd try , transfer username , display welcome message "hello there, [username used login here]. cannot far. can me out? once this, can go there. login form (just snippet): <form class="form-signin" role="form" method="post" action="checklogin.php"> <center><img src="logo.png" style="padding-bottom: 10px;"></center> ...

javascript - Uncaught syntax error: Adding <li> elements to an <ul> -

i keep getting uncaught syntex error know means code has missing closing something. keep failing see missing. the idea of function extracts links id , text content , add's un-ordered list. the links have class of 'ingredient_add' , unordered list has id of 'ingredientsadded'. i can't see i've missed here. $(document).ready(function() { $('.ingredient_add').click(function() { event.preventdefault(); var id = this.id; var value = this.text(); $('#ingredientsadded').append("<li id='"+id+"'>"+value+"</li>"); }); //end add list }); // end document ready() hello problem simple mistake. var value = $(this).text(); here jsfiddle: http://jsfiddle.net/grimbode/pflxf/1/ i updated code. watch out not use same id more once. $(document).ready(function(){ var counter = 0; $('.ingredient_add').click(function(event){ event.preventdef...

php - Response from using a brand new Google API Server Key says 'The provided API key is expired' -

i have created google developer account, attached credit card info billing, enabled places api, , created server key , attached server ip address - when attempt access api in code, response of: simplexmlelement object ( [status] => request_denied [error_message] => provided api key expired. ) the endpoint using api access is: https://maps.googleapis.com/maps/api/place/textsearch/xml?query= $query&type=$type&sensor=true&key=$serverkey is error_message possibly symptom of problem? perhaps i'm using wrong endpoint, or wrong type of api key? seems odd brand new server key expired... sounds might need browser key, opposed server key.

c# - Rebuild Parent->Child->GrandChild hierarchy with LINQ performance -

the problem i have hierarchy pulling database , trying restore using linq . when run linq query against collections, not appear hitting grand-child objects. object setup the hierarchy of objects follows one project -> many sections 1 section -> many biditems 1 biditem -> many subitems they related through foreign keys in database , mapped model objects. following simplified versions of models. models public class section { public int sectionid { get; set; } public int projectid { get; set; } } public class biditem { public int biditemid { get; set; } public int sectionid { get; set; } } public class subitem { public int subitemid { get; set; } public int biditemid { get; set; } } view models public class sectionviewmodel : basechangenotify { private readonly section section; private readonly list<biditemviewmodel> biditems; public sectionviewmodel(project project, section section) { var reposito...

sql server - MS Dynamics CRM 2011: Can I Copy an Entity and Rename the Entity? -

i need create entity exact same columns , metadata 1 have. need give new identity different name data comes different customer , wanted keep entities separate; trying efficient in case have again. is can in ms dynamics crm 2011? also, extensionbase in sql-server renamed new name if able copy entity possible? you can create , export unmanaged solution containing entity want duplicate. after need manually edit solution xml , change relevant entries (now don't know one, think entity name plus else). after import unmanaged solution , new entity.

r - Subset shapefile polygons based on values in a separate spreadsheet (.csv) -

Image
i have polygon shapefile of sampling strata, contains in attributes table name/id of each respective polygon (strataid). in separate .csv file, again have same strata ids in addition sampling effort employed in each respective strata. however, strata not sampled (sample size of 0), , grts function (spsurvey) spatial sampling not allow 0 effort, strata without effort removed; left .csv file contains strata sampling effort >0. subset of strata, need sync shapefile containing strata polygons samples allocated (i.e., strata polygons not sampled have removed shapefile). is there way subset shapefile recalling ids present in separate spreadsheet? both shapefile (strata) , .csv (effort) employ identical strata identifiers. i've played around subset , other functions minimal success: # second column of strata file strataid strata <- strata[strata@data[,2] %in% c(effort$strataid)] any direction appreciated. library(maptools) data(wrld_simpl) countrydf <- da...

javascript - dc.js month chart uneven spacing between bars -

Image
i creating chart using dc.js , can see spacing between months different. notable between february , march because february has 28 days. how have spacing between months? chart //dimensions .height(250) .margins({top: 10, right: 50, bottom: 25, left: 50}) //x-axis .x(d3.time.scale().domain(domain)) .round(d3.time.month.round) .xunits(d3.time.months) .elasticx(true) .xaxispadding(20) //left y-axis .yaxislabel('dollars') .elasticy(true) .renderhorizontalgridlines(true) // right y-axis .rightyaxislabel('quantity') //composition .compose(composition) .brushon(false) .xaxis().tickformat(d3.time.format('%b %y')); i think forget set gap mag...

matlab - integral of a series which is a function -

i quite lost matlab code.i appreciate help. need integrate series, function of variable x , on support of x . i run following: m=10; % finite summation uptill m %step1: create series function: \sum_{1}_{m}(x^{n}) series=@(x,n)(sum(x.^(1:n))); %styep2: call function m=10, x still undefined ser=@(x)series(x,m); % step3: integrate on x in given space x h=integral(ser,1,2); i get: error using .^ matrix dimensions must agree. error in @(x,n)(sum(x.^(1:n))) error in @(x)series(x,m) error in integralcalc/iteratescalarvalued (line 314) fx = fun(t); error in integralcalc/vadapt (line 133) [q,errbnd] = iteratescalarvalued(u,tinterval,pathlen); error in integralcalc (line 76) [q,errbnd] = vadapt(@atobinvtransform,interval); error in integral (line 89) q = integralcalc(fun,a,b,opstruct); error in test (line 9) h=integral(ser,1,2); any suggestions? integral requires function integrated able handle vecto...

css3 - card flip doesn't work in IE (11, 10, etc) -

i found tutorial david desandro on css3 transform found code doesn't work in ie... http://desandro.github.io/3dtransforms/examples/card-02-slide-flip.html note when "flip" clicked, thing happens card 1 still shown , card 2 hidden...anyone know what's going on , have fix this? here code used effect .container { width: 200px; height: 260px; position: relative; margin: 0 auto 40px; border: 1px solid #ccc; -webkit-perspective: 800px; -moz-perspective: 800px; -o-perspective: 800px; perspective: 800px; } #card { width: 100%; height: 100%; position: absolute; -webkit-transition: -webkit-transform 1s; -moz-transition: -moz-transform 1s; -o-transition: -o-transform 1s; transition: transform 1s; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform-origin: right center; -mo...

sql - User database design for marketplace-style app -

need best-practice wisdom i'm new database architecture. marketplace type app. main issue i'd advice on handling users. what i'd achieve buyer , seller accounts share login/signup functionality , characteristics, seller accounts have ability sell, receive payments, etc. buyers can send requests, sellers can complete them. seller can buyer can do, additionally view , fulfill requests, , sell. i'd go simple roles, except sellers have more complex relationships buyers in terms of products , payment info. sellers need able publicly listed, , have public profiles. i'm not sure having 1 big table both users types ideal this. my current idea use polymorphic associations between base user table , seller table (potentially buyer specific table well): user (buyer) name email encrypted_password (other authentication fields) location occupation meta_id meta_type seller name location occupation etc requests (belongs buyer , seller) type desc...

qt - Access properties from different qml tabs within same tabbedpane -

i have main.qml contains tabbedpane, in which, has 2 tabs: tab1 , tab2. able change text 1 tab another. if same navigationpane works not tabs apparently. there way share information between them? i've tried signals in c++ doesn't work either(i guess doesnt know instance ?). any suggestion appreciated. main.qml: tabbedpane { tab { tab1 { } } tab { tab2 { } } attachedobjects: [ tab1 { id: tab1 }, tab2 { id: tab2 } ] } tab1.qml: page { property alias labeltab1: labeltab1 container { label { id: labeltab1 text: "label tab1" } button { id: buttontab1 text: "tab1" onclicked: { tab2.labeltab2.text = "this coming tab1" } } } } tab2.qml: page { property alias labeltab2: labeltab2 container { label { id: labeltab2 text: "label tab2" } button { id: buttontab2 ...

html - White right margin on mobile devices -

i made website displays correctly on desktop on mobile devices large white margin on right side of screen. tried every solution found far, meaning following basically: html,body { width: 100%; height: 100%; margin: 0px; padding: 0px; overflow-x: hidden; overflow-y: auto; } tried every combination out of didnt have margin instead vertical scrolllbar isnt either. please me issue? you can see problem here . you should set max-width: 100%;, or try find element in html code (using development tools in browser) has width property value higher mobile screen resolution. i found .menu2 class element have negative margin value. setting 0, , changing width of .main element 100% instead of value in ems solved problem in browser.

sql - SUM Two Different Columns in two different tables Grouped by Column in third table -

i can work in 2 seperate queries can't both joins have 3 columns. can me out please? need output this: +------------------------------------------------+ | cluster_name | total_units |allocated_units| +------------------------------------------------+ | cluster1 | 300 |25 | +------------------------------------------------+ | cluster2 | 400 |45 | +------------------------------------------- ----+ two seperate queries working: query 1: select cluster_info.cluster_name, sum(host_info.unit_count) 'total_units' cluster_info inner join host_info on host_info.cluster_id = cluster_info.cluster_id group cluster_info.cluster_name query 2: select cluster_info.cluster_name, sum(vm_info.unit_count) 'allocated_units' cluster_info inner join vm_info on cluster_info.cluster_id = vm_info.cluster_id group cluster_info.cluster_name table 1 (cluster_info): +-----------------------...

node.js - Deploying Express app to Heroku -

i trying deploy express application heroku keep getting error "push rejected, no cedar-supported app detected", made sure define package.json , procfile tutorial using npm init. here package.json file: { "name": "classmatch", "version": "0.0.1", "description": "compare schedules", "main": "app.js", "scripts": { "test": "echo \"error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "https://github.com/jzone3/classmatch.git" }, "keywords": [ "example", "heroku" ], "author": "paras modi, jared zoneraich", "license": "bsd-2-clause", "bugs": { "url": "https://github.com/jzone3/classmatch/issues" }, "homepage": ...

ios - Manipulating UIImages for high resolution -

i trying build app allows user combine 2 uiimages, i've got no problem using core graphics. user able pan , resize photo in view , combining result of views in image context. the size of combined photo small saving visible portion of image in view in. avoid shrinking photo , scaling up, have provide view user alter photo , apply changes (at correct scale) full size photo? i appreciate help, if above confusing can provide code example, trying see if i'm heading down right road or if there better way... thanks to avoid shrinking photo , scaling up, have provide view user alter photo , apply changes (at correct scale) full size photo? yes, if shrink image start (to display user , allow user manipulations) must not throw away original , scale shrink image again. must keep original , operate upon it. otherwise, lose lots of pixels forever. however, why bother? display shrink the way image drawn you. if show large image in uiimageview, using aspect fit mod...

python - Merge multiple 2d lists considering axis in order -

my purpose combine multiple 2d list in order such as: a = [[1,2],[3,1]] b= [[3,6],[2,9]] c = [[5,1],[8,10]] expected: [[1,2,3,6,5,1],[3,1,2,9,8,10]] following other's advice site, tried use collections module code below: from collections import counter = [[1,2],[3,1]] b= [[3,6],[2,9]] c = [[5,1],[8,10]] d = [[k,v] k,v in (counter(dict(a)) + counter(dict(b))+ counter(dict(c))).items()] print d however, result [[1, 2], [3, 1], [3, 6], [2, 9]] not expected. do have idea solve problem? maybe if there function or module consider axis combine lists. you can use zip , list comprehension : >>> = [[1,2],[3,1]] >>> b = [[3,6],[2,9]] >>> c = [[5,1],[8,10]] >>> [x+y+z x,y,z in zip(a, b, c)] [[1, 2, 3, 6, 5, 1], [3, 1, 2, 9, 8, 10]] >>>

jquery - Backbone Model Save with Specific Attributes, How to Post some attrs when syncing? -

i've got new model tons of attributes. when #save ing expect backbone #post because id null, works correctly. $ = require('jquery') - = require('underscore') model = new backbone.model({ id: null, name: "tom", cat: false, dog: true, //... many more attrs whiskers: false, tail: true }); now want send small subset of attributes server on post. with jquery can write this: data = _.pick(model.attributes, 'name', 'dog', 'tail'); $.post(model.url(), data); how can backbone? i did sync below, felt wrong. data = {} data.attrs = _.pick(model.attributes, 'name', 'dog', 'tail'); model.sync('create', model, data)

java - Is there a way to make JTextField for my address bar larger and curvier -

Image
i'm making browser practice java skills, there way make address bar jtextfield, larger instead of swing's default value , curvier. here's code. //imports of gui //import java.awt.*; //import java.awt.event.*; //import javax.swing.*; //import javax.swing.event.*; //import javax.swing.text.*; //import javax.swing.grouplayout.*; //extends use gui class public class readfile extends jframe { private jtextfield addressbar; //to have address bar private jeditorpane display; //display html information //constructor //set frame icon image loaded file. public readfile() { super("sphere"); //name of browser addressbar = new jtextfield("enter url", 50); //inside url addressbar.addactionlistener( new actionlistener(){ public void actionperformed(actionevent event){ loadcrap(event.getactioncommand()); } } ); add(addressbar, borderlayout.north); display...

jQuery next() for class attr -

Image
html code <span class="play" href ="media/tagged - 357.mp3"> <span class="play" href ="media/tagged - 358.mp3"> <span class="play" href ="media/tagged - 359.mp3"> <span class="play" href ="media/tagged - 360.mp3"> i try set song player next/previous song buttons. possible next class attr href? $("#fwd_btn").on('tap touch click',function () { if(themp3 !=undefined){ themp3.stop(); currentsong++; } url_new = $(".play").next().attr('href'); playsound(url_new); }); okay looking @ actual code, spans not have above. not siblings, inside of elements next() fail. plus not sure why span has href, better use data attribute. second ran test and shows finds element. unless currentsong not have correct value, not sure why not work. what have in code $(this).find(".play") means looking ...

java - Abstract Quilt Square -

i creating abstract quilt square. have subclass of either abstractquiltsection or abstractgraphicalquiltsection , class extend 1 of these classes. since creating text based quilt section, extended abstractquiltsection class. there 9 abstract methods in abstractquiltsection: **public abstract string line1...line9 (int width)** each of these methods return string. length of string should width parameter. i.e. if width 12, string returned should 12 characters long. line1 method returns first line of quilt section, line2 method returns second line, etc. here confused: each text based quilt section 9 characters high (i.e. take 9 lines), width may vary. when quilt drawn, line1, line2, line3…etc. methods called figure out characters output. a sample quilt section width of 12 (containing quote shakespeare) might be: ............ .to......... ......thine. ...own...... .....self... ..be........ .....true... ............ shakespeare. i have create subclass of abstrac...