Posts

Showing posts from September, 2015

Formatting string according to pattern without regex in php -

how can format arbitrary string according flexible pattern? solution came using regular expressions, need 2 "patterns" (one search , 1 output). example: $str = '123abc5678"; desired output: 12.3ab-c5-67.8 i use pattern in variable (one user can define without knowledge of regular expressions) this: $pattern = '%%.%%%-%%-%%.%'; so user have use 2 different characters (% , .) a solution regex this: $str = '123abc5678'; $pattern_src = '@(.{2})(.{3})(.{2})(.{2})(.{1})@'; $pattern_rpl = "$1.$2-$3-$4.$5"; $res = preg_replace($pattern_src, $pattern_rpl, $str); //$res eq 12.3ab-c5-67.8 way complicated since user need define $pattern_src , $pattern_rpl. if string vary in length, more complex explain. yes, write function/parser builds required regular expressions based on simple user pattern %%.%%%-%%-%%.%. wonder if there "built in" way achieve php? thinking sprintf etc., doesn't seem trick. ideas?

vba - Copy Excel Data With Source Formatting -

i recorded macro this, , copied macro code , adapted how needed it. however, issue source formatting not kept when paste on new worksheet. step did miss? must selection.pastespecial right? below non-working syntax selection.autofilter activesheet.listobjects("db1.accdb").range.autofilter field:=1, criteria1:="pink" lastrow = 2 worksheets("sheet2").range("a65536").end(xlup).row next lastrow range("a1", "m" & lastrow).copy sheets.add after:=activesheet selection.pastespecial paste:=xlpasteallusingsourcetheme, operation:=xlnone, skipblanks:=false, transpose:=false range("a1").select activesheet.name = "pink" no need selection.pastespecial , normal copy method sufficient. sub copytest() '/ source destination '-------- ----------- sheet1.usedrange.copy sheet2.cells(1, 1) application.cutcopymode = false end sub << --this work c

python - How can I feed keys in to a terminal for unittesting purposes -

i'm working on plug-in vim, , i'd test behaves correctly, under start-up, when users edit files e.t.c. to this, i'd start terminal, , feed keys in it. i'm thinking of doing python script. there way this? in pseudo-python might this: #start terminal. here konsole konsole = os.system('konsole --width=200 --height=150') #start vim in terminal konsole.feed_keys("vim\n") #run vim function tested konsole.feed_keys(":let my_list = myvimfunction()\n") #save return value file system konsole.feed_keys(":writefile(my_list, '/tmp/result')\n") #load result python open('/tmp/result', 'r') myfile: data = myfile.read() #validate result assertequal('expect result', data) i think should verify core functionality of plugin inside vim, using unit tests. there's wide variety of vim plugins, provide additional mappings or commands, invoked user, , leave behind side effects in buffer, or output

ios - Align baselines with characters in large line heights with Text Kit -

Image
when draw attributed string fixed line height text kit, characters aligned bottom of line fragment. while make sense on 1 line characters varying in size, breaks flow of text multiple lines. baselines appear decided largest descender each line. i've found article people behind sketch explaining exact problem in bit more detail , showing solution does, not explaining how achieved this. this want basically: when showing 2 lines large line height, result far ideal: the code i'm using: let smallfont = uifont.systemfont(ofsize: 15) let bigfont = uifont.systemfont(ofsize: 25) let paragraphstyle = nsmutableparagraphstyle() paragraphstyle.minimumlineheight = 22 paragraphstyle.maximumlineheight = 22 var attributes = [ nsfontattributename: smallfont, nsparagraphstyleattributename: paragraphstyle ] let textstorage = nstextstorage() let textcontainer = nstextcontainer(size: cgsize(width: 250, height: 500)) let layoutmanager = nslayoutmanager() textstorage.append(n

java - .class files under target/classes folder Maven -

i have maven project once run maven build mvn clean install target/classes folder generated suspicious .class file. can see .class file under folder. how can identify .class file being pulled from. i searched in source code , can't find results string search. this class, rmiinvocationwrapper_stub.class

xcode - CocoaPod Storyboard error: -

i made cocoapod include in main project, splash screen animations used while app loading page go to. builds fine in cocoapod project, when include local copy in other projects local folder, following error on storyboard... error: not enough arguments provided; input document operate on? any idea on going on here? it ended being issue .podspec file. had .source_files spec including not swift file, storyboard.. apparently xcode not cool (shown below).. spec.source_files = 'cocoapodprojectfolder/source/*.{swift, storyboard}' to fix had move storyboard file correct spec: resource_bundle... spec.source_files = 'cocoapodprojectfolder/source/*.{swift}' spec.resource_bundle = {'cocoapodproject' => 'cocoapodprojectfolder/source/*.{storyboard}'}

php - WooCommerce dashboard. Edit order page - Product display -

Image
i need sort order - products different displaying woocommerce. need sort products in order variantion (i know how). problem don't find how can edit page. know can't edit woocommerce core files, woocommerce updates code disapears. i know can done function somehow so how can edit order page product display ? image want edit (order products display. display variantion):

jQuery UI dialog buttons click once -

i have jquery dialog buttons. when user clicks on button, take time, make ajax call , stuff. during time, user able click again , again. want avoid behaviour. i know, jquery has method one() . want. how achieve on dialog buttons? my current code is: $d.dialog({ buttons: [ { text: "potrdi", click: function() { // stuff } } ] }); you can set button disabled using jquery-ui button's disabled option: button( "option", "disabled", true ); here example of how set correctly on clicked button (the button enabled again after 2 secons): $( function() { $( "#dialog-confirm" ).dialog({ resizable: false, height: "auto", width: 400, modal: true, buttons: { "delete items": function(e) { btn = $(e.toelement).button( "option", "disabled", true ); settimeout(functio

Capitalizing certain chars in a string in C -

i'm looking way convert upper case letters lower case letters user inputted string. problem conditional ignored, , every character changed, not upper case ones. record tried converting chars ints using atoi encountered same issue above. #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char letter[100]; scanf("%s", letter); int i; for(i=0; letter[i]!='\0'; i++){ if((letter[i]>='a')||(letter[i]<='z')){ letter[i]=letter[i]+32; } } printf("%s", letter); return 0; } i suggest using library functions, islower() , isupper() , toupper() , tolower() this. in case, this: for(i = 0; < strlen(letter); i++) { letter[i] = tolower(letter[i]); }

php - Trouble with inarray -

so i'm trying create check date , produce different variable result depending on date today. this current code: <?php for($i = 0; $i <= 25; $i++) $dates[] = date("d", strtotime( "+$i days")); foreach ($dates $today) { if (in_array($today, array('01', '05', '09', '14', '19', '24'), true)) { $tweet = "one"; } if (in_array($today, array('02', '06', '10', '15', '20', '25'), true)) { $tweet = "two"; } if (in_array($today, array('03', '07', '11', '16', '21'), true)) { $tweet = "three"; } if (in_array($today, array('04', '08', '12', '17', '22'), true)) { $tweet = "four"; } } echo $tweet; ?> problem if date

mysql - uknown column in field list trigger -

what issue here? i'm using workbench. when try insert table staff error. i'm trying insert table values ;staff' depending if on input 1 of columns. error code: 1054. unknown column 'position' in 'field list' 0.046 sec create trigger your_trigger_name after insert on staff each row begin if position = 'senior instructor' insert new.senior_instructor values (new.employee_name, new.date_of_birth); end if; end; delimiter || create trigger your_trigger_name after insert on staff each row begin if new.position = 'senior instructor' insert senior_instructor values (new.employee_name, new.date_of_birth); end if; end || delimiter ;

javascript - DataTables: json is undefined in initComplete() -

Image
jquery.datatables.min.js: datatables 1.10.12 i need access table rows after data has been loaded ( deferred ). , can't because json undefined me inside initcomplete function. despite table loaded , see data. also, there settings data inside function. why that? did forget option? my code: var data_table = task_submit_table.datatable({ "initcomplete": function (settings, json) { console.log(json); }, "processing": true, "serverside": true, "deferrender": true, "deferloading": 0, "ordering": true, "order": [[ 0, "desc" ]], "ajax": { "url": "get_task_list/", "type": "post", "datatype": "json" }, "columns": [ {"title": "id", "data": "id"}, {"title": "date", "data": &

vb.net - What is the best way to read an XML file from Embedded resources? -

dim xmldoc new xmldocument() dim xmlnode xmlnodelist dim integer dim str string xmldoc.loadxml("countybyregion.xml") this throws an exception of type 'system.xml.xmlexception' occurred in system.xml.dll not handled in user code. additional information: data @ root level invalid. line 1, position 1. i dim fsxml new filestream("countybyregion.xml", filemode.open, fileaccess.read) and use xmldoc.load(fsxml)

tidyverse - gather and spread function in R -

i have created data frame using below code: stocks <- data.frame(time = as.date('2009-01-01') + 0:9, x = rnorm(50, 20, 1), y= rnorm(50, 20, 2),= rnorm(50, 20, 2), z=rnorm(50,20,4)) ) i have applied gather function data frame: res<-stocks%<%gather(company, value,-time) while trying spread res getting error: spread(data=res, key=company , value = value) error: duplicate identifiers rows we need sequence column avoid error duplicate identifiers... stocks %>% gather(company, value,-time) %>% group_by(company) %>% mutate(i = row_number()) %>% spread(company, value)

php - Redirect to route without get params with Laravel -

i have legacy urls params want redirect route without these parameters. in web.php have: route::get('/', ['as' => 'welcome', 'uses' => 'pagecontroller@welcome']); urls http://example.com/?page_id=5 should redirect (302) http://example.com/ . in controller tried following: public function welcome(request $request) { if($request->has('page_id')) { redirect()->to('welcome', 302); } return view('welcome'); } it reaches redirect the url still has ?page_id=5 in it. like: redirect()->to('welcome', 302)->with('page_id', null); made no difference well. best way in laravel 5.3 redirect page parameters after ? 1 without parameters? you should use return in front of redirect() method make work: public function welcome(request $request) { if($request->has('page_id')) { return redirect()->route('welcome'); }

rust - How to pass `Option<&mut ...>` to multiple function calls without causing move errors? -

since it's possible pass mutable reference vector around (without causing moves), how can option<reference> passed functions multiple times without causing borrow checking errors? this simple example shows happens when option<&mut vec<usize>> passed multiple times function: fn maybe_push(mut v_option: option<&mut vec<usize>>) -> usize { let mut c = 0; if let some(ref mut v) = v_option.as_mut() { in 0..10 { v.push(i); c += i; } } return c; } fn maybe_push_multi(v_option: option<&mut vec<usize>>) -> usize { let mut c = 0; c += maybe_push(v_option); c += maybe_push(v_option); c += maybe_push(none); return c; } fn main() { let mut v: vec<usize> = vec![]; let v_option = some(&mut v); println!("{}", maybe_push_multi(v_option)); } ( playground ) gives error: error[e0382]: use of moved value: `v_option`

java - Validating model - received from JSON (spring mvc) - good practices -

i have simple pojo class (models) created json format (received frontend). what approach validate these values ? example if number not null, if number (nor string), etc. you can use validate attributes annotation @valid in restcontroller , put @notnull or @notempty in model. exemple: @restcontroller @requestmapping(value="/book") public class bookcontroller { @requestmapping(method=requestmethod.post) public responseentity<void> save(@valid @requestbody book book){ //save book } } @entity public class book{ @notempty(message="msg") private string name; }

xaml - Exchange default ControlTemplate for control -

i want modify controltemplate appbarbutton items. possible in onlaunched() or somewhere else? windows.ui.xaml.controls.appbarbutton.templateproperty = windows.ui.xaml.application.current.resources["defaultappbarbuttoncontroltemplate"] windows.ui.xaml.controls.controltemplate; the code above doesn't work (read property), should demonstrate, i'm trying do. overwriting complete style work, overwriting controltemplate too? can't use custom control in case. if want apply style controls in app of same type, create style without x:key attribute , place in application.resources or in resourcedictionary referenced there. as sample, i've taken default style appbarbutton , changed place of label , icon. did remove other property setters , changed template . xaml style properties overwritten in order loaded: first system defaults , application resources, followed page/control resources , inline styles. since i'm defining template property, o

PHP oAuth POST requests -

having little trouble getting oauth post requests return workable response. thoughts appreciated. $request = $provider->getauthenticatedrequest( 'post', 'https://graph.microsoft.com/v1.0/me/calendar/events', $_session['access_token'], ['body' => json_encode([ 'id' => null, 'subject' => 'test 54575', 'start' => [ 'datetime' => '2016-11-17t02:00:00', 'timezone' => 'w. europe standard time' ], 'end' => [ 'datetime' => '2016-11-17t04:00:00', 'timezone' => 'w. europe standard time' ], 'body' => [ 'contenttype' => 'text', 'content' => 'estruyf' ], 

ember.js - Emberjs 1.13.0—Call Action of Component -

i have such component: app.mynicecomponent = ember.component.extend({ actions: { save: function () { … } } }); the template it: <h1>my nice component</h1> {{ yield }} anywhere in template: {{#my-nice |mn| }} … <a onclick={{ action 'save' }}>save</save> {{/my-nice}} clicking on link make ember try trigger action in routes controller. guess because version using here old, there way make ember call components action, or hand on function reference link, called? in component, designed have child components, manage so: app.achildcomponent = ember.component.extend({ targetobject: em.computed.alias('parentview'), task: '', action: 'onchildclick', //present action in parent compoent click: function(){ this.sendaction('action', this.get('task')); } }) in hbs that: {{#my-nice}} {{#a-child task="do this"}} {{/my-nice}} in case love make ember trigger compoents ac

actionscript - "Access of possibly undefined property buttonMode through a reference with static type Class" and other errors -

i'm making quiz in flash tech class , error, , "1061: call possibly undefined method addeventlistener through reference static type class.". here code black_mc.buttonmode = true; red_mc.buttonmode = true; purple_mc.buttonmode = true; black_mc.addeventlistener(mouseevent.click, feedback); red_mc.addeventlistener(mouseevent.click, feedback); purple_mc.addeventlistener(mouseevent.click, feedback); function feedback(event:mouseevent):void { if (event.target.name == "black_mc") { feedback_txt.text = "bruh thats black rectangle lmao"; } else if(event.target.name=="red_mc") { feedback_txt.text = "you flaggin man thats red square lolol"; event.target.parent.removechild(event.target); } else if(event.target.name=="purple_mc") feedback_txt.text = "ayyyy got bruh!" event.target.parent.removechild(event.target); } i checked linkage symbols , they're fine. no idea why error there

javascript - How to reset the margin of an image for animation in jquery easing plugin? -

how reset margin of image animation in jquery easing plugin? i'm trying animate image using jquery easing plugin (see http://gsgd.co.uk/sandbox/jquery/easing/ ) allow image fly left right on click of link of page. tried this: js $(".section-rates-go").click(function gorightease(){ var initalleftmargin = $( ".innerliner" ).css('margin-left').replace("px", "")*1; var newleftmargin = (initalleftmargin - 285); // 2 border $( ".innerliner" ).animate({ marginleft: newleftmargin }, 4000, 'easeoutbounce'); }) css .animation-mycontainer{ box-sizing: border-box; white-space: nowrap; overflow-x: hidden; width: 280px; } .animation-box{ box-sizing: border-box; display:inline-block; width: 278px; height: 148px; vertical-align:top; background-color:white; } html div navbar: <div id=&q

java - Apache Nifi: Resource directory paths are malformed: docs -

i'm getting "resource directory paths malformed" integrated nifi webserver jetty. jar exists , content: /jhub/_prod/server_global_unifieddata_nifi_daemon/storage/work/nar/framework/nifi-framework-nar-1.0.0-snapshot.nar-unpacked/meta-inf/bundled-dependencies/nifi-web-docs-1.0.0-snapshot.war meta-inf/ meta-inf/manifest.mf css/ images/ web-inf/ web-inf/classes/ web-inf/classes/org/ web-inf/classes/org/apache/ web-inf/classes/org/apache/nifi/ web-inf/classes/org/apache/nifi/web/ web-inf/classes/org/apache/nifi/web/docs/ web-inf/classes/meta-inf/ web-inf/jsp/ js/ css/component-usage.css css/main.css images/bgheader.png images/bgtableheader.png images/bgbannerfoot.png web-inf/classes/org/apache/nifi/web/docs/documentationcontroller.class web-inf/classes/meta-inf/dependencies web-inf/classes/meta-inf/notice web-inf/classes/meta-inf/license web-inf/web.xml web-inf/jsp/no-documentation-found.jsp web-inf/jsp/documentation.jsp js/application.js meta-inf/maven/org.apache.nifi/n

triggers - After Update errors on Memory optimized tables SqlServer -

using ef 6.1.3, sqlserver 2016. have modified tables in db memory optimized tables. functions correctly, however, when added after update trigger on non-memory optimized table following error. sql server assertion: file: <"d:\b\s1\sources\sql\ntdbms\hekaton\engine\core\tx.cpp">, line=7434 failed assertion = '!(tx->errorobject != nullptr) || (err == nullptr || tx->temptabletx)'. error may timing-related. if error persists after rerunning statement, use dbcc checkdb check database structural integrity, or restart server ensure in-memory data structures not corrupted. note: there predicate on table row level security uses memory optimized tables. has else encountered this/found solution? thanks!

google app engine - Oauth2 client.Get() email scope returning literal 'userinfo.email' rather than actual email addr in AppEngine Go app -

thr 2016.11.17 lacking suitable simple go lang oauth example , i'm following tutorial attempting retrieve user email appengine oauth2 app. followed work around obtain new appengine context. unexpectedly, literal text 'userinfo.email' returned, rather actual email addr. error handling removed brevity: ctx := appengine.newcontext(r) either ctx := newappengine.newcontext(r) code := r.formvalue("code") token, err := googleoauthconfig.exchange(ctx, code) client := googleoauthconfig.client(ctx, token) resp, err := client.get("https://www.googleapis.com/auth/userinfo.email? access_token=" + token.accesstoken) defer resp.body.close() data, _ := ioutil.readall(resp.body) str := string(data) data [[117 115 101 114 105 110 102 111 46 101 109 97 105 108]] u s e r n f o . e m l resp [&{200 ok 200 http/1.1 1 1 map[x-xss-protection:[1; mode=block] expires:[wed, 16 nov 2016 01:37:56 gmt] server

linux - Mounting a Windows DFS share on Debian box -

i'm trying mount windows server 2012 backed dfs, uses qualified domain name, on debian linux machine limited success. so, first tried was: mount -t cifs //mydfsdomain/namespaceroot/sharedfolder /mnt/sharedfolder -o username=un,password='pw',workgroup=workgroup but, received error mount error(5): input/output error after googling, told needed pass argument sec=ntlm or other sec variants, these tend result in following error message: mount error(95): operation not supported i've tried lots of googling , followed suggested here , here , still see same error messages. a little information machines. client running debian 5.0.10 , server windows server 2012 r2 standard 9600. thanks in advance! i've been wrestling mounting windows dfs well. got mine (debian 3.16.0) mount ok . here few 'gatchas' came across. maybe of them you: the mike's technology blog referenced mentioned -c option cifs.spnego in /etc/request-key.co

java - Fragment objects after the fragment is destroyed; when GC collects them? -

i have fragment, , inside fragment start worker thread, can take few seconds. after worker thread finished, have insert sqlite database calling mdatabasehandler.insertsomething(something) (mdatabasehandler private instance inside fragment). inside worker thread don't access views created ui thread, access objects created in fragment. happens if remove fragment or destroy it? i've read when fragment removed ondestroyview called. i'm not sure happens other objects. tried operations in ondestroy method of fragment: @override public void ondestroy() { super.ondestroy(); client client = mdatabasehandler.getthelastclient(); log.e(tag, "client full name: " + client.getfullname()); } everything worked fine. final question is: when gc collect objects created in fragment after fragment destroyed? as keeping reference object in fragment. fragment not garbage collected until thread finished or releases reference object in fragment. if object has

asp.net mvc - MVC - Display messages from the controller -

within mvc application have several situations where, depending on business rules of function, messages should displayed user. we using jquery "toastr" library display messages user. development follows: 1) configuring message settings (alert message.cshtml) @helper mostrarmensagensalerta(alerta alerta) { if (alerta != null) { <script> $(document).ready(function () { window.toastr.options.closebutton = '@alerta.mostrarbotaofechar'; window.toastr.options.newestontop = '@alerta.mostrarnotopo'; @foreach (aperam.biblioteca.util.base.entidades.mensagemalerta mensagem in alerta.mensagensalerta) { string tipoalerta = mensagem.tipoalerta.tostring("f").tolower(); @: var opcoes = { /* adicione atributos específidos dos alertas toastr aqui */ }; @:opcoes.closebutton = true; @:opc

mysql - SQL Error #1071 - Specified key was too long; max key length is 767 bytes -

create table wp_locations ( `id` int(11) not null auto_increment, `city` varchar(255) not null, `name` varchar(255) not null, constraint `city_name` unique (`city`, `name`) ) default character set utf8mb4 collate utf8mb4_unicode_ci; i got sql error '#1071 - specified key long; max key length 767 bytes' what doing wrong? mysql reserves max amount utf8 field 4 bytes 255 + 255 default character set utf8mb4 collate utf8mb4_unicode_ci ; on 767 max key length limit you can reduce single varchar lenght or don't use composite key

timer trigger - azure webjob does not stop (keeps working after stopping has been requested) -

we have following situation. we decided use webjob in 1 of our web app perform work every 30 seconds. for purpose use following code called main function: static void run(bool locally) { jobhostconfiguration config = new jobhostconfiguration(); if (locally) { config.tracing.consolelevel = tracelevel.verbose; config.usedevelopmentsettings(); }config.usetimers(); jobhost host = new jobhost(config); host.runandblock(); } we have method in webjob triggered timer: public static async task timerjob([timertrigger("00:00:30")] timerinfo timer) {.... ienumerable<iinvitationprocessor> processors = _container.resolve<ienumerable<iinvitationprocessor>>(); .... } where _container - autofac container we noticed 2 strange different things(it looks linked): 1) if stop webjob using th portal webjob dispalyed stopped in fact keeps working - see

java - getActivity null in fragment when app resumes -

so if user on app , click home , go several other apps , come back, activity recreated , getactivity null when call on in fragment. a solution found create static variable , store getactivity in oncreateview . i feel isn't solution. there other way can go this? i tried using non static variable , storing in oncreateview , onattach, getactivity null. here error when use getactivity if don't save static variable. use in asynctask processdialog in fragment. java.lang.nullpointerexception: attempt invoke virtual method 'android.content.res.resources$theme android.content.context.gettheme()' on null object reference thanks. if sure onattach(activity activity) has null, suspect have multiple instance of same fragment @ same time. print fragment instance in onresume , check instances.

plot - How choose which column put on axis like label? -

i have csv file this: 10557,1925080,1236052,1210752,1182492 11254,3159084,2264460,2187584,2144416 11334,2348036,1540692,1504536,1458332 11456,1607704,993228,974676,960308 ..... i want create chart these data. want use first column x-axes label, , put other column different line inside chart. how can it? this code set terminal pngcairo enhanced font "arial,10" fontscale 2.0 size 1680, 1024 set size 1,1 set ylabel '[y]' set xlabel '[first column csv]' set datafile separator "," set autoscale fix set key top left set key box set output 'figure1.png' plot \ "figure1.csv" using 2 w l linewidth 3 lc rgb "black" title "second colum", \ "figure1.csv" using 3 w l linewidth 3 lc rgb "black" title "third colum", \ "figure1.csv" using 4 w l linewidth 3 dashtype 2 title "fourth colum", \ "figure1.csv" using 5 w l linewidth 3 dashtype 5 title &

Amazon SES stopped working in email clients -

today, out of blue, amazon ses stopped working in email clients (tested on thunderbird , outlook) although in remote server working fine. tried using different internet connection , had same problem. on thunderbird error message is: "sending of message failed. message not sent because connection outgoing server (smtp) email-smtp.us-west-2.amazonaws.com timed out. try again." i'm using: server: email-smtp.us-west-2.amazonaws.com port: 587

javascript - Chart Formatting in ChartWrapper in Google Charts -

i'm creating variety of charts using dashboard portion of google charts. to make charts i'm using convention: var chartname = new google.visualization.chartwrapper({ // lots of options here }); however, there customization details not being called when enter them inside chartwrapper object. in particular, trendlines, changing bars horizonta on bar chart, , making bars stacked. there others, these should suffice question because they're contained within single chart i'm trying troubleshoot. i assume there's common element i'm missing in of these, why thought best include them in single question. there must detail chartwrapper syntax i'm not getting right. for of above mentioned items i'm first placing these in 'options' object, , own key directly inside chartwrapper() without additional nesting. to more specifics: code: here's example code that's not working: var childrenhelpedchart = new google.visualiza

vba - Pulling Bits of info from a bunch of printer status pages into an excel document -

i have bunch of printer status pages pull 3 pieces of dynamic information , place excel spreadsheet via vba. code below, page testing pulls nothing happens after that. pretty new vba , trying work through use little stuck. sub useclassnames() dim element ihtmlelement dim elements ihtmlelementcollection dim ie object dim html htmldocument 'open internet explorer in memory, , go website' set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate "http://theurl.com" 'wait until ie has loaded web page' while ie.readystate <> readystate_complete application.statusbar = "loading web page .." doevents loop set html = ie.document set elements = html.getelementsbyclassname("results") dim count long dim eorw long count = 0 each element in elements if element.classname = "result" erow = sheet1.cells(rows.count, 1).end(x1up).offset(1, 0).row cells(erow, 1) = html.getelementsbycl

javascript - Having Trouble with a cross Domain jquery/Ajax service call -

i've read through thread after thread on here , elsewhere trying cross domain ajax call work. have restful wcf service returns simple bool. have setup proper response format (json) , expected url callback parameter: [webget(requestformat = webmessageformat.json, responseformat = webmessageformat.json, uritemplate = "showcreditcardtextjquery?membernumber={membernumber}&callback={callback}", bodystyle = webmessagebodystyle.wrappedrequest)] my ajax looks this: $.ajax({ url: "http://example.com/service/service.svc/showtextjquery", type: "get", contenttype: "application/json; charset=utf-8", datatype: "jsonp", crossdomain:true, data: "{'membernumber':'" + membernumber + "'}", cache: false, //success: alert(membernumber), success: function (data) { var output = data; if (!data) { $("#dial

Calling Mongodb stored functions on an insert in php -

i'm using mongodb 3.2 php in laravel jensseger laravel-mongodb, documentation here: https://github.com/jenssegers/laravel-mongodb i'm inserting data through code , works fine: $clientes = db::connection(env('db_database'))->collection('catalogo_clientes'); $clientes->insert(array("_id" => "1", "nombre" => "test", "disponible" => 1)); however, i'd use function created in mongo instead of "1" in "_id", when inserting through command line i'd use this, works fine: db.loadserverscripts(); db.catalogo_clientes.insert( { _id: getnextid("clientes"), nombre: "bob x.", disponible: 1 } ) how can insert through php mongo using same function of "getnextid()"? this example using jenssegers' lib: $result = db::collection('your_collection')->raw(function($collection) use ($folio, $nam

python - Completing a function to add Values depending on specific "Regions" (More info provided) -

i have 2 files, 1 containing on 200 tweets, , containing key words , values. typical tweet looks like: (i provided code below) [41.923916200000001, -88.777469199999999] 6 2011-08-28 19:24:18 life moviee. ( number in brackets , words after time relevant) and keywords like love,10 like,5 best,10 hate,1 with 2 numbers @ beginning of tweet, use determine region tweet made in (shown below in code). & each individual tweet (each line in file), depending on number of keywords in tweet, add them, divided total of values associated them (per tweet) gives me score. my question is, how able total scores tweets in region , divide number of tweets in region? below, put happynesstweetscore, how calculated score individual tweets in file (each line) contain keywords. for part, i'm not sure how add values depending on region, , divide them depending on number of tweets in region? should add them list depending on region add?? don't know. i started this: def score(tweet):

sql - Does it make sense to encrypt every value in MySQL? -

i have mysql database without built in database encryption. aware encryption available, it's not available on aws rds instance size i'm working with. instead, plan utilize aws kms (basically standard hashing encryption) hash every single value before entering in datable. working sensitive data needs hipaa compliant. my question is, hashing values, renders querying useless right? additionally, if that's case, difference between hashing every value (first name, last name, dob, etc..) vs. treating entire row single json string, , hashing (and storing in single column). if has experience encrypting on application level hipaa/sensitive data , storing in mysql, i'd appreciate suggestions! while i've worked on few hippa projects in past i'm in no way expert. hipaa has lot of components need take account take following non hippa specific. i consider operating own relational db server full disc , database encryption or (if able work json strings anyw

sap - How can I format input field to a percentage value? -

using sapui5 xml view, add formatter onto input field. depending on user enters (digits) see trailing % attached value. so if userinput value = "99" ---> "99%" or ".5" ---> "50%" looking @ datatypes, i'm not sure there 'out of box' solution format input value percentage. ideas how can accomplished? <input id="percentgrowth" type="text" value="{path:'inputmodel>/mypath', type:'sap.ui.model.type.float', contraints: {maximum : 1}}" > </input> you should use formatter formatter sapui5 for example <input id="percentgrowth" type="text" value="{path:'inputmodel>/mypath', type:'sap.ui.model.type.float', contraints: {maximum : 1}, formatter:'.myformatter'}" > </input> and add in controller function mycontroller.prototype.myformatter(val