Posts

Featured post

R - Plot: How to format in 10-base scientific notation and put it text, mtex, title etc functions? -

i have numeric variable, k=3.5e-5 (its values calculated throughout script). want write value somewhere (title, text in plot, etc) in plot as: k_{root} = 3.5 10^{-5} cm /d i have tried functions bquote , substitute , no 1 worked. let's put question in examples. have tried following: 1) png("exp_1.png") kroot = 3.5e-5 plot(1:10,1:10, text(4,9,bquote(italic(k[root])~"="~.(kroot)~"cm/d"))) dev.off() try favorite function, paste(). plot(1:10,1:10, text(4,9,gsub("e",paste("k[root]=",format(k,scientific=true),"cm/d",sep=" "),replacement=" 10^"))) you can replace "e" here using function gsub. i've edited answer include this. the output: > k=.0000035 > k [1] 3.5e-06 > gsub("e",paste("k[root]=",format(k,scientific=true),"} cm/d",sep=" "),replacement=" 10^{ ") [1] "k[root]= 3.5 10^{ -06 } cm/d"

geolocation - Windows Phone 8 - Keeping background location tracking active beyond four hours -

i'm in process of developing wp8 app makes use of background location tracking abilities provided os. idea monitor users position , notify them when near types of places. so far seems work fine , when running location tracking works expect. the problem is, seems phone times out background apps after around 4 hours, stopping location tracking. i can understand why microsoft did it, preserve battery life etc. there's not point having background location tracking app has manually restarted every 4 hours! if user chooses run app , made aware of potential battery hit, surely should able run indefinitely - point of course, if system runs out of resources or similar that's fair enough. does have experience this? there must hundreds of others apps in store have run issue have thought? , presumably there must way of keeping location tracking running? i've tried periodically updating live tile (using dispatchertimer) while tracking running doesn't seem enough ke

validation - How to pass paramaters like unix into windows batch file -

i need pass various parameters .cmd file unix format file.cmd -configuration=value -source=value -flag but, try this: startlocal @echo off cls setlocal set cmdline=%* set configuration= set source= set badargs= set validation= goto main :splitargs echo splitargs(%*) if "%*" neq "" ( /f "tokens=1,2,* delims== " %%i in ("%*") call :assignkeyvalue %%i %%j & call :splitargs %%k ) goto :eof :assignkeyvalue echo assignkeyvalue(%1, %2) if /i %1==-configuration ( set configuration=%2 ) else if /i %1==-source ( set source=%2 ) else ( rem append unrecognised [key,value] badargs echo unknown key %1 set badargs=%badargs%[%1, %2] ) goto :eof :validate echo validating set validation=fail if defined configuration ( echo -configuration ok if defined source ( echo -source ok if not defined badargs ( set validation=success ) ) ) goto :eof :main cl

c# - How to make tooltips show up when mouse hovers over data point -

i've been searching sort of tutorial focusing on how tooltips work, have not had luck. i have test project render line chart 5 data points. when instantiate chart object set ismapenabled = true . when define series try set tool tip. private void defineseries() { var series = new series(); series.tooltip = "#valy"; series.postbackvalue = "#index"; var x = new[] {0, 1, 2, 3, 4, 5}; var y = new[] {0, 4, 5, 3, 7, 2}; ( int = 0; < x.length; i++ ) { series.points.add( new datapoint( x[ ], y[ ] ) ); } series.charttype = seriescharttype.line; defineseriesstyle( series ); chart_.series.add( series ); } the chart renders expected, tooltip not display when mouse hovers on data point. missing step somewhere, have no idea is. edit: code shows action method , constructor chart view model , subsequent function call. public actionresult causedoutpoint() { var causedout = new causedoutvi

Line ending issue with Mercurial or Visual Studio -

i seem have strange issue caused either visual studio or mercurial. localised single project, i'm guessing in project configuration causing issue. at difficult specify point, when perform action in visual studio, update every line ending in given file, means when @ file in sourcetree, every line has changed. i can replicate using nuget add package dependency; packages.config entirely replaced. if commit changes, including line endings, later same issue occur. workaround have shelve changes , reapply them, whereupon lines written correctly. i'm not sure application blame here. did make mistake of allowing sourcetree change mercurial configuration, issue have fixed, i'm not sure if has persisted. i thought might issue mercurial.ini files or hgrcs don't seem contain untoward. here's mercurial.ini [ui] username = .... [auth] bb.prefix = https://bitbucket.org/ bb.username = .... bb.password = .... [extensions] mq = rebase = [web] allow_push = * push_s

Uncaught TypeError: Cannot read property 'parentNode' of null javascript -

this code should make element disappear list when dropped on element (called cookiemonster) addevent(cookiemonster, 'drop', function (e) { if (e.stoppropagation) e.stoppropagation(); var el = document.getelementbyid(e.datatransfer.getdata('text')); el.parentnode.removechild(el); return false; }); create auxiliar variable this addevent(cookiemonster, 'drop', function (e) { if (e.stoppropagation) e.stoppropagation(); var el = document.getelementbyid(e.datatransfer.getdata('text')); var aux = el.parentnode; aux.removechild(el); return false; });

ruby on rails - Is it the correct way to implement belongs_to relation with factory girl? -

i have realy easy model. user have role_id depends of role table (id, name) role reference. i want create users of types on rspec test, factory girl. my first idea factory :role name "guest" factory :role_admin name "admin" end factory :role_supervisor name "supervisor" end etc... have lot different roles end factory :user email password '123456' password_confirmation '123456' association :role, factory: :role factory :admin association :role, factory: :role_admin end factory :supervisor association :role, factory: :role_supervisor end etc... have lot different roles end in model have simple method : def is(role_name) return self.role.name == role_name end it's correct way to? realy need create factory role? can make stub function in factory girl each role? i realy new test stuff, thanks. factories should reflect models. class user has_many :products en