text: Define Shortcut Keys by user (add or edit by user in web app)?
  I have a web app create with angular 7.0 and Nodejs. I want to add a shortcut engine (user customizable) like Microsoft Word that user can add or edit or modify default shortcut keys for some function in this app. is there any code or tips for doing like this?
  2 answers
  - answered 2019-06-17 14:49 Florian
  I guess this package suits your needs !
  - answered 2019-06-17 15:32 Ben Racicot
  I know there is an answer here but I do my best to stay away from packages unless I'm ready to do a deep-dive on what type of code I would be adding to my project.
  Here is the Angular/JavaScript way to trigger functions on keyboard events.
  @HostListener('window:keyup', ['$event']) keyEvent(event: KeyboardEvent) { if (event.keyCode === 27 || event.keyCode === 13) { // console.log(event.keyCode); } }
  I typically use keycode.info or logging key presses to find my key numbers.
  Pseudo code based on comment question regarding user-specific key bindings.
  mock user object saved in database
  user { ... bindings{ featureOne: 27 // key chosen by user for featureOne featureTwo: 13 // key chosen by user for featureTwo } }
  Then you can refer to those choices in the listener
  if (event.keyCode === user.bindings.featureOne) { // trigger featureOne }
  See also questions close to this topic
  - How to info message and error message stored separate file using winston log file?
  I tried to logging info and errors in log file using winston.If any info stored info.log. If uncaught exception errors occurred its stored only error.log file.but If commom errors are occurred its stored both file(info .log and error.log) how to fix it any one give some solution.
  winston.js
  const winston = require('winston'); require('winston-mongodb'); require('express-async-errors'); const winstonLogger = function () { winston.add(new winston.transports.Console({ format: winston.format.combine( winston.format.simple(), winston.format.timestamp(), winston.format.prettyPrint(), winston.format.colorize() ), handleExceptions: true })); // Info Log messages to file winston.add(new winston.transports.File({ filename: 'logs/info.log', level: 'info' })); // Error Log Messages file winston.add(new winston.transports.File({ filename: 'logs/error.log', level: 'error', handleExceptions: true, })); }; module.exports = winstonLogger;
  I want info message stored on info.log file and error message stored on error.log file.uncaught exception error stored in separate file using winston
  - SignalR occurs error [Invalid frame header] when use webpack dev server proxy
  SignalR occurs error [Invalid frame header] when use webpack dev server proxy
  Win10 + NodeJs(10.15.3)
  There is a web frontend project use
  @aspnet/signalrmodule, and develop with
  webpack-dev-server.
  I use
  @aspnet/signalrlike this:
  const connection = new signalR.HubConnectionBuilder() .withUrl('/hubs/global', { accessTokenFactory: () => getToken() }) .build() connnection.on('some event', function doSomeThing() {}) connection .start() .then(() => console.log('start success')) .catch(err => console.error(err))
  I want proxy the websocket connection to my server, so I have configured my
  webpack.config.jslike this:
  proxy: { '/api': { target: `{devServerIp}`, changeOrigin: true, }, '/hubs': { target: `{devServerIp}`, changeOrigin: true, ws: true, }, },
  But I got the follow error: Invalid frame header
  I want the dev-server can proxy the websocket request correctly.
  Do you have some similar experience to solve this problem?
  - How can I use this complete query with sequelizejs
  I want to convert this code to sequelize.
  where ADDTIME(deleted_at, TIMEDIFF(deleted_at, end_at) * 2) > NOW() OR (end_at < NOW() AND deleted_at is null);
  I found below at sequelize docs. But it is not enough to my query.
  Post.findAll({ where: sequelize.where(sequelize.fn('char_length', sequelize.col('status')), 6) });
  I want to convert this code to sequelize.
  where ADDTIME(deleted_at, TIMEDIFF(deleted_at, end_at) * 2) > NOW() OR (end_at < NOW() AND deleted_at is null);
  like this. I don't want to use RAW Query
  - Show data based on echart's pie slice click using Angular
  I just want to show the data of echarts(pie chart) in the table when i click on the pie slice i want to show that corresponding data only in the table (on pie slice click). So i am trying this since so many days but no clue i got. So can anyone suggest how it can be achieved? I mean the data w.r.t that particular pie slice only. Means on clicking the pie slice the that clicked data should be reflected on the table? Please help me on this. For reference please check the image attached.
  const tempArray = this.categoryCount.map(x => ({ value: x.count, name: x.groupBy })); this.ccArray2 = tempArray; // Pie chart this.PlaybookChart3 = { title: { text: "Category Breakdown", x: "left" }, tooltip: { trigger: "item", formatter: "{c}", textStyle: { fontWeight: "bold", fontSize: 13 } }, // Enable drag recalculate calculable: true, series: [ { type: "pie", radius: "75%", center: ["50%", "50%"], selectedMode: "single", data: this.ccArray2, label: { normal: { show: true, position: "outside" }, emphasis: { show: true, textStyle: { fontSize: "13" } } } } ] };
  HTML code:
  <div *</div>
  Thanks.
  - Is there a way to clear rxjs timeout so that I can use retrywhen to retry an http request after allowing the user to login again without timing out?
  If a user gets logged out by the server and the client still thinks that the user is logged in, I will get a
  401error code as expected. However I wish to temporarily "save" and retry the request that failed after the user has been prompted for their credentials and re-signed in. To do this I figured that
  retrywhenwould be great, however when used in conjunction with
  timeoutI start to have issues. I wish to get timeout errors on my client if any request takes longer than 10 seconds, however if the request fails with a
  401status and prompts the user for credentials, I wish to not have that observable error out on me due to a timeout.
  I have tried creating and using a custom service which had a replaySubject so that I could modify the timeout and use switchmap to swap the currently subscribed base observable with the changed timeout value, however this is not specific to one single request due to it's service/singleton nature and would replay for all requests. (I'm sure there are other issues with taking this direction.
  I have a super stripped down example on stackblitz where my "wait for user input" is replaced with a delay to simulate the user taking longer than the rxjs timeout that was set.
  I expect that I should be able to retry a failed httpRequest after a user successfully logs in without timing out and without saving anything to external state
  - "nav nav-pills nav-justified" class not stacking the tabs for mobile views
  I am using the latest bootstrap version in angular. The class "nav nav-pills nav-justified" not stacking the tabs when the screen size is reduced below 768px.
  I referred to the site. which is in the post. In stack overflow I followed Justify Nav-pills with Bootstrap v4 but it does work too
  This is my HTML code
  <div class="container"> <ul class="nav nav-pills nav-justified"> <li class="nav-item"> <a class="nav-link" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}" routerLink="/">Feeds</a> </li> <li class="nav-item"> <a class="nav-link" routerLinkActive="active" [routerLink]="['/status-update']">Status Update</a> </li> <li class="nav-item"> <a class="nav-link" routerLinkActive="active" [routerLink]="['/goal-setting']">Goal Setting</a> </li> <li class="nav-item"> <a class="nav-link" routerLinkActive="active" [routerLink]="['/meet-up']">Meet up</a> </li> </ul> </div>
  I can't understand why it works in here and the same code fails in my case. Please advice.
  - How to take a minidump of a web application on concrete exception running in a farm with periodic recycling?
  - Given: sometimes a certain exception occurs in our web application, which we cannot reproduce, except in production. Unfortunately, there are no telemetry and the logs are not helpful.
  - Wanted: minidump when exception happens
  - Problem: Running procdump is not helpful, because the process is periodically recycled. A solution is needed that would run ProcDump automatically whenever the web application starts and do it on each and every web server in the farm.
  Before engaging in writing an in-house tool to solve this problem I wonder if anything like that already exists. Cannot be that our problem is unique to us.
  - How to take full minidump of a web application hosted in IIS without having it recycled?
  We have a weird situation in production and need to grab a full memory dump. However, writing out the full minidump takes too much time. As a result, IIS recycles the process while the dump is being taken.
  We cannot increase this timeout in IIS, because this is a live pod and we do not want other web servers in the farm to be affected.
  Is it possible to somehow let IIS know that this particular process should not be recycled? Or any other way to be able to take the full minidump in our circumstances?
  The minidump is written to the local file system.
  - ASP.NET: How to Update String data in Web Api Controller using Jquery Ajax?
  Hei everyone. i have project to make communication between my website and my application using web api. i have success to get data from api controller in my application and browser (via url). but i can't update the data in my website. for example: i write a text on input box and click the write button. when i click read button the data not change.
  the data i want to update is string data. here is my code
  Web Api with read/write template
  public class ActionController : ApiController { public string text1 = "Read Data Success"; // GET: api/Action public string Get() { return text1; } // GET: api/Action/5 public string Get(int id) { return "value" + id; } // POST: api/Action public void Post([FromBody]string value) { text1 = value; } // PUT: api/Action/5 public void Put(int id, [FromBody]string value) { } // DELETE: api/Action/5 public void Delete(int id) { } }
  Html
  <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Server Manager</title> <script src=""></script> <link rel="shortcut icon" href="favicon.ico" /> <script src="Scripts/Action.js"></script> </head> <body> <div> <input id="Button1" type="button" value="write" /> <input id="Button2" type="button" value="read" /> <input id="TextIn1" type="text" /> <p id="text1">Text 1</p> </div> </body> </html>
  Jquery
  $(document).ready(function () { $("#Button1").click(function () { var TextIn = $("#TextIn1").val(); $.ajax({ type: 'POST', url: 'api/Action', dataType: 'text', data: TextIn, success: function (response) { alert("Writed " + response); }, error: function (response) { alert(response.responseText); } }); console.log("write complete"); }); $("#Button2").click(function () { $.ajax({ url: 'api/Action', type: 'GET', dataType: 'json', success: function (data, textStatus, xhr) { $("#text1").text("Get " + data); }, error: function (responese) { alert(responese.responseText); } }); console.log("read complete"); }); });
  i know my code looks weird or ambiguous. because this is my first time in web programming