Posts

Showing posts from September, 2010

python - Need help understanding code example - LSTM multivariate time series forecasting -

i have dataset of multiple columns , many rows, each column represents different variable , each row different point in time. want predict value of 1 variables @ next point in time, given data of previous time-step. i found this tutorial doing lstm neural net using keras. adapted code data (dropping no columns, no labelencoding since data floats) , ran without error, still don't understand column being predicted. in example, column predicted first column in spreadsheet. tried move column want predict first in dataset, , scatterplots (predicted vs actual y-value) before , after moving reveals had effect. but, still don't understand why - in code column predicted specified? wiki

R - calculating time per unit using data.table -

thanks helping me out in advance.i have data looks this. code , data: zz <- "srno process username activityname units starttime 1 xyz usera activity1 2 '8/10/2017 11:40:37 am' 2 xyz usera activity1 2 '8/10/2017 11:41:39 am' 3 xyz usera activity1 2 '8/10/2017 11:42:41 am' 4 xyz usera activity2 3 '8/10/2017 11:43:44 am' 5 xyz usera activity2 3 '8/10/2017 11:49:37 am' 6 xyz usera activity1 2 '8/10/2017 11:54:21 am' 7 xyz usera activity1 2 '8/10/2017 11:58:21 am' 8 xyz usera activity2 4 '8/10/2017 11:59:21 am'" dt1 <- read.table(text= zz,header = true) library(lubridate) dt1$starttime <- mdy_hms(dt1$starttime) dt1$units<- as.numeric(dt1$units) dt1$endtime <- c(dt1$starttime[-1],dt1$starttime[length(dt1)]) dt1$timeinsecs <- dt1$endtime- dt1$starttime li

c# - Casting object list which inherits type to new interface type list -

for example imagine have following interface , class configuration: public interface ianimal { } public interface idog : ianimal { } public class animal : ianimal { } then using above configuration in implementation this list<ianimal> listofanimals = new list<animal>(); i wish cast list idog this: list<idog> listofdogs = listofanimals.cast()<idog>.tolist(); i have tried list<idog> listofdogs = listofanimals.cast()<ianimal>.cast()<idog>.tolist(); is possible, possible not 100% sure if can done or not?? currently recieve invalidcastexception list<idog> listofdogs = listofanimals.cast<ianimal>().cast<idog>().tolist(); this work if listofanimals idog . believe looking oftype . list<idog> listofdogs = listofanimals.oftype<idog>().tolist(); also note () , <> reversed. thing note items not idog ignored , not returned. update comment: i lead believe can cast both

windows - How to Give Python Permission to Write Files -

i'm learning python , don't quite have vocabulary describe this. however, can't seem save files created in python window10 computer. discovered while seeking try file save in pandas . discovered same problem when creating db using sqlite3 script seemed have fun no database files appeared. does know how fix this? fyi i've got dual boot ubuntu machine, can save files via python in ubuntu need work on windows machine too. i running python via jupyter notebook. i had make couple changes code snipped linked in order work. a difference between windows , linux file path deliminator forward slash: df.to_csv("tests/ysi_test_files/filehere.csv", index = false) if want hard absolute path file, like: df.to_csv('c://folder//myfilename.csv', index=false) again, if copy folder path windows folder backslashes instead of forward slashes. need change in code save file: c:\users\myuser\desktop\python\ to c:/users/myuser/desktop/p

php - Symfony code logout not reached angular -

i've got little problem , don't know how resolve it. i'm trying implement logout in symfony using angular 1x. of code is: <button ui-sref='logout'>...</button> angular: .state('logout', { url: '/logout', controller: 'logoutcontroller', resolve: .... } ) routing.yml path: /logout defaults: { _controller: appbundle:user:logout } method: [post] usercontroller(appbundle): public function logoutaction(request request){ $something = ""; // if put breakpoint here doesn't enter @ } logoutcontroller: .controller('logoutcontroller', function($scope) { $scope.logout = function(){ //i don't have code available right alg this: localstorage.remove(sessionid); window.location = '#/login' } $scope.logout(); } the last angular part working, redirects me login page, cannot access symfony part , don't know why. url state

regex - Pattern matching in if statement in bash -

i'm trying count words @ least 2 vowels in .txt files in directory. here's code far: #!/bin/bash wordcount=0 in $home/*.txt cat $i | while read line w in $line if [[ $w == .*[aeiouaeiou].*[aeiouaeiou].* ]] wordcount=`expr $wordcount + 1` echo $w ':' $wordcount else echo "in else" fi done done echo $i ':' $wordcount wordcount=0 done here sample txt file last modified: sun aug 20 18:18:27 ist 2017 remove ppas sudo apt-get install ppa-purge sudo ppa-purge ppa: the problem doesn't match pattern in if statement words in text file. goes directly else statement. , secondly, wordcount in echo $i ':' $wordcount equal 0 should value. using grep - pretty simple do. #!/bin/bash wordcount=0 file in ./*.txt count=`cat $file | xargs -n1 | grep -ie "[aeiou].*[aeiou]" | wc -l` wordcount=`expr $wordcount + $count` done echo $wordcount wiki

need to convert procedure to amazon redshift -

can 1 please convert netezza procedure amazon redshift , if possible 1 explain me below procedure create or replace procedure admin_user.sp_log_message(character varying(any)) returns integer language nzplsql begin_proc declare v_log_id integer; p_message alias $1; begin select next value nz_bi_wksp..process_run_seq v_log_id; insert nz_bi_wksp..process_run_log ( process_run_seq, log_message, log_timestamp ) values ( v_log_id, p_message, current_timestamp ); commit; end; end_proc; wiki

css - Styling native tooltip from title="Tooltip text" -

i have input element has title attribute of course result tooltip message of attribute value. for reason tooltip needs styled css. how can done? not know in container rendered, not know nothing it. cannot accessed developer tools of firebug it seems there in fact pure css solution, requiring css attr expression, generated content , attribute selectors (which suggests works far ie8): a[title]:hover:after { content: attr(title); position: absolute; } source: http://jsfiddle.net/tdqwn/ update w/ input @viroscar: please note it's not necessary use specific attribute, although i've used "title" attribute in example above; recommendation use "alt" attribute, there chance content accessible users unable benefit css. update again i'm not changing code because "title" attribute has come mean "tooltip" attribute, , it's not idea hide important text inside field accessible on hover, if you're interested in

deep linking - When the link is clicked it needs to be taken to a specific detail screen of my android app -

as if now, have app has list of items , clicking on item has item detail screen each item having unique id. , if i'm sharing link of specific item details screen eg. through whatsapp clicking on link should not open app should take user specific detail screen of app. you have information in android documentation . when have deep linking working, creating links trivial. usually in use case urls created real http links, can have server responds url in case user doesn't have app installed, @ least can see fallback page information , link relevant app stores. wiki

amazon web services - How to get access token once authenticated via AWS Federated Identities -

i understand can access token when authenticate via cognito user pools method: cognitouser.authenticateuser(authenticationdetails, { onsuccess: function (result) { console.log('access token + ' + result.getaccesstoken().getjwttoken()) now, how access token when use federated identities facebook, google? possible access token? able see facebook token, not aws token right in aws user pools. wiki

c# - Class with [Serializable] attribute refuse to serialize -

i have class decorated [serializable] attribute. creating object of class , adding datatable. when serialize datatable using binaryserializer getting error as type not implement ixmlserializable interface therefore can not proceed serialization. here sample code [serializable] class propertydata { // properties } class main { propertydata obj = new propertydata(); dttable.rows.add(val1,val2,val3, obj); // ... objbinaryformatter.serialize(stream, dttable); // throws exception } please suggest solution. binaryformatter expects [serializable] attribute alright, exception not seem come binaryformatter, xmlserializer . problem seems class not public. however, code not clear, seem serializing datatable. try store datatable inside dataset , instead serialize that. for quick reference, please checkout .net serializers wiki

php - Conflict between two images that begin with same letter -

i have problem showing 2 images begin same letter, first 1 showing when call url, second 1 redirect me 404 error page ... notice when change name of second image different first letter, showing normally. name of 2 images using: tinyimg.png tosave.png and wanted show them on webpage: http://localhost/assets/img/tinyimg.png or http://localhost/assets/img/tosave.png ! second 1 redirect error page 404. this htaccess file using in root directory: options +followsymlinks rewriteengine on rewritecond %{request_filename} !-f rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f rewriterule ^/(css|js|img)/([a-za-z0-9_-]+)?$ /$1/$2 [l,qsa,r=301] can show me error is? wiki

Haskell error handling, log invalid file path to console -

as part of this project , i'd validate path of file that's provided passwords, i.e. pwds <- case cfgpasswords of passpath -> (map (just . t.unpack) . lines) <$> readfileutf8 passpath , in case path file not valid i'd log message effect console. how accomplish in haskell? logf' "log level {}" [show loglevel] setloglevel loglevel debugf' "configuration: {}" [show cfg] ncpus <- getnumprocessors logf' "utilizing {} core(s)" [ncpus] setnumcapabilities ncpus pwds <- case cfgpasswords of passpath -> (map (just . t.unpack) . lines) <$> readfileutf8 passpath nothing -> return $ replicate (length cfgpublickeys) nothing when (length cfgpublickeys /= length cfgprivatekeys) $ errorl' "the same amount of public keys , private keys must specified" when (length cfgpublickeys /= length pwds) $ errorl' "the same amount of passwords must included in passwords fi

c# - Can Json Schema Validation via Newtonsoft.Json.Schema validate VALUES? -

i have small sample. if json good, works correctly. if change "tag" (aka, property name), works correctly having invalid messages. if change value of guid non-guid-value, json schema validation not fail. is there way fail validation guid value? public class mycoolobject { public guid theuuid { get; set; } public int32 theinteger { get; set; } public datetime thedatetime { get; set; } } and test method. when = 2 (and i'm setting string contain "notaguid-3333-3333-3333-333333333333"), when don't error messages like to. private static void runjsonschemavalidate() { /* note, theuuid of type "string" , format "guid" */ string jsonschematext = @" { ""typename"": ""mycoolobject"", ""additionalproperties"": false, ""type"": ""obje

Gcloud ssh permission denied after running command -

i receive permission denied (publickey,gssapi-keyex,gssapi-with-mic). error: (gcloud.compute.ssh) [/usr/bin/ssh] exited return code [255]. error after run: gcloud compute ssh instance-1 --zone us-east1-d --command "tar -xf archive.tar" i can run --command "ls -al" fine. looks user you're ssh-ing can't run command. if that's case when run gcloud compute ssh instance-1 --zone us-east1-d , issue command tar -xf archive.tar should see same error. you? wiki

javascript - jquery display none not working -

gurus, using jquery hide or display fields based on field value options. used hide , show function , working fine, there white space. changed use jquery display none hide fields. doesn't work, please help, thank you! below code. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript"> jquery(document).ready( function(){ hiderating('initial'); } ); function hiderating(scope){ if(scope=='initial'){ jquery('[id$=callsupportbeforeoutput]').style.display = "none"; jquery('[id$=callsupportbeforequestionlabel]').style.display = "none"; } } jquery('[id$=callsupportbeforeoutput]') return array need provide index change style of elements. see below snippet. jquery(document).ready( function(){ hiderating('initial&

CLion checks and extern declaration of a C++ class without default constructor -

Image
i have working class, example: // myclass.h class myclass { public: explicit myclass(unsigned char enablepin); void enable(bool enable); private: const unsigned char menabepin; }; // myclass.cpp #include "myclass.h" #include <gpio.h> myclass::myclass(unsigned char enablepin) : menabepin(enablepin) { } void myclass::enable(bool enable) { gpio_set(menabepin, static_cast<unsigned char>(enable ? 0 : 1)); } then have in file extern declaration of 1 instance of class: // main.h extern myclass myclass; and of course actual definition in 1 .cpp file: // main.cpp #include "main.h" #include <board.h> myclass myclass(board::pins::myclass_enable_pin); int main() { // ... myclass.enable(true); } this compiles without warnings -wall -wextra , works well. however seems clion 2017.2.1 not extern declaration , complains about: and offers me these intention actions: despite fact recognises decl

c# - Session get null After login immediately in ASP.NET MVC 5 -

on login assigning values session after login becomes null. set session timeout still doesn't work. public actionresult login([bind(include = "username, password")] loginmodel loginmodel, string returnurl) { if (modelstate.isvalid) { egov_users egov_users = db.egov_users .where(p => p.usertype.type != "o" && p.username == loginmodel.username) .firstordefault(); if (egov_users == null) { modelstate.addmodelerror("", "invalid username"); return view(); } else { if (egov_users.password != loginmodel.password) { modelstate.addmodelerror("", "invalid password"); return view(); } var logindetail = new logindetails(); logindetail.suppli

javascript - Handling complex data objects with Reactjs -

i trying create table of orders. work react+redux. have data stored in props. data structured similar this: (a bit more detailed) [{ //stored in props(redux state) "id": 37, //order 1 "content": { "items": { "47427": { "price": "12.49", "format": "[\"1x12\"]", "quantity": 1, }, "23451": { "price": "18.99", "format": "[\"1x7\"]", "quantity": 1, }, } }, "address": { "first_name": "tyrion", "last_name": "lannister", "line1": "the red keep", "city": "king's landing", "country": "westeros", } }, { &qu

Using java Fileutils.listfiles on large directories UNIX -

i have working tree following: root ├─site1 | ├─file.def | ├─subfolder1 | └─subfolder2 ├─site2 | ├─file.def | ├─subfolder1 | └─subfolder2 └─site3 └... there thousands of files contained in subfolders. now, want read file.def, contains data site's subfolders , open subfolders according said data. i'm pretty sure there better way here's solution: collection<file> deffiles = fileutils.listfiles("c:/root", acceptmapdef, true); //listfiles accepting def files collection<file> otherfiles = fileutils.listfiles("c:/root"), acceptmapothers, true); //listfiles accepting every other file for(files def: deffiles){ // read def file for(files file: otherfiles){ // creates jsonobject correspondance between def file // , html files found in subfolders } } now, when run script on unix, after time process crashes , "too many files open" exception thrown. imo, fact script reads files twice problem, since i'm new fil

How to add an upload FileField in the Silverstripe User Forms module -

i have silverstripe website admins can create online forms using userform module . on older website work userform has form option 'file upload field'. on current website i've downloaded latest version of userform module option file upload not listed in form options. know i'm missing/ need give admins ability add file uploader page? here's image of available options, silverstripe form dropdown it looks editablefilefield requires secure assets module work. if secure assets module not installed, file upload field not appear. wiki

nextjs - How to set up Google Analytics through Google Tag Manager for Next-Js? -

formerly using react-ga npm module insert google analytics in next js app. , this: import reactga 'react-ga' export const initga = () => { reactga.initialize('ua-*******-*', { titlecase: false }) } export const logpageview = () => { if (window.location.href.split('?')[1]) { reactga.set({page: window.location.pathname + '?' + window.location.href.split('?')[1]}) reactga.pageview(window.location.pathname + '?' + window.location.href.split('?')[1]) } else { reactga.set({page: window.location.pathname}) reactga.pageview(window.location.pathname) } } and calling logpageview function in header(that inserted every page of app) this: componentdidmount () { if (!window.ga_initialized) { initga() window.ga_initialized = true } logpageview() } componentwillreceiveprops () { if (!window.ga_initialized) { initga() window.ga_initialized = true }

python - Am I slicing it right? -

import os import re import nukescripts sys import platform # f:/projetos/03_o rico e o lazaro/scr_131/cn_04/take_001/setups/nuke/scr_131_cn_04_take_001_comp_v07.nk s = nuke.selectednode().knob('file').getvalue() # read node create setup fullsplit = re.split('/',s) #turn path list fullsplit = fullsplit[-1] # hack index last item of list #split path folder creation split1 = fullsplit.rsplit('_',6)[0] #scenename split2 = re.search(".*(cn_.*)",fullsplit) cn = split2.group(1).rsplit('_',4)[0] #takename split3 = re.search(".*(take_.*)",fullsplit) take = split3.group(1).rsplit('_',2)[0] #scriptname split4 = re.search(".*(scr_.*)",fullsplit) scr = split4.group(1).rsplit('_',6)[0] #novelname split5 = re.search(".*(cbfx_.*)",s) split5 = split5.group(1) novel = re.split('/',split5)[1] fullscript = scr + '_' + cn + '_' + take + '_comp_v01.nk' pathname = server + n

scikit learn - Does sklearn.linear_model.LogisticRegression always converge to best solution? -

when using code, i've noticed converges unbelievably (small fraction of 1 second), when model and/or data large. suspect in cases not getting close best solution, hard prove. nice have option type of global optimizer such basin hopping algorithm, if consumed 100 1,000 times cpu. have thoughts on subject? this complex question , answer might incomplete, should give hints (as question indicates knowledge gaps): (1) first disagree desire some type of global optimizer such basin hopping algorithm, if consumed 100 1,000 times cpu not in cases (in ml world) differences subtle , optimization-error negligible compared other errors (model-power; empirical-risk) read "stochastic gradient descent tricks" (battou) overview (and error-components!) he gives important reason use fast approximate algorithms (not fit in case if 1000x training-time not problem): approximate optimization can achieve better expected risk because more training examples can processed du

javascript - isPrototypeOf and __proto__ have different results -

the following 2 expressions: "abc".__proto__.__proto__ === object.prototype // true object.prototype.isprototypeof("abc") // false the first expression proves object.prototype lies in prototype chain of "abc". however, second expression gets opposite result. i confused. hope can explain. "abc" not object. when evaluate "abc".__proto__ , string wrapper object implicitly constructed retrieve prototype of, , object.prototype in wrapper object's prototype chain. object.prototype.isprototypeof("abc") doesn't construct wrapper object. looks @ "abc" , sees "abc" isn't object , has no prototype chain, , returns false. can see in ecmascript spec (version 6): when isprototypeof method called argument v, following steps taken: if type(v) not object, return false. wiki

jquery - JavaScript: JSON Conditional based on user response -

this driving me crazy. user clicks on button reserve it. ajax returns value based on whether or not reservation successful: reservation successful, clear old reservation, or blocked because reserved it. value returned view , button changes based on user's choices. i've tried every possible iteration, , won't work. though console.log says value == 1, js won't admit value == 1, , i'm sent error message every time. views.py @ensure_csrf_cookie def reserve(request): if request.is_ajax(): pk = request.post['pk'] slot = event.objects.get(pk=pk) user = request.user if slot.is_reserved == true: if user == slot.teacher: slot.is_reserved = false slot.teacher = none slot.save() result = "1" else: result = "3" else: slot.is_reserved = true slot.teacher = user

php - Laravel 5.4 array remove key index -

in controller, statement generates array: // sort region collection continent faster access in front end $finalregions = $regions->sortby('continent_id'); { "0":{ "id":1, "name":"alaska", "image_x":227, "image_y":117 }, "1":{ "id":5, "name":"australian antartic territory", "image_x":1187, "image_y":1037 .... } } how remove index resulting object, looks this: [ { "id":1, "name":"alaska", "image_x":227, "image_y":117 }, { "id":5, "name":"australian antartic territory", "image_x":1187, "image_y":1037 .... } ] this stored in field cast json in table class. $res = []; foreach ($finalregions $key => $value)

javascript - Error in Gravity forms Blank Screen -

i getting black screen after submit button click. when inspect element following error in console xmlhttprequest cannot load data:text;charset=utf-8,. response preflight request doesn't pass access control check: value of 'access-control-allow-credentials' header in response '' must 'true' when request's credentials mode 'include'. origin 'chrome-extension://cfkpefbllpconnkfpdgagkifmflckkdp' therefore not allowed access. credentials mode of requests initiated xmlhttprequest controlled withcredentials attribute. please me remove error wiki

javascript - Reading files from CD using HTML5, webkitdirectory takes more time compared to reading local files -

i have web application allows user upload dicom , non-dicom files account. using javascript , html5 , webkitdirectory , chrome , datatable populate selected files on ui. issue facing - while selecting files local machine following code seems work pretty fast , selected files populated on ui, while selecting same amount of files cd takes time render on ui. here example - for cd 20 dicoms + 2 non dicoms studies, , 2241 images, takes 5-6 min populate list first time on ui. if try select same cd folder, list populate in 60 sec if it’s been populated once before during same session. but if use same set of files local machine takes 6 -7 sec populate on ui. here code executed each , every dicom file - var filereader = new filereader(); filereader.onload = function(evt){ console.log("completed reading"); var arraybuffer = filereader.result; var bytearray = new uint8array(arraybuffer); _parsedicom(bytearray); try { if (file

IRC bot written in python : TypeError: string or unicode text buffer expected, not NoneType -

i'm getting following error message code: traceback (most recent call last): file "bot.py", line 21, in <module> ircsock.connect((irc_server, port)) # here connect irc server typeerror: string or unicode text buffer expected, not nonetype here's source code written in python: import socket import string ircsock = socket.socket(socket.af_inet, socket.sock_stream) irc_server = raw_input("enter irc server wish connect: ") port = raw_input("enter irc server port: ") nick = raw_input("enter irc nickname of bot: ") channel = raw_input("enter irc channel bot join, don't forget add # before name: ") ident = 'bot' realname = 'syrius b0t' ircsock.connect((irc_server, port)) # here connect irc server ircsock.send(bytes("user "+ ident +" "+ ident +" "+ ident + " " + ident + "\n", "utf-8")) #we filling out form line , saying set fields bot

android - Cannot Install Cardview Repository -

Image
previously asked question i cannot install cardview support repository. gradle recognizes need installed , gives following error. cannot click install repository , sync. rather, can click nothing happens when do. app gradle file apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.0" defaultconfig { applicationid "pro.bladebeat.projectpsittacosaurus" minsdkversion 19 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile('com.android.support.t

angular - Scroll to change background but keep image fixed -

im working angular2 app , want add effect 1 using in google's primer: http://www.yourprimer.com/ . can use fullpage.js fixed device's image, background can change when scroll, right? how can sync change of image on device screen? suggestion please? wiki

css3 - Simplest css,js pop-up -

here html,css , javascript code: <body onload="document.getelementbyid('chrome_popup').style = 'position: fixed; left:0; bottom:10%; height:10%; width:100%;';"> <div id="pop-up" style="position: fixed; left:0; bottom:-10%; height:10%; width:100%;"> hi </div> </body> i want div pop-up when document opened. please add transition code me. the css below going you: #pop-up { -webkit-transition:all .8s ease; -moz-transition:all .8s ease; -ms-transition:all .8s ease; -o-transition:all .8s ease; transition:all .8s ease; } by way, html tags start lowercase, not upper ones! use <body></body> instead of <body></body> #pop-up { -webkit-transition:all .8s ease; -moz-transition:all .8s ease; -ms-transition:all .8s ease; -o-transition:all .8s ease; transition:all .8s ease; } <body onload="document.getelementbyid('pop-up').style = 'po

indexing - Returning the value of a cell corresponding to the 5 latest dates -

so football team use google spreadsheets plan matches ahead , store our results. overview or summary spreadsheet i'm trying show form of team based on latest 5 played matches. list of unplayed , played matches looks this: type|date|opponent|location|kick off|result|w/d/l so whenever match has been played complete row of specific match filling in result whatever score achieved (e.g. 2-1,1-1 etc.) , either w d or l in final column based on result. show form of team in last 5 matches thought use easy vlookup return corresponding w d or l, show w w d l w. tried this: =(vlookup(large datecolumn;1);range;7;true) =(vlookup(large datecolumn;2);range;7;true) =(vlookup(large datecolumn;3);range;7;true) =(vlookup(large datecolumn;4);range;7;true) =(vlookup(large datecolumn;5);range;7;true) but didn't work unplayed matches in list, returns empty cells. i'm looking way make return value corresponding latest date , isn't empty cell. when doing own search around on subject

aws lambda - Confused on creating an update request for DynamoDB using API Gateway -

i'm writing lambda function resources posting phone number. below code. exports.handle = function (e, ctx, cb) { var body = json.parse(e.body); var params = { tablename: 'useraddresses', filterexpression: '#phone = :phone', expressionattributenames: { "#phone": "phone" }, expressionattributevalues: { ":phone": body.phone } } dynamodb.scan(params).promise().then(function (data) { var uw = data.items[0]; var res = { "statuscode": 200, "headers": {}, "body": json.stringify(uw) }; ctx.succeed(res); }); } this working fine. want same put , patch. can 1 please point me in right direction. for patch, should like, phone should passed queryparameter , body updated in json body thanks is phone number hash key? if so, use dynamodb.get() or

php - How to fix Wordpress 404 moving from Apache to Nginx (Vesta)? -

hi :) have wordpress sites, trying move them shared hosting vps. first site moved without problems, still next site gives complete 404. doesn't matter base credentials use (no 'connect database' problem), no reaction. still can see static files inside directory (like robots.txt). my main concern htaccess settings. on shared server used custom setting redirect: rewriterule ^(s-stat) - [l] options +followsymlinks rewriteengine on rewritecond %{http_host} ^www\.ecobig\.ru$ [nc] rewriterule ^(.*)$ https://ecobig.ru/$1 [r=301,l] rewritebase / rewritecond %{http:x-https} !1 rewriterule ^(.*)$ https://%{http_host}/$1 [r=301,l] moving nginx (vestacp) deleted htaccess files, hoping it'll work , adjust redirect later. still no signals of life site. what need do? fix nginx conf, or add redirects, or disable plugins, before transfering? idea valuable :) also, said before, i've moved 1 non-https site vpn , works great, https can issue. specs: ubuntu 16.04 vestacp

php - google-sheets api not triggering onEdit function in google sheets -

i'm using php write data google sheets. however, trigger onedit function on google sheets isn't firing when data written php. here's piece of code used write down data: $body = new google_service_sheets_valuerange(array('values' => $resultarraygen)); $params = array('valueinputoption' => $valueinputoption); $range = 'main!f2:k'; $result = $service->spreadsheets_values->update($spreadsheetid, $range, $body, $params); is there anyway use google services sheets api trigger onedit function in google spreadsheets? thanks wiki

excel - How to apply functions on a cell after fetching data from VLOOKUP -

Image
i have following data map channel value transformation coefficient 10 ln(log) 0.1 b 20 ^(squared) 0.2 i'm using vlookup generate data need apply these transformations value of 1 cell e.g. channel metric transformedval 100 =ln(100) 200 =ln(200) b 200 =200^2 not sure if can directly vlookup. pointers? when read link antidrondert posted answer seem clearer :-) states excel has evaluate formula designed take text string , evaluate if formula, there because of compatibility purposes cant use normal formula. however, can still use in named ranges. need create named range text string of want have calculated. in case need have ln(...) , (...)^2 added formula. know need add before after cell reference (the metric). split needed formula 2 parts - 1 goes before cell reference, second goes after cell reference. "ln(...)" "ln(" , ")" , store these values in columns next first tabl

Sum if condition is true and background color is not - Google Spreadsheet -

Image
i'm trying use function 2 conditions - sum if condition true , sum if background color not. normally i'll use function sumifs here have 1 built-in function , 1 custom function. both of functions work fine separately cannot combine them one. to "sum if condition true" i've used built-in function sumif , "sum if background color not" i've used function script library. here link spreadsheet spreadsheet additional thing need sum different columns ex. values2 same conditions. using @ritz code i'm trying modify code , have script: /** * @return sum of range b corresponding value in column matches color * @customfunction */ function conditionalcheck(color,rangecondition, rangesum, criteria){ var condition = spreadsheetapp.getactivespreadsheet().getactivesheet().getrange(2,rangecondition,11).getvalues(); var val = spreadsheetapp.getactivespreadsheet().getactivesheet().getrange(2,rangesum,11).getvalues(); var bg =

html - Is there way to set empty div size like image size css -

i wonder if can set div ratio responsive image in css. example, have image (800px x 400px) , set css width:100%. when use desktop screen (widht: 1400px), image auto resize , full width of screen => image size (1400px x 700px). element, have set both width , height there way set empty width 800px , height 400px, , auto resize depends on screen size, , still keep ratio image. thank you if browser support allows you, may use viewport units convey aspect ratio div. rest handled browser. you may define class names different sizes. 1 work 16:9 images is: width: 100vw; height: 77.78vw; 16 / 9 => 1.777777777777778; in case 100% width of viewport need 77.78% height of viewport applied element. you can pre-define classes different aspect ratios or use simple js calculate this. codepen (same below): https://codepen.io/mchaov/pen/vjrgya html, body { height: 100%; margin: 0; padding: 0; } div { margin: 0; padding: 0; border: 1px solid red

typescript - Changing angular 2 services to HttpClient structure broke the application -

Image
i updated services using {httpclient} @angular/common/http instead of {http, response} @angular/http all services migrated following structure: import {injectable} '@angular/core'; import {httpclient} '@angular/common/http'; @injectable() export class exampleservice { private readonly productsapi = '/products'; // url products list api private _initdata: iproduct[] = null; constructor(private http: httpclient, private sharedservice: sharedservice) { } getproducdetail(productid?: number): observable<iproduct> { const apiproductdetail = `${this.productsapi}/${productid}`; return this.http.get<any>(apiproductdetail) .map(initdata => this.extractproductdetail(initdata, productid)); } } it works , compiles no errors, when deploy app web server shows following error in console: error registering service worker: domexception: secure origins allowed uncaught error: cannot resolve para

excel - VBA - how to use macro button for multiple boxes -

i new vba , macro. try explain trying create explain problem have it. there 2 sheets in excel; 'sheet 1' , 'sheet 2'. sheet 1 full of data. data goes column ak , there 4206 rows. sheet 2 consist input cell box 'go' button next box. button assigned macro. what want create? in input cell box type 'gb' , press 'go' button. 'go' button through sheet 1 cells 'gb' in them. there 2 particular columns have 'gb' in them; 1 of them column k , 1 column l. 'go' button in 2 columns 'gb' , filter rows. important note: don't want design macro 'gb' in column k and column l. instead want them 'gb' in column k or column l. what did create? i designed macro , assigned 'go' box. code put in: option explicit sub macro1() ' ' macro1 macro ' sheets("sheet 1").select if activesheet.autofiltermode or activesheet.filtermode activesheet.showalldata

python - Is there a function to extract image patches in PyTorch? -

given batch of images, i'd extract possible image patches, similar convolution. in tensorflow, can use tf.extract_image_patches achieve this. there equivalent function in pytorch? thank you. wiki

java - Are there any ways to check whether a key exists with RedisTemplate? -

are there ways check whether key exists redistemplate? or in other words, there equivalent of redis exists command in redistemplate api? yes, can use public boolean haskey(k key) . you can search exists in redistemplate javadoc wiki

xamarin - How to get list of login users-pubnub -

i trying chat application through pubnub in xamarin.forms,i can able login channel understood keeping break points.now trying list of people had logged in channel. <contentpage.content> <stacklayout horizontaloptions="fillandexpand" verticaloptions="fillandexpand"> <label text="welcome" textcolor="blue" horizontaloptions="center" verticaloptions="center"> <label.fontsize> <onidiom x:typearguments="x:double"> <onidiom.phone> <onplatform x:typearguments="x:double" ios="20" android="20" winphone="20" /> </onidiom.phone> <onidiom.tablet> <onplatform x:typearguments="x:double" ios="30" android="30" winphone="30" />

jquery - How do I activate a hover on link with a touch in touch enabled devices? -

with html this: <a href="http://google.com" class="readmore">read more</a> then css this: a {color:white;} a:hover {background-color:#000;} how can allow hover , link work on 1 tap on touch enabled device? also, there way activate hover on first tap , trigger link on second tap ? jsiddle link i think have prevent click on link , trigger redirection on doubleclick only. change style of <a> focus property $("a").click(function(e){ e.preventdefault(); return false; }) $("a").dblclick(function(){ var location = $(this).attr("href"); console.log("redirection :",location); window.location.href=location; }) a:focus{ color:red; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href="http://google.com">my link</a> nb : redirection blocked in example working

angular - Can't make Accordion and table work together -

Image
so i'm trying make custom table can click part of row , additional field shows up. best way explain want show you.. view should this: so table code looks this: <table class="table message-table"> <thead> <tr> <th class="clickable">title</th> <th class="clickable">date</th> <th class="clickable">action</th> <th></th> </tr> </thead> <tbody> <tr *ngfor="let message of messages | paginate: config"> <td>{{message.title}}</td> <td>{{message.created | date:'longdate'}}</td> <td> <ngb-accordion [closeothers]="true"> <ngb-panel> <ng-template ngbpaneltitle>more</ng-template>

java - Using BIRT CSV emitter with standalone BIRT designer -

i'm using standalone birt designer design reports. i've been generating reports in pdf formats fine, need generate reports in csv. found emitter actuate site . so far i'm running reports site through using tomcat. had set __format=pdf whenever i'm running report. if use plug in, process same? i can't seem find guide out there users using standalone birt. use eclipse , generating , using csv emitter through java codes. can on how plugin works have experience plugin? thank you! wiki

html - Append jquery function load multiple content -

i need suggenstions because i'm going crazy little problem insert data in html page using append jquery function , ajax request. i have html block different content under ul elements...in <ul class="pre-wed-list "> there images insert directly in html code, instead <ul class="pre-wed-list" id="rudr_instafeed"></ul> need photos catch instagram stream ( working ) ajax request reported below. here have html code <div class="container"> <div class="row"> <!-- nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#pre-wed" aria-controls="pre-wed" role="tab" data-toggle="tab">engagement</a></li> <li role="presentation">