Posts

Showing posts from August, 2010

clojure - Composing a Buffy buffer from the middle of an array and finding out how much it has consumed -

i'd use buffy interpret binary data starting middle of array. need find out how many bytes of array have been consumed buffy. let's have dynamic buffer definition this: (ns foo.core (:refer-clojure :exclude [read]) (:use [byte-streams]) (:require [clojurewerkz.buffy.core :refer :all] [clojurewerkz.buffy.frames :refer :all] [clojurewerkz.buffy.types.protocols :refer :all]) (:import [io.netty.buffer unpooled bytebuf])) (def dynbuf (let [string-encoder (frame-encoder [value] length (short-type) (count value) string (string-type (count value)) value) string-decoder (frame-decoder [buffer offset] length (short-type) string (string-type (read length buffer offset)))] (dynamic-buffer (frame-type string-encoder string-decoder second)))) i hoped use netty bytebuf parse bunch of b...

python - AttributeError: 'Series' object has no attribute 'sort_values' -

pyldavis library prepare method has crashed while using pandas library inside. here code: def load_r_model(filename): open(filename, 'r') j: data_input = json.load(j) data = {'topic_term_dists': data_input['phi'], 'doc_topic_dists': data_input['theta'], 'doc_lengths': data_input['doc.length'], 'vocab': data_input['vocab'], 'term_frequency': data_input['term.frequency']} return data movies_model_data = load_r_model('movie_reviews_input.json') print('topic-term shape:%s' %str(np.array(movies_model_data['topic_term_dists']).shape)) print('doc-topic shape: %s' %str(np.array(movies_model_data['doc_topic_dists']).shape)) movies_vis_data = pyldavis.prepare(np.array(movies_model_data['topic_term_dists']), ...

javascript - How to align text in bottom of label -

i've got problems text in label bottom of label. i'm animating falling text, label "seem" fall should, text stays on top, it's not following label downwards. please check jsfiddle out, press button see problem. have tried many different ways without coming working solution. http://jsfiddle.net/kaze72/jq6ua/ .uppgifter { vertical-align: text-bottom; } seems not help! you can try .uppgifter { display: table-cell; vertical-align: bottom; background-color: yellow; } jsfiddle updated jsfiddle .uppgifter 's height in animate method matches #spelplan 's height.

image - Building fiware/cygnus docker from source code - issue with the last step (8) -

when trying build fiware/cygnus docker image source code, last part of it, namely building of image jar with: docker build -f ./docker/dockerfile -t fiware/cygnus . gives following message in last step (8) of building process: "no source files specified". @ point building appears aborted. the building done according: https://github.com/telefonicaid/fiware-cygnus/tree/master/docker (source code from: https://github.com/telefonicaid/fiware-cygnus.git ), , amounts first building java archive (jar) provided source code, , subsequently building docker image jar file. 1) reason message in step 8? since, according documentation, no other steps mentioned. also, "target" directory, mentioned in documentation, appears not made. 2) however, there appear image, no tags ( cf "-t fiware/cygnus" flag in command mentioned above). result fact building done step 8, leaving incomplete image? many thanks! step 8 is step 8 : add ./target/*.jar /tm...

android - Custom Navigation drawer without ListView and ActionBar -

i use navigation drawer in app, should [this]: http://godpowerturbo.com/app/uploads/nav.png [a], make design have used imagebutton in place of listview plus i'm not using fragments , open navigation drawer on imagebutton click exits null pointer exception. i have searched everywhere on google , stackoverflow couldn't fix error. this main activity drawerlayout dw; percentrelativelayout rl; imagebutton nav; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); log.d(tag, "oncreate()"); session session = new session(mctx); log.e(tag, "log_id: " + session.getlogid()); session.putall(); rl = (percentrelativelayout) findviewbyid(r.id.nav_left); dw = (drawerlayout) findviewbyid(r.id.nav_drawer); nav = (imagebutton) findviewbyid(r.id.nav_menu); nav.setonclicklistener(ne...

jquery - Prettyphoto and event click on iframe -

uui'm trying detect click event inside iframe. found (not working) solution on so, , wasn't able fix them , them working on code. how can detect target of click event inside iframe? since prettyphoto loaded $("a[rel^='prettyphoto']").prettyphoto(); i hoping solution similar to $("a[rel^='prettyphoto']").prettyphoto( $('#myframe').bind('click', function(event) { alert("cliked"); }) ); but doesn't work. idea? use .on() $('#myframe').on('click', function(event) { alert("cliked"); })

doctrine - Symfony doesn't find pdo_sqlsrv driver -

i have 1 problem doctrine (or server configuration, don't know problem) in symfony2 web. have been looking answer since several days haven't found yet. i need connect symfony web remote microsoft sql database through doctrine. reason, have added "database_driver: pdo_sqlsrv" param in app/config/parameters.yml, when try execute (in mac) command like: php bin/console doctrine:database:create or php bin/console doctrine:generate:entities appbundle/entity/product i following error: [doctrine\dbal\driver\pdoexception] not find driver [pdoexception] not find driver i have checked phpinfo , driver doesn't appear (only mysql, sqlite). don't know if it's possible add mssql, because in microsoft sql server functions ( pdo_sqlsrv ) appears needs running on windows. is not possible access mssql database without windows? (if yes, how can it). would need windows hosting? thanks in advance. i'm using sql server on last project. ...

r - Display a googleVis plot in knitr html document -

i'm new using googlevis , have problem don't know how manage. how can display googlevis graphic in html knitr document?, see templates , make code --- output: knitrbootstrap::bootstrap_document: title: "test file" theme: spacelab highlight: tomorrow theme.chooser: false highlight.chooser: false --- ```{r results='asis',echo=false,fig.width=14, fig.height=8,fig.align='center', message=f, warning=f} load("cltvt.rdata") #<-table data suppresspackagestartupmessages(library(googlevis)) a4=gvismotionchart(cltvt, idvar="cltv", timevar="fecha") print(a4,tag='chart') ``` but when run code (in rstudio) space plot displayed in blank (when plot directly in r plot displayed without problems) . missing detail run code properly?, help

java - Trying to get a file path to a public folder on android device and get its content -

Image
i looking file path of folder , content. folders public folder can access connecting device computer. how go getting file path access these public folders , content? so once connect computer device these folders see , there 1 says "folder items from" , can't seem figure file path in order access content . this how i'm trying content , log them file fileofepubs = new file("/data/data/folder of items from/"); file[] direpub = fileofepubs.listfiles(); if (direpub.length != 0){ (int = 0; < direpub.length; i++){ string filename = direpub[i].tostring(); log.i("file", "file name = " + filename); } } you appear looking @ root of external storage . programmatically, access via environment.getexternalstoragedirectory() . requires either read_external_storage or write_external_storage permission.

python - Loading a date in Numpy genfromtxt -

i'm trying import simple csv file numpy genfromtxt can't manage convert data of first column dates. here code: import numpy np datetime import datetime str2date = lambda x: datetime.strptime(x, '%y-%m-%d %h:%m:%s') data = np.genfromtxt('c:\\\\data.csv',dtype=none,names=true, delimiter=',', converters = {0: str2date}) i following error in str2date: typeerror: must str, not bytes the problem there many columns, i'd prefer avoiding specification of column types (which numerical). the problem argument passed str2date of form b'%y-%m-%d %h:%m:%s' . these bytes, rightfully cannot parsed datetime object. solution problem quite simple though, should decode byte string utf-8 string: str2date = lambda x: datetime.strptime(x.decode("utf-8"), '%y-%m-%d %h:%m:%s')

xcode - How to track the exact issue for the crash in iOS -

Image
when debugging iphone app, got error , app got crashed. have added exception break point didn't point in code , crashed in main.m . here adding screen shot of xcode window when app crashed. how can find exact issue crash this? is possible? please help. enable zoombie error description in log. if edit scheme want turn on zombies (in "product" menu, select "edit scheme"), go "run foo.app" stage in left panel, , "arguments" tab on right. can add nszombieenabled "environment variables" section , set value yes, in xcode 3. in xcode 4.1 , above, there's checkbox on "diagnostics" tab of "run" stage "enable zombie objects".

java - org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized -

i adding sessionlistener in springinitializer class extends webapplicationinitializer. using sping 4.0.. jars. getting below exception :- org.apache.catalina.core.standardcontext.listenerstart exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beandefinitionstoreexception: failed parse configuration class [com.myapp.container.impl.config.springconfiguration]; nested exception java.io.filenotfoundexception: class path resource [org/springframework/security/config/annotation/web/configuration/websecurityconfigureradapter.class] cannot opened because not exist @ org.springframework.context.annotation.configurationclassparser.parse(configurationclassparser.java:177) @ org.springframework.context.annotation.configurationclasspostprocessor.processconfigbeandefinitions(configurationclasspostprocessor.java:306) @ org.springframework.context.annotation.configurationcl...

Could not load type 'ServiceStack.Common.Extensions.ReflectionExtensions' -

my question i encounter exception, message following. could not load type 'servicestack.common.extensions.reflectionextensions' assembly 'servicestack.common, version=3.9.38.0, culture=neutral, publickeytoken=null'. my ide visual studio 2012 , , ormlite.sqlite.32bit version 3.9.38 . got nuget today. tried anyversion ormlite.sqlite nuget , including 32 , 64 bit versions. my models followings [alias("ttconfig")] public class config : ihasid<int> { [autoincrement] public int id { get; set; } [stringlength(128)] public string key { get; set; } public string value { get; set; } } and, run exception when create tables. ormliteconnectionfactory fac = new ormliteconnectionfactory("data source=ttdb.sqlite;", sqlitedialect.provider); using (var db = fac.createdbconnection()) { //! when call createtables(), throw exception. db.createtables(false, typeof(config)); } stacktrace of exception. the stacktr...

c# - Calculating NaiveBayes -

i chosen data set following attributes. zipcode (1000, 4000) 2 zip codes have chosen. city (sydney, brisbane) 2 cities have chosen. optus telstra just represent in area how many people using optus network , how many people using telstra network. i have 100 records , calculated mean, std. dev , count. now, stuck should find naviebayes apart mean & std deviation? , if possible can provide sample formula too. working on c#. and, calculating precision required? thanks. naive bayes useful predict output out of 2 networks(0,1) using independent parameters zip, city , others. so use "naivebayes bernauli formula" modulate , predict case. suggest read rcran logistic regresion formula- https://cran.r-project.org/web/packages/hsaur/.../ch_logistic_regression_glm.pdf ram

c# - Capture complete page design into image, windows phone 8.1 -

Image
i developing windows mobile app 8.1, i'd convert complete design in page(wpf control) image. have implemented screenshot capture task using this its capture viewing area not complete page if page design has scroll-able. if want convert complete page design scrollable design, how this? please check below screen shot this problem, var rendertargetbitmap = new rendertargetbitmap(); await rendertargetbitmap.renderasync(uielement); its capture current viewing area instead of complete uielement content. is possible capture complete uielement content? you can use rendertargetbitmap class. create extension method takes uielement of want create image (in case page) , file generated image saved. method return true if successful: public static async task<bool> savevisualelementtofile(this uielement element, storagefile file) { try { var rendertargetbitmap = new rendertargetbitmap(); await rendertargetbitmap.renderasync(element)...

angularjs - Protractor tests in Angular: how to check variable in scope without ng-bind and ng-model? -

how check variable in scope without ng-bind , ng-model ? <span ng-if="user.code === 'yellow'"> <span class="glyphicons glyphicons-circle-remove text-danger"></span> yellow </span> <span ng-if="user.code === 'green'"> <span class="glyphicons glyphicons-circle-exclamation-mark text-warning"></span> green </span> i check user.code protractor with ng-bind , ng-model doesn't work browser.expect(element(by.binding('user.code')).gettext()).to.eventually.equal(''); or browser.expect(element(by.model('user.code')).getattribute('value')).to.eventually.equal(''); error : nosuchelementerror: no element found using locator: by.binding("user.code") nosuchelementerror: no element found using locator: by.model("user.code") you should not testing kind of stuff in protractor. should write tests perspec...

html - How to stick the footer to bottom? -

i'm trying keep footer bottom, did in way: #footer { background-color: #3a3a3a; border-top: 1px solid #222222; font-size: 11px; overflow: auto; } #footer #footer-content { padding: 10px 15px; display: inline-block; float: left; } this html: <div id="footer"> <div id="footer-content"> ... now in page footer fixed correctly, in other page i've lot of space between controls , footer, in few words there lot of space vertically. happean footer instead of remain fixed footer go @ bottom of controls, if resize window footer return @ bottom correctly other page. don't understand why, wrong in css? have tried position: fixed ? fiddle: https://jsfiddle.net/ar2smzyr/ css: .footer { background: red; height: 100px; position: fixed; bottom: 0; width: 100%; } html: <div class="footer"> content </div>

Modifying/ manipulating text using vim, sed or awk (again) -

sorry 1 more quick question regarding previous 1 - want add in underscore between peak number , range. i'm getting odd results vim. macs_peak_1 range=chr1:569425-569625 5'pad=0 3'pad=0 strand=+ repeatmasking=none ttcgctctaagattaaaaatgccctagcccacttcttaccacaaggcaca cctacaccccttatccctatactagttattatcgaaaccatcagcctact to macs_peak_1_range=chr1:569425-569625 5'pad=0 3'pad=0 strand=+ repeatmasking=none ttcgctctaagattaaaaatgccctagcccacttcttaccacaaggcaca cctacaccccttatccctatactagttattatcgaaaccatcagcctact thank harriet awk '/macs_peak/{$1=$1"_"$2;$2="";}1' your_file

angularjs - Isolating scopes with multiple jquery ui date pickers in angular -

i'm having problems isolating scopes of date-picker-search directive below. (function(){ 'use strict'; angular.module('ganeshaapp') .directive('datepickersearch', function(){ return { restrict: 'a', require: 'ngmodel', link: function(scope, element, attrs, ngmodelctrl){ $(function(){ element.datepicker({ dateformat: 'd/m/yy', onselect: function(date){ scope.date = date; scope.$apply(); } }) }); } } }) })(); in first attempt tried using code, expected changing 1 input ng-model="date" updates inputs referencing directive same ng-model. <tr> <td>publication date:</td> <td greyed-dates> betw...

html - marker should point to location and if user drags the marker the location should be in textbox -

i new google maps. have gone through many posts didnt find wanted. want achieve this: improve-my-city but able user location , drag marker. want marker move position entered on map on button click vice versa when user drags marker address should in textbox. infowindow not show. as working asp.net html page different , map shows in iframe on aspx page. textbox , button in .aspx page <div id="map"></div> <script> function initmap() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(showposition, showerror); } else { x.innerhtml = "geolocation not supported browser."; } function showerror(error) { switch (error.code) { case error.permission_denied: x.innerhtml = "user denied request geolocation." break; case error.position_unavailable: x.innerhtm...

mysql - PHP: Calling a method on a class property that is an object -

can let me know if practice or if there better cleaner way it? looks clumsy me, i'm wondering if there's reason haven't seen before. class { public $instance_of_b; function __construct () { $this->instance_of_b = new b; } function deeper_hello() { $this->instance_of_b->say_hi(); } } class b { public function say_hi() { echo "hello, b!"; } } $instance_of_a = new a; $instance_of_a->deeper_hello(); it parses php it's not semanticly wrong, there cleaner way of doing it? i should say, not code, it's method. i'm doing creating sql class uses pdo. in sql class, i'm recording pdo , pdostatment objects in properties of sql class. rather instantiating b inside of a, better pass b via constructor. called dependency injection , doing no longer tightly coupled b. class { public $instance_of_b; function __construct ($b) { $this->instance_of_b = $b; } function deeper_hello() { $t...

sql server - SQL - Recursive conditions in SELECT clause -

i not best in sql sorry if i'm asking stupid questions :) let's have table this: |id| name | nickname | |==|========|============| | 1| jo| banana| | 2|margaret|the princess| | 3| perry| monkey| | 4|margaret| queen| | 5| | rat| | 6| | cat| where nickname unique. and i'm trying results this: |id| name | nickname | display_name | |==|========|============|=======================| | 1| jo| banana| jo| | 2|margaret|the princess|margaret (the princess) | 3| perry| monkey| perry| | 4|margaret| queen| margaret (the queen)| | 5| | rat| rat| | 6| | cat| cat| basically logic is: if name empty display_name = 'nickname' if name unique display_name = 'name' if name not_unique display_name = 'name (nickname)' can achieve 1 sql query only? if - how? if not - alternatives? cur...

How to disable Year/Month navigation in Bootstrap DatePicker -

Image
i'm tryng disable month/year navigation button on bootstrap datepicker. i want disable ability users click on "month/year" text in between navigation arrows , can't figure out. thanks all. if want restrict users use arrows can use maxviewmode option $('#datepicker').datepicker({ maxviewmode: 0 }); see example: http://jsfiddle.net/zcvq0yhh/17/

python - Create unique dictionaries for two keys in a list of dictionaries -

i getting list of dictionaries in following format api, : eg. xlist =[ { "id":1, "day":2, name:"abc", ... }, { "id":1, "day":3, name:"abc", ... }, { "id":1, "day":2, name:"xyz", ... }, { "id":1, "day":3, name:"xyz", ... },... ] so, store/optimize queries in db have convert them in format. what efficient or other way generate following structure? unique_xlist =[ { "id":1, "day":2, name:["abc", "xyz"], ... }, { "id":1, "day":3, name:["abc", "xyz"], ... }, ] what doing : names = list(set([ v['name'] v in xlist])) #-- unique names templist = [{k:(names if k == 'name' else v) \ k, v in obj.items()} obj in xlist] #-- append unique names unique_xlist= {v['day']:v v in templist}.values() #- find unique dicts i...

shell - How to test connection to mysql server? -

i'm trying figure out how test if connection possible given set of user, pw, , db name info. parse out user_name, password , database_name environment file , test if connection possible. if possible continue rest of script , if not possible, exit , print error message. want test connection because have larger script runs can't tell fails if fail. you can make no-op connection: mysql -e '\q' if run suitable .my.cnf file, $? zero. if try use different user: mysql -u root -e '\q' then error message (which can redirected away 2>/dev/null ) , $? non-zero. note limited test, compared using language sql library , connection spans multiple commands. e.g. 1 connection may succeed, later 1 may fail because of network conditions or change user's conf file or server authentication.

html - Manual wrapping with pre -

i'm trying design page display email messages. have in pre white-space: pre : >> donec tincidunt lobortis orci, cursus dui ullamcorper >> vel. praesent vel enim et lectus aliquet laoreet. in tempus >> sodales. now, when screen-y small , overflows, don't want use overflow: auto . instead, want wrap automatically this: >> donec tincidunt lobortis orci, cursus >> dui ullamcorper vel. praesent vel enim >> et lectus aliquet laoreet. in tempus >> sodales. i wouldn't mind using :before if able select text in page , copy email message as-it-is. okay, let's first try solve simpler version of problem: let's there no ">> " prefix in front of each line. can use white-space: normal , when copy out text, 1 line without line-breaks , undesirable. so, how browser wrap text without losing ability copy out line-breaks displayed? you use : pre { white-space: pre-wrap; white-space: -moz-pr...

java - web.xml configuration Display tag -

how can configure display tag in jsp project? warning: standardwrappervalve[jsp]: pwc1406: servlet.service() servlet jsp threw exception java.lang.noclassdeffounderror: org/apache/commons/lang/unhandledexception for display tag there not required configuration in web.xml display tag used pagination sorting in grid data there put more 3 jar (1)displaytag-1.2,(2)displaytag-export-poi-1.2,(3)displaytag-portlet-1.2 and write tag lib in jsp page like: <%@ taglib uri="http://displaytag.sf.net" prefix="display"%> your code griding: <display:table name="sessionscope.yourlistname" pagesize="5" sort="list" cellspacing="10" cellpadding="5"> <display:column property="var1" title="title1" sortable="true" /> <display:column property="var2" title="title2" sortable="true" /> ...

c# - How do you properly dispose of a CancellationTokenSource in a ViewModel? -

typically, when trying asynchronous tasks in view-model, code looks (simplified): public class myviewmodel { private cancellationtokensource cts { get; set; } public async task process() { cts = new cancellationtokensource(); try { await longrunningtask(cts.token); } catch (operationcanceledexception) { } } public async task cancel() { cts.cancel(); } } the problem cancellationtokensource idisposable . mean place in using block, or there more since stored in private property?

c# - How to parse an xml file and return default value if no element found -

i wrote simple method in c# parse given xml file , return value of specific node. works fine i'd return default value if node not found instead of throwing exception. how can this? can method written better? offered. john public static string readconfigurationfile(string configurationfilename, string root, string section, string name) { try { string currentdirectory = path.getdirectoryname(system.reflection.assembly.getexecutingassembly().location); configfilepath = directory.getparent(currentdirectory) + configurationfolder + configurationfilename; xdocument configxml = xdocument.load(configfilepath); var result = setting in configxml.descendants(root) .descendants(section) select setting.element(name).attribute("value").value; return result.first(); } catch (exception ex) { return string.empty; } } here's sample o...

javascript - Target nested tables InDesign script -

i trying change width of column in nested table, isn't working. doing wrong? works fine when table not nested. un-nested works: app.activedocument.stories.everyitem().tables.everyitem().columns[0].width = "53mm"; nested doesn't work: app.activedocument.stories.everyitem().tables.everyitem().tables.everyitem().columns[0].width = "53mm"; insert .cells.everyitem().texts[0] solve issue. try code app.activedocument.stories.everyitem().tables.everyitem().cells.everyitem().texts[0].tables.everyitem().columns[0].width = "53mm";

sql - Selecting ranges of dates without overlapping -

i have following relational schema: dates(date: date, code: char) code can st,mn,mx,ed. example: ╔════════════╦══════╗ ║ date ║ code ║ ╠════════════╬══════╣ ║ 2001-10-01 ║ st ║ ║ 2001-10-20 ║ st ║ ║ 2001-11-01 ║ mx ║ ║ 2001-11-01 ║ mn ║ ║ 2001-11-14 ║ mx ║ ║ 2001-11-15 ║ ed ║ ║ 2001-11-15 ║ mx ║ ║ 2001-11-27 ║ mn ║ ║ 2001-12-01 ║ st ║ ║ 2001-12-01 ║ ed ║ ║ 2001-12-02 ║ mx ║ ║ 2001-12-03 ║ mx ║ ║ 2001-12-05 ║ ed ║ ║ 2001-12-20 ║ st ║ ║ 2001-12-21 ║ mn ║ ║ 2001-12-24 ║ mx ║ ║ 2001-12-31 ║ ed ║ ╚════════════╩══════╝ i need to: find range of dates starts 1 having st code , ends 1 has ed code. in range there can't tuple st or ed code (the ranges can't overlap). do without procedures , 1 select statement (i can use with). i did part 1 following query: select distinct on (dt.date) dt.date start, dt1.date end dates dt, dates dt1 dt.type='st' , dt1.type='ed' , dt.date<dt1.date; i can't figure out how ...

wordpress - Creating an event using Events Manager and JSON API -

i'm creating app using json api plugin in conjunction events manager plugin in wordpress , want create event using create_post controller. for example: url:'http://yoursite.com/api/posts/create_post/?nonce=' + eventnonce + '&type=event&title=' + eventtitle, that's enough event created draft, i'm not allowed publish until have location , date info in proper format. i found adding &location= or &date= doesn't work. i tried custom parameters ( &custom[_event_end_date]= ) referenced in previous support question , none of works me.

php - Make a simple array from a complex array -

i have array ($query) database: array ( [0] => array ( [category] => mercedes ) [1] => array ( [category] => bmw ) [2] => array ( [category] => bentley ) ) i want make array $category: array ( [0] => mercedes [1] => bmw [2] => bentley ) i tried array_merge() result doesn't want. you have iterate on array, pick each 'category' value. foreach ($query $array) { $newarray[] = $array['category']; } $newarray contain values require.

c# - Binding properties (width/sorting) of DataGrid on dynamic TabPage -

Image
i've created little wpf test project demonstrate question. project contains single wpf window. window contains tabcontrol . pages of tabcontrol created dynamically bound itemsource . so here xaml: <window x:name="window" x:class="testwpf.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:testwpf" title="mainwindow" height="350" width="525"> <tabcontrol x:name="tabcontrol" borderthickness="0" itemssource ="{binding medialists, elementname=window, notifyonsourceupdated=true}"> <tabcontrol.itemtemplate> <datatemplate datatype="{x:type vm:medialist}"> <textblock padding="2" text="{binding mediatypename}" horizontalalignment="center" verticalali...

python - Matplotlib timedelta set ylim -

Image
i have series of graphs plotting different days on x axis , time in minutes on y axis. graphs have different max value , want set ylim same them. tried selecting max value pandas dataframe, , setting max using ylim. gave error message: typeerror: ufunc 'isfinite' not supported input types, , inputs not safely coerced supported types according casting rule ''safe'' i tried manually setting limit 7 should keep visualisation similar below, instead get: how can amend limits when y axis in timedelta , measured in minutes? note 1e11 on upper left corner of first plot? means y -axis scaled 1e11. manually setting ylim 7e11 give desired results. however, 700000000000 minutes veeery long time! might indicate problem in calculations. better check code divisions - maybe divide small numbers. reason error message posted.

javascript - JQueryMobile Open phone gallery and select an image -

is possible open native gallery of phone (ios, android,windows phone etc...)and select image jquerymobile? , if how? tnks response i've resolved problem html5 form, because it's impossible javascript accede file system.

oop - is there any more standard way to resume function from jQuery ajax call? -

i trying write big project involves of lot of code. that's why want separate functionalities different files. the first file, datajs, make ajax call data json file. second file, showjs want display data obtained datajs file. when comes implementation, realise ajax call takes longer time , though include datajs , showjs in order, showjs still null data therefore made function called continuefromdatajs() in showjs file , call continuefromdatajs() @ end of ajax success function. i think it's rather makedo solution. there standard way it? in addition, intellisense in visual studio gone. despite separate files, there way make visual studio intellisense datajs? thank you sorry, don't know how add follow question code for simplicity rename of files , take part out of it. hope helps code in html code in datajs.js var planets = []; var jsondata = null; $(function () { $.getjson("scripts/planetdata.js", function (data) { //p...

r - Drawing choropleth map - 'Aesthetics error' in ggmap -

everyone! i attempting create choropleth map of denver metro area, showing different housing values census tract. when try map, gives me 'error: aesthetics must either length 1 or same data (83658): x, y, group, fill'... how solve problem, can create visual map? i read through various questions none appeared answer problem. suggestions appreciated. sample of 20 (of 588) data points below. thanks! 1.load packages library(maptools) library(ggmap) library(ggthemes) library(rgdal) 2.select, define, plot initial map denvermetro <- c(-105, 40, -104.8535, 39.3760) denvermetromap <- get_map(location=denvermetro, source = "google", maptype = "roadmap", zoom = 10, crop=false) ggmap(denvermetromap) 3.import polygons shp file denvermetrocensustracts <-readogr(dsn = "c://users/john/denver_housing_project/...

python - google app engine - how to add lib folder? -

i keep getting importerror: no module named twitter when it's in lib module details: the twitter module located in lib directory. the lib directory has empty init .py i'm getting error on page outside directory when take twitter module out of lib directory , import twitter, works when put twitter module inside lib , lib import twitter, or when import twitter, or saying import lib.twitter says, go **** , it i tried doing this: https://cloud.google.com/appengine/docs/python/tools/libraries27?hl=en , suggests to: to tell app how find libraries in directory, create (or modify) file named appengine_config.py in root of project, add these lines: from google.appengine.ext import vendor # add libraries installed in "lib" folder. vendor.add('lib') and tried import twitter, , tried lib import twitter, , says, "haha, nice try." now what? tl;dr - comments right. 'lib' not module, it's folder containing modules. needs...

php - Auto Generated HTML - Adobe GoLive Script -

alright client of mine has 40 auto generated html pages. done through js lib called adobe golive javascript library. i'm not sure happened has stopped working during site move. don't want try , fix because don't idea of auto generating html page off of 1 click of link. question is there javascript library out there still active or should use php make these pages? use php. reasons: javascript can turned off on client side. php supported on web servers, and render page regardless of client has. php quite easy learn , has lots of documentation , tutorials surrounding it.

angularjs - Is there any performance difference between $emit event and casual function call in ng-click? -

<script> angular.app('app', []) .controller('ctrl', function($scope) { $scope.$on('foo', function(evt, msg) { alert(msg); }); $scope.foo = function(msg) { alert(msg); }; }); </script> <div ng-app="app"> <div ng-controller="ctrl"> <button ng-click="foo('some msg')">call</button> <button ng-click="$emit('foo')">emit</button> </div> </div> is there significant performance different between 2 cases? case should go by?

javascript - Managing temp files -

i have website developed django deals big number of tiff files consist of lot of layers. in order give user ability browse layers, extracted layer , saved them jpegs in temp folder when user chooses tiff file, , can browse layers. problem is bad idea keep jpegs stored next browsing request! suggestions manage extracted jpegs when requested , rid of them? use tempfile library import tempfile tempfile.namedtemporaryfile() temp: temp.write('some data') temp.flush()

python - How to resample a Pandas dataframe of mixed type? -

i generate mixed type (floats , strings) pandas dataframe df3 following python code: df1 = pd.dataframe(np.random.randn(dates.shape[0],2),index=dates,columns=list('ab')) df1['c'] = 'a' df1['d'] = 'pickles' df2 = pd.dataframe(np.random.randn(dates.shape[0], 2),index=dates,columns=list('ab')) df2['c'] = 'b' df2['d'] = 'ham' df3 = pd.concat([df1, df2], axis=0) when resample df3 higher frequency don't frame resampled higher rate how ignored , missing values: df4 = df3.groupby(['c']).resample('m', how={'a': 'mean', 'b': 'mean', 'd': 'ffill'}) df4.head() result: b d c 2014-03-31 -0.4640906 -0.2435414 pickles 2014-04-30 nan nan nan 2014-05-31 nan nan nan 2014-06-30 -0.5626360 0.6679614 pickles 2014-07-31 ...