Posts

r - Need help creating the following sequence: -

in r, need create vector b = (1, 1+pi, 1+2pi, 1+3pi,...,1+19pi) . unsure how this. keep trying use seq command (i.e. seq(1, 1+npi n = 1:19) , that's totally wrong!), don't know proper syntax make work, never does. any appreciated. r needs multiplication operator. b <- 1+ seq(0,19)*pi or faster in situations speed might matter: b <- 1+ seq.int(0,19)*pi you use equivalent: b <- 1+ 0:19*pi because ":" operator has high precedence ( see ?syntax ), it's reasonable safe. careful understand precedence when use minus or plus sign might parse binary operator (remembering spaces ignored , unary-minus has higher precedence single-colon, binary minus or plus has lower precedence : > 1: 5+5 [1] 6 7 8 9 10

c# - CS0117 - Xamarin not detecting 'Resources' folders and files -

i have been developing xamarin.forms app, on ios , android. have run problem whereby code unable see resources being referenced in mainactivity.cs . have same error 2 different resources. i following along udemy course , instructor emphasising manually building of xml files, hence 2 types, axml , xml . first error /users/richardcurteis/desktop/onedrive/devshared/xamarinprojects/notetaker/droid/mainactivity.cs(35,35): error cs0117: `notetaker.droid.resource' not contain definition `menu' (cs0117) (notetaker.droid) second error: /users/richardcurteis/desktop/onedrive/devshared/xamarinprojects/notetaker/droid/mainactivity.cs(21,21): error cs0117: `notetaker.droid.resource.id' not contain definition `action_add' (cs0117) (notetaker.droid) mainactivity.cs using system; using android.app; using android.content; using android.runtime; using android.views; using android.widget; using android.os; using supporttoolbar = android.support.v7.widget.toolbar;...

laravel - Use of Command inside of a service -

im using laravel 5.0 , attempting set command queueing job inside of mailer service. my problem don't know how inject command dispatcher mailer service. my structure: services folder mailer.php (contains abstract class mailer ) usermailer.php (contains class usermailer extends mailer class) things have tried: i've tried use dispatchescommands trait within usermailer class , within mailer class. have tried inject \illuminate\contracts\bus\dispatcher constructer of usermailer class. in 3 instances error "class services\mailers\sendemail not found" mailer.php: abstract class mailer { public function emailto($view, $mdata) { mail::queue($view, $mdata, function($message) use ($mdata) { //code here - not relevant } }); } } usermailer.php: use illuminate\contracts\bus\dispatcher dispatcher; class usermailer extends mailer { protected $bus; function __construct(dispatcher $bus) { $this->bus ...

javascript - How do the regular expressions in sizzle.js work? -

if escaped characters in regular expression created in javascript regexp object need escaped again how following code in sizzle.js work - identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+" if \\\\\\\ = \ , \\\w = \w how \0 = \0 when single backslash used? when run in google console identifier "(?:\\\\.|[\w-]|[^-\\xa0])+" is mistake or not understanding correctly? if correct , how intended work purpose of \0 ? if regular expression needs contain backslash — e.g., because need \( (which matches actual ( ) or \w (which matches letter or digit or underscore) — , you're creating regular expression string literal, need write \\ , ends \ in regular expression. but in \0 example, regular expression doesn't need contain backslash. needs contain character u+0000 (which matches itself). string literal can contain \0 , ends character u+0000.

multithreading - How to start a gen_server or gen_fsm on demand in Erlang without race conditions? -

i need spawn several independent instances of same gen_fsm on demand, , able route calls correct instance. gproc library seems great way of registering processes arbitrary names. has function gproc:reg_or_locate/3 spawning things on demand without race conditions. way don't need supervisor - if crash they'll spawned on demand again. can't figure out how apply gproc:reg_or_locate/3 spawning gen_fsm or gen_server. what i've tried far: i call gen_server:start() through function, create intermediate process, give name intermediate process, intermediate process spawn gen_server , terminate, , end nameless gen_server. both gen_server , gen_fsm export enter_loop function seems need if feed gproc:reg_or_locate/3 , documentation reads: the process must have been started using 1 of start functions in proc_lib, see proc_lib(3) . and docs gproc:reg_or_locate/3 not mention through proc_lib. alternatively make intermediate process acquire name , atomical...

html - Auto adjust my background image size -

Image
i've been googling awhile , none of answers seem match need, need me this, thanks. my personal website is: http://simonykhsu.com refrences my code background image <div class="landing-header" style="background-image: url('skitrip_owlshead.jpg');"> i've tried implementing background image code cant find section in css file make background go skin color <div id="image-container"> <img id="image" src="skitrip_owlshead.jpg" alt="middle"/> </div> and second code above doesnt seem bring image middle... for centering image , set backgroud color can in image-container div <div id="image-container" style="text-align:center; background-color:#ccc;"> <img id="image" src="skitrip_owlshead.jpg" alt="middle"/> </div> #ccc sample color ... set color code..

swift - Exclamation mark prefix on variables during if statements and other as well? -

i'm confused after looking through similar questions of the(!) operator when prefixed on variable or other object in if statements, functions, etc? example: mutating func add(value: t) { if !contains(items, value) { items.append(value) } } the exclamation mark ! used 2 purposes. when see appear @ beginning of object, such in !contains(items, values) , means "not". example... let x = 10 let y = 5 if x == y { print("x equal y") } else if x != y { print("x not equal y") } the above code print => " x not equal y " . the logical not ( ! ) operator can used reverse boolean values. example... var falseboolvalue = false falseboolvalue = !falseboolvalue print(falseboolvalue) the above code print => " true " in addition usage logical not operator, exclamation mark used implicitly unwrap optional values. whenever see exclamation mark appear @ en...