How to extend Magento Catalog Image Resize Console command?

In Magento 2.2, there is one command for product image to resize in different sizes.

php bin/magento catalog:image:resize 

This command will read all image dimensions defined in the theme XML(view.xml) and re-generates the images in their respective cache folders(/pub/media/catalog/product/cache directory) to serve them from the cache on storefront.

I want to extend this command by passing argument of product id or sku.

php bin/magento catalog:image:resize --10 

i.e. where 10 would be product id or sku

Have gone through file but not able to set product id or sku in following object.

$  this->productImage 

Reading arguments via this link – Read Console Arguments

I came to know same command going to remove from future releases and Magento has introduced observer for the same. https://github.com/magento/magento2/blob/2.3/app/code/Magento/Catalog/Observer/ImageResizeAfterProductSave.php

Play Console – Alerta: una de tus aplicaciones necesita tu intervención

Tengo este mensaje en mi panel de aplicaciones:

introducir la descripción de la imagen aquí

Desde hace días he intentado subir mi app a la Play Store y ya me la han rezhazado 2 veces, me han dicho que no encuentran la funcionalidad principal de la aplicación. Las primeras 2 veces que envié la app recibí este mensaje por email:

introducir la descripción de la imagen aquí

La primera vez que me la rechazaron actualicé los permisos a lo que me sugerían los de Google. Y rechazaron la aplicación de igual manera.

Ahora es la tercer vez que envío mi app para que la revisen, yo sé que a los de Google les puede tomar horas en revisar una app pero ahora que volví a enviar una nueva versión de la app en el panel de aplicaciones ni siquiera aparece el estado de “pendiente de publicación”. Ahora me aparece directamente

introducir la descripción de la imagen aquí

Ahora mi pregunta es: ¿Hay un cierto límite de rechazos? valoro cualquier aportación.

SPFX rest call response seen in network tab but I cant read it on console

I got an issue I’m doing a rest call to get columns of a list, the call success because I can see the response in the network tab of the developer tools, here is a picture: enter image description here for some reason when I try to console it it looks like that with and without calling the .json() method : enter image description here here is my method:

   export const getListFieldsByGuid = (guid: string, context: WebPartContext)   => {   return context.spHttpClient     .get(   context.pageContext.web.absoluteUrl +     `/_api/web/lists(guid'$  {guid}')/Fields?$  filter=Hidden eq false and    ReadOnlyField eq false`,   SPHttpClient.configurations.v1 ) .then(response => {   console.log("fields without .json():", response);   return response.json(); }); }; 

what am I doing wrong? Moreover, If anyone has a better way to get columns of out specific view of a list I would thank a lot!

Problema ao publica aplicativo no Google Play Console

Amigos gostaria de uma ajuda, estou publicando pela primeira vez um app na play store, criei o aplicativo rodando perfeitamente, jé tenho uma conta no Google play console, criei o app mas quando vou subir o APK assinado para a produção eu recebo o seguinte aviso e não consigo prosseguir:

APK não otimizado

Aviso:

Este APK inclui recursos e códigos não utilizados que são enviados aos usuários. Seu app seria menor se você usasse o Android App Bundle. Quando o app não é otimizado para as configurações do dispositivo, o tamanho do download e da instalação é maior do que o necessário. Apps maiores têm taxas de instalação mais baixas e ocupam espaço nos dispositivos dos usuários.

Resolução:

A fim de otimizar automaticamente o app para várias configurações de dispositivos, use o Android App Bundle ou crie vários APKs.

Alguém sabe me informar como faço para resolver essa questão já tentei de tudo.

A heap-allocated texture class for a console renderer

I am working on a console renderer and I want a heap-allocated dynamic texture class. Since I am quite new to C++, I just want to check the memory management, if I destroy all pointers correctly etc.

class Texture { private :  char** pixels; // heap allocated int width, height;  public :  Texture(int width, int height, const char* texture) {     this->width = width;     this->height = height;      pixels = new char*[width];     for (int x = 0; x < width; x++) {         pixels[x] = new char[height];          for (int y = 0; y < height; y++)             pixels[x][y] = texture[y*width+x];        }  }  Texture(int width, int height, char fill) {      this->width = width;     this->height = height;      pixels = new char*[width];     for (int x = 0; x < width; x++) {         pixels[x] = new char[height];          for (int y = 0; y < height; y++)             pixels[x][y] = fill;          }  }  ~Texture() {     for (int x = 0; x < width; x++)         delete[] pixels[x];      delete pixels; }  Texture getSubTexture(int x, int y, int width, int height) {      Texture newtex(width, height, '?');      for (int xx = 0; xx < width; xx++)         for (int yy = 0; yy < height; yy++) {             newtex.setPixel(xx, yy, getPixel(x+xx, y+yy));         }      return newtex;  }  void setPixel(int x, int y, char c) {     pixels[x][y] = c; }  char getPixel(int x, int y) {     return pixels[x][y]; }  int getWidth() { return width; } int getHeight() { return height; }  }; 

ATM with OOP in Class Library for Console (Client Code) C#

I have completed my bank ATM application in C# class library project. For simplicity, the data of this version will be stored in the List instead of a database. The basic feature are

  • Login
  • Check balance
  • Place cash deposit
  • Withdraw cash
  • Make third party transfer
  • View transactions

Entities

public class UserBankAccount {     public long Id { get; set; }     private long cardNumber;     public long CardNumber { get; set; }         public long CardPin { get; set; }     public string FullName { get; set; }     public long AccountNumber { get; set; }     public decimal AccountBalance { get; set; }     public int TotalLogin { get; set; }     public bool IsLocked { get; set; } } 

public class Transaction {     public int TransactionId { get; set; }     public DateTime TransactionDate { get; set; }     public TransactionType TransactionType { get; set; }     public string Description { get; set; }     public decimal TransactionAmount { get; set; } } 

Enum

internal enum SecureMenu {     [Description("Check balance")]     CheckBalance = 1,     [Description("Place Deposit")]     PlaceDeposit = 2,     [Description("Make Withdrawal")]     MakeWithdrawal = 3,     [Description("Third Party Transfer")]     ThirdPartyTransfer = 4,     [Description("Transaction")]     ViewTransaction = 5,     [Description("Logout")]     Logout = 6  } 

public enum TransactionType {     Deposit,     Withdrawal,     ThirdPartyTransfer } 

Interface

public interface IATMApp {     void CheckCardNoPassword(); } 

public interface ITransaction {     void InsertTransaction(Transaction transaction);     void ViewTransaction(); } 

public interface IUserBankAccount {     void CheckBalance();     void PlaceDeposit();     void MakeWithdrawal(); } 

StaticClass

internal class AtmScreen {     internal const string cur = "RM ";     internal static void WelcomeATM()     {         Console.Title = "Meybank ATM System.";         Console.WriteLine("Welcome to Meybank ATM.\n");         Console.WriteLine("Please insert your ATM card.");         PrintEnterMessage();     }     internal static void WelcomeCustomer()     {         Utility.PrintUserInputLabel("Welcome back, ");     }     internal static void PrintLockAccount()     {         Console.Clear();         Utility.PrintMessage("Your account is locked. Please go to " +             "the nearest branch to unlocked your account. Thank you.", true);          PrintEnterMessage();         Environment.Exit(1);     }     internal static void LoginProgress()     {         Console.Write("\nChecking card number and card pin.");         Utility.printDotAnimation();         Console.Clear();     }     internal static void LogoutProgress()     {         Console.WriteLine("Thank you for using Meybank ATM system.");         Utility.printDotAnimation();         Console.Clear();     }     internal static void DisplaySecureMenu()     {         Console.Clear();         Console.WriteLine(" ---------------------------");         Console.WriteLine("| Meybank ATM Secure Menu    |");         Console.WriteLine("|                            |");         Console.WriteLine("| 1. Balance Enquiry         |");         Console.WriteLine("| 2. Cash Deposit            |");         Console.WriteLine("| 3. Withdrawal              |");         Console.WriteLine("| 4. Third Party Transfer    |");         Console.WriteLine("| 5. Transactions            |");         Console.WriteLine("| 6. Logout                  |");         Console.WriteLine("|                            |");         Console.WriteLine(" ---------------------------");          // The menu selection is tied to Enum:SecureMenu.     }     internal static void PrintCheckBalanceScreen()     {         Console.Write("Account balance amount: ");     }     internal static void PrintMakeWithdrawalScreen()     {         Console.Write("Enter amount: ");     }      // This is the only non-static method.     // Reason is this method needs to return an object.     // ToDo: Find other way to solve this design issue.     internal VMThirdPartyTransfer ThirdPartyTransferForm()     {         var vMThirdPartyTransfer = new VMThirdPartyTransfer();          vMThirdPartyTransfer.RecipientBankAccountNumber = Validator.GetValidIntInputAmt("recipient's account number");          vMThirdPartyTransfer.TransferAmount = Validator.GetValidDecimalInputAmt("amount");          vMThirdPartyTransfer.RecipientBankAccountName = Utility.GetRawInput("recipient's account name");         // no validation here yet.          return vMThirdPartyTransfer;     }     internal static void PrintEnterMessage()     {         Console.WriteLine("\nPress enter to continue.");         Console.ReadKey();     } } 

public static class Utility {     private static CultureInfo culture = new CultureInfo("ms-MY");      public static string GetRawInput(string message)     {         Console.Write($  "Enter {message}: ");         return Console.ReadLine();     }      public static string GetHiddenConsoleInput()     {         StringBuilder input = new StringBuilder();         while (true)         {             var key = Console.ReadKey(true);             if (key.Key == ConsoleKey.Enter) break;             if (key.Key == ConsoleKey.Backspace && input.Length > 0) input.Remove(input.Length - 1, 1);             else if (key.Key != ConsoleKey.Backspace) input.Append(key.KeyChar);         }         return input.ToString();     }      #region UIOutput - UX and output format     public static void printDotAnimation(int timer = 10)     {         for (var x = 0; x < timer; x++)         {             Console.Write(".");             Thread.Sleep(100);         }         Console.WriteLine();     }      public static string FormatAmount(decimal amt)     {         return String.Format(culture, "{0:C2}", amt);     }      public static void PrintConsoleWriteLine(string msg, bool ConsoleWriteLine = true)     {         if (ConsoleWriteLine)             Console.WriteLine(msg);         else             Console.Write(msg);          AtmScreen.PrintEnterMessage();     }      public static void PrintUserInputLabel(string msg, bool ConsoleWriteLine = false)     {         if (ConsoleWriteLine)             Console.WriteLine(msg);         else             Console.Write(msg);      }      public static void PrintMessage(string msg, bool success)     {         if (success)             Console.ForegroundColor = ConsoleColor.Yellow;         else             Console.ForegroundColor = ConsoleColor.Red;          Console.WriteLine(msg);         Console.ResetColor();         AtmScreen.PrintEnterMessage();     }     #endregion } 

ViewModel

public class VMThirdPartyTransfer {     public decimal TransferAmount { get; set; }     public long RecipientBankAccountNumber { get; set; }      public string RecipientBankAccountName { get; set; } } 

Main Class

public class AtmApp : IATMApp, ITransaction, IUserBankAccount {     // This class in charge of main application where by Initialization and Execute      // method will be the only methods to be called when client code run this application.      // This list is used in replace of database in this version.     private List<UserBankAccount> _accountList;     private UserBankAccount selectedAccount;     private const decimal minimum_kept_amt = 20;     private List<Transaction> _listOfTransactions;      public void Initialization()     {         _accountList = new List<UserBankAccount>         {             new UserBankAccount() { Id=1, FullName = "Peter Parker", AccountNumber=333111, CardNumber = 123123, CardPin = 111111, AccountBalance = 2000.00m, IsLocked = false },             new UserBankAccount() { Id=2, FullName = "Bruce Bane", AccountNumber=111222, CardNumber = 456456, CardPin = 222222, AccountBalance = 1500.30m, IsLocked = true },             new UserBankAccount() { Id=3, FullName = "Clark Kent", AccountNumber=888555, CardNumber = 789789, CardPin = 333333, AccountBalance = 2900.12m, IsLocked = false }         };     }      public void Execute()     {         AtmScreen.WelcomeATM();          CheckCardNoPassword();         AtmScreen.WelcomeCustomer();         Utility.PrintConsoleWriteLine(selectedAccount.FullName, false);         _listOfTransactions = new List<Transaction>();          while (true)         {             AtmScreen.DisplaySecureMenu();             ProcessMenuOption();         }     }      public void CheckCardNoPassword()     {         bool isLoginPassed = false;          while (isLoginPassed == false)         {             var inputAccount = new UserBankAccount();              // Actual ATM system will accept and validate physical ATM card.             // Card validation includes read card number and check bank account status             // and other security checking.              inputAccount.CardNumber = Validator.GetValidIntInputAmt("ATM Card Number");              Utility.PrintUserInputLabel("Enter 6 Digit PIN: ");             inputAccount.CardPin = Convert.ToInt32(Utility.GetHiddenConsoleInput());             // for brevity, length 6 is not validated and data type.              AtmScreen.LoginProgress();              foreach (UserBankAccount account in _accountList)             {                 selectedAccount = account;                 if (inputAccount.CardNumber.Equals(account.CardNumber))                 {                     selectedAccount.TotalLogin++;                      if (inputAccount.CardPin.Equals(account.CardPin))                     {                         selectedAccount = account;                         if (selectedAccount.IsLocked)                         {                             // This is when database is used and when the app is restarted.                             // Even user login with the correct card number and pin,                             // If IsLocked status is locked, user still will be still blocked.                             AtmScreen.PrintLockAccount();                         }                         else                         {                             selectedAccount.TotalLogin = 0;                             isLoginPassed = true;                             break;                         }                     }                 }             }              if (isLoginPassed == false)             {                 Utility.PrintMessage("Invalid card number or PIN.", false);                  // Lock the account if user fail to login more than 3 times.                 selectedAccount.IsLocked = selectedAccount.TotalLogin == 3;                 if (selectedAccount.IsLocked)                     AtmScreen.PrintLockAccount();             }              Console.Clear();         }     }      private void ProcessMenuOption()     {         switch (Validator.GetValidIntInputAmt("your option"))         {             case (int)SecureMenu.CheckBalance:                 CheckBalance();                 break;             case (int)SecureMenu.PlaceDeposit:                 PlaceDeposit();                 break;             case (int)SecureMenu.MakeWithdrawal:                 MakeWithdrawal();                 break;             case (int)SecureMenu.ThirdPartyTransfer:                 var screen = new AtmScreen();                 var vMThirdPartyTransfer = screen.ThirdPartyTransferForm();                 PerformThirdPartyTransfer(vMThirdPartyTransfer);                 break;             case (int)SecureMenu.ViewTransaction:                 ViewTransaction();                 break;              case (int)SecureMenu.Logout:                 AtmScreen.LogoutProgress();                 Utility.PrintConsoleWriteLine("You have succesfully logout. Please collect your ATM card.");                 ClearSession();                 Execute();                 break;             default:                 Utility.PrintMessage("Invalid Option Entered.", false);                  break;         }     }      public void CheckBalance()     {         AtmScreen.PrintCheckBalanceScreen();         Utility.PrintConsoleWriteLine(Utility.FormatAmount(selectedAccount.AccountBalance), false);     }      public void PlaceDeposit()     {         // Note: Actual ATM system will just let you         // place bank notes into physical ATM machine.          Utility.PrintConsoleWriteLine("\nNote: Actual ATM system will just\nlet you " +         "place bank notes into physical ATM machine. \n");          var transaction_amt = Validator.GetValidDecimalInputAmt("amount");          Utility.PrintUserInputLabel("\nCheck and counting bank notes.");         Utility.printDotAnimation();         Console.SetCursorPosition(0, Console.CursorTop-3);         Console.WriteLine("");          if (transaction_amt <= 0)         {             Utility.PrintMessage("Amount needs to be more than zero. Try again.", false);             return;         }          if (transaction_amt % 10 != 0)         {             Utility.PrintMessage($  "Key in the deposit amount only with multiply of 10. Try again.", false);             return;         }          if (PreviewBankNotesCount(transaction_amt) == false)         {             Utility.PrintMessage($  "You have cancelled your action.", false);             return;         }           // Bind transaction_amt to Transaction object         // Add transaction record - Start         var transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.Deposit,             TransactionAmount = transaction_amt         };         InsertTransaction(transaction);         // Add transaction record - End          // Another method to update account balance.         selectedAccount.AccountBalance = selectedAccount.AccountBalance + transaction_amt;          Utility.PrintMessage($  "You have successfully deposited {Utility.FormatAmount(transaction_amt)}. " +             "Please collect the bank slip. ", true);     }      public void MakeWithdrawal()     {         Console.WriteLine("\nNote: For GUI or actual ATM system, user can ");         Console.Write("choose some default withdrawal amount or custom amount. \n\n");          var transaction_amt = Validator.GetValidDecimalInputAmt("amount");          // Input data validation - Start         if (transaction_amt <= 0)         {             Utility.PrintMessage("Amount needs to be more than zero. Try again.", false);             return;         }          if (transaction_amt % 10 != 0)         {             Utility.PrintMessage($  "Key in the deposit amount only with multiply of 10. Try again.", false);             return;         }         // Input data validation - End           // Business rules validation - Start         if (transaction_amt > selectedAccount.AccountBalance)         {             Utility.PrintMessage($  "Withdrawal failed. You do not have enough fund to withdraw {Utility.FormatAmount(transaction_amt)}", false);             return;         }          if ((selectedAccount.AccountBalance - transaction_amt) < minimum_kept_amt)         {             Utility.PrintMessage($  "Withdrawal failed. Your account needs to have minimum {Utility.FormatAmount(minimum_kept_amt)}", false);             return;         }         // Business rules validation - End           // Bind transaction_amt to Transaction object         // Add transaction record - Start         var transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.Withdrawal,             TransactionAmount = Math.Abs(transaction_amt)         };         InsertTransaction(transaction);         // Add transaction record - End          // Another method to update account balance.         selectedAccount.AccountBalance = selectedAccount.AccountBalance - transaction_amt;          Utility.PrintMessage("Please collect your money. You have successfully withdraw " +             $  "{Utility.FormatAmount(transaction_amt)}. Please collect your bank slip.", true);      }      public void PerformThirdPartyTransfer(VMThirdPartyTransfer vMThirdPartyTransfer)     {         if (vMThirdPartyTransfer.TransferAmount <= 0)         {             Utility.PrintMessage("Amount needs to be more than zero. Try again.", false);             return;         }          // Check giver's account balance - Start         if (vMThirdPartyTransfer.TransferAmount > selectedAccount.AccountBalance)         {             Utility.PrintMessage($  "Withdrawal failed. You do not have enough " +                 "fund to withdraw {Utility.FormatAmount(vMThirdPartyTransfer.TransferAmount)}", false);             return;         }          if (selectedAccount.AccountBalance - vMThirdPartyTransfer.TransferAmount < minimum_kept_amt)         {             Utility.PrintMessage($  "Withdrawal failed. Your account needs to have " +                 "minimum {Utility.FormatAmount(minimum_kept_amt)}", false);             return;         }         // Check giver's account balance - End          // Check if receiver's bank account number is valid.         var selectedBankAccountReceiver = (from b in _accountList                                            where b.AccountNumber == vMThirdPartyTransfer.RecipientBankAccountNumber                                            select b).FirstOrDefault();          if (selectedBankAccountReceiver == null)         {             Utility.PrintMessage($  "Third party transfer failed. Receiver bank account number is invalid.", false);             return;         }          if (selectedBankAccountReceiver.FullName != vMThirdPartyTransfer.RecipientBankAccountName)         {             Utility.PrintMessage($  "Third party transfer failed. Recipient's account name does not match.", false);             return;         }          // Bind transaction_amt to Transaction object         // Add transaction record (Giver) - Start         Transaction transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.ThirdPartyTransfer,             TransactionAmount = Math.Abs(vMThirdPartyTransfer.TransferAmount),             Description = $  "Transfered to {selectedBankAccountReceiver.AccountNumber} ({selectedBankAccountReceiver.FullName})"         };         _listOfTransactions.Add(transaction);         // Add transaction record (Giver) - End          // Update balance amount (Giver)         selectedAccount.AccountBalance = selectedAccount.AccountBalance - vMThirdPartyTransfer.TransferAmount;          // Add transaction record (Receiver) - Start         transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.ThirdPartyTransfer,             TransactionAmount = vMThirdPartyTransfer.TransferAmount,             Description = $  "Transfered from {selectedAccount.AccountNumber} ({selectedAccount.FullName})"         };         _listOfTransactions.Add(transaction);         // Add transaction record (Receiver) - End          // Update balance amount (Receiver)         selectedBankAccountReceiver.AccountBalance = selectedBankAccountReceiver.AccountBalance + vMThirdPartyTransfer.TransferAmount;          Utility.PrintMessage($  "You have successfully transferred out " +              " {Utility.FormatAmount(vMThirdPartyTransfer.TransferAmount)} to {vMThirdPartyTransfer.RecipientBankAccountName}", true);     }        public void ViewTransaction()     {          if (_listOfTransactions.Count <= 0)             Utility.PrintMessage($  "There is no transaction yet.", true);         else         {             var table = new ConsoleTable("Transaction Date", "Type", "Descriptions", "Amount " + AtmScreen.cur);              foreach (var tran in _listOfTransactions)             {                 table.AddRow(tran.TransactionDate, tran.TransactionType, tran.Description, tran.TransactionAmount);             }             table.Options.EnableCount = false;             table.Write();             Utility.PrintMessage($  "You have performed {_listOfTransactions.Count} transactions.", true);         }     }      public void InsertTransaction(Transaction transaction)     {         _listOfTransactions.Add(transaction);     }      private void ClearSession()     {         // No session is used in this version.     }  } 

Any comment on the my coding style and design pattern? My concern is the ThirdPartyTransferForm() method in AtmScreen class. How should I split the UI nicely in this class? Another major issue I notice is that because ATMApp class implement the interface directly, if client code want to run this ATMApp application, those interface methods will be ‘open’ as well which is not supposed to be.

Sample out the program output is in this link but this video is the older version – https://www.youtube.com/watch?v=JViV7a0ALFY&list=PLIh_aKrRpW7QMaO9o7xxmasz0pvvvEoU-&index=9

I will upload the latest version very soon.

ATM with OOP in Class Library for Console (Client Code) C#

I have completed my bank ATM application in C# class library project. For simplicity, the data of this version will be stored in the List instead of a database. The basic feature are

  • Login
  • Check balance
  • Place cash deposit
  • Withdraw cash
  • Make third party transfer
  • View transactions

Entities

public class UserBankAccount {     public long Id { get; set; }     private long cardNumber;     public long CardNumber { get; set; }         public long CardPin { get; set; }     public string FullName { get; set; }     public long AccountNumber { get; set; }     public decimal AccountBalance { get; set; }     public int TotalLogin { get; set; }     public bool IsLocked { get; set; } } 

public class Transaction {     public int TransactionId { get; set; }     public DateTime TransactionDate { get; set; }     public TransactionType TransactionType { get; set; }     public string Description { get; set; }     public decimal TransactionAmount { get; set; } } 

Enum

internal enum SecureMenu {     [Description("Check balance")]     CheckBalance = 1,     [Description("Place Deposit")]     PlaceDeposit = 2,     [Description("Make Withdrawal")]     MakeWithdrawal = 3,     [Description("Third Party Transfer")]     ThirdPartyTransfer = 4,     [Description("Transaction")]     ViewTransaction = 5,     [Description("Logout")]     Logout = 6  } 

public enum TransactionType {     Deposit,     Withdrawal,     ThirdPartyTransfer } 

Interface

public interface IATMApp {     void CheckCardNoPassword(); } 

public interface ITransaction {     void InsertTransaction(Transaction transaction);     void ViewTransaction(); } 

public interface IUserBankAccount {     void CheckBalance();     void PlaceDeposit();     void MakeWithdrawal(); } 

StaticClass

internal class AtmScreen {     internal const string cur = "RM ";     internal static void WelcomeATM()     {         Console.Title = "Meybank ATM System.";         Console.WriteLine("Welcome to Meybank ATM.\n");         Console.WriteLine("Please insert your ATM card.");         PrintEnterMessage();     }     internal static void WelcomeCustomer()     {         Utility.PrintUserInputLabel("Welcome back, ");     }     internal static void PrintLockAccount()     {         Console.Clear();         Utility.PrintMessage("Your account is locked. Please go to " +             "the nearest branch to unlocked your account. Thank you.", true);          PrintEnterMessage();         Environment.Exit(1);     }     internal static void LoginProgress()     {         Console.Write("\nChecking card number and card pin.");         Utility.printDotAnimation();         Console.Clear();     }     internal static void LogoutProgress()     {         Console.WriteLine("Thank you for using Meybank ATM system.");         Utility.printDotAnimation();         Console.Clear();     }     internal static void DisplaySecureMenu()     {         Console.Clear();         Console.WriteLine(" ---------------------------");         Console.WriteLine("| Meybank ATM Secure Menu    |");         Console.WriteLine("|                            |");         Console.WriteLine("| 1. Balance Enquiry         |");         Console.WriteLine("| 2. Cash Deposit            |");         Console.WriteLine("| 3. Withdrawal              |");         Console.WriteLine("| 4. Third Party Transfer    |");         Console.WriteLine("| 5. Transactions            |");         Console.WriteLine("| 6. Logout                  |");         Console.WriteLine("|                            |");         Console.WriteLine(" ---------------------------");          // The menu selection is tied to Enum:SecureMenu.     }     internal static void PrintCheckBalanceScreen()     {         Console.Write("Account balance amount: ");     }     internal static void PrintMakeWithdrawalScreen()     {         Console.Write("Enter amount: ");     }      // This is the only non-static method.     // Reason is this method needs to return an object.     // ToDo: Find other way to solve this design issue.     internal VMThirdPartyTransfer ThirdPartyTransferForm()     {         var vMThirdPartyTransfer = new VMThirdPartyTransfer();          vMThirdPartyTransfer.RecipientBankAccountNumber = Validator.GetValidIntInputAmt("recipient's account number");          vMThirdPartyTransfer.TransferAmount = Validator.GetValidDecimalInputAmt("amount");          vMThirdPartyTransfer.RecipientBankAccountName = Utility.GetRawInput("recipient's account name");         // no validation here yet.          return vMThirdPartyTransfer;     }     internal static void PrintEnterMessage()     {         Console.WriteLine("\nPress enter to continue.");         Console.ReadKey();     } } 

public static class Utility {     private static CultureInfo culture = new CultureInfo("ms-MY");      public static string GetRawInput(string message)     {         Console.Write($  "Enter {message}: ");         return Console.ReadLine();     }      public static string GetHiddenConsoleInput()     {         StringBuilder input = new StringBuilder();         while (true)         {             var key = Console.ReadKey(true);             if (key.Key == ConsoleKey.Enter) break;             if (key.Key == ConsoleKey.Backspace && input.Length > 0) input.Remove(input.Length - 1, 1);             else if (key.Key != ConsoleKey.Backspace) input.Append(key.KeyChar);         }         return input.ToString();     }      #region UIOutput - UX and output format     public static void printDotAnimation(int timer = 10)     {         for (var x = 0; x < timer; x++)         {             Console.Write(".");             Thread.Sleep(100);         }         Console.WriteLine();     }      public static string FormatAmount(decimal amt)     {         return String.Format(culture, "{0:C2}", amt);     }      public static void PrintConsoleWriteLine(string msg, bool ConsoleWriteLine = true)     {         if (ConsoleWriteLine)             Console.WriteLine(msg);         else             Console.Write(msg);          AtmScreen.PrintEnterMessage();     }      public static void PrintUserInputLabel(string msg, bool ConsoleWriteLine = false)     {         if (ConsoleWriteLine)             Console.WriteLine(msg);         else             Console.Write(msg);      }      public static void PrintMessage(string msg, bool success)     {         if (success)             Console.ForegroundColor = ConsoleColor.Yellow;         else             Console.ForegroundColor = ConsoleColor.Red;          Console.WriteLine(msg);         Console.ResetColor();         AtmScreen.PrintEnterMessage();     }     #endregion } 

ViewModel

public class VMThirdPartyTransfer {     public decimal TransferAmount { get; set; }     public long RecipientBankAccountNumber { get; set; }      public string RecipientBankAccountName { get; set; } } 

Main Class

public class AtmApp : IATMApp, ITransaction, IUserBankAccount {     // This class in charge of main application where by Initialization and Execute      // method will be the only methods to be called when client code run this application.      // This list is used in replace of database in this version.     private List<UserBankAccount> _accountList;     private UserBankAccount selectedAccount;     private const decimal minimum_kept_amt = 20;     private List<Transaction> _listOfTransactions;      public void Initialization()     {         _accountList = new List<UserBankAccount>         {             new UserBankAccount() { Id=1, FullName = "Peter Parker", AccountNumber=333111, CardNumber = 123123, CardPin = 111111, AccountBalance = 2000.00m, IsLocked = false },             new UserBankAccount() { Id=2, FullName = "Bruce Bane", AccountNumber=111222, CardNumber = 456456, CardPin = 222222, AccountBalance = 1500.30m, IsLocked = true },             new UserBankAccount() { Id=3, FullName = "Clark Kent", AccountNumber=888555, CardNumber = 789789, CardPin = 333333, AccountBalance = 2900.12m, IsLocked = false }         };     }      public void Execute()     {         AtmScreen.WelcomeATM();          CheckCardNoPassword();         AtmScreen.WelcomeCustomer();         Utility.PrintConsoleWriteLine(selectedAccount.FullName, false);         _listOfTransactions = new List<Transaction>();          while (true)         {             AtmScreen.DisplaySecureMenu();             ProcessMenuOption();         }     }      public void CheckCardNoPassword()     {         bool isLoginPassed = false;          while (isLoginPassed == false)         {             var inputAccount = new UserBankAccount();              // Actual ATM system will accept and validate physical ATM card.             // Card validation includes read card number and check bank account status             // and other security checking.              inputAccount.CardNumber = Validator.GetValidIntInputAmt("ATM Card Number");              Utility.PrintUserInputLabel("Enter 6 Digit PIN: ");             inputAccount.CardPin = Convert.ToInt32(Utility.GetHiddenConsoleInput());             // for brevity, length 6 is not validated and data type.              AtmScreen.LoginProgress();              foreach (UserBankAccount account in _accountList)             {                 selectedAccount = account;                 if (inputAccount.CardNumber.Equals(account.CardNumber))                 {                     selectedAccount.TotalLogin++;                      if (inputAccount.CardPin.Equals(account.CardPin))                     {                         selectedAccount = account;                         if (selectedAccount.IsLocked)                         {                             // This is when database is used and when the app is restarted.                             // Even user login with the correct card number and pin,                             // If IsLocked status is locked, user still will be still blocked.                             AtmScreen.PrintLockAccount();                         }                         else                         {                             selectedAccount.TotalLogin = 0;                             isLoginPassed = true;                             break;                         }                     }                 }             }              if (isLoginPassed == false)             {                 Utility.PrintMessage("Invalid card number or PIN.", false);                  // Lock the account if user fail to login more than 3 times.                 selectedAccount.IsLocked = selectedAccount.TotalLogin == 3;                 if (selectedAccount.IsLocked)                     AtmScreen.PrintLockAccount();             }              Console.Clear();         }     }      private void ProcessMenuOption()     {         switch (Validator.GetValidIntInputAmt("your option"))         {             case (int)SecureMenu.CheckBalance:                 CheckBalance();                 break;             case (int)SecureMenu.PlaceDeposit:                 PlaceDeposit();                 break;             case (int)SecureMenu.MakeWithdrawal:                 MakeWithdrawal();                 break;             case (int)SecureMenu.ThirdPartyTransfer:                 var screen = new AtmScreen();                 var vMThirdPartyTransfer = screen.ThirdPartyTransferForm();                 PerformThirdPartyTransfer(vMThirdPartyTransfer);                 break;             case (int)SecureMenu.ViewTransaction:                 ViewTransaction();                 break;              case (int)SecureMenu.Logout:                 AtmScreen.LogoutProgress();                 Utility.PrintConsoleWriteLine("You have succesfully logout. Please collect your ATM card.");                 ClearSession();                 Execute();                 break;             default:                 Utility.PrintMessage("Invalid Option Entered.", false);                  break;         }     }      public void CheckBalance()     {         AtmScreen.PrintCheckBalanceScreen();         Utility.PrintConsoleWriteLine(Utility.FormatAmount(selectedAccount.AccountBalance), false);     }      public void PlaceDeposit()     {         // Note: Actual ATM system will just let you         // place bank notes into physical ATM machine.          Utility.PrintConsoleWriteLine("\nNote: Actual ATM system will just\nlet you " +         "place bank notes into physical ATM machine. \n");          var transaction_amt = Validator.GetValidDecimalInputAmt("amount");          Utility.PrintUserInputLabel("\nCheck and counting bank notes.");         Utility.printDotAnimation();         Console.SetCursorPosition(0, Console.CursorTop-3);         Console.WriteLine("");          if (transaction_amt <= 0)         {             Utility.PrintMessage("Amount needs to be more than zero. Try again.", false);             return;         }          if (transaction_amt % 10 != 0)         {             Utility.PrintMessage($  "Key in the deposit amount only with multiply of 10. Try again.", false);             return;         }          if (PreviewBankNotesCount(transaction_amt) == false)         {             Utility.PrintMessage($  "You have cancelled your action.", false);             return;         }           // Bind transaction_amt to Transaction object         // Add transaction record - Start         var transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.Deposit,             TransactionAmount = transaction_amt         };         InsertTransaction(transaction);         // Add transaction record - End          // Another method to update account balance.         selectedAccount.AccountBalance = selectedAccount.AccountBalance + transaction_amt;          Utility.PrintMessage($  "You have successfully deposited {Utility.FormatAmount(transaction_amt)}. " +             "Please collect the bank slip. ", true);     }      public void MakeWithdrawal()     {         Console.WriteLine("\nNote: For GUI or actual ATM system, user can ");         Console.Write("choose some default withdrawal amount or custom amount. \n\n");          var transaction_amt = Validator.GetValidDecimalInputAmt("amount");          // Input data validation - Start         if (transaction_amt <= 0)         {             Utility.PrintMessage("Amount needs to be more than zero. Try again.", false);             return;         }          if (transaction_amt % 10 != 0)         {             Utility.PrintMessage($  "Key in the deposit amount only with multiply of 10. Try again.", false);             return;         }         // Input data validation - End           // Business rules validation - Start         if (transaction_amt > selectedAccount.AccountBalance)         {             Utility.PrintMessage($  "Withdrawal failed. You do not have enough fund to withdraw {Utility.FormatAmount(transaction_amt)}", false);             return;         }          if ((selectedAccount.AccountBalance - transaction_amt) < minimum_kept_amt)         {             Utility.PrintMessage($  "Withdrawal failed. Your account needs to have minimum {Utility.FormatAmount(minimum_kept_amt)}", false);             return;         }         // Business rules validation - End           // Bind transaction_amt to Transaction object         // Add transaction record - Start         var transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.Withdrawal,             TransactionAmount = Math.Abs(transaction_amt)         };         InsertTransaction(transaction);         // Add transaction record - End          // Another method to update account balance.         selectedAccount.AccountBalance = selectedAccount.AccountBalance - transaction_amt;          Utility.PrintMessage("Please collect your money. You have successfully withdraw " +             $  "{Utility.FormatAmount(transaction_amt)}. Please collect your bank slip.", true);      }      public void PerformThirdPartyTransfer(VMThirdPartyTransfer vMThirdPartyTransfer)     {         if (vMThirdPartyTransfer.TransferAmount <= 0)         {             Utility.PrintMessage("Amount needs to be more than zero. Try again.", false);             return;         }          // Check giver's account balance - Start         if (vMThirdPartyTransfer.TransferAmount > selectedAccount.AccountBalance)         {             Utility.PrintMessage($  "Withdrawal failed. You do not have enough " +                 "fund to withdraw {Utility.FormatAmount(vMThirdPartyTransfer.TransferAmount)}", false);             return;         }          if (selectedAccount.AccountBalance - vMThirdPartyTransfer.TransferAmount < minimum_kept_amt)         {             Utility.PrintMessage($  "Withdrawal failed. Your account needs to have " +                 "minimum {Utility.FormatAmount(minimum_kept_amt)}", false);             return;         }         // Check giver's account balance - End          // Check if receiver's bank account number is valid.         var selectedBankAccountReceiver = (from b in _accountList                                            where b.AccountNumber == vMThirdPartyTransfer.RecipientBankAccountNumber                                            select b).FirstOrDefault();          if (selectedBankAccountReceiver == null)         {             Utility.PrintMessage($  "Third party transfer failed. Receiver bank account number is invalid.", false);             return;         }          if (selectedBankAccountReceiver.FullName != vMThirdPartyTransfer.RecipientBankAccountName)         {             Utility.PrintMessage($  "Third party transfer failed. Recipient's account name does not match.", false);             return;         }          // Bind transaction_amt to Transaction object         // Add transaction record (Giver) - Start         Transaction transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.ThirdPartyTransfer,             TransactionAmount = Math.Abs(vMThirdPartyTransfer.TransferAmount),             Description = $  "Transfered to {selectedBankAccountReceiver.AccountNumber} ({selectedBankAccountReceiver.FullName})"         };         _listOfTransactions.Add(transaction);         // Add transaction record (Giver) - End          // Update balance amount (Giver)         selectedAccount.AccountBalance = selectedAccount.AccountBalance - vMThirdPartyTransfer.TransferAmount;          // Add transaction record (Receiver) - Start         transaction = new Transaction()         {             TransactionDate = DateTime.Now,             TransactionType = TransactionType.ThirdPartyTransfer,             TransactionAmount = vMThirdPartyTransfer.TransferAmount,             Description = $  "Transfered from {selectedAccount.AccountNumber} ({selectedAccount.FullName})"         };         _listOfTransactions.Add(transaction);         // Add transaction record (Receiver) - End          // Update balance amount (Receiver)         selectedBankAccountReceiver.AccountBalance = selectedBankAccountReceiver.AccountBalance + vMThirdPartyTransfer.TransferAmount;          Utility.PrintMessage($  "You have successfully transferred out " +              " {Utility.FormatAmount(vMThirdPartyTransfer.TransferAmount)} to {vMThirdPartyTransfer.RecipientBankAccountName}", true);     }        public void ViewTransaction()     {          if (_listOfTransactions.Count <= 0)             Utility.PrintMessage($  "There is no transaction yet.", true);         else         {             var table = new ConsoleTable("Transaction Date", "Type", "Descriptions", "Amount " + AtmScreen.cur);              foreach (var tran in _listOfTransactions)             {                 table.AddRow(tran.TransactionDate, tran.TransactionType, tran.Description, tran.TransactionAmount);             }             table.Options.EnableCount = false;             table.Write();             Utility.PrintMessage($  "You have performed {_listOfTransactions.Count} transactions.", true);         }     }      public void InsertTransaction(Transaction transaction)     {         _listOfTransactions.Add(transaction);     }      private void ClearSession()     {         // No session is used in this version.     }  } 

Any comment on the my coding style and design pattern? My concern is the ThirdPartyTransferForm() method in AtmScreen class. How should I split the UI nicely in this class? Another major issue I notice is that because ATMApp class implement the interface directly, if client code want to run this ATMApp application, those interface methods will be ‘open’ as well which is not supposed to be.

Sample out the program output is in this link but this video is the older version – https://www.youtube.com/watch?v=JViV7a0ALFY&list=PLIh_aKrRpW7QMaO9o7xxmasz0pvvvEoU-&index=9

I will upload the latest version very soon.

is there a way to dump android user gesture to adb console?

I am trying to dump android user gesture such as touch screen (x,y) sweep screen (x1,y1,x2,y2) to adb console?

per doc, adb shell dumpsys could be used for this.

this command

adb shell dumpsys input 

gives an one-shot output, run command one time, dump a piece of output. what I need is like this,

when I touch somewhere on screen, adb dump touch x,y, when I sweep, adb dump sweep x1,y1,x2,y2

Is there a way to do this?