Posts

Showing posts from March, 2015

.net - SynchronizationLockException in AsyncSeq.cache -

when call asyncseq.cache synchronizationlockexception @ line calling monitor.exit(iref). can problem is? please note i'm using asyncseq.cache in project without such problems. thanks! see below test code: [<entrypoint>] let main argv = let asyncop x = async { do! async.sleep x return x } let chooser x = if x > 1000 x else none let execute (input : asyncseq<int>) = async { printfn "first result... expect 3s sleep" let! r1 = asyncseq.trypick chooser input printfn "computing second result. expect no sleep" let! r2 = asyncseq.trypick chooser input printfn "done" return (r1,r2) } printfn "starting..." let v = [1000;2000;3000;300000] |> asyncseq.ofseq |> asyncseq.mapasync asyncop |> asyncseq.cache |> execute |>

python - Returning variable from function and printing said variable -

i know newbie question bare me. in code below run blackjack game , want total hand (user or dealer's) function. when run code no errors appear, when call function, total hand value not printed. states "this provides total of:" , number blank. appreciated! see code below: user_name = input("please enter name:") print ("welcome table {}. let's deal!".format(user_name)) import random suits = ["heart", "diamond", "spade", "club"] ranks = ['a', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'j', 'q', 'k'] deck = [(suit, rank) rank in ranks suit in suits] random.shuffle(deck,random.random) user_hand = [] dealer_hand = [] user_hand.append(deck.pop()) dealer_hand.append(deck.pop()) user_hand.append(deck.pop()) dealer_hand.append(deck.pop()) def handtotal (hand): total = 0 rank in hand:

javascript - How to pre select (pre click) first, or second table row in angularjs? -

i have 2 tables. in first table have table rows generated ng-repeat ng-click events. ng-click make request , output data in second table. second table empty first, , getting populated when `m clicking table rows first table. how can make request first table row (first table), or pre click , or pre select, can output default data in second table ? table1 <tr ng-repeat="task in todos" ng-show="todos.length > 0" ng-click="updatetaskinfo(task)> <td ng-bind="task.stuffs"></td> </tr> table2 <tr ng-repeat="stats in statsfromtable1" ng-show="statsfromtable1.length > 0"> <td ng-bind="stats .stuffs"></td> </tr> so table2 first empty, , when click table rows table1 make request, , pass data in table2. problem: how can have default data in table2, such data first, or second table row in table1 ? you can use ng-init directive https://docs.angula

python - Visualize results/coordinates of shortest path algorithms -

i working on navigation system , want visually check results of calculations. (dijkstra, a*, etc.) what options without getting google maps api, javascript, etc.? for part every query gives me list of coordinates: [[53.4704344, 9.9145282], [53.4704483, 9.9152652], [53.4704704, 9.9164389], [53.4704818, 9.9169074]] right build geojson linestring paste geojsonlint.com starts getting annoying. without knowing requirements, 2 things come mind are: matplotlib maps: http://matplotlib.org/basemap/users/examples.html geojson on http://gist.github.com : https://github.com/blog/1576-gist-meets-geojson i use gist first, it's git-able, zoomable, shows streets, etc. better depends on data (especially spatial scale).

javascript - jquery plugin, boolean callback parameter -

i trying pass boolean parameter callback inside jquery plugin parameter undefined. the onswitch callback parameter should alternate between true , false each time link clicked. using debugger can see value passed callback call function defined true or false inside callback implementation turns undefined. i have tried looking @ several other similar questions this this , this cannot seem work. this plugin definition: (function ($) { $.fn.switcherbutton = function (options) { // set default options var settings = $.extend({},$.fn.switcherbutton.defaults, options); this.click(function () { $.fn.switcherbutton.switched = !$.fn.switcherbutton.switched; settings.onswitch.call($.fn.switcherbutton.switched); }); return this; }; // plugin defaults – added property on our plugin function. $.fn.switcherbutton.defaults = { onswitch: function() {} }; $.fn.switcherbutton.switched = false;

ios - Prevent In-Call Status Bar from Affecting View -

is possible prevent in-call status bar affecting app's views? i in-call status bar ideally appear on top of view , not affect frame (neither changing height nor changing origin , pushing view down). is possible? answering own question, best solution able find manually change main view's frame start @ origin , have size of entire screen (both width , height). way, receive same effect if use navigation controller example, view remains in place , in-call status bar appears on top of (on different layer, without affecting app view's display).

.net - Date column Error while importing excel in c# -

Image
i reading simple excel file code . excel has 2 column : inputdate[date] , outputdate[date] .. after importing excel ; 2nd column value not coming ..it coming 42005 ,42006 instead of date .. 2nd column include holidays , needed output here code var filename = string.format("d:\\holidaymaster", request.physicalapplicationpath, guid.newguid().tostring().replace("-", string.empty)); var connectionstring = string.format("provider=microsoft.jet.oledb.4.0; data source={0}; extended properties='excel 8.0;;hrd=yes;imex=1'", filename); var adapter = new oledbdataadapter("select * [sheet1$] ", connectionstring); var adapter = new oledbdataadapter("select * [sheet1$]",connectionstring); dataset dsexcel = new dataset(); adapter.fill(dsexcel, "holidaymaster"); this issue 2nd column ..what missing ?if not proper way . right way holidays , date well ado.net chooses data type based on m

c# - Check if property type overloads == operator with Mono.Cecil -

i using mono.cecil write program injects il code property setters. problem need use equality operator on property within il . example: public class someclass { private int _property1; public int property1 { { return _property1; } set { _property1 = value; } } private string _property2; public string property2 { { return _property2; } set { _property2 = value; } } } and il code need inject in setters like: if (value != _property1) { //do stuff } same goes property2 . problem property2 of type string overloads == operator , in il instead of ceq code need call op_equality . question is: there way check if == operator overridden on property type using mono.cecil ? well, it's easy. i've created class public class foo { public static bool operator ==(foo a, foo b) { if (system.object.referenceequals(a, b)) { return true;

c# - Can't add file to TFS because "cannot lock item" of parent folder -

i'm trying add file tfs. when right click on file , choose "tfs > add", receive message (which has name in it): tf10151: cannot lock item $/blah/api code/packages/folder/file.dll check-out. item $/blah/api code/packages checked out hoppe, joseph in workspace xyz. if in source control explorer, reports packages folder has pending change of add, although there other files checked in underneath of it. if right click , tfs undo, reports "there no changes undo in selection or children of selection". if try tf undo, following error: tf undo /workspace:xyz;domain\mydomainaccount $/blah/api code/packages/folder/file.dll /server:http://domain:8080/tfs no pending changes undo. if try tf undo * /recursive, receive same message. i deleted folder. re-got tfs. same issue. how can add these files tfs? looked in source control explorer in vs2013 , vs2015. can these locked before computer format

unity3d - Errors loading scripts on prefabs from asset bundles -

i'm trying set project allow users download mini games post release. todo trying use asset bundles facilitate this, 1 containing new games scene , 1 containing assets , dlls scripts required. problem having when load scene or prefab bundle attached scripts still there warning says "the associated script can not loaded. please fix compile errors , assign valid script". there obvious missing or asset bundles not work way , i'm going have rebuild scene on load? you can't have scripts in asset bundles assigned references gameobjects would. can access scripts asset bundles loading them reflection. can programmatically attach them gameobjects, etc. there (for example, load assembly, find type, use addcomponent() on gameobject new loaded type). see http://docs.unity3d.com/manual/scriptsinassetbundles.html . but if overcome these hurdles, won't work on windows phone , it's against terms of service of apple's store, ...

linux - The advantages of read_lock and write_lock -

i studying read_lock , write_lock. it seems can use spin_lock instead of read-write lock. so wondering there advantages use read-write lock when use read_lock , write_lock, advantages using spin_lock? short googling turned paragraph up: sometimes, lock usage can divided readers , writers. example, consider list both updated , searched. when list updated (written to), important no other threads of execution concurrently write or read list. writing demands mutual exclusion. on other hand, when list searched (read from), important nothing else write list. multiple concurrent readers safe long there no writers. task list's access patterns (discussed in chapter 3, "process management") fit description. not surprisingly, task list protected reader-writer spin lock. (source: link ) so basically, using read_lock/write_lock gives more power regular spinlocks deny/allow different lock-users, depending on needs, in above example.

angularjs - Can't access $http data in angular in bootstrap modal -

i have used search function, didn't find solution solves problem. i'm having ui bootstrap directives in angular. before opening modal, want make $hhtp call data modal. works perfectly, except data not present in first opening modal. when click again data present. here's code: myapp.controller( 'jobscontroller', [ '$rootscope', '$scope', '$http', '$modal', function( $rootscope, $scope, $http, $modal ) { $scope.post = []; $scope.getjobs = function(id) { $http({ method: 'get', url: $scope.api, params: { 'type' : 'jobs', 'filter[p]' : id, 'filter[post_status]' : 'publish' } }). success( function( data ) { $scope.post = data[0]; }); }; $scope.open = function(id) { $scope.getjobs(id);

Android M - custom permission dialog style -

while implementing new android m permission model noticed permissions dialog not respect theming of styles.xml. in styles.xml override dialog , alertdialog style this: <item name="android:dialogtheme">@style/theme.dialog</item> <item name="android:alertdialogtheme">@style/theme.dialog</item> is possible change theming? or because system dialog in device settings? no, it's not possible. permissions dialog system dialog , hence can't change theme: the m developer preview introduces new app permissions model streamlines process users install , upgrade apps. if app running on m preview supports new permissions model, user not have grant permissions when install or upgrade app. instead, app requests permissions needs them, , the system shows dialog user asking permission.

Elasticsearch - Does it matter to which node I send an update? -

in elastic cluster muliple nodes, 1 master, matter node document update or delete request hits. currently find out master node asking 1 of nodes returns complete list of nodes , master node id use transport address for. point update traffic @ transport address. can requests sent node (as long available) no issues? the short answer no, doesn't matter. send data node like. an important thing remember "master" node change on time. let's have 3 node cluster , node master. if node ever goes down maintenance node b or c become master. another important node: never need know node master. that's wasted query time. send data a, b, or c, same. don't try outsmart es, let product lot of work you. we have 3 node production cluster behind load balancer , round-robin incoming requests 3 nodes.

c - saving hexadecimal value in .dat file -

in tutorial writer saves 48 bytes of padding followed address 0x601040 in file called data1.dat.the writer shows output: $ hexdump data1.dat -vc 00000000 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |aaaaaaaaaaaaaaaa| 00000010 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |aaaaaaaaaaaaaaaa| 00000020 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |aaaaaaaaaaaaaaaa| 00000030 40 10 60 00 00 00 00 00 |@.`.....| 00000038 i created file called data1.dat on 64 bit ubuntu containing: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4010600000000000 but when type hexdump data1.dat -vc get: test@test-virtualbox:~$ hexdump data1.dat -vc 00000000 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |aaaaaaaaaaaaaaaa| 00000010 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |aaaaaaaaaaaaaaaa| 00000020 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |aaaaaaaaaaaaaaaa| 00000030 34 30 31 30 36 30 30 30 30 30 30 30 30 30 30 30 |4010600000000

spring - APK file cannot be downloaded completely in android browser ,but can be download successfully in PC from my same web server? -

question: apk file can not downloaded android browser, can downloaded @ pc's browser. actually, apk file has 5.9 mb, can downloaded 1.2kb in total. therefore, got 'analyzed failed' error. web server: linux + tomcat 7.x + jdk1.7 , , set apk mime type in tomcat server web.xml. web app: spring 4.0.2 + spring mvc + mybatis, test link: http://127.0.0.1:8080/testapk/appstore/download download function : @requestmapping(value = "/appstore/download", method = requestmethod.get) public responseentity<byte[]> download() throws ioexception { httpheaders headers = new httpheaders(); headers.setcontenttype(mediatype.application_octet_stream); //linux env. file file = new file("/usr/appstore/test.apk"); if (!file.exists()) { //test env. windows file = new file("d:/test.apk"); if(!file.exists()){ throw new filenotfoundexception("oops! can not find app file."); }

ios - Error: Use of undeclared identifier 'label' -

i have @property label in header .h file in .m file. trying - [self.view bringsubviewtofront: label]; error: use of undeclared identifier 'label'; did mean '_label'? here's .m file #import "viewcontroller.h" @interface viewcontroller () @property (strong, nonatomic) iboutlet uiwebview *webview; @property (weak, nonatomic) iboutlet uiwebview *webview2; @end @implementation viewcontroller @synthesize scrollview; - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. draw1 = 0; scrollview.frame = cgrectmake(0, 300, 480, 55); [scrollview setcontentsize:cgsizemake(480, 55)]; openmenu.frame = cgrectmake(220, 270, 60, 30); // stuff************************************************************************************************************************ [super viewdidload]; uiwebview *webview=[[uiwebview alloc]initwithframe:cgrectmake(

clojurescript - Om ref cursor not re-rendering components when updated -

(ns ^:figwheel-always refs-test.core (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true] [sablono.core :as html :refer-macros [html]])) (enable-console-print!) (def app-state (atom {:items [{:text "cat"} {:text "dog"} {:text "bird"}] :selected-item {}})) (defn selected-item [] (om/ref-cursor (:selected-item (om/root-cursor app-state)))) (defn selected-item-title [_ owner] (reify om/irender (render [_] (html [:div (let [selected (om/observe owner (selected-item))] (if (empty? selected) [:h1 "nothing selected"] [:h1 (:text selected)]))])))) (defn selected-item-button [item owner] (reify om/irender (render [_] (html [:li [:button {:on-click (fn [] (om/update! (om/root-cursor app-state) :selected-item item)

How to get Yii2 formatted error message in production systems? -

Image
when yii2 used in debug mode , error occurs, shows error message along call trace, session, cookie , server info. sample image shown below. in production ready systems, not shown. however, there way pull formatted html variable in production systems, can emailed developer ease in debugging errors. if 1 has idea, please let me know. i tried using \yii::$app->mailer->render() passing @vendor/yiisoft/yii2/views/errorhandler/exception.php view, ['exception => $ex] data, layout file parameters. i'm getting undefined variable handler error. config log targets purpose: http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html

php - Doctrine2 one-to-one correctly done -

i have entity, a. , 1 b. a={id,name} b={id,details} i want one-to-one relation. each x there must 1 y b , reverse. thought solutions , came following. 1. id shared. but like. a={same_id,name} b={same_id,details} same_id unique b have foreign key same_id a.same_id. or have foreign key same_id b.same_id but want able details a. doing $a->getab()->getdetails(); means need implement 2). but sounds counterintuitive since mean, 1 must first create new b entity , create entity , point b entity. which looks b owns - , not want. and in reverse - if b has foreign key a, can still tell b's existence, can $a->getab()->getdetails(); ? 2. b has id, , has foreign key it: so like: a={id,name,bid} b={bid,details} bid unique, id unique but in way - seems wasting column a. b won't know it's attached perhaps bad practice. edit: doesn't solve problem, noticed must again first create b, since x needs point valid y b. 3. problem automatic generat

c# - Dynamic lambda expression (OrderBy) and nullable property type -

i'm trying dynamically create expression sort data database through entity framework. encountered 1 problem , cannot overcome it. maybe let me explain i'm trying do. goal create expression this: x => x.property where "property" name of property i'd specify dynamically. now, let's go class, represents table in database (i simplified make things more clear): public class mymodelclass { public long mylongproperty { get; set; } public decimal? mynullabledecimalproperty { get; set; } // important: it's nullable } it code, i'm trying create expression described earlier: // db entityframework context iqueryable<mymodelclass> list = db.mymodels.select(x => x); // x => var argument = expression.parameter(list.elementtype, "x"); // x.mynullabledecimalproperty var propertytoorder = expression.property(argument, "mynullabledecimalproperty"); // x => x.mynullabledecimalproperty var finalexpression = e

ios - When making an if statement can I make it so a void that is already running be overwritten? -

i have bug game red circle, blue circle, , yellow circle. can touch red circle. have random button selector called buttonchanger. whenever method run selects random button , after amount of time button disappears , method runs again. wondering if made statement if bluecircle.hidden = yes, redcircle.hidden = yes, yellowcircle.hidden = yes{ [self buttonchanger]; } this stuck. if run if statement buttons keep changing , continue overlap void until crashes. wondering if inside if statement can make if statement overrides previous 1 fine , running , void not overlap. so: if bluecircle.hidden = yes, redcircle.hidden = yes, yellowcircle.hidden = yes{ if buttonchanger running{ } else{ [self buttonchanger]; } } if wish see code here is: #import "viewcontroller.h" #import "viewcontroller.m" @interface viewcontroller () @end int randomnumber; double buttontime; int randomnumberbutton; int score; int highscoreint; @impleme

javascript - Successful post request appears as failed on Chrome -

Image
i'm building web application using sails.js framework (v0.10.5), angular.js (v1.3.13) front-end. on app's "sign-up" view, i'm using angular $http service post new user's email , password database, via sails restful api action. testing process on chrome, got unexpected behavior. on first try, chrome indicates "failed" status on post request, though new user gets inserted correctly in database (the server responds 200 in case). after deleting new entry db , pressing confirmation button again, chrome recognises request worked time around, indicating status "200 ok" on second request. first request (failed): second request (200): some other questions i've seen here regarding failed requests on chrome point adblock source of problem, i'm running chrome "stock", without plugins or extensions. are first request responding 200? (failed) status in chrome's inspector indicate otherwise. sounds perhaps

JSP: Quote symbol expected in Tomcat but not in WebSphere -

i'm using struts2 in application , following error when run app in tomcat org.apache.jasper.jasperexception: /myapp/testreview.jsp (line: 29, column: 45) quote symbol expected line29: <s:iterator value="testsummarylist" status=stat> <s:iterator> <tr> <td><s:property value="value" /></td> <td><s:property value="key" /></td> </tr> </s:iterator> </s:iterator> same code works fine when deploy app in websphere. fixes error in tomcat status="stat" is tomcat jsp compiler? no, it's way jstl (xml) parsed: http://www.herongyang.com/jsp/jstl-overview-general-syntax-of-jstl-tags.html having value of status attribute without quotes renders invalid, hence jasperexception when file parsed. the rest of stack trace this: org.apache.jasper.jasperexception: /myapp/testreview.jsp (line: 29, column: 45) quote s

php - SilverStripe 3 Filtering / Filtering Out DataObjects in a Function -

i've found examples of filtering nothing clear enough answer question. have following function grand children pages. i'm trying count them if meet criteria. in case if not have x,y,z include them in count. in other words add list / array of arguments function if true don't include them , filter them out. example if dealeronly = true ignore. i thought doing in template , using if / else count won't display haven't gone down route. alternative methods welcome. <% loop $grandchildren %>$count<% end_loop %> possible help: http://www.silverstripe.org/community/forums/data-model-questions/show/23507 docs here: (not quite need though) https://docs.silverstripe.org/en/3.1/developer_guides/model/searchfilters/ my function returns grandchild pages. public function getgrandchildren() { $ids = page::get()->filter(array('parentid' => $this->id))->getidlist(); $grandchildren = page::get()->filter(array(

keyboard shortcuts - Vim: refined paragraph jumping for tex files -

i'd change behaviour of { , } in vim tex files. in tex files paragraphs typically separated 1 or more blank lines. the cursor should placed nroff macros (e.g. .sh ) on first line of paragraph not on separating blank line. afaik, adjusting :set paragraphs not allow ( see here ). noteworthy corner cases be: \indent , \noindent , \paragraph{} , \subparagraph{} , more. unfortunately, comprehensive solution complicated, see https://tex.stackexchange.com/q/13085/in-how-many-ways-can-you-create-a-paragraph-in-latex . but don't need this. when use \paragraph{} add blank line before it. so question should limited blank lines , placing cursor on next non-blank line. remarks: mappings should not touch search history. jumplist should modified (same behaviour { , } ). this question motivated plugin limelight.vim junegunn. one way be: nnoremap g} :call search('^$\n\s*\zs\s')<cr> nnoremap g{ :call search('^$\n\s*\zs\s', 'b

actionscript 3 - Flash AS3 suddenly unable to delete values from objects -

this interesting. flash cs6 has lost ability iterate through objects , delete values (which did work before) delete values object keys for each(var key:string in scorekeep.scorecard) scorekeep.scorecard[key] = 0; the object (scorekeep.as) static public var scorecard:object = { "fish":6, "golfball":2, "gloves":8, "boot":4, }; you can trace object key. value still there. you using wrongly, not supposed for each for . for each take value, not key. you have " , " after last prop in object, assume that's typo (and should result in compile-time error).

Why Restrict Branch Deletion (Git)? -

why git not allow delete branches aren't in current branch's ancestral history? is because git doesn't have access them in object storage? git allow delete unmerged branch using git branch -d <branch-name> . reason refuses when branch name not merged (using lowercase -d ), reduce accidents throw away work meant merge. git can delete branch, wants sure you're doing meant do.

php - How can I split this dynamic list into 3 columns? -

i'm working older web app, , aside rewriting modern standards i'm trying make modifications simple possible. as can see below have dynamically created list of directory. code works can't figure out best way can split list 3 columns. i'm limited having thing work in ie9 (if works on other browser that's plus). nested tables mess, know, that's how thing built, i'm trying modify dynamic directory listing (with couple checkboxes). is there php this? or there css techniques can work? i'm bit lost on work blast past. <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#808080"> <tr> <td> <table width="100%" border=0 cellpadding=0 cellspacing=0> <tr align="center" bgcolor="#000000"> <td valign=bottom class="style6 normal"><strong>wat

netlogo - count the number of occurrences of each item in a list -

i have list 20 items , want count number of occurrences of each item in list.i know code below to-report frequency [i lst] report length filter [? = i] list end but not want write 20 lines like let c1 frequency 1 (list1) let c2 frequency 2 (list1) . . . let c20 frequency 20 (list1) that's: map [frequency ? list1] n-values 20 [? + 1] sample run: observer> set list1 [1 4 4 7 10 10 10 14] observer> show map [frequency ? list1] n-values 20 [? + 1] observer: [1 0 0 2 0 0 1 0 0 3 0 0 0 1 0 0 0 0 0 0]

JSON Arrays In Java -

so i'm looking add lot of users group messaging app allows http post requests , i'm going try use file upload function read json i'm little confused how write in java: { "members": [ { "nickname": "mom", "user_id": "1234567890", "guid": "guid-1" }, { "nickname": "dad", "phone_number": "+1 2123001234", "guid": "guid-2" }, { "nickname": "jane", "email": "jane@example.com", "guid": "guid-3" } ] } this exmaple of json file need write to, can explain how write in java? (it need nickname & phone_number fields, 2 per person) thanks! edit 1: sorry, wasn't clear. need use java produce file these contents. try try https://github.com/google/gson http://www.studytrails.com/java/json/java-go

c# - Writing to DB using EF6 in async process randomly yielding "property 'Id' is part of object's key ..." -

i have base class called servicepluginbase implements logging. public class pluginlog { public int id { get; set; } public int? serviceid { get; set; } public string event { get; set; } public string details { get; set; } public datetime datetime { get; set; } public string user { get; set; } } public class sqlpluginlogger : ipluginlogger { //efloggincontext maps pluginlog so: // modelbuilder.entity<pluginlog>().totable("log").haskey(l => l.id) private efloggingcontext _logger = new efloggingcontext(); public iqueryable<pluginlog> logitems { { return _logger.logitems; } } public void logevent(pluginlog item) { _logger.logitems.add(item); _logger.savechanges(); } } public abstract class servicepluginbase : iplugin { private ipluginlogger _logger; public servicepluginbase(ipluginlogger logger) { _logger = logger; } protected logevent(string event

python - Error ImportError: No module named 'np_plots' -

i have next code in python import np_plots npp import matplotlib.pyplot plt import numpy np import math m import scipy scipy.integrate import odeint def plotlimitcycle(bval): rhs = lambda x, t: [-x[0]+x[1]*x[0]**2, bval - x[1]*x[0]**2] xeq, yeq = bval, 1.0/bval cyclerad = m.sqrt(1-bval) nbh = min(cyclerad, 0.05) ic = [xeq-nbh/5.0, yeq-nbh/5.0] time_span = np.linspace(0,400,40000) fig = plt.figure() solution = odeint(rhs, ic, time_span) x, y = zip(*solution) plt.plot(x, y) axes = plt.gca() axxmin, axxmax = axes.get_xlim() axymin, axymax = axes.get_ylim() xmin = max(-15, axxmin) xmax = min(15, axxmax) ymin = max(-15, axymin) ymax = min(15, axymax) x,y,u,v = npp.ezdomainquiver2d([[xmin, xmax],[ymin, ymax]],[25,25],lambda x: rhs(x, 0),normalize=true) plt.quiver(x,y,u,v) plt.scatter([xeq],[yeq], color='red') plt.xlim([xmin, xmax]) plt.ylim([ymin, ymax]) plt.axes().set_aspect('equal

qt - Read and Update File Properties -

i'm using folderlistmodel display lists file names, can't figure out how read additional file properties. my primary concern read media fields such album, genre, length, etc. i'd able save fields if possible. ideally platform independent, if not possible windows important followed linux , android. i have been unable find information on this. i'm using qt 5.3.2, upgrade, if necessary. the properties ask not part of file system, file specific properties, stored meta data, , such, not covered file system model. you should use qtmultimedia or @ 3rd party solution taglib instead. last not least, qml audio , mediaplayer elements support reading metadata out of box. can use audio element load each file, extract needed metadata, , populate model each media file. not sure how efficient thou...

Use jQuery .on for dynamic future event not working for me -

i have dynamic form every post reply. using $('.upload_reply').on('submit', function(e){ . par jquery documentation future event should use 1 below not work me: $(document).on('submit', '.upload_repimg',function (e){ //also tried $("body").delegate('.upload_repimg', 'submit', function(){ if use these, page refreshed without submitting form. and if use current way, reply work 1st reply. means in case of 2 or more reply @ time, reply submit 1st one, next try, page refresh. where problem please. my form <form class="upload_reply" method="post" id="up_rep'.$sid.'" enctype="multipart/form-data"> <input type="file" name="file" class="repfile" id="'.$sid.'" value="" /> <input type="submit" class="upload_repimg" id="'.$sid.'" name="upload_btn" v

asp.net web api2 - Testing if a request is anonymous or authenticated WebAPI 2 + Identity -

i'm using webapi 2 + asp.net identity in 1 of apicontroller methods, test if particular http request coming authenticated client or not (i.e. whether request contains authorization header or not). the following works, maybe there better way? private authcontext db = new authcontext(); // api/orders/ [allowanonymous] public async task<ihttpactionresult> getorder(int id) { // applicationuser identityuser. applicationuser currentuser = null; try { usermanager<applicationuser> usermanager = new usermanager<applicationuser>(new userstore<applicationuser>(db)); currentuser = await usermanager.findbynameasync(user.identity.getusername()); } catch (exception) { } if ( currentuser == null ) { // anonymous request. // etc... } else { // authorized request. // etc... } } i using default routing template. option route 2 different methods authorized requests

jsf - How to override primefaces component class -

i override primefaces component class. so, have registered component class in faces-config.xml of war project. <component> <component-type>org.primefaces.component.dnd.droppable</component-type> <component-class>com.******.****.****.component.customdroppable</component-class> </component> this new test class: public class customdroppable extends droppable{ @override public void queueevent(facesevent event) { system.out.print("fffffffffffff"); } } the application built anew, uses old class. why ? else should ? in <component-type> , should specify component type, not component class. component type not resemble java fqn, can kind of string want. usually, can find right component type in api documentation of component class you'd replace. in case of org.primefaces.component.dnd.droppable class, it's defined constant field component_type value org.primefaces.co

c# - How to Convert a Byte Array to String for a DataGridView -

i have domain class user following properties (fields): userid (int) username (nvarchar(25)) securepassword (varbinary(32)) salt (varbinary(32)) securepassword , salt store byte array length of 32 may have guessed. if set my bindingsource.datasource = context.users.local.tobindinglist(); and my datagridview.datasource = bindingsource; i’ll error telling me handle dataerror event gridview. once empty method securepassword , salt columns show [x] every row. now, use linq render in anonymous type as: var data = u in context.users select new { u.userid, u.username, securepassword = bitconverter.tostring(u.securepassword), salt = bitconverter.tostring(u.salt) }; but don’t want anonymous type. in wpf have written converter inherits ivalueconverter, doesn’t seem available in winforms. appreciated , welcomed. use cellformatting event. like: void datagridview_cel

html - jQuery animate scrollTop not working with Firefox -

the following code skipping top in firefox, , works intended in chrome. i've read here on stackoverflow, firefox , ie need $('body,html') in order work, it's still not. in chrome, works perfectly. tips why it's not? $('body,html').animate( { scrolltop: 0 }, // animating ) { duration: 1000, // how fast animating easing: 'easeinoutexpo', // type of easing }); removing event.preventdefault(); code solved issue.

ruby - AWS S3 and CEPH / Rados Bucket permission inheritance -

i'm having issues creating publicly readable bucket. i'm working in ceph / rados store using amazon aws-sdk v 1.60.2 i created bucket similar many different tutorials with s3.buckets.create('bucketname', :acl => :public_read) i uploaded number of files s3.buckets['bucketname'] when go in , @ specific permissions bucket , it's internal objects bucket see has read permissions granted allusers group full_control set user created bucket with. objects not inherit anonymous read permissions. need objects in bucket readable anonymously. as note see these permissions when run s3.buckets['bucketname'].acl . when try run s3.buckets['bucketname'].policy following error makes no sense: /var/lib/gems/1.9.1/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token @ '<?xml version="1.0" encoding="utf-8"?><listbucketresult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><

javafx - How to create tabs dinamically keeping its content -

i trying create tabs dinamically. textfields, labels, buttons, etc keep position in tab. problem tab appears content empty. using fxml and, reading other post, tried create fxml new tabs don't know how. rellenarcamposmascota method wold create tabs dinamically. package mrpuppy.controller.cliente; import java.io.ioexception; import java.util.collection; import org.springframework.beans.factory.annotation.autowired; import org.springframework.stereotype.controller; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.fxml.fxml; import javafx.fxml.fxmlloader; import javafx.scene.parent; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.combobox; import javafx.scene.control.radiobutton; import javafx.scene.control.tab; import javafx.scene.control.tabpane; import javafx.scene.control.textarea; import javafx.scene.control.textfield; import javafx.scene.layout.borderpane; import javafx.scene.