Tuesday, September 18, 2018

What the Heck? starting nginx gives duplicate entry and fails to start

Below was the error that is spit by the nginx


nginx: [emerg] duplicate location "/ms" in /etc/nginx/sites-enabled/':56

The reason is that while editing the default file, the vi editor seemed to have created a copy of the file and saved in an unstable state. the name was ' .. to remove this file, had to do the below 

sudo rm -rf \' 

then starting the server did the trick, 

the link in reference section contains the similar issue. 

references
https://www.digitalocean.com/community/questions/nginx-config-error-emerg-1226-0-duplicate-location 

iOS Siri Shortcuts - Basics

With shortcuts, users can access features of your app from places such as Spotlight search, Lock Screen, and the Siri watch face. With phrases, users can speak to Siri to access your app’s features.

Application can provide custom intent on a set of categories. This is done by adding an intent definition file to the project. A custom intent can define a set of parameters to accept and it can also define a type of response. Custom intent can also be marked for background execution. To use the details given in the custom intent definition file, app needs to define intent code.

To use custom intent in the app, Xcode need to generate the source code for the items defined inthe intent definition file. However, apps having the shared framework, the code generation should happen only for the shared framework, To specify which target has the generated source code, use the Intent Classes setting in the Target Membership panel. all other targets use the No Generated Classes setting.

Before Siri can suggest shortcuts to the user, the app must tell Siri about the shortcuts through intent donations.

private func donateInteraction(for order:Order) {
   let interaction = INInteraction(intent:order.intent, response:nil)
   interaction.identifier = order.identifier.uuidString
  
   interaction.donate { (error) in
       if (error == nil) {
        //no error. Interaction donation is successful. Great
    }
   }
}

The identifier can be used to cancel the intent if the user cancels the order.

Next task is to Handle the shortcut. Inorder to handle the shortcut, app provides an app extension, which handles the intent in background. When the app must be launched to handle the intent, the app is launched by the App Delegate call back below

override func restoreUserActivityState(_ activity : NSUSErActivity) {
    if(activity.activityType == NSUSerActivity.orderCompleteActivityType) {
       // this is order complete activity.
    }
}

All of the above was just about shortcut that appear in different places. How about if we could add a voice command to it? This can be done by adding custom voice phrases. This can be done by going to the app settings or even from the app following the below

Let addButton = INUIAddVoiceShortcutButton(style:.whiteoutline)
addShortcutButton.shortcut = INShortcut(intent:order.intent)
addShorcutButton.delegate = self





references:
https://developer.apple.com/documentation/sirikit/soup_chef_accelerating_app_interactions_with_shortcuts



How to do 'npm start' with pm2?

Below is the command to do this


pm2 --name "ms-stage" start npm -- start

by providing the --name , it appears in the list of pm2 items neatly.

references:

Why Does Xcode 10 complain libstdc++ is not present?

the libstdc++was deprecated quite sometime back. Instead, one should be using libc++ from the build phases. The problem is when there is a library that uses this framework. In that case, should get an updated library that uses the libc++.

A detailed discussion around this can be found at the link given in the references

references:
https://forums.developer.apple.com/thread/103732

Saturday, September 15, 2018

What is IRSF (International Revenue Sharing Fraud)






references:
https://www.slideshare.net/JeanMarieGandois/understanding-irsf-fraud-english

What is DSCP?

If possible, one should also take advantage of the DSCP support . DSCP, or Differentiated Services Code Point allows packets to be tagged to prioritize them on the network. Browsers that support DSCP are capable of tagging call media packets sent by the Client in this manner. Your router or network element can then use these tags to prioritize call media packets over other traffic on the network. Also, note that your router or network element needs to also be DSCP-compliant. DSCP is currently supported only by Google Chrome currently, and setting DSCP on Windows machines does not currently work. 

Friday, September 14, 2018

The Flutter Widget Framework

The minimal flutter app looks like the below
Import package:flutter/material.dart

void main(){
   runApp(
       Center (child:Text("Hello world",textDirection:TextDirection.ltr)
        )
    )
}


The runApp take given widget and makes it as the root of the widget. The framework forces the root widget to cover the screen in which case Center which is a widget is converting the entire screen.

When writing the app, one will commonly author new widget by subclassing either Stateless Widget or Stateful widget. A widget's main job is to implement a build function which describes the widget in terms of other, lower-level widgets.

References:
https://flutter.io/widgets-intro/