Posts

Showing posts from August, 2014

recursion - How can I infer a recursive TypeScript Type? -

i building typescript collection class application have struggled find solution in order infer recursive calls. arrays.ts export interface arrayable<t> { toarray(): array<t>; } export function isarrayable<t>(object: any): object arrayable<t> { return typeof object === "object" && 'toarray' in object; } collection.ts import { arrayable, isarrayable } "./arrays"; export class collection<t> implements arrayable<t> { private elements: array<t>; constructor(elements?: array<t> | arrayable<t>) { if (typeof elements === "undefined") return; this.elements = this.getelementsarray(elements); } chunk(size: number): collection<collection<t>> { let chunked = []; (let = 0, len = this.elements.length; < len; += size) chunked.push(new collection(this.elements.slice(i, + size))); return new coll

azure - How can I verify data uploaded to CosmosDB? -

i have dataset of 442k json documents in single ~2.13gb file in azure data lake store. i've upload collection in cosmosdb via azure data factory pipeline. pipeline completed successfully. but when went cosmosdb in azure portal, noticed collection size 1.5 gb. i've tried run select count(c.id) c collection, returns 19k. i've seen complains count function not reliable. if open collection preview, first ~10 records match expectations (ids , content same in adls file). is there way real record count? or other way sure nothing lost during import? according article , find: when using azure portal's query explorer, note aggregation queries may return partially aggregated results on query page. sdks produces single cumulative value across pages. in order perform aggregation queries using code, need .net sdk 1.12.0, .net core sdk 1.1.0, or java sdk 1.9.5 or above. so suggest firstly try use azure documentdb sdk count value. more details how use

r - Finding baseline (reference) of nosiy data and lag/lead between 2 signals -

Image
i have 2 datasets vary time shown in figure - sa – red , sb – black . doing analysis in r. entire dataset , segment of data 30 - 31 s shown below --- raw signals as can see figures, datasets appear similar 1 dataset leads (or lags) other dataset in time. downward peaks appear shifted in time 1 of signals wrt other. determine following – 1. baseline value (reference) 2 signals – there statistical method find out this? there signal processing techniques need applied before determining baseline? sa, baseline more noisy , shifts , down – seems difficult assume constant reference line 2. time lag / lead between these 2 signals – tried make reference line constant removing data points above approximate baseline , replacing approx baseline value. found out values sa1, sa2, sa3, sa4, ..etc. similarly, found sb1 ,sb2, sb3, sb4,… etc filtered data above approximate baseline 2a. there way can map sa1 sb1, sa2 sb2..and on? idea calculate (sa1-sb1), (sa2-sb2),… , find out avera

python - pyPEG2 giving wrong result -

i have created grammar pypeg2 parsing such statements as: a loves b b hates a, hates b , loves d while b loves c here code below: import pypeg2 pp class person(str): grammar = pp.word class action(pp.keyword): grammar = pp.enum(pp.k('loves'), pp.k('hates')) class separator(pp.keyword): grammar = pp.enum(pp.k(','), pp.k('\n'), pp.k('but'), pp.k('and'), pp.k('while')) relation = person, action, person class relations(pp.namespace): grammar = relation, pp.maybe_some(separator, relation) however when try following: >>> love = pp.parse('a loves b b hates , b loves c, relations) i get: traceback (most recent call last): file "<pyshell#64>", line 1, in <module> love = pp.parse('a loves b b hates , b loves c', relations) file "/home/michael/.local/lib/python3.5/site-packages/pypeg2/__init__.py", line 669, in parse raise parser.last

DNS Record not found what does this mean -

i used https://mxtoolbox.com/domain/www.whenyoucantravel.com/ try , obtain understanding of sites health , came twice. don't know means .. i don't understand means. in addition there other warnings showing none of understand. dns whenyoucantravel.com soa expire value out of recommended range more info smtp mx0.123-reg.co.uk reverse dns not match smtp banner more info smtp mx0.123-reg.co.uk warning - not support tls. more info smtp mx0.123-reg.co.uk 5.821 seconds - warning on transaction time more info smtp mx1.123-reg.co.uk reverse dns not match smtp banner more info smtp mx1.123-reg.co.uk warning - not support tls. more info smtp mx1.123-reg.co.uk 5.556 seconds - warning on transaction time this tool looking potential problems in dns records. dmarc whenyoucantravel.com dns record not found this means there no dmarc policy record found domain. dmarc method of controlling ho

ffmpeg scale2ref explanation? -

i'm applying watermark video. i'm trying watermark scale proportionally video dimensions. i've seen maybe dozen different answers using scale2ref, no explanations what's happening, i'm finding difficult know how implement/make changes configs work situation. current overlay command: ffmpeg -i test.mp4 -i logo.png -filter_complex "overlay=0:0" output.mp4 some answers i've looked at: ffmpeg creating gif images, add watermark during creation? ffmpeg fix watermark size or percentage what rules how scale2ref works?

angularjs - Angular 2 Http call to Node server not being invoked -

my http call node server not being invoked. the call initiates following component: @component({ selector: 'app-special-value', templateurl: './special-value.component.html', styleurls: ['./special-value.component.css'] }) export class specialvaluecomponent implements oninit { constructor(private dataservice: dataservice) { } ngoninit() { this.getspecialvalueproducts(); } getspecialvalueproducts() { this.dataservice.getspecialvalueproducts(); } } the service's getspecialvalueproducts() called calls node server: @injectable() export class dataservice { private specialvalueurl = "/api/product/specialvalue"; constructor(private http: http) { } getspecialvalueproducts() { console.log('getspecialvalueproducts() called'); return this.http.get(this.specialvalueurl) .map((response: response) => response.json()) .catch(this.handleerror); } } the connection database successful

android asynctask - looking for a way to speed up my loading of my listview -

the layout of activity want apart fact loads : buttons, text views , listview set within scrollview, whole activity scrolls 1 (rather having listview scroll separately think bad design.) the listview consists of phone contacts, have function, justifylistviewheightbasedonchildren , determines number of contacts in user's phone , hence length of list show. the problem is, activity takes few seconds load - because function determining length of list. tried asynctask putting function in background thread won't work list calculations on has in ui thread. ideas how can may list load faster? here's code : //******for phone contacts in listview // load data in background class loadcontact extends asynctask<void, void, void> { @override protected void onpreexecute() { super.onpreexecute(); } @override protected void doinbackground(void... voids) { // perhaps running thread on ui thread has s

react-native mount component without enzyme -

my test app built latest version of react-native , react [using expo app after following guidlines facebook]. "dependencies": { "expo": "18.0.3", "react": "16.0.0-alpha.12", "react-native": "0.45.1", "react-navigation": "1.0.0-beta.11" } now i'm stuck while writing tests cant use enzyme latest version of react-native. check below thread https://github.com/airbnb/enzyme/issues/928 and want test componentdidmount, fetches data , updates state of component re-render. now how test without using enzyme. enzyme had mount function made possible , dont have shallow render comes part of 'react-test-renderer' my devdependencies follows: "devdependencies": { "jest-expo": "~18.0.0", "jsdom": "^11.1.0", "react-native-scripts": "0.0.40", "react-test-renderer&quo

javascript - angular error not sure why its happening -

i new js , anguar 2 i getting below error when move 3 dots in grid. can tell me how fix it. providing whole code in fiddle , relevant code below. this.sportsdata.lockcolumn(laptop); typeerror: cannot read property 'locked' of undefined @ init.reordercolumn (kendo.all.min.js:49) @ init.lockcolumn (kendo.all.min.js:49) @ swimmingdocuments.lockkgridcolumns (ball-bat.ts:863) @ swimmingdocuments.collectuserdraggedcolumns (ball-bat.ts:847) @ htmldocument.eval (ball-bat.ts:811) @ htmldocument.dispatch (jquery-2.2.3.js:4737) @ htmldocument.elemdata.handle (jquery-2.2.3.js:4549) @ zonedelegate.invoketask (zone.js:236) @ object.oninvoketask (core.umd.js:6233) @ zonedelegate.invoketask (zone.js:235) gym(remote, running): void { if (remote.length <= 0) { return; } this.sportsdata = $('#' + running).data("kendogrid"); let jump = $('#' + running + ' .k-grid-header > div

python - Dask: DataFrame taking forever to compute -

i created dask dataframe pandas dataframe ~50k rows , 5 columns: ddf = dd.from_pandas(df, npartitions=32) i add bunch of columns (~30) dataframe , try turn pandas dataframe: data = ddf.compute(get = dask.multiprocessing.get) i looked @ docs , if don't specify num_workers , defaults using cores. i'm on 64 core ec2 instance , above line has taken minutes without finishing... any idea how speed or i'm doing incorrectly? thanks!

xamarin.android - How to make Zebra Xing (Zxing) as subview in Xamarin Android -

Image
in xamarin.android app, want use zxing scan barcode. want display scanner in view of activity. code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightsum="5"> <button android:text="scan default overlay" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/buttonscandefaultview" android:layout_weight="1" /> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/scanview" android:layout_weight="2" /> </linearlayout> protected override void o

floating point - IEEE 64 and 32 bit float validation in OCaml -

i have string matching following regex \-?[0-9]*\.[0-9]+ supposedly represents ieee floating point number. single or double precision , know type in advance. need check if interpreted valid value in given precission. like: val is_valid_float: string -> bool val is_valid_double: string -> bool for double precision numbers, can parse using float_of_string , catch exception. unsure how deal single precision. @jonathanchan's comments enlightening, more might say. however, i'm not sure mean validation. is "1.0000000000000001" valid float? val f : string = "1.0000000000000001" # float_of_string f;; - : float = 1. # there's no exception indicate number can't represented distinct 1.0. if ignore issues of precision, might not difficult test against representable range string operation. as @jonathanchan points out, best answer depends on how sure need (and want sure of, exactly).

javascript - Getting a navbar to appear on scroll with a white background -

hi guys trying nav bar have white background user scroll down website. reason not sure how white background appear on navbar , mine keeps on disappearing scroll so navbar appears fine no background @ top of page. need user scroll down page, should stick top of screen white background on something : example but have navbar set up, need background appear <body> <div class="parallax"> <div class ="logo"> <img src="images/logo1.fw.png"> </div> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">toggle navigat

Windows batch file ren using date variable -

learned batch while ago in school, haven't ever used until b/c had idea. fun wanted mess around powercfg batteryreport new laptop, want archive. going try , figure out how have file powercfg batteryreport spits out changed in sort of numerical order don't know begin, decided make new line takes current file created , adds date. of taking place inside of special folder created, pathing isnt necessary. @echo off powercfg batteryreport rename "battery-report.html" "batteryreport %date%.html" this exact script works without date variable, never in, of course need variable present in order have multiple reports saved, opposed writing on every time. i've tried messing spacings, quotes vs no quotes, no luck. (or better way, preferably explanation) appreciated. in likelihood, date format contains / illegal in filename. use %date:/=-% in place of %date% . converts each / - (see set /? prompt docco) equally, use %time::=

android - Google Cast v3: Do I _need_ to put the MediaRouteButton in a menu resource as well as the layout XML? -

i'm trying integrate cast v3 our app. our app has activity (no toolbar nor menu) adds fragment (toolbar, no menu). added mediaroutebutton toolbar xml , setup castoptionsprovider illustrated in documentation, though see media route being added our test chromecast device in android logs, mediaroutebutton never appears. if force "visible" in layout xml, appears never enabled. the sample videobrowser app works, things differently: 1. has basic activity toolbar 2. not use fragments 3. has menu associated toolbar it fair amount of work re-architect our code move toolbar fragment (one of many) activity , add menu. really required have functional mediaroutebutton? i'm thinking there has easier way ...

javascript - Broken Ajax and JS while testing out a CDN on three different directories on a Magento Build -

Image
this magento build. believe link or directory structure may have broken. ajax broken , console showing error below. i think has ajax_pager.js:101 references getbaseurl . do may need updated version of prototype javascript framework, version 1.7.3 error log saying error: "throw $continue" deprecated, use "return" instead uncaught typeerror: cannot read property 'length' of undefined @ klass.prepareurlformana (ajax_pager.js:101) @ klass.ajaxproductsupdate (ajax_pager.js:70) @ ajax_pager.js:59 @ responder (prototype.js:5598) i've right clicked on prototype.js , ajax_pager.js files , appear linked correctly still. ajax_pager.js url.substr(this.config.getbaseurl(url).length); line 101 var preparedurl = this.prepareurlformana(this.listconfig.nextbunchurl); line 70 // define if current offset scrolled checkpoint if(scrolledtocheckpoint) { _this.ajaxproductsupdate

vba - Change font in a cell based on a value -

Image
i trying change font in range of cells depending on value of these cells. so, i'd change font of d1 depending on d1's value, , i'd change font of d2 depending on d2's value, , on d33. i able find results how change font of cell depending on value of cell here . vba code did job d1 only. however, did not work d2, d3, d4 , on. could me adjust code need? i apologize if question easy answer, i'm not familiar how vba coding works. this code you've described, in case applying font text in column c based upon special characters mention in column d (notice i'm using 1 rather "1", etc...). if column d doesn't contain of characters, assumes desired font name in column d -- did provide test of code. of course, you'll need modify code particular situation, gets started. option explicit sub fontchange() dim therange range, cell range set therange = range("c1:c16") each cell in therange select case cell.offset(0, 1)

javascript - adding to a value in a database not replacing it -

so storing users 'freinds' in database , using add there freind socket.on('addfreind', function(username, freind) { console.log("add freind " + freind + "to " + username) let query = 'update users set freinds="' + freind + '" username = "' + username + '"'; connection.query(query, function(err) { console.log(err) }); }); but replaces original value new 1 how can add original value i have tried querying original value , adding array , adding new value array putting in database failed horribly , wondering if there simple way

javascript - undefined and NaN, convert to boolean value implicitly vs explicitly -

i'm learning javascript following book "you dont know js". in section " type & grammer ", when discussing implicit vs explicit boolean convertion, author mentioned //come function make sure 1 argument truthy //implicit convertion function onlyone() { var sum = 0; (var i=0; < arguments.length; i++) { // skip falsy values. same treating // them 0's, avoids nan's. if (arguments[i]) { sum += arguments[i]; } } return sum == 1; } //explicit convertion function onlyone() { var sum = 0; (var i=0; < arguments.length; i++) { sum += number( !!arguments[i] ); } return sum === 1; } is explicit coercion form of utility "better"? avoid nan trap explained in code comments. but, ultimately, depends on needs. think former version, relying on implicit coercion more elegant (if won't passing undefined or nan ), , explicit version needlessly more verbose. my questi

sql - Get Next Value within Row Groups in SSRS -

Image
i have problem i'm trying solve getting nextrow value within specific rowgroup. here's i'm trying do: if fields!interventions.value not blank , nextrow(fields!dateoccurred.value) within group within 4 hours y else n and column: if fields!interventions.value not blank compare currentrow(fields!dateoccurred.value) nextrow(fields!dateoccurred.value) , display differences in hours but i'm stuck how expression within ssrs. i saw following question: get previous,current , next record in ssrs report in page issue 1 doesn't work row groups in ssrs. upon further advise, appears isn't possible in ssrs, possible in query itself. this query i'm working with: select row_number() over(partition r.patientid, pl.chartlocationid order p.dateoccurred asc) row#, r.namefirst, r.namelast, p.dateoccurred, case p.interventions when 1 'regular analgesia' when 2 'heat pack' when 4 'cold pack' when 8

hadoop - Presto query Array of Rows -

so have hive external table schema looks : { . . `x` string, `y` array<struct<age:string,cid:string,dmt:string>>, `z` string } so need query column(column "y") array of nested json, can see data of column "y" hive, data in column seems invisible presto, though presto knows schema of field, this: array(row(age varchar,cid varchar,dmt varchar)) as can see presto knows field array of row. notes: 1.the table hive external table. 2.i schema of field "y" using odbc driver, data empty, can see in hive : [{"age":"12","cid":"bx21hdg","dmt":"120"}] 3.presto queries hivemetastore schema. 4.table stored parquet format. so how can see data in field "y" please?

Windows Service in Python -

i following solution provided in following link create windows service python not hang in stopping state when try stop after days running. timeout , windows services long running processes (python) the problem facing after start service seems run once , service in windows service manager have tasks disabled can not stop or restart it. below code. have removed real tasks want perform , replace dummy service add 1 variable (x) every-time runs , write log file. i appreciate tip in trying find mistake. # -*- coding: utf-8 -*- """ created on thu jul 27 09:07:29 2017 @author:aaaa """ import threading import logging import logging.config import win32api import win32serviceutil import win32event class interruptedexception(exception): pass class workerthread(threading.thread): def __init__(self, controller): self._controller = controller self._stop = threading.event() super(workerthread, self).__init__() sel

algorithm - C# system.timers.timer weird behavior -

i trying implement bully coordinator election algorithm. in algorithm, coordinator sends alive message every 10 seconds , processes wait @ least 14 seconds receive alive, if don't receive message within time, initiate dead coordinator election. the problem alivetimer (timer3_count) increasing exponentially , active processes affecting it. don't know why behaving weirdly. when initial coordinator sending alive message counter works after dead coordinator election, behaves weirdly. else if (received_text.contains("alive:")) { settext(received_text + "\n"); coordinator_alive = true; timer3_counter = 0; if (alive_count == 0) { alive_count++; alivetimer.interval = (1 * 1000); alivetimer.enabled = true; alivetimer.elapsed += new system.timers.elapsedeventhandler(alivetimer_elapsed

What is the Organization identifier field in Visual Studio for Mac? What should an individual enter? -

i installed visual studio mac. when go create new project, several project types in "configure [project type]" dialog have "organization identifier" field. what should individual enter here? i.e. when there no company, person, appropriate entry? i seeking explanation of naming convention field.

Double Click Python File to Run Program -

i’ve searched , read many posts none describe do. using debian stretch, i’ve been trying create python 3 program runs otherwise typed command switches @ gnome terminal. how should run: double click created *.py file contains code program. the gnome terminal appears , command/switches appear after $ , program runs. of switches have zeros (0) seems present issue. example command: $ ./binary.bin -j 0 -n 1300 anyone have ideas on how should start write program? suggestions helpful. thank you.

javascript - Use Babel Generated AMD Modules -

i have existing app amd modules based , use require.js on bundling things. need bring bunch of es2015 react code app amd modules , use babel turn them amd modules. here babel config babel: options: sourcemap: false plugins: [ 'transform-class-properties', 'transform-object-rest-spread', 'transform-es2015-modules-amd'] presets: [ 'react','es2015'] dist: files: [{ expand: true cwd: "src/foo/jsx" src: "**/*.js" dest: "build/foo/js/" ext: ".js" }] the result works , generates amd modules follows instance myreact.js module: define(["exports", "react", "prop-types"], function (exports, _react, _proptypes) { "use strict"; object.defineproperty(exports, "__esmodule", { value: true }); var _react2 = _interoprequiredefault(_react); var _proptypes2 = _inte

javascript - Checking to see if a word exist inside of a row in my mysql database with node.js -

so trying allow users add friends , storing of there friends inside of single row of database here code using socket.on('addfreind', function(username, freind) { console.log("add freind " + freind + " " + username) connection.query("update users set freinds = concat(freinds,'' ' " + freind + "') username = ?", [username], function(err) { console.log(err) }); }); it add friends fine if there friend name of nik still allow add him i tried check if user existed in row nothing happened if (connection.query("select * users instr(freinds, '" + freind + "'") > 0) { console.log("something") } what can fix this

java - Support handler exception -

i have controller @putmapping(value = "/changeemail", consumes = mediatype.application_json_value) public httpentity<changeemaildto> showchangeemail( @requestbody @valid changeemaildto changeemaildto ) { system.out.println("email: " + changeemaildto.getemail()); return responseentity.ok(changeemaildto); } throws exception when validation fails methodargumentnotvalidexception. created exception service @exceptionhandler(methodargumentnotvalidexception.class) @responsestatus(httpstatus.bad_request) @responsebody public validationerrordto processvalidationerror(methodargumentnotvalidexception ex) { bindingresult result = ex.getbindingresult(); list<fielderror> fielderrors = result.getfielderrors(); return processfielderrors(fielderrors); } still throwing me exception in console org.springframework.web.bind.methodargumentnotvalidexception: validation failed argument @ index 0 in method: public org.springframework.h

spring - JSP - AJAX and Controller gets the Object but does not update modelAttriibute -

when page loads, populate table. @requestmapping(value = { "/access" }, method = requestmethod.get) public string access(modelmap model) { list<userdto> users = userservice.findallusers(); model.addattribute("users", users); userdto user = new userdto(); model.addattribute("user", user); return "access"; } when user clicks edit on 1 row, ajax called. function getdetails(id) { $.ajax({ type : "get", data : {id: id}, url : "get-details", cache : false, success : function(response) { // code here }, }); } on controller, userdto id provided. @requestmapping(value = { "/get-details" }, method = requestmethod.get) @responsebody public string getdetails(@requestparam("id") string id, modelmap model) { userdto user = userservice.findbyid(id); model.addattribute("user", user); return

php - Regex - Select all numbers without commas -

this question has answer here: extract numbers string 13 answers php - regex - how extract number decimal (dot , comma) string (e.g. 1,120.01)? 6 answers i have been trying capture numbers in sentence stays follows: before: - 602,135 results after: 602135 i testing following: #\d+# select me 602 ps: had consulted in other posts not solve problem. you can use preg_replace try this $str = '- 602,135 results'; echo $result = preg_replace("/[^0-9]/","",$str); output - 602135 you can use same output:- $result = preg_replace('/\d/', '', $str);

laravel 5 - Blade file return the code only -

the blade file index.blade.php @foreach ( $users $user ) <li>{ !! $user['first_name']!! } { !! $user['last_name']!! } { !! $user['location']!! }</li> @endforeach the controller userscontroller , code class userscontroller extends controller { public function index() { $users = [ 0 => [ 'first_name' => 'ranjit', 'last_name' => 'pradhan', 'location' => 'bhubaneswar' ], 1 => [ 'first_name' => 'rojalin', 'last_name' => 'pradhan', 'location' => 'angul' ] ]; return view( 'admin.users.index', compact('users') ); } } and web.php file this route::get( 'users', [ 'uses' => 'userscontroller@index&#

c# - Stopping Multiple Tasks -

i'm using following method create new tasks , long time taking operations in background.if condition met,i need stop tasks , show user message. dowork() { mylist = new list<datamodel.checkdata>(); int index = 0; foreach (var line in mylist) { mylist.add(new datamodel.checkdata() { rawline = line, data = line,filename=virtualfilelist[index].tostring() }); index++; } blockingcollection<datamodel.checkdata> ujobs = new blockingcollection<datamodel.checkdata>(); timerrefreshui.start(); task.factory.startnew(() => { _dtrows.clear(); uiqueue.clear(); uiqueuebad.clear(); uiqueuegood.clear(); (int = 0; < mylist.count; i++) { addresultrow(mylist[i].data, "waiting...",mylist[i].filename, color.white); ujobs.tryadd(new datamodel.checkdata() { rowid = i, data = mylist[i].data }, 1000); } list<task> ope

javascript - how to check browser popup is going to close -

i write code open popup in new window. open window few seconds after close automatically.what want if close before limit of time. detect , show him message. here code using $(document).ready(function() { var mywindow; $("#idview").click(function() { var vidurl = $('#vurl').val(); counter(); mywindow = window.open(vidurl, "popupwindow", "width=600, height=400, scrollbars=yes"); }); function counter() { var n = $('.c').attr('id'); var c = n; $('.c').text(c); setinterval(function() { c++; if (c <= 41) { $('.c').text(c); } if (c == 41) { $('.c').text(n); } }, 1000); } setinterval(function() { mywindow.close(); }, 45000); window.onbeforeunload = closingcode; function closingcode(){ alert('hitme'

How to add website icon in gmail google apps? -

it possible add custom website icon in google app of gmail account? i have create custom website icon in gmail google apps 'google drive','youtube','calendar' etc. if click on icon custom website open in new tab login authentication/after login dashboard i.e don't need login again on custom website. there no gmail button save drive button drive api. however, given use case, seems google sign-in button can work you. works describe, there's button , when click it, handle process of sign-in you. to integrate google sign-in button: must include google platform library on web pages integrate google sign-in. specify app's client id specify client id created app in google developers console google-signin-client_id meta element. <meta name="google-signin-client_id" content="your_client_id.apps.googleusercontent.com"> add google sign-in button < div class="g-signin2" data-onsuccess=&qu

Firebase rules for increment operation not working -

Image
i have simple firebase database, single entry "async-testing/companies: 0". i have following firebase rules, meant set "companies" 0 if undefined, , otherwise allow write if greater current value of "companies" 1: { "rules": { ".read": "auth != null", ".write": "auth != null", "async-testing": { "companies": { ".validate": "(data.exists() && (newdata.val() === data.val() + 1)) || (!data.exists() && newdata.val() == 0)" } } } } however, when attempt set "companies" equal 1 in firebase simulator, not work: even stranger, when set firebase rules accept write if "companies" undefined, works correctly: { "rules": { ".read": "auth != null", ".write": "auth != null", "async-testing"

uiimageview - Overriding the class's property swift -

i want override contentmode of uiimageview wrote code doesn't seem work expected. class aspectfituiimageview: uiimageview { override var contentmode: uiviewcontentmode { { return .scaleaspectfit } set { // contentmode = contentmode } } } can 1 tell me wrong? you should set contentmode in awakefromnib() so: class aspectfituiimageview: uiimageview { override func awakefromnib() { super.awakefromnib() contentmode = .scaleaspectfit } } or if not planning on using nib or storyboard, can use following: override init(frame: cgrect) { super.init(frame: frame) contentmode = .scaleaspectfit }

java - RabbitMQ messaging middleware -

can please share application uses rabbitmq. need application codes make use of rabbitmq sending messages. please help. rabbitmq-perf-test java command line program based on rabbitmq java client. purpose put load on amqp broker. for larger, real world application, there celery , written in python, allows run tasks asynchronously.

Hosting and Speed Optimization solutions for very large listing WordPress website -

i have wordpress listing website. database has been reached 25mbs, , site content more 12gbs. site speed has gone terribly slow. recommend hosting solution , speed optimization? test site speed on https://developers.google.com/speed/pagespeed/insights/ & http://tools.pingdom.com/ both sites find reason of speed related issue. per mentioned site content more 12gbs means site has may images - below 1 of plugin can useful you. https://wordpress.org/plugins/w3-total-cache/ https://wordpress.org/plugins/cache-images/

codable - What errors can happen when encode with Swift JSONEncoder -

jsonencoder method func encode<t>(_ value: t) throws -> data t : encodable throwable. i'm wonder why throwable: if value encode not conform encodable , should not pass compiler, should have no error happen @ runtime. from jsonencoder 's source code : /// - throws: `encodingerror.invalidvalue` if non-conforming floating-point value encountered during encoding, , encoding strategy `.throw`. /// - throws: error if value throws error during encoding. debug descriptions errors: top-level (t.self) did not encode values. top-level (t.self) encoded null json fragment. top-level (t.self) encoded number json fragment. top-level (t.self) encoded string json fragment.

sublimetext3 - stack-share place sublime in devops -

Image
i confused how stack share place sublime in devops while editor idea thanks here link https://stackshare.io/devops there not direct relation between sublime , devops, while sublime has tools can aid in triggering ci/cd pipeline, sublime per se has nothing it, nor other text editor.

php - how to check one field with two values in laravel 4.2 -

$input = input::all(); $user = user::where(function($q) { $q->where('email', $input['email'] ) ->orwhere('email', $input['emails'][0]['value'] ); }) ->first(); print_r($user);die; always says undefined variable: input best way compare email 2 values please guide add use($input) pass $input variable closure scope: user::where(function ($q) use ($input) { closures may inherit variables parent scope. such variables must passed use language construct. http://php.net/manual/en/functions.anonymous.php

c++ - Can my RichEdit Control contain clickable links? -

i want display series of strings edit control or rich edit 2.0 control. after that, want of text displayed underlined , in blue. these underlined texts can clicked open dialog or sort. is there way this? rich edit 2.0 supports automatic richedit hyperlinks while rich edit 4.1 , newer (msftedit.dll) supports friendly name hyperlinks . you can emulate friendly name hyperlinks in rich edit 2.0 using combination of cfe_link , cfe_hidden character formatting flags . mark text cfe_link , hide url applying cfe_hidden . handle en_link notification react on clicks. @ point have parsing extract hidden url rich text. alternatively use cfe_link text , use std::map map text urls. work long there 1:1 mapping of text url. edit: noted want "to open dialog" when link clicked, applying cfe_link should enough in case. edit 2: if don't need display formatted text , don't need scrolling, suggest use syslink control . links displayed syslink control have b

acumatica - Hide Columns in a Grid -

is possible dynamically hide columns in grid (using aef). example, based on conditions want hide columns in graph dynamically. i have used rowselectedevent , have tried use pxuifield visibility functionality not hiding column. there way hide columns graph? rowselected should work. check correctness of typed: 1. rowselected should protected. 2. check pass rowselected pxcache , pxrowselectedeventargs 3. check in setvisible method pass proper column 4. check pass in method setvisible proper view 5. check didn't forget passed not view cache property of view 6. check chosen correct dac class. sometime 2 different dac classes can represent same table ( exapmple apregister, apinvoice. or poorder, poorder2 ) here sample working project: protected void poorder_rowselected(pxcache sender, pxrowselectedeventargs e) { pxuifieldattribute.setvisible<poorderext.allamt>(this.vendororders.cache, null, false); //this code hides column in grid }

django - Why csrftoken cookie works? -

i upgrading django 1.4.3 django 11.3. i have web page 2 different forms. both forms loaded {%csrf_token%}. flow - user logins in using form 1 ( ajax ) , second form displayed. user enters data in second form , submits using ajax. now, request failing if did ( worked under django 1.4.3 ) - csrfmiddlewaretoken = $form.find('input[name="csrfmiddlewaretoken"]').val(); now, fix getting csrftoken value cookie , sending cookie part of ajax , works - csrfmiddlewaretoken = _gethelpercookie('csrftoken'); i confused why getting client cookie works? after login, django calls rotate_token; affect? as say, django rotates csrf token when login security measure. started in django 1.5.2 . since have logged in ajax request, old token still in html. when fetch token html, using old token, csrf error. when fetch token cookie, new token, avoid error.

uitextfield - Swift - code re-use -

i’m after advice on code re-use. i have view controller has (at stage) 12 x labels , 12 x text fields. for each of these labels , fields, there lines of code duplicated (see commented lines below). i wondering best approach re-use lines of code in creation of labels , text fields, without re-writing them time. i’ve looked extension’s, creating class , subclassing common lines of code, keep hitting walls. i use class padding text fields , understand how works, can’t seem add other common attributes class. thanks example: let labela = uilabel() // labela.backgroundcolor = .clear // labela.widthanchor.constraint(equaltoconstant: 150).isactive = true // labela.font = labela.font.withsize(18) // labela.textalignment = .left labela.text = “this 1st label of 12“ let labelb = uilabel() // labelb.backgroundcolor = .clear // labelb.widthanchor.constraint(equaltoconstant: 150).isactive = true // labelb.font = labelb.font.withsize(18) // labelb.textalignment = .left labelb.text