Posts

Showing posts from February, 2010

android - How to get softkeyboard height in float window correctly -

here tried measure soft keyboard in full screen mode float window add layoutchangelistener root view this: monlayoutchangelistner = new view.onlayoutchangelistener() { @override public void onlayoutchange(view v, int left, int top, int right, int bottom, int oldleft, int oldtop, int oldright, int oldbottom) { rect r = getframevisiblepart(); if (ismaybekeyboard(r)) { onkeyboardshow(r.bottom, screenheight - r.bottom); } else if (iskeyboardmaybehide(r)) { onkeyboardhide(); } } }; mrootview.addonlayoutchangelistener(monlayoutchangelistner); getframevisiblepart: private rect getframevisiblepart() { rect r = new rect(); mrootview.getwindowvisibledisplayframe(r); return r; } and here window params: context context = app.getinstance(); windowmanager.layoutparams params = new windowmanager.layoutparams(); if (build.version.sdk_int >= 19) {

Simple lock free stack in Java -

i implemented lock free stack follows: import java.util.concurrent.atomic.atomicreference; /** * @author shuang.gao date: 2017/4/6 time: 14:39 */ public class stack<e> { private atomicreference<node<e>> head; public stack() { head = new atomicreference<>(); } public void push(e e) { node<e> node = new node<>(); node.item = e; (;;) { node<e> headnode = head.get(); node.next = headnode; if (head.compareandset(headnode, node)) { system.out.println("push: " + e); break; } } } public e pop() { node<e> headnode; (;;) { headnode = head.get(); if (headnode == null) { system.out.println("pop: null"); return null; } if (head.compareandset(headnode, headnode.next)) {

mysql - Every derived table must have its own alias Error? -

why following sub routine throws every derived table must have own alias error? sub ok_wait { $str= shift; $dbh = &connect or die "cannot connect sql server \n"; $dbh->do("use $str;"); $stmt="select name,jobs_ok,jobs_wait (select name,jobs_ok,jobs_wait files order name limit 5) t union select 'others',sum(jobs_wait)as jobs_wait,sum(jobs_ok)as jobs_ok from(select jobs_wait,jobs_ok files order name limit -1 offset 5) t;"; $sth = $dbh->prepare( $stmt ); $sth->execute() or die $sth->errstr; $tmp = 0; while(my @row_array=$sth->fetchrow_array) { if ($tmp == 0) { $var_ok .= "\[\"$row_array[0] \($row_array[2]\)\",$row_array[2]\]"; $var_wait .= "\[\"$row_array[0] \($row_array[1]\)\",$row_array[1]\]"; $tmp++; } $sth->finish; $dbh->disconnect(); } changed limit value "select name,jobs_ok,jobs_wait ((select name,jobs_ok,jobs_wait files order name limit 5) union (select 

optimization - Does K-fold I-sum of a mxn matrix totally unimodular? -

how show whether k-fold i-sum of mxn matrix totally unimodular or not. here matrix: i i ... 0 0 ... 0 0 0 ... 0 0 0 ... 0 0...0 a...0 ........a.0 0 0 0 ... here, i nxn identity matrix. a mxn matrix.

node.js - Accessing NODE_ENV environment variable in React on Rails -

i've got react on rails application hits api. want configure api endpoint localhost development , deployed app's url production. client/package.json "scripts": { "build:production": "node_env=production webpack --config webpack.config.js", }, client/webpack.config.js const devbuild = process.env.node_env !== 'production'; const config = { entry: [ 'es5-shim/es5-shim', 'es5-shim/es5-sham', 'babel-polyfill', './app/bundles/main/startup/registration', ], output: { filename: 'webpack-bundle.js', path: __dirname + '/../app/assets/webpack', }, resolve: { extensions: ['.js', '.jsx'], }, plugins: [ new webpack.environmentplugin({ node_env: 'development' }), ] } i see process.env.node_env available in config/webpack.config.js (used here add source map devtools module exports), i'd way see environment in

python - How to calculate average days between events by category 1 and category 2 -

i have table of shoplifting events store , product. i'm trying use python calculate average number of days between shoplifting events product. table looks this: product store shoplifting date times shoplifted 1 8/28/2016 6 2 8/28/2016 6 3 8/28/2016 6 2 b 8/22/2016 3 1 b 8/22/2016 3 3 b 8/22/2016 3 1 c 8/18/2016 2 3 c 8/18/2016 2 4 c 8/18/2016 2 1 8/18/2016 5 3 8/18/2016 5 1 b 8/16/2016 2 1 8/14/2016 4 4 c 8/13/2016 1 3 8/12/2016 4 2 8/12/2016 4 product 1 stolen store on 8/28, 8/18, , 8/14 (10 days , 4 days between thefts) , store b on 8/22 , 8/16 (8 days), average of (10 + 4 + 8) / 3 = 7.33 days. product 1 expected results be: product

wordpress - how to clear woocommerce checkout fields after place order? -

how clear chekcout fields in woocommerce after placing order, when registered customer makes his/her next order, he/she has fill fields again? just need add single line in child theme's functions.php add_filter('woocommerce_checkout_get_value','__return_empty_string',10);

c# - How Do I Set Z-Index in an ItemsControl with a Data Binding? -

there several answers none of them work uwp, wpf. have custom itemscontrol dynamically places children in unusual pattern based on properties within child's respective view model. items partially overlap , need ensure selected item not hidden beneath other items. cannot figure out how bind value grid's z-index. <itemscontrol name="myitemscontrol" itemssource="{x:bind pageviewmodel.mycollectionofmyviewmodel}" rendertransformorigin="0.5,0.5" > <itemscontrol.rendertransform> <compositetransform x:name="mytransform" /> </itemscontrol.rendertransform> <itemscontrol.itemspanel> <itemspaneltemplate> <grid /> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate x:datatype="viewmodel:myviewmodel"> <grid name="itemgrid" canvas.zindex="{x:bind selecte

java - Generic Map with Lists of Comparable -

i want map several lists, each of them composed of comparable objects, not same, there might list of doubles , list of strings , etc... map<string, list<comparable<?>>> unfortunately map defined above not useful because elements in each list can't compared. therefore had cheat , introduce type parameter class: class myclass<t extends comparable<? super t>> { map<string, list<t>> mymap; } this not totally correct because not lists of same type. works, thing have do type cast t when add double list of doubles or string list of strings. make sure each type gets added lists of correct type. is there better way solve problem? the alternative have 1 map every type of list . make code uglier , thing lists sort them , insert them db string values, therefore call tostring on comparables. you can use list<object> make generic , purpose. might want instance of checks specific datatypes inside list. m

windows - unable to get graphical view in key policy section of encryption key using aws kms CLI -

i created key on aws kms using cli. there used default key policy. then, using put-key-policy attached new key policy includes key administrators , key users. gets updated. but, not showing graphical version in shows key administrators , key users. also, not getting option switch default view or switch policy view. cli command used given here. aws kms create-key --description !description! --key-usage encrypt_decrypt --origin aws_kms --no-bypass-policy-lockout-safety-check --tags tagkey=tagkeyname,tagvalue=value what can done resolve this(getting graphical view of key policy)?

performance - Getting Can't find common super class of [com/loopj/android/http/MySSLSocketFactory] after enabling Pro-guard -

after enabling pro-guard, receiving around 1000 warnings. after adding rules , following this , this answers on stackoverflow, receiving 1 warning , 1 error. this getting now. warning:exception while processing task java.io.ioexception: java.lang.illegalargumentexception: can't find common super class of [com/loopj/android/http/mysslsocketfactory] (with 1 known super classes) , [java/security/keystore] (with 2 known super classes) error:execution failed task ':app:transformclassesandresourceswithproguardforrelease'. java.io.ioexception: java.lang.illegalargumentexception: can't find common super class of [com/loopj/android/http/mysslsocketfactory] (with 1 known super classes) , [java/security/keystore] (with 2 known super classes) proguard-rules.pro -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dump class_files.txt -prints

javascript - Is there a way to avoid browser repainting when using js function document.appendchild? -

i read document.appendchild() way move dom's elements because keep them in memory, checking browser, noticed moved elements repainting. there way avoid this? maybe not using appendchild function allow move elements without repainting them? the best solution i've found using transform: translate, not i'm looking for, move element around on screen, not change position in dom. in general, best approach repainting not away it, handle grace. the ultimate goal limit changes dom as possible, seems goal. in terms of moving element, depends upon element, want ensure few things how add element. establish destination element won't require page reflow. if can before move element, in better shape. ensure actual changes dom contained, , animations done in bulk via css whenever possible. sounds handling through translate, lower-impact since doesn't change dom. to accomplish goal of moving element new place in dom, after translate element new location, shoul

javascript - Clicking a button with same value in socket.io -

i stuck problem many day , havent found solution can 1 me solve please. have 2 buttons in client page shown here listen server on port 3000. button gets values html form, different clients have different values. @ present able click buttons based on id if 1 client clicks button id sq1 button same id gets clicked automatically. want when click button value 1 button same value show clicked automatically app.js const io = require('socket.io')(3000); io.on('connection', function (socket) { console.log('a client has connected'); socket.on('clicked', function() { io.emit('clicked'); }); socket.on('clicked1', function() { io.emit('clicked1'); }); }); console.log('socket.io server started @ port 3000'); button.html <!doctype html> <html> <head> <title>testing socket.io</title> <style>.tictac{ width:100px;height:100px;

c++ - Knapsack Backtracking Using only O(W) space -

so have code have written correctly finds optimal value knapsack problem. int mat[2][size + 1]; memset(mat, 0, sizeof(mat)); int = 0; while(i < nitems) { int j = 0; if(i % 2 != 0) { while(++j <= size) { if(weights[i] <= j) mat[1][j] = max(values[i] + mat[0][j - weights[i]], mat[0][j]); else mat[1][j] = mat[0][j]; } } else { while(++j <= size) { if(weights[i] <= j) mat[0][j] = max(values[i] + mat[1][j - weights[i]], mat[1][j]); else mat[0][j] = mat[1][j]; } } i++; } int val = (nitems % 2 != 0)? mat[0][size] : mat[1][size]; cout << val << endl; return 0; this part udnerstand. trying keep same memory space, i.e. o(w), compute optimal solution using backtracking. finding trouble. hints have been given this now suppose want optimal set of items. recall goal in finding

php - How to solve Fatal error: Class 'MongoClient' not found? -

i using windows 10 64 bit, xampp 3.2.2, php 5.6.30, php extension build vc11, mongodb server version: 3.4.3. i getting error "fatal error: class 'mongoclient' not found in d:\xampp\htdocs\test\test1.php on line 4". here code using code <?php // connect $m = new mongoclient(); // select database $db = $m->cabin; // select collection (analogous relational database's table) $collection = $db->user; // find in collection $cursor = $collection->find(); // iterate through results foreach ($cursor $document) { echo $document["title"] . "\n"; } ?> i have added dll file in folder (d:\xampp\php\ext) , added extension in php.ini (d:\xampp\php) "extension=php_mongodb.dll". issue not solved. mongodb (mongo db working) user@desktop-jcdjq65 mingw64 /d $ mongo mongodb shell version v3.4.3 connecting to: mongodb://127.0.0.1:27017 mongodb server version: 3.4.3 use cabin switched db cabin show tables bmessa

android - Checking State before calling activity.getSupportFragmentManager().popBackStackImmediate()? -

sometimes calling activity.getsupportfragmentmanager().popbackstackimmediate() results in error in particular: fatal exception: java.lang.illegalstateexception: can not perform action after onsaveinstancestate what check prevent error occurring? enough check !activity.isfinishing() or should 1 check activity not stopped?

java - Smtp server issue starttls command to sslsocket but when startHandshake() read time out -

public static socket createssl(socket socket) throws ioexception { sslsocketfactory factory = (sslsocketfactory) sslsocketfactory.getdefault(); sslsocket sslsocket = (sslsocket) (factory.createsocket(socket, socket .getinetaddress().gethostaddress(), socket.getport(), true)); sslsocket.setuseclientmode(false); sslsocket.starthandshake(); return sslsocket; } the sslsocket read time out when sslsocket.starthandshake(), should solve problem?

haskell - How to read the bind operator ">>=" in words? -

when reading code, able form sentences in head. example, x <- getchar "x slurps getchar". or a . b "b applied a". but when comes monadic bind operator f >>= g , leave mental gap in sentence in head, because don't know how read it. thought "f binds g", feels wrong. suggestions have? the proposed duplicate link contains nice answers other operators, bind operator answers "bind". however, "f bind g" doesn't seem meaningful me. i suggest thinking of word 'bind' in sense of 'attach': binding g f means attaching monadic action g monad f . flesh out bit, think of f , monad, computation which, when run, return value (call value x ). binding monadic action g monad f expresses new computation in monadic action g attached monad f , in sense result ( x ) of monadic computation f passed along argument action g , in turn returns new (monadic) computation.

database - SQL Server query involving subqueries - performance issues -

i have 3 tables: table 1: | dbo.pc_a21a22 | batchnbr other columns... -------- ---------------- 12345 12346 12347 table 2: | dbo.outcome | passageid record ---------- --------- 00003 200 00003 9 00004 7 table 3: | dbo.passage | passageid passagetime batchnbr ---------- ------------- --------- 00001 2015.01.01 12345 00002 2016.01.01 12345 00003 2017.01.01 12345 00004 2018.01.01 12346 what want do: each batchnbr in table 1 first latest passagetime , corresponding passageid table 3. passageid, relevant rows in table 2 , establish whether of these rows contains record 200. per passageid there @ 2 records in table 2 what ef

python - window error: [Error 3] The system cannot find the path specified: '.prank/*.* is shown -

my prankheader.py import os def removenumber(str): no_digit = [] char in str: if not char.isdigit(): no_digit.append(char) return no_digit def renamefiles(): saved_file = os.getcwd() os.chdir("./prank") # 1. loop through files in directory files in os.listdir("./prank"): # 2. if file has number, delete. newfile = removenumber(files) # 3. make list of char string newfile = ''.join(newfile) os.rename(files, newfile) os.chdir(saved_file) and prank.py import prankheader prankheader.renamefiles() both files in folder c:/users/myname/desktop/localserver/prank, , filder has folder, prank, contains pictures. when tried implement program showed me "window error: [error 3] system cannot find path specified: '.prank/ . ' is there knows why have error? if change following line for files in os.listdir("./prank"): to for

python - Can't find lpython2.7 -

/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lpython2.7 collect2: error: ld returned 1 exit status i working on cygwin , trying install sentry , encountered error? can tell why running problem, problem related python-dev package ? also how install python-dev on cygwin if required ? to search package containing file can use cygcheck or https://cygwin.com/packages/ using cygcheck in case: $ cygcheck -p libpython2.7.dll.a found 3 matches libpython2.7.dll.a python-devel-2.7.12-1 - python-devel: python language interpreter (installed binaries , support files) python-2.7.10-1 - python: python language interpreter (installed binaries , support files) python2-devel-2.7.13-1 - python2-devel: python 2 language interpreter so need install cygwin setup python2-devel package last version right file. not use pip install packages available cygwin setup

arraylist - Casting list of objects to list of maps in java -

this question has answer here: java: how convert list map 13 answers i'm having list of objects this. [ [ "abhay pawde", "development" ], [ "dinesh", null ] ] i want convert them list of maps example mentioned below: [ [ "name":"abhay pawde", "dept":"development" ], [ "name":"dinesh", "dept":null ] ] how achieve in java ? i'm not sure if there other solution mentioned here. please let me know. list of objects obtained after querying database. you could collect map using jdk-8 features, like: yourlist.stream() .map(collectors.tomap(yourobject::getname, yourobject::getdepartment))

Virtual inheritance in C++, size of the grand child's object is heavy? -

this question has answer here: multiple inheritance : size of class virtual pointers? 4 answers i not explaining diamond problem in c++. know problem can solved using virtual inheritance. query had size of grandchild's object created heavier object created without virtual inheritance. let's consider below example better understanding #include<iostream> using namespace std; class base { }; class child1 : virtual public base { }; class child2 : virtual public base { }; class gchild : public child1, public child2 { }; int main() { gchild g; cout<<sizeof(g)<<endl; return 0; } sizeof g in above program 16 bytes, below program without virtual inheritance gives size 2 bytes #include<iostream> using namespace std; class base { }; class child1 : public base { }; class child2 : public base { }; class gchild : p

javascript - how to deal with this round off error -

Image
when did simple arithmetic in javascript, there thing kind of round off error. don't want this, don't know how deal it. example: 38.8 * 3 => 116.39999999999999 use this function multiply (a, b) { exp = b.tostring().length - 2; function makeint (num) { return num * math.pow(10, exp); } function makefloat(num) { return num / math.pow(100, exp); } return makefloat(makeint(a) * makeint(b)); } var result = multiply(38.8,3) console.log(result); https://jsfiddle.net/v51s34st/

opencart2.x - Opencart- Remove option-label by vqmod instead of CSS -

i remove option text label on front end of website xml. know how so? <div class="option form-group<?php echo ($option['required'] ? ' required' : ''); ?>"> <label class="control-label" for="input-option<?php echo $option['product_option_id']; ?>"><?php echo $option['name']; ?></label> <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['value']; ?>" placeholder="<?php echo $option['name']; ?>" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control" /> </div> i create vqmod file instead of removing css. thanks help! screendump

php - date_add() expects parameter 1 to be DateTime, string given -

i trying fetch current date , add 7 calculate date of weekly installments project. while doing encountered problem:- date_add() expects parameter 1 datetime, string given the line causing me error $loan->nextpremiumdate=date_add(date("y-m-d h:i:sa"),date_interval_create_from_date_string("1 days")); i using laravel framework. , nextpremiumdate column in loan table. in model table declare want "nextpremiumdate" managed date: public class loan extends model { protected $dates = [ "nextpremiumdate" ]; } then laravel return field carbon date , can do: $loan->nextpremiumdate = $loan->nextpremiumdate->adddays(7); you can refer laravel docs or carbon docs more details.

sql - Subquery problems -

i have 2 tables, catch , members. it´s af fishing club website. want make @ list showing name, weight, spiecies. top weight each spiecies, rekord list. 2 tables looks this. members: memberid firstname secondname catch: memberid(fk) spiecies weight this shows name , weight, can´t spiecies shown. select concat(firstname, ' ' ,secondname) 'name', allcatch.rekord members join (select max(weight) 'rekord', memberid catch group memberid) allcatch on allcatch.memberid = members.memberid; -- order allcatch.weight desc try this: select concat(firstname, ' ' ,secondname) 'name', allcatch.rekord, allcatch.spiecies members inner join catch on catch.memberid = members.memberid inner join (select max(weight) 'rekord', spiecies catch group spiecies) allcatch on allcatch.rekord = catch.weight , allcatch.spiecies = catch.spiecies .

c# - Download with chunks. Need to stop page loading in order to start download with Internet Download Manager -

i using following code download huge (around 2 gb) files. view code <a href="/checkdownload/index">download</a> controller-action method code code download file in chunks. public actionresult index() { system.io.stream istream = null; // buffer read 10k bytes in chunk: byte[] buffer = new byte[10000]; int length; long datatoread; //creates whole path clicked file resides. string finalpath = @"e:\builds\sharepoint\fileabc.csv"; string filename = system.io.path.getfilename(finalpath); try { istream = new system.io.filestream(finalpath, system.io.filemode.open, system.io.fileaccess.read, system.io.fileshare.read); // total bytes read: datatoread = istream.length; response.contenttype = "application/octet-stream"; response.addheader("content-di

java - Cannot install apk in one certain phone -

when try install apk on 5 different cellphones, 1 of them panics. other 4 work fine. here error info: android.content.pm.packageparser$packageparserexception: failed adding asset path java.lang.securityexception: getdeviceid: neither user 10071 nor current process has android.permission.read_phone_state here detailed error: 04-07 12:10:06.788 9371-9371/? w/zipro: error opening archive /storage/6365-3066/download/qqmail/iscan-debug.apk: invalid file 04-07 12:10:06.789 9371-9371/? e/packageutil: can not parse packag android.content.pm.packageparser$packageparserexception: failed adding asset path: /storage/6365-3066/download/qqmail/iscan-debug.apk @ android.content.pm.packageparser.loadapkintoassetmanager(packageparser.java:898) @ android.content.pm.packageparser.parsebaseapk(packageparser.java:926)

PHP's cURL URL is being automatically entered in the browser's address bar -

i have code : private function sendtoinfusionsoft($xid, $form_name, $firstname, $lastname, $email) { $url = "https://company-name.infusionsoft.com/app/form/process/{$xid}"; $params = [ 'inf_form_xid'=>$xid, 'inf_form_name'=>$form_name, 'infusionsoft_version'=>'1.62.0.45', 'inf_field_firstname'=>$firstname, 'inf_field_lastname'=>$lastname, 'inf_field_email'=>$email ]; $params = http_build_query($params); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_ssl_verifyhost, false); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_postfields, $params); curl_exec($ch); curl_close($ch); } but wh

matplotlib - Python - Legend overlaps with the pie chart -

Image
using matplotlib in python. legend overlaps pie chart. tried various options "loc" such "best" ,1,2,3... no avail. suggestions how either mention legend position (such giving padding pie chart boundaries) or @ least make sure not overlap? the short answer is: may use plt.legend 's arguments loc , bbox_to_anchor , additionally bbox_transform , mode , position legend in axes or figure. long version: step 1: making sure legend needed. in many cases no legend needed @ , information can inferred context or color directly: if indeed plot cannot live without legend, proceed step 2. step 2: making sure, pie chart needed. in many cases pie charts not best way convey information. if need pie chart unambiguously determined, let's proceed place legend. placing legend plt.legend() has 2 main arguments determine position of legend. important , in sufficient loc argument. e.g. plt.legend(loc="upper left") placed legend

prestashop 1.6 cc avenue integration error -

Image
i trying integrate cc avenue payment gateway prestashop 1.6 shop. giving following error (screen shot attached) when click 'pay cc avenue' option on cart. [prestashopdatabaseexception] table 'new_books.bzccpg_apibzcc' doesn't exist ................... ................... ................... dbcore->displayerror - [line 425 - classes/db/db.php] - [1 arguments] dbcore->query - [line 523 - modules/ccavenue/ccavenue.php] - [1 arguments] ccavenue->getpaymentdetails - [line 44 - modules/ccavenue/controllers/front/validation.php] - [1 arguments] ccavenuevalidationmodulefrontcontroller->initcontent - [line 189 - classes/controller/controller.php] controllercore->run - [line 367 - classes/dispatcher.php] dispatchercore->dispatch - [line 28 - index.php] how can solve issue? working on prestashop 1.6.1.5 here cc avenue module have used ( http://www.filehosting.org/file/details/655462/ccavenue_mcpg_prestashop_1.6.1.4.zip ) . says version 1.6.1

how to set alignment of views in relative layout using java code in android -

this question has answer here: how programmatically set layout_align_parent_right attribute of button in relative layout? 2 answers how set alignment of views in relative layout using java code in android i know how in xml android:layout_alignleft="@id/button1" android:layout_alignparentleft="@id/button2" but, want know how write using java code? problem want align 1 textview right , imageview left inside relativelayout. how that? button btn = (button)findviewbyid(r.id.your_button_id) relativelayout.layoutparams params = new relativelayout.layoutparams( layoutparams.wrap_content, layoutparams.wrap_content); params.addrule(relativelayout.right_of, view.getid()); bbtn.setlayoutparams(params); and same left_of

android - Initialisation of MapFragment in Activity Failing -

i use following xml code create mapfragment: <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.supportmapfragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hashcoder.eegoomain.customerhomeactivity"/> and in oncreate() method, use following code initialize map: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_customer_home); createnavigationdrawerfunction(); mapfragment = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mapfragment.getmapasync(this); } but, when run code on phone (redmi note 4), shows following exception: java.lang.runtimeexception: unable start activity componentinfo{com.hashcoder.eegoomain/com.hashcoder.eegoomain.customerhomeactivity}: android.view.inflateexception: binary

python - What is dimension order of numpy shape for image data? -

i using nibabel lib load data nii file. read document of lib @ http://nipy.org/nibabel/gettingstarted.html , , found that this information available without need load of main image data memory. of course there access image data numpy array this code load data , shapes import nibabel nib img = nib.load('example.nii') data = img.get_data() data = np.squeeze(data) data = np.copy(data, order="c") print data.shape i got result 128, 128, 64 what order of data shape? widthxheightxdepth ? , input must arranged depth, height, width . use input=data.transpose(2,0,1) . right? all update: found numpy read image order height x width x depth reference http://www.python-course.eu/images/axis.jpeg ok, here's take: using scipy.ndimage.imread('img.jpg', mode='rgb') , resulting array have order: (h, w, d) i.e. (height, width, depth) because of terminology numpy uses ndarrays (axis=0, axis=1, axis=2) or analogously (y, x, z) if 1

sql server - Multiple Inner Join - SQL -

i have sql request doesn't work...i don't know why because i'm beginning sql... select cdr.*, p1.*, p2.*, p3.* dbo.t_cdr_appel cdr inner join dbo.pos p1 on cdr.cdr_loc_code = p1.loc_code , cdr.cdr_loc_code 'sc%vi%' , cdr.cdr_type 'i%' inner join dbo.pos p2 on cdr.cdr_last_redir_no = p2.post_type , cdr.cdr_loc_code 'ccn%' , cdr.cdr_type 'i' inner join dbo.pos p3 on cdr.cdr_last_redir_no = p3.backup_number , cdr.cdr_loc_code 'voicemail%' , cdr.cdr_type 'if' thanks help your select statement select cdr.*, p1.*, p2.*, p3.* dbo.t_cdr_appel cdr inner join dbo.pos p1 on cdr.cdr_loc_code = p1.loc_code , cdr.cdr_loc_code 'sc%vi%' , cdr.cdr_type 'i%' inner join dbo.pos p2 on cdr.cdr_last_redir_no = p2.post_type , cdr.cdr_loc_code 'ccn%' , cdr.cdr_type 'i' inner join dbo.pos p3 on cdr.cdr_last_redir_no = p3.backup_number , cdr.cdr_loc_code

iphone - How to scale attributed string text based on Screen size- iOS Swift? -

Image
so have app content appears in textview. using attributed strings part of text contains links websites. problem content font size. small in ipads. seems fine in iphones. below code using. let attributedstring = nsmutableattributedstring(string: "about\n common room virtual fireplace app designed love 5x entrepreneur, arjun rai. goal of create ultimate mobile , relaxing ambience anywhere , anytime. rai’s passion fireplaces along minimalism in art has led him build several apps , startups on years since teenager. common room yet effort bringing beautiful experiences everyone...just bit more relaxing time around. :) follow him @ twitter.com/arjunraime") attributedstring.addattribute(nslinkattributename, value: "http://arjunrai.me/", range: nsrange(location: 92, length: 10)) attributedstring.addattribute(nslinkattributename, value: "https://itunes.apple.com/in/genre/ios/id36?mt=8", range: nsrange(location: 14, length: 33)) attribu

html - dotted border is displayed incorrectly in safari -

Image
i have problem in safari border wrongly displayed. there css settings consider? or missing?? thank you. this css: .border-dotted { border-width: 0px 0px 7px 0px; border-style: dotted; border-color: black; border-image-source: url(/img/dot.svg); border-image-slice: 36% 38%; border-image-repeat: round; } this how displayed in safari: this how displayed in chrome: i not sure work or not in safari can try. .border-dotted{ border: 7px dotted black; } you can change way want border-bottom.

html - I want to embed a overflowing video like paralax with no movement. Image bleed -

i started building page i'm trying make simple sectioned banner welcome banner on wix site. here banner @ top of page: wix banner example it concists of 5 5ths of 20% width section approximately, 2 first 20% , third 60%. managed aling them can't manage set video dimensions third section have autoplay video. no matter resizes video available overflow:hidden; , larger height , width. esampl of code: <div style=" width:20%; overflow: hidden; position:relative; float:left; ">` <img src="https://tatouagecalypso.com/wp-content/uploads/2017/04/photo-image-tatouage-coeur-realiste-couleur-bras-femme-hyper-realisme.jpg" alt="photo d'un image de tatouage d'un coeur réaliste en couleur sur le bras d'une femme en hyper réalisme" title="du coeur à l'ouvrage, tatouage calypso - québec tattoo shop" style="min-width:350px; margin:auto; margin-left:-100px;"></div> <div style="padding:10px; ba

java - How to write test cases for private void methods using junit and mockito -

this question has answer here: how mock private method testing using powermock? 3 answers can write test cases setaddr() method, because private void method, can 1 please me? class wcfg { private void setaddr(cfg cfg, string... arg) throws exception { try { } catch (exception e) { throw new exception("invalid ip address.", e); } } public string process(string... arg) throws exception { mcfg mcfg = new mcfg(); try { setaddr(mcfg, arg); } catch (exception e) { return "wrong argument format."; } cfg.write(); return "success"; } } every private method call in of public or accessible method directly or in directly. so, no need write case them. then if want write test case use : deencapsulation.invoke(someclasswhereprivatemethod.class, "methodname", argument1, argument2, argument

python - Why does convolutional network use every 64 image for training? -

i'm looking code here python 3.5 + tensorflow + tflearn: # -*- coding: utf-8 -*- """ convolutional neural network mnist dataset classification task. references: y. lecun, l. bottou, y. bengio, , p. haffner. "gradient-based learning applied document recognition." proceedings of ieee, 86(11):2278-2324, november 1998. links: [mnist dataset] http://yann.lecun.com/exdb/mnist/ """ __future__ import division, print_function, absolute_import import tflearn tflearn.layers.core import input_data, dropout, fully_connected tflearn.layers.conv import conv_2d, max_pool_2d tflearn.layers.normalization import local_response_normalization tflearn.layers.estimator import regression # data loading , preprocessing import tflearn.datasets.mnist mnist x, y, testx, testy = mnist.load_data(one_hot=true) x = x.reshape([-1, 28, 28, 1]) testx = testx.reshape([-1, 28, 28, 1]) # building convolutional network network = input_data(shape=[non

c# - Why can't I find Amazon.Lambda.Core? -

Image
i'm new amazon lamba, may newb question. i've downloaded , installed amazon sdk , created new project in visual studio. the lamba programming model talks adding lambda serializer, in amazon.lambda.core namespace, can't seem find it. i've added awssdk.core.dll , awssdk.lamba.dll assembly references, amazon.lambda.core namespace found. in addition, amazon api reference not have amazon.lamba.core namespace. what have misunderstood here? , how can fix it?

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

Image
is there way realign baseline constraint textview in case if dependent view visibility set gone? my layout code: <android.support.constraint.constraintlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test title" android:textcolor="@color/black" android:textsize="24sp" app:layout_constraintleft_toleftof="parent" app:layout_constraintright_torightof="parent"/> <textview android:id="@+id/subtitle1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="subtitle 1" android:textsize="11sp" app:layout_constraintb

java - Postman returns status 500 regardless of which JEE exeption do I use -

i'm developing spring boot app simple @restcontroller. here's code snippet bugs me. else if (validators.iscommentvalid(submission) == false) throw new webapplicationexception("comment field empty", 400); //throw new badrequestexception("comment field cannot empty"); //throw new httpexception(400); the idea behind it: when comment field empty, return 400 status (bad request). i've tried multiple jee (based on avax.ws.rs) exceptions, , work fine when comes relaying message etc, status returned postman 500. not sure missing, ideas? you can try define own exception , annotate them @responsestatus(value=httpstatus.not_found, reason="comment field empty") see more here

javascript - jQuery .delegate() and .undelegate() is not working in chrome 56 and above versions -

please let me know alternate function this.. $("#_body").undelegate('click').delegate(".class> a",'click',function(){ i want toggle portlet on live click. thanks try on() , off() like: $("#_body").off('click').on(".class> a",'click',function(){ // code here }); using jquery on() in jquery 1.7, on() method introduced effort simplify , merge event bindings functions 1 unified consistent api. if interested see how on() replaces functionality of these event methods, open jquery 1.7.1 source code ( https://github.com/jquery/jquery/blob/1.7/src/event.js#l965 ) , find bind(), live() , delegate() point on() method.