Posts

Showing posts from 2012

database - WordPress multisite manual migration from live to local - issues changing URLs -

i have been attempting move wordpress multisite live local manually while, , i'm having problems updating urls across database. firstly, have read best practice change permalink structure of live site default instead of custom structure on temporary basis. necessary, not want make kind of change on live site website security reasons - if change did not reverse years of blog posts affected. also, live site has on 100 plugins installed, of paid , imagine have limitations on number of domains on plugins can used. when completing search , replace on db, safe replace url entries in plugin tables, , matter, tables? not wish migrate live site local , in process use plugin domain license. (i using interconnect/it's db search , replace script). thank reading, advice appreciated.

go - Create a golang pipeline automatically -

i have golang pipeline code. entities getting input channel. when invoking start() start ranging on input channel , writing output channel. tee component gets input channel , fans them out several channels. coffee component has add method merges several input channels single output channel here example code builds such pipeline. "inchan" entry point of pipeline. inchan := make(chan common.event, 1000) prefix := []byte("foo_") m := make(map[string][]common.enricher) ippa := enricher.newiptocountryenricher(prefix, geomock{}) uapa := enricher.newparseuaenricher(prefix) m[k] = []common.enricher{ippa, uapa} enricherinst := enricher.newenricher(m, inchan) enricherin := enricherinst.start(1000) teechannels := newtee(ctx, 10000, 2, enricherin) kinesiscoffee.add(k, teechannels[1]) fsconfig

Phonegap Web App iOS scrolling is laggy/choppy in iframe -

edit: added wkwebview cordova plugin referenced here: https://github.com/apache/cordova-plugin-wkwebview-engine this has helped scrolling lot! though still not perfect. edit: learned scrolling 2 fingers works fine. need find way make scrolling 1 finger same scrolling two. i'm aware there have been several questions, , solutions questions ios laggy scrolling. have tried everything, , none of seems work. i using phonegap/cordova framework7. application iframe pointed @ website (url) toolbar @ bottom navigate/use native features. however, scrolling in iframe terrible. prior using solutions found online, app scroll bit jump top while scrolling choppy. the solution fixes scrolling me most: `frameelem.style.height = defaultheight; console.log('before'); settimeout(function(){ frameheight = frameelem.clientheight; frameelem.style.height = frameheight + "px"; console.log('after'); navigator.splashscreen.hi

syntax - Python and nGrams -

aster user here trying move on python basic text analytics. trying replicate output of aster ngram in python using nltk or other module. need able ngrams of 1 thru 4. output csv. data: unique_id, text_narrative output needed: unique_id, ngram(token), ngram(frequency) example output: 023345 "i" 1 023345 "love" 1 023345 "python" 1 i wrote simple version python 's standard library, educational reasons. production code should use spacy , pandas import collections operator import itemgetter @ open("input.csv",'r') f: data = [l.split(',', 2) l in f.readlines()] spaced = lambda t: (t[0][0],' '.join(map(at(1), t))) if t[0][0]==t[1][0] else [] unigrams = [(i,w) i, d in data w in d.split()] bigrams = filter(any, map(spaced, zip(unigrams, unigrams[1:] ))) trigrams = filter(any, map(spaced, zip(unigrams, unigrams[1:], unigrams[2:]))) open("output.csv", 'w') f: ngra

linux - MIPS-I binary on MIPS32 -

i have mipsel linux system , run mipsel binary. executing binary results in ./m1: error while loading shared libraries: tl: cannot open shared object file: no such file or directory ldd output looks confusing: tl => not found nit => not found itpid => not found _file => not found file output: m1: elf 32-bit lsb executable, mips, mips-i version 1 (sysv), dynamically linked, interpreter /lib/ld.so.1, stripped readelf output: elf header: magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 class: elf32 data: 2's complement, little endian ident version: 1 (current) os/abi: unix - system v abi version: 0 type: exec (executable file) machine: mips r3000 big-endian version: 1 (current) entry point address: 0x40

.net - How Integrating Socket.io 1.x client with c# Windows Forms? -

socketio4net.client supports 0.9 , socketioclientdotnet seems not working. is there way integrate c # .net latest version of socket.io? you can use socketioclientdotnet socket.io version 1.7.3, https://github.com/quobject/socketioclientdotnet/blob/master/testserver/package.json

c# - How to submit a file to an ASP.NET Core application -

i have asp.net application presents simple form upload files (images). looks this: public iactionresult process() { return view(); } [httppost] public iactionresult process(list<iformfile> files) { var telemetry = new telemetryclient(); try { var result = files.count + " file(s) processed " + environment.newline; foreach (var file in files) { result += file.filename + environment.newline; var memorystream = new memorystream(); file.copyto(memorystream); memorystream.seek(0, seekorigin.begin); var binaryreader = new binaryreader(memorystream); var bytes = binaryreader.readbytes((int)memorystream.length); var imageinformation = imageservice.processimage(bytes); imageservice.saveimage(imageinformation.result, bytes, file.filename.substring(file.filename.lastindexof(".", stringcomparison.ordinal) + 1)); }

bash - Format date in AWS's style -

i'm looking compare dates of aws resources in external script need match aws's date/time format. aws' own documentation states date must the complete date plus hours, minutes, , seconds , date formats end looking 2017-07-27t15:47:59.373z , hardcoding of %y-%m-%dt%h:%m.%sz gets me 2017-07-15t11:39.29z . side side, that's: aws: ??? - 2017-07-27t15:47:59.373z me: %y-%m-%dt%h:%m.%sz - 2017-07-15t11:39.29z there's on end that's adding few digits. missing formatting identical? the "extra digits" milliseconds. i'm assuming you're using bash's date command. if that's case, try with: date -u +"%y-%m-%dt%h:%m:%s.%3nz" the -u option gets date in utc (so it's compliant z , utc designator ). if don't use -u , it'll print date , time in system's timezone (which can't utc).

python - Indexing a multidimensional Numpy array with an array of indices -

let have numpy array a shape (10, 10, 4, 5, 3, 3) , , 2 lists of indices, b , c , of shape (1000, 6) , (1000, 5) respectively, represent indices , partial indices array. want use indices access array, producing arrays of shape (1000,) , (1000, 3) , respectively. i know of few ways this, they're unwieldy , rather un-pythonic, example converting indices tuples or indexing each axis separately. a = np.random.random((10, 10, 4, 5, 3, 3)) b = np.random.randint(3, size=(1000, 6)) c = np.random.randint(3, size=(1000, 5)) # method 1 tuple_index_b = [tuple(row) row in b] tuple_index_c = [tuple(row) row in c] output_b = np.array([a[row] row in tuple_index_b]) output_c = np.array([a[row] row in tuple_index_c]) # method 2 output_b = a[b[:, 0], b[:, 1], b[:, 2], b[:, 3], b[:, 4], b[:, 5]] output_c = a[c[:, 0], c[:, 1], c[:, 2], c[:, 3], c[:, 4]] obviously, neither of these methods elegant or easy extend higher dimensions. first slow, 2 list comprehensions, , second requires

java - Amazon S3 - List ALL objects without hierarchy summaries -

for it's worth, amazon s3 library being used perform operations on hcp. perhaps limits version of amazon s3 can use or changes interpretation of folder. understanding is, both amazon s3 , hcp can acknowledge full paths objects , ignore folders, i'm having difficulty getting requests that. say have: something/over/here/object1 something/over/there/object2 somewhere/far/object3 and want every object under something/. here request attempt: listobjectsrequest listsomeobjects= new listobjectsrequest() .withbucketname("bucket") .withdelimiter("/") .withprefix("something/") .withmaxkeys("100") // maybe not necessary since stops @ 1000 .withmarker(null); // used after first request, imagine objectlisting objectsreturned = this.hs3client.listobjects(listsomeobjects); objectsreturned gives me few options: getcommonprefixes() - if include delimiter, returns something/over. otherwise, appears empty. getobjectsummaries() - delimi

objective c - First responder preempting menubar -

i trying write control setting keybindings. however, problem is, when set first responder (i.e. [self.window makefirstresponder:self] ), menu bar still "before" it. want swallow keypresses, if makes sense (if keybinding conflicts menu item, throw alert instead). how do that?

ios - Can't encode an array of Strings in Swift -

i can't seem arrays accepted encode function. error getting "cannot invoke 'encode' argument list of type '([string], forkey: [string])' var billid: [string]=[] var billnumber: [string]=[] var billtitle: [string]=[] var billdescription: [string]=[] var lastaction: [string]=[] var lastactiondate: [string]=[] struct statelawdata { static let state: string="state" static let lastupdate: string="lastupdate" static var billids: [string]=[] static let billnumbers: [string]=[] static let billdescriptions: [string]=[] static let billtitles: [string]=[] static let lastactions: [string]=[] static let lastactiondate: [string]=[] } override func encode(with acoder: nscoder) { acoder.encode(stateabbr, forkey: statelawdata.state) acoder.encode(lastupdatetime, forkey: statelawdata.lastupdate) acoder.encode(billid, forkey: statelawdata.billids) acoder.encode(billnumber, forkey: statelawdata.bil

r - Looping through elements of a list and then appending to a new list -

i've been trying write code allow me loop through items of list, each of vector of numeric values. elements of vector meets criterion, want append numbers new list contains vector of numeric values. my dataset structured following: col1 col2 col3 .... col29 -11 -10 -9 .... 15 -13 -12 -11 .... 14 i've tried following code far: new_list <- list() for(i in 1:length(time_list)) { for(j in 1:length(time_list[[i]]) { if(!is.na(time_list[[i]][j]) & time_list[[i]][j] >= 0) { # stuck here, code i've run gives me error. } } } i want list that's structured pretty same original, keeping numbers greater or equal 0. any appreciated. i call data df df <- structure(list(time_1 = -13l, time_2 = -12l, time_3 = -11l, time_4 = -10l, time_5 = -9l, time_6 = -8l, time_7 = -7l, time_8 = -6l, time_9 = -5l, time_10 = -4l, time_11 = -3l, time_12 = -2l, time_13 = -1l, time_14 = 0l, time_15 = 1l))

sql server - How to get a total for each InsuredCounty and Average for each Mod -

Image
how can return total premium each insuredcounty , average experiencemod, scheduremod,territorymod, effectivemod in 1 query? select * (select insured, insuredcounty, policynumber, effectivedate, policytype, sum(premium) premium, experiencemod, isnull(schedulemod,0) schedulemod, territorymod, isnull(effectivemod,0) effectivemod, row_number() on (partition insured,policynumber,premium, transactiontype order policytype desc) rid productionreportmetrics effectivedate <= eomonth(getdate()) , companyline = 'arch insurance company' , insured <>'jerry''s test' , transactiontype = 'policy' group insured, insuredcounty, policynumber, policytype, effectivedate, experiencemod, schedulemod,

datastep - Is there a way to force cleansing the raw data before importing it via a data step, in SAS? -

sas eg i have tab delimited text file has imported every month. wrote import procedure via data step. data lib.txtimp; %let _efierr_=0; infile "file/path/tabdlm.txt" lrecl=256 dlm='09'x missover firstobs=2 dsd; informat <vars>; format <vars>; input <vars>; if _error_ call symput('_efierr_',1); run; a recent problem had there times when datalines have 2 tabs mistake. text file huge, in order of 500mb. tried automate process writing above, doesn't take problem in consideration. writes blank in place. when use in-built 'import data', first cleanses raw file , runs intermediate data step give desired output. doesn't give me blank in column. ignores tab. an example of problem text file. col1 col2 col3 1 b 2 foo bar 3 wayout data 4 example sample file is there way can automate cleansing process data step import? or, guys know steps should add of sort? remove dsd option. dsd option

Twilio: API to see SIP status (Presence Panel / Buddy List) -

Image
i able show in our crm list of sip endpoints in sip domain are: 1. registered 2. on call 3. set dnd this similar 'buddy list' featured here: https://www.twilio.com/blog/2011/09/twilio-client-presence-for-everyone.html is possible? twilio developer evangelist here. i'm afraid right have no api presence on sip endpoints. i recommend in touch twilio support register interest feature this. if do, please describe use case can prioritise these features. thanks!

formatting - How can I format numbers as dollars currency string in JavaScript? -

i format price in javascript. i'd function takes float argument , returns string formatted this: "$ 2,500.00" what's best way this? you can use: var profits=2489.8237 profits.tofixed(3) //returns 2489.824 (round up) profits.tofixed(2) //returns 2489.82 profits.tofixed(7) //returns 2489.8237000 (padding) then can add sign of '$'. if require ',' thousand can use: number.prototype.formatmoney = function(c, d, t){ var n = this, c = isnan(c = math.abs(c)) ? 2 : c, d = d == undefined ? "." : d, t = t == undefined ? "," : t, s = n < 0 ? "-" : "", = string(parseint(n = math.abs(number(n) || 0).tofixed(c))), j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + math.abs(n - i).tofixed(c).slice(2) : ""); }; and use with: (123456789.

How to read a Date column from excel to a string in c#? -

i writing c# console application reads data excel spreadsheet using smartxls library. able read other column data except 'usage date'column. kindly, suggest me way solve problem. date column in excel: usage date oct-15 oct-15 oct-15 function: public void getdata() { int count = 0; desktokens = new list<token>(); string directory = path.getdirectoryname(assembly.getexecutingassembly().location); string path = path.combine(directory, @"c:\projects\product_usage_year.xlsx"); smartxls.workbook wb = new workbook(); wb.readxlsx(path); datatable dt = wb.exportdatatable(); string currenttype = string.empty; string currentcategory = string.empty; datarow dr; (int = 1; < dt.rows.count; i++) { dr = dt.rows[i]; var tkn = new token(); tkn.usagedate = dr

date - R: replace NA by mean of non-NA values based on a multiple conditions (Hour, Day of Week and Temperature range) -

i have data frame 3 columns: "date/time", "power", "temperature", represents values of power measured, 10 10 minutes, , temperature of outdoor air. entries correspond whole year of data acquiring, result on large number of strings. sampling example: df1 <- data.frame("date/hour" = c("2016-08-09 12:00", "2016-08-09 12:10", "2016-08-09 12:15", "2016-08-09 12:20"), "power" = c(500.21, 500.23, 500.24, 500.30), "day_week" = c("tuesday", "tuesday", "tuesday", "tuesday"), "temp" = c(21.1, 21.5, 21.3, 21.0)) the problem @ periods, due equipment problem, power value got na values. fill gap, want use mean of non-na values satisfy next 3 conditions: occur @ same hour. occur @ same day of week. (the intriging one) occur @ range of temperature of +/- 0.5, , increases 0.1 if there's no non-na values replace. to solve problem, fir

machine learning - Tensorflow RNN stuck at high cost -

the following rnn model decreases loss first 1 or 2 epochs , fluctuates around cost of 6. seems model random , not learning @ all. varied learning rate 0.1 0.0001 , didn't help. data fed input pipeline, worked fine other models, functions extract label , images not presented here. have looked @ many times still couldn't find what's wrong it. here's code: n_steps = 224 n_inputs = 224 learning_rate = 0.00015 batch_size = 256 # n_neurons epochs = 100 num_batch = int(len(trainnames)/batch_size) keep_prob = tf.placeholder(tf.float32) # train queue train_queue = tf.randomshufflequeue(len(trainnames)*1.5, 0, [tf.string, tf.float32], shapes=[[],[num_labels,]]) enqueue_train = train_queue.enqueue_many([trainnames, train_label]) train_image, train_image_label = train_queue.dequeue() train_image = read_image_file(train_image) train_batch, train_label_batch = tf.train.batch( [train_image, train_image_label], batch_size=batch_size, num_threads=1, capacity=

asp.net mvc - What is an MVC child action? -

i read child actions in mvc (fundamental book), don't know is? could 1 please explain these methods? phil haack explains nicely in this blog post . child action controller action invoke view using html.action helper: @html.action("someactionname", "somecontroller") this action execute , render output @ specified location in view. difference partial partial includes specified markup, there's no other action executing main action. so have main action received request , rendered view, within view render multiple child actions go through independent mvc lifecycle , render output. , happen in context of single http request. child actions useful creating entire reusable widgets embedded views , go through independent mvc lifecycle.

populate values in textbox if select combobox vb6 -

i using vb 6.0 have 1 form (form1), 1 combobox (combobox1), , 1 textbox (textbox1)i have 1 table (salary) in local database created within project.in table 'salary' have 4 columns (userid - primary key, salary type, salary range)the table has multiple records in it. what need find out how have textbox populate corresponding columns whatever selected in combobox. , appreciated. here code used link database vb : private withevents cmdpopulate commandbutton private withevents dcbdatacombo datacombo private sub form_load() dim rs adodb.recordset dim strconnect string dim strsql string strconnect = "provider=microsoft.ace.oledb.12.0;data source=c:\users\mahmoud\desktop\project\database.mdb;persist security info=false" strsql = "select distinct * salary order userid asc" ' set ascending order set rs = new adodb.recordset rs .cursortype = adopenstatic .locktype = adlockreadonly .open source:=strs

jquery - bug noticed rendering positions with javascript -

i have code first creates variable positions x,y positions of image it's width , height. select area(s) in image remove these positions clone of positions have the sum of positions in 2 different arrays. var positions = []; var areas = {} var area_counter = 0; var image_width = $('.img-class')[0].naturalwidth; var image_height = $('.img-class')[0].naturalheight; var area = image_width * image_height; var img_width = 0; var img_height = 0; (counter = 0; counter < area; counter++) { positions.push([img_width, img_height]); img_width += 1; if (img_width == image_width) { img_width = 0; img_height += 1; } } var drop_boxes = $('.drop-box'); var area_grid = []; var image_width = $('.img-class')[0].naturalwidth; var image_height = $('.img-class')[0].naturalheight; drop_boxes.each(function() { var position = $(this).position(); var width = $(this).width(); var height = $(this).height();

java - Error incompatible types. Postfix evaluation -

my task create program postfix evaluation using array , char. i'm having trouble problem incompatible type: object cannot converted int. here's code: import java.util.*; public class stackpostfixeva { //class name public static void main(string args[]) { scanner key = new scanner(system.in); //initialize scanner char[] postfix = new char[10]; //creating array system.out.println("please enter postfix expression. enter '#' if have finish entering postfix expression "); //instruction command int i; //initialize variable (i = 0; <= postfix.length; i++) { //loop receiving input postfix[i] = key.next().charat(i); //input command if (postfix[i] == '#') { //to indicate end break; } } system.out.println("the postfix expression are:"); //to print postfix expression (i = 0; <= postfix.length; i++) { system.out.println(postfix[i]); } stack st = new st

java - merge sort not sorting array -

i have written java code below after reading on merge sort. there no errors when running code merge sort not sort array. returns original unsorted array. can't life of me figure out problem might be. appreciate leads. public class mergesort { public void mergesort(int array[], int n){ if(n<2) return; int m=n/2; int left[]=new int[m]; int right[]=new int[n-m]; int i; for(i=0; i<m;i++){ left[i]=array[i]; } for( i=m; i<n;i++){ right[i-m]=array[i]; } printarray(left); printarray(right); mergesort(left, m); mergesort(right, n-m); merge(array, left, m, right, m-n); } private void merge(int[] array, int[] left, int leftcount, int[] right, int rightcount) { int i=0,j=0,k=0; while(i<leftcount && j< rightcount){ if(left[i]<=right[j]){ array[k]=left[i]; i++; k++; }else{ array[k]=right[j]; j++;

ios - Get the array with the largest object inside an array of an array -

i have array of array of cllocations , trying find array has cllocation object happened according timestamp. either index or actual list sufficient. so far have come with: let latestlist = listoflistoflocations.index{$0.max{a,b in a.timestamp < b.timestamp} < $1.max{c,d in c.timestamp < d.timestamp}} but i'm getting no luck , can't head round being relatively new swift. appreciated. first "submaxes" of each array, , take max of obtain global maximum. let subarraycontainingmostrecentobject = listoflistoflocations .flatmap{ subarray in return subarray .max{ $0.timestamp < $1.timestamp } .map{ submax in (subarray: subarray, submax: submax) } } .max{ $0.submax.timestamp < $1.submax.timestamp }?.subarray

Python: How to create a loop to change longitude data -

i using python 3.6 map precipitation data onto continent. problem data have has longitude values ranging 0 360 , need data -180 180 in order map it. need create loop states if longitude > 180 new longitude= longitude-360. data: want loop through 56 years. x have longitude values stored here have far: lon=[] n in range(0,56): lon=x[n] if lon > 180: lon=lon-360 np.save('filename',lon) does right? there examples similar problem? thanks! check : x=[100,200,400,500,100,181,179] lon=[] n in x: if n > 180: lon.append(n-360) else: lon.append(n) by using np.where : x=np.asarray(x) np.where(x >180,x-360,x)

ios - 404 error when uploading nultipart form data with parameters -

i trying upload images parameters multipart form data in moya. have following api: enum apiservice { case upload(body:[string: string]?, profilephoto: data, frontidphoto: data, backidphoto: data) } extension apiservice: targettype { var baseurl: url { return url(string: "http://202.166.194.122:8787/api/")! } var path: string { switch self { case .upload: return "jsonrx/updatecustomerkyc/" } } var method: moya.method { switch self { case .upload: return .post } } var parameters: [string: any]? { switch self { case .upload(let body, _, _, _): return body [string: any]? } } var parameterencoding: parameterencoding { return urlencoding.default } } var task: task { switch self { case .upload(_, let profilephoto,let frontidphoto, let backidphoto): var

Python: Having confusion in Regex -

my code (in python 2.7 using anaconda), import re regex = r"([a-z]+) (\d+)" str = "hello 3 hello regex example" matchobject = re.search(regex, str) print matchobject if matchobject not none: print matchobject.start() print matchobject.end() print matchobject.group(0) print matchobject.group(1) print matchobject.group(2) when regex search pattern return output in format: line 1: <_sre.sre_match object @ 0x10a2568b0> line 2: 0 line 3: 7 line 4: hello 3 line 5: hello line 6: 3 i have added line number in output better understanding, line 1 of output confusing, , line 3 (output=7) confusing. can explain line 1 , line 3 of output? those print numbers correspond print statements print matchobject #line 1, python has interpret regex match object string , gives it's type , address if matchobject not none: print matchobject.start() #line 2, full match "hello 3", 0 chars away start of input print matchobje

android - Render Errors In ExpandableTextView -

i don't know why got render errors when adding expandabletextview <com.ms.square.android.expandabletextview.expandabletextview android:id="@+id/expand_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_torightof="@+id/first_linear" expandabletextview:maxcollapsedlines="4" expandabletextview:animduration="200"> <textview android:id="@+id/expandable_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:layout_margintop="5dp"/> </com.ms.square.android.expandabletextview.expandabletextview> the dependency compile 'com.ms-square:expandabletextview:0.1.4' below complete xml file : <?xml version="1.0" enco

python - Infinite cycle over a range starting at a particular number -

say have range: r = range(1, 6) using range, want cycle infinitely , yield numbers come: for in cycle(r): yield(i) this correctly produce values of: 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, ... however, want start yielding specific value continue on range it's defined. is, if want start @ 3 , sequence be: 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, ... is there way combination of range , cycle (or other way)? just dropwhile until reach first value want emit: >>> itertools import cycle, dropwhile >>> iterable = dropwhile(lambda x: x < 3, cycle(range(1, 6))) >>> _ in range(10): ... print(next(iterable)) ... 3 4 5 1 2 3 4 5 1 2 per docs (emphasis mine): make iterator drops elements iterable long predicate true; afterwards, returns every element . the predicate takes effect until first value evaluates false-y.

bash - When my pkg runs its Post-installation script, how can I know how that happened? -

there 2 ways script can run: when user opens pkg file , goes through normal gui setup, or when admin (or savvy user) runs sudo installer -pkg /path/to/installer.pkg -target / . second one, want know when script run in mode can make more admin-friendly decisions not opening gui. how know when pkg installed via command line? i'm hoping environment variable or similar. running script via sudo change values of variables , add others in. script check existence of variables (or values) make determination whether installer run via sudo. values updated: home logname mail values set: sudo_command -- command run via sudo sudo_gid -- gid of user ran sudo sudo_uid -- uid of user ran sudo sudo_user -- username of user ran sudo my recommendation check existence of sudo_command environment variable; unlikely set non-sudo installation, , set sudo-based installation. reference: sudo 1.8.20 manual - environment section

jquery - Disable form button until all field are filled out rails 5.1 -

i have following form , looking solution disable button until form has field out. using rails 5.1, twitter bootsrap , jquery. <div class="well"> <%= bootstrap_form_for @dup |f| %> <% if current_user.errors.any? %> <div id="error_explanation" class="errors"> <ul> <% current_user.errors.full_messages.each |message| %> <li><%= message %></li> <% end %> </ul> </div> <% end %> <%= f.text_field :title, placeholder: "title here...", label: "title* (required)" %> <%= f.text_field :company_name, placeholder: "company name here...", label: "company name* (required)" %> <%= f.text_area :description, placeholder: "add description here...", label: "description* (required)" %> <%= f.text_field :location

mod rewrite - Apache mod_rewrite rules adding trailing slashes when not expected -

i trying mod_rewrite rules work particular section of site. rules should add trailing slash main /test/ section if 1 missing. add trailing slash urls under /test/ folder if url not point file or folder. reroute urls do.php file if url not point file, folder, or under "special folder. these rules: ## append / url if trailing slash missing. rewriterule ^/test$ /test/ [r=301,l] ## append / end of every url under test if not file or folder , not have trailing slash rewritecond %{document_root}/test/$1 !-f rewritecond %{document_root}/test/$1 !-d rewritecond %{request_uri} !/test/(.+)/$ rewriterule ^/test/(.+)$ /test/$1/ [l,r=301] ## reroute urls do.php unless folder, file, or under special folder rewritecond %{document_root}/test/$1 !-d rewritecond %{document_root}/test/$2 !-f rewritecond %{request_uri} !/test/special/.* rewriterule ^/test/(.+)$ /test/do.php [l] while rules not causing issue when go /test/special/index.php, when try open /test/special/js/jquery.

c# - Spawn process in the context of different user -

at moment have service execute time time .exe file. service run system user, these subprocesses executed system . due security reasons these processes executed in context of different user without administrative priviliges. there way without having store username , password of user somehow? if not: how can save these credentials in secure way? i using c# service, think questions can answered in general.

botframework - Skype bot truncating display -

Image
i have bot deployed on skype. problem skype truncates long text , shows ellipsis. there way avoid , control size of card? update: using skype desktop application on windows 10 every channel has own limitations on cards. skype allows limited number of chars on hero card example(title, subtitle, , text). of right there not work around know of either extend length of text and/or size of card.

c - is a compound literal not a literal? -

from c in nutshell: chapter 3 literals in c source code, a literal token denotes a fixed value , may integer, floating-point number, character, or string. literal’s type determined value , notation. the literals discussed here different compound literals, introduced in c99 standard. compound literals ordinary modifiable objects, similar variables. full description of compound literals , special operator used create them, see chapter 5. so literal has fixed value, i.e. value can't modified, while compound literal has modifiable values. according that, 1 correct: a compound literal not literal, or the definition of literal should extended include compound literal becomes 1 exception fixed-value rule? thanks. the c11 standard never defines "literal" on own. speaks of "string literal" , "compound literal" individually. tokens such 0 , 0.0 , a in enum { } , , '\0' called "cons

swift - LocalizedString of DateFormatter is different from iOS default calendar app -

when try localizedstring dateformatter , output different format ios default calendar app shows. dateformatter locale shows (for datestyle full) tuesday, august 15, 2017 where ios default calendar app shows tue, aug 15, 2017 dateformatter kr locale shows (for datestyle full) 2017년 8월 15일 화요일 where ios default calendar app shows 2017년 8월 15일 (화) how localizedstring shown in ios default calendar app? should create custom format locale? none of standard styles show abbreviated weekday , month name. one option use setlocalizeddateformatfromtemplate . let df = dateformatter() df.setlocalizeddateformatfromtemplate("eee mmm dd yyyy") let string = df.string(from: date())

wix - Properly registering an application that handles websites with windows -

my use of several browsers different purposes has caused me displeased how windows 10 handles default browser choice, decided make small application can pick browser want, or use 1 open browser, if there one. i have though ran bit of problem getting app list of applications in settings app. source code available here: https://github.com/mortenn/browserpicker in particular, registry values have tried setting listed in wix file here: https://github.com/mortenn/browserpicker/blob/master/setup/product.wxs i based these keys on answer here: how associate application existing file types using wix installer? looking @ how firefox/ie had keys set up. i found question, how add application in default programs list mentions company must set, have done well, no avail. i realized mistake. after removing "hkey_classes_root" registry values, started working. see commit details: https://github.com/mortenn/browserpicker/commit/f92e275d3e4d1cd8e7f05554037cfb702b7cfafb

.net - Core aspnet identity password validator based on the configuration -

public static identitybuilder addcustompasswordvalidator<tuser>(this identitybuilder builder, passwordvalidateoptions options) tuser : class { if (!options.emailinpassword) builder.addpasswordvalidator<emailinpasswordvalidator>(); if (!options.usernameinpassword) builder.addpasswordvalidator<usernameinpasswordvalidator>(); if (!options.lastpasswordsinpassword) builder.addpasswordvalidator<lastpasswordsinpasswordvalidator>(); return builder ; } in above method, can not pass arguments via prop or constructor ipasswordvalidator implementation. for instance lastpasswordvalidator, want configure based on no. of password counts options, addpasswordvalidator doesn't take data. public class lastpasswordsinpasswordvalidator:ipasswordvalidator<applicationuser> { private int lastpasswordscount { get; set; } public lastpasswordsinpasswordvalidator(ipasswordha

ubuntu - Electron app won't install if name is different than product name -

i using electron-forge create electron app , create distributables project.however encountered strange error. name field in package.json id status-client , productname field. with these values when run electron-forge make executable , can install charm , find app in utilities section in ubuntu. however problem comes when change productname field in package.json file.the executable created able install if search app new name cannot find anywhere. here new package.json : { "name": "status-client", "productname": "foo", "version": "1.0.4", "description": "monitor when raspberry pi goes online , when offline desktop notifications", "main": "src/index.js", "scripts": { "start": "electron-forge start", "package": "electron-forge package", "make": "electron-forg

Python Request for JSON file returns None -

Image
from fake_useragent import useragent import requests ua = useragent() header = {'user-agent':str(ua.chrome)} d = {"query": "/api/v2/details/ip/", "query_entry": "41.219.127.69"} r = requests.get("https://talosintelligence.com/sb_api/query_lookup/", data = d, headers=header) when run same result main site "talosintelligence.com" , @ network counsel, exact url responds json file get request python returns none . i got work setting referer header.. import requests sess = requests.session() ip_addr = "41.219.127.69" ret = sess.get('https://talosintelligence.com/sb_api/query_lookup', data={"query": "/api/v2/details/ip/", "query_entry": ip_addr, "offset": 0, "order": "ip asc"}, headers={'user-agent': 'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/61.0.3163.31 safari/537.36&#

closures - What is the equivalent of Let Over Lambda in Scala? -

i trying adapt "land of lisp" scala , got stuck elegant way lisp can support memoization using classic let on lambda pattern. here example counter in lisp: (let ((count 0)) (defun add-one () (incf count))) how in scala. came with val addone = { var count = 0 () => { count = count + 1; count } } which don't find elegant. better proposals?

Why is it required to provide setting values in all cscfg files for every setting in Azure csdef file? -

if of cscfg files not provide value setting defined in csdef , following error given: role: 'role1', setting 'setting1' in service definition not found in service configuration. if have 10 cscfg files, different environments e.g. prod1, prod2, means every time introduce new setting, have provide value same in 10 cscfg files. many settings optional , code has fallback default value. if code not handling non existence of configuration value, shouldn't there easy way define default value configuration in csdef , let cscfgs override if need to?

Facebook Ads Insights Async Report returns "Job Failed" -

i randomly getting "job failed" status on asynchronous job consecutively. have exponential backoff of 5x , succeeds @ 5th time. there 1 application hitting api 8 hours continuously various access tokens, if relevant. what cause this? ideally, should timeout , not run long, try using different date ranges if account has data. when hitting report, should check percentage completion give more details on that.

javascript - Google Recaptcha doing strange things on iOS Safari Browser -

Image
i think case bit of oddity... have form verified google recaptcha. submit button disabled until recaptcha has been interacted with, using data-callback , js. trying out site on ios device using safari browser, , did recaptcha verification , green check appeared, normal. when scrolled, container div form in disappeared, , entire form greyed out. seemed went behind site background. this screenshot of bug: so, confused least. have not been able find similar issues in searches have done. form integrated php, here's code: <?php if (isset($_request['email'])) { if ($_server["request_method"] === "post") { $recaptcha_secret = "my_secret_key_was_here"; $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_post['g-recaptcha-response']); $response = json_decode($response, true); if ($response["success"] === true)

Do we really need to run webdriver-manager start before running protractor? -

in order run unit tests against ie, run protractor without running webdriver-manager start. according existing online docs (such here ), should run selenium server before running tests on browsers except chrome , firefox, know how protractor work doesn't need selenium server? according protractor github page , protractor start selenium server default. long you've webdriver-manager updated, don't need run webdriver-manager start.

go - Golang convert map[string]*[]interface{} to slice or array of other type -

i have following type results map[string]*[]interface{} var users *[]models.user users = getusers(...) results := results{} results["users"] = users later, id able grab users map , cast *[]models.user i having hard time figuring out right way this. id following, not work. var userresults *[]models.user userresults = (*results["users").(*[]models.user) any idea on how this? here comments on code besides conversion (which addressed @ end). there no real need of using pointer slice in case, since slices header values pointing underlying array. slice values work references underlying array. since interface{} variable can reference values of kind (including slices), there no need use slice of interface{} in result , can define type results map[string]interface{} . having said this, here's how modified code like: var users []user users = getusers() results := results{} results["users"] = users fmt.println(results) var