Posts

ios - Presenting a view controller without changing the status bar color, like UIAlertController -

Image
when performing network operations, present modal view controller (similar mbprogresshud view controller) prevent user interaction , indicate progress. the view controller has modalpresentationstyle = .custom , animated using transitioning delegate , custom presentation controller. beyond animating transitions have no custom actions driving presentation. the problem have whenever view controller presented, turns status bar color black. override preferredstatusbarstyle make return .lightcontent view controller presented on view controller .default , don't want change there either. basically, want have same behavior uialertcontroller . i have tried configuring presentation controller move presented view controller out of status bar space: private class seuiprogresscontrollerpresentationcontroller: uipresentationcontroller { override func shouldpresentinfullscreen() -> bool { return false } private override func frameofpresentedviewinco...

php - Setting Wordpress Primary Menu Programatically -

i have 2 menus created via end. need activate menu based on geo location, have aleady setup set default currency. menu names in backend main , main international. below code: function geo_client_currency($client_currency){ $userinfo = geoip_detect2_get_info_from_current_ip(); if ($userinfo->country->isocode == 'us'){ $client_currency = 'usd'; //currency code } else { $client_currency = 'inr'; } return $client_currency; } so need set main menu , main international anywhere outside us. have reviewed codex not quite sure how implement easiest way possible could easy in template file (like header.php )? <?php $userinfo = geoip_detect2_get_info_from_current_ip(); if ( $userinfo->country->isocode == 'us' ){ wp_nav_menu(array('menu_id' => 1)); //change 1 main id } else { wp_nav_menu(array('menu_id' => 2)); //change 2 main international id } ?>

sorting - Google Charts is changing my data order -

i trying create simple google charts column chart using date string x-axis. when pass in ordered hash (or array) reason google charts re-orders data based on own interpretation of how sort. example: [["dec 27", 206.17], ["28", 411.09], ["29", 411.09], ["30", 411.09], ["31", 411.09], ["jan 1", 411.09], [" 2", 411.09], [" 3", 411.09], [" 4", 411.09], [" 5", 411.09], [" 6", 411.09], [" 7", 411.09]] given data, google chart displays: x-axis example displayed google charts has else run , solved this? there way tell google charts accept data order without re-sorting? maybe share code, here column chart keeps sort same defined in array. google.load('visualization', '1.1', {'packages':['corechart']}); google.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodata...

javascript - passthru real request with pretender.js -

i trying pass through real webservice in acceptance test in project. pretender intercepts xhr request i'm trying tell pass through example.com according docs should able this. var server = new pretender(function(){ this.get('https://www.example.com/:catchall', this.passthrough); }); or this var server = new pretender(); server.get('https://www.example.com', server.passthrough); but in console. uncaught typeerror: pretender intercepted https://www.example.com/foo/bar encountered error: handler.handler not function(…) because handler.handler server.passthrough , server.passthrough object? > server.passthrough  object {numberofcalls: 1, async: undefined} the test passes in isolation fails when run full suite on console npm test. passes in browser. think have either race condition.

php - Why can't I connect to my psql db? -

so trying link page a.php psql db. here's dbconnection.class.php: <?php class dbconnection { var $conn function dbconnection(); { $this->conn = pg_connect("host='localhost' port='5432' dbname='tester' user='postgres' password='password'") or die("unable connect"); } } ?> and here's a.php <?php include ("dbconnection.class.php"); $dbconnection = new dbconnection(); ?> it keeps telling me have error on line 7 of dbconnection: fatal error: non-abstract method dbconnection::dbconnection() must contain body in c:\wamp\www\dbconnection.class.php on line 7 i'm not entirely sure far fixing problem open php.ini find ;extension=php_pgsql.dll , remove initial semi colon find ;extension=php_pdo_pgsql.dll , remove initial semi colon save file restart apache remove ; from end of function name class dbconnection { var $conn functio...

python - variance vs coefficient of variation -

i need identify statistic let me find on digital image line has highest variation. using variance (square units, calculated numpy.var(x)) , coefficient of variation (unitless, calculated numpy.sd(x)/numpy.mean(x)), got different values, here: v1 = line(var(x)) v2 = line(cv(x)) print(v1,v2) (12,17) should not both find same line? 1 better use in case? coefficient of variation , variance not supposed choose same array on random data. coefficient of variation sensitive both variance , scale of data, whereas variance geared towards variation in data. please see example: import numpy np x = np.random.randn(10) x1= x+10 np.var(x), np.std(x)/np.mean(x) (2.0571740850649021, -2.2697110381499224) np.var(x1), np.std(x1)/np.mean(x1) (2.0571740850649016, 0.1531035017615747) which 1 choose depends on application, i'm leaning towards variance in case.

json - Returning specific date format with Jackson -

i trying return date on json object specific format: format: "lastmodified": "2015-08-04t13:09:15.000-07:00", i have custom objectmapper this: result.setdateformat(new iso8601dateformat()); but result: "lastmodified": "2015-08-04t20:09:15z" any ideas how change it? using: <dependency> <groupid>org.glassfish.jersey.media</groupid> <artifactid>jersey-media-json-jackson</artifactid> <version>2.22.1</version> <scope>runtime</scope> </dependency> and before used older version of: org.codehaus.jackson update: after adding line: result.configure(com.fasterxml.jackson.databind.serializationfeature. write_dates_as_timestamps , false); and removed: result.setdateformat(new iso8601dateformat()); i got result: "lastmodified": "2015-08-04t20:09:15.000+0000", still not want. this right format: result.setdateformat(new simp...