Posts

Showing posts from June, 2015

machine learning - kNN result on same distant datapoints with opposed classes -

Image
using 1-nn , 3-nn (euclidean distance knn) in conjunction using leave_one_out cross validation, cv error on data points? note error of each written in parentheses 1) 1-nn(0.1) , 3-nn(0.1) 2) 1-nn(0.1) , 3-nn(0.5) 3) 1-nn(0.5) , 3-nn(0.1) 4) 1-nn(0.5) , 3-nn(0.5) apparently right answer 3-rd one, i’m baffled , can’t figure out why? can explain how?

git - Use same branch more than once -

i new git, , assuming if can use 1 branch project. after commit code branch -- subbranch , , merge master . did other change. may commit them subbranch again , merge master , or have make new branch? you need read materials [git branch model, or git workflow. following 2 links start. git wokflow git branch model you need not creating new branch case described in question, if have needs work on multiple new features, or interrupted hot fix request, new branch help.

PHP Associative Arrays: Storing Keys and values -

i pretty new associative arrays. trying create dynamic associative array. current array - stdclass object ( [354] => array ( ) [355] => array ( ) ) trying desired output stdclass object ( [354] => array ( [activity_desc] = "description" ) [355] => array ( [activity_desc] = "description" ) ) wrote sql check key (354, 355) , return description. how store key , value under 344 & 355? current code: foreach ($report $key=>$value) { $where = 'item_id = ' . $key . ''; $query = $db->prepare('select activity_desc program '. $where); $query->execute(); $test = $query->fetch(pdo::fetch_obj); } this sql return query 354. 355 same. stdclass object ( [activity_desc] => <p>send activity</p> thanks in advan...

How to use placeholders for unneeded parameters in c++ -

i using function gmp arbitrary precision arithmetic library: function: void mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t a, const mpz_t b) set g greatest common divisor of , b, , in addition set s , t coefficients satisfying a*s + b*t = g. value in g positive, if 1 or both of , b negative (or 0 if both inputs zero). values in s , t chosen such normally, abs(s) < abs(b) / (2 g) , abs(t) < abs(a) / (2 g), , these relations define s , t uniquely. there few exceptional cases: if abs(a) = abs(b), s = 0, t = sgn(b). otherwise, s = sgn(a) if b = 0 or abs(b) = 2 g, , t = sgn(b) if = 0 or abs(a) = 2 g. in cases, s = 0 if , if g = abs(b), i.e., if b divides or = b = 0. if t null value not computed. i not need values of 'g' or 't' , not create variables sole purpose of passing function. can pass placeholder specific function, , how can in c++ in general? you might overload function. void mpz_gcdext (mpz_t s, const mpz_t a, const mpz_t b) { ...

r - Visualization library for disjoint intervals -

Image
i want visualize memory mapping states of processes. parsed output of # strace -s 256 -v -k -f -e trace=memory,process command and have time series of disjoint sums of intervals on real line. there convenient visualization library such data? haskell interface time-saving me, suggestion welcome. thanks! just in case might useful anyone, hacked little tool this. (by way ended using r/shiny interactive visualization.) here's github repo . it's interactive in if click region, stack traces responsible memory mapping shown this: trace: 22695 mmap(null, 251658240, prot_none, map_private|map_anonymous|map_noreserve, -1, 0) = 0x2b4210000000 /lib/x86_64-linux-gnu/libc-2.19.so(mmap64+0xa) [0xf487a] /usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_zn2os17pd_reserve_memoryempcm+0x31) [0x91e9c1] /usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_zn2os14reserve_memoryempcm+0x20) [0x91ced0] /usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_...

hadoop - HIVE Malformed ORC file Error -

an insert select run on hive orc table hive text table source. insert table orc_table select * text_table; both tables have same structure. insert did not throw error. select * on orc table works. but operation involves mapreduce count , max , min on orc table throws malformed orc file -invalid post script error

matlab - how to center and scale data using ployfit -

i have set of points in want fit line through. in cases end getting inf or -inf when lines either vertical or horizontal. have seen matlab's description of centering , scaling, not seem understand how apply data. below example code, please note isn't 1 issue. have used because main code long follow. x = [0, 1.81, 3.64, 5.45, 7.27]; y = [1, -0.82, -2.64, -4.45, -6.27]; fitline = polyfit([y(1), y(2), y(3), y(4)], [x(1), x(2), x(3), x(4)], 1); %plot data k = linspace(0, 10, 5); fk = (fitline(1)*k) + fitline(2); figure, plot(k, fk, 'color', 'r', 'linewidth', 1); looking forward help/suggestions/advice. thanks! matlab's function set polyfit , polyval handle centering (calculation of mean) , scaling (calculation of standard deviation) you. use third output of polyfit parameters: x = [0, 1.81, 3.64, 5.45, 7.27]; y = [1, -0.82, -2.64, -4.45, -6.27]; [fitline,~,mu] = polyfit(y(1:4),x(1:4), 1); and pass them polyval : k = linsp...

python - Many-to-many relationship: get-or-create -

i working on tagging system blog. here stripped-down version of code creates flask app object , relevant post , tag models. from flask import flask flask_sqlalchemy import sqlalchemy sqlalchemy.ext.associationproxy import association_proxy app = flask(__name__) app.config['sqlalchemy_database_uri'] = 'sqlite:///test.sqlite' db = sqlalchemy(app) post_tags = db.table('post_tags', db.column('post_id', db.integer, db.foreignkey('posts.id'), nullable=false), db.column('tag_id', db.integer, db.foreignkey('tags.id'), nullable=false), db.primarykeyconstraint('post_id', 'tag_id')) class tag(db.model): __tablename__ = 'tags' id = db.column(db.integer, primary_key=true) name = db.column(db.string(30), nullable=...

asp.net - VS 2015: Binding a WebApp to something besides localhost -

Image
i've got vs webapp testing (an odata provider if matters). client android. you can't run server , client (via simulator of client' os) on same box. so i'm using physical android device run client. unfortunately visual studio hell bent on binding webapp (and to) localhost. isn't won't respond attempts connect hostname or ip address, , attempt change iis configuration inside of visual studio meets error message saying must use localhost (which cannot used connect machine) 1) how around this? and 2) if isn't obvious find, how people expected test remote device on development machine? joehz, you need change binding configuration of iis express webapp. in folder *.sln is, find hidden folder named .vs . open xml file applicationhost.config in config folder. in applicationhost.config file, find sites nodes, site want configure. for example: <site name="mysitename" id="2"> <application path=...

c - Access structure members without using '.' or '->' operator -

this question has answer here: structure - access structure element without . , -> 1 answer how access keyvalue , alternatekeyvalue dell laptop definition without using '.' or '->' operators directly reference qwerty struct or members. i tried looking solution didn't find any. please me find way access it? typedef enum { mouse_none, mouse_up, mouse_down, mouse_left, mouse_right, } mouse_direction_e; typedef struct { bool leftbutton; bool rightbutton; bool middlebutton; bool mouseon; mouse_direction_e direction; } mouse_s; typedef struct { char keyvalue; char alternatekeyvalue; } keyboard_s; typedef struct { mouse_s simplemouse; keyboard_s qwerty; } laptop_s; laptop_s dell = { .simplemouse = { .leftbutton = false, .rightbutton = false, .middlebutto...

javascript - Mask if more then x characters -

i using masking plugin ( http://digitalbush.com/projects/masked-input-plugin/ ) works, trying work once there 5+ characters in textbox. whenever hit 6th character, clears out textbox , won't accept input anymore. js: <script> function convert(){ if (l.length > 5){ $("#q").mask('(999) 999-9999'); } } </script> html: <form action="search.php" method="get"> <input type="tel" class="form-control" name="q" id="q" placeholder="phone/order number" onkeyup="convert()"><br> <button type="submit" class="btn btn-default">search</button> </form> if please me, great. :d it clears out textbox because when apply mask, plugin clears input. can around passing autoclear option , set false. keep attempting apply mask, you'd have remove event listener. ditch inline event handler, that...

c++ - How to pass multi-argument templates to macros? -

say have macro this: #define set_type_name(type, name) \ template<typename t> \ std::string name(); \ \ template<> \ std::string name<type>() { \ return name; \ } this won't work if pass template has more 1 parameter, because comma in <int, int> interpreted separating macro arguments, not template arguments. set_type_name(std::map<int, int>, "themap") // error: macro expects 2 arguments, 3 given this problem seems solved doing this: set_type_name((std::map<int, int>), "themap") but problem arises, 1 did not expect: template<> std::string name<(std::map<int, int>)>() // template argument 1 invalid it seems parentheses make template argument invalid. there way around this? besides typedef , switch order of arguments , use variadic macros (requires c99 or c++11-com...

python - Having trouble using "in" function to check for containment of one array in another -

the current code extremely short. if understand "in" function correctly, shouldn't loop iterate , return true if both [1,3] in [1,4,5]? right getting true of tests. feel there easy fix this, don't know. i tried putting if statement in-between , return lines still returned true. def innerouter(arr1, arr2): arr1 in arr2: return true return false you have use if one_element in array def innerouter(arr1, arr2): x in arr1: if x not in arr2: return false return true innerouter([1,3], [1,4,5]) # false innerouter([1,4], [1,4,5]) # true or can use set() check def innerouter(arr1, arr2): return set(arr1).issubset(set(arr2)) innerouter([1,3], [1,4,5]) # false innerouter([1,4], [1,4,5]) # true the same: def innerouter(arr1, arr2): return set(arr1) <= set(arr2) https://docs.python.org/2/library/sets.html#set-objects

elasticsearch - Aggregate only newest document -

i have elastic index has documents user state history. data looks this; { "session_id": "yunus", "state_name": "start", "entry_time": "2016-11-09 15:27:03" }, { "session_id": "yunus", "state_name": "end", "entry_time": "2016-11-09 16:30:00" }, { "session_id": "can", "state_name": "start", "entry_time": "2016-11-09 12:01:00" }, { "session_id": "rick", "state_name": "start", "entry_time": "2016-11-09 09:00:00" }, { "session_id": "rick", "state_name": "end", "entry_time": "2016-11-10 10:00:00" } i want aggregate state name date histogram relevant last state @ time. result can be; 2016-11-08 start = 0 end ...

ios - swift 3 filter array of dictionaries by string value of key in dictionary -

i have class such this class founditem : nsobject { var id : string! var itemname : string! var itemid : int! var foundby : string! var timefound : string! init(id: string, itemname: string, itemid: int, foundby: string, timefound: string) { self.id = id self.itemname = itemname self.itemid = itemid self.foundby = foundby self.timefound = timefound } and reference on class mapviewvc: uiviewcontroller, mkmapviewdelegate { var found = [founditem]() var filteritemname : string() } my founditem generated array of dictionaries class of founditem firebase query. string of itemname generated view controller collection view on didselection function. want take string , filter or search arrays string itemname equal itemname string previous viewcontroller . removed array of dictionaries not equal itemname . not objects, entire array contains non-equal key, value pair. have looked days, , stuck on filtering array of dictionaries created ...

popup - Wordpress Modal contact form using CF7 and Easy Fancybox not working? -

Image
i have been attempting create modal contact form using 2 plugins: contact form 7 , easy fancy box. i using visual composer in order build site.. i have therefore created 'raw html' element, , in element have following code: <a href="#contact_form_pop" class="fancybox">contact us</a> <div style="display:none" class="fancybox-hidden"> <div id="contact_form_pop"> <?php echo do_shortcode('[contact-form-7 id="4" title="contact form 1"]'); ?> </div> </div> this not work , browser seems comment out php code, know php server side language following tutorial found. result when button clicked: i tried code without php , wordpress' 'do_shortcode', tutorial instructed: <a href="#contact_form_pop" class="fancybox">contact us</a> <div style="display:none" class="fancybox-hidden"> ...

ios - Wanna use StoryBoard as tab of child viewcontrollers XLPagerTabStrip -

i posted project's github issue, https://github.com/xmartlabs/xlpagertabstrip/issues/270 https://github.com/xmartlabs/xlpagertabstrip plz check method: override func viewcontrollers(for pagertabstripcontroller: pagertabstripviewcontroller) -> [uiviewcontroller] this methods return uiviewcontroller show tab's viewcontrollers, can render, , library example shows how put programatically not storyboard var child_1 : homeviewcontroller{ let storyboard = uistoryboard(name: "main", bundle: nil) let child_1 = storyboard.instantiateviewcontroller(withidentifier: string(describing: "homeviewcontroller")) as! homeviewcontroller child_1.iteminfo = "home" return child_1 } override func viewcontrollers(for pagertabstripcontroller: pagertabstripviewcontroller) -> [uiviewcontroller] { let child_2 = tablechildexampleviewcontroller(style: .plain, iteminfo: "beef") let array : [uiviewcontroller] = [child_1, chil...

angular - gulp task runner giving error -

Image
i getting error while doing task runner "gulp" file, sample project angular 2 , asp.net core. i have "typings" folder in place, has below "typings.json" file, { "resolution": "main", "tree": { "src": " https://raw.githubusercontent.com/definitelytyped/definitelytyped/be0ba281b67575b3b626a6bbb15b152add97244e/core-js/core-js.d.ts ", "raw": "registry:dt/core-js#0.0.0+20160914114559", "typings": " https://raw.githubusercontent.com/definitelytyped/definitelytyped/be0ba281b67575b3b626a6bbb15b152add97244e/core-js/core-js.d.ts " } } below "gulp" file, /* file in main entry point defining gulp tasks , using gulp plugins. click here learn more. http://go.microsoft.com/fwlink/?linkid=518007 */ var gulp = require('gulp'), gp_clean = require('gulp-clean'), gp_concat = require('gulp-concat'), g...

javascript - CSS media queries get messed up -

Image
it's not serious question, want share , more information css media queries. i find own css media queries comfortable, still has many flaw in it. know today mobile device growing fast, of them has same resolution tablet or laptop. let's case this order of media queries in index.php <!-- bootstrap --> <link rel="stylesheet" type="text/css" href="style/bootstrap/css/bootstrap.min.css"> <!-- custom --> <link rel="stylesheet" type="text/css" href="style/css/main.css"> <link rel="stylesheet" type="text/css" href="style/css/laptop.css"> <link rel="stylesheet" type="text/css" href="style/css/mobile.css"> i using bootstrap make type less, main.css dekstop view, best view on desktop resolution, 1920x1080p , below not perfect. mobile.css device phone , tablet, , default mobile device , ipad r...

html - Python scrapy, how to only get immediate children -

so have html this <div class="content"> <div class="infobox"> <p> text </p> <p> more text </p> </div> <p> text again </p> <p> more text </p> </div> and using selector '.content p::text' thought me immediate children, wanted extract "text again" , "even more text" it's getting text paragraphs inside other div, how can prevent happening, want text paragraphs immediate children of div class .content scrapy uses extended set of css selectors , xpath selectors . in case, you're using css selectors. css relationship selector want > denoting parent/child relationship, in: .content > p::text . scrapy's selectors described in section titled " selectors " in documentation.

Python Pandas iterrows and set_value as vectorized function -

i using function in 1 of programs, , have researched better performance can achieved through vectorization. how can achieve same resolution using vectorized function rather using code below? i, row in df.iterrows(): ifor_val = if <condition>: ifor_val = something_else df.set_value(i,'ifor',ifor_val) if value depends on other values in row, can't avoid iterating. df['ifor'] = df['some_col'].apply(lambda v: if <condition> else something_else) this puts iteration in pandas, it's cleaner (and possibly faster).

php - having trouble with slimframework's Immutable responses -

i trying setup project api using slim framework version 3, don't know made psr-7 , marked response object immutable, don't see use in (imho. please explain me if wrong). things easier when slim 2. came slim after long time. i have route post method, getting data , saving database , trying send 201 response code. examples , documentation showing how can change response code within index.php file itself, trying change response builder have tried use factory pattern provide different responses. problem response code stays 200 no matter function call response builder class. tried many forums , different ways of slim still couldn't able pull up. decided give on psr 7 router implementation , going implement own routing solution. remember not reinvent wheel again came here final try. below code. the route definition $app->post('/users', function(serverrequestinterface $req, responseinterface $res) { $data = $req->getparsedbody(); $model = new \apex\...

IOS testFlight invitation email "This message has no text content" -

Image
i using testflight invite internal users. other users(like gmail) works except icloud email one. internal test user can email, without text body start testing button. like below:

qt - How to embed SQLite into a C++ project -

i'm trying embed sqlite project. have included following files directory called lite : sqlite3.dll, sqlite3.h, , sqlite3.lib. this project: #include <stdio.h> #include <lite/sqlite3.h> int main(int argc, char* argv[]) { sqlite3 *db; char *zerrmsg = 0; int rc; rc = sqlite3_open("test.db", &db); if( rc ){ fprintf(stderr, "can't open database: %s\n", sqlite3_errmsg(db)); return(0); }else{ fprintf(stderr, "opened database successfully\n"); } sqlite3_close(db); } i following errors when run project: :-1: error: cannot find -lsqlite3d collect2.exe:-1: error: error: ld returned 1 exit status what doing wrong? i'm working in qt. .pro file: template = app config += console c++11 config -= app_bundle config -= qt sources += main.cpp win32:config(release, debug|release): libs += -l$$pwd/lite/ -lsqlite3 else:win32:config(debug, debug|release): libs += -l$$pwd/lite/ -lsqlite3...

javascript - Play a sound on another web page via button click -

direct point of problem. have web app have queue management system. app use teacher call student base on queue. there 2 page in app want connect each other. page 1 home page teacher login account. in page there button [next queue]. page 2 real time queue each teacher. when button in page 1 pressed, page 2 update next queue automatically (using ajax). behave chat app follow simple tutorial tutsplus simple web chat , change little make works in web app. then problem how play beep sound in page 2 when teacher pressed button ? can't find tutorial play song on other page, found same single page. simpler solution checking button pressed, don't know how check if in page. i'm newbie in ajax , not proud javascript skill follow tutorial above. thank in advance. you can handle in ajax success event when scrollheight has been changed ( according tutorial reference ): if(newscrollheight > oldscrollheight) { $("#chatbox").animate({ scrolltop: newscro...

typo3 - Validation failed while trying to call showAction -

i using typo3 7.6.11 , getting following error when trying call showaction() . validation failed while trying call vendor\extension\controller\mycontroller->showaction(). i've checked validation in model , couldn't find issues. is there way debug error , more information? you can either debug validation results or display them in template. debugging validation results for debugging have in \typo3\cms\extbase\mvc\controller\actioncontroller controller extends. you'll find method callactionmethod() validation results processed. displaying validation results for displaying errors in fluid, use viewhelper <f:form.validationresults> : <f:form.validationresults> <f:if condition="{validationresults.flattenederrors}"> <ul class="errors"> <f:for each="{validationresults.flattenederrors}" as="errors" key="propertypath"> <li>{propertypath} ...

angular - Injecting 3rd party js file -

i working off of angular 2 seed project. trying inject 3rd party js file don't think being included. had same issue css well, not able inject in index.html, got css work importing css in main.css file, stuck js file. might missing something, can point me in right direction. below index.html, <!doctype html> <html lang="en"> <head> <base href="<%= app_base %>"> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title><%= app_title %></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- inject:css --> <!-- endinject --> </head> <body> <sd-app>loading...</sd-app> <script> // fixes undefined module function in systemjs bundle function module() {} </script...

Export data to Excel from SQL Server using OPENROWSET issue -

i using below script , got following error: cannot create instance of ole db provider "microsoft.ace.oledb.12.0" linked server "(null)". exec sp_configure 'show advanced options', 1; go reconfigure; exec sp_configure 'ad hoc distributed queries', 1; go reconfigure; insert openrowset ('microsoft.ace.oledb.12.0', 'excel 12.0;database=c:\csv\testing.xlsx;', 'select * [sheet1$]') select top 10 * emp2 how can fix this? need export data excel file in unc path . please guide me how achieve it. again try below script time getting different error: cannot create instance of ole db provider "microsoft.jet.oledb.4.0" linked server "(null)". exec sp_configure 'show advanced options', 1 reconfigure go exec sp_configure 'ad hoc distributed queries', 1 reconfigure go insert openrowset ('microsoft.jet.oledb.4.0', 'excel 8.0;database=c:\csv\testing.xl...

c++ - Why is Map[2] updating a wrong key data? Is this a proper way of doing this? -

#include <iostream> using namespace std; struct ls{ bool operator()(int lhs, int rhs){ return lhs == rhs; } }; int main(){ map<int,string,ls> m1 {{1,"a"},{2,"b"}}; map<int,string>::iterator i; for(i=m1.begin();i!=m1.end();++i) { cout<<i->first<<" - "<<i->second<<endl; } //if print data here 1, "a" data present. m1[2] = "c"; for(i=m1.begin();i!=m1.end();++i) { cout<<i->first<<" - "<<i->second<<endl; } //the above statement updates m1[1] "c" though m1[2] } the problem not respecting contract of std::map third template argument should comparison function. the comparison function, defaults std::less<t> , must provide total ordering on keys of std::map . purpose iso standard defines that, associative containers @ §23.2.4.3: the phrase “equivalence of keys” means equ...

php - FOS user bundle doesn't keep logged session -

Image
i have integrated fos user bundle quick guide tells do. seem work except once log in , redirects loses session reason , i'm anonymous user. this when log in before i'm redirect back: as can see i'm logged in , should redirect homepage. when i'm on homepage i'm redirected login because check if user logged in or not. somehow not remember logged in. this configuration security.xml security: encoders: fos\userbundle\model\userinterface: bcrypt role_hierarchy: role_admin: role_user role_super_admin: [role_user, role_admin, role_allowed_to_switch] # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers providers: in_memory: memory: ~ fos_userbundle: id: fos_user.user_provider.username firewalls: main: pattern: ^/ form_login: check_path: /login_check login_path: /login ...

Python Schematics: How to do model level validation? -

i have python class following: from schematics.models import model schematics.types import stringtype class myclass(model): some_string = stringtype() other_string = stringtype() i'm trying make value of other_string required if some_string == "hello" . how write model level validator this? note docs schematics model level validation right here , documentation doesn't mention purpose of data , value arguments. furthermore, don't elaborate how model level validation @ in entire documentation.

C++ OpenGL shading version error - GLSL x is not supported [Ubuntu 16.04] -

i working on project using opengl on ubuntu 16.04 , have run major issue. @ point have no idea feels have tried in order fix this. for reason shader won't compile , returns following error: failed compile vertex shader! 0:1(10): error: glsl 4.50 not supported. supported versions are: 1.10, 1.20, 1.30, 1.00 es, 3.00 es, 3.10 es, , 3.20 es` i have adjusted version in shader file without luck. #version 450 core etc. keep getting same result. for reference, here output of sudo glxinfo | grep "opengl" : opengl vendor string: intel open source technology center opengl renderer string: mesa dri intel(r) hd graphics 520 (skylake gt2) opengl core profile version string: 4.5 (core profile) mesa 13.1.0-devel opengl core profile shading language version string: 4.50 opengl core profile context flags: (none) opengl core profile profile mask: core profile opengl core profile extensions: opengl version string: 3.0 mesa 13.1.0-devel opengl shading language version string:...

mysql - How to update a sql table only if other condition exist in another table -

i have 2 sql separated tables in database: ds_users, containing: group_id and ds_users_data_members, containing: data_gender i set / update group_id 6 data_gender equal 2 . all morning tried solve issue , without success. please help. thank much i assuming there must relation between 2 tables. without relationship cannot update record in 1 table checking condition in table. let's ds_users table has column user_id exist in ds_users_data_members table. so, can write following query update records in ds_users data_gender=2 in ds_users_data_members table sql server example update t set group_id=6 ds_users t inner join ds_users_data_members t1 on t.user_id=t1.user_id t1.data_gender=2 mysql example update ds_users t inner join ds_users_data_members t1 on t.`user_id`=t1.`user_id` set t.`group_id`=6 t1.`data_gender`=2; you can replace column name of user_id have given in table.

numpy - Ensuring positive definite covariance matrix -

the outputs of neural network act entries of covariance matrix. however, 1 one corresponde between outputs , entries results in not positive definite covariance matrices. thus, read https://www.quora.com/when-carrying-out-the-em-algorithm-how-do-i-ensure-that-the-covariance-matrix-is-positive-definite-at-all-times-avoiding-rounding-issues , https://en.wikipedia.org/wiki/cholesky_decomposition , more specificially "when has real entries, l has real entries , factorization may written a = ll^t ". now outputs corresponds entries of l matrix , generate covariance matrix multiplying transpose. however, still have error not positive definite matrix. how possible? i found matrix produces error, see print l.shape print sigma.shape s = sigma[1,18,:,:] # matrix gives error l_ = l[1,18,:,:] print l_ s = np.dot(l_,np.transpose(l_)) print s chol = np.linalg.cholesky(s) gives output: (3, 20, 2, 2) (3, 20, 2, 2) [[ -1.69684255e+00 0.00000000e+00] [ -1.50235415e+00 1...

javascript - How do I stop JSP page from executing the servlet? -

this question has answer here: preventing form submission when validation fails 3 answers i trying make simple web app. should take inputs, validate them , store in database or display error. i'm having problem while validating form through external javascript. if field empty, checking done jsp directs control servlet. need stop jsp page further going forward. please help! here code: jsp: <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>welcome</title> <script type="text/javascript" src=...

installation - Can't install CDH 5.0, Hangs at 40% -

i can't seem install cdh 5.0, i'm running binary installer. when run binary installer cdh 5.0, gets 40% of way through , hangs, have waited 45 minutes before , makes no progress. @ 40% installer screen says "cloudera-manager-installer". can please tell me how fix this? finally works. hang @ 40% normal. passes after

ios - How to add bottom constraint? -

Image
i using xcode 8.i add uiview in bottom.i see perfect in storyboard. but when run in simulator doesn't perfect. don't know problem is. i'm not sure if understood question correctly, in xcode add constraints ctrl+click+drag view needs constraint other view (or layout margins). may this: ctrl+click+drag on size inspector (on left side) should see constraints, example this: example size inspector 4 constraints defined this can edit properties of constraints.

matlab - Read multi format data in Octave -

i have started learning octave , trying read csv file comprising of data in form of string, integer , float. example shown below a,b,c,d 1,c,10,1234.2 e,2,4,5 i tried lot using csvread . of examples below: [val1, val2, val3, val4] = csvread('input.csv', '%s %s %s %s'); but getting error error: dlmread: error parsing range then using question , made use of textread function shown below: [val1, val2, val3, val4] = textread('input.csv', '%s %s %s %s', 'delimiter', ','); i able read data now, when print values, getting address of values shown below. val1 = { [1,1] = [2,1] = 1 [3,1] = e } please can me in 1) finding out wrong in csvread . 2) why textread function returning addresses. how avoid them? thanks in advance help. the use of dlmread, cause of error, can found in answer . note that x = csvread (filename, dlm_opts) is equivalent to x = dlmread (filename, "," , …) the item...

python 3.x - Passing Scrapy response URL to Selenium and then Selenium response back to Scrapy -

how pass scrapy response url selenium , selenium response scrapy i have scrapy spider first.py : # -*- coding: utf-8 -*- import scrapy import re import json class firstspider(scrapy.spider): name = "first" allowed_domains = ["someautosite.co.uk"] start_urls = ( 'http://www.someautosite.co.uk/some_specific_search_results', ) def parse(self, response): car_url in response.xpath('//article[contains(@class, "standard")]/div/div[2]/div[1]/h1/a/@href').extract(): absoluteurl = response.urljoin(car_url) # yield {'url': absoluteurl} yield scrapy.request(absoluteurl, callback=self.parse_car) def parse_car(self, response): pattern = re.compile(r"var utag_data = ({.*?});", re.multiline | re.dotall) utag_data = response.xpath('//script[contains(.,"var utag")]/text()').re(pattern)[0] utag_data_obj = json.lo...