Triggering Text Message on sales_order_shipment_track_save_after via Shipstation

I am attempting to set up a custom trigger so that when Shipstation writes back it sends out a text message via Twilio. I have it working when adding a tracking number from the admin side but does not appear to work when adding tracking number through Shipstation (I am assuming it is using Magentos API). Is there a different event I should be listening to for this?

etc/events.xml

    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="sales_order_shipment_track_save_after">     <observer name="mywebsite_model_observer_textshipment"         instance="MyWebsite\Customizations\Model\Observer\TextShipment" /> </event> 

namespace MyWebsite\Customizations\Model\Observer;  use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\Sales\Api\Data\ShipmentInterface; use Magento\Sales\Api\Data\ShipmentTrackInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Twilio\Rest\Client;  /**  * Class Shipment  */ class TextShipment implements ObserverInterface {     protected $  _logger;      public function __construct(\Psr\Log\LoggerInterface $  logger) {         $  this->_logger = $  logger;     }      /**      *      * @param Observer $  observer      * @return void      */     public function execute(Observer $  observer)     {         $  track = $  observer->getTrack();         $  shipment = $  track->getShipment();         $  order = $  shipment->getOrder();         $  shippingAddress = $  order->getShippingAddress();         $  telephone = $  this->makePhoneNumberValid($  shippingAddress->getTelephone());         $  trackUrl = $  this->getTrackingUrl($  track);         $  countryId = $  shippingAddress->getCountryId();         $  firstName = $  shippingAddress->getFirstname();          $  initialGreeting = '';          if($  firstName == '' || $  firstName == null){             $  initialGreeting = 'Hello <MyWebsite> Customer of the Year! ';         }else{             $  initialGreeting = 'Hi '. $  firstName .'! ';         }          $  objectManager = \Magento\Framework\App\ObjectManager::getInstance();         //$  notifier = $  objectManager->create('Magento\Shipping\Model\ShipmentNotifier');         //$  notifier->notify($  shipment);           if($  countryId == "US" && $  telephone != null && $  trackUrl != ''){             // Your Account SID and Auth Token from https://www.twilio.com/console             $  accountSid = "<AccountSID>";             $  authToken = "<Auth>";              $  serviceSid = "<ServiceSID>";              // Initialize the client             $  client = new Client($  accountSid, $  authToken);              //$  this->_logger->debug($  telephone . ' telenumber');                // Create a notification             $  client->messages->create(                 // the number you'd like to send the message to                 '+1'.$  telephone,                 array(                     // A Twilio phone number you purchased at twilio.com/console                     'from' => '+<Twilio Number>',                     // the body of the text message you'd like to send                     'body' => $  initialGreeting . ' Your MyWebsite order has shipped!! You can track it through the following link, ' . $  trackUrl . '. It has been a pleasure serving you and look forward to your return. With Love, MyWebsite'                 )             );         }      }      public function getTrackingUrl($  track){          $  trackurl = '';         if($  track->getCarrierCode() === 'fedex'){             $  trackurl = 'https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber='.$  track->getNumber();         }elseif ($  track->getCarrierCode() === 'usps') {             $  trackurl = 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1='.$  track->getNumber();         }elseif ($  track->getCarrierCode() === 'ups') {             $  trackurl = 'https://wwwapps.ups.com/WebTracking/returnToDetails?tracknum='.$  track->getNumber();         }         return $  trackurl;     }      public function makePhoneNumberValid($  number){         if($  number == null){             return $  number;         }           $  patterns = array();         $  replacements = array();          $  patterns[] = '/-/';         $  patterns[] = '/\(/';         $  patterns[] = '/\)/';         $  patterns[] = '/\+01/';         $  patterns[] = '/\+1/';         $  patterns[] = '/^$  /';          for ($  i = 0; $  i < 6; $  i++) {             $  replacements[] = ' ';         }          $  number = preg_replace($  patterns, $  replacements, $  number);          if($  number == "0000000000"){             return null;         }          return $  number;     } } ......  

Batch search and replace text in PDF

I am trying to do a batch find and replace in PDF files. Goal is to search for SKUs in a supplier’s catalog and replace it with our sales price. Result does not have to look nice, as long as it works 95% of the time.

For instance looking for “PRODUCT9522” and replacing it with “PRODUCT9522 – 95.20E”

I tried several options, like uncompressing the PDF with pdftk and then searching and replacing with sed, but that did not work. Some windows tools did work to some extent, but not exactly like I wanted them to.

I would really appreciate your expertise on this matter.

how to drag and drop word by word and drop into each edit text place of same activity ..plz help i am facing problem [on hold]

@Override public boolean onDrag(View v, DragEvent event) {     int action = event.getAction();     switch (action) {          case DragEvent.ACTION_DRAG_STARTED:             // dx = v.getX()-event.getX();           //  dy = v.getY()-event.getY();                if (event.getClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {             //    v.setX(event.getX()+ dx);             //    v.setY(event.getY() + dy);                 return true;             }             return false;          case DragEvent.ACTION_DRAG_ENTERED:             v.invalidate();             return true;          case DragEvent.ACTION_DRAG_LOCATION:              return true;          case DragEvent.ACTION_DRAG_EXITED:             v.invalidate();             return true;          case DragEvent.ACTION_DROP:              ClipData.Item item = event.getClipData().getItemAt(0);             // Gets the text data from the item.             String dragData = item.getText().toString();             // Displays a message containing the dragged data.             Toast.makeText(this, "Dragged data is " + dragData, Toast.LENGTH_SHORT).show();             v.invalidate();              View vw = (View) event.getLocalState();              ViewGroup owner = (ViewGroup) vw.getParent();             owner.removeView(vw); //remove the dragged view             ConstraintLayout constraintLayout = (ConstraintLayout) v;             constraintLayout.addView(vw);              vw.setVisibility(View.VISIBLE);//finally set Visibility to VISIBLE             //Returns true. DragEvent.getResult() will return true.             return true;           case DragEvent.ACTION_DRAG_ENDED:             v.invalidate();              if (event.getResult())                 Toast.makeText(this, "The drop was handled.", Toast.LENGTH_SHORT).show();             else                 Toast.makeText(this, "The drop didn't work.", Toast.LENGTH_SHORT).show();             return true;         // An unknown action type was received.         default:             Log.e("DragDrop Example", "Unknown action type received by OnDragListener.");             break;     }     return false; } 

Why does YouTube disable the comment button until text has been entered?

YouTube disables the comment button by default, and only enables it once text has been entered:

Before: enter image description here

After: enter image description here

The general consensus on ux.stackexchange.com is to not disable submit buttons and wait to present errors until after the user has hit the submit button.

  • Form validation and disabled buttons
  • Disabled submit button on form vs allow submit then show errors?
  • Disabling submit-button until the user has completed the form

Does this mean YouTube is going against best UX practices? What would be the reason for this?

How to increase character limit of text field in Magento 2?

I am using Magento 2.1.9

I have one attribute named “Features”. Values for this attribute are coming from Lightspeed pos and input type for this attribute is a text field. Light speed doesn’t provide a text area for this attribute.

I want to increase the character limit for this field in admin. Right now the limit is 255 chars. So, how can I increase this limit?

Jquery text() doesn’t want to work with append(); [on hold]

for (let i = 0; i < json.length; i ++) {                         let color = $  ("td#color"+i).text();                                                 let img = 'img/';                                                 $  ("td#color"+i).text('').append(`<img src="img/$  {color}.png" class="p-2">`);                         };  

The code should loop through tds of the table and changes the text of “black”, “white”, etc. into pictures by getting the text data with text() and appending it to the td with a unique ID. But in reality it shows only the last color (with a picture), but all the previous are erased.

$  .getJSON("https://rawgit.com/Varinetz/e6cbadec972e76a340c41a65fcc2a6b3/raw/90191826a3bac2ff0761040ed1d95c59f14eaf26/frontend_test_table.json", function(json) {                                  $  ('#table-cars').append("<tbody id='car-list'>");                 for (let counter = 0; counter < json.length; counter++) {                     $  ('#table-cars').append("<tr class='main-text table-body-bg'><td id='fix" + counter + "'>" + json[counter].title + "<br/>" + "<span class='sub-text'>" + json[counter].description + "</span>" + "</td>"                     + "<td class=main-text'>" + json[counter].year + "</td>"                      + "<td id='color" + [counter] + "' class='main-text color'>" + json[counter].color + "</td>"                      + "<td id='status" + [counter] + "' class='main-text'>" + json[counter].status + "</td>"                      + "<td class=main-text'>" + json[counter].price + " руб." + "</td>"                      + "<td class=main-text'>" + "<button class='delete' onclick='$  (this).closest(`tr`).remove();'>Удалить</button>" + "</td></tr>");                     // COLOR TEXT REPLACEMENT                         // Valid code, but doesn't work. Don't know why.                          // If you can - give me a hint.                          // The culprit is the "color" variable.                          // Only the green color works. If you change it - EVERYTHING WORKS AS INTENDED.                          for (let i = 0; i < json.length; i ++) {                             let color = $  ("td#color"+i).text();                                                     let img = 'img/';                                                     $  ("td#color"+i).text('').append(`<img src="img/$  {color}.png" class="p-2">`);                             };                     //Ugly code that works straightaway                                             // const img = 'img/';                                           // $  ("td#color0").html(`<img src='$  {img}red.png' class='p-2'>`);                     // $  ("td#color1").html(`<img src='$  {img}white.png' class='p-2'>`);                     // $  ("td#color2").html(`<img src='$  {img}black.png' class='p-2'>`);                     // $  ("td#color3").html(`<img src='$  {img}black.png' class='p-2'>`);                     // $  ("td#color4").html(`<img src='$  {img}green.png' class='p-2'>`);                     // STATUS TEXT REPLACEMENT
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <table id="table-cars" class="table"> 		<thead> 			<tr> 				<th class="table-header table-width-40 corner-top-left-rounded">Название</th> 				<th class="table-header">Год</th> 				<th class="table-header">Цвет</th>                 <th class="table-header w-25">Статус</th>                 <th class="table-header w-25">Цена</th>                 <th class="table-header corner-top-right-rounded"></th>                 			</tr> 		</thead>     </table>     <script>         $  (document).ready(getJSONData());     </script>

Can I install GNU/Linux in text mode on android?

I want to use my old smartphone (Moto 3G) like Rassbery Pi to make some low level things with just terminal. I want to install GNU/Linux in text mode, get access to it with SSH, get connection to Internet and have possibility to type in installed system with onscreen keyboard like in android.

Important thing is that, I want to FULLY remove android and install GNU/Linux in this place. I don’t care about SMS, Phone calls etc. ( But things like camera handling, and way to see battery status, playing/recording sounds, or changing screen brightness of the screen are nice to have).

Is there any distribution that can satisfy me? And how can I install chosen system instead of android?