Posts

Partial string matching in R -

this question has answer here: regular expression in base r regex identify email address 2 answers i trying remove 'bad' email addresses csv. have column of emails "abd@no.com," "123@none.com," "@," or "a". there wide range of email formats want try find , remove them all. my inital idea strictly @ end of email string - "@..." part. @ length of character, if email of length 1 or 2 not valid. if have list of bad emails, want generate new list of emails bad ones replaced na. below code have far not work , looks exact matches on pattern, not end of string. email_clean <- function(email, invalid = na) { email <- trimws(email) # remove whitespace email[nchar(email) %in% c(1,2)] <- invalid bad_email <- c("\\@no.com", "\\@none....

javascript - Angular how to set a model inside a factory service for use in a controller? -

is possible (and idea) set model (scope vars) in factory service? for example, have factory defines model below how can init in controller? (function () { 'use strict'; angular.module('services.auth', []) .factory('authorisationservice', function ($rootscope, $http) { // public variables var authservice = { user: { email: '', password: '' } }; return authservice; }); })(); controller: .controller('loginctrl', ['$scope', 'authorisationservice', function ($scope, authorisationservice) { authorisationservice(); }; }]); sure can way, love use service , keep controller clean. take @ demo: var app = angular.module('app', []); app.controller('mainctrl', function($scope, authorisationservice) { $scop...

types - Isabelle: generic datatypes and equivalence -

i'm starting making type generic in isabelle funny error messages once start using parenthesis. theory scratch imports main begin no_notation plus (infixl "+" 65) datatype typea = aa datatype typeb = bb datatype ('a, 'b) generictype = cc | plus 'a 'b (infixr "+" 35) lemma test1 : "x + y ≡ x + y" auto lemma test2 : "x + y + z ≡ x + y + z" auto lemma test3 : "x + (y + z) ≡ x + y + z" auto lemma test4 : "(x + y) + z ≡ x + y + z" lemma test5 : "(aa + aa) + aa ≡ aa + aa + aa" lemma test6 : "(cc + cc) + cc ≡ cc + cc + cc" lemma test7 : "(cc + aa) + cc ≡ cc + aa + cc" lemma test8 : "(aa + cc) + cc ≡ cc + aa + cc" everything fine test1-3, test 4 , 5 result in error: type unification failed: occurs check! type error in application: incompatible operand type operator: op ≡ ((x + y) + z) :: ((??'a, ??'b) generictype, ??...

vba - Outlook Custom Rule for Replying -

i'm getting e-mails through company e-mail server. because of of them coming forwarded mails info@mycompany.com. i'm looking rule when try reply mails reply forwarded e-mail address. thanks. you can create rule in outlook can trigger vba macro procedure. in code can whatever need using outlook object model. should following one: public sub test(mail mailitem) ' end sub where mail object passed parameter represents incoming email. instead of creating rules in outlook may consider handling incoming emails using newmailex event of application class. newmailex event fires when new message arrives in inbox , before client rule processing occurs. can use entry id returned in entryidcollection array call namespace.getitemfromid method , process item. finally, may find getting started vba in outlook 2010 article helpful.

html - Upload issue in MIME type while file open -

i have issue when try upload attachment application. when file still open on computer , try upload it, application/octet-stream mime type instead of application/sword. when close it, there no error while uploading. files have problem excel or word files , stocked in database. configuration of database allows save in binaries , text (depending of file) obviously, fix closing it. understand how/why file uploaded in mime type. edit : browser ie9 (compatibility ie7) , os windows 7. happends on each computer of service. (with same configuration)

clojure - Persisting State from a DRPC Spout in Trident -

i'm experimenting storm , trident project, , i'm using clojure , marceline so. i'm trying expand wordcount example given on the marceline page , such sentence spout comes drpc call rather local spout. i'm having problems think stem fact drpc stream needs have result return client, drpc call return null, , update persisted data. (defn build-topology ([] (let [trident-topology (tridenttopology.)] (let [ ;; ### 2 alternatives here ### ;collect-stream (t/new-stream trident-topology "words" (mk-fixed-batch-spout 3)) collect-stream (t/drpc-stream trident-topology "words") ] (-> collect-stream (t/group-by ["args"]) (t/persistent-aggregate (memorymapstate$factory.) ["args"] count-words ["count"])) (.build tr...

php - $_SESSION variables not passing between files -

i've got login script puts user details session variables. today moved website new host, , coding doesn't work. best can do, , still doesn't work main_login.php: (script above here gets $info database. far working) if($count==1){ session_start(); $_session['username'] = $info['username']; $_session['given'] = $info['given_name']; $_session['family'] = $info['family_name']; $_session['profile'] = $info['profile']; $_session['adultchild'] = $info['adultchild']; $_session['id'] = $info['id']; header("location:welcome.php"); } welcome.php: // check if session not registered , redirect main page. // put code in first line of web page. session_start(); if(!isset($_session['username'])){ header("location:main_login.php"); } the trouble when print of session variables nothing happens. i've tried doing var...