Posts

Showing posts from September, 2012

algorithm - Efficient way to see if a set of values appear in an array? -

i'm trying check if 1d array of integers a contains or not, @ every 1 of it's size(a) positions, of elements of set of integers s (also 1d array), general case of size(s) > 1 . the easy , obvious way following nested loop: do = 1, size(a) j = 1, size(s) if(a(i) == s(j)) ** ** enddo enddo the problem that, large arrays a , s , process inefficient. there intrinsic fortran subroutine or function faster? or other method? i've tried following, doesn't want compile: do = 1, nnodes if(a(i) == any(s)) ** ** enddo the error message appears following: " error #6362: data types of argument(s) invalid. " i'm using vs2010 intel parallel studio 2013. the expression a(i) == any(s) has integer on lhs , logical on rhs . we'll have none of c-inspired nonsense of regarding comparable types in fortran thank much. actually, it's worse that, any returns logical takes array of logicals on input, any(array_of_int) ...

java - Fetching URL from HTMLData with List Android Studio -

i'm near want, i'm blocked... have html data in string contentstring : log.i(tag, "all url : " + contentstring); : <p><b>14th april</b></p> <p>the wind south west 4 5 foot of swell @ peak. streedagh best beach break.</p> <p><span id="more-113"></span></p> <p>high tide: 1250  3.1m    <span style="color: #ff0000;"> <a href="http://www.bundoransurfco.com/webcam/"><strong>click here live peak webcam</strong></a></span></p> <p>low tide: 1854 1.4m</p> <p></p> <p></p> <style type='text/css'> #gallery-1 { margin: auto; } #gallery-1 .gallery-item { float: left; margin-top: 10px; text-align: center; width: 50%; } #gallery-1 img { border: 2px solid #cfcfcf; } #gallery-1 .gallery-caption { margin-left: 0; } /* see gallery_shortcode() in wp-includes/media.php */ </style> <div id=...

watchman - What are the performance and reliability implications of watching too many files? -

in facebook's watchman application, somewhere in docs says this : most systems have finite limit on number of directories can watched effectively; when limit exceeded performance , reliability of filesystem watching degraded, point ceases function. this seems vague me. before "ceases function", can expect happen if start watching many files? , talking 100 files, 1,000 files, 100,000 files..? (i realise number vary on different systems, rough idea of sensible limit modern unix laptop useful). i have use case involve watching entire node_modules folder (which contains thousands of files in nested subdirectories), , want know before start work on whether it's complete non-starter. sorry if docs aren't clear might like. first up, built watchman accelerate tools have operate on extremely large trees, particularly one, has continued have gotten bigger , bigger since written: https://code.facebook.com/posts/218678814984400/scaling-mercurial-a...

php - Javascript button wont work or show -

i have been trying few hours try , working. however, code working fine second button not show on website. please help? echo "<td><input class=button_normal type=button value=google renter onclick=window.window.open(href='https://www.google.co.uk/')"; echo "<input class=button_normal type=button value=yahoo onclick=window.window.open(href='https://www.yahoo.co.uk')</td>"; you haven't added quotations onclick, value , class. forgot close input tag. echo "<td><input class='button_normal' type='button' value='google renter' onclick='window.window.open.href=\'https://www.google.co.uk/\''/>"; echo "<input class='button_normal' type='button' value='yahoo' onclick='window.location.href=\'https://www.yahoo.co.uk\''/></td>"; what suggest this: <script> function gotoyahoo() { wi...

java - Seemingly Pointless Regex Found in Code -

so inherited code , looking through code found regex seems allow pretty string. regex is: ^(?=\\s*\\s).*$ this on field saved database thought maybe doing basic sql injection protection. thoughts? can tell checking there start\end of line, have positive lookahead white space or non-white space character, , allowing characters. ^(?=\\s*\\s).*$ this says there cannot empty string .there has 1 non space character.so string ' ' not pass neither "" . this similar ^.*\s.*$ . lookaheads expensive can use this.

AngularJS, GAE, Python Flask and CORS -

i new angularjs , have following: python flask rest services running on google app engine (gae) angularjs front-end running on godaddy i have rest service i'm trying call angularjs gui. if access rest service curl, works fine, expected. i'm confident rest code not issue. know need account cors have added server side flask code: @app.after_request def after_request(response): response.headers.add('access-control-allow-origin', '*') response.headers.add('access-control-allow-headers', 'origin, x-requested-with, content-type, accept') response.headers.add('access-control-allow-methods', 'get,put,post,delete, options') return response my complete client-side code looks like: var app = angular.module('myapp', []); app.controller('formctrl', function ($scope, $http) { app.config(['$httpprovider', function ($httpprovider) { delete $httpprovider.defaults.headers.commo...

gis - Using mapbox, how can I add a borders layer over the top of the satellite image layer? -

essentially reproduce open gl example map - https://www.mapbox.com/mapbox-gl-js/example/satellite-map/ able use mapbox.js api add customer markers , clustering. the streets map has information, don't know how border line , country/state name layers added onto satellite map. you'll have edit mapbox-gl style file referencing: https://www.mapbox.com/mapbox-gl-styles/styles/satellite-v7.json . all available layer styles listed under "layers":[...] , e.g. { ... "layers": [{ "id": "background", "type": "background", "paint.labels": { "background-color": "rgb(4,7,14)" } }, { "id": "satellite", "type": "raster", "source": "satellite", ... }] } so, if you're looking keep borders , country , state labels, find objects ids represent these layers, "province_border...

No result from google API PHP -

i want distance 1 point using google api, i'm having issues. api link is: http://maps.googleapis.com/maps/api/directions/json?origin=55.061744,9.429565&destination=opnæsgård,%20hørsholm,%20denmark&alternatives=true&sensor=false if access link browser, correct distance however; when try access exact same url php script, error. php script: <?php print_r(file_get_contents('http://maps.googleapis.com/maps/api/directions/json?origin=55.061744,9.429565&destination=opnæsgård,%20hørsholm,%20denmark&alternatives=true&sensor=false')); ?> output php script: { "routes" : [], "status" : "not_found" } as can see, i'm getting 2 different results same url, , have no idea why. i have tried using curl in php script without luck. i hope can me //mikkel

c# - Windows Phone 8.1 MultipartFormDataContent is missing -

why can't use multipartformdatacontent , streamcontent ? getting following error: the type or namespace name 'multipartformdatacontent' not found (are missing using directive or assembly reference?) here code: var fileuploadurl = @"http://<ipaddress>:<port>/fileupload"; var client = new httpclient(); photostream.position = 0; multipartformdatacontent content = new multipartformdatacontent(); content.add(new streamcontent(photostream), "file", filename); await client.postasync(fileuploadurl, content) .continuewith((posttask) => { posttask.result.ensuresuccessstatuscode(); }); you have add system.net.http class using system.net.http

generics - Java wildcard versus Object in API -

i have existing java api method: public foo(collection<object> collection) {... } items read collection param, never updated. want change method to: public foo(collection<?> collection) {... } is change guaranteed transparent, safe, , without side effects users? note: not sure if important, api contains method: public foo(object object) { ... } having parameter collection<?> allows users pass whatever collection want method, because collection<?> super type of types of collections. in meantime, collection<object> compatible collection<object> values only, not collection<string> , collection<integer> , etc., makes difference between 2 approaches. to summarize, applying change break method's initial intent, work collections of object s only. the foo(object object) method method overload foo(collection<object> object) method , nothing more.

python - Subprocess.CREATE_NEW_CONSOLE -

i have python code. import subprocess subprocess.popen("airmon-ng check kill", creationflags = subprocess.create_new_console) python 2.7.6 on linux mint gives me following error: subprocess.popen("airmon-ng check kill", creationflags = subprocess.create_new_console) attributeerror: 'module' object has no attribute 'create_new_console' the same on windows 8.1 gives me this: traceback (most recent call last): file "c:\users\ben\dropbox\coding\jam.py", line 10, in <module> subprocess.popen("airmon-ng check kill", creationflags = subprocess.create_new_console) file "c:\python27\lib\subprocess.py", line 710, in __init__ errread, errwrite) file "c:\python27\lib\subprocess.py", line 958, in _execute_child startupinfo) windowserror: [error 2] system cannot find file specified subprocess.popen("airmon-ng check kill", shell=true) will want, presume open shell , execute ai...

reporting services - SSRS Report Parameter Available Values setting -

i trying set available values on ssrs report parameter properties. wish can add images not enough reputation. when select 'get values query' , don't have problem. however, message when trying use 'specify values' "field cannot used in report parameter expressions." i using following expression. appreciated. =first(fields!eventcode1.value, "history2") you cannot use same dataset "history2" field (column in report design) , in parameter list. create different dataset required value , use in parameter.

Toggle mobile data app on Android lollipop -

i see following posted user standpoint looking app or instructions toggle data. thanks. the setmobiledataenabled method no longer callable of android l , later as mentioned in post linked have root access phone? there aren't other workarounds know of. seems though intentional change. if xda member there free version supplied works on devices (see link list). http://forum.xda-developers.com/android/apps-games/app-toggle-data-5-0-widget-to-toggle-t2937936

lambda - How to implement my own finisher in a collector? -

welcome people! i wondering how implement own finisher not trival, identity function. header of collector is public class sequentialppscollector<t> implements collector<pair<t, double>, list<pair<t, double>>, list<t>> {...} inside there finisher method should transform list<pair<t, double>> list<t> @override public function<list<pair<t, double>>, list<t>> finisher() { return ... } this job return list -> list .stream() .map(pair::getleft) .collect(collectors.tolist()); here's how can transform list<pair<t, double>> list<t> : list<t> listoft = list.stream() .map(pair::getfirst) .collect(collectors.tolist()); so finisher function looks this: @override public function<list<pair<t, double>>, list<t>> finisher() { return list -> list.stream().map(pa...

c# - NancyFX + SSL - how to make "this.RequireHttps()" work on Linux? -

my self-hosted* nancyfx application use ssl, , use " this.requireshttps() " mark modules "ssl only". on windows followed tutorial: https://github.com/nancyfx/nancy/wiki/accessing-the-client-certificate-when-using-ssl after: netsh http add sslcert ipport=0.0.0.0:1234 certhash=303b4adb5aeb17eeac00d8576693a908c01e0b71 appid={00112233-4455-6677-8899-aabbccddeeff} clientcertnegotiation=enable i used following code: public static void main(string[] args) { list<uri> uri2 = new list<uri>(); uri2.add(new uri("http://localhost:80")); uri2.add(new uri("https://localhost:1234")); hostconfiguration hc = new hostconfiguration() { enableclientcertificates = true }; using (var host = new nancyhost(hc,uri2.toarray())) { host.start(); string runningon = "\n\n"; foreach(var item in uri2) { runningon += item+"\n"; } c...

r - When is Lexical Scope for a function within a function determined? -

i've looked @ other lexical scoping questions in r , can't find answer. consider code: f <- function(x) { g <- function(y) { y + z } z <- 4 x + g(x) } f(3) f(3) return answer of 10. question why? @ point g() defined in code, z has not been assigned value. @ point closure g() created? "look ahead" rest of function body? created when g(x) evaluated? if so, why? when f run, first thing happens function g created in f 's local environment. next, variable z created assignment. finally, x added result of g(x) , returned. @ point g(x) called, x = 3 , g exists in f 's local environment. when free variable z encountered while executing g(x) , r looks in next environment up, calling environment, f 's local environment. finds z there , proceeds, returning 7. adds x 3. (since answer attracting more attention, should add language bit loose when talking x "equals" @ various points not accurately reflec...

Infragistics Pivot Grid vs DevExpress Pivot Grid -

i'm working on winforms product merges both control libraries, , i'd see consolidated 1 or other. application uses infragistics more heavily devexpress seems candidate, pivot grid functionality utilizes devexpress making big hurdle jump in convincing others involved switch on infragistics. question how compare. i'm new both libraries, , instead of comparing documentation , features, i'm hoping know if has experience in switching 1 control other, , "gotchas" might in store if such move made. also, more powerful, , how so? give me expertise credit can use create argument 1 way or another. in advance!

Randomise quiz questions from xml file with javascript -

i created quiz in xml file. manage make hole code work properly. i'm stuck @ 1 point, how make quiz questions appear random? bellow can see 1 of question in javascript. <!-- question 1 --> <question id="q1" time="15" event=""> <box id="col1" position="relative" class="col-md-6" /> <box id="col2" position="relative" class="col-md-6" /> <text id="question1" position="relative" target="col1" x="0" margin-top="150" margin-bottom="40" anim="left" animtime="0.5"><![cdata[<p class="p_24">what's name?</p>]]></text> <image id="fb1image" position="relative" target="col1" x="0" y="0" margin-bottom="30" anim="none" class="img-responsive...

reload - Reloading Clojure Code/Routes - Issue with using the symbol vs. var -

i'm new clojure, , trying few simple web routes set up. want routes reload associated code in development, not in production. i able work using var's routes, not actual symbols. can explain if i'm doing wrong? if not, why var required? (def app-handler (let [formats [:json-kw :edn :yaml-kw :yaml-in-html :transit-json :transit-msgpack] wrapped-api (wrap-restful-format #'routes/api-routes :formats formats) combined-routes (compojure.core/routes wrapped-api #'routes/html-routes) with-defaults (wrap-defaults combined-routes api-defaults)] (if (is-dev?) ; development (wrap-reload with-defaults) ; production with-defaults))) (note #'routes/api-routes , #'routes/html-routes above). in manner described in more detail in answer , server ends capturing route functions when passed in, , if provide var, ensure server uses updated definitions. this considered normal way provide route or handler ...

Android: how can I know that a device has entered in a WIFI network -

lets xyz ssid of access point of network. want create broadcast receiver in service receive action when device enters region xyz of access point. using wifimanager's scanresult think scanresult generate event once. want notified when device enters xyz region, technically whenever list of access points changes. are there other better actions can listen for?

python - pickle.load() raising EOFError in Windows -

this how code with open(pickle_f, 'r') fhand: obj = pickle.load(fhand) this works fine on linux systems not on windows. showing eoferror. have use rb mode make work on windows.. isn't working on linux. why happening, , how fix it? always use b mode when reading , writing pickles ( open(f, 'wb') writing, open(f, 'rb') reading). "fix" file have, convert newlines using dos2unix .

.htaccess - htaccess rewrite rule without slash -

i trying , googling hours , can't find solution problem. want rewrite: domain.com/profile.php?user=abc > domain.com/abc i use: rewriterule ^(.*)/$ /profile.php?user=$1 [l] which works slash @ end. if try without slash rewriterule ^(.*)$ /profile.php?user=$1 [l] i internal server error! complete .htaccess errordocument 404 /errors/404.php errordocument 500 /errors/500.php rewriteengine on rewritecond %{http_host} ^www\.domain\.com$ [nc] rewritecond %{request_uri} !\.(css|jpg|gif|png|jar|js|html|htm|php)$ rewriterule ^(.*)$ http://domain.com/$1 [l,r=301] rewriterule ^share/([^/]*)/$ /share/share.php?id=$1 [l] rewriterule ^(.*)/$ /profile.php?user=$1 [l] <ifmodule mod_deflate.c> <filesmatch "\.(html|php|txt|xml|js|css|svg)$"> setoutputfilter deflate </filesmatch> </ifmodule> browsermatch ^mozilla/4\.0[678] no-gzip browsermatch \bmsie\s7 !no-gzip !gzip-only-text/html someboy have idea im doing wrong? thanks, kornel w...

ios - tableview has extra header when it uses auto layout in navigation controller -

i placed tableview inside navigation controller, embedded in tab bar controller. when used auto layout tableview, there spaces between top edge , first row. idea why? how can rid of it? thanks! the image here . try adding on viewdidload self.automaticallyadjustsscrollviewinsets = no;

Count occurrences of array elements with JavaScript -

this question has answer here: how count duplicate value in array in javascript 15 answers i have javascript array length 129. var fullnames = [karri, ismo, grigori, ahmed, roope, arto .....] i find how many times names appeared in array , store information in array this: var counter = [2, 5, 7, ..] where karri occured in fullnames array 2 times, ismo occured 5 times etc. ideas how it? i assuming fullnames array of strings. if so, can so: var occurences = { }; (var = 0; < fullnames.length; i++) { if (typeof occurences[fullnames[i]] == "undefined") { occurences[fullnames[i]] = 1; } else { occurences[fullnames[i]]++; } } console.log(occurences); // prints out like: {"karri": 2, "ismo": 5, ...}

Java SWT make a Label Scrollable -

i have label in group in swt , if contains many lines of text, make scrollable vertically. setting style parameter swt.v_scroll doesn't seem it. how can this? label not support scrolling. you use read text control scroll: text text = new text(parent, swt.read_only | swt.v_scroll);

Spring Security + AngularJS + Permissions: disabling all pages for non authenticated users other than login -

i want users have login before seeing other pages. if try access other page, have login first. i tried using following, keeps giving me http status 401 - access denied error. http.csrf().disable().exceptionhandling() .authenticationentrypoint(unauthorizedhandler).and() .formlogin().loginpage("/login").successhandler(authsuccess) .failurehandler(authfailure).and().authorizerequests() .antmatchers("/login", "/#/login", "/login.html", "/login.jsp", "login", "/login") .permitall().anyrequest().authenticated(); since using angularjs, might have that. still tried add /#/login part, still without result. you can achieve using routing. have @ below code. app.run(function($rootscope, $location,cachelogout) { // register listener watch route changes $rootscope.$on("$routechangestart", function(event, next, current) {...

MATLAB code break -

i have started running script on matlab takes days finish. usually, if changed mind , don't want wait finish , content intermediate results, highlight command window , press ctrl-c break code. now, have run matlab. desktop got kinda stuck in background. when try restore desktop toolbar, not restore. know task manager process running , consuming memory , cpu performance. so, kinda stuck. don't want kill process because need intermediate values in workspace, , can't open desktop break code using ctrl-c. is there solution? example, there command can used in command prompt act ctrl-c matlab? i using matlab r2012b , windows 8. quick try fix recent problem: try ty set higher priority matlab.exe in task manager. (right click -> priority -> higher normal). see if can window front. some approaches avoid problem in future: try optimize code. starters at: http://de.mathworks.com/help/matlab/matlab_prog/vectorization.html use matlab compiler faster ex...

date - rails 4 date_select helper custom Thai calendar -

i'm using rails 4 create application. , in form use date_select helper user select birth date. can change months name thai no problem. wondering if there way display years according thai calendar 543 years more christian calendar. example if year 2015 thai year 2015+543 = 2558 , if year 1991 thai year 1991+543=2534. please want know if can done :). thanks. you can use rails built in i18n support. create locale file thai language config/locales/th.rb , override default date format. if have th.yml file you'll have convert ruby hash , rename file th.rb work: { th: { date: { formats: { default: lambda { |date, _| "%d.%m.#{date.year + 543}" } } } } } now long locale set th default date show current year plus 543: i18n.locale = :th puts i18n.l(date.current) #=> "04.14.2558"

c# - Merge sort days of week in order of weekday and not alphabetical -

i have object array string property represents weekdays. want write merge sort algorithm sort object array in order of weekdays. i capable of writing merge sort algorithm wondering how sort in order of weekdays , not alphabet? in advance. use collection objects supports custom comparators, or implement icomparable on object as demonstrated here . use static map of property ordering or if can map string property dayofweek enum use built-in ordering.

php - Laravel 5 Multi-Tenancy App on Fortrabbit -

currently migrating laravel 5 multi-tenancy application on fortrabbit. account type floppy [ minimal setup development environment, multi-staging, playground or small production.] single database works fine, current grants permitting creating new databases. mysql> show grants; grant usage on *.* 'my-app'@'%' identified password '*12345678901234567890' max_user_connections 5 grant select, insert, update, delete, create, drop, references, index, alter, create temporary tables, lock tables, create view, show view on `my-app`.* 'my-app'@'%' is possible have multiple databases on floppy preset? please can suggest solution issue ? many thanks i replied private ticket already, it's worth answer public: you can not create database, since there 1 database included , limits, metrics , migration processes interact single database. this means setup multiple databases not work @ fortrabbit. you may book rds database ...

selenium - Should I be using @Before @After annotations with TestNG? Webdriver -

my question far framework goes should using such testng annotations @beforemethod @beforetest @aftertest? or have code in each class? for example why call firefox driver these @before annotations? can understand can reuse code , call chrome driver example, of time running same tests on chrome or other browsers require modifications pass, , can copy whole code anyway. so wouldn't make sense have code or call code directly class using @test? also, @aftertest why call teardown there? when can call in every class? are there advantages/disadvantages of using these annotations instead of writing code directly in class? for example, have file runs tests: package firefox; import org.testng.annotations.test; public class testgroup { ////////////////////////////////////////////////// @test(priority=1) public void sessiontasks() { session_tasks call = new session_tasks(); call.sessiontasks(); } //////////////////////////////////////////////// @t...

powershell - Rename fails because it represents a path or device name -

when run following command: rename-item some\long\path\filename.txt some\long\path\newname.txt i receive following error message: cannot rename specified target, because represents path or device name. i've tried wrapping paths in quotes , doesn't succeed either. for second argument, just use new name not full path . is, this: rename-item some\long\path\filename.txt newname.txt from docs , says of -newname<string> enter name, not path , name. if enter path different path specified in path parameter, rename-item generates error.

angularjs - Restangular and Rails, DELETE 406 not acceptable, Curl working -

why restangular 406 error, when want delete user? curl request working: curl -x delete -v "http://localhost:3000/api/v1/users/1" this restangular method: removeone: function(user) { var deferred; deferred = $q.defer(); if (_.isundefined(user.id) || _.isnan(user.id)) { alertsserv.logerror(err); deferred.reject(err); } else { user.remove().then(function(result) { return deferred.resolve(result); }, function(err) { alertsserv.logerror(err); console.log(err); return deferred.reject(err); }); } return deferred.promise; } and rails method (i'm using grape framework): delete ':id' user = user.find(params[:id]) user.update(hidden: true) user end request server: referer: http://localhost:4400/users origin: http://localhost:4400 host: localhost:3000 content-type: text/plain; charset=utf-8 content-length: 263 co...

javascript - AngularJS - State name passed into controller doesn't work -

i'm new angular , can't figure out why isn't working. when call {{$state.current.name}} in view works fine, try pass controller, state gets "lost". here setup: module: angular.module('app', ['ui.router']) .run(function ($rootscope, $state, $stateparams) { $rootscope.$state = $state; $rootscope.$stateparams = $stateparams; }) //followed boilerplate ui router setup view: <home-nav-bar></home-nav-bar> directive: angular.module('app') .directive('homenavbar', function () { return { restrict: 'e', templateurl: 'homenavbarview.html', controller: 'navctrl' }; }) })(); controller: angular.module('app') .controller('navctrl', function ($state, $scope) { alert($state.current...

java - Number format exception error in the code -

i having error in code state number format exception error. trying take ip address ex.172.16.10.100 & subnet mask 255.255.255.0. after taking value, trying convert them decimal binary format. getting error in line ipaddress = ipaddress + printbinaryformat(octet[i]); could please suggest me how can sorted out problem? import java.awt.*; import java.awt.event.*; import javax.swing.text.maskformatter; import javax.swing.*; import java.text.parseexception; import java.util.regex.pattern; import java.math.biginteger; import java.util.arrays; import java.util.stringtokenizer; public class update extends jpanel implements actionlistener { private jbutton cmdcalculate; public jformattedtextfield txtip, txtsub;//object name txtip,txtsub private jlabel lblcalculate, lblip, lblsub, lblnetwork, lblhost; private static string ipaddress = "",subenetaddress= "", networkaddress= "", lastaddress= ""; private jpanel pananswerarea, pannortharea, pa...

How do I use JavaScript when the HTML body loads? -

i tried doing on website, it's not working. need sort of link? <body onload=“alert(‘today - 10% off on weekend - coupon code zenten’);”> what have should work, problem can see quotes aren't standard quotes. try code. <body onload="alert('today - 10% off on weekend - coupon code zenten');">

java - Android Log In with Gmail not supported -

i 'm developing android application allows user login gmail . problem have integrating cycled clicking on log in button. here code use , idea why happens, or example can use? public class androidgoogleplusexample extends activity implements onclicklistener, connectioncallbacks, onconnectionfailedlistener { private static final int rc_sign_in = 0; // google client communicate google private googleapiclient mgoogleapiclient; private boolean mintentinprogress; private boolean signedinuser; private connectionresult mconnectionresult; private signinbutton signinbutton; private imageview image; private textview username, emaillabel; private linearlayout profileframe, signinframe; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); signinbutton = (signinbutton) findviewbyid(r.id.signin); signinbutton.setonclicklistener(this); image = (imageview) findviewbyid(r.id.image);...

ssas - Error when adding Analysis Services Data Source View from c# code -

i want create analysis services database, datasource , datasource view c# code. seems working fine until add mining structure , models , try process structure, following error: errors in high-level relational engine. data source view not contain definition 'dbo_challenger201501trainingall' table or view. source property may not have been set. the dsv meant contain same info table in data source. this code create data set , dsv: private static object filldataset(sqlconnection objconnection, dataset objdataset, string strtablename) { try { string strcommand = "select * " + strtablename; sqldataadapter objempdata = new sqldataadapter(strcommand, objconnection); objempdata.missingschemaaction = missingschemaaction.addwithkey; objempdata.fillschema(objdataset, schematype.source, strtablename); console.writeline(objempdata.tostring()); ...

python - How detect and plot intensity of asc file -

Image
i have photo of flame - data asc file contains matrix of pixels. in each pixel value of light intensity. my code of plotting: import os import numpy np import matplotlib.pyplot plt # open file path = "input/" dirs = os.listdir( path ) number_of_files = 0 # print files , directories file in dirs: if file.endswith(".asc"): img = np.genfromtxt (path+file) file = os.path.splitext(file)[0] #pasukamas vaizdas img = img.transpose () # figure , 1 subplot fig, ax = plt.subplots(1,figsize=(20,20)) ax.set_title(file, fontsize=60, y=1.03) plt.imshow (img, interpolation='nearest', origin='lower') plt.colorbar () plt.savefig ('output/' + file + '.png', bbox_inches = 'tight') number_of_files = number_of_files + 1 plt.close(fig) print (number_of_files) result: how can plot images in 3 ranges: from max intensity 36000 (red zo...

datatable - Matlab struct computations -

i download data yahoo! finance with: data = getyahoodailydata({'msft', 'axp'},'01/01/2000', '01/01/2015', 'dd/mm/yyyy'); and data stored 1x1 struct. want create tx2 matrix of daily adjusted closing prices msft , axp, column 7 in each table in struct. how can that? or better : there way make computations directly on information/prices in struct? you can access data in struct name. vecmsftadj = data.msft.adjclose; vecaxpadj = data.axp.adjclose; % if want n x 2 matrix madjclose = [vecmsftadj, vecaxpadj]; % personnaly prefer working table tadjclose = table; tadjclose.msftadj = vecmsftadj; tadjclose.axpadj = vecaxpadj;

c++ - Error 'LC_TYPE' was not declared in this scope -

i'm writing program in c++ supposed change letters in text uppercase letters(program works, setlocale not working). giving me error. [error] 'lc_type' not declared in scope. "should" work because official faculty literature. #include <iostream> #include <string> using namespace std; int main() { cout << "write something: " << endl; string tekst; //tekst=text getline(cin, tekst); setlocale(lc_type, "croatian"); // here problem... (char znak : tekst){ //znak=char, symbol... char velikoslovo = toupper(znak); // velikoslovo=uppercaseletter cout << velikoslovo; } cout << endl; return 0; } anyone knows how fix this?? i'm using orwell dev c++ 5.9.2. language standard (-std) iso c++ 11. here picture. don't need include #include <clocale> said here edit: #include <locale.h> should preferred <clocale> reduce portability issues. @cheers mentioning in comme...

java - Drawing from one panel class to another panel class. -

i have 2 classes. first class called fishy1, , second class called fishy2. code first class: import java.awt.graphics; import javax.swing.jpanel; public class fishy1 extends jpanel { fishy1 fishy1 = new fishy1(); /* graphics goes here */ public void paintcomponent(graphics g) { super.paintcomponent(g); g.drawoval(50, 50, 50, 50); } } as can see, code draws oval in fishy1. , here code second class: import java.awt.graphics; import javax.swing.jpanel; public class fishy2 extends jpanel { fishy2 fishy2 = new fishy2(); } as can see, in second class, there no paintcomponet method draw fishy2. so, question is, there way draw second class using paintcomponent method in first class? if there's no way it, please let me know. thank you. to achieve graphics replication between 2 swing classes @ same time public class fishs extends jpanel { //static list, fishes panel display same objects @ same positions private static list<ovalobj> lstova...

matlab - Most efficient way to store numbers as strings inside a table -

i want store efficiently numbers strings (with different lengths) table. code: % table numbers n = 5; m = 5; t_numb = array2table((rand(n,m))); % create table empty cells (to store strings) t_string = array2table(cell(n,m)); = 1:height(t_numb) ii = 1:width(t_numb) t_string{i,ii} = cellstr(num2str(t_numb{i,ii}, '%.2f')); end end what improve it? thank you. i don't have access function cell2table right now, using undocumented function sprintfc might work here (check here details). for instance: %// 2d array = magic(5) b = sprintfc('%0.2f',a) generates cell array this: b = '17.00' '24.00' '1.00' '8.00' '15.00' '23.00' '5.00' '7.00' '14.00' '16.00' '4.00' '6.00' '13.00' '20.00' '22.00' '10.00' '12.00' '19.00' '21.0...

jquery validation plugin field set using validator.element not working -

i trying validate set of fields in form using below code working first field only: var validator = $("#myform").validate({ rules: { stat: { required: true }, momlastname: { required: true }, momfirstname: { required: true }, mommaidenname: { required: true } } }); $("#btn1").click(function(){ var validator1 = $( "#myform" ).validate(); if(validator1.element( "#momlastname" ) && validator1.element( "#stat" ) && validator1.element( "#momfirstname" ) && validator1.element( "#mommaidenname" ) { ...

logging - Linux Forward all the syslog -

i working on solution can forward system events via udp port server happen on red hat linux box. a) possible bash script, if logic ? b) best technology/app use purpose ? thanks a) possible bash script, if logic ? b) best technology/app use purpose ? the syslog daemon has capability out-of-the-box; need add 1 line syslog configuration file on each machine, including consolidation server.. in fact, merging logs several machines onto 1 why written in first place.

mysql - SQL to get number count per minute -

i have dataset like: id name updated_at 1 test1 2014-06-30 09:00:00 1 test2 2014-06-30 09:01:10 1 test3 2014-06-30 09:01:23 1 test4 2014-06-30 09:01:43 1 test5 2014-06-30 09:02:02 1 test6 2014-06-30 09:02:34 1 test7 2014-06-30 09:03:22 1 test8 2014-06-30 09:03:28 i need count of rows minute last ten minutes. should return ten numbers being count of rows updated last. ideas on how , efficiently? last 10 results http://sqlfiddle.com/#!9/3d586/22 --get minute component of update time select minute(updated_at) sec --count number of records have minute , count(1) cnt mytable --use group ensure return 1 row per minute group minute(updated_at) --list recent working backwards order minute(updated_at) desc --return 10 results limit 10 results last 10 minutes http://sqlfiddle.com/#!9/3d586/26 --get minute component of update time select minute(y.d) min --count number of ...

jaxb - Processing Amazon MWS Feed Responses -

we set system processing amazon feeds variety of customers. working lot of customers , process feeds this: <amazonenvelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="amzn-envelope.xsd"> <header> <documentversion>1.02</documentversion> <merchantidentifier>redacted_8055</merchantidentifier> </header> <messagetype>processingreport</messagetype> <message> <messageid>1</messageid> <processingreport> <documenttransactionid>1016539</documenttransactionid> <statuscode>complete</statuscode> <processingsummary> <messagesprocessed>218</messagesprocessed> <messagessuccessful>218</messagessuccessful> <messageswitherror>0</messageswitherror> <...