Posts

Showing posts from September, 2013

Connecting to specific wifi sometimes fails on android -

i creating app, can list out available wifi's in listview. if select 1 of wifi's in list, cached before in list<wificonfiguration> list = wifimanager.getconfigurednetworks(); should connect it. if wificonfiguration list doesn't contain selected wifi, nothing happens. problem is, select wifi list (which know sure in wificonfiguration list), doesn't connects it. instead connects connected wifi. after attempts (selecting again , again same wifi) connects finally. doesn't happen always, sometimes. can problem? here code snippet: // go through cached wifis , check if selected gopro cached before (wificonfiguration config : configurations) { // if cached connect , that's if (config.ssid != null && config.ssid.equals("\"" + mdrawerlistview.getadapter().getitem(position) + "\"")) { // log log.i("onreceive", "connecting to: " + config.ssid); mwifimanager.disconnect();

scala - Wiring a Play Filter to wrap the error handler -

i have play filter post request logging this: class loggingfilter extends filter lazylogging { override def apply(f: (requestheader) => future[result])(rh: requestheader): future[result] = f(rh) andthen { case success(result) => logger.info(s"[success] ${result.header.status}") case failure(e) => val end = system.currenttimemillis() val duration = end - start logger.error(s"[failure] ${e.getmessage}}", e) } } } i have onservererror handler maps known exceptions appropriate result . unfortunately, filter invoked before error handler converts known exceptions results, leaving me without status code sent caller , stack trace handled exception in logs. is there way define filter wraps request post errors handler invocation?

algorithm - Computational Complexity of Fourth Order Butterworth Filter and fastICA in Matlab -

i working on eeg signal , need extract signal bands based on frequency. delta: 0 - 4hz theta: 4 - 8hz alpha: 8 - 12hz beta : 12 - 40hz i used fourth order butterworth filter , works fine don't know complexity of it, people used fastica well, need know if faster if used fastica. tell me complexity of both algorithms (fourth order butterworth filter vs fastica)? code extract theta band: w1 = 8/fs; w2 = 14/fs; wn_t = [w1 w2]; [c,d] = butter(n,wn_t); theta = filter(c,d,eeg);

java - Referring applicationContext.xml bean in Spring @Configuration -

i have this: @configuration public class springconfigutil { private static final logger logger = logger.getlogger(springconfigutil.class); @value("#{ systemproperties['activemq.username'] }") private string username; @value("#{ systemproperties['activemq.password'] }") private string password; @value("#{ systemproperties['activemq.url'] }") private string brokerurl; @value("#{ systemproperties['activemq.queuename'] }") private string queuename; @bean public static propertysourcesplaceholderconfigurer placeholderconfigurer() { return new propertysourcesplaceholderconfigurer(); } @bean(name="producer") public jmstemplate jmstemplate() { jmstemplate jmstemplate = new jmstemplate(); jmstemplate.setdefaultdestination(new activemqque

In Windows 8.1 XAML/C# app, how can I style the buttons precisely? -

Image
i'm new windows 8.1 development, forgive me if answer obvious, i've been beating on awhile, , can't work. here's situation: i made usercontrol in order style button adding additional functionality it. here's code that: <usercontrol x:class="mycalculator.calculatorbutton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:mycalculator" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:designheight="300" d:designwidth="400" mc:ignorable="d" > <!-- grid takes whole width , height --> <grid x:name="layoutroot"> <grid.rowdefinitions> <rowdefinition height="*" /> </grid.rowdefiniti

dictionary - C++ STL map, whose key is shared_ptr<struct tm> -

for 1 of projects, need use shared_ptr struct tm key stl map. below testing code. in loop, there 2 ways create shared_ptr: 1) tmsptr tm_ptr = std::make_shared(* tminfo); 2) tmsptr tm_ptr(tminfo). both can compile; during run-time, 2nd method throws error: " * error in `./a.out': free(): invalid pointer: 0x00007f52e0222de0 * aborted (core dumped)", indicating tries free memory not exist. still quite new smart pointers, can insight forum. apologies may have included more headers needed #include <iostream> #include <map> #include <algorithm> #include <iterator> #include <memory> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> using namespace std; typedef std::shared_ptr<struct tm> tmsptr; int main() { cout << "\ntesting map key smart ptr struct tm:\n"; map<tmsptr, int> price_series; (int = 0; < 5; ++i) { time_t now; time(

ocaml - Error trying to parse imaginary programming language -

i'm working on language interpreter programming language made up. here's example code, should work dies syntax error @ offset 45. when reading testcase. { foo = { "min" : 1 ,"max" : 5}; foo["min"] } the correct interpretation first line foo create map , store in variable named foo, second line looks value of field min in record foo, , starting/ending curlies semicolon wrap 2 expressions expr_seq (i.e. block) evaluates same thing last expr in it. a simplified version of parser.mly follows: %token <int> int %token <string> var %token semi comma colon assign quote %token lbrack rbrack lcurl rcurl %token eof %start <int> main %% main: | eof { failwith "empty input" } | e = exp eof { e } exp: | int { 0 } | e = exp lbrack v = q_var rbrack { (* map lookup *) 0 } | v = var assign e = exp { (* assign var *) 0 } | v = var lbrack f = q_var rbrack assign e = exp { (* assign map field *)

Transform a rectangle to a specific shape using java -

Image
is there way transform rectangle shape shown in image..? i have tried every way can using affinetransform this. couldn't the expected result. want make sure impossible task or there way this.. affine transformation definition preserves points, straight lines , planes. so can @ best transform rectangle rotated parallelogram @ best (opposite lines remain parallel). to achieve more complex shapes, need more general transformation projective transformation (also known homography) (affine transformation special kind of projective transformation).

How can I resolve this code challenge? -

your challenge implement game described here. description refers picking number, means computer should pick random number between 1 , 10. the computer picks 1 number dealer, , picks 2 numbers player. these numbers displayed player. the player can ask computer pick more numbers player, 1 @ time, if sum of numbers goes on 21 have lost game. once player happy set of numbers, computer pick numbers dealer until sum of numbers 16 or higher. if dealer's numbers sum more 21, player wins game. otherwise, highest-scoring set of numbers wins game. basically, don't know if understand question correctly. think problem questionable. as player cannot predict future pick , cannot revert last pick, stop-pick time when player happy? can know dealer's price on 16, if initial pick below 16, chooses pick more numbers. after numbers sum on 16, how do? if aggressive, continue pick. or if conservative, stop , happy. so problem questionabl

javascript - I can't get my navigation to change on scroll -

i know repeat question, trying navigation bar change styling using javascript/jquery/css making jquery add , remove classes depending on position of scrollbar, yet no prevail. huge noob jquery. tell me if these wrong code. have searched hours , can't find , error. here working example: http://codepen.io/anon/pen/qbwojv , here code: // on scroll, $(window).on('scroll',function(){ // round here reduce little workload stop = math.round($(window).scrolltop()); if (stop > 50) { $('.nav').addclass('passed-main'); } else { $('.nav').removeclass('passed-main'); } .nav { background-color: #000000; opacity: 0.3; width: 100%; height: 40px; position: fixed; top: 0; z-index: 2000; transition: 0.3s; } .nav.past-main

objective c - Xcode iOS UIView with tap gesture allowing input on subviews -

so have homepage view people see when first boot app, has several different options. yesterday added tutorial overlay, first time open app have view 0.5 alpha black , fullscreen on other view, view has white text , arrows pointing functions on page. attached tap gesture recognizer view , action call next tutorial screen ( 3 in total). afterwords hidden , app acts normal. works, except though view full screen, user interaction enabled checked , gesture tap recognizer, gestures / touches on sub view still work. if tap white space on app tutorial , tap gesture work expected, cycle me through pages etc , works. if accidentally press sub view button or gesture subview action (take new page or w/e) so far can tell view despite being on top of other , having tap gesture recognizer attached view sub views still getting pressed, ideas? check tap event view before doing operation.. - (ibaction)yourtapevent:(uitapgesturerecognizer *)gesturerecognizer { uiview *piece

Wordpress - How to create a custom functions.php file in another folder? -

i've seen tutorials creating files my_functions.php , , custom_functions.php , specific themes. i'm looking way create custom functions.php file can used in theme, possible? @ least plugin or put original file in different folder. don't know, i've been looking everywhere , can't find anything.

java - Process command line arguments -

we have shell script invokes java program. script passes arguments values methods defined in main method of java program. the expected input format parameters follows "test1, test1_21apr15,xyz,test,test, , , 2015-04-21" "test2, test2_21apr15,xyz,test,test, , ,2015-04-21" "test3,test3_21apr15,xyz, test,test, , ,2015-04-21" and on, i.e. each string has attributes comma separated , string separated space (here have mentioned in next line actual values separated space). from above input values need assign values local attributes shown below: attr1 = test1,test2,test3 attr2 = test1_21apr15,test2_21apr15,test3_21apr15 attr3 = xyz,xyz,xyz attr4 = test,test,test . . . attr8 = 2015-04-21,2015-04-21,2015-04-21, and need process these parameters in methods. i understand when pass arguments main method placed in arg[] array, facing issues while assigning parameters values attributes. can please give me guidance me on this? i

python - Simple way to round floats when printing -

i working on project has take user inputs , calculations. what aiming print appear as inform customer saved 0.71 today not inform customer saved 0.7105000000000001 today is there can put same line of code print function have rounded? or have modify each variable. i can post code if requested. round() return floating point value number rounded ndigits digits after decimal point. takes first argument number , second argument precision no = 0.7105000000000001 print round(no, 2) second solution: print "%.2f" % 0.7105000000000001

node.js - toJSON() does not work on a array full of json objects -

updated question im using sails.js v0.10.5 and i'm trying use sails tojson() , im trying delete stuff server before sent client. so have user system can write name , typeaead query database using sails backend. when suggestions sent array includes multiple users objects. the returned object follows [ { "_id": "55394747d01d6777e09f4919", "index": 0, "guid": "1e08f17d-0163-40f6-b673-c9b1823b3e9b", "isactive": true, "balance": "$2,994.39", "picture": "http://placehold.it/32x32", "age": 28, "eyecolor": "brown", "name": "grant hughes", "gender": "male", "company": "cubix", "email": "granthughes@cubix.com", "phone": "+1 (972) 415-2367", "address": "656 hornell loop, farmers,

php - Generate Entities from an Existing Database -

i new symfony , doing application using framework. trying generate entities existing database , while run following command: php app\console doctrine:mapping:convert annotation .\src\appbundle\resources\config\doctrine i've got error message: no metadata classes process. could please tell me what's happening this? from docs, seems missing --from-database argument. i've never used tool though. http://symfony.com/fr/doc/current/cookbook/doctrine/reverse_engineering.html php app/console doctrine:mapping:convert xml ./src/acme/blogbundle/resources/config/doctrine/metadata/orm --from-database --force

xamarin for android :How to setTextColor Set Xml Selector -

i want xml color selector set textview in java code. mtext.settextcolor(getresources().getcolorstatelist(r.color.xml_color_selector)) how code work in xamarin? found api here 1 , here 2 . tried both of them, but: mtext.settextcolor(android.content.res.resources. "not found getcolorstatelist"<br> mtext.settextcolor(resources. "not found getcolorstatelist" mtext.settextcolor(java.lang.classloader. "not found getresource" mtext.settextcolor(java.lang.class. "not found getresource" thanks. p.s. want convert java code c# code , set xml selector textcolor in code. this resources\drawable\xml_color_selector.xml hope set textcolor drawable in activity <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@color/menu_item_title_color_pressed" android:state_pressed="true" /> <item android:color="@color/menu_item_title_color" andr

php - combine search from multiple tables -

the current table structure have is product_description [ (int)product_id, (varchar)name, (text)description, ... ] vendors [ (int)vendor_id, (varchar)vendor_name, (text)vendor_description, ... ] vendor [ (int)vendor, (int)product_id, ... ] currently have search option fetch matching values both tables. work independently, i.e. keyword search gets matching value both tables' name description fields. now requirement has been changed client. client wants search dependent, i.e. suppose 1 search product associated vendors should fetched , if vendor searched associated products should visible. issue there no option determine whether user searching product or vendor. is there way make search dependent? after search there other filter work out location, price range, etc. result displayed on tab based page separate tab vendor , product , each tab has own pagination not affect other tab. we suggested client give drop down elance near searc

Block requests via intermediate host names at nginx -

i have setup users supposed send requests a.com. requests sent cdn further sends request a-reader.com, , a-reader routes request nginx. i want a-reader accessible via cdn, so, aim block request original request url not a.com. if user types a-reader.com/<anything> in browser address bar, requests should blocked @ nginx is possible? yes - can use nginx http referrer module - http://nginx.org/en/docs/http/ngx_http_referer_module.html in case, since want allow a.com, configuration should like: valid_referers *.a.com; if ($invalid_referer) { return 403; } you'll have customize valid referral list match domain. alternatively, can regex matching on $http_referer: if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|poker|porn)) { return 403; } (http referer https://calomel.org/nginx.html via how block referral spam using nginx? )

hive - Is there a way to define replacement of one string to other in external table creation in greenplum.? -

i need create external table hdfs location. data having null instead of empty space few fields. if field length less 4 such fields, throwing error when selecting data. there way define replacement of such nulls empty space while creating table self.? i trying in greenplum, tagged hive see can done such cases in hive. you use serialization property mapping null string empty string. create table if not exists abc ( ) row format delimited fields terminated '|' stored textfile tblproperties ("serialization.null.format"="") in case when query hive empty value field , hdfs have "\n". or if want represented empty string instead of '\n', can using coalesce function: insert overwrite tabname select null, coalesce(null,"") data_table;

java - add content to a created xml document -

here code: import java.io.filewriter; import java.io.ioexception; import org.jdom2.attribute; import org.jdom2.document; import org.jdom2.element; import org.jdom2.output.format; import org.jdom2.output.xmloutputter; try { element fichadas = new element("fichadas"); document doc = new document(fichadas); doc.setrootelement(fichadas); element fichada = new element("fichada"); fichada.addcontent(new element("n_terminal").settext("xx")); fichada.addcontent(new element("tarjeta").settext("xx")); fichada.addcontent(new element("fecha").settext("xx")); fichada.addcontent(new element("hora").settext("xx")); fichada.addcontent(new element("causa").settext("xx")); doc.getrootelement().addcontent(fichada); xmloutputter xmloutput = new xmloutputter(); xmloutput.setformat(format.getprettyformat()); xmloutput.output(

java - Displaying Output Not as Expected -

for following program expecting output as enter value : 3 entered 3 but not getting output, instead in output java expecting input without displaying "enter value". if enter value display output as 3 enter value : entered 3. here code: import java.io.*; // system.in object of inputstream - byte stream class consoleinputdemo{ public static void main(string args[]) throws ioexception{ bufferedreader consoleinput = new bufferedreader(new inputstreamreader(system.in)); // convert byte stream character stream printwriter consoleoutput = new printwriter(system.out); consoleoutput.println("enter value : "); int c= consoleinput.read(); consoleoutput.write("you entered " + c); consoleinput.close(); consoleoutput.close(); } } consoleoutput.println didn't print until close() . use system.out.println("enter value

entity framework - Symfony2 Filter Collections in Form -

we have user entity has relations(onetomany) other entities. while building formtype user entity. have took associated entities collection. $builder->add('sso_users_organization', "collection", array('type'=>new usersorganizationtype(),'allow_add' => true) ); we want show associated entities filtering based on status "active". we have tried filtering in below way. $organizations = $userentity->getssousersorganization(); foreach($organizations $key=>$org){ if($org->getstatus() == 0){ unset($organizations[$key]); } } but when saving details back, other records having status "inactive" getting deleted. please can me out. thanks try this. $er entity repository of type specified "class". in case usersorganizationtyperepository $builder->add('sso_users_organization', "entity", array( "class" => "acme\appbundle\userso

Call external Web Service using javascript CRM 2011 RU 12 (Rollup 12) -

until we'd been using ru 11 within our dynamics crm 2011 application have begun project move crm 2015. we've upgraded ru 12 , things fun! i've managed sort out lot of coding issues present cannot life of me solve our issue of accessing external web service, passing parameters along way , retrieving data back. at first had trouble "createxmlhttp()" function found great answer online indicating following function help: function createxmlhttp() { var ref = null; if (window.xmlhttprequest) { ref = new xmlhttprequest(); } else if (window.activexobject) { // older ie ref = new activexobject("msxml2.xmlhttp.3.0"); } return ref; } this worked fine , expected, have appeared connect service. however, not retrieving data , issue tying me in knots. as background, following code declare few integer variables before posting xml through webservice. parseint(lnglicensnr); parseint(lngnrofusers);

jaxb - Unmarshaller failure -

i have mrss feeds form i'm getting content via unmarshalling process. have same structure, in 1 case returning null 'mediacontent'. can difference between 2 feeds? returns null: http://smrss.neulion.com/u/nhl/mrss/sights-and-sounds/vod.xml working correctly: http://smrss.neulion.com/u/nhl/mrss/news/news_mrss.xml at first glance seems namespaces different .. first 1 http://search.yahoo.com/mrss , , second http://search.yahoo.com/mrss/ . second has / @ end.

google openid - TypeError: gapi.auth2 undefined -

i went instructions integrating google sign-in: https://developers.google.com/identity/sign-in/web/sign-in#specify_your_apps_client_id sign-in works, sign-out gives javascript error in line: var auth2 = gapi.auth2.getauthinstance(); the error is: gapi.auth2 undefined i include google platform library instructed: <script type='text/javascript' src='https://apis.google.com/js/platform.js' async defer></script> why not work? are signin , signout used on same page? div g-signin2 loads , inits gapi.auth2 should work long on same page. in case signout on separate page, should manually load , init gapi.auth2 library. full example (you have replace your_client_id actual client_id): <html> <head> <meta name="google-signin-client_id" content="your_client_id"> </head> <body> <script> function signout() { var auth2 = gapi.auth2.getauthinstance();

android - How to remove padding from horizontal barchart of mpandroidchart? -

Image
i trying make horizontal barchart covers entire parent layout not. below code - horizontalbarchart barchart = new horizontalbarchart(activity); barchart.setlayoutparams(new linearlayout.layoutparams(0, 110, weight)); arraylist<barentry> entries = new arraylist<barentry>(); entries.add(new barentry(86.0f, 0)); bardataset dataset = new bardataset(entries, ""); dataset.setcolor(color.parsecolor("#e0e0e0")); arraylist<string> labels = new arraylist<string>(); labels.add("86.0"); bardata bardata = new bardata(labels, dataset); barchart.setdata(bardata); barchart.setdescription(""); legend legend = barchart.getlegend(); legend.setenabled(false); yaxis topaxis = barchart.getaxisleft(); topaxis.setdrawlabels(false); yaxis bottomaxis = barchart.getaxisright(); bottomaxis.setdrawlabels(false); xaxis rightaxis = barchart.getxaxis(); rightaxis.setdrawlabels(false); bottomaxis.setdrawlabels(false); barchart.setpadding(-

Why does our Coldfusion server require a daily restart? -

our coldfusion server requires daily restart using command -jar jrun.jar -start coldfusion not sure why stopping daily. please resolve this. we have coldfusion running on unix server. server.log has below: "warning","14","04/22/15","16:48:38",,"template: /cfide/cf5dev/break/cage/cage.cfm, ran: 8 seconds." "warning","12","04/22/15","16:50:17",,"template: /cfide/cf5dev/break/cage/cage.cfm, ran: 22 seconds." "warning","14","04/22/15","16:50:20",,"template: /cfide/cf5dev/break/cage/cage.cfm, ran: 27 seconds." "warning","9","04/22/15","16:53:20",,"template: /cfide/administrator/logging/downloadlog.cfm, ran: 2 seconds." "warning","9","04/22/15","16:54:23",,"template: /cfide/administrator/logging/downl

c++ - how to delete local machine registry key? -

i need delete local machine registry keys, tried registry delete routines result through admin account cant it. how can set access rights of application system account using windows api routines??? used routine regdeletekey returned value 5 means access denied, run application under full admin rights even manually open regedit admin rights, wont able delete local machine registry keys. purpose need system account rights. i opened regedit system account rights , able delete local machine keys successfully. need programmatically you either need run application administrator (run administrator in context menu of explorer), or need add manifest application, indicating application needs administrator rights. in latter case, uac dialog ask administrator credentials.

hashtable - I am creating a Hash Table that uses nodes to chain. What is a collision? -

i can't seem answer understand. collision when have hash table uses linked nodes? is collision +1 every index must pass index needed node adding? i know collisions unavoidable, have learned through research haven't been able figure out constitutes collision when dealing hash table has linked nodes. my program after finding proper place in array (array of pointers nodes), sticks new node @ front. each element points @ node points @ node, have multiple linked lists. so, collision count include first node of element new node belongs because stick @ front, or include every single node in linked list element. for example, if name "smith" goes element [5], has 5 other nodes linked together, , add front, how decide collision count is? thanks help! a collision when 2 distinct entries produces same output through hash function. say (poorly designed) hash function h consists in adding digits of number: 5312 -> 5 + 3 + 1 + 2 = 11 1220 -> 1

ios - How to customise the UIPickerView height -

how customise height of uipickerview more 250 . have done following unable height given -(void)pickerview:(id)sender { pickerview=[[uipickerview alloc] initwithframe:cgrectmake(0,200,320,400)]; pickerview.transform = cgaffinetransformmakescale(0.75f, 0.75f); pickerview.delegate = self; pickerview.datasource = self; pickerview.showsselectionindicator = yes; pickerview.backgroundcolor = [uicolor lightgraycolor]; [pickerview selectrow:1 incomponent:0 animated:yes]; [self.view addsubview:pickerview]; // [contentview addsubview:pickerview]; } here there 3 valid heights uipickerview (162.0, 180.0 , 216.0). you can use cgaffinetransformmaketranslation , cgaffinetransformmakescale functions fit picker convenience. example: cgaffinetransform t0 = cgaffinetransformmaketranslation( 0, pickerview.bounds.size.height/2 ); cgaffinetransform s0 = cgaffinetransformmakescale(1.0, 0.5); cgaffine

php - How to Display Option Name in Dropdown using Javascript -

i have 2 dropdowns values populated mysql. second dropdown values depends on first dropdown option. anyways, code working. using code posting hospital_id php. want display hospital_name text on dropdown well, of able display hospital_id. please see me code below , suggest me solution: $query = "select bp_id,bp_name mfb_billing"; $result = $db->query($query); while($row = $result->fetch_assoc()){ $categories[] = array("bp_id" => $row['bp_id'], "val" => $row['bp_name']); } $query = "select bp_id, hospital_id, hospital_name mfb_hospital"; $result = $db->query($query); while($row = $result->fetch_assoc()){ $subcats[$row['bp_id']][] = array("bp_id" => $row['bp_id'], "val" => $row['hospital_id']); } $jsoncats = json_encode($categories); $jsonsubcats = json_encode($subcats); this script: <script type='text/javascript'

angularjs - angular $routeProvider resolve -

Image
i want create menu dynamically, that, use resolve before loading dashboard. var app = angular.module('mabnaaapp', ['ngroute', 'ngresource', 'nganimate', 'ui.bootstrap', 'ur.file']) .config(function ($routeprovider) { $routeprovider .when('/login', { templateurl: 'views/login.html', controller: 'loginctrl' }) .when('/dashboard', { templateurl: 'views/dashboard.html', resolve: { menu: function (menuservice) { return menuservice.getmenu(); } }, controller: function ($scope, menu) { $scope.menu = menu; $scope.oneatatime = true; } }) .when('/flatfile', { templateurl: 'views/flatfile.html' }) .when('/view/:vtid/:prid', { templat

regex - PHP Regular Expression pattern accepts characters that are not allowed -

preg_match('~^[a-za-z0-9!@#$%^*()-_+=.]+$~', $string) this pattern used in code, wanted telling users they're allowed use these characters. problem works characters , not others. example doesn't allow string "john&john" allows "test<>" though didn't enter '<' , '>' in pattern! i test regexps tools https://regex101.com/ you must escape special characters in regexp: ^[a-za-z0-9!@#\$%\^\*\(\)\-_\+=\.]+$

Linux opencv independent installation : not found in CMake -

Image
i creating object tracking program rely on opencv. want able test different versions of opencv have linking errors. i installed last version of opencv (a69b435c928f422fb5f99c02cf2dcae57dcf820a) in following folder : /usr/local/opencv/opencv-trunk instead of usual /usr/local . then followed official tutorial use opencv cmake in linux, had following "normal" error : cmake error @ cmakelists.txt:11 (find_package): not providing "findopencv.cmake" in cmake_module_path project has asked cmake find package configuration file provided "opencv", cmake did not find one. not find package configuration file provided "opencv" of following names: opencvconfig.cmake opencv-config.cmake add installation prefix of "opencv" cmake_prefix_path or set "opencv_dir" directory containing 1 of above files. if "opencv" provides separate development package or sdk, sure has been installed. -- configuring incomp

javascript - error with gulp-ng-annoate, couldn't process source due to parse error -

i getting trouble error generated gulp-ng-annoate. error message error: app.js: error: couldn't process source due parse error i've found other thread seems have same problem me answer not work me. the other thread here gulp file , files trying execute tasks. gulpfile.js var gulp = require('gulp') var concat = require('gulp-concat') //var uglify = require('gulp-uglify') var ngannotate = require('gulp-ng-annotate') gulp.task('js', function(){ gulp.src(['ng/module.js', 'ng/**/*.js']) .pipe(concat('app.js')) .pipe(ngannotate()) //.pipe(uglify()) .pipe(gulp.dest('assets')) }) and files trying concat/ngannotate module.js angular.module('app', []) posts.ctrl.js angular.module('app') .controller('postctrl', function($scope, postssvc){ $scope.addpost = function(){ if ($scope.postbody){ postssvc.create(

Is there a Python equivalent to the mahalanobis() function in R? If not, how can I implement it? -

i have following code in r calculates mahalanobis distance on iris dataset , returns numeric vector 150 values, 1 every observation in dataset. x=read.csv("iris data.csv") mean<-colmeans(x) sx<-cov(x) d2<-mahalanobis(x,mean,sx) i tried implement same in python using 'scipy.spatial.distance.mahalanobis(u, v, vi)' function, seems function takes one-dimensional arrays parameters. i used iris dataset r, suppose same using. first, these r benchmark, comparison: x <- read.csv("irisdata.csv") x <- x[,c(2,3,4,5)] mean<-colmeans(x) sx<-cov(x) d2<-mahalanobis(x,mean,sx) then, in python can use: from scipy.spatial.distance import mahalanobis import scipy sp import pandas pd x = pd.read_csv('irisdata.csv') x = x.ix[:,1:] sx = x.cov().values sx = sp.linalg.inv(sx) mean = x.mean().values def mahalanobisr(x,meancol,ic): m = [] in range(x.shape[0]): m.append(mahalanobis(x.ix[i,:],meancol,ic) *

haskell - Data.ConfigFile not using the Bool instance of get -

according https://hackage.haskell.org/package/configfile-1.0.5/docs/data-configfile.html , package convert value in config. file bool. following code: {-# language flexiblecontexts #-} import qualified data.configfile dc import qualified control.monad.except cme -- | foundation object data jrstate = jrstate { secureonly :: bool -- ^ restrict connections https } main :: io () main = (cme.runexceptt $ pipe (jrstate false)) >>= estate estate :: show t => either t jrstate -> io () estate (right state) = return () estate (left err) = putstrln $ "<<" ++ show err ++ ">>" return () pipe :: (cme.monaderror dc.cperror m, cme.monadio m) => jrstate -> m jrstate pipe site = cp <- cme.join $ cme.liftio $ return $ dc.readstring dc.emptycp{dc.optionxform=id} "securesession = true\n" dc.get cp "default" "securesession" >>= return . nubb nubb (left err) = error e

tomcat - How to access shared folder from spring -

this might question show poor searching truth despite googling have not found direction yet. the context i developing web player using tomcat , spring mvc. @ point of time have deveoped jsp page search audio calls locally(on pc) . however, plan retrieve audio calls windows shared folder. might have understood @ moment keep audio files in local folder on desktop. need store million of files , amount of data expected around 200 tb. my objective my aims store calls on windows shared folder can access spring somehow , secure audio data make sure it can played audio player fyi the database @ moment keep metadata of relative audio paths. audio files in opus format , should played in html5 audio tag. summary: which best technology achieve this? is windows shared folder best solution? do know how can secure audio data? encrypt in shared folder increase security , make sure can played application? how can connect external shared folder using spring? jcifs solution. apac

angularjs - Protractor Not select first Element from an autocomplete search address -

Image
i need select first element autocomplete search box , when autocomplete shows hover other element,so other element not clickable protractor , solution element.all(by.css('[ng-model="address"]')).get(0) not work me work in computer , same script work in computer , checked protractor version , selenium version try element.all(by.css('[ng-model="address"]')).first() ; not work me , have idea how cant first element ?. thanks you can send enter key protractor.key.enter yourelement.sendkeys('your text send ', protractor.key.enter);

logstash - Can anyone give a list of REST APIs to query elasticsearch? -

i trying push logs elasticsearch through logstash. my logstash.conf have 2 log files input; elasticsearch output; , grok filter. here grok match: grok { match => [ "message", "(?<timestamp>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) (?:\[%{greedydata:caller_thread}\]) (?:%{loglevel:level}) (?:%{data:caller_class})(?:\-%{greedydata:message})" ] } when elasticsearch started, logs added elasticsearch server seperate index name mentioned in logstash.conf . my doubt how logs stored in elasticsearch? know stored index name mentioned in logstash. ' http://164.99.178.18:9200/_cat/indices?v ' api given me following: health status index pri rep docs.count docs.deleted store.size pri.store.size yellow open tomcat-log 5 1 6478 0 1.9mb 1.9mb yellow open apache-log 5 1 212 0 137kb 137kb but, how 'documents', 'fiel

entity framework 6 - How to set SetSqlGenerator and CodeGenerator in MySql Connector 6.9.6? -

i updated mysql connector/net 6.9.6 (from 6.9.5) , ef 6.1.3 (from 6.1.2) broke migrations :( i used have this, make migrations work on mysql. public configuration() { // fails cannot assign mysqlmigrationsqlgenerator tosystem.data.entity.migrations.sql.migrationsqlgenerator setsqlgenerator("mysql.data.mysqlclient", new mysql.data.entity.mysqlmigrationsqlgenerator()); // fails cannot assign mysqlmigrationcodegenerator system.data.entity.migrations.design.migrationcodegenerator codegenerator = new mysql.data.entity.mysqlmigrationcodegenerator(); } but doesn't work. , when remove generated migrations prefixed dbo doesn't work. i tried setting new config in web.config <entityframework codeconfigurationtype="mysql.data.entity.mysqlefconfiguration, mysql.data.entity.ef6"> also tried setting new attribute on context. [dbconfigurationtype(typeof(mysqlefconfiguration))] public class mycontext : dbcontext but no avail. h

Kendo ListView not working -

my kendo ui core listview not working reason , can't figure out why: <div id="events-upcoming"></div> <script type="text/x-kendo-template" id="events-template"> <div class="event"> <p>#: title #</p> </div> </script> <script> $(document).ready(function () { var upcomingevents = new kendo.data.datasource({ transport: { read: { url: "http://localhost/supersavings/services/eventservice.asmx/getfutureeventsbycompanyname", type: "post", contenttype: "application/json; charset=utf-8", datatype: "json", data: { companyname: "admin", currentdate: "1/1/2015" } },

c# - Get TextBlock lines as separate strings WPF -

is there way textblock lines separate strings after text wrapping? example, if have textblock defined this: textblock mytextblock = new textblock(); mytextblock.textwrapping = textwrapping.wrap; mytextblock.text = verylongstring; is possible separate string each row displayed in textblock, created textwrapping.wrap? textblock has property called inline , use , access strings 1 one, stringbuilder s = new stringbuilder(); foreach (var line in txtsample.inlines) { if (line linebreak) s.appendline(); else if (line run) s.append(((run)line).text); } var text = s.tostring(); }

html - Vertically aligning a text element inside a parent div element? -

i trying align text inside div . have read 4 topics here on sof , of them recommend use vertical-align property. in case doesn't work. .free { display: inline-block; -webkit-border-radius: 4; -moz-border-radius: 4; border-radius: 4px; font-family: 'open sans', sans-serif; color: #ff0000; background: #ffffff; border: dashed #ff0000 2px; width: 105px; height: 46px; font-size: 1.07rem; font-weight: bold; text-align: center; text-decoration: none; text-transform: uppercase; margin-bottom: 0; } .free p { vertical-align: middle; } <div class="free"> <p>text</p> </div> try this: demo add following code in css .free { line-height:46px; } .free p { background-color:#ccc; padding:0; margin:0; } hope helps !