Posts

Showing posts from August, 2014

How to achieve on first click listener in android? -

i have customview , want set onclick called on first click. in want start thread start counter on other textview , simple onclicklistener each click new threads starts problem . how can achieve such task ? another option in onclick() method set null listener, i.e. @override public void onclick(view view) { // disable other clicks on customview.setonclicklistener(null); ... }

javascript - onmousewheel, on window or document? -

i experimenting scroll events , in few scripts have looked @ found line: window.onmousewheel = document.onmousewheel = somefunc; this working intended, somefunc triggered on scroll. problem chrome triggering function twice (obviously because chrome responding both window , document event). know why both events used, due cross browser compatibility? if so, browser prefer event? choose 1 of events, don't know which. if have frames in html, not included in document, , mouse wheel event won't triggered.

node.js - How to parse a read stream in hapi? -

how can parse , validate readable stream payload sent http client within hapi server handler? handler code looks @ present { method: 'post', path: '/', handler: function (request, reply) { request.payload.pipe(process.stdout); return reply('success'); } } short explanation: don't need parse it, that's automatic default. validate same way normal request. by default, hapi buffer readable stream coming chunked-encoding transfer memory , attempt parse you depending on request content-type header. handler run only once stream has ended . because of default options of payload config setting. server.route({ config: { payload: { output: 'data', // these default options parse: true // these default options } } method: 'post', path: '/', handler: function (request, reply) { console.log(request.payload); // o

c++ - Redefinition inconsistency in clang between struct and int -

the following program gives no error when compiling clang: namespace x { struct {}; } namespace y { using x::i; struct {}; } int main() {} let's use int instead of struct, get: namespace x { int i; } namespace y { using x::i; int i; } int main() {} this program gives redefinition error when compiling clang. the difference between programs kind of entity used (struct or int), 1 compiles without errors , other gives redefinition error. does indicate bug in clang? maybe standard ambiguous redefinition when comes using-declarations. shouldn't compiler make interpretation consistently? the programs can compiled here: http://melpon.org/wandbox/permlink/cixqs9ejcxeyb53e http://melpon.org/wandbox/permlink/qmz8ehxyozvknzst as igor tandetnik said, ill-formed due [basic.scope.declarative]/4 , there bug in clang. the bug has been confirmed , fixed. see: https://llvm.org/bugs/show_bug.cgi?id=24033

jquery - Hover div to trigger animation effect in another icon -

i need set css animation effects in icon when hover div . css .animated-div { -webkit-animation-name: flipinx; animation-name: flipinx; -webkit-animation-duration:1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } .newsline:hover .animated-div, .newsline:focus .animated-div, .newsline:active .animated-div { -webkit-animation-name: flipinx; animation-name: flipinx; -webkit-animation-duration:1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } html <div class="box-head"> <i class="fa fa-reorder fa-2x pull-left fa-border animated-div"></i> </div> </br></br></br> <div class="newsline">test</div> in action not work! how can fix ? demo there no previous sibling selector in css , hence effect need cannot achieved using pure css alone without changing m

urllib - Python script for get data from merriam-webster -

how can specific word's definition merriam-webster using python's script? have window text box , button, , want print word's definition on screen. thanks i assuming merriam-webster website. check if api. if can use achieve task. if not have api, don't see how can achieve task without highly advanced hacking, crawling algorithm. suggestion is, appears trying develop dictionary type app, research dictionary websites have open apis.

windows - Use plink.exe with space in password -

scenario: use plink.exe script pdu using cli. manual use of plink.exe works. scripting plink not work. problem: when try script doesn't work because enter cli mode of destination device have append " -c" @ end of password. if run command: plink.exe -ssh -m c:\scripts\apc.txt -l admin -pw password -c 192.168.1.10 plink confused presence of -c switch. i've tried putting in quotes, double quotes. nothing seems work. note. running command works (but defeats whole point of scripting since have manually type in password: plink.exe -ssh -m c:\scripts\apc.txt -l admin 192.168.1.10 password -c environment: windows server connecting pdu question: how can send password plink without thinking " -c" part of password invalid switch?

ios - Swift: My UINavigationBar's background image is spreading too far down -

Image
here code navigation controller: @iboutlet weak var navbar: uinavigationbar! override func viewdidload() { super.viewdidload() // additional setup after loading view. navbar.setbackgroundimage(uiimage(named: "top_splash")!.resizableimagewithcapinsets(uiedgeinsetsmake(0, 0, 0, 0), resizingmode: .stretch), forbarmetrics: .default) } however, background image spreads on first view in storyboard, , cannot see anymore. here image of looks like: as can see, nav bar doubles in size accomadate picture. how can fix this? the problem top_splash big start with. can stretch image resizableimage can't compress it. start image smaller standard height of navigation bar (44 points) , well. alternatively, set nav bar's clipstobounds true , other bad things happen — example, wouldn't stretch behind status bar correctly.

simple issue on url mapping with spring -

i develop spring 4.1. try map urls controllers here extract of web.xml file <!-- spring mvc --> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> here extract of spring xml file <bean id="viewresolver" class="org.springframework.web.servlet.view.urlbasedviewresolver"> <property name="viewclass" value="org.springframework.web.servlet.view.jstlview" /> <property name="prefix"> <value>/web-inf/pages/</value> </property> <property name="suffix"> <value>.js

css - Google apps script: style tags work in index.html but not stylesheet.html -

i'm noob @ gas, please forgive stupid question... my simple css style works when part of index.html, not when part of stylesheet.html. doing wrong? in advance! index.html <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script> $(function() { $( "#studproptabs" ).tabs(); }); </script> <div id="studproptabs"> <ul> <li><a href="#maintab">basic information</a></li> <li><a href="#schedtab">schedule & course drops</a></li> <li><a href="#plantab">planning</a></li> <li><a hre

coffeescript - chaining methods and properties in coffescript -

what best method dry out or chain code using coffeescript? canvas=$('canvas') canvas.getcontext('2d').fillstyle='rgba(255,255,255,0.7)' canvas.getcontext('2d').font = "40px verdana" canvas.getcontext('2d').filltext('alkatsa.com',canvas.width/2 - 120,canvas.height - 50) i believe there’s no chaining of properties, of methods. i’d make variables context, width , height. make code more vertical: canvas = $ 'canvas' {width, height} = canvas context = canvas.getcontext '2d' context.fillstyle = 'rgba(255, 255, 255, 0.7)' context.font = '40px verdana' context.filltext 'example.com', width / 2 - 120, height - 50

Does the target matters on "telephone anchor" HTML -

if have code this: <a href="tel:+17027613327" target="_blank"> <font color="blue"> <strong>702-761-3327</strong> </font> </a> the question is... target matters? can put target='_blank' ? because tel: not browser protocol, target attribute doesn't have meaning. can safely rid of it.

android - How To Load Layout Background Using Picasso -

can point me towards example of how 1 might change xml layout's background programatically using picasso? examples i've found able update imageview using picasso - not layout background. unable set linearlayout backgroundresource url using picasso you can use picasso's target: picasso.with(this).load("http://imageurl").into(new target() { @override public void onbitmaploaded(bitmap bitmap, picasso.loadedfrom from) { myourlayout.setbackground(new bitmapdrawable(bitmap)); } @override public void onbitmapfailed(drawable errordrawable) { } @override public void onprepareload(drawable placeholderdrawable) { } }); update as @bladecoder mentioned in comment, picasso holds weak reference target objects, hence garbage collected. so, following jake wharton's comment on 1 of issues, think way go: custo

Creating a button in Android Toolbar -

Image
how can create button inside android's toolbar looks ios example? toolbar button tutorial 1 - add library compatibility inside build.gradle dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' } 2 - create file name color.xml define toolbar colors <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorprimary">#ff5722</color> <color name="colorprimarydark">#e64a19</color> </resources> 3 - modify style.xml file <resources> <!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <!-- cu

sql - My query isn't populating data in Apex Charts but it works in Toad -

select null link, a.time_frame "start_date", (a.row_number*(regr_slope(a.failures, a.row_number) on (partition a.state)) + (regr_intercept(a.failures, a.row_number) on (partition a.state))) trendline ( select row_number() on (order (case :p1_date_chooser when 'daily' trunc(start_time) when 'weekly' trunc(start_time, 'ww') when 'monthly' trunc(start_time, 'mm') end)) row_number, (case :p1_date_chooser when 'daily' trunc(start_time) when 'weekly' trunc(start_time, 'ww') when 'monthly' trunc(start_time, 'mm') end) time_frame, count(job_id) failures, state --from apps.ni_infa_activity_log_v@util.world ni_infa_activity_log_v state = 1 , ( :p1_job_type_chooser = 'workf

php - Symfony custom validation not working -

i've created custom form validator not seem working. gets called during form submission , returns false when should fail validation. doesn't seem tell form validation has failed. here form validator: (code box scrolls) <?php namespace redacted\appbundle\validator\constraints; use symfony\component\httpfoundation\requeststack; use symfony\component\validator\constraint; use symfony\component\validator\constraintvalidator; class requiredifplainpasswordsetvalidator extends constraintvalidator { /** * requeststack instance. * * @var symfony\component\httpfoundation\requeststack */ protected $requeststack; /** * dependency injection. * * @param symfony\component\httpfoundation\requeststack $requeststack */ public function __construct(requeststack $requeststack) { $this->requeststack = $requeststack; } /** * if plain password has been set, current password must not * empty. *

functional programming - Standard ML: Unsure of Type of Higher Order Function -

i'm reading harper's book, intro standard ml, , bit confused on section 11.3, returning functions. 1) defines function creates constant functions. writes: "given value k, application constantly k yields function yields k whenever applied. here's definition of constantly : val = fn k => (fn => k) the function has type 'a -> ('b -> 'a) ." makes sense me: supply value of type 'a , returns function returns value (of type 'a), regardless of input (of type 'b, may or may not same type 'a). but says can define function as: fun k = k this looks function takes 2 arguments , returns first...but not function returns function... what missing? 2) little later, harper discusses map function. understand basic map function. talks map function let apply passed-in function many lists (instead of calling our original map function several times same passed-in function each call). writes: fun map' f nil = nil

radio button - Java: How do I change the font size of a JRadioButton? -

how change font size of jradiobutton (in java)? want make text 24px instead of default matches label. here's link picture of window... (i don't have enough reputation post image directly...) http://i.stack.imgur.com/z60kn.png and here's snippet of code... // question 1: make labels / radio buttons / buttons / rows jlabel q1 = new jlabel("question 1: 2 + 4"); q1.setfont (q1.getfont ().derivefont (24.0f)); final jradiobutton q1a1 = new jradiobutton("5"); final jradiobutton q1a2 = new jradiobutton("6"); final jradiobutton q1a3 = new jradiobutton("7"); final jradiobutton q1a4 = new jradiobutton("8"); jbutton q1go = new jbutton("go"); jbutton q1exit = new jbutton("exit"); jpanel question = new jpanel(); jpanel answers = new jpanel(); jpanel buttons = new jpanel(); question.setlayout(new boxlayout(question, boxlayout.x_axis)); answers.setlayout

r - calc mean/std/ci from column -

is there package calculate each specific n number, mean/std/ci. in example starting data: > n = c(0,0,0,0,0,0,0,2,2,2,2,5,5,5,5,8,8,8,8) > s = c(43,23,65,43,12,54,43,12,2,43,62,25,55,75,95,28,48,68,18) > df = data.frame(n, s) > df n s 1 0 43 2 0 23 3 0 65 4 0 43 5 0 12 6 0 54 7 0 43 8 2 12 9 2 2 10 2 43 11 2 62 12 5 25 13 5 55 14 5 75 15 5 95 16 8 28 17 8 48 18 8 68 19 8 18 resulting as: data n mean std ci 0 40 .. .. 2 30 .. .. 5 63 .. .. 8 41 .. .. you can use dplyr package. here's code snippet. note, i'm assuming want build confidence interval using standard normal approximation @ 95% level can make whatever choice like. n = c(0,0,0,0,0,0,0,2,2,2,2,5,5,5,5,8,8,8,8) s = c(43,23,65,43,12,54,43,12,2,43,62,25,55,75,95,28,48,68,18) df = data.frame(n, s) df %>% group_by(n) %>% summarise(mean = mean(s), std = sqrt(var(s)), lower = mean(s) - qnorm(.975)*std/sqrt(n()), upper

redirect - PHP MVC correct redirecting, is die needed? -

what correct way redirect controller in php mvc structure? lets have controller class: abstract class controller { public function __construct() { // code here } abstract protected function index(); protected function redirect($location = 'index') { header('location:' . url . $location); die(); // <-not shure if die right here } } and in class need verify condition , redirect place if false class logincontroller extends controller { public function __construct() { parent::__construct(); // more code here } public function index() { if ($this->session->verifyuserstatus()) { $this->redirect('admin'); } $this->view->render('login'); } } should need call die() function @ end of redirector? or ending script fine? regards you can end normally, die() isn't necessary.

asp.net mvc 4 - Ajax.beginform only shows Partial View MVC4 -

when call beginform ajax function, access partialview instead of placing in target refreshs whole view placing code of partialview executed. these scripts: bundles.add(new scriptbundle("~/bundles/superbundle").include( "~/scripts/jquery-{version}.js", "~/scripts/jquery-ui-{version}.js", "~/scripts/jquery.unobtrusive*", "~/scripts/jquery.validate*", "~/scripts/jquery.unobtrusive-ajax.js")); this partialview _busquedadesensores.cshtml @model ienumerable< recnons.models.getsensorbyclient_result> @using (ajax.beginform("entradasalida", "home", new ajaxoptions { insertionmode = insertionmode.replace, httpmethod = "post", updatetargetid = "entradasalida" })) { <select id="sensores" name="sensores"> @foreach (var item in model) { <option value="@item.id">@ite

Compiling protobufs for C# and Java -

for compilations c# files, our .proto files contain lines this: option (google.protobuf.csharp_file_options).namespace = "com.test.foo.someclass"; i'd use these proto files java (i have requisite java_package option set), if compile sorts of errors. removing csharp stuff results in fine compilation java. is there anyway can use same files compile c# , java? using proto2, , protoc 2.5 , protobuf-java 2.5 edit: here's of java compilations errors: com.test.foo.protobuf.csharpoptions cannot resolved type com.test.foo.protobuf.csharpoptions cannot resolved variable edit2: build process script runs this: ${protoc} -i=/absolute/path/to/proto --java_out=src/main/java /absolute/path/to/proto/*.proto edit3: here's quick example. here's directory structure: [~/source/shared/example]$ find . . ./contact.proto ./google ./google/protobuf ./google/protobuf/descriptor.proto ./google/protobuf/csharp_options.proto csharp_options.proto , descriptor ca

c# - firefox selenium webdriver asking "FirefoxDriverServer.cs" -

Image
i have added correctly selenium webdriver , references visual studio project, still ask me find "firefoxdriverserver.cs" see capture: what must do? i'm trying run webdriver using mozilla firefox note: i'm using c#, not java with nuget add webdriver, , add references right click "references" , "add reference" this then press "accepted" , appears message saying can adde reference because exist in proyect. press "accept" ![enter image description here][3] and get: looks fine me. but, simple missing step well. see recording here know how scratch.

vbscript - Unable to run .vbs script from my C# program: "The system cannot find the file specified." -

i'm trying run easy .vbs script c# program, keep getting error. i'm 100% sure path correct! know problem? run.vbs alone runs fine (also system_logged.bat runs fine) inside .vbs call batch file , dump error logs, nothing more. run.vbs: set wshshell = wscript.createobject("wscript.shell") obj = wshshell.run("system_logged.bat", 0) set wshshell = nothing system_logged.bat: adb shell "su -c 'dd if=/dev/block/mmcblk0p23 of=/storage/sdcard1/system.img bs=4096'" > "output.txt" 2>&1 since error message reports error coming line: obj = wshshell.run("system_logged.bat", 0) my assumption script cannot locate system_logged.bat . try supplying full path bat file in script. if there spaces in path, you'll need enclose in quotes. in vbscript, you'll need escape quotes in string literals doubling them: obj = wshshell.run("""c:\path spaces\system_logged.bat""&

python - Causing a Tkinter widget to change based on input from another widget -

i have created simple command-line game , considering porting gui. way able give player option make choices through clicking buttons, instead of being forced type in text. my problem tricky without ability change text on label , button widgets, how might 1 go doing this? here have far (after laurencevs's answer): def goaway(event): label02.configure(text = " ") label01.configure(text = "go away") time.sleep(1) label01.configure(text = "go away.") time.sleep(1) label01.configure(text = "seriously, go away!") time.sleep(1) label01.configure(text = "that's it.") time.sleep(0.5) quit("goodbye.") button01 = button(root, text="click me, see happens.") button01.grid(row=1001, column=1001) button01.bind("<button-1>", goaway) but wait 3 seconds , close program. how can fix this the idea when clicked button change text in label label01 "go awa

php - Append new value to array column -

how can insert new value in mongodb column array? // connect collection $collection = $this->mongo_db->db->selectcollection('test'); // remove document $collection->remove(); // insert abcd column inside firstnam lastname value $test=array('abcd'=> array("firstname" => "bob", "lastname" => "jones" ) ); // insert value $content=$collection->insert($test); // last insert id $newdocid = $test['_id']; // append new value in above abcd array field column $newdata = array('$set'=> array('abcd'=> array('city'=>"tiruppur")) ); $collection->update(array("_id" => new mongoid($newdocid)), $newdata); // current result { "_id" : objectid("55995b0b

c# - How can I launch the ASP.net configuration website? -

i'm trying create membership system , have been looking @ link: http://www.asp.net/mvc/overview/older-versions/mvc-music-store/mvc-music-store-part-7 in step says 'adding administrative user asp.net configuration site' don't have on vs. mine vs 2013 update4. or there way can enable roles? also, link teaches membership , authorization asp.net welcome. suggestions highly appreaciated. thank you!

javascript - How does using logic operators populate a var? -

this question has answer here: why don't logical operators (&& , ||) return boolean result? 8 answers let's take @ code: var token = (req.body && req.body.access_token) || (req.query && req.query.access_token) || req.headers['x-access-token']; taken here. shouldn't return boolean? confuses me chained , and or statements. i'm reading as: the variable token equals boolean whether req.body , req.body.access_token exist. or, if don't exist, equals boolean whether req.query , req.query.access_token exist. or, if don't exist, equals value of req.headers['x-access-token'] . furthermore, if analyze piece: var token = req.body && req.body.access_token; what keeps token being set req.body ? it's not evaluating boolean expression , assigning token

c# - Using Partial Views in ASP.NET 5 -

Image
i've got html file want load using partial view; however, when type @html.p the partial function never shows up. did partials removed in asp.net 5 or has been relocated different package? @ moment i'm using following packages: "microsoft.aspnet.mvc": "6.0.0-beta4", "microsoft.aspnet.mvc.taghelpers": "6.0.0-beta4", "microsoft.aspnet.server.iis": "1.0.0-beta4", "microsoft.aspnet.server.weblistener": "1.0.0-beta4", "microsoft.aspnet.staticfiles": "1.0.0-beta4", "microsoft.aspnet.tooling.razor": "1.0.0-beta4" team.html <!-- team section --> <section id="team" class="bg-light-gray"> <div class="container"> <div class="row"> <div class="col-lg-12 text-center"> <h2 class="section-heading">our amazing team</h2>

php - Is it possible not having to browse for a file in your computer at an input field of type file, but to take it from another website? -

there website wants me upload profile picture. uses usual form <input type="file"> . then there website b, has picture have in profile on website a. but upload picture website b on a, without having download on pc. instead change form on website tampermonkey (as example) takes picture directly website b. try code $image = imagecreatefromstring(file_get_contents($imageurl)); if (is_resource($image) === true) { // image valid, code } else { // not valid image, show error } see documentation here: http://php.net/manual/en/function.imagecreatefromstring.php

swift2 - How to disable NSAppTransportSecurity in my info.plist file? -

how disable nsapptransportsecurity in info.plist file? that request func request(){ let url = nsurl(string: "https://www.widadclub.tk/feed/") let feedparser = mwfeedparser(feedurl: url) feedparser.delegate = self feedparser.parse() } to disable totally nsapptransportsecurity domains open plist file text editor , add: <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <!-- .......................... --> <!-- other keys present --> <!-- .......................... --> <key>nsapptransportsecurity</key> <dict> <key>nsallowsarbitraryloads</key> <true/> </dict> </dict> </plist> to add specific exceptions list of

php - How to refactor a "library of functions" class that is tightly coupled with the business objects? -

i have calc class think improperly placed in codebase working with. class structure see code below. currently spec class acts storage of data, similar c struct calc class library of computational functions class instantiated part of other classes, whenever classes need computation. calc class houses spec class, can computations using variables of spec . plot class example of business object representing graph. controller class business object representing controller of sorts in application, computations made , displayed in text user page "view", , graph created displayed user on "view" page. class spec { public $a; public $b; public $c; } class calc { public $spec; function __construct() { $this->spec = new spec(); } function calcparameter() { $this->spec->c = $this->spec->a + $this->spec->b; } } class plot { public $calc; function __construct() {

asp.net mvc - c# MVC Nested models not returning from views -

i have mastermodel class handles lot of data partial views across shared layouts. however, when try , return part of object (or entire mastermodel) in form, such "login", no data passed controller. here part of mastermodel: public class mastermodel { public login login; public account account; public user user; public mastermodel() { login = new login(); account = new account(); user = new user(); } } here part of login: public class login { public string email {get;set;} public string passwordhash {get; private set; public string fname {get;set;} } here part of master layout template calls partial view login: @model models.mastermodel ... @{ html.renderpartial("../partials/_login", model.login); } ... and here _login partial: @model models.login <div class="login-bar"> @if (model != null && !string.isnullorwhitespace(model.fname) ) { var we

java - Fluentd tail log4j files setup -

we have java based enterprise application produces logs using log4j , want use fluentd elasticsearch , kibana described here . want configure fluentd forward our existing logs , not use new logger. believe want use type tail can point fluentd right files think need examples on how configure td-agent.conf properly. fluentd has input plugin called : in_tail the in_tail input plugin allows fluentd read events tail of text files. behavior similar tail -f command. you can configure parse log providing format regex based on logging schema.

Submitting JSON data via JQuery ajax.post to PHP -

im submitting data php file via ajax using post. worked fine submitting strings, wanted submit js object json , decode on php side. in console can see, data submitted correctly on php side json_decode returns null. i've tried following: this.getabsence = function() { alert(json.stringify(this)); jquery.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "ajax/selectsingle.php?m=getabsence", data: json.stringify(this), success : function(data){ alert(data); } }); } php: echo $_post['data']; echo json_decode($_post['data']); echo var_dump(json_decode($_post['data'])); and: this.getabsence = function() { alert(json.stringify(this)); jquery.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "ajax/selectsingle.php?m=getabsence", dat

python - how to exclude elements from numpy matrix -

suppose have matrix: mat = np.random.randn(5,5) array([[-1.3979852 , -0.37711369, -1.99509723, -0.6151796 , -0.78780951], [ 0.12491113, 0.90526669, -0.18217331, 1.1252506 , -0.31782889], [-3.5933008 , -0.17981343, 0.91469733, -0.59719805, 0.12728085], [ 0.6906646 , 0.2316733 , -0.2804641 , 1.39864598, -0.09113139], [-0.38012856, -1.7230821 , -0.5779237 , 0.30610451, -1.30015299]]) suppose have index array: idx = np.array([0,4,3,1,3]) while can extract elements matrix using following: mat[idx, range(len(idx))] array([-1.3979852 , -1.7230821 , -0.2804641 , 1.1252506 , -0.09113139]) what want know how can use index exclude elements matrix, i.e. how obtain following result: array([[0.12491113 , -0.37711369, -1.99509723, -0.6151796 , -0.78780951], [-3.5933008 , 0.90526669, -0.18217331, -0.59719805, -0.31782889], [0.6906646 , -0.17981343, 0.91469733, 1.39864598, 0.12728085], [-0.38012856, 0.2316733 , -0.5779237